0.9.1: cannot create decorate flag / option with reserved word

Issue #2 resolved
coderazzi coderazzi repo owner created an issue

Following code is not accepted python

@optmatch(flags='import')
def handle(import, folder)

So it cannot be used --import as flag. A workaround is:

@optmatch
def handle(import_flag, folder)

But as decorator and variable definitions cannot be mixed, this is not always a solution

Comments (1)

  1. coderazzi coderazzi reporter

    On version 0.9.1, this could be handled using

    @optmatch(flags='variable as import')

    On version 0.9.2, it is possible to use non alphanumerical characters on the variable name, that will be dismissed. For example, parameter import will be automatically matched to variable 'import_' (or '_import')

  2. Log in to comment