Message109919
The python-ideas mailing list might be a better place to discuss this. Note that it's too late for new features in the 2.x series, so I'm changing the version to 3.2
> pop self.recv_buffer[:size]
I don't think this'll fly, even if you spell it pop(self.recv_buffer[:size]). It's not worth a new built-in function, let alone a grammar change.
> self.recv_buffer.pop(,-size)
Something like this seems more reasonable, especially if it can be done without introducing new syntax and in a fully backwards-compatible way.
One idea that seems fairly natural to me would be to allow list.pop and friends to support slices, so you could do:
last2 = slice(None, -2)
self.recv_buffer.pop(last2)
or even
penultimate, ultimate = self.recv_buffer.pop(last2)
It would require some work to implement and debug this, though. |
|
Date |
User |
Action |
Args |
2010-07-10 19:51:23 | mark.dickinson | set | recipients:
+ mark.dickinson, jacobidiego |
2010-07-10 19:51:23 | mark.dickinson | set | messageid: <1278791483.84.0.924913856563.issue9218@psf.upfronthosting.co.za> |
2010-07-10 19:51:22 | mark.dickinson | link | issue9218 messages |
2010-07-10 19:51:22 | mark.dickinson | create | |
|