def __new__(cls, cartantype): """Create a new RootSystem object This method assigns an attribute called cartan_type to each instance of a RootSystem object. When an instance of RootSystem is called, it needs an argument, which should be an instance of a simple Lie algebra. We then take the CartanType of this argument and set it as the cartan_type attribute of the RootSystem instance. """ obj = Atom.__new__(cls) obj.cartan_type = CartanType(cartantype) return obj
def __new__(cls, cartantype): obj = Atom.__new__(cls) obj.cartan_type = CartanType(cartantype) return obj
def __new__(cls, function): if not callable(function): raise TypeError('Callable expected, got: %r' % function) obj = Atom.__new__(cls) obj.function = function return obj