[IPython-dev] IPython and unicode (planning ahead for Py3k)

Brian Granger ellisonbg.net@gmail....
Wed Nov 11 18:29:26 CST 2009


Hi,

I am running into an issue with paths and unicode strings in IPython.
Currently, in 99% of IPython's code base
we use str for *everything*.  But, there are a few things that are unicode
(get_ipython_dir, get_home_dir, some others).
The inconsistency is giving me some trouble and I need to decide if I should
be using str or unicode for files, paths, dirs.

So, I would like us to come up with a more consistent plan for unicode/str.
This is especially relevant for the Python 3.0
transition, where the str type goes away (only unicode and bytes).

Here is what I am thinking:

* Sometimes soon, we begin to do the transition from str-> unicode.
Basically, 99% of strings in IPython should be unicode.  That is
everything that is not a path, file, directory, etc.

* Starting now, every path, filename, etc should be unicode?  I am not as
sure about this one...
The Python 3 docs here:

http://docs.python.org/3.1/library/os.path.html

say the most general thing is to use bytes on unix/linux/os x and unicode on
Windows for paths,
files, dirs.  That seems like a huge pain though and would mean we have to
provide some sort
of abstraction layer for these things.  It would be so nice to simply use
unicode everywhere.
But, that means there are some paths that we can't represent on unix.

Does anyone have experience with Python 3.0 in this regard yet?

Cheers,

Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-dev/attachments/20091111/c679fd1c/attachment.html 


More information about the IPython-dev mailing list