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