Making a list-inhereted object return standard repr?
sholden at holdenweb.com
Mon Feb 4 16:04:11 CET 2002
"Delaney, Timothy" <tdelaney at avaya.com> wrote ...
> This brings up the interesting question of whether there should be a an
> object method which returns the "canonical repr" of an object i.e. the
> <module.Class object at address> or possibly even a builtin method (so it
> would work with classic classes too).
> I know I've wanted to use this in classic classes many times for debugging
> purposes - I want to be easily able to distinguish instances from each
> other. Each time I end up having to code it myself.
Although, of course, even this would not necessarily be unambigous if you
had code that produced classes from factory functions, as you would then
have to identify the class by address rather than by name (each class
returned by the factory having either the same name or no name at all,
depending on your point of view).
Consulting, training, speaking: http://www.holdenweb.com/
Python Web Programming: http://pydish.holdenweb.com/pwp/
More information about the Python-list