Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #108745

Re: Design: Idiom for classes and methods that are customizable by the user?

Path csiph.com!2.us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail
From Dirk Bächle <tshortik@gmx.de>
Newsgroups comp.lang.python
Subject Re: Design: Idiom for classes and methods that are customizable by the user?
Date Tue, 17 May 2016 16:51:54 +0200
Lines 32
Message-ID <mailman.63.1463497837.19823.python-list@python.org> (permalink)
References <5734ECDF.7070006@gmx.de> <mailman.617.1463087060.32212.python-list@python.org> <dplassFelugU1@mid.individual.net> <CAGgTfkPeqybAeqXLq8FHyRSb+d8KLemvxLrk8i3PfbWdwV4rBA@mail.gmail.com> <573B300A.5080502@gmx.de>
Reply-To dl9obn@darc.de
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de VdNcr8SqR3Z3lneij1sWxQbDl6NIXKxDj9OMpDqsB3PA==
Return-Path <tshortik@gmx.de>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'api': 0.09; 'backwards': 0.09; 'degree,': 0.09; 'derived': 0.09; 'received:gmx.net': 0.09; 'python': 0.10; 'python.': 0.11; '2.7': 0.13; 'explicitly': 0.15; 'subject: \n ': 0.15; 'codebase,': 0.16; 'dots': 0.16; 'from:addr:gmx.de': 0.16; 'message-id:@gmx.de': 0.16; 'michael,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'registry': 0.16; 'some)': 0.16; 'subject:user': 0.16; 'wrote:': 0.16; 'looked': 0.16; 'string': 0.17; 'first.': 0.18; 'input': 0.18; 'all,': 0.20; '(or': 0.23; 'header:In-Reply-To:1': 0.24; 'discussion': 0.24; 'header:User-Agent:1': 0.26; "doesn't": 0.26; 'compatible': 0.27; 'defining': 0.27; 'function': 0.28; 'idea': 0.28; 'subject:that': 0.29; 'classes': 0.30; "we're": 0.30; 'putting': 0.30; 'probably': 0.31; 'class': 0.33; 'michael': 0.33; 'decorators': 0.33; 'picking': 0.33; "i'll": 0.33; 'add': 0.34; 'that,': 0.34; 'could': 0.35; 'clear': 0.35; 'mix': 0.35; 'knowledge': 0.35; 'but': 0.36; 'possible': 0.36; 'to:addr:python- list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'thanks': 0.37; 'subject:the': 0.39; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'share': 0.61; 'further': 0.62; 'back': 0.62; 'strange': 0.63; 'great': 0.63; 'hear': 0.64; 'our': 0.64; 'received:212.227.17': 0.66; 'cut': 0.67; 'header:Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; 'subject:Design': 0.79; '"decorator"': 0.84; 'gregory,': 0.84; 'technically': 0.91; 'average': 0.93; 'from.': 0.93
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0
In-Reply-To <CAGgTfkPeqybAeqXLq8FHyRSb+d8KLemvxLrk8i3PfbWdwV4rBA@mail.gmail.com>
X-Provags-ID V03:K0:G5YStPiNGC/BpdScba2BhtNC+iDiOBWny764prkVyx40ureurlN b0CUQspxDewuv9e0Wue6ohkND3W9sCmnk4t2ks/r1KS+y3DpuiVvG96QW6/mzjNu7o+iSuP D2xWu6YAcih39a+8GM2dexY/KlU7j5fMlQJiiWjiSGCjCPA//+mnmgr94PS8jw3MrcF4nGw etej+WUn66lDcOLt2FEsw==
X-UI-Out-Filterresults notjunk:1;V01:K0:lYsi5PyOs5Y=:BHFyWlkN6zzDZOUYLt8wbA wC+5KyOG+p76UGDa9OmosFF/Qbd4wLuOrvl4gs+Ak3BArJH56cGPCisvmjQxe5dnBOxXhUumC BBaSfRD2qffn9f6D20uvAW1zFB//Ba9UhznoPWqC2WSMtCH+AQgZIunLJQjc6jaoG7wAAf5NW j4jh4IyoFnS0xPK0349IxgkmbDoWkBsQP5LtoWqY2LZsXEnqJZyUtOYBBShyGO9Eyizp3Mcrm QjjwzfFGv5EDMicTXztJ8K55/NR4Vt5dOlhZwUHeBKP5eISHizoAgdXjiLzSexHDuFk4BHZlj v+zyQ2TTdIo9KOeacSz1WjA5QSdmpK8gPGWZGGSEWBLkc8Kqug9+sccY7xVxJu+DWKHDbx8bW EtqyL1S4v1pBoVOtUlS+30tnfJa5ehePH3+EEuO/53vCjvk/eGC5OLePszfPm6EC8jLMUw1Af 3YkYK9I6Kqpilo0cP9qeXFvP2T4RN9SswoYr6kN/eoYvPhnCXZRVu4AvfRcsPv8yhHM/YM9z2 VMYC0fFp1tSr5vamSsyfVhx3CHHuNoh0eG5awgJ++eHEBJ9OoK+HUkMtAYk3Kf6JgNNtjBDad ITNaZJfqzd0dHM0gUkSzMVBqsUs7mq+Sy7wtJkw0Nsug2VmhO27VNDW1sGMTSq/KmBwUydKmV Q4Mue9Fr+LgcyuDNxE61rbwYBZJR0+Bhf1tYLCXoaPxXZO4kiy8hxH2MOdfSQWL+Ghbdaoc8f fnQoOp66I9QRSzDDipXV1Abk8XBmf3zVVg5A8ibTf2oZqy1kdyegEfj7dQijui2j0qxC64GSl 0rH6L+J
X-Mailman-Approved-At Tue, 17 May 2016 11:10:37 -0400
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 <573B300A.5080502@gmx.de>
X-Mailman-Original-References <5734ECDF.7070006@gmx.de> <mailman.617.1463087060.32212.python-list@python.org> <dplassFelugU1@mid.individual.net> <CAGgTfkPeqybAeqXLq8FHyRSb+d8KLemvxLrk8i3PfbWdwV4rBA@mail.gmail.com>
Xref csiph.com comp.lang.python:108745

Show key headers only | View raw


Hi Michael,

and thanks a lot for chiming in on this topic.

On 13.05.2016 22:33, Michael Selik wrote:
>
>> [...]
>>
> I share Greg's trepidation when I hear a phrase like that, but the general
> idea of a registry of classes or functions and then picking the right one
> based on string input is fine.
>

See my answer to Gregory, addressing his concerns. ;)

