Vajrasky Kok added the comment:

Larry said, "It behaves differently depending on whether "times" is passed by 
position or by keyword."

And that is the bug. It should be the same no matter whether we send times 
through positional or keyword. As Raymond has said earlier in this thread, "The 
preferred behavior is that a negative number always means 0."

So negative times through keyword must mean zero repetitions.

So it means we cannot set -1 as a default value for times because it will upset 
many people.

I am not sure at the moment in itertools.repeat,

  sig = inspect.signature(itertools.repeat)
  a = itertools.repeat('a')
  b = itertools.repeat('a', sig.parameters['times'].default)
  c = itertools.repeat('a', times=sig.parameters['times'].default)

a & b & c can and should be interchangebly. b & c, yeah, should be 
interchangeably. But not a. a is a special case. Of course, if we were to 
design this function from scratch again, we should make a & b & c 
interchangeably. That is the ideal case. We should be able to send default 
value explicitly and manually. But we are in beta phase. Can we alter the 
behaviour in this phase?

But if we have to make a & b & c interchangeably in Python 3.4 (for 
philosophical or pragmatic reason), I think None is sensible default value, and 
your nullable-int patch works in this case. And I think we need to get approval 
from Raymond Hettinger.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19145>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to