Favorite non-python language trick?

Enrico lux at perpetua.org
Fri Jun 24 03:18:12 EDT 2005


"Joseph Garvin" <k04jg02 at kzoo.edu> ha scritto nel messaggio
news:mailman.837.1119596150.10512.python-list at python.org...
> --This code won't run because it's in a comment block
> --[[
> print(10)
> --]]
>
> --This code will, because the first two dashes make the rest a comment,
> breaking the block
> ---[[
> print(10)
> --]]
>
> So you can change whether or not code is commented out just by adding a
> dash. This is much nicer than in C or Python having to get rid of """ or
> /* and */. Of course, the IDE can compensate. But it's still neat :)

python:

"""
print 10
"""

and

#"""
print 10
#"""

C++:

/*
print(10);
*/

and

///*
print(10);
//*/

?

Bye,
Enrico





More information about the Python-list mailing list