[Python-ideas] Re: Conditional function/method/dict arguments assignments

2020-10-25 Thread Shai Berger
I've been toying with a similar idea myself. I've felt the pain described by Brian, and I share Marco's dislike for the suggested syntax. Moreover, I dislike the idea that the conditional should somehow refer to the function's default arguments. My half-baked idea is along the lines of f(

[Python-ideas] Allowing -b (BytesWarning) to be activated in other ways

2020-07-16 Thread Shai Berger
Hi Pythonistas, The -b flag, which turns on checks which emit BytesWarnings on operations mixing bytes and str objects, is very useful. However, the only way to set this flag is via the Python invocation. This limits its usability in contexts where the user's control of the Python invocation is l

[Python-ideas] Re: `raise as` to raise with current exception as cause

2020-02-07 Thread Shai Berger
On Fri, 7 Feb 2020 20:08:35 -0800 Andrew Barnert wrote: > > On Feb 7, 2020, at 16:11, Steven D'Aprano > > wrote: > > > > Shai Berger wants to set it implicily, based on where the raise is. > > If it is "directly" under the except line, impl

[Python-ideas] Re: `raise as` to raise with current exception as cause

2020-02-07 Thread Shai Berger
Hi, In the Django thread, I suggested that an implicit "raise from" should be the behavior whenever an exception is raised directly in exception-handling code (that is, within an except: or finally: clause). Ram claimed there were problems with that, but gave no details; I would be happy to know w