INADA Naoki writes:

 > latin1 is OK but is it Pythonic?

Yes.  EIBTI, including being explicit that you're doing something that
has semantics that you are ignoring but may come back to bite you or
somebody who naively uses your module.

There's nothing un-Pythonic about using potentially dangerous idioms.
We assume that you know what you are doing and either have taken
measures to trap exceptional cases or are willing to accept the risk
of an unhandled exception.

 > I've posted suggestion about add 'bytes' as a alias for 'latin1'.

Unpythonic.  Such alternative names hide the fact that there are
semantics that you may not want.  Only the programmer can know whether
it's safe.  If you want an ascii-compatible and space-efficient
representation that is safe even if the bytestream is something you
don't expect, you need to do something like I proposed.  If you don't
need efficiency, (encoding='ascii', errors='surrogateescape') is the
way to go.  But these still don't provide convenient interpolation of
binary data, as we discovered earlier.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to