self.detail.id = "%s-%s" % (name, kwargs['arch']) if name else baseurl
Sure it works [1]. Hm, is that really extremely confusing? I don't find it as such at all actually.
[1] http://docs.python.org/reference/expressions.html#conditional-expressions
It might be confusing just for me, or you might not see it as the code author :) I'll describe it better just for clarity sake.
The source of my confusion is which part of the line is related to the "if" statement:
Option #1 (obviously the correct one):
self.detail.id = "%s-%s" % (name, kwargs['arch']) if name else baseurl <------------------------------>
Option #2 (my first impression):
self.detail.id = "%s-%s" % (name, kwargs['arch']) if name else baseurl <-------------------->
In this case it would crash, because '%' operator expects two arguments and receives just one (baseurl).
But you are right, option #1 is correct. Still I don't recommend to write it this way, as you see it's not that clear for everyone.