Slashdot Mirror


Python 3.6 Released (python.org)

On Friday, more than a year after Python 3.5, core developers Elvis Pranskevichus and Yury Selivanov announced the release of version 3.6. An anonymous reader writes: InfoWorld describes the changes as async in more places, speed and memory usage improvements, and pluggable support for JITs, tracers, and debuggers. "Python 3.6 also provides support for DTrace and SystemTap, brings a secrets module to the standard library [to generate authentication tokens], introduces new string and number formats, and adds type annotations for variables. It also gives us easier methods to customize the creation of subclasses."
You can read Slashdot's interview with Python creator Guido van Rossum from 2013. I also remember an interview this July where Perl creator Larry Wall called Python "a pretty okay first language, with a tendency towards style enforcement, monoculture, and group-think...more interested in giving you one adequate way to do something than it is in giving you a workshop that you, the programmer, get to choose the best tool from." Anyone want to share their thoughts today about the future of Python?

187 comments

  1. Have they added curly braces yet? by Snotnose · · Score: 0, Flamebait

    Cuz IMHO using whitespace to define blocks is brain dead.

    1. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 5, Insightful

      Python enforces a single form and this is its strength. It makes everyone write readable code. I know this vexes the special snowflakes but it is for the greater good.

    2. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 1

      I thought so at first too, but enforcing indentation by making it the block defining element increases readability a lot.

    3. Re:Have they added curly braces yet? by Zelig · · Score: 5, Insightful

      Syntactic whitespace makes me twitch, too; but it neatly resolves many of the codestyle hubbub issues you see in other language environments.

      If your editor helps you do the right thing, it's just an aesthetic whine, and shouldn't be worth arguing about.

    4. Re:Have they added curly braces yet? by Waffle+Iron · · Score: 1

      Derp!

      Der took er berces!!

      Derp!!!

    5. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 1

      Can we please retain "special snowflake" to refer to gender specials and liberal arts majors who think $100k of debt entitles them to a well paid job, and not debase the phrase by wheeling it out every time someone complains.

    6. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 1

      Complain some more you special snowflake.

    7. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Can you name a single open source project of any reasonable size where the founder knows the intricacies of every single component?

    8. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Cuz IMO using whitespace to define blocks is brain dead.

      ftfy

    9. Re:Have they added curly braces yet? by TeknoHog · · Score: 4, Insightful

      IMHO, curly braces are braindead (unless used in a math context to denote sets, which is the one true way). Now can I also get a +5 Insightful for my equally valid personal opinion?

      --
      Escher was the first MC and Giger invented the HR department.
    10. Re:Have they added curly braces yet? by Camel+Pilot · · Score: 1

      I have programmed in Perl for over 20 years... recently been learning Python and rather like the whitespace and newlines as part of the syntax... economy of expression. Also the OO syntax is less bolt on as it is in Perl and a breeze to implement and remember.

      What I don't like about Python is the v2 and v3 scism....

    11. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 1

      I'm still trying to figure out how the antiamerican 4chan trolls from 15 years ago have become the mainstream opinion of the "patriotic" American right of today.

      Fucksakes, I thought the NSA invented reddit to stem that from ever happening.

      If you just assume that the US Government, from the highest levels on down, is absolutely determined to fragment and destroy American culture while running its economy into the ground, then the behavior of its agencies suddenly makes a lot of sense. In fact it becomes predictable.

      Also, anyone referencing "patriotism" should be aware that a massive PR effort has been made against it. The old definition was "support what is best for one's country". The new definition is "support whatever its government wants". They are rarely compatible.

    12. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Most of Python is braindead. Now they're continuously shoving more and more features into the Python 3 version in a desperate attempt to get people to upgrade from Python 2. Guido himself couldn't tell you how most of the async features actually work.

      Guido? I remember Snookie constantly talking about how she doesn't want any Guidos or Juiceheads. I had no idea she disliked Python so much.

    13. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Even better, can the divisive language of the "alt-right" just die?

    14. Re:Have they added curly braces yet? by sjames · · Score: 5, Insightful

      Most written languages do exactly that, why not Python?

      It works just fine as long as you're not silly enough to use a word processor as a text editor.

      And if you're sensible enough to use tabs, you can even change the spacing to suit personal preferences and visual acuity.

    15. Re: Have they added curly braces yet? by mark-t · · Score: 4, Interesting

      Indentation improves readability. but the problem with using it to directly delimit logical blocks is that humans don't actually directly read whitespace, there can be something syntactically wrong with a program that is not visible to humans reading it because of a line that had a tab character in it instead of spaces, or vice versa, for example. While you can always convert tabs to spaces or vice versa in certain editors, this constrains what editing environments one should develop in, and ideally, languages should be designed to be agnostic to what features should necessarily exist in the editing environment that the programmer chooses.

      And related to this, doing python development, I cannot count the number of times I have accidentally had the wrong number of spaces on a line following an indented block, and at best the python environment complains about indentation levels right away, and at worst the mistake is not realized until I find that the program is not behaving as I intended it to behave.

      And while I do maintain that practical programming language should not depend on the features of the editing environment to be practical, at least it is *FEASIBLE* for an editing environment to enforce strict indentation policies when the programmer has explicitly specified where each logical block begins and ends, so the claimed advantage that python has of having whitespace be significant to the syntax of the program somehow actually improving legibility is not that important in the long run, since source code that uses explicit delimiters on blocks can easily be run through a pretty-print filter, so python mandates that programmers do something for themselves that a computer is far more capable of doing reliably and consistently. Even at best this is a waste of a programmer's time.

      While the intent behind it was laudable, in practice it's just not a very good idea in a modern language. It kinda reminds me of COBOL, to be perfectly honest.

    16. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 1

      After learning a third or fourth programming language, I think most people don't care much about such cosmetic things. There are much more important pros and cons to languages, and arguing over the syntax is like arguing over the color of a server: outside of very convoluted or extreme situations it doesn't make any difference in the real world.

    17. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Want curly braces? Use tcl. They put that shit on everything.

    18. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      This is slashdot; your opinion is actually superior but will thus languish in obscurity.

    19. Re:Have they added curly braces yet? by fnj · · Score: 1

      Nobody cares about HO's. Best keep your personal hangups to yourself. It's like emacs vs vi. Just be happy with what you like.

    20. Re:Have they added curly braces yet? by fnj · · Score: 1

      What the christ does Python's "one clear way to do any given thing" philosophy have to do with using indentation to denote blocks?

    21. Re:Have they added curly braces yet? by fnj · · Score: 2, Informative

      Using tabs for indentation is a mental disease. Also, PEP 8. Tabs are not Pythonic and should not be used. You're free to torture your programming language however you please, but if you expect others to respect your work, you are advised to adhere to the rules.

    22. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Yeah the creator of a language shouldn't have to know the intricacies of language features or how they interact! Just add more features for progress!

    23. Re:Have they added curly braces yet? by Lisandro · · Score: 4, Insightful

      Using tabs for indentation is a mental disease.

      Um, why? Tab exists solely to provide indentation.

    24. Re:Have they added curly braces yet? by hey! · · Score: 2

      If you don't like it, it's easy enough to fix. You can use an editor macro to "compile" your Python-with-braces to Python, and de-compile other peoples' Python to your Python-with-braces. that would correct what you see as "wrong" with the language but maintaining full access to and compatibility with the entire Python software ecosystem.

      In my view the braces/whitespace thing simply isn't such a big deal. It's just a lexical convention. It's an interesting gimmick; what C programmer hasn't encountered some brain-dead indentation that obscures the actual structure of the code? But that's easy to fix, you just pretty-print the file. I guess the problem is when pretty-print reveals a really overblown control flow, which making code formatting lexically significant discourages. But in practical terms coders who are so bad as to generate that kind of stuff will find some other way to make your life miserable.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    25. Re:Have they added curly braces yet? by paulpach · · Score: 1

      In pretty much any other language, you already indent your code to represent blocks. If you don't, it because very hard to read whether there are curly braces or not.

      When I first started learning python I also had a knee jerk reaction to the indentation thing, especially because I had used fortran before and I hated it. But after writing a few lines of code, you quickly realize that the indentation is not an issue at all. I was already going through the trouble of properly indenting all my code in C++, java, perl, etc..., so removing the curly braces did not make any difference. They are in fact redundant.

      That said, there are a couple annoyances related to the indentation (pretty minor in my opinion):
      If you try to embed python inside a template tool, like how you do in php or embedding java inside jsp, then it really gets in the way.
      If you sometimes use tabs and sometimes use spaces, it can get in the way. It is best to use an IDE that will enforce tabs or spaces but never mix them.

    26. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      If pythondid this transparently many snowflakes would have fewer problems, look at go, enforcement of layout without forcing whitespace nonsense

    27. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 1

      > What the christ does Python's "one clear way to do any given thing" philosophy have to do with using indentation to denote blocks?

      He said "a single form", which does relate to indentation. A single form of indentation that is read the same way by the reader and by the compiler.

      But it is also "one clear way", unlike other languages where the 'begin' and 'end' can be done in several different styles, or not at all:


      if condition {
              action
      }
      if condition {
              action
              }
      if condition
              {
              action
              }
      if condition {
      action }

    28. Re:Have they added curly braces yet? by Blrfl · · Score: 2

      With sufficient motivation, I can write unreadable code in any language no matter how it's indented.

    29. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 2

      > because of a line that had a tab character in it instead of spaces,

      This is exactly why you should configure the editor to visibly show tab characters (in colour for example) and to replace tabs with spaces. If it can't do that then get a better editor.

      > Even at best this is a waste of a programmer's time.

      Then don't use Python, nobody will care that you use Perl or Ruby instead.

    30. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 1

      I think you both miss the point; use a real editor and you can press tab and have it automatically use whatever number of spaces you want. Python sets people up with screwy notions because IDLE has all kinds of tab-manipulation functions where you can end up mixing both until you get into a better editor.

    31. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      > Most written languages do exactly that,

      No they don't. Your experience of other languages is rather limited if that is all you have.

      > And if you're sensible enough to use tabs,

      I think that it would be best if you stay away from Python, then everyone will be happier.

    32. Re: Have they added curly braces yet? by mark-t · · Score: 1

      because of a line that had a tab character in it instead of spaces,

      This is exactly why you should configure the editor to visibly show tab characters (in colour for example) and to replace tabs with spaces. If it can't do that then get a better editor.

      Sure, but you seem to have ignored the point I was actually driving at that a modern programming language should not constrain what editing environment(s) a programmer can or should choose from. "Better" is inherently a subjective term that has no discernable meaning in this context beyond whatever editor one is most accustomed to.

    33. Re:Have they added curly braces yet? by Shane_Optima · · Score: 2

      There's a third option here: why is this a thing? Why hasn't this been abstracted out into a middle layer pre-compilation markup layer so your IDE can switch to whatever suits your fancy?

      Why are these pointless, subjective arguments over syntactic sugar still happening? Why the hell is human readable plaintext the target medium of exchange here? It's not like a this would be incompatible with plaintext; conversion both ways would be easy enough. The guy who insists on using nothing but notepad could keep doing his thing; you'd just have to convert everything to text (using his preferred style) before sending it to him.

      This doesn't just solve the immediate, practical issues of different competing preferences; it also has interesting theoretical effects in that people are forced to think about what counts as syntactic sugar and what counts as actual compilation--what should happen when, and why? What are the differences between languages that truly matter?

    34. Re:Have they added curly braces yet? by Shane_Optima · · Score: 1

      And before anyone says it, yes I'm aware this poses interesting challenges for certain code-as-data metaprogramming stuff, hence my penultimate question.

    35. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      > Using tabs for indentation is a mental disease.

      Using the Tab key is perfectly usable, just configure your editor to convert that into the appropriate number of spaces. If you editor can't do that then get a better editor.

    36. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Cuz IMHO using whitespace to define blocks is brain dead.

      It harkens back to the days of COBOL and FORTRAN. For a primarily educational programming language I understand the rationale of whitespace formatting of code blocks. However, my criticism of Python boils down to an inconsistency in the built-in functions and data structures. Either be 100% object-oriented like Smalltalk or strictly procedural like C or strictly functional like Scheme. All in all, Python is not a terrible programming language but why do so many people insist on writing code with no documentation embedded in the code?

    37. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Using tabs instead of blank spaces during file storage saves storage space on whatever media the file is stored. The tab expansion can occur at view time and run time but when the file is being saved the consecutive space characters should be automatically replaced by tab characters. Agreeing on a tab expansion value, say 1 tab character equals 4 space characters is easier than other options proposed. I know some people who insist upon 8 character tabs. Maybe their screen is 1024 characters wide but standardising on a 80-column screen keeps it consistent for everyone. There are times that I increase the font size for those 80 columns fill the 22-inch high-resolution screen making it easier to read.

    38. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 1

      >Sure, but you seem to have ignored the point I was actually driving at that a modern programming language should not constrain what editing environment(s) a programmer can or should choose from.

      Actually, some of the biggest gains to be had is from *exactly* providing a special live editing environment.

      If you don't want to use Python then don't use it. Simple.

      But *please* stop trying to get Python to add braces. Just use another language and stop trying to break ours, thanks.

    39. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      >Using tabs instead of blank spaces during file storage saves storage space on whatever media the file is stored.

      Yes, but don't do premature optimizations like that. If you want a smaller file, turn on file system compression. Stop fucking with the payload.

      >The tab expansion can occur at view time and run time but when the file is being saved the consecutive space characters should be automatically replaced by tab characters.

      That would make me deinstall that editor immediately and never use it again. Spaces and tabs are *nothing* alike. Also, how many spaces consistute one tab is not fixed (and shouldn't be).

      Why does this keep coming up again and again with the same weird suggestions? I've heard the stuff 20 years now. Why doesn't it ever stop?

      A tab and a space are different characters. Would you advocate replacing all "A"s by "B"s? No? Then also don't replace tabs by anything...

    40. Re:Have they added curly braces yet? by Mybrid · · Score: 1

      I agree, not an issue. Refactoring and getting the wrong indent level for last statement in "for" loop. Ouch. Many times I 've scooched the last line the wrong indent level on refactor. ha

    41. Re:Have they added curly braces yet? by Quarters · · Score: 3, Informative

      Have you actually read PEP 8 or are you just throwing it out there?The intro to that PEP goes to great lengths to explain that it is the preferredstyle guide for the Python Standard Library, thatother coding standards are OK, and that you should always adhere to the coding standards any given project uses. It is not some sort of dictatorial manifesto that ALL PYTHON SHOULD BE 4 SPACES.

    42. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 1

      For a 2 line script, it might be okay, but I work with the beast and it ain't pretty.
      I'm more annoyed in that, even if you break things into ridiculously small functions,
      the fact that you have to do things on a single line burns me to no end.

      Scope by white-space indentation is high-school mentality feature. Yeah, the language
      has some good points, but readability and maintenance isn't high on its list of pluses.

      CAP === 'grazing'

    43. Re:Have they added curly braces yet? by phantomfive · · Score: 1

      And if you're sensible enough to use tabs

      "tabs vs spaces" is one of the oldest arguments in programming since we moved off punch cards.
      And now one programmer immediately alienated half the programming world by enshrining his opinion into the programming language. Nicely done.

      --
      "First they came for the slanderers and i said nothing."
    44. Re:Have they added curly braces yet? by ceoyoyo · · Score: 4, Insightful

      Enforced indentation enhances readability. Perhaps you've never run into any godawful code where the programmer decided to follow his own arbitrary indentation system.

      You don't have to do everything on a single line in Python. Where'd you get that idea? You can split statements across lines just fine. Most Python programmers do so.

    45. Re: Have they added curly braces yet? by ceoyoyo · · Score: 1

      Enforced indentation in Python is great, but I have to agree: allowing the use of tabs or spaces was a horrible idea. I assume supporting spaces was a bad habit held over from C.

    46. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      We do it anyway so why not make use of it.

    47. Re:Have they added curly braces yet? by ceoyoyo · · Score: 1

      Another one of the enlightened. People in my lab get a look when I tell them that they will use tabs as indentation. Then they come back and thank me.

    48. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 1

      Using tabs for indentation is a mental disease.

      Um, why? Tab exists solely to provide indentation.

      cf.

      * https://en.wikipedia.org/wiki/Tab_stop

    49. Re:Have they added curly braces yet? by ceoyoyo · · Score: 1

      PEP 8 says that Guido prefers spaces. It doesn't say tabs are bad, and it certainly doesn't say they're wrong. It DOES say mixing tabs and spaces is bad, Python 3 doesn't allow it, and you're recommended to run Python 2 in such a way that it doesn't allow it either.

    50. Re: Have they added curly braces yet? by orlanz · · Score: 2

      The point is that most languages don't need motivation, let alone sufficient amounts of it to do what say.

    51. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      List comprehensions and inline if/else statements are generally good enough - cramming more logic those those allow into one line sounds like bad programming, in most cases.

    52. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Python has had support from the very beginning for curly braces. Here, let me demonstrate:

      for i in range(10):
                # {
                print("Python has support for curly braces!!!!")
                # }

      See!!! It's that simple!

    53. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Yep. Arguments over whitespace is just bike-shedding.

    54. Re:Have they added curly braces yet? by Snotnose · · Score: 1

      I seem to have hit a nerve :) Been using Python off and on (more off than on) for 15 years or so and am well aware of the curly braces, um, discussion.

      My biggest issue is sometimes when tracking down a problem you want to comment out blocks of code. Easiest is an "if(0){....}", that isn't really practical with Python.

    55. Re:Have they added curly braces yet? by sjames · · Score: 1

      That just breaks things even if you're trying to get it right.

      Consider, I see well so I set tabstops at 2 chars on my editor. Except when my eyes are tired and I set it to 4. The next guy to read my code has limited vision and so he sets it to 8 chars (there are many vision problems that make it hard to tell if one letter is directly above another or not).

    56. Re:Have they added curly braces yet? by sjames · · Score: 1

      You realize paragraphs introduce white space, don't you?

    57. Re:Have they added curly braces yet? by sjames · · Score: 1

      Actually, he didn't. Python accepts either one as long as you don't mix them.

    58. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 0

      no. just no. fuck replacing tabs with spaces.

    59. Re:Have they added curly braces yet? by phantomfive · · Score: 1

      That's true, I should have pointed my comment at the GP, but tbh I think tabs to the point of indent and spaces thereafter is the proper way to indent things :)

      --
      "First they came for the slanderers and i said nothing."
    60. Re:Have they added curly braces yet? by sjames · · Score: 1

      Agreed, that is the proper way to use tab.

    61. Re:Have they added curly braces yet? by Paul+Carver · · Score: 1

      I think three single quotes above and below is easier than that.

    62. Re:Have they added curly braces yet? by phantomfive · · Score: 1

      Excellent, I'm glad to encounter a person with such refined taste as yourself.

      --
      "First they came for the slanderers and i said nothing."
    63. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      >>> from __future__ import braces
      SyntaxError: not a chance

    64. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Saying it alienates half the programming world implies everyone is divided and gives a damn about that debate. The vast majority probably don't care, and the combination of both sides of that debate are a small minority.

      Most of us are too busy to debate such superficial stuff, or to even care. Python, like many other languages, is perfectly capable of getting stuff done, even if sometimes other languages are better or faster for a given task. Those other languages are worse for yet other tasks.

    65. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 0

      if expression: action()

      - that's perfect valid python.

    66. Re:Have they added curly braces yet? by MichaelSmith · · Score: 1

      I completely agree. The K&R braces argument has always come down to the fact that people who disagree can just use an editor which shows them what they want to see. Code is a sequence of tokens so why not store it as a sequence of tokens, rather than a sequence of characters.

    67. Re:Have they added curly braces yet? by MichaelSmith · · Score: 1

      Not if there is triple quotes inside the block you want to remove.

    68. Re:Have they added curly braces yet? by MichaelSmith · · Score: 1

      lol it does do that.

    69. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Um, why? Tab exists solely to provide indentation.

      They exist solely to provide invisible errors in the editor and text processing system of your choice. Tabs are nothing but a really primitive text compression system that should've died 50 years ago.

      Any programmer that can't routinely handle any indentation between 1 and 8 characters is a really crap programmer who shouldn't be allowed to do anything serious. It's actually a pretty good sign that you're dealing with a crap program/programmer if a source file has tab characters.

    70. Re:Have they added curly braces yet? by Lisandro · · Score: 1

      They exist solely to provide invisible errors in the editor and text processing system of your choice. Tabs are nothing but a really primitive text compression system that should've died 50 years ago.

      No, tabs are tabs and nothing else. "Invisible errors" come from handling indentation with spacing, in fact.

      Grow up and use tabs, then set the display spacing to whatever floats your boat.

    71. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Amen!

    72. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Python enforces a single form and this is its strength. It makes everyone write readable code. I know this vexes the special snowflakes but it is for the greater good.

      I've taken your tabs are placed half of them spaces. Where is your python god now?

    73. Re:Have they added curly braces yet? by fnj · · Score: 0

      Wrong. It doesn't say "tabs are OK". It specifically says that where idiots have already created a codebase using tabs, it is permissable not to confuse things hopelessly for the special snowflakes by trying to change it.

      It _IS_ a mandate that the style to use when creating Python code is 4 spaces per level of indentation. Wake up.

    74. Re:Have they added curly braces yet? by fnj · · Score: 1

      Wrong. That's not what the PEP 8 I'm reading says. As noted.

      BTW, I'm nowhere near as diplomatic as Guido. IMO, anyone who uses tab characters for indentation is a moron. I also much prefer 2 spaces to 4.

    75. Re: Have they added curly braces yet? by HiThere · · Score: 1

      IIUC, there is a rule against mixing tabs and spaces at the beginning of lines. I think that's a syntax error. This was a problem with Python 2.?.

      That said, as I always use tabs at the beginning of lines I've never encountered the error, at least not within the last couple of years. I prefer tabs over spaces because if I start getting deeply indented lines it's easy to reduce the amount of horizontal indentation without editing the lines. (Just change how the editor displays tabs.)

      OTOH, I follow this rule whatever language I using. It's not something specific to Python. I feel that a consistent pattern of indentation is valuable in making code intelligible whether or not braces are used...or for that matter begin...end pairs. (Ada does/did insist on the function name appended to the end token, but that doesn't really change things, and I often do that even in Python. e.g.:
            def fun (args):
      ... some code here ...
            #def fun (args)

      Sorry about the spacing, but /. doesn't seem to preserve it.)

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    76. Re: Have they added curly braces yet? by mark-t · · Score: 1

      IIUC, there is a rule against mixing tabs and spaces at the beginning of lines. I think that's a syntax error.

      Be that as it may, it is still not possible to distinguish between them when simply looking at source code. Counting characters and telling the difference between characters that are not visibly distinguishable in how they are rendered on screen is something that a computer is good at, but humans aren't. Ironically, because most people don't ordinarily actually even *read* whitespace, the indentation that Python advocates claim improves readability amounts to differences that are ordinarily invisible to people anyways, and only a computer can actually tell the difference unless a person is paying especially close attention.

      It is, I'm afraid, somewhat reminiscent of the bygone days when COBOL was king. and programmers had to have certain things in certain columns in their code or else it would not compile.

    77. Re:Have they added curly braces yet? by Snotnose · · Score: 1

      Bingo. With C, C++, Java you can easily disable a block of code. With Python you're just as likely to introduce a new bug into the code you're debugging than to isolate code you don't care about.

      Don't get me wrong, I love Python. But IMHO using whitespace to define blocks was a stupid move. And yeah, I'm well aware of the arguments for and against for the last 15 years.

      Almost 24 hours after I made my snarky first post, the discussion rages on. Sez I hit a nerve :)

    78. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Read again. PEP8 only applies when you contribute code to the Python project, it is not a recommendation for all projects written in Python.

    79. Re:Have they added curly braces yet? by Quarters · · Score: 1

      "It doesn't say'tabs are OK'."

      While I admire your attempt to try to steer the argument to yourlimited comprehension of PEP 8 and yourinsular viewthat tab using people are "idiots", your strawman attempt was quite awful.All one has to do is read the parent post to which you are replying to see that youmade up a fake quote and tried topass it off as something I wrote.

      Go read PEP 8 again, please. It is quite clearly denoted as the style guide that should be adhered toif you are contributing to the Python Standard Library.It is not promoted or positioned as the only style guide to ever be used on any Python project. In fact the final sentence of the Introduction to PEP 8 says all that needs to be said about projects using their own conventions, "Many projects have their own coding style guidelines. In the event of any conflicts, such project-specific guides take precedence for that project." But, honestly, if you are sosmall minded as to view people who use tabs as "idiots" I doubt we can hold it against you that you were unable to read and comprehend five (5) sentences. If you had somehow maintained the mental stamina necessaryto readthe title of the second section of the PEP, "A Foolish Consistency is the Hobgoblin of Little Minds" you might have managedthe insight that the following sentences would further clarify the situation. Starting at sentence four (4) in that section are these four (4) sentences, "A style guide is about consistency. Consistency with this style guide is important. Consistency within a project is more important. Consistency within one module or function is the most important."

      To summarize, projects can have their own coding styles, project specific coding styles take precedence for that project, and consistency within a project is more important than consistency with PEP 8.

      That you would say 'Wake up' as a reply to my post, as if I'mnot comprehending something when it is absolutely clearthat you can't comprehend nine (9) sentences at the very start of a PEP is pretty self-righteous of you. Why don't you take your ego down a peg or two (or nine) andgo read PEP8, for it is not what you are portraying it to be.In other words, words that you can probably understand, "wake up". There is no mandate whatsoever in PEP 8 that all Python ever written must adhere tospaces and an indentation level of 4, let alone anything else specified in that PEP.

    80. Re:Have they added curly braces yet? by Quarters · · Score: 1

      Which PEP 8 are you reading, as you areclearly not reading the correct one. In the entirety of PEP 8 the word 'tabs' only appearsseven times. Hereis all the PEPhas to say on that subject,

      Tabs or Spaces?
      Spaces are the preferred indentation method.
      Tabs should be used solely to remain consistent with code that is already indented with tabs.
      Python 3 disallows mixing the use of tabs and spaces for indentation.
      Python 2 code indented with a mixture of tabs and spaces should be converted to using spaces exclusively.
      When invoking the Python 2 command line interpreter with the -t option, it issues warnings about code that illegally mixes tabs and spaces. When using -tt these warnings become errors. These options are highly recommended!

      And since PEP 8 only deals with code being written for the Python Standard Library those statements are only applicable to that codebase.
      So far you've referred to people who use tabs as 'idiots','brain dead', and'morons' in various, all demonstrably incorrect, replies in this discussion, yet all you have done is continually demonstrate your lack of actual knowledge regarding PEP 8. If anyonein this discussion deserves to have disparaging names regarding their lack of mental acuity assigned to them it would be you.

    81. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Dude, there's a guy up thread who's been a Perl programmer for 20 years. We can have the tired argument of tabs vs. spaces or we can do the humanitarian thing and stage an intervention.

    82. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 0

      > I also much prefer 2 spaces to 4.

      Oh god. If only there was one fucking character that you could display as two spaces and other people could display as four spaces.

    83. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 1

      Replacing tabs with spaces is a good practice in any language because as soon as you open a program in a different editor it becomes unreadable. In fact, Python is the first language where I DIDN'T have to replace tabs with spaces because indentation rules are enforced and taken care of by editor.

    84. Re:Have they added curly braces yet? by presidenteloco · · Score: 3, Insightful

      Because human readability of code is much more important than machine readability of code. With a suitable parser, the machine will be able to read the code. The art is in creating a language in which the program is obvious to many humans, not just the person who wrote it.

      IMHO Python is on the right track for that. The best way to ensure all programs written in a programming language are readable by many people is to have the language enforce a uniform style, with a take-it-or-leave-it attitude. People who don't like the language-author's enforced style conventions can use another language. Programs written in the language will be reliably readable and maintainable, and that's way more important than giving freedom of artistic impression to the program writer.

      --

      Where are we going and why are we in a handbasket?
    85. Re:Have they added curly braces yet? by angel'o'sphere · · Score: 1

      The big deal about indentation is actually in C.
      Or more precisely: the question where to place the { and } and how to indent them!
      I think the five or six most common (which means the lesser common ones of those share perhaps 10% of all C code base) even have names!! Like K&R, Awho, etc.
      The lack of {/} in Python at least relieves us from that war :)
      My next project involves me maintaining and developing a build system in Python (github, see BoB), I'm looking forward to get my hands on it.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    86. Re:Have they added curly braces yet? by presidenteloco · · Score: 1

      Larry Wall critiquing someone else's programming language? ROFL.
      Given that he blessed us with:

      Pre-
      Encyphered
      Rune
      Language

      --

      Where are we going and why are we in a handbasket?
    87. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Since tabs have no place in code regardless of the language used, my code is just fine thank you very much...

    88. Re:Have they added curly braces yet? by angel'o'sphere · · Score: 1

      Then learn how to use your source code control tool.
      Delete the offending code instead of commenting it out.
      If you are forced to use a certain one and are not allowed to do single commits, install a local one of a different kind, e.g. if you use SVN you can locally use Git or even RCS just fine.
      Commit your code locally. Delete the stuff you usually would uncomment, commit if you want, continue your work.
      Everything can later be retrieved from the central or local repository ... easily!

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    89. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Tabs work great if everyone uses them consistently. Which *never* happens. So the code becomes a godawful tangle of conflicting attempts to "correct" the spacing which works for no one. How is this better again?

    90. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Tabs exist to line things up in a table, hence the name.
      Indentation is just a side-effect.

    91. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Wait, are you claiming the whitespace is invisible to people? Otherwise, you've created a strawman, as the advocates that indentation improves readability aren't say tabs vs spaces makes a readability difference, but just indentation period.

    92. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      One of these years I'll create a curly brace front end for python, but I'm busy doing other things like ignoring python because the syntax is shit.

    93. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 0

      The fact your looking at indentation and not code is a really good sign you cannot code. If getting high and mighty on white spaces hides the fact you have no no idea about anything else in the program. More power to you, your generalized statements how ever make you a retard and not only should you not be coding, you should be considering castration to prevent the spreading of your retard dna

    94. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Useful editors let you toggle visible symbols for all characters. Use set list in vi or vim. Emacs has WhiteSpace mode and shows you characters like wrong line terminators by default.

      While languages like Python do support Unicode strings, most programming languages stick to roughly the lower ASCII range for symbols. This means you are going to get some collisions somewhere. Wait until you work in any language with the semicolon (;) as an optional or mandatory end of line character. This appears the same in most fonts as the Greek question mark (Unicode character 037e).

      . but the problem with using it to directly delimit logical blocks is that humans don't actually directly read whitespace, there can be something syntactically wrong with a program that is not visible to humans reading it because of a line that had a tab character in it instead of spaces, or vice versa, for example.

      The only real problem with Python's style of indentation is that it doesn't intelligently collapse tabs and spaces into some uniform indentation for a block. Like tab stops were invented to provide in the first place. But then the language lacks syntax like case statements because, of all the syntactic sugar poured into Python, the BFDL doesn't like them. Programming languages are about communication - clearly expressing yourself to the computer and to other programmers (like yourself in six months, two jobs and twenty interruptions.) Having to lint for invisible characters is the opposite of communication. But since that indentation-defining white space is pretty core to the language it is not likely to be solved without fancy tricks involving what the code "looks like" to a human verses the text string fed into the compiler or interpreter.

      In the end, if this were about C people would just be arguing about bracing styles.

    95. Re: Have they added curly braces yet? by Lisandro · · Score: 1

      Tabs work great if everyone uses them consistently. Which *never* happens.

      No shit. Too bad the same is true about spaces.

    96. Re:Have they added curly braces yet? by Raenex · · Score: 1

      Syntactic whitespace makes me twitch, too; but it neatly resolves many of the codestyle hubbub issues you see in other language environments.

      Well, it could have, by being more strict, but no.

    97. Re:Have they added curly braces yet? by 0100010001010011 · · Score: 1

      It also applies to people that think what they learned 30 years ago makes them completely competitive in a modern workforce.

      You'll often find them complaining about H1Bs and ageism.

    98. Re: Have they added curly braces yet? by 0100010001010011 · · Score: 1

      I cannot count the number of times I have accidentally

      And I can't count the number of times I've flipped back to C from Matlab/Python and it doesn't do anything because I forgot a semi-colon.

      Python's strength is in its brevity.

    99. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 0

      > and only a computer can actually tell the difference

      But you _can_ get the computer to 'tell' you the difference. My editors are configured to show me tab characters in colours. If yours cannot do that then get a better editor.

      The editors are also configured to replace tab key with appropriate number of spaces.

        > COBOL ... programmers had to have certain things in certain columns in their code or else it would not compile.

      Did you find that hard ? Could you not configure your editor adequately to help you ?

    100. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      Well played, TeknoHog.

    101. Re:Have they added curly braces yet? by fisted · · Score: 1

      Sorry, but there's more to readability than consistent indentation. I'm pretty sure I'm not the only one who has seen truly horrible python code. Running in production, of course.

    102. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      > Tab exists solely to provide indentation.

      'Tab' is short for 'tabulate' - to make into a table. Source code is not a table, except for a few odd languages such as RPG.

      The Tab key on a typewriter provides _spacing_ to the next tab stop.

      The ASCII tab _character_ is a form of text compression which was useful when disks were 20Megabytes or less.

      The Tab key does not have to produce tab characters in the source code, the text editor (or other) can do whatever the user requires, specifically it can add an appropriate number of space characters.

    103. Re:Have they added curly braces yet? by Lisandro · · Score: 1

      The ASCII tab _character_ is a form of text compression which was useful when disks were 20Megabytes or less.

      What a moron. How many spaces a tab is supposed to "uncompress"?

      You're mixing up tabulation with spacing. These are two different enough concepts that, lo and behod, we have dedicated keys for each.

    104. Re: Have they added curly braces yet? by fisted · · Score: 1

      Unfortunately, getting that right requires a functioning brain. fnj doesn't seem to have one.

    105. Re:Have they added curly braces yet? by fisted · · Score: 1

      A thousand times this.

    106. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      > Using tabs instead of blank spaces during file storage saves storage space on whatever media the file is stored.

      Do you really care about that these days ? Files are stored in multiples of the cluster size, reducing the text by using tabs will often merely give more slack at the end of the cluster.

      > say 1 tab character equals 4 space characters

      'Tabs' go to the next 'tab stop'. A 'tab' character may be replaced by 1, 2, 3, 4 or more characters depending on the current column and the position of the next tab stop. Different editors may have different default tab stops (for example columns 5,9,13,.. or columns 4,8,12,16,..) or may have particular tab stop settings for certain conditions (eg COBOL with columns 7,8,12,16,20,...73).

      If you want to use ASCII tab characters in your source code then please do not use Python. There are plenty of other languages.

    107. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      > the word 'tabs' only appearsseven times. Hereis all the PEPhas to say on that subject,

      I appears that you have a broken space bar, or is it that your input mehod is converting 'tab' to zero spaces at times ?

    108. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      > "tabs vs spaces" is one of the oldest arguments in programming since we moved off punch cards.

      On a punch card machine the 'tab' key moves the card to the next 'tab stop' and the intervening characters are spaces. Why would anyone, or any text editor, want to do something different ?

    109. Re:Have they added curly braces yet? by Daimanta · · Score: 1

      Well played, TeknoHog, well played.

      --
      Knowledge is power. Knowledge shared is power lost.
    110. Re: Have they added curly braces yet? by HiThere · · Score: 1

      Well, at the time COBOL was common, the only editor was a *I* had was a keypunch machine. But I never knew that COBOL was sensitive to indentation. Fortran was, as the first 5 columns were reserved for numeric labels, and the 6th column was reserved for a continuation marker, and columns 73-80 were reserved for non-code uses (often sequence numbers), but I never heard any rule like that for COBOL.

      So back then I couldn't, and didn't, use tabs. (I *did* use special formatting cards in the keypunch...but I no longer remember the details, just as I no longer remember how to punch carriage control tapes for the printer.)

      That said, the tabs vs. spaces argument is silly. I prefer tabs, but I can automate conversion of them to spaces when I ship the code to someone who prefers spaces. The only problem comes when you mix them...which can happen when converting spaces to tabs, but not in the tabs-to-spaces direction. (Yeah, I *could* tell my editor to always replace tabs by spaces, but I won't. I see no advantage and a few disadvantages. [The disadvantages are only annoyances, but they *are* annoyances.])

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    111. Re: Have they added curly braces yet? by shutdown+-p+now · · Score: 1

      You don't have to distinguish between them while reading the code. Any Python 3 program that mixes the two is not a valid program, and won't even parse. So you can safely assume that whitespace "behaves" exactly how it looks, and disregard tab size issues etc.

    112. Re: Have they added curly braces yet? by ConceptJunkie · · Score: 1


      If you just assume that the US Government, from the highest levels on down, is absolutely determined to fragment and destroy American culture while running its economy into the ground, then the behavior of its agencies suddenly makes a lot of sense. In fact it becomes predictable.

      This has been demonstrably true for the last 8 years. Come back in a few more to see if it continues.

      --
      You are in a maze of twisty little passages, all alike.
    113. Re:Have they added curly braces yet? by ConceptJunkie · · Score: 2

      Python will immediately complain about mixing tabs and space. Other languages won't, but your code just became unreadable. I know all about that because my coworkers do it constantly. I realized tabs were a bad idea 25 years, and the company I work at now is the only place I've ever worked that uses tabs, and it's been nothing but trouble, but no one wants to change anything.

      --
      You are in a maze of twisty little passages, all alike.
    114. Re:Have they added curly braces yet? by ConceptJunkie · · Score: 1

      I kind of thought so too, until I tried it. Now I like it. It forces you do to do something you should be doing to make the code readable, and it's something I always do anyway. It's not brain-dead, it's just different. You might not prefer it, and if not, I think that's understandable, but it's definitely not a bad idea.

      --
      You are in a maze of twisty little passages, all alike.
    115. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      > You're mixing up tabulation with spacing. These are two different enough concepts that, lo and behod, we have dedicated keys for each.

      No, they are equivalent. Try using a typewriter or a card punch, the 'Tab' key moves to the next tab stop leaving all the columns between as spaces. The 'Tab' key is just a short cut to getting a number of space characters.

      ASCII TAB characters may be used as field terminators in such files as CSV or other, but have no specific meaning in terms of column spacing without an interpretation by means of a set of tab stops.

      > How many spaces a tab is supposed to "uncompress"?

      That is unknown without a set of tab stops, which is why it such a really bad idea.

    116. Re: Have they added curly braces yet? by Anonymous Coward · · Score: 0

      > but I never heard any rule like that for COBOL.

      Then you never knew COBOL at all. Columns 1-6 sequence number, column 7 continuation/debug/comment marker, column 8-11 Area A, Column 12-72 Area B.

      > So back then I couldn't, and didn't, use tabs. (I *did* use special formatting cards in the keypunch

      The formatting card was a set of tab stops (plus it could enforce numeric only fields). The way to 'use' a formatting card was to hit the 'Tab' key. 'Tab' characters cannot be represented on the punched card.

      > The only problem comes when you mix them...which can happen when ....

      It can happen when you hit the space bar.

    117. Re:Have they added curly braces yet? by Shane_Optima · · Score: 1

      Because human readability of code is much more important than machine readability of code... The art is in creating a language in which the program is obvious to many humans, not just the person who wrote it.

      That's an argument for my stance, not yours. Create an intermediate layer consisting of symbols and scopes that are mostly free of ambiguity and an IDE that convert to or from that format. Presto, you get your whitespace scope delimiters and the brace people get theirs. (For maximum transparency, there's no reason why this intermediate layer couldn't be human readable as well. It would necessarily be a very explicit and even Lisp-y syntax with lots of parentheses and brackets. And whitespace would be ignored, of course.)

      There's a corner case for metaprogramming, but that can be dealt with in a few ways... and does Python even support/encourage code as data?

      If you dislike using an IDE, tools can exist to translate it to plaintext (and then either you or someone else can translate back into the generalized format.)

      Programs written in the language will be reliably readable and maintainable, and that's way more important than giving freedom of artistic impression to the program writer.

      It's only reliably readable and maintainable to the extent that your language remains popular, and "artistic impression" is a fancy way of saying that in some ways Python lacks the power of other languages, but you want people to code inferiorly with large training wheels so that you can hire someone cheap to maintain it, because it's still a fairly popular language. For now.

      with a take-it-or-leave-it attitude

      Insisting that humans should be manually doing something (learning the One True Way) that computers can easily, silently and transparently do is pretty much the worst conceivable solution for any problem.

      How did that old meme go?

      "Your mediocre language has been replaced by a simple shell script."

    118. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      They're most certainly not. The fact that you can tabulate with spaces confuses a lot of people it seems.

    119. Re: Have they added curly braces yet? by Half-pint+HAL · · Score: 1

      Yes, but you've got to remember that while Python has no end delimiter for code blocks, it does have a start delimiter -- :. People try to spin it that a colon is a syntactic feature of the preceding statement, but that is merely playing semantics. It occurs everywhere an open brace would in C, Java etc.

      --
      Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
    120. Re:Have they added curly braces yet? by Half-pint+HAL · · Score: 1

      Syntactic whitespace makes me twitch, too; but it neatly resolves many of the codestyle hubbub issues you see in other language environments.

      If your editor helps you do the right thing, it's just an aesthetic whine, and shouldn't be worth arguing about.

      ...and there's my big problem with semantic whitespace: if it all comes down to needing the right editor, why bother with semantic whitespace in the first place?

      Any decent code editor can match parentheses no problem at all, so why not have the editor parse the structure and handle the indentation automatically? That way everybody in the team can have the code set in the way that is most readable to them taking into account their screen size, coding style, visual impairments etc.

      --
      Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
    121. Re:Have they added curly braces yet? by Half-pint+HAL · · Score: 1

      Yes, but the point here is that it's a semantic token that can be rendered as per personal preference, which would be a good thing. However, Python conventions favour spaces because people like to line up their continuation lines exactly (eg the continuation of a parenthetical expression should be indented at least one character beyond the parenthesis or bracket it is ruled by), which means either all spaces or a mixture of tabs and space... or at least it does until we abandon our collective love of dumb plaintext editors and start writing languages that demand that the editor parses code structure and renders the code itself.

      --
      Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
    122. Re:Have they added curly braces yet? by Half-pint+HAL · · Score: 1

      That's not true. Most editors have a notion of tab stops, and a tab does not "uncompress" to a specific number of spaces. In gedit, a tab character is a true tab -- by default it will leave up to 8 blank columns, moving to the next column that's directly after a multiple of eight. It's very different from just a number of spaces.

      --
      Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
    123. Re: Have they added curly braces yet? by Half-pint+HAL · · Score: 1

      if expression: action()

      - that's perfect valid python.

      Yes, but in order to use that to "comment out" multiple lines of code, you've got to indent each and every line of code that you're commenting out, which defeats the purpose of the exercise.

      --
      Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
    124. Re: Have they added curly braces yet? by HiThere · · Score: 1

      You're right, my acquaintance with COBOL was always at a distance. I did see some code, but it was in printout, and I think I once wrote a 5 line routine, but someone else keypunched it. But I would have expected to know if it was picky about line columns. Perhaps it was a matter of which implementation was being used, or compiler options or some such. (Certainly modern Fortrans aren't picky about columns used, unless you pick certain compiler options.)

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    125. Re:Have they added curly braces yet? by Anonymous Coward · · Score: 0

      IMO, anyone who uses tab characters for indentation is a moron.

      IMO, people who call other people morons for such trivialities are the real morons and shouldn't be allowed to write code.

    126. Re: Have they added curly braces yet? by mark-t · · Score: 1

      Indentation is visible, but the actual characters are not... ironically, the very thing that python advocates claim improves readability is, without using a custom font, invisible.

      Also, the actual amount of whitespace will mean dick-all to a programmer that is visually handicapped, rather than improving any legibility, it will only amount to a whole lot of extra noise to its syntax, possibly literally as well as figuratively.

      The legibility of any program written in a language that uses explicit block start and block end indicators but is not nicely indented can be improved by passing the program through a pretty-printer algorithm anyways, so python forces programmers using it to do something that computers are generally far more adept at and can perform much more reliably.

    127. Re:Have they added curly braces yet? by fnj · · Score: 1

      Jesus, does anybody have to work with this guy? I've met some self righteous ass-clowns, but sheesh.

    128. Re:Have they added curly braces yet? by fnj · · Score: 1

      You are the very definition of a logic failure. As you yourself just quoted, PEP 8 says "Tabs or Spaces? Spaces are the preferred indentation method." And yet you think that it means tabs are just fine.

  2. Larry is a cunning linguist by bill_mcgonigle · · Score: 5, Interesting

    Perl is great for people who tend to be more "verbal". The total math geeks I know really prefer python, though.

    It's wonderful that we have such a joyful abundance of tools to choose from in the FLOSS world, and aren't stuck running VB.net or whatever the craptastic commercial product is these days. Be maximally productive and we can all be happy for that.

    Now let's work on getting these things coordinated so I can use a python module in perl6 and the ruby folks can use a perl6 module on rails. That was one of the great dreams of the perl6 project and it doesn't seem to be effective yet.

    --
    My God, it's Full of Source!
    OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
    1. Re:Larry is a cunning linguist by phantomfive · · Score: 3, Insightful

      The total math geeks I know really prefer python, though.

      That's because of the good math libraries available, it has nothing to do with the language itself. Remember R is popular among mathematicians, and from a language viewpoint, it's a crap language. Sometimes it's the right tool for the job, though.

      --
      "First they came for the slanderers and i said nothing."
    2. Re:Larry is a cunning linguist by Anonymous Coward · · Score: 1

      Except that python can read almost like pseudocode - that makes it pretty appealing; and when the above poster says Perl is for the more "verbal" I presume he means those who spew larger amounts of gobbledygook to communicate the same information.

    3. Re:Larry is a cunning linguist by phantomfive · · Score: 1

      Except that python can read almost like pseudocode

      Any language can, if you write it correctly, though frankly I think it's easier in COBOL than most modern languages, including Python. So there is more to a language than that.

      --
      "First they came for the slanderers and i said nothing."
    4. Re:Larry is a cunning linguist by Anonymous Coward · · Score: 0

      "It's wonderful that we have such a joyful abundance of tools to choose from in the FLOSS world, " Agreed. Well said. Merry Christmas.

    5. Re:Larry is a cunning linguist by shutdown+-p+now · · Score: 1

      R is an... interesting... language. Definitely lots of crappy points, but I think it's the closest that any language with a mainstream C-style syntax has come to being Lisp. In fact, arguably, R has exceeded Lisp in some ways - by making function arguments lazy, and making it possible to get the underlying expression if desired, it did away with the need for macros as a separate facility - it's just functions all the way.

      And literally everything in R is a function call. Including things like conditionals and loops, variable assignments, function definitions, and even parentheses themselves (they're all just syntactic sugar on top of the underlying S-expressions).

      This all makes some traditional "debug that, mofo" tricks more interesting, e.g.:

      > real_if <- `if`
      > `if` <- function(x, y, z) real_if(x, z, y)
      > if (TRUE) 1 else 2
      [1] 2

  3. Python 2.7 is still better by Anonymous Coward · · Score: 0

    And that's why Python sucks, no backwards compability.

  4. Python's Future by Anonymous Coward · · Score: 0

    Any word on how Trump is going make Python great, finally? Maybe by adding curly braces?

    1. Re:Python's Future by haruchai · · Score: 1

      Any word on how Trump is going make Python great, finally? Maybe by adding curly braces?

      Programming was great when we had GOTO so that's how Trump will save Python from being a LOSER and make it win, win, win until we're tired of it winning

      --
      Pain is merely failure leaving the body
  5. The problem with Perl by Anonymous Coward · · Score: 0

    Perl is great as "awk on steroids" as Larry once put it, it's much more convenient and performant than the sed+awk+shell scripts for doing batch text editing.

    But there's so much stuff in the language that it takes a long time to acquire (and maintain) the proficiency needed to read someone else's code, if that someone else is an intermediate or higher level Perl coder. Many of us use Perl only occasionally, so it's easy to forget what we thought we learned in the long-ago determined scramble through the O'Reilly book.

    1. Re:The problem with Perl by skids · · Score: 1

      I use python about once every two years when I have to patch something written in it. Same problem, especially because the function/method names make no sense whatsoever.

    2. Re: The problem with Perl by Anonymous Coward · · Score: 0

      Do you have any examples? At my job, I have to deal with incoming code in a variety of langues written by outside contributors for data analysis, and nothing sticks out about reading Python even though it is not a language I written in a long time. Some specific libraries have bad names, but the ones I'm thinking of use the same bad names in other language bindings.

    3. Re: The problem with Perl by skids · · Score: 1

      To start it would be helpful if functions were consistently verbs when that is a natural choice: in python you have "filter", which is a verb, but then you have "sorted" and "reversed", and then to add to the crazy you have sort(..., [reverse]) which, if you were heart set on using an adjective form, that parameter would be the place to actually use "reversed".

      array.extend to me would imply more a memory management tweak allocating more slots. If you're appending elements "push" or "append" makes more sense, or maybe "concatenate" if you like to be mathy. So you do have "append" but only for single elements... and... you have "pop" s why in the heck would you not have "push"?

      It's little stuff like this that kinda turns me off above and beyond the whitespace handling, which I find just intolerable.

      (PHP is way worse, though)

  6. Speaking as a Perl nerd.. by LocoBurger · · Score: 3

    That summary is pretty inflammatory. "New Python: Also, some people say Python sucks!"

    What Larry sees as a virtue of Perl, the fact that it gives you myriad tools to accomplish your tasks, many see as over-complicating the matter. You can certainly do whatever you need to get done in Python (duh), but the Python folks pride themselves on giving you a good way. It's just a different approach to language design.

    A (possibly) overwhelming everything-and-the-kitchen sink? Or tools crafted by experts? Personally, I love Perl, but there really doesn't need to be this counter-productive contention between the different approaches.

    1. Re: Speaking as a Perl nerd.. by Anonymous Coward · · Score: 0

      Your post is reasonable, thoughtful, informative, balanced, and mature.

      Get the fuck off Slashdot. Your kind aren't welcome here.

    2. Re:Speaking as a Perl nerd.. by Camel+Pilot · · Score: 2

      That summary is pretty inflammatory.

      That was the intent... to start a religious war. Sort of like quoting the Pope as saying "Protestantism is a pretty okay primitive religion, better than being Muslim I guess"

    3. Re: Speaking as a Perl nerd.. by Anonymous Coward · · Score: 0

      Contention between versions is counter productive?

      As president of the Nerd Association of America, I hereby revoke your credentials and membership

    4. Re:Speaking as a Perl nerd.. by angel'o'sphere · · Score: 1

      Considering that the muslimes comsider Islam an more 'evolved' version of judaism and catolizism this is a pretty tough statement :)

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  7. And yet... by Anonymous Coward · · Score: 0

    And yet, everyone will continue to use 2.7.

    1. Re:And yet... by Camel+Pilot · · Score: 1

      Why the hell is that? As a Python newbie I never know what to install and configure a new project in. I start with say v3 only to find that some module or framework I need down the road isn't available in 3 or visa versa. Really annoying.

    2. Re:And yet... by Anonymous Coward · · Score: 0

      Use python 3, and generally tune out any of the crotchety hold outs still screaming python 2.7. Seriously, starting new development in python 2.7 is a dead end

    3. Re:And yet... by Dutch+Gun · · Score: 1

      Because large-scale infrastructure resists change by sheer inertia. It's the same reason the US hasn't gone metric. Even if the "new" is arguably better, no one likes to fix problems caused by deliberately designed incompatibility.

      One of the great strengths of C++ is that nearly any ancient code from decades ago can still compile today on a C++14-compliant compiler. The language committee went to great lengths to avoid making incompatible changes over the years. When there are billions of lines of C++ code out there, that's a responsibility that you need to take seriously. This dedication to backwards-compatibility means that developers have little fear about investing in significant C++ development, without worrying about a language designer that suddenly decides to go in a new direction and break ties to the past, leaving them in a nasty position (especially if your language requires a run-time interpreter).

      As you can tell, I'm not a fan of breaking backwards compatibility in languages. If you *must* do it, be prepared to deprecate those features over *decades*, because that's how long things like that will linger around. The Python developers *vastly* underestimated the pain that decision would cause, and the time it would take to get resolved. Apple *still* ships 2.7 on their machines.

      --
      Irony: Agile development has too much intertia to be abandoned now.
    4. Re:And yet... by Anonymous Coward · · Score: 0

      If you have the liberty of making that decision there would literally be no reason not to use version 3. In the real world, meanwhile, certain essential packages are not available outside 2.7 and being at the bleeding edge for its own sake provides zero practical benefit.

    5. Re:And yet... by Anonymous Coward · · Score: 0

      Python 3 isn't bleeding edge, even in the real world. There really aren't many 2.7-only packages left, that aren't well on their way to bit-rot.

    6. Re: And yet... by Anonymous Coward · · Score: 0

      I switched to python3 only about a year ago and i found my stack (Numpy, Celery, Flask, Sqlalchemy,..) is fully supported - I don't care about Python2 in my apps any longer, but true - I don't maintain a library

    7. Re:And yet... by MichaelSmith · · Score: 1

      I use python3 as well but there is a lot of important stuff out there which doesn't, like google oauth libraries.

  8. Because Programmers Make Bad Decisions by Anonymous Coward · · Score: 2, Informative

    The language changed for virtually no reason/benefit in Python 3 and they broke backward compatibility. Worst of all, no automated means of reliably porting 2.7 code to 3 was provided, and even today, there is no reliable means.

    Developers stuck with 2.7 to maintain compatibility and then continued further development in 2.7. Thus creating an even larger body of work that doesn't run under Python 3.

    It was a massively stupid decision. But, I expect nothing less from those that build a language whose code can completely change functionality by simply misplacing an invisible character(space). Said character itself often makes up 20% of the frickin code!

    1. Re:Because Programmers Make Bad Decisions by shutdown+-p+now · · Score: 1

      The language changed for one big reason, that being making strings work properly - i.e. without magic encoding and decoding, silently losing characters or worse. This was a much needed change for anyone except for those assholes who 1) use a language for which ASCII is good enough, and 2) don't care about anyone else, and don't care if their code breaks on non-ASCII locales.

      Unfortunately, it was also a breaking change, but there was no way around it. And since they already had one breaking change, they figured they might as well clean up the rest of the language and the core standard library - which they did with great results.

      As far as developers sticking to 2.7 - some do, true. And some people still stick to VB6, and keep demanding that Microsoft brings it back. I suspect the "Python 2 forever!" crowd will eventually end up in the same boat - we're getting close to a similar timeframe, at least. In the meantime, anyone who is actually following the ecosystem knows that all the major libraries and frameworks are now available on 3.x, most smaller libraries are as well or else have replacements (often API-compatible), and the overall trend is that 2.x usage keeps declining, and 3.x usage keeps trending up. So, painful as the transition has been, the community had powered through it, and reaped the rewards in form of a better, cleaner language.

    2. Re:Because Programmers Make Bad Decisions by spitzak · · Score: 1

      Sorry, no. They broke strings entirely in Python 3.0 and that is why people cannot port to them.

      Here is how to do strings correctly: use UTF-8 and DO NOT BARF ON ENCODING ERRORS!

      It is absolutely 100% a requirement that a program be able to read a random byte stream into a "string", then write it out again, and get the same byte stream.

      In Python 2.0 this only barfed if you tried to convert that string to "Unicode" (it would have been nice if it did not barf, but at least you could store, read, and write strings).

      In Python 3.0 it will BARF ON READ. This makes it impossible to write reliable software.

      Yes you can use "bytes" in Python 3.0. But that really sucks if in fact you expect your bytes to be readable text, with only RARE (but not magically non-existent) errors.

    3. Re:Because Programmers Make Bad Decisions by shutdown+-p+now · · Score: 1

      Here is how to do strings correctly: use UTF-8 and DO NOT BARF ON ENCODING ERRORS!

      Let's just say that this is your opinion, and that it is not shared by the majority of developers out there. Which is why most mainstream languages today do not use this model (and some of them did, but migrated from it).

      The simple reason why it's impractical is that many important platforms (Windows, OS X) don't use UTF-8 to encode Unicode for most of their stuff - so you need to re-encode, and for that you need valid UTF-8 input anyway. On top of that, it's pretty common to have non-Unicode file contents, and on Unix, even file names.

      Writing reliable software is easy: if you know that your input is a text string (defined as something representable in Unicode), then use a string. Otherwise, use a byte array, but then do not expect your bytes to be readable text, because that is the guarantee that you explicitly abandon when you say "this is not a string". You can't have your cake and eat it too, and it's long past time that we started slapping you hard when you try.

      If you disagree, that's fine, there are languages out there who cater to your crowd - Ruby is one example.

  9. Guido by Anonymous Coward · · Score: 0

    I once had a dog named Guido.

  10. 2.7 by Anonymous Coward · · Score: 0

    Isn't 2.7 always the latest release?

  11. Python: better than JS, except for JSON by scorp1us · · Score: 4, Interesting

    Python 3.5 got async, await key words and has had proper OOP for a decade, things JS is still trying to get into the language. The one downfall of python is JSON object literals aren't as easy as in JS.

    If more node devs found out about Python's Tornado, they'd probably pick Tornado.

    --
    Slashdot's rate-of-post filter: Preventing you from posting too many great ideas at once.
    1. Re:Python: better than JS, except for JSON by MichaelSmith · · Score: 1

      The one downfall of python is JSON object literals aren't as easy as in JS.

      Dunno I don't really like the idea of having my communication protocol interpreted as code.

    2. Re:Python: better than JS, except for JSON by angel'o'sphere · · Score: 1

      JSON can't be a protocol. It is a data format.
      On the other hand: every protocoll is code. Code that tells the 'other sode' in which state my side is, what action I expect from 'the other side' and in what state I will switch afterwards.
      Considering that, you can ofc. implement/represent the messages for the protocol in JSON, and then: it is code, and no longer data.
      Hint: read about a simple protocoll, e.g SMTP.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    3. Re:Python: better than JS, except for JSON by MichaelSmith · · Score: 1

      With json in python I am going to go:

      import json
      my_data = json.loads(message_contents)
      do_something_with(my_data['part_of_data'])

      Which is better than passing message_contents directly into my own interpreter and assuming it doesn't do something it shouldn't be doing.

    4. Re:Python: better than JS, except for JSON by angel'o'sphere · · Score: 1

      So you don't know what your interpret is doing with JSON, even after you wrote it yourself?
      And "do_something_with" is not an interpreter?

      Hm ...

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    5. Re:Python: better than JS, except for JSON by MichaelSmith · · Score: 1

      So you don't know what your interpret is doing with JSON, even after you wrote it yourself?

      Its a message from Dr Evil.

      And "do_something_with" is not an interpreter?

      It might be print(my_data)

    6. Re:Python: better than JS, except for JSON by scorp1us · · Score: 1

      You mistake eval() for JSON.parse()

      Both JS and python can eval(). Yeah, it's really stupid to eval() code. And you can do it in JS and it will usually give you an object (the times it doesn't are very interesting indeed!) But JSON.parse() is not eval. JSON.parse decodes a string into an object, which is data only.

      Similarly json.loads() takes a string and converts it to a dict.

      What I was getting at is really a minor quibble but it comes up a lot. var o = { this:1 that: 2} is much more friendly to write than o = {"this": 1, "that":2} There are a limited number of what they key can be: string, int float. That is it. So if they key is non-numeric, then it can only be a string. That's the only point I was making. Perhaps it would be interesting to have key="this" o={ key: 1} which then makes {"this":1}, but I'd argue against it

      --
      Slashdot's rate-of-post filter: Preventing you from posting too many great ideas at once.
    7. Re:Python: better than JS, except for JSON by MichaelSmith · · Score: 1

      Then in python you want a namespace object. Yes, python makes you declare a class for that, maybe not as convenient but you can do a lot more with a class than just put data in it.

  12. Want braces in python? by Anonymous Coward · · Score: 0

    from __future__ import braces

  13. Dump Python 3.x by speedplane · · Score: 1

    Time to dump Python 3.x resume development on the 2.x branch. The ridiculous lack of backwards compatibility hurts far more than it helps.

    --
    Fast Federal Court and I.T.C. updates
    1. Re:Dump Python 3.x by Anonymous Coward · · Score: 0

      Agreed. Incompatible branching was a huge mistake.
      VB6 was the most widely used programming language until MS made the next version completely incompatible.
      Are nobody took lesson?
      Think how much Python 2.7 code working fine everywhere but everybody has time/will to spend on modifying all of them for Python 3.x?
      But I think it is still possible to modify Python 3.x to be compatible with Python 2.x.
      I have myself lots of Python 2.x scripts both at work and home.
      I would start using Python 3.x right away if it made made compatible with 2.x.

    2. Re:Dump Python 3.x by Anonymous Coward · · Score: 0

      May be a while ago that might have had merit but the move has not been forced, both can co-exist. For those that want 2to3 eases migration of code. Using 3 just to get over unicode nonsense got me to dump 2.

      Use 3 for new development or don't, migrate or don't what's the problem.

  14. Python is excellent as a glue by Anonymous Coward · · Score: 0

    The language is clean, the libraries are rich in functionality, and bindings to native code are easy. Python makes perfect glue for scripting complex processes - much more capable than shell script, and infinitely better than the awful powershell. It's also great for 'in application' scripting, since customers can pick it up easily. I work on a large retail product that both embeds, and can be embedded in a Python interpreter. I have nothing bad to say about it. Scipy/matplotlib give something like a more capable/versitile matlab for free. It's great for data processing. Anythimg that gets too slow can just be factored out, and moved to compiled code. I find the perl vs python comment amusing. Perl can be a 'write only' language, depending how it was written. I've seen perl scripts like that. This just doesn't seem to happen in python. Given a suitable idiot, you usually get at worst, code duplication, lack of seperation into proper classes or even functions, and general sphaghetti. It still needs to be re-written, but at least you can understand what it was supposed to do. There is no excuse for some perlisms. I think Dijkstra said something like 'you can write Fortran in any language'. I'd extend that with 'but you can only write obfuscated perl in perl'. Note that I'm not saying perl is intrinsically bad, but that I have certainly seen a lot of code that was badly written in perl modules, such that it was hardly readable. Clearly it has some functionality that should not be used to keep code clean and readable.

  15. Interestingly... by Anonymous Coward · · Score: 0

    Most tools I use still require Python 2.7 as a direct result of this.

    The backports modules provide enough support of new features that pretty much nothing actually requires Python 3 (other than dumb 'you must upgrade always' apps like Blender.)

    By and large though most things dabbled with Python 3 when it was claimed it was going to clean up the Python 2 messes, then after a couple minors breaking things (again!) they just migrated back to 2.7 and never looked forward.

  16. Python will continue to do fine - it's readable by Sarusa · · Score: 4, Insightful

    First, I know Javascript is wildly more popular as the language that runs everywhere, but it's not what most people use when they're writing a system / glue script - though some people do, they've got a hammer.

    Python's the utility / glue scripting language of choice precisely because it's READABLE - it doesn't have nine different ways to do everything like Perl does which makes it less expressive but more comprehensible and maintainable. You can definitely bang stuff out faster in Perl, but you can come back to the Python four years later and easily figure out what it's doing (just did that recently, fixed a large four year old 2.x script for new requirements and features and upgraded it to Python 3.x in a day, most of that testing), or grab someone else's Python and maintain it with reasonable effort unless they were seriously defective. Terrible programmers can write Perl in Python, and great programmers can write very maintainable code in Perl, but the language heavily skews the odds.

    Remember when Ruby briefly seemed like a contender for Python? Well, it was neat, and decent enough (I used it), but it had too many perlisms (punctuation vomit syntax) which made it similarly not so readable, and then all the magpies flew away to the next hotness and I went back to Python as more maintainable - and more capable because of the strong library support. And now Ruby is just 'That language you use for Rails'.

    Similarly, people like to bitch about the whitespace, but it forces readability. Perl people considered cramming 5 or more lines worth of Python on a single line a bragging point, and it was when vertical space was limited, but it's hell for readability and maintainability and we've got big monitors now. And if you have any code skills at all the whitespace is not a problem - I do Python, C#, C++, bash, Haskell, ASM, and VHDL - all wildly different, and the biggest problem is remembering how each does '# of items in a collection' (Count? count? Count()? Length? length? sizeof()?) - whitespace is not even on the radar.

    A more valid complaint is that Python has relentlessly marched towards cleaning itself up even if that breaks compatibility - it is not afraid to clean up terrible mistakes it has made (usually on new features) rather than leaving them in forever for compatibility reasons like bash has to. I know that's a big sticking point - it can be jarring when old code breaks, but locking old code you don't have the time to maintain to a specific version has worked pretty well for us. Mostly that's just segregating things as 2.x or 3.x. Code we have kept up to latest version has improved as a result as the language improves.

    Biggest weakness - the lack of compile time checks due to strong but dynamic typing continues to be an Achilles heel for any large project. Python (and other scripting languages) just aren't suited for that and we don't use it for that. Use something with static compile-time checking like C# or C++ - yes, after all my kvetching about readability we still use C++ for some things because nothing else fills its niche.

    1. Re:Python will continue to do fine - it's readable by Anonymous Coward · · Score: 0

      Yes, that's all well and good, but I was wondering why, even with the changes to idlelib, that they still aren't supporting Tcl/Tk 8.6 on MacOS?

      The "IDLE and tkinter with Tcl/Tk on macOS" web page has been updated to mention MacOS 10.12 ("Sierra") and Python 3.6, but sadly there appear to have been no salient changes made as to what version(s) of Tcl/Tk can be used with them. Given how long Tcl/Tk 8.6 has been out, this is very disappointing.

    2. Re:Python will continue to do fine - it's readable by Anonymous Coward · · Score: 0

      "Biggest weakness - the lack of compile time checks due to strong but dynamic typing continues to be an Achilles heel for any large project. Python (and other scripting languages) just aren't suited for that and we don't use it for that. Use something with static compile-time checking like C# or C++ - yes, after all my kvetching about readability we still use C++ for some things because nothing else fills its niche."

      I had thought the annotated variables and mypy resolved this.

  17. Pythong promises but does not deliver by Anonymous Coward · · Score: 0

    Unfortunately there is nothing about Python that encourages better programming by its users. I have seen plenty of people move from, say, C to Python and guess what ... they continue all of their bad habits in the new language. The end result is often worse than it would have been in C. Many programmers have trouble modularising their code no matter what the language. It simply becomes Python spaghetti.

    The indentation issue is something that could, and should, have been totally avoided by the Python creator. It was a very bad decision.

    Also, the instability of the Python modules is another serious flaw. We see situations where programmers have mandated Python2.4 or similar and moving to a newer Python becomes a large complicated problem.

  18. Before the apologists... by scorp1us · · Score: 1

    Before the apologists say you can use Babel, admittedly, you can, but, using such a tool is an admission of defeat. To compile something that is not true JS to something that is JS I would argue is not the original language. It's like using macros in assembly. It may seem pedantic, but pragmatically, Python runs _everywhere_ that C runs*. (Meaning your platform has a C compiler). Comparatively, using JSLint as an example, in order for JSLint to support a particular feature, it must be in two runtimes and at least stage 3 in proposal.

    * I'm not talking about browsers, because that's where JS was designed to work. I'm talking about outside the browser, where people are taking JS. And Mozilla did have an experiment about running Python in the browser. And if you want to split hairs: https://repl.it/languages/pyth...

    --
    Slashdot's rate-of-post filter: Preventing you from posting too many great ideas at once.
  19. Most important question! by Anonymous Coward · · Score: 0

    Is it compatible with Python 3.5? or do I need to rewrite my code? :-)

    flamebait +1

  20. Inkey$ by Anonymous Coward · · Score: 0

    Is there a inkey$ command yet.