Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #108588
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | dieter <dieter@handshake.de> |
| Newsgroups | comp.lang.python |
| Subject | Re: Design: Idiom for classes and methods that are customizable by the user? |
| Date | Fri, 13 May 2016 09:21:56 +0200 |
| Lines | 31 |
| Message-ID | <mailman.627.1463124126.32212.python-list@python.org> (permalink) |
| References | <5734ECDF.7070006@gmx.de> <87lh3eifsb.fsf@handshake.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=iso-8859-1 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | news.uni-berlin.de Ij9lrtFONT+YMBqM2cT7vQlWNC6sAtksDOHmopeRULTw== |
| Cancel-Lock | sha1:6Zt7cYf8qWfPSmJv0H9M+4imV1I= |
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'heavily': 0.04; 'needed,': 0.05; 'adapter': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; 'above?': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:user': 0.16; 'flexibility': 0.18; 'implementing': 0.18; 'component': 0.23; 'interfaces': 0.23; 'specified': 0.23; 'xml': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'looks': 0.29; 'node': 0.29; 'skip:q 20': 0.29; 'subject:that': 0.29; 'code': 0.30; 'e.g.': 0.30; 'class': 0.33; 'interface,': 0.33; 'file': 0.34; 'could': 0.35; 'i.e.': 0.35; 'something': 0.35; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'architecture': 0.38; 'subject:the': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'received:de': 0.40; 'some': 0.40; 'questions': 0.40; 'subject:Design': 0.79; '============': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| X-Gmane-NNTP-Posting-Host | p57b38a19.dip0.t-ipconnect.de |
| User-Agent | Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux) |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <87lh3eifsb.fsf@handshake.de> |
| X-Mailman-Original-References | <5734ECDF.7070006@gmx.de> |
| Xref | csiph.com comp.lang.python:108588 |
Show key headers only | View raw
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