Is a list an instance of a class?
kent3737 at yahoo.com
Sun Nov 14 21:33:44 CET 2004
In the Python tutorial section 9.1, it says, "the word ``object'' in
Python does not necessarily mean a class instance. Like C++ and
Modula-3, and unlike Smalltalk, not all types in Python are classes: the
basic built-in types like integers and lists are not, and even somewhat
more exotic types like files aren't."
Is this still correct or was it made obsolete by Python 2.2? Lists and
files have __class__ attributes, at least:
>>> f = open('ThreadQueue.py')
So do integers and floats, though you have to ask nicely for an int:
File "<stdin>", line 1
SyntaxError: invalid syntax
More information about the Python-list