1 Nov 2007 05:35
[Bug 2351] Make Seq more like a string, even subclass string?
<bugzilla-daemon <at> portal.open-bio.org>
2007-11-01 04:35:13 GMT
2007-11-01 04:35:13 GMT
http://bugzilla.open-bio.org/show_bug.cgi?id=2351 ------- Comment #8 from mdehoon <at> ims.u-tokyo.ac.jp 2007-11-01 00:35 EST ------- > > 3) The sequence should be mutable, so that we won't need a separate > > MutableSeq class. This also implies that a Seq class cannot subclass from > > string, since strings are not mutable. > > Why? Python strings are not mutable, and this isn't usually a problem. > Personally, I have never needed a mutable sequence and have only ever > used them in test cases. For my research, I do need a mutable sequence. > Having the basic Seq non-mutable means we can leverage existing > string functionality and optimizations. Thinking this over, I can see one more pressing reason to keep the basic Seq immutable: If Seq is immutable, it can be used as the key in a dictionary, and as a member of a set. With a mutable Seq, neither is possible. So I guess we need to keep both a Seq and a MutableSeq class. We'll have to write a clearer explanation though in the tutorial as to why two classes are needed. > Also writing a new mutable sequence in C seems like a bit maintainance load in > the long term (and may complicate the cross platform build process). > Surely we can get good enough performance via the array of characters > route currently used? The array of characters approach allows us fast modification of sequences. On the other hand, things like taking the complement is much slower than for strings. I looked around a bit in the Python standard library and found that(Continue reading)
RSS Feed