Closed jbasko closed 6 years ago
This is a Python limitation, not one imposed by dataclasses. There's nothing dataclasses can do to work around it, short of *args, which defeats the whole point of dataclasses!
It looks like this restriction has been removed in python 3.8. At least, a quick test shows a __init__
with 260 parameters doesn't fail in 3.8 (master), while it does in 3.6. I don't have a 3.7 handy.
I wouldn’t expect it to be fixed as it would make the code probably much slower for normal use cases, but don’t necessarily agree with *args and **kwargs beating the purpose of dataclasses because who said a dataclass-using code cannot be generated (which is where I hit this) :)
In Python 3.6.6 (the only one I've tried), when I declare a dataclass with more than 255 fields, I am getting the 255 arguments error:
Not sure if it's worth "fixing" this :)