This is not really the best syntax, but I thought this generator expression
might be of interest:
counter = (d.update(n=d['n']+1) or d['n'] for d in [dict(n=-1)] for _ in
iter(int,1))
It counts forever starting at 0. I was playing with only using generator
syntax...
On Fri, Jun 19, 2020 at 1:32
> I don't see the value myself, but in theory it would make sense to
have both bounded and infinite ranges be able to be processed the same
way.
My thinking is that if we wanted to represent an unbounded range as a
mathematical entity (rather than a tool for iteration), we should let that
exist in
On Fri, Jun 19, 2020 at 12:29 PM Ricky Teachey wrote:
> On Fri, Jun 19, 2020 at 12:25 PM wrote:
>
>> Proposal:
>> range(start, ..., step)
>> should function like
>> itertools.count(start, step)
>>
>> Reason:
>> It's pretty common to see people do things where they increment a count
>> within a w
On Sat, Jun 20, 2020 at 2:39 AM Steele Farnsworth
wrote:
> If range were to support infinite ranges, range.__len__ would have to be
> changed to either raise an error or return float('inf') in these cases.
That would be a problem that would have to be solved, as would related
concepts like what
On 19/06/2020 17:11, ke...@edinburghacademy.org.uk wrote:
Reason:
It's pretty common to see people do things where they increment a
count within a while True loop, and it would be nice to have
something easily available for people to use to replace this.
Sorry, but I'm failing to see the use ca
I suppose my previous message totally ignored that you acknowledged that
itertools.count exists.
If range were to support infinite ranges, range.__len__ would have to be
changed to either raise an error or return float('inf') in these cases. I
believe __contains__ would also need to have extra che
On Fri, Jun 19, 2020 at 12:25 PM wrote:
> Proposal:
> range(start, ..., step)
> should function like
> itertools.count(start, step)
>
> Reason:
> It's pretty common to see people do things where they increment a count
> within a while True loop, and it would be nice to have something easily
> ava
You can get this behavior with itertools.count
On Fri, Jun 19, 2020, 12:23 PM wrote:
> Proposal:
> range(start, ..., step)
> should function like
> itertools.count(start, step)
>
> Reason:
> It's pretty common to see people do things where they increment a count
> within a while True loop, and i
How on earth is "count()" not easily available?
On Fri, Jun 19, 2020 at 12:23 PM wrote:
> Proposal:
> range(start, ..., step)
> should function like
> itertools.count(start, step)
>
> Reason:
> It's pretty common to see people do things where they increment a count
> within a while True loop, an