"M.-A. Lemburg" <[EMAIL PROTECTED]> 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
>>>>> Unicode.
>>>> 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...

Cheers,
mwh

-- 
  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
_______________________________________________
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

Reply via email to