Hacker News new | ask | show | jobs
by andreareina 2642 days ago
The link isn't a good example, or maybe it's the exception that proves the rule. XOR/shift is a well-known technique for hashing and I wouldn't expect an experienced engineer to need to cite it, unless they copied the specific constants.

The question author is a student and thus the expectation to cite is increased, unless they independently came up with the idea.

There are no hard-and-fast rules, but the more the example is a straightforward application of unknown (or forgotten) knowledge, the more unsurprising that knowledge is, the less I feel the need to cite. To take it back to the OP's example, once you know that subtracting two datetime objects yields a timedelta object, it becomes obvious to take the result's .total_seconds() (if that's something useful to you). Conversely, my older code is littered with citations for things that are obvious and second-nature to me now but weren't at the time.