Trinary operator?

Jeff Shannon jeff at ccvcorp.com
Fri Apr 19 13:37:10 EDT 2002


In article <a9pjl6$pj6$1 at slb4.atl.mindspring.net>, 
dalke at dalkescientific.com says...
> Dale Strickland-Clark:
> >But several orders of magnitude more processing [to use a dictionary
> >compared to an and/or solution]. Certainly not for tight, efficient loops.
> 
> Perhaps your intuition comes from C?  That doesn't seem to be the
> case for Python.
> 
[...] 
> Dictionary looks faster to me, in this small, tight loop.

And would be even faster if the dictionary creation were hoisted 
out of the loop, since it's invariant anyhow.

This definitely looks better to me.

-- 

Jeff Shannon
Technician/Programmer
Credit International



More information about the Python-list mailing list