Venkatraman S <venka...@gmail.com> writes:

[...]

> Right. I wrote this and then didnt send as the OP sounds like a n00b.

n00b (especially with the leet speak) is a tad pejorative. I think you
should not use the word here. 

> Btw, i got a  Q: why doesnt 'any' work in this case? Like...
> for tup in data:
>   if any(tup) > 5:
>     print 'greater'
>   else:
>     print 'lesser'

[...]

any expects an iterable of items with a truth value (True or
False). It will return True if any of the items are try. 

any(tup) will return True (since all the numbers in his tuple are non
zero and therefore True) so your condition is True > 5 (which ironically
evaluates to False on Python2.x) so it'll just print "lesser". 


-- 
~noufal
http://nibrahim.net.in

I am a deeply superficial person. -Andy Warhol
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to