title: Python Code wont Run giving unnecessary TypeError, not sure why?
body: <p>I'm learning python and finally got around to playing with factories. The code below is giving me the following error and I don't know why.</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\py_Lab\Factory.py", line 38, in &lt;module&gt;
      print(MyFactory("Ham").x)
    File "C:\py_Lab\Factory.py", line 30, in MyFactory
      if cls.Check(myStr):
  TypeError: Check() missing 1 required positional argument: 'myStr'
  </code></pre>
  
  <p>The factory definition is suppose to loop through the sub-classes of the base classes and use the <code>Check()</code> definition in the sub-classes to choose which class to run. I'm pretty sure the parameter <code>'myStr'</code> is where it should be, and I have placed an argument in the instance of the factory. Is this error due to the way python compiles or something? I'm running <code>python 3.5</code> on a <code>Windows 8</code> pc.</p>
  
  <pre><code>class BaseClass(object):
      pass
  
  class AltBaseClass(object):
      pass
  
  class C1(BaseClass, AltBaseClass):
      def __init__(self, *args, **kwargs):
          self.x = 1
      def Check(self, myStr, *args, **kwargs):
          return myStr == "Ham"
  
  class C2(BaseClass, AltBaseClass):
      def __init__(self, *args, **kwargs):
          self.x = 30
      def Check(self, myStr, *args, **kwargs):
          return myStr == "Sandwich"
  
  class C3(BaseClass, AltBaseClass):
      def __init__(self, *args, **kwargs):
          self.x = 70
      def Check(self, myStr, *args, **kwargs):
          return myStr == "Pancake"
  
  def MyFactory(myStr):
      for cls in BaseClass.__subclasses__():
          if cls.Check(myStr):
              return cls()
  
  def OthrFactory(myStr):
      for cls in AltBaseClass.__subclasses__():
          if cls.Check(myStr):
              return cls()
  
  print(MyFactory("Ham").x)
  print(OthrFactory("Sandwich").x)
  print(OthrFactory("Pancake").x)
  </code></pre>