should "self" be changed?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Jun 3 03:05:56 EDT 2015


On Wednesday 03 June 2015 03:19, Marko Rauhamaa wrote:

> Steven D'Aprano <steve at pearwood.info>:
> 
>> On Fri, 29 May 2015 12:00 pm, Steven D'Aprano wrote:
>>
>> [...]
>>> in a language where classes are
>>> themselves values, there is no reason why a class must be instantiated,
>>> particularly if you're only using a single instance of the class. Anyone
>>> ever come across a named design pattern that involves using classes
>>> directly without instantiating them?
>>> 
>>> I'm basically looking for a less inelegant term for "instanceless class"
>>> -- not so much a singleton as a zeroton.
>>
>> C# has these, and calls them static classes.
> 
> I guess Python has them, too, and calls them modules.


Modules play a similar role -- after all, modules and classes are both 
namespaces. But:

- you can't (easily) use inheritance on a module to make a new module, 
  but you can use inheritance on a class; although I think C# prohibits
  that.

- you can't (easily) include more than one module in a single file.


-- 
Steve




More information about the Python-list mailing list