3 ms·
I'd argue it's not ambiguous: current age would have to be a function of invocation time, while "age at time of writing the function" would be a constant. Expr
by bonesss 8y ago
I'd argue it's not ambiguous: current age would have to be a function of invocation time, while "age at time of writing the function" would be a constant.
Expressing "age" in whole years is acceptable in English, but using a decimal would be highly defensible. That's an issue of grading though.
- danbruc 8y agoIf we were talking about pure functions, I would certainly agree, but in Python it would of course be perfectly fine and not unusual to have an impure function implicitly depending on the current time. Obviously assuming »consume nothing« only refers to the parameters of the function, so this too could be less ambiguous.
- nothis 8y agoYea, that would have stumped me, expecting a trick/trap. What if my birthday is tomorrow? By the time my teacher checks it, it's wrong. "Your birth year" would have prevented that. This is a problem I have with certain parts of computer science and math education. Everything is encouraged to be exact, then, suddenly, variable names are used inconsistently, niche cases are ignored arbitrarily and explained with essentially referring to "common sense".
- bonesss 8y agoIsn't that more or less what happens in the real world? Software engineering is all about mapping dirty nuance to formal systems.
- nothis 8y agoBut general purpose education isn’t „the real world“. I think the opposite argument is often made to justify teaching theory when it doesn’t seem to have many real world applications.
- acbart 8y agoIt's graded immediately (automatically), so there wouldn't be any issues. Further, the text of the problem makes it clear that I'm not actually going to check their age - they can return any valid number (although it does check >0 and <100, perhaps discriminatorily). It would be a little invasive to their privacy otherwise, I think.