Re: Calling constructor but not initializer

2007-09-21 Thread Steven D'Aprano
On Fri, 21 Sep 2007 10:47:02 -0400, Steve Holden wrote: [snippity-doo-dah] >> but of course __init__ is automatically called. >> >> >> Any suggestions for doing something like this? >> >> > Easy: use a method whose name is something other than __init__, then > don't bother to implement __init

Re: Calling constructor but not initializer

2007-09-21 Thread Hrvoje Niksic
Steven D'Aprano <[EMAIL PROTECTED]> writes: > I can construct an empty instance in the __new__ constructor, and I > can initialize an non-empty instance in the __init__ initializer, > but I can't think of any good way to stop __init__ from being called > if the instance is empty. In pseudo-code, I

Re: Calling constructor but not initializer

2007-09-21 Thread Steve Holden
Steven D'Aprano wrote: > I have a class that has a distinct "empty" state. In the empty state, it > shouldn't have any data attributes, but it should still have methods. > > The analogy is with a list: an empty list still has methods like append() > etc. but it has no "data", if by data you mean