syntax glitch with +=
Carl Banks
imbosol-1045796685 at aerojockey.com
Thu Feb 20 22:21:49 EST 2003
David Eppstein wrote:
> In article <mailman.1045784817.1817.python-list at python.org>,
> "Delaney, Timothy C (Timothy)" <tdelaney at avaya.com> wrote:
>
>> No. += *uses* extend, but they are not identical. Specifically, every
>> augmented *assignment* operator includes an assignment as part of the
>> operation.
>>
>> In the case of a list, the assignment is redundant, but still occurs.
>
> Ok, thanks for the explanation. The error with += makes more sense in
> that case, since a (redundant) assignment is happening. I guess this
> means that, after the assignment, the variable name will be in local
> scope?
The scope of a variable is determined at compile time, so no. Well,
actually, yes, it will be local after the assignment, but it was also
local before it.
--
CARL BANKS
More information about the Python-list
mailing list