Re: Why has python3 been created as a seperate language where thereis still python2.7 ?

Discussion in 'Python' started by Michiel Overtoom, Jun 25, 2012.

  1. On Jun 24, 2012, at 05:46, gmspro wrote:

    > Why has python3 been created as a seperate language where there is still python2.7?


    It has not. Python2 and Python3 are very similar. It's not like if you learn Python using version 2, you have to relearn the language when you want to switch Python3. The syntax is the same, only 'print' is a function instead of a statement. Other improvements are unicode strings, cleanups in the library, lazy iterators, new-style classes by default etc... mostly background stuff you won't even notice in daily Python use.

    Greetings,

    --
    Test your knowledge of flowers! http://www.learn-the-flowers.com
    or http://www.leer-de-bloemen.nl for the Dutch version.

    Test je kennis van bloemen! http://www.leer-de-bloemen.nl
    of http://www.learn-the-flowers.com voor de Engelse versie.
     
    Michiel Overtoom, Jun 25, 2012
    #1
    1. Advertising

  2. Michiel Overtoom

    Guest

    On Monday, June 25, 2012 5:10:47 AM UTC-5, Michiel Overtoom wrote:
    > It has not. Python2 and Python3 are very similar. It's not like if
    > you learn Python using version 2, you have to relearn the language
    > when you want to switch Python3. The syntax is the same, only
    > 'print' is a function instead of a statement.


    However, there is something to be said for "old habits die hard". I myself lament every time i must type->(, then blah, then->) AGAIN!. My fingers are hardwired for the old print statement. Damned that Guido and his mind games!

    http://www.youtube.com/watch?v=-Ny42Mdg5qo
     
    , Jun 26, 2012
    #2
    1. Advertising

  3. Michiel Overtoom

    Guest

    On Monday, June 25, 2012 5:10:47 AM UTC-5, Michiel Overtoom wrote:
    > It has not. Python2 and Python3 are very similar. It's not like if
    > you learn Python using version 2, you have to relearn the language
    > when you want to switch Python3. The syntax is the same, only
    > 'print' is a function instead of a statement.


    However, there is something to be said for "old habits die hard". I myself lament every time i must type->(, then blah, then->) AGAIN!. My fingers are hardwired for the old print statement. Damned that Guido and his mind games!

    http://www.youtube.com/watch?v=-Ny42Mdg5qo
     
    , Jun 26, 2012
    #3
  4. (Rick, don't make me regret communicating with you again.)

    On Mon, 25 Jun 2012 19:28:01 -0700, rantingrickjohnson wrote:

    > However, there is something to be said for "old habits die hard". I
    > myself lament every time i must type->(, then blah, then->) AGAIN!. My
    > fingers are hardwired for the old print statement. Damned that Guido and
    > his mind games!


    There's no real difference between typing print(...) and all the other
    functions in Python. Do you lament having to type len(obj) instead of
    "len obj" or list(zip(a, b, c)) instead of "list zip a b c"?

    Making print a statement in the first place was a mistake, but
    fortunately it was a simple enough mistake to rectify once the need for
    backward compatibility was relaxed.


    --
    Steven
     
    Steven D'Aprano, Jun 26, 2012
    #4
  5. Michiel Overtoom

    Terry Reedy Guest

    On 6/25/2012 11:35 PM, Steven D'Aprano wrote:
    > (Rick, don't make me regret communicating with you again.)
    >
    > On Mon, 25 Jun 2012 19:28:01 -0700, rantingrickjohnson wrote:
    >
    >> However, there is something to be said for "old habits die hard". I
    >> myself lament every time i must type->(, then blah, then->) AGAIN!. My
    >> fingers are hardwired for the old print statement. Damned that Guido and
    >> his mind games!

    >
    > There's no real difference between typing print(...) and all the other
    > functions in Python.


    Yes there is ... as Rick said, habit. I still sometimes forget ;-(

    > Do you lament having to type len(obj) instead of
    > "len obj" or list(zip(a, b, c)) instead of "list zip a b c"?


    No.

    > Making print a statement in the first place was a mistake, but
    > fortunately it was a simple enough mistake to rectify once the need for
    > backward compatibility was relaxed.


    Complete agreed. I have used all of sep=, end=, and file= at various times.

    --
    Terry Jan Reedy
     
    Terry Reedy, Jun 26, 2012
    #5
  6. writes:

    > On Monday, June 25, 2012 5:10:47 AM UTC-5, Michiel Overtoom wrote:
    >> It has not. Python2 and Python3 are very similar. It's not like if
    >> you learn Python using version 2, you have to relearn the language
    >> when you want to switch Python3. The syntax is the same, only
    >> 'print' is a function instead of a statement.

    >
    > However, there is something to be said for "old habits die hard". I myself
    > lament every time i must type->(, then blah, then->) AGAIN!. My fingers are
    > hardwired for the old print statement. Damned that Guido and his mind games!
    >
    > http://www.youtube.com/watch?v=-Ny42Mdg5qo


    I'm of the opinion that the solution to this involves configuring your editor.
     
    Jeremiah Dodds, Jun 26, 2012
    #6
  7. On Mon, Jun 25, 2012 at 11:35 PM, Steven D'Aprano
    <> wrote:
    > There's no real difference between typing print(...) and all the other
    > functions in Python. Do you lament having to type len(obj) instead of
    > "len obj" or list(zip(a, b, c)) instead of "list zip a b c"?


    Surely you mean "list $ zip a b c"? ;)

    But yes, it's really not a big deal. It's a trivial change, and one
    that 2to3 can handle really easily.

    >
    > Making print a statement in the first place was a mistake, but
    > fortunately it was a simple enough mistake to rectify once the need for
    > backward compatibility was relaxed.


    Hmmm, why is the function so much better than the statement? You like
    using it in expressions? Or is it that you like passing it in as a
    callback?

    -- Devin
     
    Devin Jeanpierre, Jun 26, 2012
    #7
  8. Jeremiah Dodds, 26.06.2012 07:04:
    > writes:
    >
    >> On Monday, June 25, 2012 5:10:47 AM UTC-5, Michiel Overtoom wrote:
    >>> It has not. Python2 and Python3 are very similar. It's not like if
    >>> you learn Python using version 2, you have to relearn the language
    >>> when you want to switch Python3. The syntax is the same, only
    >>> 'print' is a function instead of a statement.

    >>
    >> However, there is something to be said for "old habits die hard". I myself
    >> lament every time i must type->(, then blah, then->) AGAIN!. My fingers are
    >> hardwired for the old print statement. Damned that Guido and his mind games!
    >>
    >> http://www.youtube.com/watch?v=-Ny42Mdg5qo

    >
    > I'm of the opinion that the solution to this involves configuring your editor.


    But wasn't the whole idea behind Python to be accessible for innocent
    users? Isn't the one and only acceptable goal of a language cleanup that
    those who do not have the expert knowledge to configure the editor of their
    choice should finally be able to wholeheartedly type down their Pythonish
    code without having the parser allude them to the one holy way from time to
    time? It clearly cannot have achieved that goal, given the amount of
    traffic on this list, can it?

    Maybe we should add a remote error reporting mode to Python that sends all
    syntax error messages not only to the local screen but also directly to the
    PSF so that they can fund developers who are able to delete that error
    message from the interpreter based on real world statistical evidence. That
    would eventually make the language match the powerset of what all users
    have in their fingers. A very worthy goal, if you ask me.

    Stefan
     
    Stefan Behnel, Jun 26, 2012
    #8
  9. Devin Jeanpierre, 26.06.2012 08:15:
    > On Mon, Jun 25, 2012 at 11:35 PM, Steven D'Aprano
    >> Making print a statement in the first place was a mistake, but
    >> fortunately it was a simple enough mistake to rectify once the need for
    >> backward compatibility was relaxed.

    >
    > Hmmm, why is the function so much better than the statement? You like
    > using it in expressions? Or is it that you like passing it in as a
    > callback?


    First of all, the statement has a rather special syntax that is not obvious
    and practically non-extensible. It also has hidden semantics that are hard
    to explain and mixes formatting with output - soft-space, anyone?

    The function is straight forward, configurable, does one thing, works with
    help() and doesn't get in the way. And something as rarely[1] used as a
    print simply doesn't deserve special syntax. Oh, and, yes, you can even
    pass it into some code as callback, although I rarely had a need for that.

    Stefan


    [1] Seriously, it's not very helpful in interactive mode and too simplistic
    to be used in application code. Even scripts often work better with logging
    than with prints.
     
    Stefan Behnel, Jun 26, 2012
    #9
  10. On Tue, 26 Jun 2012 02:15:17 -0400, Devin Jeanpierre wrote:

    >> Making print a statement in the first place was a mistake, but
    >> fortunately it was a simple enough mistake to rectify once the need for
    >> backward compatibility was relaxed.

    >
    > Hmmm, why is the function so much better than the statement? You like
    > using it in expressions? Or is it that you like passing it in as a
    > callback?


    Simplicity: there doesn't seem to be anything special about print that
    requires it to be syntax instead of just a built-in function. Nearly
    everything else which is handled by syntax is special: assignment,
    deletion, imports, flow control. (Decorators are the obvious exception,
    but they are pure syntactic sugar.)

    Consistency: print as a function isn't a special case to be learned.
    There's no need to memorise magic syntax to control it, you just pass
    ordinary arguments using ordinary syntax. Instead of arcane and bizarre
    special cases like this:

    print >>sys.stderr, spam, ham, eggs,

    you just use:

    print(spam, ham, eggs, file=sys.stderr, end='')

    While it's a tad longer, there's no special syntax to be learned.

    Practicality: as a function, you can use print anywhere you can use other
    functions. You can bind it to another name, pass it as argument to
    another function such as help(), store it in a list, use it as a
    callback, or monkey-patch it, without needing to write a wrapper
    "print_" (or "prnt", "pr", etc.) around it.


    Compare that to print as a statement, which only has one argument in
    favour: backwards compatibility.



    --
    Steven
     
    Steven D'Aprano, Jun 26, 2012
    #10
  11. On Wed, Jun 27, 2012 at 8:25 PM, Christian Tismer <> wrote:
    > I think, for the small importance of the print statement in code, it
    > would have made the transition easier, if python 3 was as flexible
    > as python 2.7, with a symmetric
    >
    > "from __past__ import print_statement" construct.
    >


    For how long? Will Python require, in perpetuity, the code to support
    this? Must the print statement be enhanced when the print function is?
    What about bug fixes? How much dev time is required to enable backward
    compatibility past a boundary across which backward compatibility was
    not promised? And if there's a limit to the duration of this __past__
    directive, when should it be and what should happen after that point?

    Much easier to simply say no.

    ChrisA
     
    Chris Angelico, Jun 27, 2012
    #11
  12. On Wed, Jun 27, 2012 at 7:02 AM, Chris Angelico <> wrote:
    > Much easier to simply say no.


    It's also easier to cease developing Python at all.

    By which I mean: just because something is hard doesn't mean it
    shouldn't be done. Lots of things Python does are hard, but they make
    users' lives easier. The question should probably be where developer
    effort is best spent, not where developers spend the least effort.

    -- Devin
     
    Devin Jeanpierre, Jun 27, 2012
    #12
  13. Michiel Overtoom

    Roy Smith Guest

    Re: Why has python3 been created as a seperate language where there is still python2.7 ?

    In article <>,
    wrote:

    > On Monday, June 25, 2012 5:10:47 AM UTC-5, Michiel Overtoom wrote:
    > > It has not. Python2 and Python3 are very similar. It's not like if
    > > you learn Python using version 2, you have to relearn the language
    > > when you want to switch Python3. The syntax is the same, only
    > > 'print' is a function instead of a statement.

    >
    > However, there is something to be said for "old habits die hard". I myself
    > lament every time i must type->(, then blah, then->) AGAIN!. My fingers are
    > hardwired for the old print statement. Damned that Guido and his mind games!


    On the other hand, I hate it (in P2) when I want to change a print to a
    pprint and have to add the parens, then take them back out when I want
    to go back to plain print.
     
    Roy Smith, Jun 27, 2012
    #13
  14. On Wed, Jun 27, 2012 at 9:24 PM, Devin Jeanpierre
    <> wrote:
    > On Wed, Jun 27, 2012 at 7:02 AM, Chris Angelico <> wrote:
    >> Much easier to simply say no.

    >
    > It's also easier to cease developing Python at all.
    >
    > By which I mean: just because something is hard doesn't mean it
    > shouldn't be done. Lots of things Python does are hard, but they make
    > users' lives easier. The question should probably be where developer
    > effort is best spent, not where developers spend the least effort.


    Of course, of course. Easier doesn't necessarily mean better. But
    there's a much larger cost to this kind of backward compatibility than
    many people realize.

    ChrisA
     
    Chris Angelico, Jun 27, 2012
    #14
  15. On 27.06.12 14:22, Stefan Behnel wrote:
    > For comparison, the revival of the "u" string prefix in Py3.3 is a simple
    > change in the parser grammar that's easy to maintain but that has a huge
    > impact on the Py3 compatibility of code that accepts to drop support for
    > Py2.5 and earlier (as well as Py3.[012]) but wants to keep working in
    > Py2.[67] (which supports the opposite "b" prefix).


    And even this simple change has caused unexpected issues (see issues
    #15054 and #15096), which were not predicted by the preceding stormy
    discussion. IMHO, the negative consequences of this change are undervalued.
     
    Serhiy Storchaka, Jun 27, 2012
    #15
  16. Michiel Overtoom

    Terry Reedy Guest

    On 6/27/2012 3:08 PM, Serhiy Storchaka wrote:
    > On 27.06.12 14:22, Stefan Behnel wrote:
    >> For comparison, the revival of the "u" string prefix in Py3.3 is a simple
    >> change in the parser grammar that's easy to maintain


    > And even this simple change has caused unexpected issues (see issues
    > #15054 and #15096), which were not predicted by the preceding stormy
    > discussion.


    #15054 was mostly not about 'u'.

    http://bugs.python.org/issue15096 is about 'u', or rather about the post
    discussion extension of 'u' to 'ur'. During the discussion of 'u', I
    predicted that adding 'innocuous' 'u' would lead to efforts to add other
    things. Adding 'ur' was the first example of that. We are fortunate that
    someone decided to test the new feature at the alpha stage. At least the
    near fiasco is a lesson.

    > IMHO, the negative consequences of this change are undervalued.


    Another prediction: people who code Python without reading the manual,
    at least not for new features, will learn about 'u' somehow (such as by
    reading this list) and may do either of the following, both of which are
    bad.

    1. They will confuse themselves by thinking that 'u' actually means
    somethings. They may then confuse others by writing about its supposed
    meaning. This might get amusing.

    2. They will use 'u' in Python 3 only code, thereby making it
    incompatible with 3.2-, even if it otherwise would not be.

    These two actions will reinforce each other.

    --
    Terry Jan Reedy
     
    Terry Reedy, Jun 27, 2012
    #16
  17. Michiel Overtoom

    alex23 Guest

    On Jun 28, 8:11 am, Christian Tismer <> wrote:
    > Random notes without context and reasoning are no better than spam.
    > My answer as well, of course, so let's stop here.


    It's more that all of this has been discussed at length. Repeatedly.
    It's very easy to criticise the current state of affairs when you
    didn't actively participate in the lead up to it and, by your own
    admission, really just want tools to "abuse" existing libraries
    without putting effort into migration. It's fine that you want this,
    but don't expect anyone else to put in effort where you're not
    prepared.

    If you believe providing a complementary __past__ namespace will work
    - even though I believe Guido has explicitly stated it will never
    happen - then the onus is on you to come up with an implementation.
     
    alex23, Jun 28, 2012
    #17
  18. Michiel Overtoom

    Guest

    On Monday, June 25, 2012 10:35:14 PM UTC-5, Steven D'Aprano wrote:
    > (Rick, don't make me regret communicating with you again.)


    Well unfortunately Steven i am not sure what causes you to stop communicating with me for these seeming random periods of time -- although i can deduce from past experiences that you have difficulty accepting diverse opinions, then, your emotions take control causing you to wield the only weapon of recourse you have available to you: the kill file -- so in that sense, i cannot provide a solution for a problem that exists beyond my control. HTH.

    > On Mon, 25 Jun 2012 19:28:01 -0700, rantingrickjohnson wrote:
    > There's no real difference between typing print(...) and all the other
    > functions in Python. Do you lament having to type len(obj) instead of
    > "len obj" or list(zip(a, b, c)) instead of "list zip a b c"?


    No. I actually like the forced parenthesis -- even when on a function declaration with no arguments. I think this is a consistent approach. And boy doi love consistency!

    > Making print a statement in the first place was a mistake, but
    > fortunately it was a simple enough mistake to rectify once the need for
    > backward compatibility was relaxed.


    Agreed. However, my comment was not a rant against the new print function, more that, it is a warning against pushing people to learn Python 2.x FIRST, and therby "training" them with the bad habit of using a "naked print syntax" that they will surely lament in the future.

    For me the print statement is like a big old delicious chocolate chip cookie and the print function is like a plate of leafy vegetables. I know i should eat my vegetables; but that damn cookie is just too tempting!
     
    , Jun 28, 2012
    #18
  19. Michiel Overtoom

    Guest

    On Tuesday, June 26, 2012 1:24:43 AM UTC-5, Stefan Behnel wrote:

    > Maybe we should add a remote error reporting mode to Python that sends all
    > syntax error messages not only to the local screen but also directly to the
    > PSF so that they can fund developers who are able to delete that error
    > message from the interpreter based on real world statistical evidence. That
    > would eventually make the language match the powerset of what all users
    > have in their fingers. A very worthy goal, if you ask me.


    I'm sure you meant this a joke, however, some feedback like this would be greatly beneficial to the developers and community. It's not something you'dwant to send each time an exception is thrown, but a log could be requested for delivery from time to time. I think it would be a great addition to any python editor; especially those geared toward neophytes: like IDLE and such.
     
    , Jun 28, 2012
    #19
  20. Michiel Overtoom

    Guest

    On Tuesday, June 26, 2012 1:24:43 AM UTC-5, Stefan Behnel wrote:

    > Maybe we should add a remote error reporting mode to Python that sends all
    > syntax error messages not only to the local screen but also directly to the
    > PSF so that they can fund developers who are able to delete that error
    > message from the interpreter based on real world statistical evidence. That
    > would eventually make the language match the powerset of what all users
    > have in their fingers. A very worthy goal, if you ask me.


    I'm sure you meant this a joke, however, some feedback like this would be greatly beneficial to the developers and community. It's not something you'dwant to send each time an exception is thrown, but a log could be requested for delivery from time to time. I think it would be a great addition to any python editor; especially those geared toward neophytes: like IDLE and such.
     
    , Jun 28, 2012
    #20
    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. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,975
    Smokey Grindel
    Dec 2, 2006
  2. Terry
    Replies:
    20
    Views:
    779
    Дамјан ГеоргиевÑки
    Feb 8, 2009
  3. Stefan Behnel
    Replies:
    3
    Views:
    332
    HoneyMonster
    Jun 26, 2012
  4. Andrew Berg
    Replies:
    0
    Views:
    249
    Andrew Berg
    Jun 25, 2012
  5. fl
    Replies:
    5
    Views:
    276
    Rui Maciel
    Jan 6, 2013
Loading...

Share This Page