On 12/14/2014 11:29 PM, Ben Finney wrote:
> 
> This entails, I believe, the admonition to ensure text literals are
> Unicode by default::
> 
>     from __future__ import unicode_literals
> 
> and to specify bytes literals explicitly with ‘b'wibble'’ if needed.

For some scripts this works great (I have some), and for some it does not (I 
have some of those, too).

> The ‘__import__’ built-in function, though, is tripping up.

One work-around I have used is:

  if isinstance(some_var, bytes):
      some_var = some_var.decode('ascii')
  # at this point some_var is unicode in both Pythons

--
~Ethan~

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to