[Tutor] toggle idiom?

Sean 'Shaleh' Perry shalehperry@attbi.com
Tue, 07 May 2002 14:05:29 -0700 (PDT)


On 07-May-2002 Andrei Kulakov wrote:
> Hello,
> 
> I'm not sure this is a "toggle idiom", but here's what it should do:
> 
> if a:
>     a = 0
> else:
>     a = 1
> 
> Is there a one-liner that can do this?
> 

a = not a