def __init__(self, partition_lengths, delimiter=None, *args, **kw): if isinstance(partition_lengths, (int, long)): partition_lengths = [partition_lengths] if not delimiter: delimiter = '' self.format = self.assembly_formatstring(partition_lengths, delimiter) self.regex = self.assembly_regex(partition_lengths, delimiter) self.partition_lengths, self.delimiter = partition_lengths, delimiter Regex.__init__(self, *args, **kw)
def __init__(self, partition_lengths, delimiter = None, *args, **kw): if type(partition_lengths) == type(1): partition_lengths = [partition_lengths] if not delimiter: delimiter = '' self.format = self.assembly_formatstring(partition_lengths, delimiter) self.regex = self.assembly_regex(partition_lengths, delimiter) (self.partition_lengths, self.delimiter) = (partition_lengths, delimiter) Regex.__init__(self, *args, **kw)