Skip to content

Instantly share code, notes, and snippets.

@lig
Created April 10, 2018 09:55
Show Gist options
  • Save lig/fd608ec8d5cbac8d5ddf04efa51a7411 to your computer and use it in GitHub Desktop.
Save lig/fd608ec8d5cbac8d5ddf04efa51a7411 to your computer and use it in GitHub Desktop.
Nasty f-string hacks
In [1]: foo = {}
In [2]: f'r u a hacker or wat? {foo.update(a=1)} {locals().update(b="ham")}'
Out[2]: 'r u a hacker or wat? None None'
In [3]: foo
Out[3]: {'a': 1}
In [4]: b
Out[4]: 'ham'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment