On Fri, 2012-06-08 at 10:56 -0400, John Dennis wrote:
> I frequently see this idiom in the code in plugins and pre/post callbacks:
> keys[-1]
> My understanding is that keys in the positional parameter list of the 
> command, correct?


> keys always appears in a formal parameter list with the parameter 
> "options", which I believe are the keyword arguments of the command 
> (i.e. *args, **kwds)
> Thus keys[-1] would be the last positional parameter. What is special 
> about it such that one can always reference the last positional 
> parameter? (or have I misunderstood, if so please elucidate).

I am a bit lost here. As you correctly stated, keys contains the
positional parameters. Each keys value should uniquely point to one LDAP
entry represented by LDAPObject class. We use keys[-1] for a case when
LDAPObjects are nested and keys list holds more than one value and thus
keys[0] would not work. For example keys list for DNS record could hold
('example.com', 'ipa').

> If keys is the positional parameter list (e.g. *args) why is is called 
> "keys"? That seems really confusing because keys usually has an entirely 
> different meaning (i.e. keys of a dict). Why isn't it named "args"?

Maybe Rob will know why we started calling it keys, I think it is not a
total non-sense, after all it holds primary _key_ values for referred


Freeipa-devel mailing list

Reply via email to