Page 1 of 1

One line docStrings

PostPosted: Sun Sep 07, 2008 9:33 pm
by hopscc
docStrings currently are allowed only of the form
Code: Select all
"""
This is a doc String
"""

i.e leading and trailing terminators on their own lines.

Thats fine for modules/files, classes and (perhaps ) methods (usually) where theres often need for a multiline description but seems unnecessarily verbose for
class vars ( instance variables)
Code: Select all
class MyClass
"""
This is MyClass which is a wonderful thing to behold,
clean and pristine in form, functional in all its uses and
superlative in its brevity
"""

    var _usefulVar1
        """
        Used for something useful like backing a property
        """
    var _anotherVar
       """
        Also useful in its own way
        """
    def aMethod as int
        """
        sole method giving interesting integers
       """

- Thats 4 lines of decl and description for each var decl only two of which is actual useful content

I'd like cobra to also support single line docStrings
e.g.
Code: Select all
""" a single line docString"""


just to deverbose the above case (var decls) some
Code: Select all
class MyClass
"""
This is MyClass which is a wonderful thing to behold,
clean and pristine in form, functional in all its uses and
superlative in its brevity
"""

    var _usefulVar1
        """Used for something useful like backing a property. """
    var _anotherVar
       """Also useful in its own way """

    def aMethod as int
        """Sole method giving interesting integers"""


comments?

Re: One line docStrings

PostPosted: Thu Sep 18, 2008 4:57 am
by hopscc
ticket:43 added

Re: One line docStrings

PostPosted: Thu Sep 18, 2008 6:14 am
by relez
hopscc wrote: var _usefulVar1
"""
Used for something useful like backing a property
"""
var _anotherVar
"""
Also useful in its own way
"""
def aMethod as int
"""
sole method giving interesting integers
"""
[/code]

I'd like cobra to also support single line docStrings
e.g.
Code: Select all
""" a single line docString"""


just to deverbose the above case (var decls) some
Code: Select all
class MyClass
"""
This is MyClass which is a wonderful thing to behold,
clean and pristine in form, functional in all its uses and
superlative in its brevity
"""

    var _usefulVar1
        """Used for something useful like backing a property. """
    var _anotherVar
       """Also useful in its own way """

    def aMethod as int
        """Sole method giving interesting integers"""


comments?


yes, both formats may be preferable depending on situations. I agree your idea.