[Python-ideas] Re: Pre PEP: Python Literals (was custom strings before)

2021-06-15 Thread Thomas Güttler
Am Mo., 14. Juni 2021 um 11:12 Uhr schrieb J. Pic : > On Thu, Jun 10, 2021 at 8:34 AM Thomas Güttler > wrote: > >> >> This solution has two drawbacks: >> >>1. It is too verbose. Typing "conditional_escape(...)" again and >>again is cumbersome. >> >> from django import conditional_espace a

[Python-ideas] Re: Pre PEP: Python Literals (was custom strings before)

2021-06-15 Thread Thomas Güttler
Am Mo., 14. Juni 2021 um 01:25 Uhr schrieb Chris Angelico : > > I'd love to have some sort of generic interpolation construct, but the > use-cases all seem really weak... > > It depends on your daily work. If you create many small methods returning small HTML fragments, then it really helps if you

[Python-ideas] Receive filtered warnings

2021-06-15 Thread kasium
Hello all, I recently opened a feature request for pytest (https://github.com/pytest-dev/pytest/issues/8768) to find out if a warnings filter capture anything. Basic use-case: In big project with a lot of dependencies, the warnings filter list can grow a lot. Currently the only safe way to fin

[Python-ideas] "except;" - semicolon after except, to get rid of indentation when doing error recovery

2021-06-15 Thread Soni L.
Sometimes it would be useful to be able to write: def foo():   try: return thing()   except ValueError;   try: return otherthing()   except ValueError;   try: return yetotherthing()   except ValueError;   if shouldraise(): raise But currently this needs to be written like so: def foo():   try: r

[Python-ideas] Re: "except;" - semicolon after except, to get rid of indentation when doing error recovery

2021-06-15 Thread Chris Angelico
On Wed, Jun 16, 2021 at 10:51 AM Soni L. wrote: > > Sometimes it would be useful to be able to write: > > def foo(): > try: return thing() > except ValueError; > try: return otherthing() > except ValueError; > try: return yetotherthing() > except ValueError; > if shouldraise(): raise

[Python-ideas] Re: "except;" - semicolon after except, to get rid of indentation when doing error recovery

2021-06-15 Thread Joao S. O. Bueno
Sorry - personally I think this is absolutely ugly :-) So I will bikeshed. If this thread even go ahead - since the idea is not that bad, maybe allowing `try` on the same line? Then it would be inline with `elif` - but still structured "English like" try: statement except ValueError try: s

[Python-ideas] Re: "except;" - semicolon after except, to get rid of indentation when doing error recovery

2021-06-15 Thread Soni L.
On 2021-06-15 10:13 p.m., Joao S. O. Bueno wrote: > Sorry - personally I think this is absolutely ugly :-)  So I will > bikeshed. > > If this thread even go ahead - since the idea is not that bad, maybe > allowing `try` on the same line? > Then it would be inline with `elif` - but still structure

[Python-ideas] Re: "except;" - semicolon after except, to get rid of indentation when doing error recovery

2021-06-15 Thread Steven D'Aprano
On Tue, Jun 15, 2021 at 09:48:48PM -0300, Soni L. wrote: > def foo(): >   try: return thing() >   except ValueError: >     try: return otherthing() >     except ValueError: >   try: return yetotherthing() >   except ValueError: >     if shouldraise(): raise > > Look at all that unnece

[Python-ideas] Re: "except;" - semicolon after except, to get rid of indentation when doing error recovery

2021-06-15 Thread Steven D'Aprano
On Wed, Jun 16, 2021 at 10:56:12AM +1000, Chris Angelico wrote: > Dangerous idea - my first interpretation of that syntax was that it > would be equivalent to "except ValueError: pass", which would be very > confusing (it's subtly different in your example with return, and > drastically different

[Python-ideas] Re: "except;" - semicolon after except, to get rid of indentation when doing error recovery

2021-06-15 Thread Chris Angelico
On Wed, Jun 16, 2021 at 11:45 AM Steven D'Aprano wrote: > > On Wed, Jun 16, 2021 at 10:56:12AM +1000, Chris Angelico wrote: > > > Dangerous idea - my first interpretation of that syntax was that it > > would be equivalent to "except ValueError: pass", which would be very > > confusing (it's subtly