[Python-ideas] pop multiple elements of a list at once (original) (raw)
Nick Coghlan ncoghlan at gmail.com
Sun Jul 11 23🔞49 CEST 2010
- Previous message: [Python-ideas] pop multiple elements of a list at once
- Next message: [Python-ideas] pop multiple elements of a list at once
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I think you overestimate how standardised we could make this across all platforms and data structures. Under the hood, any such expansion to the .pop API would almost certainly be defined as equivalent to:
def pop(self, index): result = self[index] del self[index] return result
such that slice objects could be passed in as well as integers (or integer equivalents). (Currently pop on builtin objects rejects slice objects, as it only works with integers)
In the meantime, if you want to manipulate memory while minimising copying, then the 2.7 memoryview object may be for you (assuming you can switch to the later version).
Cheers, Nick.
-- Nick Coghlan  |  ncoghlan at gmail.com  |  Brisbane, Australia
- Previous message: [Python-ideas] pop multiple elements of a list at once
- Next message: [Python-ideas] pop multiple elements of a list at once
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]