Are the critiques in "All the things I hate about Python" valid?

MRAB python at mrabarnett.plus.com
Tue Feb 20 15:17:55 EST 2018


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 <mwild at sun.ac.za>"
>> <mwild at 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.



More information about the Python-list mailing list