title: Unresolved reference in class method
body: <p>I don't think it is because of the scope of the function, but I get a </p>
  
  <blockquote>
    <p>Unresolved reference at get_all_predicates(examples).count(predicate_list[0]) </p>
  </blockquote>
  
  <p>inside <code>get_entropy_of_attributes(examples, predicate_list)</code> function in my class <code>Tree</code>:</p>
  
  <pre><code>class Tree:
  
      def get_examples(examples, attributes):
          for value in examples:
              yield dict(zip(attributes, value.strip().replace(" ", "").split(',')))
  
      def get_all_predicates(examples):
          return [d['Predicate'] for d in examples]
  
      def get_entropy_of_attributes(examples, predicate_list):
          get_all_predicates(examples).count(predicate_list[0])
          return 0
  
      examples = list(get_examples(all_examples, name_of_attributes))
  
      predicate_list = list(set(get_all_predicates(examples)))
  
      get_entropy_of_attributes(examples, predicate_list)
  </code></pre>
  
  <p><code>all_examples</code> is a list of dictionary and <code>name_of_attributes</code> is a list, that holds values imported from a text file.</p>
  
  <pre><code>all_examples = [{'P_Length': '1.4', 'P_Width': '0.2', 'Predicate': 'I-setosa', 'Sepal_Width': '3.5', 'S_Length': '5.1'}, ...]
  
  name_of_attributes = ["Check","P-Width"]
  </code></pre>
  
  <p>Any help?</p>