Re:The Zen of Python by Example
by eru on Friday February 11, 2011 @06:31AM
(#2205958)
> Yeah, I don't think you can use i % 2 as an equivalent of i % 2 == 0. Maybe it's a python 3 thing, but on my 2.6.1 the mod operator just returns the remainder, it doesn't change its output if it's a boolean context (which would be perlish and highly unpythonic).
Python doesn't have Perl-like contexts, but it does treat lots of values as True or False. I do agree that
is more explicit here.
[ Parent
| on HN ]
There are no comments on this comment yet.