Message23131
Logged In: YES
user_id=6133
Thanks for the clarifcation. However IMHO it is wrong to have different
behavior for different methods.
To wit, if I defined a method, it is a bound method, and ergo a "self" initial
argument is automatically supplied. However, a __repr__, even though I
define it, acts as an unbound method, with the self argument having a default
of the current instance but overrideable if an argument is supplied on the call.
This means that the argument evaluation/passing is different for these types
of builtins as opposed to other methods, both of which I have defined myself.
This just doesn't seem right to me, which is why I'm re-opening this bug
report... sorry to be annoying, but this definitely seems inconsistent and a
better explanation.
My current workaround is to do the following:
class foo:
def __str__(self):
return my_str()
def my_str(self):
return 'something'
So that I can do "foo.my_str = lambda self: return 'something else'".
When what I should be able to do is:
class foo:
def __str__(self):
return 'something'
...
foo.__str__ = lambda self: return 'something else'
|
|
| Date |
User |
Action |
Args |
| 2007-08-23 14:27:27 | admin | link | issue1066490 messages |
| 2007-08-23 14:27:27 | admin | create | |
|