Forgot your password?
typodupeerror
Programming IT Technology

The Evolution of Python 3 215

Posted by ScuttleMonkey
from the all-growd-up dept.
chromatic writes to tell us that O'Reilly has an interview with Guido van Rossum on the evolutionary process that gave us Python 3.0 and what is in store for the future. "I'd like to reiterate that at this point, it's a very personal choice to decide whether to use 3.0 or 2.6. You don't run the risk of being left behind by taking a conservative stance at this point. 2.6 will be just as well supported by the same group of core Python developers as 3.0. At the same time, we're also not sort of deemphasizing the importance and quality of 3.0. So if you are not held back by external requirements like dependencies on packages or third party software that hasn't been ported to 3.0 yet or working in an environment where everyone else is using another version. If you're learning Python for the first time, 3.0 is a great way to learn the language. There's a couple of things that trip over beginners have been removed."
This discussion has been archived. No new comments can be posted.

The Evolution of Python 3

Comments Filter:
  • by thetoadwarrior (1268702) on Monday January 12, 2009 @04:06PM (#26423003) Homepage
    and make everyone happy with Python 5.6
  • Evolution? (Score:3, Funny)

    by El_Muerte_TDS (592157) <elmuerte@Nospam.drunksnipers.com> on Monday January 12, 2009 @04:07PM (#26423013) Homepage

    Shouldn't that be intelligent design? Otherwise we'd have way more python flavors.

    • by Abreu (173023)

      Well, Python has a distinct, well known creator, so I guess it does qualify

    • It depends on if Python can actually fork() on Windows yet without using Cygwin.
    • There were a lot more flavors, but 3.0 and 2.6 ganged up and ate them all. Don't even ask about poor version 3.14159...
      • Re: (Score:3, Funny)

        Don't even ask about poor version 3.14159...

        I hear it bit its tail and now just slowly slithers around in a circle...
    • "Python species"

      There, fixed it for you! ;)

  • by NinthAgendaDotCom (1401899) on Monday January 12, 2009 @04:12PM (#26423083) Homepage

    I just started learning Python a few weeks ago when I got laid off from my QA job. I imagine I'm not to the point yet where the language differences between 2.x and 3.x are going to matter?

    • Re: (Score:3, Informative)

      Unless you're trying to learn how to code Django apps, which won't work on Python 3.0. Neither will a lot of other 3rd party modules.

    • by Random BedHead Ed (602081) on Monday January 12, 2009 @04:16PM (#26423139) Homepage Journal

      Not really. Keep learning 2.x as you were. Quoth Guido:

      http://www.artima.com/weblogs/viewpost.jsp?thread=211200 [artima.com]

      Ignore 3.0 for now. If you encounter it, there is a handy script to help update your code, though most of the language is unchanged. The biggest gotcha is that print is now a function print() rather than a statement.

    • Re: (Score:2, Interesting)

      by joetainment (891917)
      They will matter a little bit. Some very basic things (like the way the print function works) have changed. However, there's plenty of information on their website, and they've made tools to make migration easier. Those little problems should be easy enough to work around if you use 3.x, or you could keep using 2.x for a while until everything else catches up.
  • by AaxelB (1034884) on Monday January 12, 2009 @04:14PM (#26423103)

    There's a couple of things that trip over beginners have been removed.

    Ah, yes, I remember python tripping over me. It's actually pretty impressive that a snake figured out how to trip, why take out that feature? It seems like you're knocking it back a notch in the evolution toward legs.

    • So if you are not held back by external requirements like dependencies on packages or third party software that hasn't been ported to 3.0 yet or working in an environment where everyone else is using another version. If you're learning Python for the first time, 3.0 is a great way to learn the language. There's a couple of things that trip over beginners have been removed.

      Like basic grammatical structure, for instance? When did Palin become a Python dev?

  • by dedazo (737510) on Monday January 12, 2009 @04:23PM (#26423237) Journal

    For those interested, IBM is running a primer series [ibm.com] on the new language/runtime features.

    There's also this [python.org] older (but still relevant) PEP that explains things that did not change between the 2.x series and 3.0.

    Personally, I'm not looking forward to migrating existing code bases (especially non-trivial ones) to 3.0, but I'm planning to do all new development against it (of course assuming that the various packages I use have ports).

    For Python trivia lovers, here [slashdot.org] the the actual moment in time when 3.0 was let loose on the world. I'm such a sentimental geek :)

  • by HTH NE1 (675604) on Monday January 12, 2009 @04:26PM (#26423267)

    So if ( you are ( not ( held back by ( external requirements like ( dependencies on packages ) or ( third party software that hasn't been ported to 3.0 yet )))) or ( working in an environment where everyone else is using another version )).

    The above sentence fragment is apparently a verbal quotation where Guido van Rossum forgot he used the word "if" when he was somewhere in the middle.

  • Python 3 mostly changes things that deal with unicode (i.e. it uses unicode an it's "text" object, like Java).

    If you don't care about unicode that much (e.g. you mostly deal with development tools, iso-latin1/ascii encoded files...) there is absolutely no rush to hop on the bandwagon. And perhaps you just hate unicode as a concept ;-).

    I predict that the bandwagon will start rolling ~ Q2 / 2009, when toolkits like PyQt4 for 3.0 are materializing.

    • Of course the list would be pretty long (good thing I don't have to list it [python.org]), and of course Unicode is very significant, but I think there are other things just as significant if not more. Example: everything's an iterator now, not just a list.

      BTW, Python 2.x has all the unicode support you need to write a correct application. You just have to use u'unicode strings' instead of 'strings' in a lot more places. Python 3.0 has just switched the default, which will make it easier for application developers to

      • Unicode (Score:2, Troll)

        by spitzak (4019)

        I posted about this before in a previous Python 3.0 article and a lot of people attacked me. However I very much feel that Pythons treatment of Unicode as UTF-16 is a HUGE problem that will cause no end of pain. I think a far cleaner solution to Unicode is to do the following:

        - Make unmarked plain quoted strings produce byte strings just like they do now. Unless there are backslashes, the contents are precisely the bytes that are in the input file. Keep the automatic casting of byte strings to unicode strin

        • Re: (Score:3, Informative)

          I've read your previous posts. You weren't making any sense back then, and you aren't making any now either. However, for some reason your trolling seems to go well with the mods every time.

          It's a fact that the Unicode support in Python is not perfect (see e.g. this post [cmlenz.net]). However, every and any issue you might have with Python 3 internal representation of Unicode strings, you are bound to have with Python 2 as well. The only thing that has changed is that the unicode and str types got replaced with str and

  • Oh good. (Score:5, Insightful)

    by powerlord (28156) on Monday January 12, 2009 @04:45PM (#26423549) Journal

    There's a couple of things that trip over beginners have been removed.

    So whitespace block delineation is finally out, in favor of braces? :P

    • Re:Oh good. (Score:5, Insightful)

      by SatanicPuppy (611928) * <Satanicpuppy@MOSCOWgmail.com minus city> on Monday January 12, 2009 @05:14PM (#26424053) Journal

      I'll preface this by saying that I program primarily in brace-based languages.

      Braces suck in the worst possible way as a method of delineation. Let me give an example:

      while(...){if(...){if(...){}elseif(...){}}}

      That's clearly the suck, so we break it out like:

      while(...){
          if(...){
                if(...){
                }elseif(...){}
          }
      }

      ...at which point we realize that the braces are basically useless, since the code is unreadable without the whitespace. Python just forces you to use a readable formatting, and it's not all that hard to get used to.

      • Re:Oh good. (Score:5, Insightful)

        by hwyhobo (1420503) on Monday January 12, 2009 @05:26PM (#26424245)

        at which point we realize that the braces are basically useless, since the code is unreadable without the whitespace.

        No, it means the code is hard to read, but it still works. You can reformat that block, or you can change the spaces (tabs, number of spaces), and it will still work. In Python, it may look okay, and be readable, but it won't work.

        I guess it is a matter of priorities.

        BTW, I like Python (and have almost given up on Perl 6), but the white space thing drives me crazy.

        • Re:Oh good. (Score:5, Insightful)

          by costas (38724) on Monday January 12, 2009 @06:42PM (#26424821) Homepage

          The whitespace issue is a red-herring: most people get used to it quickly and it's not as strict as it sounds (you can mix-and-match tabs and spaces, as long as you are consistent for each *block*; not even an entire .py file). There's two real-world problems with it: copy-and-paste and generating Python code. Both are much less common than looking at badly-formatted code that it takes a bit to mentally parse which brace-delineated languages have.

          • by Unoti (731964)
            Parent is right. It sounds daunting before you actually work with it all the time. But in practice, you set up your editor to do the right thing, and it's never a problem again for you except like once every few months.
          • There's two real-world problems with it: copy-and-paste and generating Python code.

            And posting code on forums, or any other place that doesn't assign meaning to invisible characters. Python is like the cat of programming languages... always freaking out about some imaginary thing. You'll be writing your code all nice and friendly like and then accidentally hit tab instead of spaces and then out of the blue Rrrwrwr!

            Both are much less common than looking at badly-formatted code that it takes a bit to mentally parse which brace-delineated languages have.

            Any programming editor has a simple command to reindent or reformat the code. If you're writing your program in Word you're in trouble no matter what language.

            On the other ha

          • by Nevyn (5505) *

            The whitespace issue is a red-herring: most people get used to it quickly

            You have data to back this up, I assume? I'm not certain that the majority of people I know using python hate the whitespace retardedness, but I know it's not a "red-herring" and it's far from 90%+ of people who don't hate it (people either don't care or hate it, with a very few who thinks it's a great idea ... IME).

            There's two real-world problems with it: copy-and-paste and generating Python code.

            Err ... and let's not forget that

        • I was always a fan of the white space.
          Having worked with a lot of languages. Forcing good form is actually a nice feature, when the language doesn't enforce proper layout of application of any size will undoubtedly start getting sloppy. Adding an If statement or a while loop as a bug fix and not taking time to properly indent is quite common. And over say 20 years life span of an application, those simple fixes become sloppy code that is hard to read.

        • by Jeremi (14640)

          BTW, I like Python (and have almost given up on Perl 6), but the white space thing drives me crazy.

          I suppose there is no reason someone couldn't write some SVN hooks that would automatically add curly braces to Python code as it was being checked out from the repository, and automatically remove them again (and correctly indent the text) as Python code was being checked back in. And, of course, update the Python interpreter with a flag to optionally require curly braces instead of indentation, as a way of

          • Re: (Score:3, Interesting)

            by bitMonster (189384)
            Somebody wrote an encoding module to support braces in python code as kind of a joke. It's called pybraces [timhatch.com].

            The code that implements it is surprisingly short [timhatch.com].

        • by mgiuca (1040724)

          You can reformat that block, or you can change the spaces (tabs, number of spaces), and it will still work. In Python, it may look okay, and be readable, but it won't work.

          Why would you want to mess up the indentation?

      • by krischik (781389)

        Of course I would use:


        while ... loop
        if ... then
        if ... then
        null;
        else
        null;
        end if;
        end if;
        end while;

        Knowing at the end of an block which block ends is nice and can lead to more intelligent error messages.

        Of course braces don't give you that advantage either. They are indeed completely useless and g

    • by Kingrames (858416)
      No,theyremovedthewhitespace,butdidn'taddanybraces.
    • So whitespace block delineation is finally out, in favor of braces?

      No, unfortunately they did the worst thing they could do in that respect. Nearly all the changes introduced will make longer lines of code. I think they are trying to make sure that you will need to use the line continuation backslash, which completely negates the advantages of whitespace formatting.

      It seems that their definition of "clean syntax" is Java-like, rather than Perl-like. I never went to the extreme of playing "Perl Golf" [wikipedia.org], but a

      • Python was almost there, the perfect compromise between readability and conciseness. Until 3.0, when they went astray...

        So what, specifically, don't you like about Py3K? I've appreciated what I've seen so far. I don't mean that as a troll - I'm genuinely curious. What's less readable or concise for you?

  • by zwekiel (1445761)
    I think that whenever a group releases a new version of their language, they should strive to make it (mostly) backwards compatible. Not only does Python 3.0 change the way things work in relation to specific function, but it also removes specific language conventions and creates new ones in their places. This means that very large projects have a lot of work to do to bring their project over to the new specification.

    The question is: is this work worth the upgrade to python 3.0? I'd say on the whole, the
    • by ultrabot (200914) on Monday January 12, 2009 @05:07PM (#26423905)

      I think that whenever a group releases a new version of their language, they should strive to make it (mostly) backwards compatible.

      That's why they keep releasing 2.x versions that are backwards compatible.

      This means that very large projects have a lot of work to do to bring their project over to the new specification.

      Very large projects can stay with the 2.x series (along with a big portion of users) just fine.

      The question is: is this work worth the upgrade to python 3.0? I'd say on the whole, the changes do not contribute enough to the usability of the language to make it ultimately a worthwhile transition to make. I haven't seen really any compelling features in Python 3.0 that would provide enough incentive for me to spend hours of grunt work making all my code workable in Python 3.0.

      And you shouldn't, since it would probably be a waste of work. 2.x is a rock-solid series that is years away from obsolescense, and new serious projects started right now should pick 2.5 / 2.6. Try starting to use Py3 for projects where it fits - your command line scripts, self-contained internal applications... and ramp up the stakes when new libraries are ported.

      A programming language deserves a "cleanup" every now and then - this is such a thing. Hey, people have survived worse things, like gcc version changes, Qt3 => Qt4, Gtk 1 => Gtk2...

      • by MSG (12810)

        A programming language deserves a "cleanup" every now and then - this is such a thing. Hey, people have survived worse things, like gcc version changes, Qt3 => Qt4, Gtk 1 => Gtk2...

        Not to mention Perl4 -> Perl5.

        • by dkf (304284)

          Hey, people have survived worse things, like gcc version changes, Qt3 => Qt4, Gtk 1 => Gtk2...

          Not to mention Perl4 -> Perl5.

          Or Perl5 -> Perl6...

          (The bane of my life has been glibc versioning. Brought to you by the "Stable ABI? What's that?" school of programming.)

      • As a KDE fan, I have to say just how jealous I am that other software development communities actually have common sense.

        Apache: "Our newest is Apache 2, but you can use our rock-solid Apache 1 if you want."
        Python: "Our newest is Python 3, but you can use our rock-solid Python 2 if you want."
        KDE: "What!? You're still using KDE 3? But we told all our developers to drop all KDE 3 and move on to our newest KDE 4, which just came out with the second release candidate version of the beta for our alpha version!

    • by negative3 (836451)
      Backwards compatibility is good but it was never a part of the plan for Python 3 from the beginning - that was declared from the start and has been known for years. 2.6 and 3.0 were released close to each other. The biggest worry I have is that 3.0 is SLOWER than 2.6 in the benchmarks I have seen.

The reason that every major university maintains a department of mathematics is that it's cheaper than institutionalizing all those people.

Working...