conditional print statement ?
Duncan Booth
duncan.booth at invalid.invalid
Fri Apr 27 10:45:09 EDT 2007
Paul McGuire <ptmcg at austin.rr.com> wrote:
> The Enable/Disable decorators on the Python wiki (http://
> wiki.python.org/moin/PythonDecoratorLibrary?highlight=%28decorator
> %29#head-8298dbf9ac7325d9ef15e7130e676378bbbda572) help you do
> something very similar, without having to replicate the function being
> enabled/disabled.
>
> @(disabled,enabled)[Print_Info]
> def printOrNot(arg):
> print arg
>
Pardon me for asking, but isn't that a syntax error? Decorator syntax is:
"@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE
and you don't have a dotted_name.
More information about the Python-list
mailing list