[Tutor] use the data None

Alan Gauld alan.gauld at btinternet.com
Mon Jun 4 03:09:25 CEST 2012


On 04/06/12 01:39, Alan Gauld wrote:

> for var in (a,b,c):
>     if not var:
>            print var.__name__, ' is empty or false'

Oops, that won't work. __name__ is not an attribute
of object, which I thought it was...

But hopefully the intention was clear.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list