syntax for code blocks

alex23 wuwei23 at gmail.com
Tue May 1 22:50:46 EDT 2012


On May 2, 12:43 pm, alex23 <wuwe... at gmail.com> wrote:
> I'm not entirely sure what your 'solution' offers over something like:
>
> class FOO(object):
>     def __init__(self, fn):
>         self.fn = fn
>
>     def __enter__(self):
>         return self.fn
>
>     def __exit__(self, exc_type, exc_value, traceback):
>         pass
>
> def func(x, before_check=None, after_check=None, when_odd=None,
> when_prime=None):
>     pass

Sorry, the func definition was meant to be:

    def func(x):
        # before_check, after_check, when_odd, when_prime used
internally
        pass



More information about the Python-list mailing list