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/2006-February/061467.html below:

[Python-Dev] New Module: CommandLoop

[Python-Dev] New Module: CommandLoopCrutcher Dunnavant crutcher at gmail.com
Mon Feb 20 02:12:44 CET 2006
On 2/19/06, Raymond Hettinger <raymond.hettinger at verizon.net> wrote:
> >>         @cmdloop.aliases('goodbye')
> >>         @cmdloop.shorthelp('say goodbye')
> >>         @cmdloop.usage('goodbye TARGET')
> >>
> >> to just:
> >>
> >>         @cmdloop.addspec(aliases=['goodbye'], shorthelp ='say goodbye',
> >> usage='goodbye TARGET')
> >>
> >> leaving the possibility of multiple decorators when one line gets to long:
> >>
> >>         @cmdloop.addspec(aliases=['goodbye'], shorthelp ='say goodbye')
> >>         @cmdloop.addspec(usage='goodbye TARGET  # where TARGET is a filename
> >> in
> >> the current directory')
>
> > Well, why not support both, and leave it up to the user?
>
> Having only one method keeps the API simple.  Also, the addspec() approach
> allows the user to choose between single and multiple lines.
>
> BTW, addspec() could be made completely general by supporting all possible
> keywords at once:
>
> def addspec(**kwds):
>     def decorator(func):
>         func.__dict__.update(kwds)
>         return func
>     return decorator
>
> With an open definition like that, users can specify new attributes with less
> effort.

Well, yes it could. But as it currently stands, there is no mechanism
for user code to manipulate commands, so that would be of limited
utility, versus throwing errors if the user specified something
unsupported.

>
>
> Raymond
>
>


--
Crutcher Dunnavant <crutcher at gmail.com>
littlelanguages.com
monket.samedi-studios.com
More information about the Python-Dev mailing list

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