[Tutor] am I missing another simpler structure?

Liam Clarke cyresse at gmail.com
Thu Dec 16 08:05:11 CET 2004


Alright, so that was a quick example, but....

>return not x % 2

A light dawns.

On Thu, 16 Dec 2004 15:58:38 +0900, Guillermo Fernandez Castellanos
<guillermo.fernandez.castellanos at gmail.com> wrote:
> Well...
> 
> > I find multiple returns to be rather useful
> > def isOdd(x):
> >     if not x % 2: return False
> >     return True
> 
> I find this easier though...
> 
> def isOdd(x):
>     return not x % 2
> 
> Enjoy,
> 
> Guille
> 


-- 
'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.


More information about the Tutor mailing list