mutually exclusive arguments to a constructor

Adam Funk a24061 at ducksburg.com
Sat Dec 31 15:59:17 EST 2011


On 2011-12-30, Roy Smith wrote:

> "But!", some C++/Java type bondage addicts might cry, "there's nothing 
> to prevent somebody from creating a DirectionIndicatingThingie directly, 
> bypassing the factory functions.  There's no way to make the constructor 
> private!".  To which the free-willed pythonistas would respond, "If it 
> hurts when you do that, don't do that".

Actually one problem that can occur in large Java projects is that the
package structure requires some things to have public constructors
(even when you'd rather not do that) so the Factory class in the main
package has access to them.


-- 
English has perfect phonetic spelling. It just doesn't have phonetic
pronunciation.                                        [Peter Moylan]



More information about the Python-list mailing list