[Freeipa-devel] DN patch and documentation

John Dennis jdennis at redhat.com
Thu Jul 26 20:11:02 UTC 2012


On 07/17/2012 06:47 PM, John Dennis wrote:
>> ipapython/dn.py:
>>        in docstring:  DN(arg0, ..., locked=False, first_key_match=True)
>>        followed by:  def __init__(self, *args, **kwds):
>>        and:  kwds.get('first_key_match', True)
>>
>> I don't see the reason for this. Just write `def __init__(self, *args,
>> locked=False, first_key_match=True)` and put a proper summary in the
>> first line of the docstring. Same in AVA & RDN.
>
> A valid point. I think I was trying to be too flexible/extensible.

Sorry, I was unable to make the suggested change. I tried and it 
refreshed my memory as to why it was coded the way it was.

Python considers it a syntax error if keyword arguments follow an arg 
list reference. e.g.

 >>> def foo(*args, bar=None):
   File "<stdin>", line 1
     def foo(*args, bar=None):
                      ^
SyntaxError: invalid syntax

I'm not sure why, but that's why the methods are coded as

def foo(*args, **kwds):

If you have a suggestion as to how to use named parameters in this 
context let me know or maybe explain why it's an illegal construct (I'm 
sure it's in the language reference documentation somewhere, I just 
didn't take the time to research it).

-- 
John Dennis <jdennis at redhat.com>

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/




More information about the Freeipa-devel mailing list