3 ms·
When you use a tricky language feature to improve readability, you can just add a comment to the link some piece of documentation for that behavior. It is still
by shkkmo 7y ago
When you use a tricky language feature to improve readability, you can just add a comment to the link some piece of documentation for that behavior. It is still a trade-off, but it saves a bit of time and whenever I come across a place where past me did this, I am always appreciative.
- stinos 7y agoDepends. For obscure behavior features, ok, for 'language features' I'm probably still going to pass. Because in this example case that would come down do # See stackoverflow/highlyupvoted/wtf/does/python/do/here # This is the same as (a < b) < c. x = a < b < c whih is not clearer, not easier to parse and not faster to read and harder to maintain (leads to rot easily when variable names change) than the non-ambiguous other choice.
- shkkmo 7y agoI would have skipped that second line and just left the line with the documentation link. If you are going to provide the equivalent code in a comment, you might as well just use the equivalent code.