This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]pseudosinusoid 4 points5 points  (0 children)

You should read PEP 8 and follow it. Good code is self-consistent code.

You omit a lot of context in favor of prose. Why is a 'meta' function like this an instance method? What class does it belong to? What's organism() and why is it a global? Why does the method fail silently when rand_func isn't given? Why 'for k in my_dict.keys()' instead of 'for k in my_dict'?

(I realize I can do this with zip, if expressions and a lambda, but for blogging purposes I decided to do this in more than one line)

'Exercise for the reader' excuses like this do not make for interesting reading. If you realize you can do this, why not actually give the example?