On 20/02/2018 20:17, MRAB wrote:
On 2018-02-20 19:17, bartc wrote:
On 20/02/2018 19:04, Dennis Lee Bieber wrote:
On Tue, 20 Feb 2018 17:11:05 +0000, "Wild, Marcel, Prof
<mw...@sun.ac.za>"
<mw...@sun.ac.za> declaimed the following:
So the special type of the values 65..90 might not allow the type be
multiplied or divided, or added to itself. Because they represent
characters A..Z. Or house numbers. Or the age of pensioners. (You'd
need to convert to ordinary integers, is that is allowed.)
Off-hand -- if you are storing the /age of pensioners/, you have an
inappropriate data model... Age being a time varying value computed as:
time_now - date_of_birth
and date_of_birth is the proper entity for storage...
If you wanted a scientifically exact value, maybe.
But someone who's 24.157094 years old now won't say their age is
24.157094 (and 24.157104 five minutes later). They will usually say they
are 24, until they are 25 (much older people prefer to round upwards,
for some reason).
So age is usually colloquially specified as an integer from 1 to around
100. Other than for young children where the lack of precision requires
the use of fractions or to switch to whole numbers of months or weeks.
The point he was making is that if you store a person's age, you'd have
to update it every year. It's far better to store the date of birth and
calculate the age on demand.
People are making too much of my example of a type consisting of a set
of special values.
Anyway the values might not relate to an individual; they could be
indices into a data structure so that C[65] gives you the number of
65-year-olds or something, or 67 is the age at which someone is entitled
to a pension.
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list