Tom RitchfordHow long can you chew the same stick of gum?The "Marvel Comics Universe" is old and dreadfully formulaic. Almost every movie ends with a punch-up, with an ending you could have…1d ago1d ago
Tom RitchfordCreating an is_even function that is equivalent to not x % 2 adds bulk and slows your program down…You should not write your code for complete beginners: you should be writing it for the average programmer who understands the basics.1d ago1d ago
Tom RitchfordWhy, specifically, would one wish to prohibit calling that function on some value for which it…Indeed, passing a list gives a wrong impression - that the function might want to mutate the list at some point.2d ago2d ago
Tom RitchfordGood question, to which I do not know the answer!That said, on my machine I find this difference on each Python version!2d ago2d ago
Tom RitchfordBut that isn't what's happening here in your first example.Also, your API is not good because it pretends to be functional, but it isn't: it also mutates the original object, which is a bad feature.3d ago3d ago
Tom RitchfordThe difference is honestly tiny.Also, you might want to report intermediate stats, like how many people older than 30, so the intermediate values might be useful.3d ago3d ago
Tom RitchfordA masochist?!And why, exactly, was his direct manager, the person with the most information, not involved?3d ago13d ago1
Tom RitchfordBenchmarking shows the loop comprehension is about 10% faster for large lists: try it yourself.It isn't always the case that loop comprehensions are faster, but in this case when you know the size of the input and there is no if…5d ago15d ago1
Tom RitchfordA few more events like this, and I might start believing in justice and rationality again.Jun 26Jun 26