title: Python Variable Declaration
body: <p>I want to clarify how variables are declared in Python.</p>
  <ol>
  <li>I have seen <a href="https://www.learnpython.org/en/Variables_and_Types" rel="nofollow noreferrer">variable declaration</a> as</li>
  </ol>
  <pre><code>class writer:
       path = &quot;&quot;
  </code></pre>
  <p>sometimes, there is no explicit declaration but just initialization using <code>__init__</code>:</p>
  <pre><code>def __init__(self, name):
      self.name = name
  </code></pre>
  <p>I understand the purpose of <code>__init__</code>, but is it advisable to declare variable in any other functions?</p>
  <ol start="2">
  <li>How can I create a variable to hold a custom type?</li>
  </ol>
  <pre><code>class writer:
      path = &quot;&quot; # string value
      customObj = ??
  </code></pre>