Python Forum
Global Variables - Some Points Needing Clarification.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Global Variables - Some Points Needing Clarification.
#3
(Nov-30-2019, 07:58 AM)Gribouillis Wrote: I think strategy (b) is perfectly acceptable.
Thanks for your kind confirmation.

Regarding the suggestion:
Quote:instead of passing explicitly the global object in the functions' signature, the solution is often to make the functions methods of a class and to make the global object a member of the class, or an instance, so that the pointer to this object is passed implicitly through the self argument.

Would setting up a class be the preferred option even if it were to be called just for a single instance?
A.D.Tejpal
Reply


Messages In This Thread
RE: Global Variables - Some Points Needing Clarification. - by adt - Nov-30-2019, 12:03 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  needing some help to write some code for a game calculator rymdaksel 1 550 Jan-02-2024, 09:56 AM
Last Post: deanhystad
  Trying to understand global variables 357mag 5 1,258 May-12-2023, 04:16 PM
Last Post: deanhystad
  Can I get some clarification on importing functions from external files. wh33t 3 1,008 Feb-25-2023, 08:07 PM
Last Post: deanhystad
  Global variables or local accessible caslor 4 1,157 Jan-27-2023, 05:32 PM
Last Post: caslor
  global variables HeinKurz 3 1,261 Jan-17-2023, 06:58 PM
Last Post: HeinKurz
  Clarity on global variables JonWayn 2 1,028 Nov-26-2022, 12:10 PM
Last Post: JonWayn
  Looking for clarification related to performance Pymon 5 2,201 Apr-04-2022, 04:47 PM
Last Post: deanhystad
  Needing to Check Every Quarter Hour bill_z 10 3,269 Feb-09-2022, 07:23 PM
Last Post: menator01
  Read Tensorflow Documentation - Clarification IoannisDem 0 1,216 Aug-20-2021, 10:36 AM
Last Post: IoannisDem
  *args implementation and clarification about tuple status amjass12 10 4,279 Jul-07-2021, 10:29 AM
Last Post: amjass12

Forum Jump:

User Panel Messages

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