[Python-Dev] Half-baked proposal: * (and **?) in assignments

Brett Cannon bac@OCF.Berkeley.EDU
Sat, 23 Nov 2002 17:09:09 -0800 (PST)


[Delaney, Timothy]

> > From: Brett Cannon [mailto:bac@OCF.Berkeley.EDU]
> > [Delaney, Timothy]
>
> In particular, I tend to produce a lot of filtering functions (whether run
> through list comps, filter or just standalone) and this is one place where
> this syntax would be useful. Of course, that presupposes that at least *one*
> value passes the filter ... but surely a failure there would be a data error
> ;)
>

But is it that big of a deal to just take the [1:] index of something
instead of using this suggested addition?

And yes, it is always a data error.  =)

> > concise code and I want to keep the LHS of the assignment simple.  But
> > then again that might be a bias coming from a right-handed person.  =)
>
> Nah - I'm right-handed too, but I've got nothing against the LHS.
>

Damn.  Would have been nice if that argument held up.

> The major point I have against it is that you would presumably have
> duplication in:
>
>     a = t
>     *a = t
>
> unless that were special-cased. I personally think it should be syntactially
> correct if the proposal were to be accepted, but with a strong suggestion in
> the documentation that it be avoided ;)
>

Yes, it should be correct  if the change is accepted.  But what are the
chances that people will actually read the note advising against it?  =)

-Brett