Embedded comments in Python?
Irmen de Jong
irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Mon May 3 07:53:10 EDT 2004
Ernie wrote:
> Hi,
> Whats the legal way in Python to embed comments in Python code?
> Example:
>
> def foo(a <:int>, b <:float>): <:array>
> return [a, b]
>
> Want the CPython interpreter to ignore the <:int>, <:float> and
> <:array>(this one can be written as #array). Using triple quoted
> strings would be longer and is invalid syntax. This would be
> extremely useful for those who write tools for processing Python
> scripts. In C/C++, this would be no problem with /* */.
Why not:
def foo(a,b): # (a:int,b:int)-->array
return [a,b]
That should be almost as easy to generate/process?
--Irmen
More information about the Python-list
mailing list