At 07:55 AM 5/6/2005 -0700, Guido van Rossum wrote: >[jJ] > > > Incidentally, would the resulting functions be a bit faster if you > compiled > > > the lambda instead of repeatedly eval ing it, or does the eval > overhead still > > > apply? > >[Michele] > > Honestly, I don't care, since "eval" happens only once at decoration time. > > There is no "eval" overhead at calling time, so I do not expect to have > > problems. I am waiting for volunteers to perform profiling and > > performance analysis ;) > >Watch out. I didn't see the code referred to, but realize that eval is >*very* expensive on some other implementations of Python (Jython and >IronPython). Eval should only be used if there is actual user-provided >input that you don't know yet when your module is compiled; not to get >around some limitation in the language there are usually ways around >that, and occasionally we add one, e.g. getattr()).
In this case, the informally-discussed proposal is to add a mutable __signature__ to functions, and have it be used by inspect.getargspec(), so that decorators can copy __signature__ from the decoratee to the decorated function. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com