Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
instance methods invokation
#3
(Apr-04-2021, 07:05 AM)Gribouillis Wrote: The call tst.fun(3, 5) is incorrect here because fun() needs an instance to work
Yet the code gives no error:
Output:
8 8
I believe Mim has a point.
Also a class does not need an instance to work as we can read in 9.3.2. Class Objects: Class objects support two kinds of operations: attribute references and instantiation. As a method is also an attribute it can be called.
Reply


Messages In This Thread
instance methods invokation - by mim - Apr-04-2021, 06:26 AM
RE: instance methods invokation - by Gribouillis - Apr-04-2021, 07:05 AM
RE: instance methods invokation - by ibreeden - Apr-04-2021, 07:39 AM
RE: instance methods invokation - by Gribouillis - Apr-04-2021, 08:18 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Bug Copying methods to effect the new owner instead of the old instance Daniel285 2 315 Jun-03-2024, 07:58 AM
Last Post: Gribouillis
  instance methods mim 7 3,443 Mar-28-2021, 03:46 PM
Last Post: deanhystad
  instance methods sharing addresses mim 1 2,376 Mar-28-2021, 05:22 AM
Last Post: deanhystad
  Class object instance. Link instance attribute to class. Can it be done easier. Windspar 7 4,420 Dec-03-2018, 11:16 PM
Last Post: Windspar
  How to check if class instance exists in a list of class instance objects? sonicblind 23 21,301 May-27-2018, 05:44 AM
Last Post: buran
  Python3x running only with one instance (how can I prevent too many running instance) harun2525 5 18,656 Jul-21-2017, 07:36 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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