statement level resumable exception

ilejn ilja.golshtein at gmail.com
Fri Jan 21 03:41:21 EST 2011


Arnaud,

it looks like a solution.
Perhaps it is better than plain try/accept and than proxy class with
__getattr__.
It is not for free, e.g. because syntax check such as parentheses
matching is lazy too, though looks
very interesting.

Thanks a lot!

On Jan 21, 10:41 am, Arnaud Delobelle <arno... at gmail.com> wrote:
> ilejn <ilja.golsht... at gmail.com> writes:
> > Arnaud,
>
> > these lists are not generated.
>
> > Actually these lists are a sort of interpreted programs and contain
> > some application logic.
>
> > Here is an example
> >         [
> >         [PUSH, [get_modified_interface, req]],
> >         [TIMEOUT, 3],
> >         [PULL, [out_interface, '']],
> >         [PULL, [err_interface, '']],
> >         [PULL, [out_mined_interface, req]],
> >         ]
>
> > If any interface name is unknown the list must not be invoked (in
> > other words, f function
> > call with this list must be somehow bypassed).
>
> > Thanks.
>
> You could still use the same idea and delay evaluation of the lists. E.g.
>
> prg1 = """[
>     [PUSH, [get_modified_interface, req]],
>     [TIMEOUT, 3],
>     ...
> """
>
> prg2 = """[
>     [OPCODE, [arguments, blah]],
>     ...
> """
>
> ...
>
> prgN = """..."""
>
> for prg in prg1, prg2, ..., prgN:
>     try:
>         prg = eval(prg)
>     except NameError:
>         continue
>     f(prg)
>
> --
> Arnaud

Best regards,
Ilja Golshtein



More information about the Python-list mailing list