<div dir="ltr">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?</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 23, 2017 at 1:53 PM, Brett Cannon <span dir="ltr"><<a href="mailto:brett@python.org" target="_blank">brett@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Actually multi-line import doesn't work:<div><br></div><div><div>File ".\Untitled.py", line 1</div><div>    import (tokenize,</div><div>           ^</div><div>SyntaxError: invalid syntax</div></div><div><br></div><div>I think you're getting this mixed up with parentheses being allowed in `from ... import (...)` syntax. So unless there is another single-word keyword that allows multi-line arguments using parentheses I don't think there's an inconsistency here.</div><div><br></div><div>Plus, as Guido pointed out, the current syntax isn't preventing you from doing something you can already do. So if you want to add parentheses support to global, nonlocal, and import, you can propose a patch, but it's not a priority to solve without someone providing a solution since it doesn't open up anything new for something people don't use on a regular basis.</div><div><div class="h5"><div><br><br><div class="gmail_quote"><div dir="ltr">On Mon, 23 Jan 2017 at 11:39 João Matos <<a href="mailto:jcrmatos@gmail.com" target="_blank">jcrmatos@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br class="m_-5369753509200740785gmail_msg">
<br class="m_-5369753509200740785gmail_msg">
You are correct, my mistake. I should have written global and not globals.<br class="m_-5369753509200740785gmail_msg">
<br class="m_-5369753509200740785gmail_msg">
The purpose of using parentheses on the import statement is not (in my<br class="m_-5369753509200740785gmail_msg">
view) for operational efficiency but for appearance/cleaness.<br class="m_-5369753509200740785gmail_msg">
The same applies to using it to global.<br class="m_-5369753509200740785gmail_msg">
<br class="m_-5369753509200740785gmail_msg">
One does not need to have 10 global vars. It may have to do with var<br class="m_-5369753509200740785gmail_msg">
name length and the 79 max line length.<br class="m_-5369753509200740785gmail_msg">
<br class="m_-5369753509200740785gmail_msg">
This is an example from my one of my programs:<br class="m_-5369753509200740785gmail_msg">
global existing_graph, expected_duration_in_sec, file_size, \<br class="m_-5369753509200740785gmail_msg">
     file_mtime, no_change_counter<br class="m_-5369753509200740785gmail_msg">
<br class="m_-5369753509200740785gmail_msg">
Anyway, the use of global being rare is of no concern. The point of my<br class="m_-5369753509200740785gmail_msg">
suggestion is standardization.<br class="m_-5369753509200740785gmail_msg">
My opinion is that a standard language is easier to learn (and teach)<br class="m_-5369753509200740785gmail_msg">
than one that has different syntax for the same issue, depending on the<br class="m_-5369753509200740785gmail_msg">
statement.<br class="m_-5369753509200740785gmail_msg">
<br class="m_-5369753509200740785gmail_msg">
In short, if the recommended multi-line use for import is<br class="m_-5369753509200740785gmail_msg">
<br class="m_-5369753509200740785gmail_msg">
import (a, b,<br class="m_-5369753509200740785gmail_msg">
     c)<br class="m_-5369753509200740785gmail_msg">
<br class="m_-5369753509200740785gmail_msg">
instead of<br class="m_-5369753509200740785gmail_msg">
<br class="m_-5369753509200740785gmail_msg">
import a, b, \<br class="m_-5369753509200740785gmail_msg">
     c<br class="m_-5369753509200740785gmail_msg">
