Name

__setitem__

Synopsis

__setitem__(self,key,value)

For a request to bind an item or slice of x (typically an assignment x [ key ]= value), Python calls x .__setitem__( key,value ). A container x should have __setitem__ only if x is mutable, so that items, and possibly slices, can be added and/or rebound.

Get Python in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.