type names versus types module
Neal Norwitz
neal at metaslash.com
Fri Jul 26 16:58:16 EDT 2002
On Fri, 26 Jul 2002 16:39:26 -0400, Donnal Walter wrote:
> I read in Guido's keynote address (slide 15 of 23) that we are now
> supposed to be using built-in type names instead of the types module.
> What is the preferred alternative syntax in Python 2.2 for the following
> snippet?
>
> ...
> if type(content) is types.ListType:
> print 'content is a list'
> else:
> print 'content is not a list'
Check out PEP 8, Programming Recommendations (near the end).
http://www.python.org/peps/pep-0008.html
Guido prefers to use isinstance(content, list).
Neal
More information about the Python-list
mailing list