title: How to define additional methods when implementing __new__
body: <p>In this example, the user has to deal with two file types (.txt and .csv). However, the used does not want to bother checking the file type and consequently instance the dedicated class. Instead, the user crated an instance of FileTypeFactory using <code>__new__</code> and the appropriate type will be instanced and returned. However, I don't see how to add new methods to the factory without occurring in <code>AttributeError</code> </p>
  
  <pre><code>class TXT:
      def is_valid(self):
          return False
  
  class CSV:
      def is_valid(self):
          return True
  
  class FileTypeFactory:
      def __new__(cls):
          for FileType in [TXT, CSV]:
              file_type = FileType()
              if file_type.is_valid():
                  return file_type
  
      def factory_method(self):
          print('Running factory_method')
  
  
  c = Factory()
  c.__class__.__name__
  # Returns: 'CSV'
  c.factory_method()
  # Returns: AttributeError: 'CSV' object has no attribute 'factory_method'
  </code></pre>