Palm Python?

Will Ware wware at world.std.com
Sat Jul 8 11:23:31 EDT 2000


Blake Winton (bwinton at tor.dhs.org) wrote:
> But man, is my C ever rusty...
> "Why can't I name two functions the same when they're in different
> files, and I only use them in their respective files?"

It's true that C's notion of namespaces is quite crude by Pythonic
standards, but you can give two functions the same name, if you
declare them with the keyword "static", which limits their scope to
the source file in which they appear. You'll probably want to put a
prototype at the top of the source file to catch forward references.

There's actually an interesting problem with "static", as it applies
to variables rather than functions. For variables, it also limits the
name scope to the current source file, but it has a second meaning
which is to ensure that the variable has a permanent address (rather
than being, say, just a local allocated on the stack). It would have
been good to use a second keyword for this second meaning. This hasn't
ever actually been a problem for me in writing C code, but it's an
interesting little design blunder.
-- 
 - - - - - - - - - - - - - - - - - - - - - - - -
Resistance is futile. Capacitance is efficacious.
Will Ware	email:    wware @ world.std.com



More information about the Python-list mailing list