[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, t

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

2018-07-20 Thread Terry J. Reedy
Terry J. Reedy added the comment: The 'roughly equivalent' Python code is real code that really runs, and in that sense not pseudocode. itertools is coded in C, which allows optional args with no default. To have optional args when coding in Python, either a default is needed or the argume

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

2018-07-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: > we should let users through documentation know that this code is just > pseudo-code We already modified the docs to specifically say that the provided code is just a rough equivalent. Thanks for the suggestion, but I'm going to decline. There doesn't

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

2018-07-20 Thread Dong-hee Na
Dong-hee Na added the comment: Raymond, when I first read this issue, it seemed very clear that it should not work. However, after reading the documentation I misunderstood that it can be worked because the pseudocode specifies NoneType. IMHO, in that case, we should let users through docum

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

2018-07-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: Clint, why do you think you need this? Dong-hee, the pure python code is listed a rough equivalent, not an exact equivalent. -- ___ Python tracker _

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

2018-07-20 Thread Dong-hee Na
Change by Dong-hee Na : -- versions: +Python 3.8 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

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

2018-07-20 Thread Dong-hee Na
Dong-hee Na added the comment: IMHO, this issue should be fixed since times=None can be passed, ref: https://docs.python.org/3/library/itertools.html#itertools.repeat This documentation also shows the equivalent python code, >From this code, times=None should work but does not work in current

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

2018-07-20 Thread Dong-hee Na
Change by Dong-hee Na : -- keywords: +patch pull_requests: +7890 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-list

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

2018-07-20 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- assignee: -> rhettinger nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list

[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), 10)) Traceback (mo