Need debugging knowhow for my creeping Unicodephobia

Anthony Tolle anthony.tolle at gmail.com
Wed Feb 10 15:17:51 EST 2010


On Feb 10, 2:09 pm, kj <no.em... at please.post> wrote:
> Some people have mathphobia.  I'm developing a wicked case of
> Unicodephobia.
> [snip]

Some general advice (Looks like I am reiterating what MRAB said -- I
type slower :):

1. If possible, use unicode strings for everything.  That is, don't
use both str and unicode within the same project.

2. If that isn't possible, convert strings to unicode as early as
possible, work with them that way, then convert them back as late as
possible.

3. Know what type of string you are working with!  If a function
returns or accepts a string value, verify whether the expected type is
unicode or str.

4. Consider switching to Python 3.x, since there is only one string
type (unicode).

--



More information about the Python-list mailing list