开发者

Python 3 Syntax Changes

So my work which had used older Python 2 is doing some code updating, anyways I开发者_Go百科 am just learning python and am actually pretty new here, but what are the major syntax changes that went from 2-->3

Or is there really even that much syntax changes at all (like I know print got changed, but what else MAJOR)

Thanks


What’s New In Python 3.0:
http://docs.python.org/release/3.0.1/whatsnew/3.0.html

PEP: 3000 - Python 3000:
http://www.python.org/dev/peps/pep-3000/

PEP: 3099 - Things that will Not Change in Python 3000:
http://www.python.org/dev/peps/pep-3099/


Did you read this: Overview of Syntax Changes ?


The things you really notice in the syntax are the print statement, and the change in the exception syntax. 2to3 will handle all that.

That won't cause you any headaches though. Those generally come from the split of strings into binary bytes and Unicode strings. 2to3 doesn't handle that.

So the changes in syntax aren't really what you need to worry about. :)

Then there are some minor changes in the syntax, tons of small changes in various functionality and a huge reorganization of the standard library, most of which 2to3 handles.

There isn't any canonical summary of all changes afaik, although I've tried to make one in my new book. There may be some misses, but there you go.


You can't do much better than to read the documentation: http://docs.python.org/release/3.1.2/whatsnew/ covers all the changes pretty succienctly. Read the "What’s New In Python 3.0" section first for the main changes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