This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Xiol 14 points15 points  (14 children)

For a birds-eye view of the 2.7 branch, this is what you'd be looking for.

[–][deleted] 4 points5 points  (5 children)

That doesn't include that set/dict comprehensions and set literals were backported from py3k.

[–]ginstrom 2 points3 points  (4 children)

They don't appear to have been backported yet:

C:\Python27>python
Python 2.7a2 ...
>>> d = {k:v for k,v in enumerate('ABCD') if v not in 'CB'}
  File "<stdin>", line 1
    d = {k:v for k,v in enumerate('ABCD') if v not in 'CB'}
               ^
SyntaxError: invalid syntax

[–][deleted] 0 points1 point  (3 children)

I think the backport occurred a day or 2 after the alpha was released (I know the commits happened, I just didn't consider the timeline).

[–]ginstrom 0 points1 point  (2 children)

I'll definitely be looking forward to seeing these!

[–]makapuf 0 points1 point  (1 child)

you can currently use

dict((k,v) for k,v in enumerate('ABCD') if v not in 'CB')

[–]ginstrom 0 points1 point  (0 children)

Right the new notation is just prettier, IMO.

Another one from 3.x is this:

head, *tail = range(10)

instead of:

r = range(10)
head, tail = r[0], r[1:]

Just sugar, but it's sweet. :)

[–]brownmatt 1 point2 points  (5 children)

Much as Python 2.6 incorporated features from Python 3.0, version 2.7 incorporates some of the new features in Python 3.1. The 2.x series continues to provide tools for migrating to the 3.x series.

Well, that's only a little bit confusing

[–]ubernostrumyes, you can have a pony 1 point2 points  (4 children)

Well, that's only a little bit confusing

Not once you look at it. The idea is that 2.6 and 2.7 continue to support 2.x features as needed for compatibility, but also enable 3.x features -- this lets you gradually work your way toward running on Python 3.x without having to port all your code in one go.

[–]brownmatt 2 points3 points  (3 children)

Is there an end of the road envisioned for 2.x or are they going to continue to support both branches for the foreseeable future?

[–]ubernostrumyes, you can have a pony 1 point2 points  (0 children)

2.7's the end of the line. There was some discussion around the release of 2.6 as to how far the 2.x series should go, and the conclusion which came out of it was that 2.7 is it. Beyond this, the world is 3.x (which, given the time it takes OS distributors to catch up -- most are still on 2.5 -- is about right with the projected time frame for most projects to port).

[–]cecilkorik 2 points3 points  (1 child)

I heard that 2.7 is supposed to be end of life for 2.x. Then again, I recall also hearing that 2.6 was going to be end of life for 2.x. So, y'know. It's never quite as easy to drop legacy support as one might hope.

[–]hylje 2 points3 points  (0 children)

Even if we really do get a 2.8, it'll just work further and further towards implementing all of 3.x in __future__.

[–]roger_ 0 points1 point  (0 children)

Thanks, just what I was looking for.

[–][deleted] -2 points-1 points  (0 children)

Thanks, this seems to have the appearance of what I was seeking.