Sujet : Re: New VSI post on Youtube
De : arne (at) *nospam* vajhoej.dk (Arne Vajhøj)
Groupes : comp.os.vmsDate : 26. Aug 2024, 01:40:48
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vagiuf$255ve$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
User-Agent : Mozilla Thunderbird
On 8/25/2024 7:37 PM, Lawrence D'Oliveiro wrote:
On Sun, 25 Aug 2024 10:22:27 -0400, Arne Vajhøj wrote:
Python modules are not exactly like packages/namespaces, but OK close.
Python does have package namespaces. You can do longwinded Java-style
hierarchies, if you want. It’s just not common.
Python modules does way more than C++/C#/VB.NET namespaces and Java packages.
The latter are a pure name thing. And the using/imports/import
is a name abbreviation only thing.
VB.NET:
Imports x
is not the equivalent of Python:
import x
It is (mostly) the equivalent to the difference between:
import x
and:
from x import *
.NET assemblies and Java jars/Java 9 modules/OSGI modules provide
some of the extra functionality that Python modules has over
pure namespaces.
I guess there are two approaches to naming:
>
shorter is better -> less typing and smaller files
There is another useful approach, and that is
import «long-winded-name» as «short-name»
Python supports this, too.
Java, which needs it more, doesn’t.
Lot of languages support that feature.
C++, C#, VB.NET, Kotlin, Groovy, Scala etc..
But Java does not.
Arne