<br><br><div class="gmail_quote">On 27 July 2011 13:36, Giampaolo Rodolą <span dir="ltr"><<a href="mailto:g.rodola@gmail.com">g.rodola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="gmail_quote"><div class="im">2011/7/25 Michael Foord <span dir="ltr"><<a href="mailto:fuzzyman@gmail.com" target="_blank">fuzzyman@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br><br><div class="gmail_quote"><div>On 25 July 2011 19:47, Raymond Hettinger <span dir="ltr"><<a href="mailto:raymond.hettinger@gmail.com" target="_blank">raymond.hettinger@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><br><div><div><div>On Jul 25, 2011, at 1:06 PM, Michael Foord wrote:</div><blockquote type="cite"><div class="gmail_quote"><div><font color="#000000"><br></font> Python standard library modules 
currently using integers for constants:
<br>
<br>* re - has flags (OR'able constants) defined in sre_constants, each flag 
has two names (e.g. re.IGNORECASE and re.I)
<br></div></div></blockquote><div><br></div></div><div>What is being proposed here?  Will there be a new namespace so that we would start writing re.Flags.IGNORECASE instead of re.IGNORECASE?  Are module level constants now going to be considered bad-form?</div>


<div><br></div><div>If constants switch from re.IGNORECASE to re.flags.IGNORECASE, are there any benefits to compensate for being both wordier and slower?</div><div><div><br></div></div></div></div></blockquote>
</div><div><br>Nope. Just something like this at the module level.<br><br>IGNORECASE = Flags.IGNORECASE <br><br>What it gains you is a nicer representation when looking at the values when debugging. On the other hand being able to have access to all the constants namespaced on a single object (as well) doesn't seem like such a bad thing.</div>

</div></blockquote><div><br></div></div><div>Having aliases all around stdlib module namespaces doesn't sound like a good idea to me at all.</div><div>"There should be one and preferably one obvious way to do it".</div>

<div>That aside, it's not clear what name convention to use that extra "Flags" namespace which wasn't there before.</div><div><br></div><div>Why re.Flags.* instead of re.Constants.*?</div></div></blockquote>
<div><br>I used Flags as an arbitrary name for an example. It could be anything. It could be _Constants if it was decided that the constant group itself wasn't useful. I would expect it to be useful.<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="gmail_quote"><div>
If we decide to use re.Flags what should we expect to find into the socket module? socket.Constants?</div><div>If so, why do we find AF_INET in socket.Constants.AF_INET rather than socket.Family.AF_INET?</div>
<div> </div></div></blockquote><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="gmail_quote"><div></div><div>
...and so on.</div><div><br></div></div></blockquote><div><br>We can give it whatever name is most useful.<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="gmail_quote"><div></div><div>Also, while before it was clear that module.SOMETHING was referring to a constant, now I that I make a dir() of a module and see "Something"  instead of "SOMETHING", the first thing which comes to my mind is that "Something" is a class, not a container of some constants.</div>
</div></blockquote><div><br>Something would be a class. SOMETHING would still exist and should behave as expected. "Something" should in fact have a name that *does* tell you what it does. "Constants" for example gives you a good clue.<br>
<br>Michael<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="gmail_quote">
<div><br></div><div>Regards,</div><div class="im"><div>
<br></div><div>--- Giampaolo</div><div><a href="http://code.google.com/p/psutil/downloads/list" target="_blank">http://code.google.com/p/pyftpdlib/</a></div><div><a href="http://code.google.com/p/psutil/downloads/list" target="_blank">http://code.google.com/p/psutil/</a></div>

</div></div>
</blockquote></div><br><br clear="all"><br>-- <br><pre cols="72"><a href="http://www.voidspace.org.uk/" target="_blank">http://www.voidspace.org.uk/</a><br><br>May you do good and not evil<br>May you find forgiveness for yourself and forgive others<br>
May you share freely, never taking more than you give.<br>-- the sqlite blessing <a href="http://www.sqlite.org/different.html" target="_blank">http://www.sqlite.org/different.html</a></pre>
<br>