Re: [Python-Dev] __str__ and unicode

2006-12-06 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Dec 6, 2006, at 9:15 AM, Michael Urman wrote: >> I don't have anything older than 2.4 laying around either, but IIRC >> in 2.3 unicode() did not call __unicode__(). > > It turns out __unicode__() is called on Python 2.3.5. Ah cool, thanks. I must

Re: [Python-Dev] __str__ and unicode

2006-12-06 Thread Michael Urman
> I don't have anything older than 2.4 laying around either, but IIRC > in 2.3 unicode() did not call __unicode__(). It turns out __unicode__() is called on Python 2.3.5. % python2.3 Python 2.3.5 (#2, Oct 18 2006, 23:04:45) [GCC 4.1.2 20061015 (prerelease) (Debian 4.1.1-16.1)] on linux2 Type "hel

Re: [Python-Dev] __str__ and unicode

2006-12-06 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Dec 6, 2006, at 7:07 AM, Nick Coghlan wrote: > M.-A. Lemburg wrote: >> On 2006-12-06 10:26, Fredrik Lundh wrote: >>> From what I can tell, __str__ may return a Unicode object, but >>> only if can be converted to an 8-bit string using the default

Re: [Python-Dev] __str__ and unicode

2006-12-06 Thread Nick Coghlan
M.-A. Lemburg wrote: > On 2006-12-06 10:26, Fredrik Lundh wrote: >> From what I can tell, __str__ may return a Unicode object, but >> only if can be converted to an 8-bit string using the default encoding. Is >> this >> on purpose or by accident? Do we have a plan for improving the situation >>

Re: [Python-Dev] __str__ and unicode

2006-12-06 Thread M.-A. Lemburg
On 2006-12-06 10:56, Fredrik Lundh wrote: > M.-A. Lemburg wrote: > >> This was added to make the transition to all Unicode in 3k easier: > > thanks for the clarification. > > do you recall when this was added? 2.5? Not really, only that it was definitely before 2.5. -- Marc-Andre Lemburg eGe

Re: [Python-Dev] __str__ and unicode

2006-12-06 Thread Fredrik Lundh
M.-A. Lemburg wrote: > This was added to make the transition to all Unicode in 3k easier: thanks for the clarification. do you recall when this was added? 2.5? ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/list

Re: [Python-Dev] __str__ and unicode

2006-12-06 Thread M.-A. Lemburg
On 2006-12-06 10:46, M.-A. Lemburg wrote: > On 2006-12-06 10:26, Fredrik Lundh wrote: >> over at my work copy of the python language reference, Adrian Holovaty >> asked about the exact semantics of the __str__ hook: >> >> http://effbot.org/pyref/__str__ >> >>"The return value must be a stri

Re: [Python-Dev] __str__ and unicode

2006-12-06 Thread M.-A. Lemburg
On 2006-12-06 10:26, Fredrik Lundh wrote: > over at my work copy of the python language reference, Adrian Holovaty > asked about the exact semantics of the __str__ hook: > > http://effbot.org/pyref/__str__ > >"The return value must be a string object." Does this mean it can be a >*Uni