[Python-Dev] Import and unicode: part two

Nick Coghlan ncoghlan at gmail.com
Fri Jan 21 08:55:25 CET 2011

On Fri, Jan 21, 2011 at 4:44 PM, Atsuo Ishimoto <ishimoto at gembook.org> wrote:
> On Fri, Jan 21, 2011 at 2:59 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>> These all sound like good reasons to continue to *advise* against
>> using non-ASCII module names. But aside from that, they sound exactly
>> like a lot of the arguments we heard when Py3k started enforcing the
>> bytes/text distinction more rigorously: "you're going to break
>> stuff!".
> No, non-ASCII module names are new breakage you are going to introduce now :)

No, they're not. Non-ASCII module names *already work* in Python 3.1
on UTF-8 filesystems. The portability problem you're complaining about
exists now, and Victor is trying to at least partially alleviate it by
making these filenames work correctly on more properly configured
systems (such as Windows). It won't go away until all filesystem
manipulation tools are properly Unicode aware, but that's no reason
for us to continue to unnecessarily exacerbate the problem.

Given imp_cafe.py:

import café

And café.py:

print('Hello world from {}'.format(__name__))

I get the following result:

~$ python3.1 imp_cafe.py
Hello world from café


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-Dev mailing list