> How would the API work for custom Taskmasters? It's not so great to require
> that the user must explicitly ``add`` their derived class after defining
> it. Perhaps that add function could be a decorator?
>

Our current API doesn't use decorators at all, since it's also aimed at people with no (or only some) knowledge of Python. Until a 
year or so ago, we have been backwards compatible down to Python 1.5.2...and then to Python 2.4 for some time. Only during the last 
two months we made a clear cut and are now seeing Python 2.7 as our floor to further develop from.
So to some degree, decorators were technically not possible to support...and would have looked strange to the average user perhaps?

We're now free to add them into the mix for our new Python 2.7.x/3.y codebase, but this would probably require an API discussion 
first. However, I'll keep the "decorator" idea in mind when I get back to putting "all the dots on the i" for the interface.

Best regards,

Dirk

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Design: Idiom for classes and methods that are customizable by the user? Dirk Bächle <tshortik@gmx.de> - 2016-05-12 22:51 +0200
  Re: Design: Idiom for classes and methods that are customizable by the user? Marko Rauhamaa <marko@pacujo.net> - 2016-05-13 01:01 +0300
    Re: Design: Idiom for classes and methods that are customizable by the user? Dirk Bächle <tshortik@gmx.de> - 2016-05-13 00:42 +0200
      Re: Design: Idiom for classes and methods that are customizable by the user? Marko Rauhamaa <marko@pacujo.net> - 2016-05-13 08:53 +0300
  Re: Design: Idiom for classes and methods that are customizable by the   user? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-05-13 18:35 +1200
    Re: Design: Idiom for classes and methods that are customizable by the user? Michael Selik <michael.selik@gmail.com> - 2016-05-13 20:33 +0000
    Re: Design: Idiom for classes and methods that are customizable by the user? Dirk Bächle <tshortik@gmx.de> - 2016-05-17 16:51 +0200
    Re: Design: Idiom for classes and methods that are customizable by the user? Michael Selik <michael.selik@gmail.com> - 2016-05-17 18:13 +0000

csiph-web