Is 'everything' a refrence or isn't it?
Fredrik Lundh
fredrik at pythonware.com
Sat Jan 14 07:21:01 EST 2006
Bryan Olson wrote:
> > The identity is not, in itself, a part of the value.
> >
> > Python doesn't query the object to determine it's type or identity, but it
> > always has to query the object to access the value.
> >
> > A look at the C implementation of a typical object might help:
> >
> > typedef struct {
> > int ob_refcnt;
> > struct _typeobject *ob_type; /* type */
> > ... an unknown amount of stuff used to represent the value ...
> > } MyObject;
> >
> > In CPython, the MyObject* pointer is the identity. The ob_refcnt field is a
> > CPython implementation detail. The ob_type field contains the type.
>
> So, was it an editing error when you said that Python does not
> query the object to determine its type? The type is there in the
> object, and and in Python, variables and references are not typed.
do you want to understand this, or do you just want to argue ?
(hint: what might the word "query" mean in this context? can you think
of a meaning that's compatible with what I wrote? would concepts like
"object", "value", "type", and "identity" be radically different on a python
implementation that used e.g. "true" garbage collection and tagged pointers
instead of CPython's approach? if so, why?)
</F>
More information about the Python-list
mailing list