S
seafoid
Hey Guys,
I have started to read over classes as a brief respite from my parsing
problem.
When a class is defined, how does the class access the data upon which the
class should act?
Example:
class Seq:
def __init__(self, data, alphabet = Alphabet.generic_alphabet):
self.data = data
self.alphabet = alphabet
def tostring(self):
return self.data
def tomutable(self):
return MutableSeq(self.data, self.alphabet)
def count(self, item):
return len([x for x in self.data if x == item])
I know what it should do, but have no idea how to feed it the data.
Methinks I need to invest in actual computing books as learning from
biologists is hazy!
Kind regards,
Seafoid.
I have started to read over classes as a brief respite from my parsing
problem.
When a class is defined, how does the class access the data upon which the
class should act?
Example:
class Seq:
def __init__(self, data, alphabet = Alphabet.generic_alphabet):
self.data = data
self.alphabet = alphabet
def tostring(self):
return self.data
def tomutable(self):
return MutableSeq(self.data, self.alphabet)
def count(self, item):
return len([x for x in self.data if x == item])
I know what it should do, but have no idea how to feed it the data.
Methinks I need to invest in actual computing books as learning from
biologists is hazy!
Kind regards,
Seafoid.