Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #87796

__iadd__ with 2 args?

From Neal Becker <ndbecker2@gmail.com>
Subject __iadd__ with 2 args?
Date 2015-03-20 17:25 -0400
Newsgroups comp.lang.python
Message-ID <mailman.47.1426886781.10327.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

__iadd__ with 2 args? Neal Becker <ndbecker2@gmail.com> - 2015-03-20 17:25 -0400
  Re: __iadd__ with 2 args? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-21 16:37 +1100

csiph-web