[issue34169] itertools.repeat does not accept None as an explicit count

2018-07-21 Thread Clint Hepner
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

[issue34169] itertools.repeat does not accept None as an explicit count

2018-07-20 Thread Clint Hepner
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),

[issue22138] patch.object doesn't restore function defaults

2014-08-04 Thread Clint Hepner
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 # As expected