Passing data out of a Sax parser
Andrew Dalke
adalke at mindspring.com
Mon Sep 22 01:29:09 EDT 2003
Me:
> > if name == "spam":
> > self.count += 1
John J. Lee:
> Works, but integers aren't mutable.
I assume you refer to the snippet I posted above?
Since it works, I don't understand the need for
your comment.
True, integers aren't mutable, so += does nothing
to the integer. Since __iadd__ isn't defined, the
Python runtime turns it into the equivalent of
self.count = self.count + 1
and so does what is expected.
Andrew
dalke at dalkescientific.com
More information about the Python-list
mailing list