Użytkownik Ed Leafe napisał:
> You are describing a very lightweight situation: a boolean return value
> vs. a boolean attribute. If you're worrying about the effect of a boolean
> attribute added to an object, then your system is either already broken, or
> you prematurely optimizing.
>
>
Optimization is my second name :-)
Old, old time ago I programmed microcontrollers, where each single bit
has meaning.
> But if you really, really need to remove that attribute, it's simple:
>
> self.foo = False
> self.scan(...)
> if self.foo:
> doWhatever()
> del self.foo
It's still much more complicated than just return value:
if self.scan(...):
doWhatever()
Programming should be a pleasure.
Let's imagine you have deeply inherited class and you must create
few new attributes, without use IDE autocomplete feature.
Without look into each subsequent class definition, there is no guarantee,
that newly created attributes aren't used in any previous class.
In compiled languages like C, you are warned about such situation,
but in Python you will not receive any warning.
It's much safer to use local variables and return values, than attributes
especially if attribute is rare accessed.
You should know about it, because you didn't avoid such situations
in Dabo <-> wxPython interaction - do you remember wx.ControlWithItems
class?
--
Regards
Jacek Kałucki
_______________________________________________
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]