integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

rantingrick rantingrick at gmail.com
Sun Jul 11 04:26:38 EDT 2010


On Jul 11, 2:39 am, Paul Rubin <no.em... at nospam.invalid> wrote:
> rantingrick <rantingr... at gmail.com> writes:
> > unspeakably ugly code.
>
> I'd write the code differently to not do all those branches.
> I like to use 1-elemnt lists as an option type, instead of using None,
> so you can just concatenate them together to get the first non-empty
> one.  Untested code:

<snip code>

Hmm, thanks for offering a solution but since functions call's induce
so much overhead and you use the  len function in each condition i
believe the code would run much slower. How much slower, i don't know?
Maybe i'll run the test later. I need to come up with some good test
cases. Of course i'll want to maximize my side of the argument by
producing the most efficient code that really makes your look
slow. ;-)




More information about the Python-list mailing list