<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 04.09.2015 18:55, <a class="moz-txt-link-abbreviated" href="mailto:tdev@freenet.de">tdev@freenet.de</a> wrote:<br>
<blockquote
cite="mid:83b54738-95d0-4d4a-b8e3-810894ed8388@googlegroups.com"
type="cite">
<pre wrap="">From knowing e.g Java as OO language I had no need to set
such a keyword "global" to get write access to class members.
</pre>
</blockquote>
<br>
It is true and I really dislike Java for having this. Please
consider this<br>
<tt><br>
</tt>
<pre>class MyClass:
@classmethod
def method(cls):<tt>
attribute = 'a'
cls.myattribute = 1234</tt>
</pre>
<font face="Courier New, Courier, monospace"><br>
</font>As you see, even when using a class for the purpose, you
still need to reference the class object somehow.<font face="Courier
New, Courier, monospace"><br>
<br>
</font>
<blockquote
cite="mid:83b54738-95d0-4d4a-b8e3-810894ed8388@googlegroups.com"
type="cite">
<pre wrap="">
And now the main point: Cause all of the features and especially
the singleton construct, I could not believe that Python
does nearly all for me but forces me then to use such
a "ugly" keyword "global" in comparison to other OO languages.
</pre>
</blockquote>
<br>
It is ugly, that is true. Would something like this help you?<br>
<br>
<tt>@modulemethod</tt><tt><br>
</tt><tt>def method(mod):<br>
attribute = 'a'<br>
</tt><tt></tt><tt> mod.myattribute = 123</tt><br>
<br>
<br>
Works like classmethod but on module level. You still need to
explicitly specify from which namespace you want <tt>myattribute</tt>
but that's the Python way I think. It applies to instance methods,
class methods and all other types of Python code.<br>
<br>
<blockquote
cite="mid:83b54738-95d0-4d4a-b8e3-810894ed8388@googlegroups.com"
type="cite">
<pre wrap="">But I agree, I should have better never mentioned it.
Please lay OO and sharing globals aside.
It is really about procedural programming and "global"-keyword only.
That said I will really give no longer any comments about this.
</pre>
</blockquote>
<br>
That is sad. :(<br>
I at least would like to know if my suggestion would help? :)<br>
<br>
Best,<br>
Sven<br>
<br>
</body>
</html>