A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-March/002670.html below:

[Python-Dev] dict.supplement() (was Re: list.shift())

[Python-Dev] dict.supplement() (was Re: list.shift()) [Python-Dev] dict.supplement() (was Re: list.shift())Ka-Ping Yee ping@lfw.org
Mon, 20 Mar 2000 06:36:34 -0600 (CST)
On Mon, 20 Mar 2000, Peter Funk wrote:
> Consider another example, where arbitrary instance attributes should be
> specified as keyword arguments to the constructor:
> 
>   >>> class Example:
>   ...     _defaults = {'a': 1, 'b': 2}
>   ...     _config = _defaults
>   ...     def __init__(self, **kw):
>   ...         if kw:
>   ...             self._config = self._defaults.copy()
>   ...             self._config.update(kw)

Yes!  I do this all the time.  I wrote a user-interface module
to take care of exactly this kind of hassle when creating lots
of UI components.  When you're making UI, you can easily drown in
keyword arguments and default values if you're not careful.


-- ?!ng




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