<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
This is just an example and there are many other use cases.<br>
</blockquote>
<br></div>
Great! Let's hear what those other use-cases are. Maybe some of them are more compelling.<br>
<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div></div></blockquote></blockquote><div>- Being able to identify more easily the variable. <br>
</div><div>- UnboundLocalError is too confusing for starters<br></div><div>- This is a counterpart for "<span style="font-family:courier new,monospace">from foo import bar</span>". Did you never scrolled up 500 lines of code in a module to see what this "do_weird_stuff()" function came from?<br>
</div><div>- Maybe "big function" I wrote is not just what you're thinking:<br> If you're reading a diff output, 10 lines could be enough to hide the information.<br> If you're on 80x25 terminal window, 30 lines could be too much.<br>
If you have a critical security bug at 3am after drinking two liters of coffee, 1 line can be too much.<br> And, if you're one of the people my boss hire to "help" the project, I won't even guess what is too much for your twisted mind. :)<br>
<br></div><div>Yes, there are use cases, you can probably think of others too.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<br>
Well, I didn't proposed them to become objects... There's nothing wrong<br></div>
with some keywords behaving *partially* like objects.<br>
</blockquote>
<br>
Of course there is something wrong with keywords behaving partially like objects. It is bad design that makes it harder to reason about what code does. It makes it harder to learn the language. It complicates the execution model. It complicates the parser.<br>
<br>
Good programming languages must be consistent. Things which are similar should look similar. Things which are different should look different. In your proposal, things which are different (the global keyword, and objects) look similar. That makes Python less consistent, which makes it a worse language.<div>
<div><br></div></div></blockquote><div> </div><div>The form of "super" without arguments is super inconsistent. It is just black magic, but it works.<br></div><div>Another point is that your text editor (usually) will color the word "global" differently, so it's easy to accept this may not be an object like others.<br>
</div><div>Also, I would argue it is more consistent to use namespaces than to declare the variable.<br></div></div><br></div></div>