News for hackers. Stuff that matters.
Re:What’s New in Python 3.7 by fulafel on Sunday September 17, 2017 @10:56AM (#15269897)
Switching the default encoding from ASCII to utf-8 sounds like a pretty big change.
Re:What’s New in Python 3.7 by coldtea on Sunday September 17, 2017 @11:58AM (#15270198)
Isn't ASCII a strict subset of UTF-8?

If anything this should make sure programs don't break because they read some utf-8 extended character when expecting just ascii -- which is the most common case.

Re:What’s New in Python 3.7 by fulafel on Monday September 18, 2017 @02:17AM (#15273742)
I didn't say it's a bad change!

But since you raise the issue, there are downsides: Many programs developed on 3.7 will inadvertently break on pre-3.7 Python versions. As we know, this is a big thing on parts of the Python ecosystem because users frequently rely on the Python version that come with their OS or framework (eg AWS Lambda), and many developers want to stay compatible with the most common platform-shipped Python versions.

Re:What’s New in Python 3.7 by ericfrederich on Tuesday September 19, 2017 @08:56AM (#15284180)
It's a good assumption for 3.7. In isolation this is a pragmatic decision and makes sense.

You are correct though. A .py file which uses non-ascii and doesn't declare the encoding should be considered an error though. Hopefully everybody's dev tools will pick this up (even on 3.7 where they wouldn't need to)

Re:What’s New in Python 3.7 by akx on Sunday September 17, 2017 @11:06AM (#15269939)
Not really, imho. It makes more things work out of the box, but input and output for things that used to be ASCII anyway remain the same.
[dead]
Re:What’s New in Python 3.7 by noselasd on Sunday September 17, 2017 @11:54AM (#15270178)
If it was changed from ascii to utf-8, how does it break everyting else ?
Re:What’s New in Python 3.7 by user5994461 on Sunday September 17, 2017 @03:07PM (#15271158)
ASCII doesn't exist as such.

Characters are encoded in one byte and ascii leaves the highest 128 characters undefined. They are interpreted system-wise, depends on the locale and user settings.

Re:What’s New in Python 3.7 by warbiscuit on Sunday September 17, 2017 @11:02PM (#15273092)
"ascii" the codec does exist under python. It's strictly defined as byte values 0-127, anything in the 128-255 range causes a decoding error...

    >>> b"abc\xf0".decode("ascii")
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xf0 in position 3
Thus, moving the default from "ascii" to an ASCII-superset should have no decoding issues for previously valid files, since those bytes were never valid to start with.
Re:What’s New in Python 3.7 by noselasd on Monday September 18, 2017 @01:29PM (#15277787)
ASCII very much exists - but what you describe is an entierly different thing. Sure - if the change is from default-user-locale to UTF-8, things would break.

But if the changelog is truthful, and the change is from ASCII to UTF-8, things should not break - at least not to any great extent.

Re:What’s New in Python 3.7 by akx on Sunday September 17, 2017 @12:51PM (#15270469)
I'm Finnish, thank you for asking, so I'm quite aware of different encodings.
Re:What’s New in Python 3.7 by JupiterMoon on Sunday September 17, 2017 @03:44PM (#15271320)
Is Finnish representable in Latin1? If so you might be missing some of the suitabilities of converting from "asci" (most things around Europe weren't asci but latin1) to utf.
Re:What’s New in Python 3.7 by VHRanger on Sunday September 17, 2017 @12:14PM (#15270285)
The only real question is:

When am I going to be able to name my variable as emojis?

Re:What’s New in Python 3.7 by masklinn on Sunday September 17, 2017 @01:53PM (#15270792)
Well Python 3 broadly follows UAX 31 "UNICODE IDENTIFIER AND PATTERN SYNTAX", and emoji don't have the xid_start or xid_continue properties, so… never unless you decide to be the change to believe in and get the Unicode consortium to change its ways?
Re:What’s New in Python 3.7 by dbcurtis on Sunday September 17, 2017 @01:47PM (#15270771)
You've been able to do that for a while.

edit: I take that back. Apparently thebunicode allowed in identifers is not unrestricted..... in my defense I don't use unicode identifiers as a rule....

Re:What’s New in Python 3.7 by masklinn on Sunday September 17, 2017 @01:56PM (#15270813)
You can use non-ascii characters but not emoji as arbitrary symbols are not generally classified as either XID_Start or XID_Continue.
Re:What’s New in Python 3.7 by agumonkey on Sunday September 17, 2017 @12:29PM (#15270357)
When Apple releases a MacBook Pro emoji keys only