Prothon gets Major Facelift in Vers 0.1.0 [Prothon]
Denis S. Otkidach
ods at strana.ru
Tue May 25 05:58:17 EDT 2004
On Mon, 24 May 2004, Mark Hahn wrote:
MH> So to me, documenting the public vars makes the most sense.
MH> They need some
MH> explaining anyway. So now the only question is, what is a
MH> fun and painless
MH> way to document public vars. It would be nice if it had
[...]
MH> Any ideas in this area would be greatly welcomed.
MH> Implementing a half-baked
MH> scheme would be as good as no scheme because it wouldn't be
MH> used.
I suggest to invent yet another way to define strings - something
like end-of-line literals (similar to # comments). It would be
especially useful for docstrings. For instance:
class MyClass:
@ Just an example class to demonstrate idea.
@ Change "@" to your favorite character or combination.
@ In fact we can use "d" prefix like it's used for unicode
@ literals, or "$" (as this character is often used as EOL
@ marker).
If we state that such string literals cannot be concatenated
(like "Hello" 'world'), then we can use them as docstrings for
class members:
class MyClass:
member = "default value" @ Docstring for member
Since string literals are not allowed to contain EOL characters,
we can use even single '"' and "'" :
class MyClass:
" multiline
" docstring
" here
But in this case all special characters in literal must be
properly escaped, so this approach is not convinient and error
prone.
--
Denis S. Otkidach
http://www.python.ru/ [ru]
More information about the Python-list
mailing list