Everything you did not want to know about Unicode in Python 3

MRAB python at mrabarnett.plus.com
Mon May 12 15:42:22 EDT 2014


On 2014-05-12 19:31, Ian Kelly wrote:
> On Mon, May 12, 2014 at 11:47 AM, alister
> <alister.nospam.ware at ntlworld.com> wrote:
>> On Mon, 12 May 2014 16:19:17 +0100, Mark Lawrence wrote:
>>
>>> This was *NOT* written by our resident unicode expert
>>> http://lucumr.pocoo.org/2014/5/12/everything-about-unicode/
>>>
>>> Posted as I thought it would make a rather pleasant change from
>>> interminable threads about names vs values vs variables vs objects.
>>
>> Surely those example programs are not the pythonoic way to do things or
>> am i missing something?
>
> The _is_binary_reader and _is_binary_writer functions look like they
> could be simplified by calling isinstance on the io object itself
> against io.TextIOBase, io.BufferedIOBase or io.RawIOBase, rather than
> doing those odd 0-length reads and writes.  And then perhaps those
> exception-swallowing try-excepts wouldn't be necessary.  But perhaps
> there's a non-obvious reason why it's written the way it is.
>
How about checking sys.stdin.mode and sys.stdout.mode?

> And there appears to be a bug where everything *except* the filename
> '-' is treated as stdin, so the script probably hasn't been tested at
> all.
>
>> if those code samples are anything to go by this guy makes JMF look
>> sensible.
>
> This is an ad hominem.  Just because his code sucks doesn't mean he's
> wrong about the state of Unicode and UNIX in Python 3.
>




More information about the Python-list mailing list