M.-A. Lemburg wrote:
Walter Dörwald wrote:
M.-A. Lemburg wrote:
> [...]
__str__ and __unicode__ as well as the other hooks were specifically added for the type constructors to use. However, these were added at a time where sub-classing of types was not possible, so it's time now to reconsider whether this functionality should be extended to sub-classes as well.
So can we reach consensus on this, or do we need a BDFL pronouncement?
I don't have a clear picture of what the consensus currently looks like :-)
If we're going for for a solution that implements the hook awareness for all __<typename>__ hooks, I'd be +1 on that. If we only touch the __unicode__ case, we'd only be created yet another special case. I'd vote -0 on that.
> [...]
Here's the patch that implements this for int/long/float/unicode: http://www.python.org/sf/1109424
Any movement on this? +1 for making things work like str; if a subclass overrides __str__ it should use that method. If correctness of what is returned is a worry then a check could be tossed in before the value is returned.
-Brett _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com