Passing data out of a Sax parser
adalke at mindspring.com
Mon Sep 22 07:29:09 CEST 2003
> > 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
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.
dalke at dalkescientific.com
More information about the Python-list