[Python-ideas] get method for sets?
Dirkjan Ochtman
dirkjan at ochtman.nl
Wed May 16 09:01:04 CEST 2012
On Wed, May 16, 2012 at 8:58 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> pop returns an arbitrary element, and removes it. That's a very
> different operation to "get this element from the set".
>
> The problem is, if there was a set.get(x) method, you have to pass x as
> argument, and it returns, what? x. So what's the point? You already have
> the return value before you call the function.
I understood Mike's message to be proposing an argument-less .get() method.
Cheers,
Dirkjan
More information about the Python-ideas
mailing list