UTF-8 characters in doctest

Peter Otten __peter__ at web.de
Fri Sep 21 02:23:53 EDT 2007


John J. Lee wrote:

> Peter Otten <__peter__ at web.de> writes:
> [...]
>> # -*- coding: utf8 -*-
>> r"""
>>>>> f("äöü".decode("utf8"))
>> (u'\xe4\xf6\xfc',)
>> """
>> def f(s):
>>     return (s,)
> 
> Forgive me if this is a stupid question, but: What purpose does
> function f serve?

Like the OP's get_inventary_number() it takes a unicode string and
returns a tuple of unicode strings. I'ts pointless otherwise. I hoped I
had stripped down his code to a point where the analogy was still
recognizable.

Peter



More information about the Python-list mailing list