On Thu, Oct 13, 2016 at 11:59 PM Paul Moore <p.f.mo...@gmail.com> wrote:
> On 13 October 2016 at 21:47, אלעזר <elaz...@gmail.com> wrote: > > if you allow result.append(1, 2, 3) to mean result.extend([1,2,3]) # > which > > was discussed before > > I don't (for the reasons raised before). But thank you for your > explanation, it clarifies what you were proposing. And it does so > within the *current* uses of the * symbol, which is good. But: > > 1. I'm not keen on extending append's meaning to overlap with extend's > like this. > 2. Your proposal does not generalise to generator expressions, set > displays (without similarly modifying the set.add() method) or > dictionary displays. > 3. *fn(x) isn't an expression, and yet it *looks* like it should be, > and in the current syntax, an expression is required in that position. > To me, that suggests it would be hard to teach. [1] > > You can of course generalise Sjoerd's "from" proposal and then just > replace "from" with "*" throughout. That avoids your requirement to > change append, but at the cost of the translation no longer being a > parallel to an existing use of "*". > > I think it is an unfortunate accident of syntax, the use of "yield from foo()" instead of "yield *foo()". These "mean" the same: a syntactic context that directly handles iterable as repetition, (with some guarantees regarding exceptions etc.). Alternatively, we could be writing [1, 2, from [3, 4], 5, 6]. Whether it is "from x" or "*x" is just an accident. In my mind. As you said, the proposal should be written in a much more formal way, so that it could be evaluated without confusion. I completely agree. Elazar
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/