<br class="m_-5369753509200740785gmail_msg">
Then the same should apply to global.<br class="m_-5369753509200740785gmail_msg">
<br class="m_-5369753509200740785gmail_msg">
<br class="m_-5369753509200740785gmail_msg">
Best regards,<br class="m_-5369753509200740785gmail_msg">
<br class="m_-5369753509200740785gmail_msg">
JM<br class="m_-5369753509200740785gmail_msg">
<br class="m_-5369753509200740785gmail_msg">
<br class="m_-5369753509200740785gmail_msg">
<br class="m_-5369753509200740785gmail_msg">
<br class="m_-5369753509200740785gmail_msg">
On 23-01-2017 19:25, Terry Reedy wrote:<br class="m_-5369753509200740785gmail_msg">
> On 1/23/2017 1:43 PM, João Matos wrote:<br class="m_-5369753509200740785gmail_msg">
>> Hello,<br class="m_-5369753509200740785gmail_msg">
>><br class="m_-5369753509200740785gmail_msg">
>> I would like to suggest that globals should follow the existing rule<br class="m_-5369753509200740785gmail_msg">
>> (followed by the import statement, the if statement and in other places)<br class="m_-5369753509200740785gmail_msg">
>> for extending beyond 1 line using parentheses.<br class="m_-5369753509200740785gmail_msg">
>> Like this:<br class="m_-5369753509200740785gmail_msg">
>> globals (var_1, var_2,<br class="m_-5369753509200740785gmail_msg">
>>     var_3)<br class="m_-5369753509200740785gmail_msg">
>><br class="m_-5369753509200740785gmail_msg">
>> instead of what must be done now, which is:<br class="m_-5369753509200740785gmail_msg">
>> globals var_1, var_2 \<br class="m_-5369753509200740785gmail_msg">
>>     var_3<br class="m_-5369753509200740785gmail_msg">
><br class="m_-5369753509200740785gmail_msg">
> The declaration keyword is 'global'; 'globals' is the built-in<br class="m_-5369753509200740785gmail_msg">
> function.  In any case<br class="m_-5369753509200740785gmail_msg">
><br class="m_-5369753509200740785gmail_msg">
> global var_1, var_2<br class="m_-5369753509200740785gmail_msg">
> global var_3<br class="m_-5369753509200740785gmail_msg">
><br class="m_-5369753509200740785gmail_msg">
> works fine.  There is no connection between the names and, unlike with<br class="m_-5369753509200740785gmail_msg">
> import, no operational efficiency is gained by mashing the statements<br class="m_-5369753509200740785gmail_msg">
> together.<br class="m_-5369753509200740785gmail_msg">
><br class="m_-5369753509200740785gmail_msg">
> This issue should be rare.  The global statement is only needed when<br class="m_-5369753509200740785gmail_msg">
> one is rebinding global names within a function*.  If a function<br class="m_-5369753509200740785gmail_msg">
> rebinds 10 different global names, the design should probably be<br class="m_-5369753509200740785gmail_msg">
> re-examined.<br class="m_-5369753509200740785gmail_msg">
><br class="m_-5369753509200740785gmail_msg">
> * 'global' at class scope seems useless.<br class="m_-5369753509200740785gmail_msg">
><br class="m_-5369753509200740785gmail_msg">
> a = 0<br class="m_-5369753509200740785gmail_msg">
> class C:<br class="m_-5369753509200740785gmail_msg">
>     a = 1<br class="m_-5369753509200740785gmail_msg">
><br class="m_-5369753509200740785gmail_msg">
> has the same effect as<br class="m_-5369753509200740785gmail_msg">
> a = 0<br class="m_-5369753509200740785gmail_msg">
> a = 1<br class="m_-5369753509200740785gmail_msg">
> class C: pass<br class="m_-5369753509200740785gmail_msg">
><br class="m_-5369753509200740785gmail_msg">
<br class="m_-5369753509200740785gmail_msg">
______________________________<wbr>_________________<br class="m_-5369753509200740785gmail_msg">
Python-ideas mailing list<br class="m_-5369753509200740785gmail_msg">
<a href="mailto:Python-ideas@python.org" class="m_-5369753509200740785gmail_msg" target="_blank">Python-ideas@python.org</a><br class="m_-5369753509200740785gmail_msg">
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" class="m_-5369753509200740785gmail_msg" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a><br class="m_-5369753509200740785gmail_msg">
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" class="m_-5369753509200740785gmail_msg" target="_blank">http://python.org/psf/<wbr>codeofconduct/</a></blockquote></div></div></div></div></div>
<br>______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/<wbr>codeofconduct/</a><br></blockquote></div><br></div>