Re: [Python-Dev] Requesting pronouncement on PEP 463: Exception-catching expressions

2014-03-12 Thread Nick Coghlan
On 13 March 2014 07:49, Chris Angelico wrote: > > Umm, yeah, that one. Why did I think hasattr was the only way around > that? Anyway, that just means I picked a bad example. There are others > where you have to go for the full try/except. You may have been thinking of item lookup on sequences. A

Re: [Python-Dev] Requesting pronouncement on PEP 463: Exception-catching expressions

2014-03-12 Thread Chris Angelico
On Thu, Mar 13, 2014 at 8:37 AM, Tres Seaver wrote: > On 03/12/2014 04:49 PM, Chris Angelico wrote: >> You can use hasattr() in place of AttributeError > > I use: > > getattr(subject, attrname, default)? > > *all the time*. Umm, yeah, that one. Why did I think hasattr was the only way around tha

Re: [Python-Dev] Requesting pronouncement on PEP 463: Exception-catching expressions

2014-03-12 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/12/2014 04:49 PM, Chris Angelico wrote: > You can use hasattr() in place of AttributeError I use: getattr(subject, attrname, default)? *all the time*. Tres. - -- === Tres Sea

Re: [Python-Dev] Requesting pronouncement on PEP 463: Exception-catching expressions

2014-03-12 Thread Emile van Sebille
On 3/12/2014 1:44 PM, Chris Angelico wrote: unless someone's going to employ me to champion PEPs full time :) (Hmm. That would be an interesting job title on the resume.) It's available now -- www.pepboys.com :) Emile ___ Python-Dev mailing list P

Re: [Python-Dev] PEP 463: Exception-catching expressions

2014-03-12 Thread Chris Angelico
On Thu, Mar 13, 2014 at 7:26 AM, "Martin v. Löwis" wrote: > I think you (or someone) first needs to find a BDFL delegate. > Traditionally, with syntax changes, there is a good chance that Guido > doesn't want to delegate at all, so ask him whether he wants to delegate > or not. He beat you to it;

Re: [Python-Dev] Requesting pronouncement on PEP 463: Exception-catching expressions

2014-03-12 Thread Chris Angelico
On Thu, Mar 13, 2014 at 7:14 AM, Barry Warsaw wrote: > Interestingly enough, where ternaries are most useful are in the same > situations where I think exception expressions would be most useful, in the > setting of a variable or attribute to one of two different values. In both > branches of the

Re: [Python-Dev] Requesting pronouncement on PEP 463: Exception-catching expressions

2014-03-12 Thread Chris Angelico
On Thu, Mar 13, 2014 at 4:09 AM, Guido van Rossum wrote: > But the thing I can't get behind are the motivation and rationale. I don't > think that e.g. dict.get() would be unnecessary once we have except > expressions, and I disagree with the position that EAFP is better than LBYL, > or "generally

Re: [Python-Dev] PEP 463: Exception-catching expressions

2014-03-12 Thread Martin v. Löwis
Am 12.03.14 04:58, schrieb Chris Angelico: > On Wed, Mar 12, 2014 at 2:20 PM, Ethan Furman wrote: >> I sure hope this is accepted. I could have used it at least a half-dozen >> times in the last week -- which is more often than I would have used the >> ternary-if! :) > > Where do we go from her

Re: [Python-Dev] Requesting pronouncement on PEP 463: Exception-catching expressions

2014-03-12 Thread Barry Warsaw
On Mar 12, 2014, at 10:40 AM, Ethan Furman wrote: >Does this mean a better motivation and rationale may cause you to change your >mind? > >My motivation is for simpler, easier to read code: instead of a full-blown >try/except block or a double-lookup into an indexable object I would much >rather d

Re: [Python-Dev] Requesting pronouncement on PEP 463: Exception-catching expressions

2014-03-12 Thread Ethan Furman
On 03/12/2014 10:09 AM, Guido van Rossum wrote: I want to reject this PEP. [...] But the thing I can't get behind are the motivation and rationale. I don't think that e.g. dict.get() would be unnecessary once we have except expressions, and I disagree with the position that EAFP is better th

Re: [Python-Dev] Why not make frames? [was: Alternative forms [was: PEP 463: Exception-catching expressions]]

2014-03-12 Thread R. David Murray
On Mon, 10 Mar 2014 14:26:14 +1100, Chris Angelico wrote: > On Mon, Mar 10, 2014 at 1:16 PM, Jim J. Jewett wrote: > > I don't claim that syntax is perfect. I do think it is less flawed > > than the no-parentheses (or external parentheses) versions: > > > > (expr1 except expr3 if expr2) > >

