python-2.1 function attributes

D-Man dsh8290 at rit.edu
Thu Jan 25 14:18:30 EST 2001


On Thu, Jan 25, 2001 at 02:48:58PM +0000, Tony J Ibbs (Tibs) wrote:
| Decent syntax for this is obviously hard (else the Pythonlabs people and
| their cohorts would already have gotten one). But...
| 

Has anyone suggested a javadoc-like syntax before?

ex:

>>>def f() :
        """f() -> return value

           Other comments here

           @newattribute value_for_new_atribute
        """

>>>print f.__doc__
f() -> return value

Other comments here
>>>print f.__attributes__["newattribute"]
value_for_new_attribute
>>>

As I tried to show above, the extra stuff would be removed from the
__doc__ attribute, and instead placed into it's own proper attribute.

I don't recall the new attributes' names and the exact way of
accessing them off the top of my head right now, so I apologize since
I probably got it wrong.

Just a thought...
-D





More information about the Python-list mailing list