integer >= 1 == True and integer.0 == False is bad, bad, bad!!!
rantingrick
rantingrick at gmail.com
Sun Jul 11 20:35:18 EDT 2010
On Jul 11, 7:02 pm, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> Come back when you have profiled your code and
> can prove that the cost of building empty tuples is an actual bottleneck.
Did you even read this thread, i mean from head to tail. I NEVER said
building EMPTY tuples was the cause of my rant. My complaint (an oddly
enough the title of this thread!) concerns the fact that Python treats
0 as False and every integer above and below 0 as True. Which is
another example of how *some* aspects of Python support bad coding
styles.
The only reason i used the tuple was so that my conditional logic
worked as expected.
*Stephen* offered a solution in the form of using tuples within the
conditional expression. I countered his solution by showing that
creating tuples in a conditional expression is slower that testing for
bool-inity.
*Steven*, Please read the thread completely before making off hand
comments else you could make a complete fool of yourself!
More information about the Python-list
mailing list