Python-URL! - weekly Python news and links (Nov 17)

Steve Holden steve at
Tue Nov 18 18:22:54 CET 2008

rurpy at wrote:
> One of the reasons I would like to formulate a good
> model of an object's value and type is so that I could
> try to offer something better.  Responses like yours
> are significantly demotivating.

And yet you argue when people try to explain to you that objects don't
*have* values, objects *are* values. Objects have attributes, which are
references to other values. One of an object's attributes is its type.

You seem to be hunting for the ineffable "primitive value" that has no
other attributes. Such a thing doesn't exist.

>>> type(object) is type
>>> type(type) is type
>>> isinstance(type, object)
>>> isinstance(object, type)
>>> dir(object)
['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__',
'__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
'__setattr__', '__str__']
>>> object.__class__
<type 'type'>
>>> type.__class__
<type 'type'>
>>> dir(type)
['__base__', '__bases__', '__basicsize__', '__call__', '__class__',
'__cmp__', '__delattr__', '__dict__', '__dictoffset__', '__doc__',
'__flags__', '__getattribute__', '__hash__', '__init__', '__itemsize__',
'__module__', '__mro__', '__name__', '__new__', '__reduce__',
'__reduce_ex__', '__repr__', '__setattr__', '__str__', '__subclasses__',
'__weakrefoffset__', 'mro']
>>> type.__bases__
(<type 'object'>,)
>>> object.__bases__

Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC    

More information about the Python-list mailing list