Why are functions atomic?

Carsten Haese carsten at uniqsys.com
Wed May 2 09:08:36 EDT 2007


On Tue, 2007-05-01 at 22:21 -0700, Michael wrote:
> Is there a reason for using the closure here?  Using function defaults
> seems to give better performance:[...]

It does? Not as far as I can measure it to any significant degree on my
computer.

> This is definitely one viable solution and is essentially what I had
> in mind, but I did not want to have to carry the generator arround
> with me:

I don't know what you mean by "carry it around." Just put it in a module
and import it where you need it.

An overriding theme in this thread is that you are greatly concerned
with the speed of your solution rather than the structure and
readability of your code. How often is your function going to get called
and how much of a performance benefit are you expecting?

-Carsten





More information about the Python-list mailing list