Classes in Python

Wiebke Pätzold wiebke.paetzold at mplusr.de
Mon Aug 4 12:30:11 CEST 2003


Hi all!

Could somebody help me with a task?

import sys
import Mk4py
import re

db = Mk4py.storage("c:\\datafile.mk",1)
vw = db.view("people")

class PatternFilter:
    def _init_(self, pattern):
        self.pattern = re.compile(pattern)

    def _call_(self, row):
        try:
            nachname = row.Nachname
        except AttributeError:
            return 0
        return self.pattern.search(nachname)is not None

vf = vw.filter(PatternFilter("Ge.*"))

for r in vf:
    print  vw[r.index].Nachname
    


I wrote this program, but it returns nothing. I can't find the error.
Can somebody help me? 
Can somebody tell me why the part:   "class PatternFilter:"  doesn't
return the expressions it should return?

Wiebke




More information about the Python-list mailing list