A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2002-August/028493.html below:

[Python-Dev] Proposed Mixins for Wide Interfaces

[Python-Dev] Proposed Mixins for Wide InterfacesDavid Abrahams David Abrahams" <dave@boost-consulting.com
Sat, 31 Aug 2002 12:48:29 -0400
From: "Raymond Hettinger" <python@rcn.com>


> How about adding some mixins to simplify the
> implementation of some of the fatter interfaces?
>
> class CompareMixin:
>     """
>     Given an __eq__ method in a subclass, adds a __ne__ method
>     Given __eq__ and __lt__, adds !=, <=, >, >=.
>     """
>
> class MappingMixin:
>     """
>     Given __setitem__, __getitem__,  and keys,
>     implements values, items, update, get, setdefault, len,
>     iterkeys, iteritems, itervalues, has_key, and __contains__.
>
>     If __delitem__ is also supplied, implements clear, pop,
>     and popitem.
>
>     Takes advantage of __iter__ if supplied (recommended).
>
>     Takes advantage of __contains__ or has_key if supplied
>     (recommended).
>     """
>
> The idea is to make it easier to implement these interfaces.
> Also, if the interfaces get expanded, the clients automatically
> updated.

I think these are a great idea, *in the context of* an understanding of
what we want interfaces to be, say, and do. Are we there yet?

-----------------------------------------------------------
           David Abrahams * Boost Consulting
dave@boost-consulting.com * http://www.boost-consulting.com






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