@ChrisA: There are already flags for enabling warnings on dangerous bytearray
comparisons[1] or relying on locale-dependent encodings[2], not to mention a
whole Development Mode flag[3] that adds extra checks. Some of those checks
affect fewer people than my proposal. A "warn on reused generator
2023 at 07:02, BoppreH via Python-ideas
> wrote:
> >
> > > In close to 10 years of experience with python I have never encountered
> > > anything like this.
> >
> > Here's a small selection of the StackOverflow questions from people who
> > en
ed numbers.
> 2. If I wanted unmodified list and if it was modified then it is an error,
> your solution doesn’t work either.
> 3. If sorting is ok only on non-empty iterator, then just `assert sorted`
> after sorting.
>
> If you could give a full real-life scenario, then i
@ChrisA: Shadowing "iter()" would only help with Barry's example.
@Jonathan: Updating documentation is helpful, but I find an automated check
better. Too often the most obvious way to accomplish something silently
triggers this behavior:
strings = ['aa', '', 'bbb', 'c']
strings = filter(bool, s
Any thoughts on logging a warning, perhaps behind an opt-in flag? I could not
find a single false positive scenario, so I expect the signal-to-noise ratio to
be high and prevent lots of bugs.
BoppreH
On Tue, Jun 13, 2023, at 1:05 AM, Greg Ewing wrote:
> On 13/06/23 9:59 am, Rob Cliffe via Pytho
empty list.
BoppreH
On Mon, Jun 12, 2023, at 10:11 PM, Barry wrote:
>
>
> > On 12 Jun 2023, at 16:55, BoppreH via Python-ideas
> > wrote:
> >
> > Then the empty list creates hard-to-track bugs. I'm familiar with the
> > iterator protocol and why the
This is my first post to this list, apologies in advance if this is the wrong
place or it's a known topic that my search failed to find.
As a Python user since 2.6, I make stupid mistakes with exhausted generators
more often than I'd like to admit:
numbers = (i for i in range(5))
assert 5 not i