python/nondist/peps pep-0318.txt,1.8,1.9

Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv870 Modified Files: pep-0318.txt Log Message: * tweak adding attributes example * add open issue about changing func_name Index: pep-0318.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0318.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pep-0318.txt 30 Mar 2004 13:39:21 -0000 1.8 --- pep-0318.txt 31 Mar 2004 18:19:22 -0000 1.9 *************** *** 248,257 **** ... ! 3. Decorate a function with release information. (Based on an example ! posted by Anders Munch on ``python-dev``.) :: ! def release(**kwds): def decorate(f): for k in kwds: --- 248,257 ---- ... ! 3. Add attributes to a function. (Based on an example posted by ! Anders Munch on ``python-dev``.) :: ! def attrs(**kwds): def decorate(f): for k in kwds: *************** *** 260,268 **** return decorate ! def mymethod(f) [release(versionadded="2.2", ! author="Guido van Rossum")]: ... ! 4. Enforce function argument and return types. :: --- 260,270 ---- return decorate ! def mymethod(f) [attrs(versionadded="2.2", ! author="Guido van Rossum")]: ... ! 4. Enforce function argument and return types. (Note that this is not ! exactly correct, as the returned new_f doesn't have "func" as its ! func_name attribute.) :: *************** *** 331,334 **** --- 333,341 ---- ``python-dev``. + 2. Decorators which wrap a function and return a different function + should be able to easily change the func_name attribute without + constructing it with new.function(). Perhaps the func_name + attribute should be writable. + .. _strong arguments: http://mail.python.org/pipermail/python-dev/2004-March/thread.html
participants (1)
-
montanaroļ¼ users.sourceforge.net