A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-January/051193.html below:

[Python-Dev] __str__ vs. __unicode__

[Python-Dev] __str__ vs. __unicode__Alex Martelli aleax at aleax.it
Wed Jan 19 12:22:44 CET 2005
On 2005 Jan 19, at 11:10, Bob Ippolito wrote:

> Do you REALLY think this should be True?!
>     isinstance(foo, unicode) and foo != unicode(foo)

Hmmmm -- why not?  In the generic case, talking about some class B, it 
certainly violates no programming principle known to me that 
"isinstance(foo, B) and foo != B(foo)"; it seems a rather common case 
-- ``casting to the base class'' (in C++ terminology, I guess) ``slices 
off'' some parts of foo, and thus equality does not hold.  If this is 
specifically a bad idea for the specific case where B is unicode, OK, 
that's surely possible, but if so it seems it should be possible to 
explain this in terms of particular properties of type unicode.


Alex

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4