Re: __iadd__ with 2 args?

2015-03-20 Thread Steven D'Aprano
On Sat, 21 Mar 2015 08:25 am, Neal Becker wrote: > 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) If you find yourself explicitly calling dunder methods like __iadd__, that's a sign you are tr

Re: __iadd__ with 2 args?

2015-03-20 Thread Ian Kelly
On Fri, Mar 20, 2015 at 3:25 PM, Neal Becker wrote: > 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

__iadd__ with 2 args?

2015-03-20 Thread Neal Becker
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?