Ka-Ping Yee <ping@lfw.org>: > The only change that needs to be made to support sets of immutable > elements is to provide "in" on dictionaries. The rest is then all > quite natural: > > dict[key] = 1 > if key in dict: ... > for key in dict: ... Independently of implementation issues about sets, I think this is a damn fine idea. +1. > (Then we can also get rid of the ugly has_key method.) > > For those that need mutable set elements badly enough to sacrifice > a little speed, we can add two methods to lists: > > lst.include(elt) # same as - if elt not in lst: lst.append(elt) > lst.exclude(elt) # same as - while elt in lst: lst.remove(elt) +1 on the concept, -0 on the names. -- <a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a> [The disarming of citizens] has a double effect, it palsies the hand and brutalizes the mind: a habitual disuse of physical forces totally destroys the moral [force]; and men lose at once the power of protecting themselves, and of discerning the cause of their oppression. -- Joel Barlow, "Advice to the Privileged Orders", 1792-93
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4