name of object inside it's methods?

Moshe Zadka moshez at math.huji.ac.il
Mon Feb 28 00:33:31 EST 2000


On Mon, 28 Feb 2000, Jason Stokes wrote:

> 
> >In other words I want the method to print the name of the object that it
> >belongs to
> 
> 
> Objects do not have names.  Objects can be referred to by names, but this is
> not the same thing; any object can be referred to by multiple names.

Or none at all:

reader = lambda f=open("file"): f.readline()

The file isn't referred to with any name you can get your hands on easily.
(Yes, you could start taking reader apart, but it's at best shaky)
--
Moshe Zadka <mzadka at geocities.com>. 
INTERNET: Learn what you know.
Share what you don't.





More information about the Python-list mailing list