This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients docs@python, eric.araujo, nadeem.vawda, rhettinger, terry.reedy
Date 2012-05-20.23:21:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1337556063.65.0.420088232866.issue14836@psf.upfronthosting.co.za>
In-reply-to
Content
I don't think it is a good idea to expand to the pop/popitem docs this way.  The text is not about what pop/popitem does, it is about what another hypothetical method might do.  The text would be a distractor from the focused description of what pop/popitem actually do.  Also, it would face discoverability problems (there is no reason to think that someone who wants a nonmutating getfirst() method would think to look in the docs for a mutating method).

Also, the text talks about a general purpose programming technique (how to get the first element out of *any* iterable without removing it).  That belongs in a tutorial entry or a summary of idioms.

FWIW, the "several requests for set.get" haven't been serious requests accompanied by valid use cases.  Instead, they have mostly been toy discussions about all the ways you could do it ("for x in s: break",  "next(iter(s))", "x=s.pop(); s.add(x)").   The absence of get() or pick() in other language's set implementations suggest that there isn't a real need here.

That said, I don't think there is much of a downside to adding a sentence to the set.pop() docs.   It would be a waste though to also put it in dict.pop() and dict.popitem() where the question never seems to arise and where the docs already have issues with trying to over describe what can be done.
History
Date User Action Args
2012-05-20 23:21:03rhettingersetrecipients: + rhettinger, terry.reedy, nadeem.vawda, eric.araujo, docs@python
2012-05-20 23:21:03rhettingersetmessageid: <1337556063.65.0.420088232866.issue14836@psf.upfronthosting.co.za>
2012-05-20 23:21:03rhettingerlinkissue14836 messages
2012-05-20 23:21:02rhettingercreate