Avoiding the __repr__ call or protecting an instance from evaluation URG. please

Donn Cave donn at oz.net
Sat Jan 27 21:55:56 EST 2001


Quoth Fernando Rodrguez <spamers at must.die>:
| 	I have a class whose __repr__ method returns a string. Whenever I pass
| an instance of this class to a function, what the function gets is the result
| of __repr__. Most of the time this is OK, but under certain circumstances I
| also need to make sure that a function receives an instance of the class, and
| the the string that __repr__ returns.

Somewhere in this, you have been deceived.  Python doesn't do that
kind of thing, converting function arguments like C++, and whatever
you pass to a function should arrive intact.

It's hard to say what has been happening to confuse the issue.
Note that if you "print" a sequence, repr will be used to render
its contents.

	Donn Cave, donn at oz.net



More information about the Python-list mailing list