Re: Which Version of Python?

Discussion in 'Python' started by Peter, Sep 12, 2012.

  1. Peter

    Peter Guest

    If your desire is to "learn" Python then I would stick to 2.7

    My reasoning would be that there are still a significant number of packagesthat have not been ported to 3.x (and may never be ported).

    Not having looked at the changes in 3.x (so don't flame me! :)), it would seem that anything you "learn" in 2.7 would be easily transferred "up" whenand if you feel the need to go to 3.x, but in the meantime enjoy the better support of a greater range of packages that are still only 2.x compatible! i.e. learning (and using) features of 3.x could make it difficult to go "down" when/if you decide you really need to use a library that hasn't (and may never!) be ported to 3.x. For example, Graysons book on Python GUI programming is still one of the better Python GUI books (although very old now!) and it would steer you towards using the Pmw library - which may never beported to 3.x. If you decide to use wxPython for your GUI work then I see that has support for 2.x only also.

    So in this case, staying with the lower common denominator might be the better choice.
     
    Peter, Sep 12, 2012
    #1
    1. Advertising

  2. Peter

    Andrew Berg Guest

    On 2012.09.11 19:17, Peter wrote:
    > If your desire is to "learn" Python then I would stick to 2.7
    >
    > My reasoning would be that there are still a significant number of packages that have not been ported to 3.x (and may never be ported).

    This is true, but the /potential/ for the need for one of these packages
    is not a good reason to learn from a branch that will never get any new
    features. If there is indeed a compelling reason to stay with the older
    version, then it is a worthwhile tradeoff. Otherwise, it is just silly.

    > Not having looked at the changes in 3.x (so don't flame me! :))

    That would be a good reason /to/ flame you. ;)

    > , it would seem that anything you "learn" in 2.7 would be easily transferred "up" when and if you feel the need to go to 3.x,

    3.x is not a simple superset of 2.7 - there are certain limitations and
    ways of doing things in 2.x that don't apply to 3.x. A new programmer
    should learn, for example, handling Unicode properly (which is strongly
    encouraged in 3.x) and then learn how to deal with less-than-ideal
    implementations (like 2.x) rather than learn how to do it sloppily and
    then be frustrated when 3.x wants them to do it correctly. Backward
    compatibility was not broken for trivial reasons.

    > i.e. learning (and using) features of 3.x could make it difficult to go "down"

    The official documentation does point out things that have been
    added/changed both overall in the "What's New" page and specifically in
    each module's documentation.

    > when/if you decide you really need to use a library that hasn't (and may never!) be ported to 3.x.

    I don't think it's a good idea to encourage people (especially newbies)
    to stick with packages that won't get updated. I'm not saying that a
    package that isn't planned to be 3.x compatible will necessarily be
    unmaintained, but being unmaintained is the reason many packages will
    not be made 3.x compatible. In any case, packages that aren't getting
    support for 3.x will likely be replaced with better alternatives,
    especially once people start flocking en masse to 3.x (I'm no expert,
    but my guess is that this will happen once Django and Twisted support 3.x).

    If 3.0 had come out a month ago, I would see value in learning 2.x, but
    it's been nearly 4 years.
    --
    CPython 3.3.0b1 | Windows NT 6.1.7601.17803
     
    Andrew Berg, Sep 12, 2012
    #2
    1. Advertising

  3. On Tue, 11 Sep 2012 17:17:14 -0700, Peter wrote:

    > If your desire is to "learn" Python then I would stick to 2.7
    >
    > My reasoning would be that there are still a significant number of
    > packages that have not been ported to 3.x (and may never be ported).


    But if all you want is to learn Python, then those packages are
    irrelevant. If I want to learn to write Python code, why should I care
    about SomePackage, regardless of whether it supports Python 3.x or 2.x or
    even 1.x? As a beginner to the language, I don't even know it exists, and
    chances are I'm never going to use it.

    (I was happily using Python using only the standard library for about
    seven years before I installed my first third-party library.)

    You may not have intended it this way, but the argument "stick to Python
    2, because packages!" is a typical troll response. It might have been a
    reasonable response six years ago, when there weren't many (or even any)
    major packages that supported Python 3, but now many major packages do
    and most of those that don't are in the process of doing so. Now the
    choice is, paradoxically, much harder because library support is much
    more split: some libraries support 2.x, some 3.x, and some both.

    Of course, if you *need* to use SomePackage which only supports Python 2
    or 3, then that will drive your decision to learn Python 2 or 3. But
    consider:

    (1) If a package only supports Python 2 now, and *has no plans* to
    support Python 3, I would consider that package more or less a dead end
    and be reluctant to start a new project with it unless I had no other
    choice at all.

    (Seriously guys, if you're the developer of a project that only supports
    2.x and you aren't at least *thinking about* supporting 3.x, your project
    is going to be irrelevant to the wider world soon.)

    (2) The syntax differences between Python 2 and 3 are very minor. By the
    time you are proficient in one, you will be *easily* be able to jump to
    the other.


    > Not having looked at the changes in 3.x (so don't flame me! :)), it
    > would seem that anything you "learn" in 2.7 would be easily transferred
    > "up" when and if you feel the need to go to 3.x,


    It goes both ways. But frankly, whenever I drop down from 3.x code to 2.x
    code, I get really annoyed that there's a lot of excellent stuff I cannot
    use.


    > but in the meantime
    > enjoy the better support of a greater range of packages that are still
    > only 2.x compatible!


    That's true. But the range of 3.x compatible third party libraries is
    very impressive: it includes numpy and scipy, CherryPy, parts of zope
    (but not yet all of it), pyparsing, an unofficial port of nltk, py2exe,
    and many more. Others, like django, have committed to support 3.x as soon
    as they can drop support for 2.4 or 2.5.

    See also:

    http://python3wos.appspot.com/

    PyPy is now in the process of supporting Python 3. Within a few years,
    Python 3 will be the standard.


    > i.e. learning (and using) features of 3.x could
    > make it difficult to go "down" when/if you decide you really need to use
    > a library that hasn't (and may never!) be ported to 3.x.


    Any package that is not ported to 3.x will eventually be as obsolete and
    irrelevant as packages that only support Python 1.5. Python 2.7 will have
    an extended support period, but that won't last forever.

    My estimate is that we're past the half-way mark: in another four years,
    the question of "2.x or 3.x" will be irrelevant, people will be asking "I
    want to use library foo, but it only supports 2.7, what should I do?",
    and in eight years, people won't even ask that, they'll just ignore
    library foo as abandoned.


    > So in this case, staying with the lower common denominator might be the
    > better choice.


    Everyone has to make that choice for themselves, based on what libraries
    they intend to use. For those who don't intend to use any libraries at
    all, I think the answer is simple:

    Learn the version of Python that comes installed on your computer, or if
    you have to install it yourself, learn Python 3.



    --
    Steven
     
    Steven D'Aprano, Sep 12, 2012
    #3
  4. On Wed, 12 Sep 2012 02:11:22 +0000, Steven D'Aprano wrote:

    > On Tue, 11 Sep 2012 17:17:14 -0700, Peter wrote:
    >
    >> If your desire is to "learn" Python then I would stick to 2.7
    >>
    >> My reasoning would be that there are still a significant number of
    >> packages that have not been ported to 3.x (and may never be ported).

    >
    > But if all you want is to learn Python, then those packages are
    > irrelevant. If I want to learn to write Python code, why should I care
    > about SomePackage, regardless of whether it supports Python 3.x or 2.x
    > or even 1.x? As a beginner to the language, I don't even know it exists,
    > and chances are I'm never going to use it.
    >
    > (I was happily using Python using only the standard library for about
    > seven years before I installed my first third-party library.)
    >
    > You may not have intended it this way, but the argument "stick to Python
    > 2, because packages!" is a typical troll response. It might have been a
    > reasonable response six years ago, when there weren't many (or even any)
    > major packages that supported Python 3,


    Hardly surprising given that Python 3 came out four years ago. Sorry,
    brain-fart. I meant four years ago.


    --
    Steven
     
    Steven D'Aprano, Sep 12, 2012
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kenny
    Replies:
    0
    Views:
    467
    Kenny
    Jun 2, 2004
  2. V Green
    Replies:
    0
    Views:
    858
    V Green
    Feb 5, 2008
  3. PA Bear [MS MVP]
    Replies:
    0
    Views:
    969
    PA Bear [MS MVP]
    Feb 5, 2008
  4. MowGreen [MVP]
    Replies:
    5
    Views:
    2,020
    PA Bear [MS MVP]
    Feb 9, 2008
  5. Patrick
    Replies:
    0
    Views:
    143
    Patrick
    Sep 1, 2003
Loading...

Share This Page