variable declaration
Alex Martelli
aleaxit at yahoo.com
Sun Feb 6 02:27:32 EST 2005
Nick Coghlan <ncoghlan at iinet.net.au> wrote:
...
> > _temp = x.y
> > x.y = type(temp).__irebind__(temp, z)
...
> I was thinking of something simpler:
>
> x.y
> x.y = z
>
> That is, before the assignment attempt, x.y has to resolve to *something*, but
> the interpreter isn't particularly fussy about what that something is.
OK, I guess this makes sense. I just feel a tad apprehensive at
thinking that the semantics differ so drastically from that of every
other augmented assignment, I guess. But probably it's preferable to
NOT let a type override what this one augmented assignment means; that
looks like an "attractive nuisance" tempting people to be too clever.
Still, if you write a PEP, I would mention the possible alternative and
why it's being rejected in favor of this simpler one.
Alex
More information about the Python-list
mailing list