On Mon, May 12, 2014 at 11:47 AM, alister <alister.nospam.w...@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. 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. -- https://mail.python.org/mailman/listinfo/python-list