help me get excited about python 3

Discussion in 'Python' started by Sean Wolfe, Jan 4, 2012.

  1. Sean Wolfe

    Sean Wolfe Guest

    I am still living in the 2.x world because all the things I want to do
    right now in python are in 2 (django, pygame). But I want to be
    excited about the future of the language. I understand the concept of
    needing to break backwards compatibility. But it's not particularly
    exciting to think about. What are the cool new bits I should be
    reading up on?

    Related reading ... http://lucumr.pocoo.org/2011/12/7/thoughts-on-python3

    [Zaphod] Hey, Marvin! We've got a job for you.
    [Marvin] I won't enjoy it.
    [Zaphod] Yes, you will. There's a whole new life stretching out in front of you!
    [Marvin] Oh, not another one!
    [Zaphod] Shut up and listen! There'll be excitement and adventure and
    really wild things!
    [Marvin] Sounds awful.
    [Zaphod] But, Marvin ...
    [Marvin] I suppose you want me to help you to get into this spaceship ...
    [Zaphod] Marvin, will you just listen!
    [Marvin] ... and open the door for you.
    [Zaphod] What? Er ... Yeah.
    [Marvin] Well, I wish you'd just tell me, rather than try to engage my
    enthusiasm, because I haven't got one.


    --
    A musician must make music, an artist must paint, a poet must write,
    if he is to be ultimately at peace with himself.
    - Abraham Maslow
    Sean Wolfe, Jan 4, 2012
    #1
    1. Advertising

  2. Sean Wolfe

    Rick Johnson Guest

    On Jan 4, 9:56 am, Sean Wolfe <> wrote:
    > I am still living in the 2.x world because all the things I want to do
    > right now in python are in 2 (django, pygame). But I want to be
    > excited about the future of the language.


    Okay. So why not enjoy the best of both worlds (almost) and use
    version 2.7.2 along with "from __future__ import EVERYTHING".

    Your best course of action would be to write all code that can be
    written in Python 3000 IN Python 3000. If you must use Python 2.x
    because of dependencies, well then, you must.
    Rick Johnson, Jan 4, 2012
    #2
    1. Advertising

  3. You get some of the good stuff by importing future, unicode literals
    which essentially means you're working in unicode by default most of the
    time, and print function, (a small fix but long overdue).

    I try to write python3 whenever I can. It's rare that dependencies keep
    me back. More often it's debugger problems or lack of distributions,
    (python3 doesn't entirely build on MacOsX Lion and the distributed
    binaries can't download third party code that requires compilation).

    If you do anything with raw data, the bytes/unicode upgrades are a god
    send. The old way was workable, (although I still don't understand
    string quoting). The new way is much better, more rational, easier to
    understand, more consistent, better documented, closer to intuitive
    expectations, and expressively clearer. Trying to find idioms that work
    for both is horrendous, though.

    Unicode rocks. This change alone is leading me to use python in many
    places where, in the past, I would have used /bin/sh for portability.
    Utf-8 file names, file names with spaces and other "special characters",
    and user entered data fields with diacriticals are all difficult to
    handle in /bin/sh, awkward in python2, but near trivial in python3.

    Classic classes are finally dead.

    Range now works like xrange used to. This is great, although a bit
    clumsy when trying to write for both 2 and 3 concurrently.

    In practice, most of the library changes are 1:1 renames, which are both
    worthwhile and easy enough to work with.

    Most of the other interesting features, (imo), have been backported to
    2.7. Context managers, "with", str.format(), etc.

    I'm currently writing in both more or less concurrently most of the
    time, (can't afford to live without the debugger), and I'm really,
    REALLY looking forward to the day when I can drop the python2 idioms. I
    really hate adding crap to python3 clean code in order to backport
    support for python2.

    Really, the biggest win to 3, aside from the unicode/bytes change, is
    the fact that a lot of outdated stuff is finally getting flushed. IMO,
    it's not so much about the new features, (context managers are big, but
    have been backported), as it is about the lack of pollution from ancient
    ones. Many of the new changes are ramifications of these removals.

    --rich
    K Richard Pixley, Jan 5, 2012
    #3
  4. Sean Wolfe

    peter Guest

    I'm sure Python 3 is wonderful, but I make heavy use of the Python
    Imaging Library, which as I understand it has not been adapted to
    Python 3. There may be alternatives, but as I have a large amount of
    working code using PIL I am reluctant to drop it just yet.

    Peter
    peter, Jan 6, 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. Al Dykes
    Replies:
    2
    Views:
    443
    dimitri pater
    Oct 16, 2004
  2. Linuxguy123
    Replies:
    2
    Views:
    916
  3. aimeixu
    Replies:
    1
    Views:
    229
    Ulrich Eckhardt
    Jul 15, 2010
  4. Mark Carter

    Excited n00b

    Mark Carter, Feb 15, 2005, in forum: Ruby
    Replies:
    2
    Views:
    276
    Gavri Fernandez
    Feb 16, 2005
  5. Replies:
    2
    Views:
    80
    Tad J McClellan
    Oct 18, 2008
Loading...

Share This Page