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