Re: [Python-Dev] Requesting pronouncement on PEP 463: Exception-catching expressions

2014-03-12 Thread Guido van Rossum
On Tue, Mar 11, 2014 at 9:10 PM, Chris Angelico wrote: > PEP 463, Exception-catching expressions, is stable and I believe ready > for pronouncement. Drumroll please... > > http://www.python.org/dev/peps/pep-0463/ > > PEP: 463 > Title: Exception-catching expressions > Version: $Revision$ > Last-Mo

Re: [Python-Dev] Requesting pronouncement on PEP 463: Exception-catching expressions

2014-03-12 Thread Gustavo Carneiro
On 12 March 2014 15:21, Brett Cannon wrote: > > > > On Wed, Mar 12, 2014 at 11:16 AM, Chris Angelico wrote: > >> On Thu, Mar 13, 2014 at 2:14 AM, Brett Cannon wrote: >> > While I'm +0 on the idea, I'm -1 on the syntax; >> > > I just don't like having a >> > colon in an expression. >> > lambda:

[Python-Dev] Fwd: Requesting pronouncement on PEP 463: Exception-catching expressions

2014-03-12 Thread Jeremy Kloth
[resending to list] -- Forwarded message -- From: Jeremy Kloth Date: Wed, Mar 12, 2014 at 10:27 AM Subject: Re: [Python-Dev] Requesting pronouncement on PEP 463: Exception-catching expressions To: Chris Angelico On Wed, Mar 12, 2014 at 10:05 AM, Chris Angelico wrote: > Tooling

Re: [Python-Dev] Requesting pronouncement on PEP 463: Exception-catching expressions

2014-03-12 Thread Paul Moore
On 12 March 2014 16:05, Chris Angelico wrote: > Tooling issues should already have been solved for lambda, but if you > don't like the colon, go with one of the other options - Brett > expressed support for 'then', which makes very good sense (it does > require creating a new keyword, but it's a f

Re: [Python-Dev] Requesting pronouncement on PEP 463: Exception-catching expressions

2014-03-12 Thread Chris Angelico
On Thu, Mar 13, 2014 at 2:44 AM, Barry Warsaw wrote: > That being said, the colon really bothers me, despite what is written in > "Common objections". True, colons are used in places other than suite > introduction, but with exception handling, colons *do* introduce a new suite, > so its use here

Re: [Python-Dev] Requesting pronouncement on PEP 463: Exception-catching expressions

2014-03-12 Thread Barry Warsaw
On Mar 12, 2014, at 11:14 AM, Brett Cannon wrote: >While I'm +0 on the idea, I'm -1 on the syntax; I just don't like having a >colon in an expression. I'm -0 on the idea, mostly be cause it's never occurred to me to even need something like this, and because I don't personally think the existing

Re: [Python-Dev] Requesting pronouncement on PEP 463: Exception-catching expressions

2014-03-12 Thread Brett Cannon
On Wed, Mar 12, 2014 at 11:16 AM, Chris Angelico wrote: > On Thu, Mar 13, 2014 at 2:14 AM, Brett Cannon wrote: > > While I'm +0 on the idea, I'm -1 on the syntax; I just don't like having > a > > colon in an expression. > > Which is why there are alternatives listed, and the best four of them >

Re: [Python-Dev] Requesting pronouncement on PEP 463: Exception-catching expressions

2014-03-12 Thread Chris Angelico
On Thu, Mar 13, 2014 at 2:14 AM, Brett Cannon wrote: > While I'm +0 on the idea, I'm -1 on the syntax; I just don't like having a > colon in an expression. Which is why there are alternatives listed, and the best four of them (including the proposed one) ranked. ChrisA __

Re: [Python-Dev] Requesting pronouncement on PEP 463: Exception-catching expressions

2014-03-12 Thread Brett Cannon
On Wed, Mar 12, 2014 at 12:10 AM, Chris Angelico wrote: > PEP 463, Exception-catching expressions, is stable and I believe ready > for pronouncement. Drumroll please... > > http://www.python.org/dev/peps/pep-0463/ > > PEP: 463 > Title: Exception-catching expressions > Version: $Revision$ > Last-M

Re: [Python-Dev] PEP 463: Exception-catching expressions

2014-03-12 Thread Brett Cannon
On Tue Mar 11 2014 at 11:59:23 PM, Chris Angelico wrote: > On Wed, Mar 12, 2014 at 2:20 PM, Ethan Furman wrote: > > I sure hope this is accepted. I could have used it at least a half-dozen > > times in the last week -- which is more often than I would have used the > > ternary-if! :) > > Where