Definite or indefinite article for non-singletons?

DL Neil PythonList at DancesWithMice.info
Sat Jul 27 18:34:29 EDT 2019


On 28/07/19 9:10 AM, Chris Angelico wrote:
> When talking about indistinguishable objects, is it correct to talk
> about "the <x>" or "an <x>"?
> Example:
> def f(s):
>      """Frob a thing.
>      If s is an empty string, frobs all the things.
>      OR
>      If s is the empty string, frobs all the things.
>      """
> It's entirely possible that a Python implementation will optimize
> small strings and thus have exactly one empty string, but it's also
> entirely possible to have multiple indistinguishable empty strings.
> Grammatically, is it better to think of empty strings as an entire
> category of object, and you were passed one from that category ("an
> empty string"), or to think of zero-length instances of 'str' as being
> implementation details referring to the one and only Platonic "empty
> string"?
> Does it make a difference to usage if the object is mutable? For
> instance, would you say "the empty string" but "an empty set"?


Python:

Immutable:
 >>> NULSTRING = ""
 >>> A_NULSTRING = ""
 >>> THE_NULSTRING = ""
 >>> id( NULSTRING )
139654031453296
 >>> id( A_NULSTRING )
139654031453296		<<< it's all the same, to me!
 >>> id( THE_NULSTRING )
139654031453296		<<< they're all the same, to me?

Mutable:
 >>> ONE = 1
 >>> A_ONE = 1
 >>> THE_ONE = 1
 >>> id( ONE )
139654256829664
 >>> id( A_ONE )
139654256829664		<<< likewise
 >>> id( THE_ONE )
139654256829664

 >>> ONE = 1 + 1
 >>> id( ONE )
139654256829696		<<< as you'd expect
 >>> id( A_ONE )
139654256829664
 >>> id( THE_ONE)
139654256829664

 >>> ONE = 1
 >>> id(ONE)
139654256829664		<<< did you expect this?

There is only a/the ONE way.
Disclaimer: I am not Dutch!


English:

Whilst the formalities of English grammar distinguish the specific 
("the") from the general case ("a" or "an"), eg "the Python language" cf 
"a programming language". Spoken or colloquial English can be quite 
different from academically-correct text - and in this case is!
(he says dangling a participle to demonstrate)

Whereas the indefinite article can only be used in the singular, the 
definite article may be used as both singular and plural.

	A NULSTRING
	THE ONESIE
	THE ONESIES

(a choice of 'article' which will enrage both grammarians and 
fashionistas, in equal measure!*)
* oops, did you notice that it is "measure" and not "measures"?


If you were verbally suggesting an API to someone else, eg

	class API(): def __init__( self, path="" ): ...

Would you use either the definite or indefinite article?

Trick question!

The unequivocal answer is: "neither"! We would say "default id to 
NULSTRING".
(similarly: "default [int value] to ONE")


When you advise this other person, and when (s)he writes such code, do 
any of us care whether all NULSTRING-s have the same id() or not? When 
speaking, not! When typing, not!
(and I venture to suggest, there'd be very few occasions when someone, 
suffering tight memory constraint*, went through counting NULSTRING-s 
seeking re-factor potential!)

PS should that be "constraint" because there's only one, ie "memory"; or 
"constraints"?


English is a ghastly language to learn because of its many irregular 
forms. The issue here is less about the preceding article, and more 
about the noun, ie NULSTRING, ONE, etc.

Some nouns are positively confusing, eg "jeans". How many pairs of 
trousers/pants are there? (and then there is the same problem with the 
word "trousers", or if you prefer "pants"!) Few people wear more than 
one - at the same time. Yet we still say "jeans" as if the two legs are 
not somehow part of the single item.

Other nouns are written as if plural but are only used in the singular, 
eg maths. If you only attend the one course, how many maths courses do 
you attend? Did you really think mathematics a precise science? (or 
should that have been "precise sciences"?)
NB American English (English people reel in 'shock, horror') appears 
more correct in preferring the term "math" - but before anyone becomes 
too cocky, try "physics"!

Thus George Bernard Shaw's claim that the two nations are "divided by 
the use of a common language", and the virtue of non-native speakers 
learning "Globish" or similar.


To really confuse language-learners, we only need to add "collective 
nouns", eg "team" - they're enough to make one feel sheep-ish. (Ho ho!) 
Oh look, we're back to the question: is it "a team" or "the team"?


Aren't most of us happy with the article-free wording?

We should be concerned for "ONE" because as Harry Nilsson said, it is 
"the loneliest number"!

I'll become concerned for you, should you start to look too closely at 
the concept of a NULSTRING (None, "infinite", ...). If you look into it 
too deeply, you will realised that you are standing on the edge of an 
abyss, and the roaring noise in your ears/an ear/the ears comes from the 
black hole, which is about to swallow you up, never to return* to us again!
(*from an/the institution caring for the mentally-ill)...


Yours sincerely, undoubtedly off-balance, but nevertheless well articulated.
-- 
Regards =dn



More information about the Python-list mailing list