Tuples and immutability

Gregory Ewing greg.ewing at canterbury.ac.nz
Tue Mar 11 17:23:27 EDT 2014


Steven D'Aprano wrote:
> On Tue, 11 Mar 2014 04:39:39 -0600, Ian Kelly wrote:
> 
>>On Mon, Mar 10, 2014 at 11:03 PM, Gregory Ewing
 >
>>What's the obvious way
>>>to spell in-place set intersection, for example? 
> 
> I would expect it to be &=,

That's my point -- once you know the binary operator for
an operation, the corresponding in-place operator is
obvious. But there's no established standard set of
method names for in-place operations -- each type
does its own thing.

>>You mean set.intersection_update?  The in-place set methods are not hard
>>to remember, because they all end in _update.

For that particular type, maybe, but I wouldn't trust
that rule to extend to other types.

-- 
Greg



More information about the Python-list mailing list