allowing braces around suites
Paul McGuire
ptmcg at austin.rr._bogus_.com
Fri Aug 27 15:12:31 EDT 2004
"Kjetil Torgrim Homme" <kjetilho at yksi.ifi.uio.no> wrote in message
news:1r3c28ejis.fsf at rovereto.ifi.uio.no...
> [Isaac To]:
> >
> > When Python is concerned and Emacs is not, Python only sees there
> > is indentation, and only indentation, to define the suites. And
> > it is also what people will perceive when they stare at the code.
> > There is nothing to be inconsistent with it.
>
> how long do you have to stare before spotting the bug?
>
> db.update_name(person)
> if is_student(person):
> db.update_courses(person)
> db.commit()
>
> only students have their names updated. I wonder why.
>
> real world examples have taken hours or days.
> --
> Kjetil T.
Here's a real-world C example, took us several weeks to track down - all the
programmer did was add some debugging code:
db->startTransaction();
db->update_name(person);
if ( is_student(person) )
log("update student %s", person->name );
db->update_courses(person);
-------------------------------------------page
break-----------------------------
db->commit();
Everybody has their courses updated whether students or not - why???
On the hardcopy, the update_courses() call was the last line on the page,
which made it that much harder to spot.
In fact, you can cite examples on this argument in either direction; it is
more than a little condescending to preach that "in the real world, my way
is the right way."
As far as Python goes, I think bracelessness is one of its defining
features; if some day braces were to get included in Python a la C or Java,
then it will cease to be Python.
-- Paul
More information about the Python-list
mailing list