"""editsequence.py -- an edit() module for Python sequences""" from types import * def canedit(data): "Return 5 (on a scale of 1-10) if data is a list or tuple; \ return 2 if it's an object with sequence operators." t = type(data) if t == ListType or t==TupleType: return 5 if t == InstanceType: for op in ['__len__','__getitem__','__setitem__','__delitem__']: if not hasattr(data,op): return 0 return 2 return 0 def edit(data, returndata=0): print "Not yet implemented!" return data