On 8/31/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 8/31/07, Jim Jewett <[EMAIL PROTECTED]> 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 _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com