r/learnpython •

Printing local variables outside of a function

[deleted] — view deleted post

0 Upvotes

14 comments sorted by

View all comments

Show parent comment

1

u/Outside_Complaint755 Oct 05 '26

Don't use global variables unless absolutely necessary. It will just cause headaches and is definitely a code smell.

Plus, if you're returning it, then making it global is unnecessary.