Python Forum
Function will not return variable that I think is defined
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Function will not return variable that I think is defined
#7
If you don't understand scope many Python errors are completely mystifying. I set x = 10, why is it 5 here? What do you mean name "y" is not defined? I set it right here!! But when you know about scope the error messages not only tell you what you did wrong, but where. You'll still smack your head a few times, but you are probably past spending hours trying to fix a scope error.
Reply


Messages In This Thread
RE: Function will not return variable that I think is defined - by deanhystad - Aug-18-2020, 08:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Variable not defined even though it is CoderMerv 3 293 Mar-28-2024, 02:13 PM
Last Post: Larz60+
  Variable for the value element in the index function?? Learner1 8 665 Jan-20-2024, 09:20 PM
Last Post: Learner1
  Variable is not defined error when trying to use my custom function code fnafgamer239 4 594 Nov-23-2023, 02:53 PM
Last Post: rob101
  nested function return MHGhonaim 2 619 Oct-02-2023, 09:21 AM
Last Post: deanhystad
  Printing the variable from defined function jws 7 1,323 Sep-03-2023, 03:22 PM
Last Post: deanhystad
  Function parameter not writing to variable Karp 5 949 Aug-07-2023, 05:58 PM
Last Post: Karp
  return next item each time a function is executed User3000 19 2,300 Aug-06-2023, 02:29 PM
Last Post: deanhystad
  function return boolean based on GPIO pin reading caslor 2 1,192 Feb-04-2023, 12:30 PM
Last Post: caslor
  Getting NameError for a function that is defined JonWayn 2 1,114 Dec-11-2022, 01:53 PM
Last Post: JonWayn
Question Help with function - encryption - messages - NameError: name 'message' is not defined MrKnd94 4 2,907 Nov-11-2022, 09:03 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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