Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
method call help
#3
What is this supposed to do? What it does is set self.price = 75.
    def pricing_mac(self):
  
        detail = {"achat matériel MAC", "configuration matériel", "installation chez client"}
        if detail == "achat matériel MAC":
            self.price = 75
        if detail == "configuration matériel":
            self.price = 50
        elif detail == "installation chez client":
            self.price = 50
        else :self.price = 75    # <- This always executes
This makes a set:
detail = {"achat matériel MAC", "configuration matériel", "installation chez client"}
detail will never equal "achat matériel MAC" or "configuration matériel" or any other str. A set is never equal to a str.
Reply


Messages In This Thread
method call help - by sollarriiii - Feb-19-2023, 03:14 PM
RE: method call help - by Yoriz - Feb-19-2023, 03:39 PM
RE: method call help - by deanhystad - Feb-19-2023, 04:22 PM
RE: method call help - by noisefloor - Feb-19-2023, 06:40 PM
RE: method call help - by sollarriiii - Feb-19-2023, 07:24 PM
RE: method call help - by Gribouillis - Feb-19-2023, 07:30 PM
RE: method call help - by noisefloor - Feb-21-2023, 03:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  how to get around recursive method call Skaperen 10 4,380 Jul-01-2020, 10:09 PM
Last Post: Skaperen
  How to call COM-method using comtypes jespersahner 0 2,469 Nov-15-2019, 12:54 PM
Last Post: jespersahner
  Polymorphism not working with a call to a abstract method colt 3 2,380 Nov-04-2019, 11:04 PM
Last Post: colt
  How to Call a method of class having no argument dataplumber 7 6,585 Oct-31-2019, 01:52 PM
Last Post: dataplumber
  Call method from another method within a class anteboy65 3 7,558 Sep-11-2019, 08:40 PM
Last Post: Larz60+
  What is the use of call method and when to use it? everyday1 1 3,340 Jul-14-2019, 01:02 PM
Last Post: ichabod801
  I'm trying to figure out whether this is a method or function call 357mag 2 2,493 Jul-04-2019, 01:43 AM
Last Post: ichabod801
  How to call a method in a module using code KingPieter 4 3,059 Jan-15-2019, 09:13 PM
Last Post: KingPieter
  call method in class using threads? masterofamn 0 2,751 Jan-24-2017, 09:09 PM
Last Post: masterofamn

Forum Jump:

User Panel Messages

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