Python Forum
When to decide whether or not to have an argument in a class method?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
When to decide whether or not to have an argument in a class method?
#4
you have a class House. it has properties - side, roof, volume.
i.e. self.side is a property. self.volume() is also a property (method to be precise). there is no such property self.side.volume().
self.side is actually just a floating number (i.e. float object, not House object). you need to read/revisit class basics. https://python-forum.io/Thread-Classes-Class-Basics
Reply


Messages In This Thread
RE: When to decide whether or not to have an argument in a class method? - by buran - Oct-29-2017, 03:51 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  class definition and problem with a method HerrAyas 2 271 Apr-01-2024, 03:34 PM
Last Post: HerrAyas
  super() and order of running method in class inheritance akbarza 7 778 Feb-04-2024, 09:35 AM
Last Post: Gribouillis
  Using one child class method in another child class garynewport 5 1,619 Jan-11-2023, 06:07 PM
Last Post: garynewport
  i want to use type= as a function/method keyword argument Skaperen 9 1,908 Nov-06-2022, 04:28 AM
Last Post: Skaperen
  [Solved] Novice question to OOP: can a method of class A access attributes of class B BigMan 1 1,324 Mar-14-2022, 11:21 PM
Last Post: deanhystad
  class, attribute and method Frankduc 9 2,490 Feb-27-2022, 09:07 PM
Last Post: deanhystad
  Subclass initialized property used in parent class method. Is it bad coding practice? saavedra29 5 1,804 Feb-07-2022, 07:29 PM
Last Post: saavedra29
  Class Method to Calculate Age Doesn't Work gdbengo 1 1,719 Oct-30-2021, 11:20 PM
Last Post: Yoriz
Question How to pass a method as argument in an another method? anilanvesh 6 2,765 Sep-30-2021, 10:18 PM
Last Post: deanhystad
  anonymous method in a class Skaperen 8 3,610 May-23-2021, 11:17 PM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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