title: Pythonic way of creating a class in python 2.7.6
body: <p>I have defined a module to work with several types of data files (filetypes.py for example). In it I defined a base class to deal with file opening and some basic processing which is inherited by the remaining classes specific to each type of data file. In each of these classes I used the __init__() method to initialize some class variables and another method to read the data file that has as input the filename (this operation can not be done in the __init__() method). Something like:</p>
  
  <pre><code>class maintype(object):
      """main type class.""
      def __init__(self):
          self.a = 1
  
  class filetype1(maintype):
      """file type 1 class."""
      def __init__(self):
          self.b = 1
  
      def readfile(self, filename):
          self.ifile = open(filename, 'rb')
  </code></pre>
  
  <p>When calling this module from the main code, it feels a litle unnatural:</p>
  
  <pre><code>import filetypes
  
  data = filetypes.filetype1()
  data.readfile('some_file_name')
  </code></pre>
  
  <p>Question: wouldn't it be more pythonic to define in the module a function that returns the class instead of using the class method? Something like:</p>
  
  <pre><code>def file_type1(filename):
      class1 = filetype1()
      class1.readfile(filename)
      return class1
  </code></pre>
  
  <p>Now, it would look like:</p>
  
  <pre><code>import filetypes
  
  data = filetypes.file_type1('some_file_name')
  </code></pre>
  
  <p>I have searched the web and couldn't find any helpful indications...</p>