[Python-Dev] Retrieve an arbitrary element from a set withoutremoving it (original) (raw)
Raymond Hettinger python at rcn.com
Tue Oct 27 18:47:59 CET 2009
- Previous message: [Python-Dev] Retrieve an arbitrary element from a set without removing it
- Next message: [Python-Dev] Retrieve an arbitrary element from a set withoutremoving it
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Chris Bergstresser] Still, I think my
point stands--it's a clear extrapolation from the existing dict.get().
Not really. One looks-up a key and supplies a default value if not found. The other, set.get(), doesn't have a key to lookup.
A dict.get() can be meaningfully used in a loop (because the key can vary). A set.get() returns the same value over and over again (because there is no key).
Raymond
- Previous message: [Python-Dev] Retrieve an arbitrary element from a set without removing it
- Next message: [Python-Dev] Retrieve an arbitrary element from a set withoutremoving it
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]