Clint Hepner added the comment:
This came up in response to https://stackoverflow.com/q/51443795/1126841.
I realize the current documentation is informative, not normative, but I think
there is a legitimate reason to allow an explicit None argument like the pure
Python suggests.
Currently
New submission from Clint Hepner :
I expected to be able to pass None as an explicit count to itertools.repeat to
get the default behavior of an infinite iterator:
>>> list(islice(repeat(1), 10))
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
>>> list(islice(repeat(1, None),
New submission from Clint Hepner:
Following a patch, a function's __defaults__ attribute is reset to None.
def foo(x=5):
return x
assert foo() == 5 # As expected
with unittest.mock.patch.object(foo, '__defaults__', (10,)):
assert foo() == 10