Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Globals vs Function
#3
When you are using global variables in a local scope, you are cross scope boundaries. This can become confusing and hard to track. If you run into a problem with the values of a and b, it can be harder to figure out where a and b are being modified. If you are passing them around as parameters and return values, it becomes easier to track down where they might get modified.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
Globals vs Function - by mcmxl22 - Feb-04-2017, 12:29 AM
RE: Globals vs Function - by wavic - Feb-04-2017, 12:53 AM
RE: Globals vs Function - by ichabod801 - Feb-04-2017, 11:38 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  why globals() exits python when quit() is aliased as q abc12346 4 735 May-23-2023, 08:56 AM
Last Post: Gribouillis
  How to avoid exec(), globals(), locals(), eval() paul18fr 10 5,202 Apr-21-2021, 05:53 PM
Last Post: snippsat
  accessing globals from a function Skaperen 8 4,243 Sep-01-2018, 11:50 PM
Last Post: Skaperen
  Use of Globals CWatters 5 3,889 Nov-13-2017, 09:00 PM
Last Post: CWatters

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020