Python 3 Syntax Changes

13,499

Solution 1

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/

Solution 2

Did you read this: Overview of Syntax Changes ?

Solution 3

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.

Share:
13,499
Admin
Author by

Admin

Updated on July 29, 2022

Comments

  • Admin
    Admin over 1 year

    So my work which had used older Python 2 is doing some code updating, anyways I 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

  • Admin
    Admin about 13 years
    The first one is important. There have been several changes in semantics - most should cause the code to fail fast (e.g. using the result of zip or range as a list), but there might be some subtle ones.
  • Admin
    Admin about 13 years
    Ya I read the Overview, but it doesn't really state specifics