Re: [Python-ideas] Extending expressions using ellipsis

2016-09-01 Thread Shane Hathaway
On 09/01/2016 02:04 PM, Paul Moore wrote: Thanks. That's a nice example of how the proposal might help. But you could of course have written your original code as def update(names, value): (dbsession.query(Table1) .filter(Table1.name.in_(names)) .update({'valu

Re: [Python-ideas] Extending expressions using ellipsis

2016-09-01 Thread Shane Hathaway
On 09/01/2016 01:24 PM, Brendan Barnwell wrote: I sometimes write similar code with a sequence of pandas operations. I think you can get a lot of mileage out of accepting the loss in precious vertical space and just putting the closing parenthesis on its own line, indented to the same level

Re: [Python-ideas] Extending expressions using ellipsis

2016-09-01 Thread Paul Moore
On 1 September 2016 at 19:44, Shane Hathaway wrote: > Sometimes I fix unbalanced parentheses incorrectly. Here's something I > might type. There should be another closing parenthesis in the middle: > > def update(names, value): > (dbsession.query(Table1) > .filter(Table1.nam

Re: [Python-ideas] Extending expressions using ellipsis

2016-09-01 Thread Brendan Barnwell
On 2016-08-31 14:46, Shane Hathaway wrote: Hi, I write a lot of SQLAlchemy code that looks more or less like this: rows = ( dbsession.query(Table1) .join( Table2, Table2.y = Table1.y) .filter(Table1.x = xx) .all()) The expressions get very long and nearly alwa

Re: [Python-ideas] Extending expressions using ellipsis

2016-09-01 Thread Shane Hathaway
On 09/01/2016 09:35 AM, Steven D'Aprano wrote: On Wed, Aug 31, 2016 at 03:46:13PM -0600, Shane Hathaway wrote: Cons: - Extra parentheses are required. You have to have extra *something* no matter how you do it. An extra semi-colon at the end of the statement, in semi-colon language. An extra

[Python-ideas] Improve the error message for impossible multiple inheritance

2016-09-01 Thread Neil Girdhar
I sometimes get the error message: TypeError: Cannot create a consistent method resolution order (MRO) for bases … I suggest that Python report * cycles (if there are any), or * a list of orderings of direct base classes (if there are no cycles). A cycle for the base classes A, B, C, D can be re

Re: [Python-ideas] real numbers with SI scale factors: next steps

2016-09-01 Thread Stephen J. Turnbull
Guido van Rossum writes: > On Wed, Aug 31, 2016 at 8:57 PM, Stephen J. Turnbull > wrote: > > That seems to be right approach: in system administration, these > > numbers are used mostly to understand resource usage, and > > underestimates are almost never what you want, > > That would see

Re: [Python-ideas] Extending expressions using ellipsis

2016-09-01 Thread Steven D'Aprano
On Thu, Sep 01, 2016 at 10:04:12AM -0500, Ryan Hiebert wrote: > > > On Sep 1, 2016, at 1:40 AM, Greg Ewing wrote: > > > > Guido van Rossum wrote: > >> Would this be enforced in the grammar or by the lexer? Since you say > >> you expect the indentation to be enforced, that suggests it would be >

Re: [Python-ideas] Extending expressions using ellipsis

2016-09-01 Thread Steven D'Aprano
On Wed, Aug 31, 2016 at 03:46:13PM -0600, Shane Hathaway wrote: > Cons: > > - Extra parentheses are required. You have to have extra *something* no matter how you do it. An extra semi-colon at the end of the statement, in semi-colon language. An extra backslash at the end of the line. An extra

Re: [Python-ideas] Extending expressions using ellipsis

2016-09-01 Thread Ryan Hiebert
> On Sep 1, 2016, at 1:40 AM, Greg Ewing wrote: > > Guido van Rossum wrote: >> Would this be enforced in the grammar or by the lexer? Since you say >> you expect the indentation to be enforced, that suggests it would be >> done by the grammar, > > I think it could be done by having the lexer en

Re: [Python-ideas] real numbers with SI scale factors: next steps

2016-09-01 Thread Random832
On Thu, Sep 1, 2016, at 02:17, Greg Ewing wrote: > I don't think a space should be automatic. The typographical > recommendation is to put a thin non-breaking space between > the value and the unit, but this is not possible with a > monospaced font, so some people might decide that it's > better wi

Re: [Python-ideas] Extending expressions using ellipsis

2016-09-01 Thread Sjoerd Job Postmus
On Thu, Sep 01, 2016 at 01:38:19PM +0300, Joonas Liik wrote: > On 1 September 2016 at 11:10, Sjoerd Job Postmus > wrote: > > On Thu, Sep 01, 2016 at 10:43:17AM +0300, Joonas Liik wrote: > >> Not sure if this is a good idea but it might also make some sense to > >> in stead have an operator at the

Re: [Python-ideas] Extending expressions using ellipsis

2016-09-01 Thread Joonas Liik
On 1 September 2016 at 11:10, Sjoerd Job Postmus wrote: > On Thu, Sep 01, 2016 at 10:43:17AM +0300, Joonas Liik wrote: >> Not sure if this is a good idea but it might also make some sense to >> in stead have an operator at the beginning of the line >> >> for example some languages have a chainging

Re: [Python-ideas] real numbers with SI scale factors: next steps

2016-09-01 Thread Greg Ewing
On 2016-08-31 17:19, Guido van Rossum wrote: I guess we need to debate what it should do if the value is way out of range of the SI scale system -- what's it going to do when I pass it 1e50? I propose that it should fall back to 'g' style then, but use "engineering" style where exponents are alw

Re: [Python-ideas] Extending expressions using ellipsis

2016-09-01 Thread Sjoerd Job Postmus
On Thu, Sep 01, 2016 at 10:43:17AM +0300, Joonas Liik wrote: > Not sure if this is a good idea but it might also make some sense to > in stead have an operator at the beginning of the line > > for example some languages have a chainging operator for method calls: > > my_object.m1() > ..m2() >

Re: [Python-ideas] Extending expressions using ellipsis

2016-09-01 Thread Joonas Liik
On 1 September 2016 at 09:40, Greg Ewing wrote: > Guido van Rossum wrote: >> >> Would this be enforced in the grammar or by the lexer? Since you say >> you expect the indentation to be enforced, that suggests it would be >> done by the grammar, > > > I think it could be done by having the lexer en