On Sat, Jun 7, 2014 at 5:50 AM, Nick Coghlan <ncogh...@gmail.com> wrote:
> On 7 June 2014 19:36, Ram Rachum <ram.rac...@gmail.com> wrote: > > My need is to have an infinite immutable sequence. I did this for myself > by > > creating a simple `count`-like stateless class, but it would be nice if > that > > behavior was part of `range`. > > Handling esoteric use cases like it sounds yours was is *why* user > defined classes exist. It does not follow that "I had to write a > custom class to solve my problem" should lead to a standard library or > builtin changing unless you can make a compelling case for: > > * the change being a solution to a common problem that a lot of other > people also have. "I think it might be nice" and "it would have been > useful to me to help solve this weird problem I had that one time" > isn't enough. > * the change fitting in *conceptually* with the existing language and > tools. In this case, "infinite sequence" is a fundamentally incoherent > concept in Python - len() certainly won't work, and negative indexing > behaviour is hence not defined. By contrast, since iterables and > iterators aren't required to support len() the way sequences are, > infinite iterable and infinite iterator are both perfectly well > defined. > With all due respect, “"infinite sequence" is a fundamentally incoherent concept in Python” is a bit hyperbolic. It would be perfectly reasonable to have them, but they're not defined (yet). > > Cheers, > Nick. > > -- > Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia >
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com