allowing braces around suites

Kjetil Torgrim Homme kjetilho at yksi.ifi.uio.no
Sat Aug 28 09:22:44 EDT 2004


[Roel Schroeven]:
>
>   Kjetil Torgrim Homme wrote:
>   > when it's part of a large system, it's a bit harder.  also
>   > consider that the db.commit() originally was correctly placed by
>   > the programmer, and the wrong indentation was introduced later
>   > by an editing glitch.
>   
>   In that case, I agree it can be harder. But IMO it gets harder
>   with increasing code complexity, whether braces are used or not. I
>   haven't yet seen very complex python programs, but I have seen C
>   and C++ code with multiple nesting levels, and let me assure that
>   it can sometimes be very difficult to spot errors.

indeed, C or C++ is no better in this respect, quite the opposite IMO.
Paul McGuire illustrated the corresponding problem in C:

    db->update_name(person);

    if (is_student(person))
        log("update student %s", person->name);
        db->update_courses(person);
    db->commit();

I think it's harder to spot the bug here than in my Python example.
this doesn't mean Python can't be improved further :-)
-- 
Kjetil T.



More information about the Python-list mailing list