title: making a function as an else inside an __init__
body: <p>How to get a function inside <code>if/else</code> inside an <code>__init__</code> :</p>
  
  <pre><code>class Foo(object):
      def __init__(self, q, **keywords):
          if a == "":
              print "No empty strings"
          else:
              def on_g(self, response):
                  if response.error:
                      print "Check your internet settings"
                  else:
                      self.Bar()
              http_client.fetch("http://www.google.com/", self.on_g)
  </code></pre>
  
  <p>because the program dont read the <code>on_g()</code> if i put an empty string!</p>
  
  <p>If i use the <code>on_g()</code> outside in parallel with <code>__init__()</code> i need a declared variable, for example:</p>
  
  <pre><code>class Foo(object):
      def __init__(self, q, **keywords):
          if a == "":
              print "No empty strings"
          else:
              self.on_g()
     def on_g(self):
         print 'hello there'
  </code></pre>
  
  <p>will return <code>hello there</code></p>