[Python-ideas] "value" ~ "data" ~ "object"

Nick Coghlan ncoghlan at gmail.com
Thu Apr 15 16:40:10 CEST 2010


spir ☣ wrote:
> What useful distinctions are or may be done, for instance in documentation?

Python mainly considers:

object identity (x is y, determined by id())
object value (x == y, determined by the implementations of relevant
__eq__ methods)

For many objects, their value degenerates to being the same as their
identity (i.e. they compare equal only with themselves), but others have
for more useful comparisons defined (e.g. containers, numbers).

In addition to objects with their identities and values, there are
references to objects. These 'references' are the only things in Python
which aren't first class objects, since they reflect lookup entries in
some namespace or container, such as the mapping from names to pointers
in a class or module __dict__ or a function's locals, or the items
stored in a list or set.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------



More information about the Python-ideas mailing list