Python under PowerShell adds characters

Chris Angelico rosuav at gmail.com
Thu Mar 30 02:03:20 EDT 2017


On Thu, Mar 30, 2017 at 4:57 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
> What I'm saying is that every program must behave in a minimally
> controlled manner regardless of its inputs (which are not in its
> control). With UTF-8, it is dangerously easy to write programs that
> explode surprisingly. What's more, resyncing after such exceptions is
> not at all easy. I would venture to guess that few Python programs even
> try to do that.

If you expect to get a series of decimal integers, and you find a "Q"
in the middle, is it dangerously easy for your program blow up? How do
you resync after that? Do these questions even make sense? Not in my
opinion; you got invalid data, so you throw an exception and stop
reading data.

ChrisA



More information about the Python-list mailing list