[pygccxml-development] need help with query
Brought to you by:
mbaas,
roman_yakovenko
|
From: Roman Y. <rom...@gm...> - 2006-03-15 06:12:07
|
I saw Matthias filters ( Or, Not and And ) and liked the idea. But (
there is always some 'but' :-( ).
I don't think they are useful in the form like this. People are to
lazy to learn. So instead
of composing queries using Matthias classes, they will right small
lambda function that will
do the job. May be I wrong, may be not. I propose an other
implementation. Take a look on attached file. Right now it does not
work. This is the area I need help. Can you see what I am doing wrong?
Lets say I have query class, that has __call__ method, that takes 1
argument - some text
qa =3D query_t( 'a' ) #returns true if 'a' in text
qb =3D query_t( 'b' ) #returns true if 'b' in text
qab =3D qa and qb
print 'a and b in text ac?', qab( 'ac' ) #False
print 'a and b in text ab?',qab( 'ab' ) #True
qaqb =3D qa or qb
print 'a or b in text a', qaqb('a') #True
print 'a or b in text b', qaqb('b')#True
print 'a or b in text c', qaqb('c')#False
Do you like such approach? Matthias what do you think?
Thanks for help.
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
|