[Python-3000] Release Countdown (original) (raw)
Jim Jewett jimjjewett at gmail.com
Sat Sep 1 01🔞12 CEST 2007
- Previous message: [Python-3000] Release Countdown
- Next message: [Python-3000] Release Countdown
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 8/31/07, "Martin v. Löwis" <martin at v.loewis.de> wrote:
>> 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 coconsts.
>> 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.
By that definition, bytes never receives a constant.
To go back to the original motivation
x.split(":") # a constant, currently fails in Py3K
x.split(b":") # mechanical replacement for x.split(":")
sep=":"
x.split(sep) # annoying but less important failure
I would prefer that x.split(":") work.
If that happens because bytes.split does the conversion for me (so that x.split(sep) also works), then great. But I realize that would require an assumption about the proper encoding.
If it works because the bytecode compiler changes x.split(":") into the moral equivalent of
try:
x.split(":")
except StrNotBytesError:
x.split(b":")
that is good enough. And for constants which appear as string literals in the code (token stringliteral), the proper encoding is known.
-jJ
- Previous message: [Python-3000] Release Countdown
- Next message: [Python-3000] Release Countdown
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]