Re: [pygccxml-development] need help with query
Brought to you by:
mbaas,
roman_yakovenko
From: Roman Y. <rom...@gm...> - 2006-03-15 09:40:15
|
On 3/15/06, Matthias Baas <ba...@ir...> wrote: > Roman Yakovenko wrote: > > 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 > > [...] > > qaqb =3D qa or qb > > The above lines should read: > > qab =3D qa & qb > ... > qaqb =3D qa | qb > > "and", "or" is not the same as the &,| operators. > > > Do you like such approach? Matthias what do you think? > > I don't understand what problem you want to solve. Your query class just > does the same than my filters, but above you say that this is too > difficult to learn...? So in what respect is query_t easier to use than > my filters? By the way, I could be wrong. I just want a discuss this a little. OrFilter and AndFilter takes as argument list of filters right. I think that in most case an user does not have more then 2 or 3 filters. I could be wrong. So I think, user will not use next code f1 =3D filter(....) f2 =3D filter(...) mb =3D module_builder_t(...) mb.classes( OrFilter( [f1,f2] ) ) but rather: mb.classes( lambda decl: f1(decl) or f2(decl) ) I could be wrong, but in this case he will not learn OrFilter. If we implement your idea in a different way, then user can write next line mb.classes( f1 | f2 ) > - Matthias - I hope, I was clear. I do like your idea, but I think it should be improved a little. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |