Accessing Objects Based On Their ID

Tim Daneliuk tundra at tundraware.com
Tue Feb 15 14:28:05 EST 2005


Diez B. Roggisch wrote:

>>Given the ID of an object, is there a way to access it?  For example,
>>if we have the ID of a class instance, is there a way to invoke its
>>methods and attributes knowning only that ID?  Similarly, if we have the
>>ID of a function, is there a way to call it?
> 
> 
> No. 
> 
> 
>>This comes up because of an implementation I had in mind wherein I
>>would store the IDs of a notionally linked-list of objects - but without
>>the link - I just want to store their IDs in the desired order.  But
>>later, when I want to actually use the objects I need a way to get from ID
>>back to something accessible in the namespace...
> 
> 
> Why only the id? A list only stores a reference to the object anyway - no
> copy of it. So you don't gain anything by using the id.

Point taken... thanks.

-- 
----------------------------------------------------------------------------
Tim Daneliuk     tundra at tundraware.com
PGP Key:         http://www.tundraware.com/PGP/



More information about the Python-list mailing list