Re: [Python-ideas] globals should accept parenteses for extending beyond 1 line

2017-01-26 Thread Nick Coghlan
On 23 January 2017 at 22:29, MRAB wrote: > On 2017-01-23 20:09, Nick Timkovich wrote: >> >> Related and probably more common is the need for the line-continuation >> operator for long/multiple context managers with "with". I assume that's >> come up before, but was it

Re: [Python-ideas] globals should accept parenteses for extending beyond 1 line

2017-01-24 Thread Brett Cannon
On Tue, 24 Jan 2017 at 01:42 Petr Viktorin wrote: > On 01/23/2017 10:22 PM, João Matos wrote: > > Hello, > > > > I understand. > > Python sources are very large. Any pointers to which file defines the > > global statement syntax? > > Consider joining the core-mentorship list

Re: [Python-ideas] globals should accept parenteses for extending beyond 1 line

2017-01-24 Thread Petr Viktorin
On 01/23/2017 10:22 PM, João Matos wrote: Hello, I understand. Python sources are very large. Any pointers to which file defines the global statement syntax? Consider joining the core-mentorship list for questions like these: https://mail.python.org/mailman/listinfo/core-mentorship Anyway,

Re: [Python-ideas] globals should accept parenteses for extending beyond 1 line

2017-01-23 Thread Steven D'Aprano
On Mon, Jan 23, 2017 at 09:18:54PM +, João Matos wrote: > Why should I repeat global if I can use the line separation character \ > (like I mentioned on my 1st email) or parentheses as I suggested? That's the wrong question. The right question is, why should the Python language be made

Re: [Python-ideas] globals should accept parenteses for extending beyond 1 line

2017-01-23 Thread Ethan Furman
On 01/23/2017 01:18 PM, João Matos wrote: Why should I repeat global if I can use the line separation character \ (like I mentioned on my 1st email) or parentheses as I suggested? Because prefixing each line with global is more readable than either \ or ( )? At least to me. ;) -- ~Ethan~

Re: [Python-ideas] globals should accept parenteses for extending beyond 1 line

2017-01-23 Thread MRAB
On 2017-01-23 20:09, Nick Timkovich wrote: Related and probably more common is the need for the line-continuation operator for long/multiple context managers with "with". I assume that's come up before, but was it also just a low priority rather than any technical reason? It has come up before,

Re: [Python-ideas] globals should accept parenteses for extending beyond 1 line

2017-01-23 Thread João Matos
Hello, The subject of this topic is a suggestion about the language and not the programming paradigm/style. Why should I repeat global if I can use the line separation character \ (like I mentioned on my 1st email) or parentheses as I suggested? "global existing_graph, expected_duration #

Re: [Python-ideas] globals should accept parenteses for extending beyond 1 line

2017-01-23 Thread João Matos
Hello, I understand. Python sources are very large. Any pointers to which file defines the global statement syntax? Best regards, JM On 23-01-2017 19:53, Brett Cannon wrote: Actually multi-line import doesn't work: File ".\Untitled.py", line 1 import (tokenize, ^

Re: [Python-ideas] globals should accept parenteses for extending beyond 1 line

2017-01-23 Thread Chris Angelico
On Tue, Jan 24, 2017 at 6:37 AM, João Matos wrote: > One does not need to have 10 global vars. It may have to do with var name > length and the 79 max line length. > > This is an example from my one of my programs: > global existing_graph, expected_duration_in_sec, file_size,

Re: [Python-ideas] globals should accept parenteses for extending beyond 1 line

2017-01-23 Thread Nick Timkovich
Related and probably more common is the need for the line-continuation operator for long/multiple context managers with "with". I assume that's come up before, but was it also just a low priority rather than any technical reason? On Mon, Jan 23, 2017 at 1:53 PM, Brett Cannon

Re: [Python-ideas] globals should accept parenteses for extending beyond 1 line

2017-01-23 Thread Stephan Houben
For what it's worth, I normally just do: global a global b But I've never needed more than two. I think if you need more, then there is a serious style issue. That it looks syntactically ugly is a feature. Perhaps we should deprecate the comma in global ;-) . Stephan Op 23 jan. 2017 8:38 p.m.

Re: [Python-ideas] globals should accept parenteses for extending beyond 1 line

2017-01-23 Thread João Matos
Hello, You are correct, my mistake. I should have written global and not globals. The purpose of using parentheses on the import statement is not (in my view) for operational efficiency but for appearance/cleaness. The same applies to using it to global. One does not need to have 10 global

Re: [Python-ideas] globals should accept parenteses for extending beyond 1 line

2017-01-23 Thread Terry Reedy
On 1/23/2017 1:43 PM, João Matos wrote: Hello, I would like to suggest that globals should follow the existing rule (followed by the import statement, the if statement and in other places) for extending beyond 1 line using parentheses. Like this: globals (var_1, var_2, var_3) instead of

Re: [Python-ideas] globals should accept parenteses for extending beyond 1 line

2017-01-23 Thread Guido van Rossum
You can just write global foo, bar global baz, bletch On Mon, Jan 23, 2017 at 10:43 AM, João Matos wrote: > Hello, > > I would like to suggest that globals should follow the existing rule > (followed by the import statement, the if statement and in other places) > for