__iadd__ with 2 args?

Neal Becker ndbecker2 at gmail.com
Fri Mar 20 17:25:59 EDT 2015


I can write a member 

F.__iadd__ (self, *args)

and then call it with 2 args:

f = F()
f.__iadd__ (a, b)

And then args is:
(a, b)

But it seems impossible to spell this as

f += a, b

That, instead, results in 

args = ((a, b),)

So should I just abandon the idea that += could be used this way?

-- 
Those who fail to understand recursion are doomed to repeat it




More information about the Python-list mailing list