Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support comma delimited string for namedtuple. #1518

Closed
graingert opened this issue May 11, 2016 · 3 comments
Closed

Support comma delimited string for namedtuple. #1518

graingert opened this issue May 11, 2016 · 3 comments

Comments

@graingert
Copy link
Contributor

graingert commented May 11, 2016

from collections import namedtuple

X = 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"
class Y(X): 
    """you can use a namedtuple class as a base class"""
@The-Compiler
Copy link
Contributor

#529 is the same thing for enum.Enum.

@elazarg
Copy link
Contributor

elazarg commented 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() into items = str_expr.value.replace(',', ' ').split()

However, as discussed in the Enum case, it's a good idea not to use this form.

@elazarg
Copy link
Contributor

elazarg commented Sep 3, 2016

This has been be fixed by #1810

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants