Jean-Michel Pichavant writes: > If you like one-liners, > > def __init__(self, center=(0,0), radius=10, mass=None): > self.center = center > self.radius = radius > self.mass = (mass is None and radius**2) or mass
That's not a one-liner. That's a one-liner: def __init__(self, center=(0,0), radius=10, mass=None): self.center = center ; self.radius = radius ; self.mass = (mass is None and radius**2) or mass And as others point out, you could highlight the number of sub-expressions better by using an actual three-place expression. (Why _that_ is considered so salient, I don't know. But it is.) </deadpan> -- https://mail.python.org/mailman/listinfo/python-list