On 11 Mar 2020, at 19:03, Rhodri James <rhodri@kynesim.co.uk> wrote:
On 11/03/2020 18:45, Stephen J. Turnbull wrote:
We've headed off down the rabbit-hole of filenames for justification here, but surely pathlib is the correct tool if you are going to be chopping up filenames and path names? This isn't obvious to me. The majority of people (among those for whom my respect is "very high" or better) who hate Python 3 are people who spend much of their effort on byteslinging applications (Twisted and Mercurial come immediately to mind). I don't know if *they* think
Rhodri James writes: these APIs would be more useful than pathlib for them, but it's not obvious to me the APIs are *not* useful. I'm thinking of things like RFC 822-like headers, URI schemes, REST endpoints, yada yada yada. We should ask *them*. (By "we" I mean the proponents of the new APIs.)
That's fair. I don't deal with bytes in a way that prefixing or suffixing is any use for. I think even in the cgi module all the hairy parsing gets done elsewhere. I'm more concerned with how the original discussion seems to have obsessed about wanting prefix/suffix trimming to deal with filenames without seeming to have considered whether it's actually the right answer.
It already gives us OS-specific behaviour and the sort of partitioning of name elements that seem to be 90% of what people are asking for. I tend to agree, but I don't know what the byteslingers want/need, because I'm a text-oriented kinda guy. Maybe you know better, if you're a byteslinger, I'll take your word for it. I still think we should ask some of the folks I mentioned above.
I'm not that sort of byteslinger, but I'm completely prepared to believe they exist in numbers!
I do byte slinging in python as my current and previous day jobs. In the last job we had an appliance that allows upload of files from HTTP POST and FTP. We ran the file system with utf-8 encoding and the interface in unicode. But, I recall, we found out that FTP allows the client to set the encoding and that lead to us having to process filenames very carefully as they where not always uft-8 and we handled this as a special case and allowed the user to rename the files from byte-filename into a nice unicode name. I cannot remember if the USB sticks formatted on Windows suffered from encoding problems. Not sure if we have code in the current jobs code base to strip prefix/suffix, but would not be surprised. As almost all the data comes form HTTP we process in bytes. The cost of converting to and from unicode would drop the TPS rate more then we could bare. If the prefix/suffix functions are added to unicode then it would certainly be nice to have the same API for bytes and I'd use them. But I can always maintain our our functions to do this (might be doing that already). Barry
-- Rhodri James *-* Kynesim Ltd _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/6XNHB2... Code of Conduct: http://python.org/psf/codeofconduct/