ASPN ActiveState Programmer Network
  ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups | Web Services
SEARCH
advanced | search help

Reference
ActivePython 2.4
What's New
What's new in Python 2.3?
Contents
1 PEP 218: A Standard Set Datatype
2 PEP 255: Simple Generators
3 PEP 263: Source Code Encodings
4 PEP 273: Importing Modules from Zip Archives
5 PEP 277: Unicode file name support for Windows NT
6 PEP 278: Universal Newline Support
7 PEP 279: enumerate()
8 PEP 282: The logging Package
9 PEP 285: A Boolean Type
10 PEP 293: Codec Error Handling Callbacks
11 PEP 301: Package Index and Metadata for Distutils
12 PEP 302: New Import Hooks
13 PEP 305: Comma-separated Files
14 PEP 307: Pickle Enhancements
15 Extended Slices
16 Other Language Changes
17 New, Improved, and Deprecated Modules
18 Pymalloc: A Specialized Object Allocator
19 Build and C API Changes
20 Other Changes and Fixes
21 Porting to Python 2.3
22 Acknowledgements
About this document ...

MyASPN >> Reference >> ActivePython 2.4 >> What's New >> What's new in Python 2.3?
ActivePython 2.4 documentation

21 Porting to Python 2.3

This section lists previously described changes that may require changes to your code:

  • yield is now always a keyword; if it's used as a variable name in your code, a different name must be chosen.

  • For strings X and Y, X in Y now works if X is more than one character long.

  • The int() type constructor will now return a long integer instead of raising an OverflowError when a string or floating-point number is too large to fit into an integer.

  • If you have Unicode strings that contain 8-bit characters, you must declare the file's encoding (UTF-8, Latin-1, or whatever) by adding a comment to the top of the file. See section 3 for more information.

  • Calling Tcl methods through _tkinter no longer returns only strings. Instead, if Tcl returns other objects those objects are converted to their Python equivalent, if one exists, or wrapped with a _tkinter.Tcl_Obj object if no Python equivalent exists.

  • Large octal and hex literals such as 0xffffffff now trigger a FutureWarning. Currently they're stored as 32-bit numbers and result in a negative value, but in Python 2.4 they'll become positive long integers.

    There are a few ways to fix this warning. If you really need a positive number, just add an "L" to the end of the literal. If you're trying to get a 32-bit integer with low bits set and have previously used an expression such as  (1 « 31), it's probably clearest to start with all bits set and clear the desired upper bits. For example, to clear just the top bit (bit 31), you could write 0xffffffffL &~(1L«31).

  • You can no longer disable assertions by assigning to __debug__.

  • The Distutils setup() function has gained various new keyword arguments such as depends. Old versions of the Distutils will abort if passed unknown keywords. A solution is to check for the presence of the new get_distutil_options() function in your setup.py and only uses the new keywords with a version of the Distutils that supports them:

    from distutils import core
    
    kw = {'sources': 'foo.c', ...}
    if hasattr(core, 'get_distutil_options'):
        kw['depends'] = ['foo.h']
    ext = Extension(**kw)
    

  • Using None as a variable name will now result in a SyntaxWarning warning.

  • Names of extension types defined by the modules included with Python now contain the module and a "." in front of the type name.

See About this document... for information on suggesting changes.

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState 2004 All rights reserved