From-Import Freezes a Value
Two files in the same directory:
# config.py
DEBUG = False
def enable_debug():
global DEBUG
DEBUG = True
# app.py
import config
from config import DEBUG as DEBUG_COPY
config.enable_debug()
print("config.DEBUG:", config.DEBUG)
print("DEBUG_COPY:", DEBUG_COPY)
You run python3 app.py. What prints?
Sign in to answer questions and track your progress
Sign In