allowing braces around suites
Kjetil Torgrim Homme
kjetilho at yksi.ifi.uio.no
Sat Aug 28 05:13:17 EDT 2004
[Roel Schroeven]:
>
> Kjetil Torgrim Homme wrote:
> > how long do you have to stare before spotting the bug?
>
> Just the time needed to read the code.
>
> > db.update_name(person)
> > if is_student(person):
> > db.update_courses(person)
> > db.commit()
> > only students have their names updated. I wonder why.
>
> No offense, but I wonder why you have a problem with this
> code. IMO the indentation makes perfectly clear what's happening.
I don't think it is appropriate that I dump thousands of lines of code
here to illustrate the problem :-)
when I provide four lines of code and tell you there's a bug, of
course you can spot it immediately. 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.
--
Kjetil T.
More information about the Python-list
mailing list