Dear friends, >>> from itertools import repeat >>> list(repeat('a', 3)) ['a', 'a', 'a'] >>> list(repeat('a', 0)) [] >>> repeat.__doc__ 'repeat(object [,times]) -> create an iterator which returns the object\nfor the specified number of times. If not specified, returns the object\nendlessly.' If you omit the times argument: >>> list(repeat('a')) ... unlimited of a .... sometimes it can hang your machine .... In the C code it self, the default value of variable handling times argument is -1. It checks how many arguments you give to the function. So if you give -1 directly: >>> list(repeat('a', -1)) [] Negative value of times argument means 0. So what is the correct signature of this function? The value is not really capturable in Python and C. repeat(object [,times = unlimited]) ???? Can we do this in Clinic? If not, should we? Vajrasky
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4