[Patches] [ python-Patches-1005461 ] property to get the docstring from fget

SourceForge.net noreply at sourceforge.net
Mon Aug 9 04:06:44 CEST 2004


Patches item #1005461, was opened at 2004-08-08 11:08
Message generated for change (Comment added) made by ddorfman
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1005461&group_id=5470

Category: Modules
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Dima Dorfman (ddorfman)
Assigned to: Nobody/Anonymous (nobody)
Summary: property to get the docstring from fget

Initial Comment:
Allow property objects to use the fget function's docstring if a 
property docstring wasn't specified. This was suggested by 
someone on python-dev or c.l.py, but I don't remember who it was 
(sorry). Function docstrings are easier to write (read: prettier) than 
explicit doc= arguments, so this should make more properties 
have docstrings, sometimes automagically (I know it will for my 
code, anyway). It gets even better with syntatic sugar for 
decorators; read-only properties can now be defined, including 
docstring, with just one function:

  @property
    def golden(self):
        """The Golden Ratio. (Don't ask why this is a property.)"""
        return (1 + math.sqrt(5)) / 2

The doc part of the patch also improves some markup in the 
vicinity.

----------------------------------------------------------------------

>Comment By: Dima Dorfman (ddorfman)
Date: 2004-08-09 02:06

Message:
Logged In: YES 
user_id=908995

Oops, now that I'm sufficiently awake, it's pretty obvious that the patch 
is broken--it leaks a reference every time the new code runs. Mea culpa! 
Corrected patch attached.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1005461&group_id=5470


More information about the Patches mailing list