[Python-3000] A few small py3k wishes

Terry Reedy tjreedy at udel.edu
Mon Apr 3 07:45:27 CEST 2006


"Michael P. Soulier" <msoulier at digitaltorque.ca> wrote in message 
news:20060402222130.GA12075 at tigger.digitaltorque.ca...
>It's a minor thing, but it'd be nice to make a method alias for append() 
>on
>mutable sequences called push(), to go with pop().

Bound methods to your rescue:
_stack = []
push = _stack.append
pop = _stack.pop
Now push(i) and i = pop() to your heart's content ;-)
What's ironic about your 'wish' is that making it possible to make a bound 
pop to go with the previously possible bound push was part of my rationale, 
several years ago, for proposing the addition of a pop method.
Terry Jan Reedy


More information about the Python-3000 mailing list

AltStyle によって変換されたページ (->オリジナル) /