On Tuesday, February 20, 2018 at 2:18:31 PM UTC-6, MRAB wrote: > 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.
*AHEM* At the risk of being labeled a "quibbler" (which, in the grander scheme is not really all that bad considering some of the names that have been attributed to me), i must say your advice is only "sound advice" in cases where the age will not be queried frequently. For instance, if the age is queried many times a second, it would be a much wiser design to set-up an event that will advance the age at the end of the last second of every year, instead of doing the age calculation many times a second. Heck, even if the frequency is multiple time a day, a valid argument could be made. Of course. Outside of buggy loop that, much to the chagrin of the code monkey who wrote it waxes infinite, i cannot image many scenarios in which someone's age would be queried many times a second. But hey, this is Python-list after all. And i wouldn't be a true pal i didn't point out an implicit corner case. -- https://mail.python.org/mailman/listinfo/python-list