How to parse this line of code manually

Davy zhushenli at
Tue Aug 28 05:00:13 CEST 2007

Hi all,

It is well known that Python is appreciated for its merit of concise.
However, I found the over concise code is too hard to understand for

Consider, for instance,
def known_edits2(word):
    return set(e2 for e1 in edits1(word) for e2 in edits1(e1) if e2 in

Shall I understand the code in set() as
for e2 in edits1(e1) {
    if e2 in NWORDS {
        for e1 in edits1(word) {

And a general question is: Is there any tip available to understand
the code in one line, or what's the parsing priority (left to right,
right to left, or other possibilities)

Any suggestions are welcome!

The code is a simple spell checker from

Best regards,

More information about the Python-list mailing list