[Python-ideas] New 3.x restriction on number of keyword arguments
Terry Reedy
tjreedy at udel.edu
Fri Sep 17 23:50:00 CEST 2010
On 9/17/2010 4:00 PM, Raymond Hettinger wrote:
> One of the use cases for named tuples is to have them be
> automatically created from a SQL query or CSV header. Sometimes (but
> not often), those can have a huge number of columns. In Python 2.x,
> it worked just fine -- we had a test for a named tuple with 5000
> fields. In Python 3.x, there is a SyntaxError when there are more
> than 255 fields.
So, when the test failed due to the code change, the test was simply
removed?
> The origin of the change was a hack to fit positional argument counts
> and keyword-only argument counts in a single oparg in the python
> opcode encoding.
I do not remember any discussion of adding such a language restriction,
though I could have forgotten or missed it. As near as I can tell, it is
undocumented. While there are undocumented limits to the interpreter,
like nesting depth, this one is so low that I would consider the
discrepancy between doc and behavior a bug.
--
Terry Jan Reedy
More information about the Python-ideas
mailing list