About
Language - Object in Python.
In Python everything is an object including:
- and functions
Articles Related
Comparison
Comparing objects of different types is legal.
The outcome is deterministic but arbitrary: the types are ordered by their name. Thus, a list is always smaller than a string, a string is always smaller than a tuple, etc. Mixed numeric types are compared according to their numeric value, so 0 equals 0.0, etc.
The rules for comparing objects of different types should not be relied upon; they may change in a future version of the language.
Management
id
Object id
a=1
id(a)
1370343552
Conversion
To dictionary
vars([object]) -> dictionary
print(myObject)
type
type of an object
- Integer
print(type(1))
<type 'int'>
- String
print(type("1"))
<type 'str'>
print(type(myClass))
<type 'type'>
- Object
print(type(myClass()))
<class '__main__.myClass'>