title: Create an instance in a class method in Python
body: <p>I am trying to create <code>DataType</code> class to reflect data types in a SQL database. Since data types require different information like <code>size</code>, <code>precision</code> etc. different parameters need to be specified when creating an instance.</p>
  
  <p>I want to be able to call it with something like <code>DataType.createVarChar(size, charSet)</code>. So far I have written the code below but I am not sure whether it is the correct way to do it since I am originally creating an object at the start without providing any information in it.</p>
  
  <p>What would be the correct design in this case?</p>
  
  <pre><code>class SQLDatatype(Enum):
      UNSUPPORTED,
      VARCHAR
  
  
  class DataType(object):
  
      def __init__(self, dataType=None, precision=None, scale=None, size=None, charSet=None):
          self.dataType = dataType
          self.precision = precision
          self.scale = scale
          self.size = size
          self.withLocalTimezone = withLocalTimezone
          self.charSet = charSet
  
      def createVarChar(self, size, charSet):
          return Datatype(dataType=SQLDataType.VARCHAR, size=size, charSet=charSet)
  </code></pre>