[Python-3000] Release Countdown
Jim Jewett
jimjjewett at gmail.com
Sat Sep 1 00:17:57 CEST 2007
On 8/31/07, Guido van Rossum <guido at python.org> wrote:
> On 8/31/07, Jim Jewett <jimjjewett at gmail.com> wrote:
> > (1) Allow bytes methods to take a literal string (which will
> > obviously be in the source file's encoding).
> Yuck, yuck about the source file encoding part. Also, there is no way
> to tell that a particular argument was passed a literal.
There is when compiling to bytecode; it goes in co_consts.
> The very
> definition of "this was a literal" is iffy -- is x a literal when
> passed to f below?
> x = "abc"
> f(x)
No, it isn't. Though I suppose consistency with that sort of use
(particularly inside a function, where the compiler *could* know) is
the main argument against this.
> > (2) There really ought to be an immutable bytes type, and the literal
> > (or at least a literal, if capitalization matters) ought to be the
> > immutable.
> > PLISTHEADER = b"""\
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD
> > PLIST 1.0//EN" "http://www.apple.com/DTDs/
> > PropertyList-1.0.dtd">
> > """
> > If the value of PLISTHEADER does change during the run, it will almost
> > certainly be a bug. I could code defensively by only ever passing
> > copies, but that seems wasteful, and it could hide other bugs. If
> > something does try to modify (not replace, modify) it, then there was
> > probably a typo or API misunderstanding; I *want* an exception.
> Sounds like you're worrying to much. Do you have any indication that
> this is going to be a common problem?
> > http://svn.python.org/view/python/branches/py3k/Lib/plat-mac/plistlib.py?rev=57563&r1=57305&r2=57563
Let me reverse the question. In Py2, that variable holds a constant
string. What is the value in making that constant mutable?
-jJ
More information about the Python-3000
mailing list