Namespaces are one honking great idea

jmp jeanmichel at sequans.com
Mon Jul 4 11:58:30 EDT 2016


On 07/04/2016 01:37 PM, Chris Angelico wrote:
> On Mon, Jul 4, 2016 at 9:23 PM, jmp <jeanmichel at sequans.com> wrote:
>> 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.
>
> Functions within the namespace can't call other functions within the
> same namespace using unqualified names. This was a stated requirement.
>
> ChrisA
>

Ho, I missed that one.

But if it's the only missing requirement, wouldn't be like stating that 
python instances are not instances because methods cannot call other 
methods without "self."ed qualified name ? We like explicit qualified 
stuff in python right ? ("explicit is better than implicit")

jm






More information about the Python-list mailing list