[Python-Dev] PEP 460: allowing %d and %f and mojibake (original) (raw)
Guido van Rossum guido at python.org
Tue Jan 14 07:04:06 CET 2014
- Previous message: [Python-Dev] PEP 460: allowing %d and %f and mojibake
- Next message: [Python-Dev] PEP 460: allowing %d and %f and mojibake
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Jan 13, 2014 at 9:34 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
On 14 January 2014 15:15, Stephen J. Turnbull <stephen at xemacs.org> wrote:
The purity position is probably going to lose in the end, since Guido is clearly in the PBP camp at this point, and that's a strong indicator (especially since Nick has given up on convincing python-dev). But that does not mean it's entirely invalid. I didn't give up regarding PEP 460 - Guido pointed out an error in my assumptions that made my position invalid, and his correct. "Give up" makes it sound like I got tired of arguing without being convinced rather than admitting I was just plain wrong.
Thanks for that. (I was worried when I saw your first huge post in the reboot thread.)
While I'll still work on the asciistr proposal, that's unrelated to PEP 460 - it's about making hybrid APIs less painful to write in Python 3 when you're willing to place the burden of ensuring ASCII compatibility of binary data on the calling code. That kind of thing is likely to be a reasonable approach in specific domains (when writing a web development framework, for example), even though I think it's an inappropriate design for the standard library.
I've now looked at asciistr. (Thanks Glenn and Ethan for the link.)
Now that I (hopefully) understand it, I'm worried that a text processing algorithm that uses asciistr might under hard-to-predict circumstances (such as when the arguments contain nothing of interest to the algorithm) might return an asciistr instance instead of a str or bytes instance, and this might confuse a caller (e.g. isinstance() checks might fail, dict lookups, or whatever -- it feels like the problem is similar to creating the perfect proxy type).
PEP 460 should actually make asciistr easier in the long run, as I now expect we'll run into some "interesting" issues getting formatting to produce anything other than text (contrary to what I said elsewhere in these threads - I hadn't thought through the full implications at the time).
For example?
-- --Guido van Rossum (python.org/~guido)
- Previous message: [Python-Dev] PEP 460: allowing %d and %f and mojibake
- Next message: [Python-Dev] PEP 460: allowing %d and %f and mojibake
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]