Who knows somefunction?

sismex01 at hebmex.com sismex01 at hebmex.com
Thu Sep 26 17:47:52 EDT 2002


> Erik Max Francis <max at alcyone.com> writes:
> > > Is there a function <somefunction> in Python
> > > for which
> > > 
> > > something is <somefunction>(id(something))
> > > 
> > > returns invariably true?
> > 
> > Not offhand, but there's an easier test.  x is y really 
> just means id(x)
> > == id(y), so you could change this test to:
> > 
> > 	id(something) == id(somethingElse)
> > 
> > and you probably wouldn't have the need for your 
> hypothetical function.
> 
> No I think he's asking for a way to dereference an id of an object.
> And the answer is there's no way to do that.
> 

Actually, it would be possible, in CPython at least;
but dangerous, and set a bad precedent.

Just imagine....

>>> x = deref(0x98237128)
>>> print x

--> and who knows what would happen here, because, what object
    would exist at that address?

Nope, it's a bad idea.

-gus







Advertencia: 
La informacion contenida en este mensaje es confidencial y restringida y
esta destinada unicamente para el uso de la persona arriba indicada, Esta
comunicacion representa la opinion personal del remitente y no refleja
necesariamente la opinion de la Compañia. Se le notifica que esta
estrictamente prohibida cualquier difusion, distribucion o copia de este
mensaje. Si ha recibido esta comunicacion o copia de este mensaje por error,
o si hay problemas en la transmision, favor de comunicarse con el remitente.


Todo el correo electrónico enviado para o desde esta dirección será
procesado por el sistema de correo corporativo de HEB. Tal correo
electrónico esta sujeto a ser almacenado y puede ser revisado por alguien
ajeno al recipiente autorizado con el propósito de monitorear que se cumplan
las normas de seguridad de la empresa.




More information about the Python-list mailing list