[Python-Dev] str vs. unicode (original) (raw)
Alex Martelli aleax at aleax.it
Wed Jan 19 12:22:44 CET 2005
- Previous message: [Python-Dev] __str__ vs. __unicode__
- Next message: [Python-Dev] __str__ vs. __unicode__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Python-Dev] __str__ vs. __unicode__
- Next message: [Python-Dev] __str__ vs. __unicode__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]