This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vajrasky
Recipients ezio.melotti, larry, rhettinger, serhiy.storchaka, terry.reedy, vajrasky
Date 2014-01-25.05:11:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1390626666.72.0.504897695989.issue19145@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-01-25 05:11:06vajraskysetrecipients: + vajrasky, rhettinger, terry.reedy, larry, ezio.melotti, serhiy.storchaka
2014-01-25 05:11:06vajraskysetmessageid: <1390626666.72.0.504897695989.issue19145@psf.upfronthosting.co.za>
2014-01-25 05:11:06vajraskylinkissue19145 messages
2014-01-25 05:11:05vajraskycreate