[Freeipa-devel] [freeipa PR#681][comment] Fix ipadiscovery

tiran freeipa-github-notification at redhat.com
Mon Apr 3 04:14:16 UTC 2017


  URL: https://github.com/freeipa/freeipa/pull/681
Title: #681: Fix ipadiscovery

tiran commented:
"""
You can simplify your code a lot with the operator module and sorted(key) trick:

https://docs.python.org/3/library/operator.html#operator.attrgetter
https://docs.python.org/3/library/functions.html#sorted

```
import operator
```

```
answers = resolver.query(qname, rdatatype.SRV)
answers = sorted(answer, key=operator.attrgetter('priority'))
```

Please squash your changes into one commit.
"""

See the full comment at https://github.com/freeipa/freeipa/pull/681#issuecomment-291045102


More information about the Freeipa-devel mailing list