Back to index

python3.2  3.2.2
Classes | Functions
lib2to3.fixes.fix_except Namespace Reference


class  FixExcept


def find_excepts

Detailed Description

Fixer for except statements with named exceptions.

The following cases will be converted:

- "except E, T:" where T is a name:

    except E as T:

- "except E, T:" where T is not a name, tuple or list:

except E as t:
    T = t

    This is done because the target of an "except" clause must be a

- "except E, T:" where T is a tuple or list literal:

except E as t:
    T = t.args

Function Documentation

Definition at line 30 of file

00031 def find_excepts(nodes):
00032     for i, n in enumerate(nodes):
00033         if n.type == syms.except_clause:
00034             if n.children[0].value == 'except':
00035                 yield (n, nodes[i+2])

Here is the call graph for this function:

Here is the caller graph for this function: