![]() |
what is the doc parameter of property? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: what is the doc parameter of property? (/thread-17400.html) |
what is the doc parameter of property? - microphone_head - Apr-09-2019 Hi all. I was doing some light reading and noticed a line in sprite.py file that I didn't totally understand. The lines of code were found in the DirtySprite class. I guess its declaring a property in the sprite module for the class DirtySprite, but I thought all declarators like that had to be declared like: @propertyThe lines i'm interested in are: visible = property(lambda self: self._get_visible(), lambda self, value: self._set_visible(value), doc="you can make this sprite disappear without " "removing it from the group,\n" "assign 0 for invisible and 1 for visible")Can anyone tell me anything about the doc parameter? ![]() FYI: I'm running a RaspberryPi2B+ RE: visible = property - Yoriz - Apr-09-2019 See python docs https://docs.python.org/3/library/functions.html?highlight=property#property doc creates a docstring for the attribute. visible = property(lambda self: self._get_visible(), lambda self, value: self._set_visible(value), doc="you can make this sprite disappear without " "removing it from the group,\n" "assign 0 for invisible and 1 for visible") help(visible) we could go inception and use property's doc string to find out what the doc of property is.help(property)
RE: what is the doc parameter of property? - microphone_head - Apr-11-2019 I've been following up the help you've given so far, and found a style of doc string that I would like to apply to my code, Numpy. Thanks for the help. I never thought of using the "help" function on my own code before , a nice eye opener. ![]() |