Namespaces are one honking great idea
jmp
jeanmichel at sequans.com
Mon Jul 4 07:23:17 EDT 2016
On 07/01/2016 04:13 PM, Steven D'Aprano wrote:
> But classes are not like the others: they must be instantiated before they
> can be used, and they are more than just a mere namespace grouping related
> entities. Classes support inheritance. Classes should be used for "is-a"
> relationships, not "has-a" relationships. Although classes (and instances)
> are namespaces, they provide fundamentally different kind of behaviour than
> modules and packages.
A namespace would not hurt but I really don't get why you don't consider
classes a valid and rather helpful namespace.
1/ classes do not have to be instantiated.
2/ the fact that classes are more than a namespace is not an argument.
Almost any object in python is able to do more than what you are
actually using.
3/ Classes are used as much as 'is-a' than 'has-a', class instances
*have* a state usually described by attributes
4/ "Although classes (and instances) are namespaces, ". You seem to
contradict yourself. It was probably a rhetorical construct but it's
rather confusing.
jm
More information about the Python-list
mailing list