Ed Leafe wrote: > On Jun 11, 2008, at 3:20 PM, Nate Lowrie wrote: > >> def _getShowColumnLabels(self): >> - return self._showColumnLabels >> + if hasattr(self, "_showColumnLabels"): >> + v = self._showColumnLabels >> + else: >> + v = self._showColumnLabels = True >> + return v > > This construction is to be avoided. It is best to either: a) > initialize the underlying attribute in the __init__() method, or b) > use a try/except. This should only fail once and could possibly be > called unlimited times, and hasattr() tests add up.
hasattr() would only be called the first time. self._showColumnLabels is initialized in the else clause. Paul _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev Searchable Archives: http://leafe.com/archives/search/dabo-dev This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]
