homepage

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 larry
Recipients ezio.melotti, larry, rhettinger, serhiy.storchaka, terry.reedy, vajrasky
Date 2014年01月22日.20:36:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1390422962.57.0.34893926064.issue19145@psf.upfronthosting.co.za>
In-reply-to
Content
This problem been independently rediscovered by people converting
code to Argument Clinic. A Python signature can't express these
semantics, where a parameter behaves differently depending on
whether it's passed in by keyword or by reference. So Argument
Clinic can't either. I think it would be best if itertools.repeat
behaved like a pure Python function--that is, that it behaved
the same whether "times" was passed in by position or by keyword.
What's I find curious: the documentation is wildly out of sync with the implementation. It says:
 itertools.repeat(object[, times])
 ....
 def repeat(object, times=None):
 ....
 http://docs.python.org/3.4/library/itertools.html#itertools.repeat
But repeat() doesn't support passing in None for the times parameter,
if indeed it ever has.
I see two possible choices here.
1) Honor the existing behavior. Change the signature to simply
 def repeat(object, times=-1):
 and document it that way.
2) Honor the documentation. Change the implementation to
 def repeat(object, times=None):
 This change could break code. So we'd have to go through a
 deprecation cycle. Breaking "times=-1" without a deprecation
 cycle is simply not viable at this point.
I could live with either.
History
Date User Action Args
2014年01月22日 20:36:02larrysetrecipients: + larry, rhettinger, terry.reedy, ezio.melotti, serhiy.storchaka, vajrasky
2014年01月22日 20:36:02larrysetmessageid: <1390422962.57.0.34893926064.issue19145@psf.upfronthosting.co.za>
2014年01月22日 20:36:02larrylinkissue19145 messages
2014年01月22日 20:36:01larrycreate

AltStyle によって変換されたページ (->オリジナル) /