[Python-ideas] Re: __init__ in module names

2020-12-11 Thread Steven D'Aprano
On Thu, Dec 10, 2020 at 11:10:05PM +0200, Serhiy Storchaka wrote: > > There are other ways you can get this same effect. Should we have > > warnings for them all? > > > > import spam > > ImportWarning: spam.py is a hard link to eggs.py and we > > want to force you to read the docs to

[Python-ideas] Re: Conditional with statements

2020-12-11 Thread Chris Angelico
On Sat, Dec 12, 2020 at 11:42 AM Jonathan Crall wrote: > > I'm not sure if this has been asked / suggested before. > > I'm wondering if there is any interest in conditional or loop-based `with` > statements. I think it could be done without a syntax change. > > ### Napkin proposal > > Context man

[Python-ideas] Conditional with statements

2020-12-11 Thread Jonathan Crall
I'm not sure if this has been asked / suggested before. I'm wondering if there is any interest in conditional or loop-based `with` statements. I think it could be done without a syntax change. ### Napkin proposal Context managers could define `__if__` or `__for__`, and if those dunder methods we

[Python-ideas] Re: An itertools.interleave / itertools.join function

2020-12-11 Thread Christopher Barker
On Thu, Dec 10, 2020 at 8:03 PM Chris Angelico wrote: > > Here is an example of how I use it to build an arbitrary long SQL > request without having to pay for long intermediate strings, both in > computation on memory. > > > I often had such cases, but ended up using the more costy str.join .