4 ms·
Switching the default encoding from ASCII to utf-8 sounds like a pretty big change.
by fulafel 9y ago
Switching the default encoding from ASCII to utf-8 sounds like a pretty big change.
- akx 9y agoNot 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.
- user5994461 9y agoAre you American? Americans always think that changing the encoding is a minor detail. Guess what, changing the default encoding breaks every language that is not English.
- noselasd 9y agoIf it was changed from ascii to utf-8, how does it break everyting else ?
- user5994461 9y agoASCII 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.
- warbiscuit 9y ago"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.
- noselasd 9y agoASCII 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.
- deleted 9y ago[deleted]
- akx 9y agoI'm Finnish, thank you for asking, so I'm quite aware of different encodings.
- JupiterMoon 9y agoIs 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.
- coldtea 9y agoIsn'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.
- fulafel 9y agoI 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.
- ericfrederich 9y agoIt'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)
- VHRanger 9y agoThe only real question is: When am I going to be able to name my variable as emojis?
- agumonkey 9y agoWhen Apple releases a MacBook Pro emoji keys only
- dbcurtis 9y agoYou'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....
- masklinn 9y agoYou can use non-ascii characters but not emoji as arbitrary symbols are not generally classified as either XID_Start or XID_Continue.
- masklinn 9y agoWell 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?