title: Is it a bad programing practice to put a function inside a class method?
body: <p>I'm looking at a case like this:</p>
  
  <pre><code>def parse_item(self, response):
  
      item = MetrocItem()
  
      def ver(string):
          if string:
              return string
          else:
              return 'null'
  
      item['latitude'] = ver(response.xpath('//input[@id="latitude"]/@value').extract_first())
  </code></pre>
  
  <p>It works, but is there a better way to do this?</p>