On 05/04/2015 02:13 PM, Nikolai Kondrashov wrote:
On 04/29/2015 05:58 PM, Michal Židek wrote:On 04/29/2015 12:23 PM, Nikolai Kondrashov wrote:On 04/28/2015 05:49 PM, Michal Židek wrote:On 04/27/2015 05:56 PM, Nikolai Kondrashov wrote:On 04/24/2015 01:44 PM, Nikolai Kondrashov wrote:I understand your motivation to keep the interface accessible and safe, and I'm willing to implement it your way, if this message doesn't change your mind.May I suggest another solution, which might make it more palatable? What if we replace lists/tuples with functions or class constructors, which would annotate what's happening? So, instead of writing this rather unusual, but illustrative example: pattern = ( {name='group1', gid=1001, mem=['userA', 'userB', 'userC']}, {name='group2', gid=1002, mem=('userX', 'userY')}, ) ent.group_assert(pattern) You would write something like this: pattern = ent.some( {name='group1', gid=1001, mem=ent.all('userA', 'userB', 'userC')}, {name='group2', gid=1002, mem=ent.some('userX', 'userY')} ) ent.group_assert(pattern) Theoretically, we can also make a distinction of matching some/all of dictionary members, but I don't see that as useful ATM.This does not look bad to me. Please add example of usage to the docstring of the "all" and "some" functions. So that it is clear where and how the functions are to be used. Also add reference to these functions to the diff function, so that they are linked both ways (something along the line "use this and that to create the list or tuple and do not craft it manually"... of course better wording is advised :) ) Also I would rename the "some" to "contains" and "all" to "contains_only". The "some" word misleads the reader a little in the way that "some of the listed users must match, but not all", which is not the case. The "all" can mislead the reader in the way "all these members must match, but we do not care if there are some others", which is also not how it works.Alright. Do you mind if I replace "contains" with the shorter "has"? I.e. make that "has" and "has_only"?
"has" and "has_only" is also good IMO. Michal _______________________________________________ sssd-devel mailing list sssd-devel@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/sssd-devel