integer >= 1 == True and integer.0 == False is bad, bad, bad!!!
Steven D'Aprano
steve-REMOVE-THIS at cybersource.com.au
Sun Jul 11 22:09:02 EDT 2010
On Sun, 11 Jul 2010 17:35:18 -0700, rantingrick wrote:
> 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.
Yes I did.
> I NEVER said
> building EMPTY tuples was the cause of my rant.
The cause of your rant appears to be that you have nothing better to do
with your time. But the *excuse* for your rant was that you had to
replace:
choiceIdx1 = None
with:
choiceIdx1 = ()
and followed with:
Seems kinda dumb to build a tuple just so a conditional
wont blow chunks!
and
My bin packer could potentially compute millions of parts.
I do not want to waste valuable processor cycles building
numerous TUPLES just for the sake of a conditional
"condition"!
[emphasis added]
> 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.
Yes, Python does support bad coding styles. The treatment of 0 as a false
value is not one of them though.
--
Steven
More information about the Python-list
mailing list