What are new-style classes?

Terry Hancock hancock at anansispaceworks.com
Wed Aug 31 18:21:33 EDT 2005


On Wednesday 31 August 2005 12:14 pm, Reinhold Birkenfeld wrote:
> Steve Holden wrote:
> > Reinhold Birkenfeld wrote:
> >>>>My comment mostly referred to "new-style classes must be declared as a subclass of
> >>>>a new-style class", which is not true.
> >>>
> >>>Nonsense.
> >> 
> >> Given the rest of your post, I assume that this isn't meant as it sounds. Remember, I'm
> >> German, so please bear with my sense of humour. ;)

Yes, it was tongue-in-cheek.

However, there *was* some truth in what I said:

Python *does* indicate implementation details with the
"ignore the man behind the curtain" approach of marking
them with "_" or "__".

Yes, that is the only kind of encapsulation Python really
gives you -- you have to play by the rules if you want
those advantages, and one of the rules is to pretend you
don't see those magic methods.

Except when you really, really need to, of course.

Also, we have to remember that this was a *newbie* question,
so I gave a newbie-approved answer -- I told the "right"
way to do it.

And of course, there is something slightly comical about
this. But you should expect that from a language named
after a comedy troupe, shouldn't you?

The fact that I did this because I didn't know about the
other way is totally unimportant! :-P

You are such a rude man for displaying your intellectual
superiority like that. Fie!

Actually, I was thinking seriously about trying to use the
exact wording of Douglas Adams from "Hitchhiker's" (approx):
"We have normality, therefore anything you still can't cope
with is your own problem".  But it didn't quite fit, and
the other possible reference to the "Son of the Invisible
Man" skit*, was just way too obscure.  I doubt you've ever
seen it.

*I think this was in "Amazon Women on the Moon", though it
may have been "Kentucky Fried Movie".  Both are TV spoofs.

And, yes, of course, I'm glad you posted about this detail,
I learned something from it, which is why I read this list.

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com




More information about the Python-list mailing list