[Python-ideas] Re: exception instance call should raise exception

2020-07-05 Thread Tiago Illipronti Girardi
Your original proposal appears to want this behavior: class BaseException: def __call__(self): raise self That could be expanded to something like: class BaseException: def __call__(self, *args): if not args: raise self if len(args) > 1: Ty

[Python-ideas] Re: exception instance call should raise exception

2020-07-05 Thread Soni L.
On 2020-07-05 12:58 p.m., MRAB wrote: On 2020-07-05 14:10, Soni L. wrote: On 2020-07-05 10:03 a.m., MRAB wrote: On 2020-07-05 13:39, Soni L. wrote: 1. saves keywords and 2. can be passed as callables. since there's no lambda: raise, 2 is a new feature. How would you re-raise an exceptio

[Python-ideas] Re: exception instance call should raise exception

2020-07-05 Thread MRAB
On 2020-07-05 14:10, Soni L. wrote: On 2020-07-05 10:03 a.m., MRAB wrote: On 2020-07-05 13:39, Soni L. wrote: 1. saves keywords and 2. can be passed as callables. since there's no lambda: raise, 2 is a new feature. How would you re-raise an exception? just call it. Wouldn't that just c

[Python-ideas] Re: exception instance call should raise exception

2020-07-05 Thread Steven D'Aprano
On Sun, Jul 05, 2020 at 10:10:01AM -0300, Soni L. wrote: > >What would be the replacement for: > > > >    raise ex from None > > > >and so forth? > > no idea. just don't use that anymore? So your plan is to make Python less useful, less powerful, and be unable to do things that it can do now? S

[Python-ideas] Re: exception instance call should raise exception

2020-07-05 Thread Soni L.
On 2020-07-05 10:03 a.m., MRAB wrote: On 2020-07-05 13:39, Soni L. wrote: 1. saves keywords and 2. can be passed as callables. since there's no lambda: raise, 2 is a new feature. How would you re-raise an exception? just call it. What would be the replacement for:     raise ex from No

[Python-ideas] Re: exception instance call should raise exception

2020-07-05 Thread MRAB
On 2020-07-05 13:39, Soni L. wrote: 1. saves keywords and 2. can be passed as callables. since there's no lambda: raise, 2 is a new feature. How would you re-raise an exception? What would be the replacement for: raise ex from None and so forth? I prefer the clarity of knowing that it'

[Python-ideas] Re: exception instance call should raise exception

2020-07-05 Thread Soni L.
1. saves keywords and 2. can be passed as callables. since there's no lambda: raise, 2 is a new feature. On 2020-07-05 1:15 a.m., Steven D'Aprano wrote: On Sun, Jul 05, 2020 at 12:48:08AM -0300, Soni L. wrote: > ValueError()() should be the same as raise ValueError() but with an > extra call l

[Python-ideas] Re: exception instance call should raise exception

2020-07-04 Thread Steven D'Aprano
On Sun, Jul 05, 2020 at 12:48:08AM -0300, Soni L. wrote: > ValueError()() should be the same as raise ValueError() but with an > extra call level. > > and raise should be deprecated. Proposals that are given without justification should be rejected without justification: "No they shouldn't."