finding name of instances created

Nick Coghlan ncoghlan at
Mon Jan 24 06:41:18 EST 2005

Steven Bethard wrote:
> That is, you can just keep track of all the names of a Robot in the 
> Robot object.  In the simple case, where there's only one name, you can 
> display it as such.  In the more complicated case, where there's some 
> aliasing, you can display the multiple aliases.  This means you don't 
> have to teach about aliasing right off the bat, but if a student 
> accidentally discovers it on their own, the machinery's there to explain 
> it...

Incidentally, this discussion made me realise the real reason why using a lambda 
to create a named function is evil:

Py> def f(): pass
Py> f.func_name
Py> f = lambda: None
Py> f.func_name

I think I've heard that explanation before, but it never really clicked.


Nick Coghlan   |   ncoghlan at   |   Brisbane, Australia

More information about the Python-list mailing list