Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #108588
| From | dieter <dieter@handshake.de> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Design: Idiom for classes and methods that are customizable by the user? |
| Date | 2016-05-13 09:21 +0200 |
| Message-ID | <mailman.627.1463124126.32212.python-list@python.org> (permalink) |
| References | <5734ECDF.7070006@gmx.de> <87lh3eifsb.fsf@handshake.de> |
Dirk Bächle <tshortik@gmx.de> writes:
> ...
> My questions
> ============
>
> - Is this a good approach, that I could use for other parts of the architecture as well, e.g. the Node class mentioned above?
You might look at the "adpater" pattern.
It is heavily used in Zope - and there looks something like:
* components are abstracted by interfaces (--> "zope.interface")
* where flexibility is needed, the code looks like
component = queryAdapter(<context>, interface, default=...)
or
component = queryUtility(interface, default=...)
to get a component implementing "interface".
(utilities are in some way adapters for "None", i.e.
those independent of a context)
* there is an adapter registry,
its content is specified either via an XML specification file
or via Python code
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Design: Idiom for classes and methods that are customizable by the user? dieter <dieter@handshake.de> - 2016-05-13 09:21 +0200
csiph-web