[PATCH] ms_schema: fix python2.6 incompatibility

Bjoern Baumbach bb at sernet.de
Thu Mar 15 22:20:18 UTC 2018


On 03/15/2018 09:23 PM, Douglas Bagnall wrote:
>> -    entry = header + [x for x in entry if x[0].lower() not in {'dn', 'changetype', 'objectcategory'}]
>> +    entry = header + [x for x in entry if x[0].lower() not in set(['dn', 'changetype', 'objectcategory'])]
>>  
> In this case with three members it would be more efficient and 
> line-length-compliant to just use a list or tuple:
> 
> +    entry = header + [x for x in entry if x[0].lower() not in ('dn', 'changetype', 'objectcategory')]

I don't know what is the right way. I've googled that and have read that
a set() might be faster. Any details are unknown to me.
According to my tests with {} means a 'set', so i've translated the
changes to set(), as seen on many other places in the samba code.
Without google'ing the other options, I would just replace the {} with
[]. But I think this is a challenge for a real python user, who knows
what he is doing.

There are also suggested patch attached to the bug report by Alexey
Vekshin. Please let me know what the correct fix is (and maybe why).

Best regards,
Björn

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.d



More information about the samba-technical mailing list