Conditional compilation
Garth T Kidd
garth at deadlybloodyserious.com
Sun May 12 20:36:36 EDT 2002
> It does not seem to be possible to "comment out" blocks of code, which would
> be a very nice feature for testing purposes. (Maybe I can do it with """
> but that looks a bit cumbersome.)
>
> Any ideas, hint, proposals?
One thing I love in UserTalk (of Frontier, Manilla and Radio UserLand
fame) is the 'bundle' keyword that simply provides another variable
scope and bundles up a few lines of code.
In the Frontier/Radio environment all programming is done in an
outliner, and bundling turns out to be a whole lot nicer than it
originally looks -- so much so, that these days I curse as much about
there being no 'bundle' in Python as I do about most Python features
lacking in UserTalk. :)
Compare::
# do this
... code to do this
# do that
... code to do that
With::
bundle # do this
... code to do this
bundle # do that
... code to do that
I'm almost tested to hack it:
if 1: # do this
... code to do this
... but that's a little ghastly. If I could figure out a way to add a
keyword in pure Python, I'd do it. :)
Regards,
Garth.
More information about the Python-list
mailing list