[Tutor] Another Class question.

SA sarmstrong13@mac.com
Wed, 14 Aug 2002 17:44:52 -0500


Hi Everyone-

While we are the subject of classes, here is one more question for you (at
least I hope it is one more...):

If I have the following class-

Class Fud:
    def __init__(self, text)
        self.text = text    # does this create an instance?
    def search(self, start, end):
        tags = r'''%s.+%s''' % (start, end)
    def extract(self):
        self.text = re.findall(tags, self.text)

First off, is this written correctly? If not where did I goof? Secondly,
tags in the extract funtion should be the same as the final tags in the
search function. So should I be using tags, self.tags, or search.tags in the
extract function in order to pass along the correct value to that function?
So my main question deals with namespace defining in this class.

By the way I purposefully broke this class down into three functions. I know
I could have done it in two, but I wanted three to give an example of the
namespace question.

Thanks in advance.

SA

-- 
"I can do everything on my Mac I used to on my PC. Plus a lot more ..."
-Me