[Tutor] Subclasses?

Gonçalo Rodrigues op73418@mail.telepac.pt
Mon Dec 30 07:42:16 2002


----- Original Message -----
From: "Dick Kniep" <d.j.kniep@chello.nl>
To: <tutor@python.org>
Sent: Monday, December 30, 2002 12:32 AM
Subject: [Tutor] Subclasses?


> Hi there,
>
> Perhaps a silly question,  but I can't seem to find an answer in the
> manuals.
>
> If you look at the code of SQLDict (which is a superb piece of work by
> the way), I noticed there were class definitions defined WITHIN another
> class. I just don't understand what is achieved by that.

I don't know the code in question, but answering in broad terms: Not much,
really, since it doesn't buy you anything special. It is mainly a way to
organize the code and bundle up classes that the author thought should be
bundled together. Python is not Java, where classes within classes *really*
are important. I remember reading recently a thread at python-dev where
Guido van Rossum asked for a real use-case for inner classes. After a while
W. Dorwald seemed to have found one since it got a "really cool!" from the
BDFL.

>
> thanks in advance
>
> --
> Dick Kniep <d.j.kniep@chello.nl>
> Lindix

With my best regards,
G. Rodrigues