@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 generators" flag would fit right in, maintain backwards compatibility, and help some people (admittedly less than an opt-out one).
[1] https://docs.python.org/3/using/cmdline.html#cmdoption-b [2] https://docs.python.org/3/using/cmdline.html#cmdoption-X [3] https://docs.python.org/3/library/devmode.html#devmode @Dom: Thank you for your last message. That was genuinely kind and helpful, and the type of feedback I was hoping for. I also appreciate the others who said they haven't experienced this; maybe I'm doing something wrong, or misremembering how often it happens. I'd love to stay and improve the points you mentioned, but to be honest I started regretting this thread when the first reply was a counter-example that didn't work. And then Chris' messages started rolling in. If anybody wants to take the idea forward, be my guest.
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/KAFBSB23GSVP35EMW7UQXAKFZKWA7DDS/ Code of Conduct: http://python.org/psf/codeofconduct/