where are isinstance types documented?
Fredrik Lundh
fredrik at pythonware.com
Tue Sep 26 06:19:21 EDT 2006
codefire wrote:
> I'm using the isinstance built-in function. I've found the docs for it,
> but there are no docs on the supported types.
*all* types and classes can be used.
> For example isinstance(a, int) works fine but isinstance(s, string)
> doesn't - because 'string is not known'.
>
> I do know how to import the types module and then use defined types
> such as 'types.StringType' - but the documentation says that from 2.2
> this is not the preferred way.
>
> So, where's the documentation for types I can use with isinstance, such
> as 'int'?
based on http://docs.python.org/ref/types.html, here's a list of the
most commonly used core types:
None:
(singleton; use "is None" to test for this)
Numbers:
int
long
bool
float
complex
Sequences:
str
unicode
tuple
list
Mappings:
dict
Class Types:
(any class defined using "class")
Files:
file
hope this helps!
</F>
More information about the Python-list
mailing list