Compiling and running a flat Python file with args & keywds
Steven Taschuk
staschuk at telusplanet.net
Sat May 31 00:26:22 EDT 2003
Quoth martin z:
[...]
> ------------------------------
> Header (not in the python file):
> arg xpos
> arg ypos
> arg zpos
> keywd mass
> keywd speed
> keywd size
>
> ------------------
> In the python file:
> SetPos(xpos,ypos,zpos)
> if mass
> SetMass(mass)
> if speed
> SetSpeed(speed)
> ---------------------
>
> size is never used, or even mentioned. Currently, the arguments and
> keywords are parsed together into one dictionary and passed in as locals,
> and all the functions used are stored in the globals. Still, this is less
> than top optimizing.
What you're presently doing is probably what I would do.
It might well be possible to do some magic with code object
attributes, but afaik all of that is implementation- and
version-dependent, so you'd be setting yourself up for trouble in
the future.
Is this argument access really a performance hotspot?
--
Steven Taschuk "The world will end if you get this wrong."
staschuk at telusplanet.net -- "Typesetting Mathematics -- User's Guide",
Brian Kernighan and Lorrinda Cherry
More information about the Python-list
mailing list