Mark Dickinson <dicki...@gmail.com> added the comment:

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.

----------
components: +Interpreter Core
nosy: +mark.dickinson
type: performance -> feature request
versions: +Python 3.2 -Python 2.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9218>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to