Question about idioms for clearing a list
bonono at gmail.com
bonono at gmail.com
Tue Feb 7 19:04:17 EST 2006
More information about the Python-list mailing list
Tue Feb 7 19:04:17 EST 2006
- Previous message (by thread): Question about idioms for clearing a list
- Next message (by thread): Question about idioms for clearing a list
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Fredrik Lundh wrote: > > Python now has, what, three built-in mutable collections types: > > lists, dictionaries, and sets. Dicts and sets both have a clear() > > method and lists do not. > > dicts and sets are mappings, and lists are not. mappings don't > support slicing. lists do. I am confused. Could you explain this ? I was under the impression said above(mapping don't support slicing), until after I read the language reference. I don't think it is slicing as in the list slicing sense but it does use the term "extend slicing". http://www.python.org/doc/2.4.2/ref/slicings.html "The semantics for an extended slicing are as follows. The primary must evaluate to a mapping object, and it is indexed with a key that is constructed from the slice list, as follows. If the slice list contains at least one comma, the key is a tuple containing the conversion of the slice items; otherwise, the conversion of the lone slice item is the key. The conversion of a slice item that is an expression is that expression. The conversion of an ellipsis slice item is the built-in Ellipsis object. The conversion of a proper slice is a slice object (see section 3.2) whose start, stop and step attributes are the values of the expressions given as lower bound, upper bound and stride, respectively, substituting None for missing expressions."
- Previous message (by thread): Question about idioms for clearing a list
- Next message (by thread): Question about idioms for clearing a list
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list