Chris Angelico <ros...@gmail.com> writes:
> @cmdline
> def adduser(
>         user: {cmdline: "Name of user to add", typing: str},
>         password: {cmdline: "Password for the new user", typing: str}=""):
>     """Add a new user"""

In the case of just one decorator, the dictionary could be omitted.  The
decorator function itself could have an annotation flagging it as a
consumer of annotations, so that would make it easy to check if there
was more than one.  In your example above, you'd also want a @typing
decorator.  

In those particular cases, the decorators don't even need the annotation
feature:

@cmdline(name="Name of user to add", password="Password for the new user")
@typing(name=str, password=str)
def adduser(user, password):
    """Add a new user"""
    ...
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to