comparison runes.py @ 12:ab7d6e908034

Allow cloning.
author David Barts <n5jrn@me.com>
date Fri, 27 Dec 2019 11:39:21 -0800
parents 397c178c5b98
children 6acda841a690
comparison
equal deleted inserted replaced
11:1f5e471101b0 12:ab7d6e908034
33 elif isinstance(based_on, str): 33 elif isinstance(based_on, str):
34 # A string should always be able to encode to runes. 34 # A string should always be able to encode to runes.
35 self.buffer = array.array('H', self.codec.encode(based_on, 'strict')[0]) 35 self.buffer = array.array('H', self.codec.encode(based_on, 'strict')[0])
36 elif based_on is None: 36 elif based_on is None:
37 self.buffer = array.array('H', bytes()) 37 self.buffer = array.array('H', bytes())
38 elif isinstance(based_on, Runes):
39 self.buffer = array.array('H', based_on.buffer)
38 else: 40 else:
39 self.buffer = array.array('H', based_on) 41 self.buffer = array.array('H', based_on)
40 42
41 def __str__(self): 43 def __str__(self):
42 """ 44 """