[issue22656] `help` ignores `__doc__` of descriptors

2021-11-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This was fixed long ago in commit ac4bdcc80e986bdd5b9d10ab0bce35aabb790a3e

The code is in inspect.py::_finddoc().  See issue 25503.

--
nosy: +rhettinger
resolution:  -> out of date
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22656] `help` ignores `__doc__` of descriptors

2021-11-29 Thread Irit Katriel


Irit Katriel  added the comment:

I am unable to reproduce the problem on 3.11 (on a Mac). I get both help 
messages from Ram's code.

--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22656] `help` ignores `__doc__` of descriptors

2016-05-02 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22656] `help` ignores `__doc__` of descriptors

2016-05-02 Thread Berker Peksag

Berker Peksag added the comment:

The attached patch should solve this. We probably need to add more tests. 
test_property_subclass depends on issue 24766.

--
keywords: +patch
nosy: +berker.peksag
stage:  -> patch review
type:  -> behavior
versions: +Python 3.5, Python 3.6 -Python 3.4
Added file: http://bugs.python.org/file42684/issue22656.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22656] `help` ignores `__doc__` of descriptors

2015-07-21 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
nosy:  -ethan.furman

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22656
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22656] `help` ignores `__doc__` of descriptors

2014-10-17 Thread Ram Rachum

New submission from Ram Rachum:

The builtin `property` lets you specify a `doc` argument for your properties, 
which is great because then it shows up in `help`. So I figured that when I'm 
writing my own descriptor, I could set `__doc__` on it and have `help` use it. 
Not so, `help` ignores it. 

See this example:

class Property(object):
Emulate PyProperty_Type() in Objects/descrobject.c

def __init__(self, fget=None, fset=None, fdel=None, doc=None):
self.fget = fget
self.fset = fset
self.fdel = fdel
if doc is None and fget is not None:
doc = fget.__doc__
self.__doc__ = doc

def __get__(self, obj, objtype=None):
if obj is None:
return self
if self.fget is None:
raise AttributeError(unreadable attribute)
return self.fget(obj)

def __set__(self, obj, value):
if self.fset is None:
raise AttributeError(can't set attribute)
self.fset(obj, value)

def __delete__(self, obj):
if self.fdel is None:
raise AttributeError(can't delete attribute)
self.fdel(obj)

def getter(self, fget):
return type(self)(fget, self.fset, self.fdel, self.__doc__)

def setter(self, fset):
return type(self)(self.fget, fset, self.fdel, self.__doc__)

def deleter(self, fdel):
return type(self)(self.fget, self.fset, fdel, self.__doc__)


class A:
x = property(lambda self: 3,
 doc='Helpful text')

y = Property(lambda self: 7,
 doc='More Helpful text')


help(A.x) # Shows 'Helpful text'
help(A.y) # Does not show 'More Helpful text'


It seems that `property` is special-cased or something. I want to be able to 
set a docstring on my own descriptors.

--
components: Library (Lib)
messages: 229572
nosy: cool-RR
priority: normal
severity: normal
status: open
title: `help` ignores `__doc__` of descriptors
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22656
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22656] `help` ignores `__doc__` of descriptors

2014-10-17 Thread R. David Murray

R. David Murray added the comment:

You might find issue 5890 to be interesting reading.  It's been long enough 
that I forget the details, but I think the short answer is yes, property is 
special cased.   So probably what you want to do is subclass property.

Given the knock-on issue that fix caused, I've always been a little bit 
uncomfortable with it.  Perhaps you will see a way to generalize things.

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22656
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22656] `help` ignores `__doc__` of descriptors

2014-10-17 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
nosy: +ethan.furman

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22656
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22656] `help` ignores `__doc__` of descriptors

2014-10-17 Thread Ethan Furman

Ethan Furman added the comment:

Yeah, that was interesting. ;)

I think there are two different, yet related, issues:

  - which __doc__ should help display?

  - how should __doc__ be inherited?

The issue we should deal with here is the first, as what help displays does not 
have to follow the exact same rules as inheritence and magic-method lookup; 
specifically, help should be free to look for a __doc__ on the instance and 
incorporate it.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22656
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com