preventing creation of instance

Mirko Koenig koenig at v-i-t.de
Wed Jun 18 14:57:17 CEST 2003


On Wed, 18 Jun 2003 14:42:36 +0200, Peter Hansen wrote:

> Mirko Koenig wrote:
>> Is using __new__ a common way in programming python like the contructor
>> in c++ or is it seldom used ?
> 
> Perhaps the best answer is that it's *extremely* "new", no pun intended.
> It was only just added to the language, and relatively few people have
> probably tried using it, let alone figured out how to judge the best
> time to use it, and when not to.
> 
> And many of us are still programming with older versions that didn't
> have that feature.

So perhaps throwing an exception in __init__ is the better way for me?

Mirko Koenig




More information about the Python-list mailing list