|
|
Subscribe / Log in / New account

2to3?

2to3?

Posted May 30, 2025 21:46 UTC (Fri) by Cyberax (✭ supporter ✭, #52523)
In reply to: 2to3? by mb
Parent article: Recent disruptive changes from Setuptools

> Nope. The actual problem was that many developers only ever tested ascii and delivered their software if it was "good".

And I would take that over Py3 string mess. It could have been easily fixed by just setting the string encoding to utf-8.

> If you handle strings you *need* to be aware of (2). Always.

No, you don't. If you're only using string operations for protocol-level stuff, like splitting the HTTP headers on a ":" character, then you can just treat strings as bags of bytes. Same for filesystem operations.


to post comments

2to3?

Posted May 30, 2025 21:49 UTC (Fri) by mb (subscriber, #50428) [Link] (1 responses)

yeah, right. If you don't use strings ("just treat strings as bags of bytes"), then you don't need to use strings.
That's trivially true and I don't see the problem. Just use bytes.

2to3?

Posted May 30, 2025 21:58 UTC (Fri) by Cyberax (✭ supporter ✭, #52523) [Link]

> yeah, right. If you don't use strings ("just treat strings as bags of bytes"), then you don't need to use strings.

That is correct. The problem is that the type for string literals in Python is, well, a string. It pops up in a myriad of places in the standard library.

For example, the exception message is (you guessed it) a string.

> That's trivially true and I don't see the problem. Just use bytes.

Well, I recommend you to try your own advice.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds