From 0529b5cfe00d70ee1f1e765822a4018b292846ba Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Mon, 15 Jan 2001 20:47:14 +0000 Subject: [PATCH] Mark this PEP as final, and do a few minor updates. Guido's accepted it and the patch is in the cvs tree. --- pep-0232.txt | 57 ++++++++++++++++++++++++---------------------------- 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/pep-0232.txt b/pep-0232.txt index 8f85bb066..fcb5125a8 100644 --- a/pep-0232.txt +++ b/pep-0232.txt @@ -2,7 +2,7 @@ PEP: 232 Title: Function Attributes Version: $Revision$ Author: barry@digicool.com (Barry A. Warsaw) -Status: Draft +Status: Final Type: Standards Track Created: 02-Dec-2000 Python-Version: 2.1 @@ -94,42 +94,35 @@ Other Uses http://mail.python.org/pipermail/python-dev/2000-April/003364.html -Open Issues +Future Directions - 1) Should function attributes be settable or gettable when in - restricted execution mode? What about __dict__/func_dict? + - Currently, Python supports function attributes only on Python + functions (i.e. those that are written in Python, not those that + are built-in). Should it be worthwhile, a separate patch can be + crafted that will add function attributes to built-ins. - 2) Should built-in functions have writable attributes? The - current patch only supports attributes on user defined - (i.e. Python) functions and methods. Adding support to - built-in functions isn't difficult -- it would essentially - mirror the implementation for user defined functions (i.e. we - add a PyObject* to the PyCFunctionObject struct and write - getattro and setattro functions to read and write them). + - __doc__ is the only function attribute that currently has + syntactic support for conveniently setting. It may be + worthwhile to eventually enhance the language for supporting + easy function attribute setting. Here are some syntaxes + suggested by PEP reviewers: - 3) __doc__ is the only function attribute that currently has - syntactic support for conveniently setting. It may be - worthwhile to eventually enhance the language for supporting - easy function attribute setting. Here are some syntaxes - suggested by PEP reviewers: + def a { + 'publish' : 1, + 'unittest': '''...''', + } + (args): + # ... - def a { - 'publish' : 1, + def a(args): + """The usual docstring.""" + {'publish' : 1, 'unittest': '''...''', + # etc. } - (args): - # ... - def a(args): - """The usual docstring.""" - {'publish' : 1, - 'unittest': '''...''', - # etc. - } - - It isn't currently clear if special syntax is necessary or - desirable. It would be sufficient to postpone syntactic - support for some future PEP. + It isn't currently clear if special syntax is necessary or + desirable. Dissenting Opinion @@ -171,7 +164,9 @@ Reference Implementation doesn't include the regrtest module and output file. Those are available upon request. - http://sourceforge.net/patch/?func=detailpatch&patch_id=103123&group_id=5470 + http://sourceforge.net/patch/?func=detailpatch&patch_id=103123&group_id=5470 + + This patch has been applied and will become part of Python 2.1. References