constants in Python: at the root of the module or in a namespace inside the module?
<p>I'm building a Python module with about a hundred of constants.</p>

<p>I would like to avoid naming issues when people import my module so I was wondering what is the best way to do it.</p>

<pre><code>MY_CONSTANT = 1
MY_SECOND_CONSTANT = 2
...
MY2_CONSTANT = "a"
MY2_SECOND_CONSTANT = "b"
...
</code></pre>

<p>Or</p>

<pre><code>class My:
  CONSTANT = 1
  SECOND_CONSTANT = 2
  ...

class My2
  CONSTANT = "a"
  SECOND_CONSTANT = "b"
  ...
</code></pre>

<p>Or maybe another of your suggestion?</p>

<p>Coming from Java, I surely prefer the second way, but some might find it overkill...</p>
