What is a class?

castironpi at gmail.com castironpi at gmail.com
Wed Mar 5 17:16:36 EST 2008


On Mar 5, 3:58 pm, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> On Wed, 05 Mar 2008 10:50:12 -0800, castironpi wrote:
> > What is a class that is not a module?
>
> Er, all of them?
>
> I'm curious what classes you think are modules.
>
> --
> Steven

Thank you for your time in entertaining my questions so far.

Functions are first-class objects.
Modules are first-class objects.
Classes are first-class objects.

There's even a ModuleType in 'types'.

>>> set( dir(type('None',(),{})) )- set( dir( ModuleType ) )
{'__module__', '__weakref__'}

How superficial are the differences?



More information about the Python-list mailing list