[Python-Dev] Re: new syntax for wrapping (PEP 318)
Pete Shinners
pete at shinners.org
Thu Feb 26 03:07:17 EST 2004
I'm not too concerned about the syntax. All current proposals weigh about
equal to me. Although I don't believe "as" makes documentation lookup much
easier.
I think this feature will be another one of those positive changes that
effects the entire way python is used. The kind of thing like iterators,
string methods, etc. I've been playing with the idea for awhile and can
throw out some extra use cases.
Some of these may even be bad ideas apon further thought, but it's something
to ponder.
def main() [__main__]:
"""specify a function to be run if __name__=='__main__'. this
would need some other python tricks to actually work."""
def cleanup() [sys.atexit]:
"""ensures this function is called when program quits."""
def handler(event) [self.button.slot('clicked')]:
"""automatically make this function a callback for some
gui slot/signal mechanism."""
def food(arg) [pysco.optimize]:
"""specifically control functions that psyco takes over."""
def bard(arg, gar) [validate(int, str)]:
"""confirm arguments match a type. validate would
have to be a function that returns a function. odd."""
def corn() [profiler.track]:
"""log specific runtime stats on this function."""
def sanitytest() [sys.debugfunc]:
"""function is ignored at runtime if python not in
"-O" optimize mode (something like assert)."""
def entrypoint(data) [__all__]:
def hidden(data) [__hidden__]:
"""select functions for hiding or passing to 'import *'."""
I'm sure others will come to me as soon as I hit send. I don't know if I get
a vote, but I'm +2 on PEP 318.
More information about the Python-Dev
mailing list