![]() |
Available news archives:
comp.lang.tcl
-
comp.lang.python
-
comp.security.firewalls
-
sci.crypt -
comp.lang.php -
comp.lang.javascript
|
|
comp.lang.python archiveRe: "Aliasing" an object's __str__ to a different method
From: Jeffrey E. Forcier <jforcier@strozllc.com>
Date: Sat Jul 23 2005 - 02:57:08 CEST
On Jul 22, 2005, at 7:46 PM, Michael Hoffman wrote:
> I'm too tired and/or lazy to check, but I believe str() is calling
So in other words, __str__() and its ilk are class methods instead of
(http://python.org/doc/2.4/ref/specialnames.html)
However, you appear to be correct, and the docs appear to be confused:
class MyClass(object):
def edit(self):
def setToEdit(self):
In [3]: test = MyClass()
Of course, this doesn't quite do what I had in mind, and in fact you
In [7]: repr(MyClass.__str__)
Either way, guess I will have to take another route. Your suggestion
Thanks for the response! If you or anyone else can shed some insight
Regards,
-- Jeffrey E. Forcier Junior Developer, Research and Development Stroz Friedberg, LLC 15 Maiden Lane, 12th Floor New York, NY 10038 [main]212-981-6540 [direct]212-981-6546 http://www.strozllc.com This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No right to confidential or privileged treatment of this message is waived or lost by any error in transmission. If you have received this message in error, please immediately notify the sender by e-mail or by telephone at 212.981.6540, delete the message and all copies from your system and destroy any hard copies. You must not, directly or indirectly, use, disclose, distribute, print or copy any part of this message if you are not the intended recipient.Received on Thu Sep 29 17:06:59 2005 |