re Challenge: More Compact?

Thomas Wouters thomas at xs4all.net
Mon Jul 16 04:22:55 EDT 2001


On Mon, Jul 16, 2001 at 02:39:50AM +0000, Tim Hammerquist wrote:

> I'm in the habit (in Python as well) of return undef on
> false because in some methods, 0 is ambiguous.  So, in cases where 0 is
> not ambiguous, 0 is idiomatically preferred to None?

You wouldn't call those functions in a boolean context, now would you ? I
prefer to return -1 if 0 is a valid return value, or just raise an exception
if -1 is valid as well. We're talking an entirely different function though,
one where an 'error return' really is exceptional. 

> Ok, so here's my version (I hate wasted line space and unnecessary temp
> vars):

Just wait until you revisit this code in 6 months ;)

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list