1

Using Ctrl + i in Spyder generally displays the docstring for the object the cursor is at, but for the B method in the following code, it returns a red "No further documentation available" message:

class A():
    @property
    def B(self):
        ''' This is a docstring. '''

If the @property decorator is commented out, it works fine. I get that property is wrapping around B somehow, but it seems like there should be an easy, built-in way to get the docstring to pass through and I can't find an answer.

Is there a way to get around this? What's the best way to get the Spyder interactive help to display the docstring for potentially many class methods that each have the @property decorator?

This question certainly seems related, and may help answer why it behaves in this way, but does that mean I need to subclass the property built-in in some way?

EDIT: Maybe it's something internal to Spyder, because this works with @property:

>>> print(A.B.__doc__)    
 This is a docstring. 
Community
  • 1
  • 1
Brian
  • 1,988
  • 1
  • 14
  • 29
  • If you set the doc param of the `property` function (It’s one of the arguments, but I don’t know how to pass it in decorator form), that will be the doc for the property. – Jed Fox Oct 27 '16 at 21:40
  • Maybe it's something to do with Spyder itself. The voltage example in the following link says that `property` should pass the docstring through: https://docs.python.org/3/library/functions.html#property – Brian Oct 27 '16 at 21:52
  • If it helps, I'm using Python 3.5.1 and Spyder 2.3.8 – Brian Oct 27 '16 at 21:54
  • I’ve never used Spyder, so I’ve got no idea. – Jed Fox Oct 27 '16 at 21:55

1 Answers1

1

I found that upgrading from Spyder 2.3.8 to Spyder 3.0.1 fixes this issue. The docstring now displays properly.

Brian
  • 1,988
  • 1
  • 14
  • 29