2.2 features

Nick Perkins nperkins7 at home.com
Thu Jul 26 09:51:45 CEST 2001


Here's a nice little use of type/class unification:

instead of using:
if type(x) is type(0):

we can use:
if type(x) is int:

or, for type checking..

assert type(num) is int
assert type(msg) is str

( I assume the use of 'is', rather than '==',  is acceptable here )

..much prettier.






More information about the Python-list mailing list