Overriding iadd for dictionary like objects

Aahz aahz at pythoncraft.com
Fri Aug 28 15:29:09 EDT 2009


In article <21e57363-4e92-41cb-9907-5aef96ad0a6e at o15g2000yqm.googlegroups.com>,
RunThePun  <ubershmekel at gmail.com> wrote:
>
>Anybody have any more ideas? I think python should/could havev a
>syntax for overriding this behaviour, i mean, obviously the complexity
>of supporting all operators with the getitem syntax could introduce
>alot of clutter. But maybe there's an elegant solution out there...

Any solution you create must support this:

>>> L = [3]
>>> L[0] += 7
>>> L
[10]
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"I support family values -- Addams family values" --www.nancybuttons.com



More information about the Python-list mailing list