[Python-ideas] list…pushed, or something

Shane Green shane at umbrellacode.com
Thu Mar 28 03:29:17 CET 2013

I'm not sure if there's anything inherently wrong with this idea, and I am well aware how incredibly easy it is to implement as an extension of the built-ins, but, I find it very useful to have variations of list().append(obj) and set().add(obj) that return, obj.  I've never come up with perfect method names; sometimes I go with past-tense versions, "added" and "appended" (or "pushed").  I often use these methods in places where performance is  a factor, such as using a set() to filter repeats from an input sequence.  

I was thinking it may be worth considering adding it to core, or perhaps creating collections types with these features, so they are high performance and standardized.  They can be particularly useful in generator recipes, etc.  

Shane Green 
408-692-4666 | shane at umbrellacode.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130327/223e737c/attachment.html>

More information about the Python-ideas mailing list