Why are functions atomic?

Michael michael.forbes at gmail.com
Fri May 4 15:59:39 EDT 2007


On May 4, 9:19 am, John Nagle <n... at animats.com> wrote:
> > ...     def g():
> > ...         x = x + 1
>
>      Too cute.  Don't nest functions in Python; the scoping model
> isn't really designed for it.

How can you make generators then if you don't nest?

>     Python probably isn't the right language for N-dimensional optimization
> if performance is a major concern. That's a very compute-intensive operation.
> I've done it in C++, with heavy use of inlines, and had to work hard to
> get the performance up.  (I was one of the first to do physics engines for
> games and animation, which is a rather compute-intensive problem.)
>
>     If you're doing number-crunching in Python, it's essential to use
> NumPy or some other C library for matrix operations, or it's going to
> take way too long.

I know.  I am trying to flesh out a modular optimization proposal for
SciPy.  Using C++ would defeat the purpose of making it easy to extend
the optimizers.  I just want to make things as clean and efficient as
possible when I stumbled on this python copy problem.

Michael.




More information about the Python-list mailing list