Skip to content

Instantly share code, notes, and snippets.

@dstufft
Created April 16, 2014 02:21
Show Gist options
  • Select an option

  • Save dstufft/10799016 to your computer and use it in GitHub Desktop.

Select an option

Save dstufft/10799016 to your computer and use it in GitHub Desktop.
# BAD
from flask import request as global_request
def do_a_thing_globally():
print(global_request.session["username"])
def view():
do_a_thing_globally()
# GOOD
def do_a_thing(username):
print(username)
def view(local_request):
do_a_thing(local_request.session["username"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment