Official definition of call-by-value (Re: Finding the instance reference...)

Duncan Booth duncan.booth at invalid.invalid
Fri Nov 21 05:33:34 EST 2008


Aaron Brady <castironpi at gmail.com> wrote:
>> a[:] = [1, 2, 3]
> 
> No, that's not assignment, it's syntactic sugar for a __setslice__
> call.  No copies here.
> 

Oh dear, perhaps you had better get the Python developers to update the 
grammar that Python uses as that seems to think it's an assignment:

assignment_stmt ::= (target_list "=")+ (expression_list | 
yield_expression) 
target_list ::= target ("," target)* [","] 
target ::= identifier 
  | "(" target_list ")" 
  | "[" target_list "]" 
  | attributeref 
  | subscription 
  | slicing 


:^)

-- 
Duncan Booth http://kupuguy.blogspot.com



More information about the Python-list mailing list