Problem with mixing doctest with gettext _()

Pierre Rouleau prouleau at impathnetworks.com
Fri Feb 27 15:59:33 EST 2004


Peter Otten wrote:
> Pierre Rouleau wrote:
> 
> 
>>It worked, BUT only for a simple function, it fails if I add a another
>>simple function:
> 
> 
> Haven't read your post completely, but judging from the error message, it's
> just a minor glitch in mydisplayhook(). Try the following instead:
> 
> 
> 
>>>>def mydisplayhook(a):
> 
> ...     if a is not None:
> ...             sys.stdout.write("%r\n" % (a,))
> ...
> 
> That should be able to cope with tuples as commandline results.
> 
> Peter


You're right!  It does work. I must admit, that I don't see why though. 
  (a,) makes a tuple out of the `a` argument.  Does the %r conversion 
require a tuple?



More information about the Python-list mailing list