Re: How to comment constant values?

2009-07-27 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Mon, 27 Jul 2009 00:47:08 +0200, Diez B. Roggisch wrote: Only modules, classes, and functions/methods can have docstrings associated with them. For anything else, you have to use comments; or you can mention them in the docstrings of related things. While

How to comment constant values?

2009-07-26 Thread Erwin Mueller
Hello, I'm new to Python (using it for two months) and I wonder how can I comment the const. values with the doc-strings. I.e. if I have code: FRACTION_MIN = 1 FRACTION_MAX = 10 class Fraction(collections.MutableSequence): '''Model a fraction with denominators. It contains one ore more

Re: How to comment constant values?

2009-07-26 Thread Chris Rebert
On Sun, Jul 26, 2009 at 2:49 PM, Erwin Muellerdev...@deventm.org wrote: Hello, I'm new to Python (using it for two months) and I wonder how can I comment the const. values with the doc-strings. I.e. if I have code: FRACTION_MIN = 1 FRACTION_MAX = 10 class Fraction(collections.MutableSequence):

Re: How to comment constant values?

2009-07-26 Thread Bearophile
Chris Rebert: Only modules, classes, and functions/methods can have docstrings associated with them. For anything else, you have to use comments; or you can mention them in the docstrings of related things. What about adding docstrings to other Python things, especially to variables? Bye,

Re: How to comment constant values?

2009-07-26 Thread Diez B. Roggisch
Chris Rebert schrieb: On Sun, Jul 26, 2009 at 2:49 PM, Erwin Muellerdev...@deventm.org wrote: Hello, I'm new to Python (using it for two months) and I wonder how can I comment the const. values with the doc-strings. I.e. if I have code: FRACTION_MIN = 1 FRACTION_MAX = 10 class

Re: How to comment constant values?

2009-07-26 Thread Steven D'Aprano
On Sun, 26 Jul 2009 15:42:22 -0700, Bearophile wrote: Chris Rebert: Only modules, classes, and functions/methods can have docstrings associated with them. For anything else, you have to use comments; or you can mention them in the docstrings of related things. What about adding docstrings

Re: How to comment constant values?

2009-07-26 Thread Steven D'Aprano
On Mon, 27 Jul 2009 00:47:08 +0200, Diez B. Roggisch wrote: Only modules, classes, and functions/methods can have docstrings associated with them. For anything else, you have to use comments; or you can mention them in the docstrings of related things. While this is technically true,

Re: How to comment constant values?

2009-07-26 Thread Robert Kern
On 2009-07-26 18:23, Steven D'Aprano wrote: On Mon, 27 Jul 2009 00:47:08 +0200, Diez B. Roggisch wrote: Only modules, classes, and functions/methods can have docstrings associated with them. For anything else, you have to use comments; or you can mention them in the docstrings of related