object.enable() anti-pattern

Serhiy Storchaka storchaka at gmail.com
Fri May 10 11:44:35 EDT 2013


10.05.13 15:19, Robert Kern написав(ла):
> I'd be curious to see in-the-wild instances of the anti-pattern that you
> are talking about, then.

Many (if not most) GUI frameworks use this pattern.

     button = Button("text")
     button.setForegroundColor(...)
     button.setBackgoundColor(...)
     button.setFont(...)
     button.setRelief(...)
     button.setBorder(...)
     button.setWidth(...)
     button.setAction(...)
     button.setMouseListener(...)
     button.place(...)

Another example is running a subprocess in Unix-like systems.

     fork()
     open/close file descriptors, set limits, etc
     exec*()





More information about the Python-list mailing list