Python Forum
How to Call a method of class having no argument
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Call a method of class having no argument
#8
(Oct-31-2019, 12:03 PM)dataplumber Wrote:
(Oct-30-2019, 06:24 PM)ndc85430 Wrote: Methods need to be declared with self as the first parameter, e.g.
 class Foo: def bar(self): pass f = Foo() f.bar() 
Yes, with self as argument it is working. That being said, Is it necessary to have all the class methods should have at least 1 argument (self) in our case. Can't we have no arguments ?

Thank you. That Answers my question.
Reply


Messages In This Thread
RE: How to Call a method of class having no argument - by dataplumber - Oct-31-2019, 01:52 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  class definition and problem with a method HerrAyas 2 265 Apr-01-2024, 03:34 PM
Last Post: HerrAyas
  super() and order of running method in class inheritance akbarza 7 751 Feb-04-2024, 09:35 AM
Last Post: Gribouillis
  method call help sollarriiii 6 1,158 Feb-21-2023, 03:19 AM
Last Post: noisefloor
  Using one child class method in another child class garynewport 5 1,606 Jan-11-2023, 06:07 PM
Last Post: garynewport
  i want to use type= as a function/method keyword argument Skaperen 9 1,877 Nov-06-2022, 04:28 AM
Last Post: Skaperen
  How to call a class in other class? 3lnyn0 3 938 Oct-24-2022, 09:18 AM
Last Post: GenTorossi
  [Solved] Novice question to OOP: can a method of class A access attributes of class B BigMan 1 1,322 Mar-14-2022, 11:21 PM
Last Post: deanhystad
  class, attribute and method Frankduc 9 2,482 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,801 Feb-07-2022, 07:29 PM
Last Post: saavedra29
  Class Method to Calculate Age Doesn't Work gdbengo 1 1,716 Oct-30-2021, 11:20 PM
Last Post: Yoriz

Forum Jump:

User Panel Messages

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