<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,<br>
<br>
I understand.<br>
Python sources are very large. Any pointers to which file defines
the global statement syntax?<br>
<br>
Best regards,<br>
<br>
JM<br>
<br>
<br>
<div class="moz-cite-prefix">On 23-01-2017 19:53, Brett Cannon
wrote:<br>
</div>
<blockquote
cite="mid:CAP1=2W7oicO3byB_1fztDtDMEpYFZys1C211xWvp6VOA15MHaA@mail.gmail.com"
type="cite">
<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><br>
<br>
<div class="gmail_quote">
<div dir="ltr">On Mon, 23 Jan 2017 at 11:39 João Matos <<a
moz-do-not-send="true" href="mailto:jcrmatos@gmail.com">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="gmail_msg">
<br class="gmail_msg">
You are correct, my mistake. I should have written global
and not globals.<br class="gmail_msg">
<br class="gmail_msg">
The purpose of using parentheses on the import statement
is not (in my<br class="gmail_msg">
view) for operational efficiency but for
appearance/cleaness.<br class="gmail_msg">
The same applies to using it to global.<br
class="gmail_msg">
<br class="gmail_msg">
One does not need to have 10 global vars. It may have to
do with var<br class="gmail_msg">
name length and the 79 max line length.<br
class="gmail_msg">
<br class="gmail_msg">
This is an example from my one of my programs:<br
class="gmail_msg">
global existing_graph, expected_duration_in_sec,
file_size, \<br class="gmail_msg">
file_mtime, no_change_counter<br class="gmail_msg">
<br class="gmail_msg">
Anyway, the use of global being rare is of no concern. The
point of my<br class="gmail_msg">
suggestion is standardization.<br class="gmail_msg">
My opinion is that a standard language is easier to learn
(and teach)<br class="gmail_msg">
than one that has different syntax for the same issue,
depending on the<br class="gmail_msg">
statement.<br class="gmail_msg">
<br class="gmail_msg">
In short, if the recommended multi-line use for import is<br
class="gmail_msg">
<br class="gmail_msg">
import (a, b,<br class="gmail_msg">
c)<br class="gmail_msg">
<br class="gmail_msg">
instead of<br class="gmail_msg">
<br class="gmail_msg">
import a, b, \<br class="gmail_msg">
c<br class="gmail_msg">
<br class="gmail_msg">
Then the same should apply to global.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Best regards,<br class="gmail_msg">
<br class="gmail_msg">
JM<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
On 23-01-2017 19:25, Terry Reedy wrote:<br
class="gmail_msg">
> On 1/23/2017 1:43 PM, João Matos wrote:<br
class="gmail_msg">
>> Hello,<br class="gmail_msg">
>><br class="gmail_msg">
>> I would like to suggest that globals should
follow the existing rule<br class="gmail_msg">
>> (followed by the import statement, the if
statement and in other places)<br class="gmail_msg">
>> for extending beyond 1 line using parentheses.<br
class="gmail_msg">
>> Like this:<br class="gmail_msg">
>> globals (var_1, var_2,<br class="gmail_msg">
>> var_3)<br class="gmail_msg">
>><br class="gmail_msg">
>> instead of what must be done now, which is:<br
class="gmail_msg">
>> globals var_1, var_2 \<br class="gmail_msg">
>> var_3<br class="gmail_msg">
><br class="gmail_msg">
> The declaration keyword is 'global'; 'globals' is the
built-in<br class="gmail_msg">
> function. In any case<br class="gmail_msg">
><br class="gmail_msg">
> global var_1, var_2<br class="gmail_msg">
> global var_3<br class="gmail_msg">
><br class="gmail_msg">
> works fine. There is no connection between the names
and, unlike with<br class="gmail_msg">
> import, no operational efficiency is gained by
mashing the statements<br class="gmail_msg">
> together.<br class="gmail_msg">
><br class="gmail_msg">
> This issue should be rare. The global statement is
only needed when<br class="gmail_msg">
> one is rebinding global names within a function*. If
a function<br class="gmail_msg">
> rebinds 10 different global names, the design should
probably be<br class="gmail_msg">
> re-examined.<br class="gmail_msg">
><br class="gmail_msg">
> * 'global' at class scope seems useless.<br
class="gmail_msg">
><br class="gmail_msg">
> a = 0<br class="gmail_msg">
> class C:<br class="gmail_msg">
> a = 1<br class="gmail_msg">
><br class="gmail_msg">
> has the same effect as<br class="gmail_msg">
> a = 0<br class="gmail_msg">
> a = 1<br class="gmail_msg">
> class C: pass<br class="gmail_msg">
><br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br
class="gmail_msg">
Python-ideas mailing list<br class="gmail_msg">
<a moz-do-not-send="true"
href="mailto:Python-ideas@python.org" class="gmail_msg"
target="_blank">Python-ideas@python.org</a><br
class="gmail_msg">
<a moz-do-not-send="true"
href="https://mail.python.org/mailman/listinfo/python-ideas"
rel="noreferrer" class="gmail_msg" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br
class="gmail_msg">
Code of Conduct: <a moz-do-not-send="true"
href="http://python.org/psf/codeofconduct/"
rel="noreferrer" class="gmail_msg" target="_blank">http://python.org/psf/codeofconduct/</a></blockquote>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>