generator expressions: performance anomaly?
Steve Holden
steve at holdenweb.com
Tue Jan 18 10:17:35 EST 2005
Antoon Pardon wrote:
> Op 2005-01-18, Steve Holden schreef <steve at holdenweb.com>:
>
>
>>Python is *designed* as a dynamic language. I wish you would embrace
>>this aspect rather than continually trying to shoehorn it into a static
>>straitjacket. Efficiency is good. Flexibility is better.
>
>
> Flexibility is better? IMO flexibilty implies more than one way to do
> things. But that is a big no no here in c.l.py.
>
Become one with the language.
> I also see a lot of remarks that go: "Don't do this!" when some of
> the more dynamic aspects are talked about, because there are
> security risks involved. One of the results was that I ended up
> writing a parser for some kind of game instead of just dumping the
> structure in textual form and doing an eval of the file when reading
> it in. But if I need a parser I could just as well used a static
> language.
>
Wow, you mean you actually *took* some advice? :-) Perhaps this whole
thing has arisen because you feel you were badly advised. It looks as
though your programming skill level might have been underestimated. Your
ability to wring an argument to a merciless death could never be.
> I'm beginning to guess the dynamic aspect of python is overrated.
>
You shouldn't have to guess, and it isn't.
Certain of its dynamic aspects do demand a certain care rather than
casual usage, however, which leads to rules of thumb like "don't use
mutables as dictionary keys". Yes, of course you can, but to a newbie
your behavior (it seems to me) is a bit like this:
Me (to newbie): "... And, of course, you want to be careful not to shoot
yourself in the foot."
You: ":Well, actually, if you use a .22 and aim very carefully between
the big toe and its neighbor there's a 96% chance that you will only
suffer serious burns".
So, please understand, I'm not trying to say that (most of) your
utterances are untrue, or question your knowledge of the Python
environment. I'm just trying to bring the day closer when you will be
able to watch me write something that's only 99% true and happily walk
away without writing a thousand-word essay on the remaining 1% case.
This anal behavior is unlikely to win friends and influence people.
Anyway, I've just about had my say on this topic now. I'm left with the
uncomfortable feeling that having led you patiently (or at least as
patiently as I can) down to the water, I will now have to watch you die
of thirst rather than take a well-deserved drink.
Life's too short. I'm going to stop disagreeing with you now, even if
this means stopping communicating with you. I'm sure you won't miss my
crotchety ramblings anyway.
regards
Steve
--
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/
Holden Web LLC +1 703 861 4237 +1 800 494 3119
More information about the Python-list
mailing list