def __new__(cls, *args, **hints): if not len(args) in [1, 2]: raise ValueError('1 or 2 parameters expected, got %s' % args) if len(args) == 1: args = (args[0], Integer(1)) if len(args) == 2: args = (args[0], Integer(args[1])) return Operator.__new__(cls, *args)
def __new__(cls, *args, **hints): if not len(args) in [3, 4]: raise ValueError('3 or 4 parameters expected, got %s' % args) if str(args[2]) not in ['discrete', 'continuous']: print("discrete or continuous: %s" % args[2]) raise ValueError('The third argument should be "discrete" or "continuous", got %s' % args) if len(args) == 3: args = (args[0], args[1], str(args[2]), Integer(1)) if len(args) == 4: args = (args[0], args[1], str(args[2]), Integer(args[3])) return Operator.__new__(cls, *args)
def __new__(cls, *args, **hints): if not len(args) in [3, 4]: raise ValueError('3 or 4 parameters expected, got %s' % args) if str(args[2]) not in ['discrete', 'continuous']: print("discrete or continuous: %s" % args[2]) raise ValueError( 'The third argument should be "discrete" or "continuous", got %s' % args) if len(args) == 3: args = (args[0], args[1], str(args[2]), Integer(1)) if len(args) == 4: args = (args[0], args[1], str(args[2]), Integer(args[3])) return Operator.__new__(cls, *args)
def __new__(cls, *args, **hints): return Operator.__new__(cls, *args, **hints)