Good practice when writing modules...
John Machin
sjmachin at lexicon.net
Sat Nov 15 16:04:38 EST 2008
On Nov 15, 9:08 pm, bearophileH... at lycos.com wrote:
> I also put a comment after each import, with the name of the function/
> class it is used into:
>
> import foo # used by baz()
> import bar # used by spam()
Why bother with the ()? Why bother at all? Surely this rapidly becomes
tedious clutter:
import xyz # used by abc(), def(), ghi(), ...
Do you remember to adjust the comment when a function/class is changed
so that it doesn't use the module any more?
> ...
> def baz(n):
> return foo(n) * 10
> ...
> def spam(k):
> return bar(k) - 20
Your modules are callable???
> Time ago I have read an interesting article that says that comments of
> today will often become statements and declaration and tags of
> tomorrow, that is stuff that the interpreter/compiler/editor
> understands. This means that such annotations of mine may be something
> fit to become a syntax of the language.
I hope not.
> I don't have ideas on how such
> syntax can be, if you have suggestions I'm listening.
Suggestion: no such syntax!!
More information about the Python-list
mailing list