Trivial performance questions
Michael Hudson
mwh at python.net
Fri Oct 17 10:47:57 EDT 2003
"Brian Patterson" <bp at computastore.com> writes:
> >> I appreciate that these are trivial in the extreme, but I seem to be
> >> writing dozens of them, and I may as well use the right one and
> >> squeeze what performance I can.
>
> > This is an unhelpful attitude. You're writing in Python after all!
>
> I have never considered using the fastest available option to be an
> unhelpful attitude, especially when it does not impact on readability.
That's not what you said!
> It occurred to me that someone more knowledgable might know whether
> there was a 'right' answer to these trivial questions.
>
> However, it appears not. Sorry for wasting your time :(
Well, it was hardly a waste.
> Thanks for the tip on the getattr default. This is much cleaner to read,
> almost certainly quicker, and will serve the purpose well. I had convinced
> myself that it was not available in 2.1.3.
No, I think it's (at least) 1.5.2 vintage...
Cheers,
mwh
--
ARTHUR: Why should a rock hum?
FORD: Maybe it feels good about being a rock.
-- The Hitch-Hikers Guide to the Galaxy, Episode 8
More information about the Python-list
mailing list