Mercurial > p > roundup > code
comparison roundup/anypy/README.txt @ 4089:eddb82d0964c
Add compatibility package to allow us to deal with Python versions 2.3..2.6.
Outstanding issues noted in roundup/anypy/TODO.txt
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 12 Mar 2009 02:52:56 +0000 |
| parents | |
| children | 9ba03348f923 |
comparison
equal
deleted
inserted
replaced
| 4088:34434785f308 | 4089:eddb82d0964c |
|---|---|
| 1 roundup.anypy package - Python version compatibility layer | |
| 2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 3 | |
| 4 Roundup currently supports Python 2.3 to 2.6; however, some modules | |
| 5 have been introduced, while others have been deprecated. The modules | |
| 6 in this package provide the functionalities which are used by Roundup | |
| 7 | |
| 8 - adapting the most recent Python usage | |
| 9 - using new built-in functionality | |
| 10 - avoiding deprecation warnings | |
| 11 | |
| 12 Use the modules in this package to preserve Roundup's compatibility. | |
| 13 | |
| 14 sets_: sets compatibility module | |
| 15 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 16 | |
| 17 Since Python 2.4, there is a built-in type 'set'; therefore, the 'sets' | |
| 18 module is deprecated since version 2.6. As far as Roundup is concerned, | |
| 19 the usage is identical; see | |
| 20 http://docs.python.org/library/sets.html#comparison-to-the-built-in-set-types | |
| 21 | |
| 22 Uses the built-in type 'set' if available, and thus avoids | |
| 23 deprecation warnings. Simple usage: | |
| 24 | |
| 25 Change all:: | |
| 26 from sets import Set | |
| 27 | |
| 28 to:: | |
| 29 from roundup.anypy.sets_ import set | |
| 30 | |
| 31 and use 'set' instead of 'Set' (or sets.Set, respectively). | |
| 32 To avoid unnecessary imports, you can:: | |
| 33 | |
| 34 try: | |
| 35 set | |
| 36 except NameError: | |
| 37 from roundup.anypy.sets_ import set | |
| 38 | |
| 39 hashlib_: md5/sha/hashlib compatibility | |
| 40 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 41 | |
| 42 The md5 and sha modules are deprecated since Python 2.6; the hashlib | |
| 43 module, introduced with Python 2.5, is recommended instead. | |
| 44 | |
| 45 Change all:: | |
| 46 import md5 | |
| 47 md5.md5(), md5.new() | |
| 48 import sha | |
| 49 sha.sha(), sha.new() | |
| 50 | |
| 51 to:: | |
| 52 from roundup.anypy.hashlib_ import md5 | |
| 53 md5() | |
| 54 from roundup.anypy.hashlib_ import sha1 | |
| 55 sha1() | |
| 56 | |
| 57 # vim: si |
