Re: [Python-ideas] Improving Catching Exceptions

2017-06-23 Thread Paul Moore
On 23 June 2017 at 15:20, Sven R. Kunze wrote: > On 23.06.2017 03:02, Cameron Simpson wrote: > > > How about something like this? > >try: >val = bah[5] >except IndexError: ># handle your expected exception here >else: >foo(val) > > > That is

Re: [Python-ideas] be upfront if you aren't willing to implement your own idea

2017-06-23 Thread Carl Smith
+1 I'm quite active in the CoffeeScript community, but am also on a ton of medication that ultimately means I won't implement much of what I suggest doing, but the core devs understand the situation well enough to respond accordingly. It really does help when people know what they can reasonably

Re: [Python-ideas] be upfront if you aren't willing to implement your own idea

2017-06-23 Thread Guido van Rossum
"to put it succinctly" -- IMO we shouldn't discuss features without giving thought to their implementation. On Fri, Jun 23, 2017 at 11:28 AM, Brendan Barnwell wrote: > On 2017-06-23 09:49, Brett Cannon wrote: > >> Everyone, please be upfront when proposing any ideas if

Re: [Python-ideas] Improving Catching Exceptions

2017-06-23 Thread Stephan Houben
2017-06-23 17:09 GMT+02:00 Andy Dirnberger : > It's not really a proposal. It's existing syntax. Wow! I have been using Python since 1.5.2 and I never knew this. This is not Guido's famous time machine in action, by any chance? Guess there's some code to refactor using

Re: [Python-ideas] Improving Catching Exceptions

2017-06-23 Thread Steven D'Aprano
On Fri, Jun 23, 2017 at 09:29:23AM +1000, Cameron Simpson wrote: > On 23Jun2017 06:55, Steven D'Aprano wrote: > >On Thu, Jun 22, 2017 at 10:30:57PM +0200, Sven R. Kunze wrote: > >>We usually teach our newbies to catch exceptions as narrowly as > >>possible, i.e.

Re: [Python-ideas] Improving Catching Exceptions

2017-06-23 Thread Cameron Simpson
On 24Jun2017 05:02, Steven D'Aprano wrote: On Fri, Jun 23, 2017 at 09:29:23AM +1000, Cameron Simpson wrote: On 23Jun2017 06:55, Steven D'Aprano wrote: >On Thu, Jun 22, 2017 at 10:30:57PM +0200, Sven R. Kunze wrote: >>We usually teach our newbies to

Re: [Python-ideas] Improving Catching Exceptions

2017-06-23 Thread Cameron Simpson
On 23Jun2017 15:59, Paul Moore wrote: On 23 June 2017 at 15:20, Sven R. Kunze wrote: On 23.06.2017 03:02, Cameron Simpson wrote: How about something like this? try: val = bah[5] except IndexError: # handle your expected exception here

Re: [Python-ideas] Improving Catching Exceptions

2017-06-23 Thread Cameron Simpson
On 23Jun2017 20:30, Stephan Houben wrote: 2017-06-23 17:09 GMT+02:00 Andy Dirnberger : It's not really a proposal. It's existing syntax. Wow! I have been using Python since 1.5.2 and I never knew this. This is not Guido's famous time machine in

Re: [Python-ideas] Improving Catching Exceptions

2017-06-23 Thread Cameron Simpson
On 23Jun2017 11:48, Nick Coghlan wrote: On 23 June 2017 at 09:29, Cameron Simpson wrote: This is so common that I actually keep around a special hack: def prop(func): ''' The builtin @property decorator lets internal AttributeErrors escape.

Re: [Python-ideas] Improving Catching Exceptions

2017-06-23 Thread Greg Ewing
Cameron Simpson wrote: try: foo(bah[5]) except IndexError as e: ... infer that there is no bah[5] ... One can easily want, instead, some kind of "shallow except", which would catch exceptions only if they were directly raised from the surface code; The problem I see

Re: [Python-ideas] be upfront if you aren't willing to implement your own idea

2017-06-23 Thread Brett Cannon
On Fri, 23 Jun 2017 at 13:10 Paul Moore wrote: > On 23 June 2017 at 19:28, Brendan Barnwell wrote: > > So to put it succinctly, as someone who's found discussion on this list > > interesting and valuable, I think there is value in having discussion >