3 ms·
For the most EXTREME algorithmic compression of information to number of lines in Python (with few to 0 intermediate values stored), I've found it hard to beat
by davidhollander 16y ago
For the most EXTREME algorithmic compression of information to number of lines in Python (with few to 0 intermediate values stored), I've found it hard to beat using nested function definitions with abstracted shared logic called by running the vars() builtin as the parameter list. Basically ship the current scope elsewhere to finish processing to ensure no logic is repeated.
I tend to not use separate URL mappers in controllers but have nested functions that define both logic and layout simultaneously. (Basically a tree structure of function definitions where the ending subpage elements are leaf nodes, and nodes render wrapper base templates on post traversal unless it was an ajax request). I can post some code if this doesn't make sense. Obviously not defining new variables nor using classes is extremely unpythonic and could pose difficulties for group work... minimum number of lines while fun isn't everything!