示例#1
0
 def dereference(self, w_string):
     """
     Switches object strategy from reference one to general one
     """
     new_storage = ['\x00'] * self.len(w_string)
     self.write_into_list(w_string, new_storage, 0)
     strategy = get_string_strategy(MutableStringStrategy)
     w_string.storage = strategy.erase(new_storage)
     w_string.strategy = strategy
示例#2
0
文件: string.py 项目: parastoo-62/pie
 def __init__(self, strval):
     from pie.objects.strategy.general import ConstantStringStrategy
     strategy = get_string_strategy(ConstantStringStrategy)
     self.storage = strategy.erase(strval)
     self.strategy = strategy
     self.copies = None
示例#3
0
 def make_mutable(self, w_string):
     new_strategy = get_string_strategy(MutableStringStrategy)
     w_string.strategy = new_strategy
     w_string.storage = new_strategy.erase(
         [c for c in self.unerase(w_string.storage)]
     )