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

2014-03-13 Thread Nikolaus Rath
Tres Seaver writes: > 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*. In my opinion that's almost as ugly, because it still forces you to specify the attribute name as a stri

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

2014-03-13 Thread Barry Warsaw
On Mar 13, 2014, at 10:15 AM, Victor Stinner wrote: >It's hard to accept that a wonderful idea at a first look is not a >good idea. Some months later, I now agree and see issues of my PEPs. >The PEP process ensures that the Python "language" (+ stdlib) keeps >consistent and well designed. > >Even

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

2014-03-13 Thread Chris Angelico
On Thu, Mar 13, 2014 at 8:15 PM, Victor Stinner wrote: > Even if a PEP is rejected, it becomes the best reference if someone > requests the same or a similar feature some months or years later. > Rejected PEPs explain almost how the Python language was designed. > > For thanks Chris, and I hope th

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

2014-03-13 Thread Victor Stinner
Hi, 2014-03-12 18:09 GMT+01:00 Guido van Rossum : > I want to reject this PEP. (...) > this was a well-written and well-researched PEP, and I think you've done a > great job moderating the discussion, collecting objections, reviewing > alternatives, and everything else that is required to turn a h

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] 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] 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] 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:

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

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

2014-03-11 Thread Chris Angelico
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-Modified: $Date$ Author: Chris Angelico Status: Draft Type: Standards Trac