Python Forum
function 2 inside function 1 parameters
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
function 2 inside function 1 parameters
#3
I have class shop. When making the __init__ I need to give it a function within one of the parameter player. If I give it the function though, the function executes from within the parameter of the class shop, rather than executing when the shop class executes it

def openCabin(p):
    gD.fill(black)
    health = getattr(p, 'damageTaken')
    healthSub = health - (health * 2)
    p.damageTake(healthSub)
    pygame.display.update()
    time.sleep(5)

Cabin = Building(260, 30, 200, 200, Buildings[1], openCabin(p))
The function executes one line 9 where it says "openCabin"
Reply


Messages In This Thread
RE: function 2 inside function 1 parameters - by SheeppOSU - Apr-20-2019, 09:07 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 679 Feb-19-2024, 03:51 PM
Last Post: deanhystad
  How to receive two passed cmdline parameters and access them inside a Python script? pstein 2 356 Feb-17-2024, 12:29 PM
Last Post: deanhystad
  with open context inside of a recursive function billykid999 1 588 May-23-2023, 02:37 AM
Last Post: deanhystad
  How do I call sys.argv list inside a function, from the CLI? billykid999 3 798 May-02-2023, 08:40 AM
Last Post: Gribouillis
Question How to compare two parameters in a function that has *args? Milan 4 1,282 Mar-26-2023, 07:43 PM
Last Post: Milan
  function accepts infinite parameters and returns a graph with those values edencthompson 0 868 Jun-10-2022, 03:42 PM
Last Post: edencthompson
  Exit function from nested function based on user input Turtle 5 2,931 Oct-10-2021, 12:55 AM
Last Post: Turtle
Question Stopping a parent function from a nested function? wallgraffiti 1 3,690 May-02-2021, 12:21 PM
Last Post: Gribouillis
  How can I write a function with three parameters? MehmetAliKarabulut 1 2,436 Mar-04-2021, 10:47 PM
Last Post: Larz60+
Question exiting the outer function from the inner function banidjamali 3 3,559 Feb-27-2021, 09:47 AM
Last Post: banidjamali

Forum Jump:

User Panel Messages

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