back to article Everyone loves programming in Python! You disagree? But it's the fastest growing, says Stack Overflow

Python, which ranks consistently as one of the most popular programming languages, is the fastest growing major programming language, according to coding community site Stack Overflow. Stack Overflow's metric here is visits to website posts tagged "Python" compared to posts tagged with other programming languages – …

    1. The Indomitable Gall

      Ah, yield... generator functions are great.

      A couple of years ago I was trying to do some text generation that included multiple correct solutions. As a total hack, I took my object model and added a toProlog method to each object and yes, seriously, I had part of the code convert everything to Prolog and then ran the search in Sicstus. It was a monumentally crazy hack and led to weeks of debugging. When I later realised that by shoving a yield statement and iterating on all results from the generator functions called from each function, I could do exact same thing in Python much quicker and with far fewer lines of code.

      Generator functions are a good example of a core element of the Python design philosophy -- it enables you to work with datasets of virtually unlimited size, producing ad hoc code to process them.

  1. a_yank_lurker

    Usefulness

    Python has a couple of traits that make it very useful for those who program as a secondary function. Its syntax is relatively easy to understand, it has a lot of very good libraries available, and being an interpreted language it is easy to experiment with code to see what a fragment will do. Plus, it is not 'teaching' language like Basic or Pascal. It was designed to a general purpose language suitable for a wide range of programming problems.

    But like any programming language there are areas that it sucks at.

    1. Pete 2 Silver badge

      Re: Usefulness

      > But like any programming language there are areas that it sucks at.

      Although I use it a lot, I cannot respect a language where white space is a critical part of the syntax.

      Move a line of code in or out by a space or two and it either becomes part of a preceding conditional clause, or is removed from it.

      As for "pythonic"? In my book, if the code works, it works. Who cares whether it conforms to the "right" way of doing it.

      1. Eponymous Cowherd
        Facepalm

        Re: Usefulness

        As for "pythonic"? In my book, if the code works, it works. Who cares whether it conforms to the "right" way of doing it.

        The poor fuckers who have to maintain your pile of shite code after you've been sacked, that's who!!!

        1. Ken Hagan Gold badge

          Re: Usefulness

          "The poor fuckers who have to maintain your pile of shite code after you've been sacked, that's who!!!"

          Matters of formatting can be sorted by automatic tools. Matters of implementation style are no more subtle in python than in any other language. The fact that the python community has coined the word pythonic when few other languages have coined anything similar is interesting from a social point of view but of no technical importance. I concur with the OP: Who cares whether it conforms to the "right" way of doing it.

          1. Tomato42
            Facepalm

            Re: Usefulness

            "Matters of formatting can be sorted by automatic tools."

            right, because checking out the code, formatting it to way you're used to, hacking on it and then reformatting it to the library/application standard before preparing pull request is such a convenient way to work.... /s

            "Matters of implementation style are no more subtle in python than in any other language."

            so you're saying that the automatic deformatting and reformatting may not work as painlessly as you're claiming? No wonder you are so irritated by people following a consistent standard that is just different to what you like...

            "The fact that the python community has coined the word pythonic when few other languages have coined anything similar is interesting from a social point of view but of no technical importance."

            Yes, other communities have things like IOCCC.

            when you are working on software, it inevitably will grow and thus require new libraries, it's nice when that library has the same formatting and style as the code you work on every day. Makes it easier to fix issues and submit patches to it.

            "I concur with the OP: Who cares whether it conforms to the "right" way of doing it."

            Except there have been multiple studies that readability of code _matters_ and while no specific way to format code is better than other, _consistency_ matters.

            So, I can only feel sorry for people that will have to work on your code after you've been sacked.

            1. FatGerman

              Re: Usefulness

              >> Except there have been multiple studies that readability of code _matters_

              Yes it does. That's why there are different types of brackets used to delimit segments of code in every single other bloody language. It's clear and obvious and any editor worth using will do bracket matching so you can always tell at a glance which block of code you're working in.

              Python, especially when you have to follow that ridiculous 80-column rule, might as well be random ASCII in comparison. I loathe it. The fact that it's actually quite useful means lots of people are prepared to overlook that, but it would be so much better if they'd just use some { }.

              1. bombastic bob Silver badge
                WTF?

                Re: Usefulness

                "it would be so much better if they'd just use some { }"

                yeah but if THAT happened, then a bunch of K&R extremists would put '{' on the same line as the control statement, and use syntax like "} else {" and it would drive ME (even more) insane, requiring me to re-format the code just so that I could read it... and YES, I do that. A *LOT* [even with JAVA code, take THAT you K&R extremists!]

                I deliberately re-do the IDE settings in the Android IDE to look like Allman style. Then I set it as the project default. Then I reformat things as I go over stuff, or if I'm particularly frustrated, auto-reformat everything [once the right settings are in place]. I also get rid of the hard tabs, too, spaces only.

                Anyway, those who aren't familiar:

                https://en.wikipedia.org/wiki/Indent_style#Allman_style

                And, in many ways, Python kinda reminds me of Allman Style. So yeah, let's leave it as-is.

                [lousy coding practices and ABuse of "objects" and "signals" and member functions 3 miles deep and everything promiscuously playing with every other object's stuff are bad enough, but at least the pure language syntax is readable from a scoping perspective - the CRAP code itself can be dealt with in the usual manner. And I shouldn't need to reformat it in order to read it]

              2. david 12 Silver badge

                Re: Usefulness

                > but it would be so much better if they'd just use some { }.<

                After a while, I realized that one of the reasons I prefer Pascal and BASIC is because I'm a left-handed touch-typist.

            2. Ken Hagan Gold badge

              Re: Usefulness

              You can automate the re-formatting on checkout and checkin and if you work in a team that makes this a requirement then you wouldn't be much of a programmer if you didn't automate it.

              The IOCCC contest is also of social interest but I'm not aware of anyone working professionally who writes that way. Likewise, if you deliberately indent something in C or C++ to align with the wrong block (the equivalent of adding space in Python) it will compile fine but you can expect a visit from your colleagues on the next dark night. Demanding that whitespace indentation corresponds to the actual block structure is an informal-but-rigid requirement in every (text-based) programming language I've ever used. Python actually bothers to enforce it, but even C and C++ enforce it if you have lint-like warnings on your compiler.

              As regards external libraries, perhaps you missed the bit where re-formatting was automated. If it bothers you, reformat it, but actually I suspect that you will get used to all the styles that are common in your language and switch seamless from one to the next as you step through the debugger. The rest of us did at some point in our careers.

              No-one is suggesting that multiple styles should be mixed within a given section of the codebase. (I bet that's what the "studies" were looking at, though. I've read plenty of "studies" in my time that I wouldn't wipe my arse with.) To assert that consistency is required across *all* code would be a much less plausible study result. It would, for one thing, be a compelling argument for never using more than one language in a project, which is certainly a proposition that people will dispute. It would also be an argument about never writing Windows programs in C or C++, since the Win32 and CRT house styles are different.

              In the real world, outside of academia and internet flame wars, "readability" is not a matter of formatting or any other stylistic metric. It is about whether things have identifiable names, whether the algorithms are clear, whether things are done in the obvious order, whether violations of the first three are properly justified in an obvious fashion either in the code or in documentation, and whether those comments and that documentation are actually kept in step with the code. Your compiler can't check that, but by god it's important!

              1. Adrian 4

                Re: Usefulness

                Presumably it's possible to script checkin/out of python so you can have it readable (with whitespace) in the repo and editable (with sane, visible block markers) in the editor ?

            3. Vanir

              Re: Usefulness

              @Tomato42

              <Except there have been multiple studies that readability of code _matters_ and while no specific way to format code is better than other, _consistency_ matters.>

              Not the whole truth. Equating readability of code with consistent formatting is not consistent with what a professional developer encounters in their day-to-day routine.

              Code bases and coding guidelines. If a coder only deals with one code base and it's ordained style then they will find it jarring if they have to read and understand another code base written in another 'style'. A professional programmer should not have any difficulity with different code formatting styles.

              A C++ contractor doesn't have a choice in this going from company to company with differing formatting styles. And don't professionall programmers read and have to understand open source code bases with different styles in their working day?

              Readability and understandability of code is not just an issue of code formatting: is it?

              Low coupling and high cohesion are 2 properties of a code base that promote understanding of it.

              In C/C++ one could be nasty and strip out everything but the tokens: the misuse of maximal munches, I admit, would be a challange to find in this formatting style.

              1. bombastic bob Silver badge
                Headmaster

                Re: Usefulness

                "Readability and understandability of code is not just an issue of code formatting: is it?"

                actually, it is. high level management, "dive in without seeing it before" contractors, and people who don't want to read piles of docs before getting something done, prefer "readable code".

                The most readable style of all is Allman Style. It has a lot of white space in it, which means that you can clearly see where the boundaries are. It works best if you enforce curly braces around things like this:

                if(something)

                {

                ....do_this();

                }

                (using dots instead of white space - the editor doesn't represent them properly)

                even though a lot of people might be tempted to:

                if(something) do_this();

                The first example is MORE READABLE. A coder might not like it because it "takes up too much space on the screen" but too bad. For someone skimming code [not reading every! single! line! and! detail!] it's a LOT easier to see things this way. It's *EFFICIENT* in other words, for reasons not obvious to the K&R fascists nor to the hard-tab nazis. Oh yeah, no hard tabs either. Then your tab settings won't affect what it looks like...

                /me wants to be able to view it with 'less' and have everything line up EXACTLY! THE! SAME! as it does in an IDE, or a simple editor like 'nano', or a GUI editor like 'pluma', or something like vi, or whatever.

                graphic being 'style nazi' alert this time

          2. Down not across

            Re: Usefulness

            he fact that the python community has coined the word pythonic when few other languages have coined anything similar is interesting from a social point of view but of no technical importance. I concur with the OP: Who cares whether it conforms to the "right" way of doing it.

            I concur. Bunch of elitist bullshit really.

            Perl: TIMTOWTDI

            Python: There should be one — and preferably only one — obvious way to do it.

            No wonder I prefer perl where what matters is that the task gets done, rather than getting hung up on how exactly.

            As for whitespaces...yeah it worked for COBOL but at least there was a reason (punch cards) for it and AFAIK no modern compiler actually insists on that any more.

        2. Pete 2 Silver badge

          Re: Usefulness

          > The poor fuckers who have to maintain your pile of shite code after you've been sacked, that's who!!!

          Any "support" coder who is only able to understand software that is written in one particular way is never going have either the flexibility to understand that "there is more than one way to do it", nor would they be experienced enough to reliably do general purpose software support.

          One trick ponies!

      2. Anonymous Coward
        Anonymous Coward

        Re: Usefulness

        @pete 2

        I sympathise with your position. But I'm from a Java, PHP and Perl background, and more recently moved to Python - It was (still is) a learning curve. But I can honestly say, its a breathe of fresh-air for me, the code is just naturally clean and easy to read.

      3. Wensleydale Cheese

        Re: Usefulness

        "Although I use it a lot, I cannot respect a language where white space is a critical part of the syntax."

        In my early career I used programming languages where certain things had to go in certain columns (Fortran IV & 77, Cobol, and even more so RPG II), I really can't get worked up about this. Yes, it's different, but with some applied thought, it really isn't so difficult to comprehend.

        "Move a line of code in or out by a space or two and it either becomes part of a preceding conditional clause, or is removed from it."

        BTDT, but the run time diagnostics usually catch the mistakes I make. Regular commits with a version control system have saved a lot of grief there.

        Also note that on the Mac platform, both TextWrangler and BBEdit give you the ability to take a time-stamped snapshot every time you save a file (not enabled out of the box - see Preferences -> Text files -> Backups for that). This is invaluable for those files which don't justify their own version control environment, although I'm increasingly finding myself using version control in areas I traditionally didn't (e.g, system configuration files).

        1. Long John Brass
          Gimp

          Re: Usefulness

          @Wensleydale Cheese

          RPG-II

          I feel your pain. I remember using that god awful code ruler on program listings.

          When I was young and stupid (as opposed to now; old and stupid) I had RPG-II buried in the fine print at the end of my CV. I had agents contantly calling asking if I was interested in RPG-II work... That was 10+ years since I had last touched it! Have long since removed the offending line, Don't need that amount of suffering in my life.

      4. a_yank_lurker

        Re: Usefulness

        @pete 2 - The Python formatting rules for blocks actually mirror what is consider good programming style in other languages. Where I work our default formatting is identical to the Python indentation for blocks. This is done to make following programming logic and scope easier to follow. All Guido did was to take best practice and make it a requirement for identifying block scope.

    2. Jason Hindle

      Re: Usefulness

      "Python has a couple of traits that make it very useful for those who program as a secondary function."

      That would be me. I was originally a programmer by training, but it's now an occasional part of the job. Sure, I recently learned some Java for a specific set of tasks (nice enough language, btw), but Python is becoming the language I use when I just want to get stuff done.

      I'm not sure if it's a good language for the beginner though. Call me old fashioned, but a good set of training wheels should be strongly typed.

  2. Anonymous Coward
    Anonymous Coward

    Perl or bust!

    1. jrd

      Re: Perl or bust!

      Perl - a solution to every problem.

      Unfortunately, never the best solution to any problem...

    2. Dr_N

      If it can't be done in SED, AWK or GREP, walk away.

  3. To Mars in Man Bras!
    Thumb Up

    Best Description I Ever Read of Python....

    ..was:

    "It's like pseudo-code that runs"

    As a non-professional programmer who, every now and then, has to knock something together to accomplish a repetitive, long or tedious process, I love that aspect of Python.

    I don't code regularly enough for huge chunks of the syntax, outside of the basics such as conditionals, loops, functions, etc to stick in my brain. But, most of the time, I can pretty much cobble together something that works well enough for my needs in pretty short order, because the syntax is so straightforward and there are usually already lots of modules out there which do all the things I need to do.

    Very often, all I'm left with is the task of lashing a couple of modules together with string and sealing wax and setting it running.

    1. Naselus

      Re: Best Description I Ever Read of Python....

      "As a non-professional programmer who, every now and then, has to knock something together to accomplish a repetitive, long or tedious process, I love that aspect of Python."

      This. Python's a great language for people who aren't programmers and never intend to become full-time programmers. I'm a systems engineer; I can knock shit together in Python fairly quickly and easily. I know network engineers who learn it. Hell, I know architects - not systems architects, actual building architects - who have learned a bit of python to help with scripting in Revit. Actual programmers who specialize in Python as their main job? Not so much.

      And this is precisely the demographics which you'd expect to see lots of posts on Stack Overflow from - people with no formal training in coding, looking to do small things in addition to a main job that has little to do with writing programs, who lack the tools to work out how to do various things for themselves. It'd be interesting to see some metric of relative task complexity being asked about in the posts; I'd be willing to bet Python's volume of posts is matched by a relative simplicity in the questions being asked compared to, say, C++.

      1. Paddy

        Re: Best Description I Ever Read of Python....

        > I'd be willing to bet Python's volume of posts is matched by a relative

        > simplicity in the questions being asked compared to, say, C++.

        That might just tell you that, say, C++ solutions are overly complex.

        There are a fair amount of scientists and engineers with gravitons to detect and medicines to design, etc, that use Python because the easy learning curve leaves them room to think more of their problem and its solution, rather than needing to become computer scientists (and so asking your famed "difficult" stackoverflow questions).

      2. Tom 38

        Re: Best Description I Ever Read of Python....

        Python's a great language for people who aren't programmers and never intend to become full-time programmers. I'm a systems engineer; I can knock shit together in Python fairly quickly and easily. I know network engineers who learn it. Hell, I know architects - not systems architects, actual building architects - who have learned a bit of python to help with scripting in Revit. Actual programmers who specialize in Python as their main job? Not so much.

        Well this is just wrong. Python's ease of use for the novice is a benefit for the pro as well. It is an extremely expressive language that allows you to write a lot of functionality with a small amount of code. You can prototype faster in python, and the expressiveness means that refactoring is simple and, if following the pythonic style, simple.

        The speed of python is not really relevant in most scenarios as anything cpu intensive can be written as a C extension, with a pythonic API added over the top. This usually makes the underlying library much easier to use, for instance it is much easier (less typing and clearer to the reader) to write XML and XPath manipulations using the python lxml library than it is to use libxml2 in C, but the speed of operation of both is virtually identical - python is just the plumbing around the boiler.

        I don't think the criticism of the python open source libraries is particularly fair, as it applies to all languages with lots of open source libraries; you have to assess the quality and reliability yourself before using it. There are a lot of rubbish ones, but there are a lot of good ones also.

        PS: The term "pythonic"; lots of people don't seem to like it, but this is what it stands for (verbatim from the language spec):

        * Beautiful is better than ugly

        * Explicit is better than implicit

        * Simple is better than complex

        * Complex is better than complicated

        * Readability counts

        Argue against any of those points..I'm guessing bob will try

  4. CAPS LOCK

    dBase II...

    ...dBase II -> dBase 3 -> dBase 3+ -> dBXL -> Clipper Summer '87 -> FoxBase Xenix -> MS FoxPro Unix

    -> Harbour.

    1. kmac499

      Re: dBase II...

      OOh I loved Clipper.. I'm sure the comp-sci crew on here will be running for their pitchforks screaming "injection risk" but the ability to have scraps of code as text in the database which can be read in, dropped into a code block and executed was wonderful.

      Multidimensional nested non typed arrays that could be constructed at run time, mimicing the discovered data structures not just parent child but multiple childrren as you walked the tables.

      The -> operator with variables for the table name so you could access other tables at will

      The simplicity of @SAY..GET with pre and post validation

      NOW that was power.

    2. Anonymous Coward
      Anonymous Coward

      Re: dBase II...

      @CAPS LOCK

      I've often wondered just how much xBASE code is out there in 2017. The problem seems to be that xBASE applications have lots of names (like the list in your original comment). There are quite a few others: dBase-IV, dBase-V, xHarbour, clip, FlagShip, Visual FoxPro, dBFast.....

      *

      So how much xBASE code is still out there, live and being maintained? Any ideas?

      1. Anonymous Coward
        Anonymous Coward

        Re: dBase II...

        16k.

      2. Nick Ryan Silver badge

        Re: dBase II...

        IMHE there is a lot of (x)base code still out there. On one hand, forced obsolence is crippling a lot of it with code no longer operable on modern systems (actually, a bad reflection of modern systems) but far too much of it is suffering because it was written by people who should never be let near a keyboard, let alone an applictaion/database system.

        So it's great because it was accessible to many people while simultaneously not being great for the same reason... :)

      3. CAPS LOCK

        Re: dBase II...

        >how much xBASE code is still out there, live and being maintained?

        Round my gaff? 100%, thanks to Harbour. Cross platform, 32 bit and 64 bit. Perfect Clipper compatibility. What's not to like. Harbour deserves to be better known.

  5. Tom 7

    Computing languages are easy.

    Its computing that's a bit of a bugger.

    1. Anonymous Coward
      Anonymous Coward

      Re: Computing languages are easy.

      Indeed. Learning the Russian alphabet - easy. Reading War and Peace - not so easy.

  6. Anonymous Coward
    Anonymous Coward

    Python courses plug stack overflow

    I've taken a couple of python courses just because it was something I didn't know. Both of them suggested stack overflow as a good place to ask questions.

    So it's hardly surprising that stack overflow gets a lot of python questions.

  7. Old Used Programmer

    Another contributing factor?

    One might well wonder if 15 million Raspberry Pis has anything to do with the popularity and spread of Python.

    1. Jason Bloomberg Silver badge
      Pint

      Re: Another contributing factor?

      The Pi is what finally pushed me into using Python. I then discovered Python is an excellent "write once, run anywhere" environment; just copy the source code over and, as long as Python and any required libraries are installed, it mostly just works. There are a few platform specifics but not that many and not that hard to overcome.

      It's not perfect; forgetting a closing parenthesis on one line can cause a misleading and time consuming syntax error on the next, a simple typo in a variable assignment can sometimes be hard to chase down, not throwing the error until run-time can be annoying. Because of those and other debugging issues I am not convinced it's a great beginner's language.

      But overall 9/10.

  8. acid andy
    Devil

    "Fastest Growing"

    Does anyone else feel like smirking cynically every time they hear the phrase "fastest growing"? Even worse of course is "We're one of the fastest growing...". It's used whenever marketing types need to hype up their product but cannot claim it's the biggest or most popular.

    I mean, "one of the fastest growing" is basically meaningless. Even "the fastest growing" is meaningless if you don't know the context. When Python was brand new and went from zero users to one, that's an infinite rate of growth.

    Why stop at "fastest growing"? If you can't claim that about your product, how about "it boasts one of the highest second derivatives of growth rate".

    1. Ken Hagan Gold badge

      Re: "Fastest Growing"

      "When Python was brand new and went from zero users to one, that's an infinite rate of growth."

      I think I'd argue that the initial number of Python users was one, not zero, since it is a bit silly to assert that there are no users (yet) of a language that doesn't exist (yet).

      This approach also means that languages designed by committee experience slower initial growth than languages created by individuals, which strikes me as karma in operation right from the start.

    2. Vanir

      Re: "Fastest Growing"

      It's now called "Fake Growing".

  9. herman

    Actually, the stats mean that Python is so crap that people have to ask lots of stupid questions.

    1. Vanir

      Damn. I've been found out

      @Herman

      <Actually, the stats mean that Python is so crap that people have to ask lots of stupid questions.>

      As c++ coder having to learn Python I was going to put this question on SO's Python section.

      Does Python have a rule of zero?

      It will now have to be:

      Where's the best place to put '{' and '}'?

      1. disgruntled yank

        Re: Damn. I've been found out

        On either side of a list that you mean to be a dictionary...

  10. sambaynham

    Re: My thoughts on this ...

    I hope my own personal efforts have contributed to this in some small way. Why? Well, because whenever I'm asked 'My lad/lass is interested in programmng, what language should they learn first?', I always answer : 'Python. It'll teach them good indenting habits.'

    So far as I'm concerned, being a good n00b language is nothing to be ashamed of. I cut my teeth on PHP, but I wish it'd been Python.

  11. FlippingGerman

    Python was my first language, and since I'm not a professional coder it's still my most used. I think it's been a wonderful language to learn with, and has some truly wonderful mechanisms that make many things easy.

    That said, I don't like using it for moderately sized programs (i.e. longer than a few hundred lines) because I struggle to keep every last detail - like what type a function expects - in my head. A better IDE might help with that. Also decent error-checking such as gcc does - which presumably is difficult or impossible to do in Python - makes finding some types of bugs much easier.

    Alternative headline that StackOverflow could have come up with: Python is the hardest programming language around, and it's getting harder.

  12. McBread

    Nobody expects the Pythonese inquisition

    Here's an interesting talk on how and why Python has exploded in the astrophysics/astronomy field.

    https://www.youtube.com/watch?v=ZyjCqQEUa8o

    Somewhere in the middle he's got a plot of programming language references from science papers and Python takes off massively somewhere around 2010.

  13. rmullen0

    No thanks to any dynamic language

    Personally, I do not like dynamic languages. I would rather use something that has static type checking so that errors are found at compile time rather that at runtime. And I would rather use something that has proper intellisense support. The fact that Python is dynamic makes it a fail in my book.

    1. Tom 7

      Re: No thanks to any dynamic language

      The thing about Python is it borrows most of its libraries for 'big things' are from C++ or Fortran so type checking is done before it gets round to doing the grunt work.

      But if your types need checking then you can do that in python or most (any?) dynamic languages. Its all swings and roundabouts - the 1 second you save not having to declare a variable type in a dynamic language will be lost with hospitalisation due to the multiple injuries sustained from being hurled off the roundabout if you dont program safely.

    2. Day

      Re: No thanks to any dynamic language

      "proper intellisense support".

      That is not a programming language consideration.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Other stories you might like