help me get excited about python 3

S

Sean Wolfe

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.
 
R

Rick Johnson

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.
 
K

K Richard Pixley

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
 
P

peter

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top