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 MLModel
Recipients MLModel, georg.brandl, rhettinger, terry.reedy
Date 2009-05-14.16:40:46
SpamBayes Score 1.4321877e-14
Marked as misclassified No
Message-id <p06240803c631f166a048@[10.0.1.221]>
In-reply-to <1242310403.86.0.185275044361.issue5953@psf.upfronthosting.co.za>
Content
Sounds right. (1) I was raising the issue in case either the behavior was unintended or the documentation should mention it; (2) I realize that comparing ranges is strange; (3) I understand that range works in 3 the way xrange worked in 2, and that the what's new documentation says that range replaces xrange (4) you're point about ranges with steps clinches the issue, I think -- certainly equality of ranges should not have to compute the range -- they should be thought of as generators (and maybe documented as such -- for all I know, since I haven't looked, they are implemented that way); (5) I agree that range behaves like an iterator -- its documentation at the introduction to sequence tyhpes even points out that in, not in, max, and min are inefficient (6) the specific documentation for range explicitly states that they have very little behavior supporting only indexing, iteration, and len().

Your comments were very helpful in explicitly laying out the issues regarding implementing equality and the relative unimportance of the change in behavior, and I now have the explanation I wanted.

The only thing that still makes me uncomfortable is that it wouldn't be such a big deal to point out in the 3.0 "what's new" document where the change to range is mentioned in a bullet that range supports only indexing, iteration, and len, and that operations such as in and not in and functions such as max and min are inefficient because, except in when true, they require iterating over the entire range. Since these are specified in the actual documentation of range I believe they should be added to the what's new, where the change to range is described. I agree that what things don't do should rarely be documented, but if they no longer do something that they used to do, that should go in the "what's new" document -- at least in the form of an explicit list of what they do do. The only argument I can see against doing that is that the document says that "range() now behaves like xrange() used to behave", but I don't feel that is sufficiently explicit for people who have used range extensively but never or rarely xrange or who don't think about its implications. Maybe the "what's new" should just say that range() acts like an iterator.

All in all I'm satisfied and appreciative, except that I'm still left with the feeling that something about range() should be added to the 3.0 "what's new".
-- 
-- 

        --- Mitchell
History
Date User Action Args
2009-05-14 16:40:50MLModelsetrecipients: + MLModel, georg.brandl, rhettinger, terry.reedy
2009-05-14 16:40:49MLModellinkissue5953 messages
2009-05-14 16:40:46MLModelcreate