On 01/07/2011 11:59 AM, Jakub Hrozek wrote:
On 01/07/2011 05:28 PM, Adam Young wrote:
I'm Not a pythonista. What is this line doing?


On 01/07/2011 10:58 AM, Jakub Hrozek wrote:
+ nameserver = nameserver[-1] == '.' and nameserver or nameserver + '.'


This construct is called the 'and-or trick' and somewhat resembles ternary operator (which was added to python in 2.7 IIRC, so I'm not sure if it's old enough to use) from C and other languages. See http://diveintopython.org/power_of_introspection/and_or.html#d0e9975 for details.

But yeah, a simple if would be more readable. A new patch is attached, thanks for bringing it up.


_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel
ACK
_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to