any ways to judge whether an object is initilized or not in a class

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Tue Mar 20 17:19:26 EDT 2007


Steven D'Aprano a écrit :
> On Tue, 20 Mar 2007 10:28:10 +0100, Bruno Desthuilliers wrote:
> 
> [deploying weapons of mass snippage]

Lol !-)

> 
>>>Otherwise, the choice between old
>>>and new is not very important.
>>
>>Your opinion. Too bad you're missing some of the most powerful parts of 
>>the language.
> 
> 
> Yes, it is my opinion, and it seems that in your zeal to defend new-style
> classes against an imaginary attack, you've completely misunderstood what
> my opinion is.

Your opinion, as I understood it, is that it's not worth six extra 
keystrokes (in the worse case) to get the full power of Python's object 
model.

> I'm not against new-style classes. I do use new-style classes. 

So why do you use old-style ones too ? Seems like it would be simpler to 
stick to new-style whatever, no ?

> There are a
> whole lot of extra features that new-style classes have that old-style
> classes don't have, some of which I didn't even think of. (Thanks for
> pointing them out, and I'm not being sarcastic.)
> 
> There are plenty of reasons for preferring new style classes. If those
> reasons hold for you, then of course you should use new style classes.
> 
> But that's not the same thing as saying that you should use new style
> classes *even when you don't care about those features*.

Could we see it the other way round ? Everything you can do with 
old-style classes (except writing code compatible with more than 
six-years old python interpreters), you can do with new-styles. So why 
even wasting time asking yourself if you need these features now or will 
need them later ? Saving six extra keystrokes ? How much time do you 
need to type 'object' ? Certainly less than 1 second. And how much time 
will you spend when you'll find out that you finally need some of these 
'extra' features ?

> I never once suggested that new style classes are unnecessary, or a waste
> of time, or bad, or whatever else you seem to think I was saying. My point
> was, if you don't _need_ a new style class, there is no reason to avoid
> using an old style class. It is a purely personal choice.

My point is that there's no reason to keep on using old-style classes 
(compatibility with six-years old interpreters set aside).

> There seems to be a misunderstanding that classic classes have been
> depreciated. They certainly have not.

Not officially yet, true. But come on, it's been 6 (six) years since 
type unification, and it has always been obvious (to me at least) that 
the new object model was to replace the 'classic' one.



More information about the Python-list mailing list