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
#5
Another way give only in openCabin when instantiate the Cabin object.
class Bar:
    def __init__(self, open_cabin):
        self.open_cabin = open_cabin

def open_cabin(p):
    return p
Use:
>>> cabin = Bar(open_cabin)
>>> cabin.open_cabin
<function open_cabin at 0x0324B4B0>
>>> 
>>> # First now will executes the open_cabin function with a argument
>>> cabin.open_cabin(42)
42
Reply


Messages In This Thread
RE: function 2 inside function 1 parameters - by snippsat - Apr-20-2019, 09:34 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 676 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 352 Feb-17-2024, 12:29 PM
Last Post: deanhystad
  with open context inside of a recursive function billykid999 1 584 May-23-2023, 02:37 AM
Last Post: deanhystad
  How do I call sys.argv list inside a function, from the CLI? billykid999 3 796 May-02-2023, 08:40 AM
Last Post: Gribouillis
Question How to compare two parameters in a function that has *args? Milan 4 1,280 Mar-26-2023, 07:43 PM
Last Post: Milan
  function accepts infinite parameters and returns a graph with those values edencthompson 0 867 Jun-10-2022, 03:42 PM
Last Post: edencthompson
  Exit function from nested function based on user input Turtle 5 2,929 Oct-10-2021, 12:55 AM
Last Post: Turtle
Question Stopping a parent function from a nested function? wallgraffiti 1 3,687 May-02-2021, 12:21 PM
Last Post: Gribouillis
  How can I write a function with three parameters? MehmetAliKarabulut 1 2,433 Mar-04-2021, 10:47 PM
Last Post: Larz60+
Question exiting the outer function from the inner function banidjamali 3 3,557 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