From fc00e0941b34d8d789ac0ea8750c6486cdb463f1 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Fri, 18 Jan 2008 19:16:36 -0700 Subject: [PATCH] Initializers for GapStrings --- gapstr.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gapstr.py b/gapstr.py index 94fdd29..a276b74 100755 --- a/gapstr.py +++ b/gapstr.py @@ -10,10 +10,12 @@ import __init__ import sys class GapString: - def __init__(self, drop='?'): + def __init__(self, init=None, drop='?'): self.contents = [] self.length = 0 self.drop = drop + if init: + self.append(init) def __len__(self): return self.length @@ -58,7 +60,7 @@ class GapString: end = min(self.length, end) start = min(self.length, start) - new = self.__class__(self.drop) + new = self.__class__(drop=self.drop) new.contents = self.contents[:] new.length = end - start if new.length == 0: