You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support comma delimited string for namedtuple. #1518
fromcollectionsimportnamedtupleX=namedtuple('X', 'a, b')
x=X(1, 'x')
x=X(b='y', a='x') # error: Unexpected keyword argument "a" for "X"x.a+ [1] # error: "X" has no attribute "a"classY(X):
"""you can use a namedtuple class as a base class"""
I will add it to PR #1810, although it's easy enough not to wait for it. It requires a single line change here. Changing items = str_expr.value.split() into items = str_expr.value.replace(',', ' ').split()
However, as discussed in the Enum case, it's a good idea not to use this form.
Activity
The-Compiler commentedon May 11, 2016
#529 is the same thing for
enum.Enum.elazarg commentedon Aug 31, 2016
I will add it to PR #1810, although it's easy enough not to wait for it. It requires a single line change here. Changing
items = str_expr.value.split()intoitems = str_expr.value.replace(',', ' ').split()However, as discussed in the
Enumcase, it's a good idea not to use this form.elazarg commentedon Sep 3, 2016
This has been be fixed by #1810