Steven D'Aprano writes:
> So just because a feature is an accident of history, doesn't mean that
> a use can't be found for it.
Which I explicitly noted in my message. I suppose it's inevitable for
the nuances of one's utterances to be forgotten as the discussion
progresses, but darn if it ain't
John Pinner wrote:
> On Aug 9, 1:36 am, Ben Finney wrote:
>> Ethan Furman writes:
>> > So if property docstrings are so hard to get to, what's the point in
>> > having them?
>>
>> Why would you expect there be a special point to them?
>>
>> Men, like all primates of any sex, have nipples.
>>
>>
On Aug 9, 1:36 am, Ben Finney wrote:
> Ethan Furman writes:
> > So if property docstrings are so hard to get to, what's the point in
> > having them?
>
> Why would you expect there be a special point to them?
>
> Men, like all primates of any sex, have nipples.
>
> Properties, like any function i
Steven D'Aprano writes:
> Ben Finney wrote:
>
> > They're an accident of the history that led to their implementation,
> > and of the pre-existing parts that they're built from. There doesn't
> > need to be a point to them (though they might be useful for reasons
> > incidental for the reasons th
Ben Finney wrote:
> Ethan Furman writes:
>
>> So if property docstrings are so hard to get to, what's the point in
>> having them?
>
> Why would you expect there be a special point to them?
>
> Men, like all primates of any sex, have nipples.
>
> Properties, like any function in Python, have
Ethan Furman writes:
> So if property docstrings are so hard to get to, what's the point in
> having them?
Why would you expect there be a special point to them?
Men, like all primates of any sex, have nipples.
Properties, like any function in Python, have docstrings.
They're an accident of t
On Mon, Aug 8, 2011 at 1:05 PM, Steven D'Aprano
wrote:
> Ethan Furman wrote:
>
>> So if property docstrings are so hard to get to, what's the point in
>> having them?
>
> Hard to get, not impossible. But I have no idea really -- they don't seem
> very useful to me.
They do show up in help(), but
They are actually quite easy to get to. help() on both the class or instance
produces the docstring, and __doc__ on the property as accessed from the
class produces the docstring.
>>> class Test(object):
... @property
... def fred(self):
... """*This is a docstring.*"""
...
Ethan Furman wrote:
> So if property docstrings are so hard to get to, what's the point in
> having them?
Hard to get, not impossible. But I have no idea really -- they don't seem
very useful to me.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On 8/8/2011 2:26 PM, Steven D'Aprano wrote:
Eric Snow wrote:
On Mon, Aug 8, 2011 at 6:37 AM, Nick wrote:
Is it possible to put a doc string on a class attribute?
This really makes little sense. The purpose of docstrings is to give
interactive help. The place to document data attributes of
Steven D'Aprano wrote:
Eric Snow wrote:
On Mon, Aug 8, 2011 at 6:37 AM, Nick wrote:
Is it possible to put a doc string on a class attribute? Something
like this
You can put a docstring on a property (which is a function):
class Test(object):
@property
def fred(self):
"attrib
Nick wrote:
> Is it possible to put a doc string on a class attribute? Something
> like this
>
> class Test (object):
> '''classx'''
> fred = 10
> '''attribute'''
The short answer is, no.
The longer answer is, maybe, if you can make Test.fred be some sort of
object with a docstring
Eric Snow wrote:
> On Mon, Aug 8, 2011 at 6:37 AM, Nick wrote:
>> Is it possible to put a doc string on a class attribute? Something
>> like this
>
> You can put a docstring on a property (which is a function):
>
> class Test(object):
> @property
> def fred(self):
> "attribute"
On 8/8/2011 8:37 AM, Nick wrote:
Is it possible to put a doc string on a class attribute?
Class and function docstrings are generated from string expression
statements at the beginning of a suite.
class Test (object):
'''classx'''
fred = 10
'''attribute'''
This is two stat
On Mon, Aug 8, 2011 at 6:37 AM, Nick wrote:
> Is it possible to put a doc string on a class attribute? Something
> like this
You can put a docstring on a property (which is a function):
class Test(object):
@property
def fred(self):
"attribute"
return 10
Python syntax sup
Is it possible to put a doc string on a class attribute? Something
like this
class Test (object):
'''classx'''
fred = 10
'''attribute'''
print Test.__doc__
print Test.fred.__doc__
This code produces this output
classx
int(x[, base]) -> integer
Convert a string or number to an inte
16 matches
Mail list logo