>Another approach would be to add a new bsddb method to specify the
>default encoding to use to convert unicode->bytes, and to do the
>conversion internally when getting unicode data as a parameter. The
>issue here is that "u'hi' != b'hi'", so the translation must be done
>both when storing and when retrieving data.

What about a new keyword argument to the constructor, "encoding". If
specified, *only* accept unicode (and do the conversion internally). If
not specified, only accept bytes. That way, people dealing with "strings"
can set-and-forget, people doing hairy stuff can use bytes, and mistakes
instantly result in an exception.

-- 
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to