[I18n-sig] Modified open() builtin (Re: Python Character Model)
M.-A. Lemburg
mal@lemburg.com
Sat, 10 Feb 2001 23:08:06 +0100
Paul Prescod wrote:
>
> At the bottom of one of my messages I proposed that we insert it as the
> second argument. Although the encoding and mode are both strings there
> is no syntactic overlap between [rwa][+]?[tb]+ and the set of existent
> or proposed encodings. If we merely outlaw encodings with that name then
> we can quickly figure out whether the second argument is a mode or an
> encoding. So the documented syntax would be
>
> open(filename, encoding, [[mode], bytes])
>
> And the documentation would say:
>
> "There is an obsolete variant that does not require an encoding string.
> This may cause a warning in future versions of Python and be removed
> sometime after that."
Any reason why we cannot use a keyword argument for encoding
and put it at the end of the argument list ? The result is:
1. no ambiguity
2. backward compatibility
3. good visibility of what the argument stands for (without having
to look up the manual for e.g. the meaning of 'mbcs')
--
Marc-Andre Lemburg
______________________________________________________________________
Company: http://www.egenix.com/
Consulting: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/