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 steven.daprano
Recipients mdk, ncoghlan, rhettinger, seluj78, serhiy.storchaka, steven.daprano
Date 2018-11-20.00:01:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1542672071.11.0.788709270274.issue35200@psf.upfronthosting.co.za>
In-reply-to
Content
Raymond:
> I'm in agreement with the comments that the proposed __str__ revision is confusing.

In what way is it "confusing"?

I'm especially perplexed that Julien apparently thinks it is confusing when emitted by str(), but educational and useful when emitted by repr(). This makes no sense to me.

I think Julien's idea is a good one, just not for repr, and I don't think it is confusing at all.


Raymond:
> most other iterators can't show a preview of the output without actually consuming some of their inputs

`range` is not some arbitrary iterator, in fact it isn't an iterator at all:

py> r = range(10)
py> iter(r) is r
False


It is a sequence, like list and tuple, and like list and tuple it is perfectly capable of showing its content (in full or part) on demand. Other important built-in sequence types like strings, lists and tuples aren't hamstrung with the restriction not to do anything iterators can't do, there's no good reason for range objects to be given that restriction.


Julien:
> I'm closing this.

Not so hasty, please. Some of us think this is a worthwhile enhancement. You might have changed your mind, but the idea is bigger than you now :-)

I'm taking this discussion to Python-Ideas to see if there is community interest in this feature. If so, I'm going to reopen the issue.
History
Date User Action Args
2018-11-20 00:01:11steven.dapranosetrecipients: + steven.daprano, rhettinger, ncoghlan, serhiy.storchaka, mdk, seluj78
2018-11-20 00:01:11steven.dapranosetmessageid: <1542672071.11.0.788709270274.issue35200@psf.upfronthosting.co.za>
2018-11-20 00:01:11steven.dapranolinkissue35200 messages
2018-11-20 00:01:11steven.dapranocreate