object.enable() anti-pattern

Roy Smith roy at panix.com
Fri May 10 10:54:54 EDT 2013


In article <mailman.1531.1368197225.3114.python-list at python.org>,
 Chris Angelico <rosuav at gmail.com> wrote:

> On Sat, May 11, 2013 at 12:37 AM, Roy Smith <roy at panix.com> wrote:
> > I suppose, if I had a class like this, I would write a factory function
> > which called the constructor and post-construction initializer.  And
> > then I would make the constructor protected.
> 
> That sounds like a reasonable plan, with the possible exception of
> protected. Since meeting Python, I've stopped using private and
> protected anywhere.
> 
> ChrisA

Each language has its own set of best practices.  Trying to write C++ 
code using Python patterns is as bad as trying to write Python code 
using C++ patterns.



More information about the Python-list mailing list