Simon Forman wrote: > Hey I was hoping to get your opinions on a sort of minor stylistic > point. > These two snippets of code are functionally identical. Which would you > use and why?
If self is an object (and it must have been), it would be preferrable to set self.higher and self.lower to a known value inside self.__init__ and avoid having the comparison. I'm guessing you have something like this in your __init__: def __init__(self, lower=None, higher=None): self.lower = lower self.higher = higher that should be changed to: def __init__(self, lower=None, higher=None): self.lower = lower if lower is not None else higher self.higher = higher if lower is not None else lower or whatever else-value you see is appropriate for the context. -- http://mail.python.org/mailman/listinfo/python-list