mwh at python.net
Sun Feb 19 11:36:09 CET 2006
"M.-A. Lemburg" <mal at egenix.com> writes:
> Martin v. Löwis wrote:
>> M.-A. Lemburg wrote:
>>>>> True. However, note that the .encode()/.decode() methods on
>>>>> strings and Unicode narrow down the possible return types.
>>>>> The corresponding .bytes methods should only allow bytes and
>>>> I forgot that: what is the rationale for that restriction?
>>> To assure that only those types can be returned from those
>>> methods, ie. instances of basestring, which in return permits
>>> type inference for those methods.
>> Hmm. So it for type inference????
>> Where is that documented?
> Somewhere in the python-dev mailing list archives ;-)
> Seriously, we should probably add this to the documentation.
Err.................. I don't think this is a good argument, for quite
a few reasons. There certainly aren't many other features in Python
designed to aid type inference and the knowledge that something
returns "unicode or str" isn't especially useful...
ROOSTA: Ever since you arrived on this planet last night you've
been going round telling people that you're Zaphod
Beeblebrox, but that they're not to tell anyone else.
-- The Hitch-Hikers Guide to the Galaxy, Episode 7
More information about the Python-Dev