Python Forum
Calling a function whch is inside a function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calling a function whch is inside a function
#2
Good question but I am going to skirt around the answer because I believe inner functions are used in python because (as you found out) they are protected. At least, that's what I have gathered so far (also new to python). There kind of like a private function in that their functionality is protected from the global scope.

In other words there is essentially no good reason or time when you are going to want to use method nested within another method and if you did you wouldn't.. instead, you would just make a private method completely separate from the other. If your still interested:

def functOuter():
  print("funcOuter() called")

  def functInner():
    print("funcInner() called")

  functInner()

functOuter()
Reply


Messages In This Thread
RE: Calling a function whch is inside a function - by Vysero - Aug-10-2018, 08:32 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  The function of double underscore back and front in a class function name? Pedroski55 9 819 Feb-19-2024, 03:51 PM
Last Post: deanhystad
  calling external function with arguments Wimpy_Wellington 7 1,551 Jul-05-2023, 06:33 PM
Last Post: deanhystad
  Calling a function (which accesses a library) from another file mouse9095 4 867 Jun-07-2023, 08:55 PM
Last Post: deanhystad
  with open context inside of a recursive function billykid999 1 613 May-23-2023, 02:37 AM
Last Post: deanhystad
  How do I call sys.argv list inside a function, from the CLI? billykid999 3 855 May-02-2023, 08:40 AM
Last Post: Gribouillis
Sad Iterate randint() multiple times when calling a function Jake123 2 2,129 Feb-15-2022, 10:56 PM
Last Post: deanhystad
  Calling a class from a function jc4d 5 1,910 Dec-17-2021, 09:04 PM
Last Post: ndc85430
  Exit function from nested function based on user input Turtle 5 3,022 Oct-10-2021, 12:55 AM
Last Post: Turtle
  [Solved] TypeError when calling function Laplace12 2 2,962 Jun-16-2021, 02:46 PM
Last Post: Laplace12
Question Stopping a parent function from a nested function? wallgraffiti 1 3,729 May-02-2021, 12:21 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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