/gist:feab6f43925ac6a05e31 Secret
Created
January 12, 2014 23:18
-
-
Save rweir/feab6f43925ac6a05e31 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# some actions to be performed on | |
actions = { 'k1' : lambda x : this.mangle(x), | |
'k2' : lambda x : x.lowercase(), | |
'k3' : lambda x : x[0] | |
} | |
for id in sorted(file.iterkeys()): | |
action = actions.get(id) | |
if action != None: | |
print action[file[id]]() | |
# input | |
file = { 'k1' : 'abc', 'k2' : 'DeF' , 'k3' : 'baz' } | |
# prints: | |
this.mangle('abc') # actually the value of this | |
def | |
b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment