On 01/12/2016 07:59 AM, INADA Naoki wrote:
> Hi, all.
> 
> I found DB-API 2.0 defines Binary() as Binary(string).
> https://www.python.org/dev/peps/pep-0249/#binary
> 
> What the string means?
> On Python 2, should Binary accept unicode?
> On Python 3, should Binary accept str?


IMO, Py2K's "binary" is str, that's all you should accept, and Py3K's
"binary" is "bytes", that's all you should accept.   A Unicode object is
not a "binary" any more than a Python dictionary is.  If your users are
looking for the "convenience" of assuming unicodes become binaries by
using the nearest available character set to encode it, they need to be
reminded of "explicit is better than implicit" :).




> 
> -- 
> INADA Naoki  <songofaca...@gmail.com <mailto:songofaca...@gmail.com>>
> 
> 
> _______________________________________________
> DB-SIG maillist  -  DB-SIG@python.org
> https://mail.python.org/mailman/listinfo/db-sig
> 
_______________________________________________
DB-SIG maillist  -  DB-SIG@python.org
https://mail.python.org/mailman/listinfo/db-sig

Reply via email to