Index: Lib/test/test_descr.py =================================================================== --- Lib/test/test_descr.py (Revision 42459) +++ Lib/test/test_descr.py (Arbeitskopie) @@ -2000,6 +2000,24 @@ else: raise TestFailed, "expected ZeroDivisionError from bad property" + class E(object): + def getter(self): + "getter method" + return 0 + def setter(self, value): + "setter method" + pass + prop = property(getter) + vereq(prop.__doc__, "getter method") + prop2 = property(fset=setter) + vereq(prop.__doc__, None) + try: + prop = property(0) + except ValueError: + pass + else: + raise TestFailed, "expected ValueError from property(0)" + def supers(): if verbose: print "Testing super..." Index: Doc/lib/libfuncs.tex =================================================================== --- Doc/lib/libfuncs.tex (Revision 42459) +++ Doc/lib/libfuncs.tex (Arbeitskopie) @@ -771,7 +771,17 @@ x = property(getx, setx, delx, "I'm the 'x' property.") \end{verbatim} + If given, \var{doc} will be the docstring of the property attribute. + Otherwise, the property will copy \var{fget}'s docstring (if it + exists). + + If \var{fget}, \var{fset} or \var{fdel} are given but not callable, + \exception{ValueError} will be raised. + \versionadded{2.2} + \versionchanged[Use \var{fget}'s docstring if no \var{doc} given, + raise \exception{ValueErrors} if a function is + not callable]{2.5} \end{funcdesc} \begin{funcdesc}{range}{\optional{start,} stop\optional{, step}}