I Need A Placeholder

Peter Otten __peter__ at web.de
Thu Jun 26 13:57:47 EDT 2008


John Salerno wrote:

> "Joshua Kugler" <jkugler at bigfoot.com> wrote in message
> news:mailman.884.1214500462.1044.python-list at python.org...
>> except:
>>    pass
>>
>> is the usual technique there.
> 
> Is there any other?

if 0: 42

Proof:

>>> def cp(pass_):
...     return compile("try: 1/0\nexcept:\n %s" % pass_, "<nofile>", "exec")
...
>>> cp("pass") == cp("if 0: 42")
True

:-)

Peter



More information about the Python-list mailing list