Python Forum
How can i call classmethod with myClass() instead of using myClass.myClassMethod()
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can i call classmethod with myClass() instead of using myClass.myClassMethod()
#2
>>> class foo:
...     def say(self):
...         print("Hello!")

>>> bar = foo()

>>> bar.say()
Hello!

>>> say = bar.say

>>> say()
Hello!
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
RE: How can i call classmethod with myClass() instead of using myClass.myClassMethod() - by wavic - Mar-23-2017, 04:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  @staticmethod and @classmethod akbarza 2 624 Jan-01-2024, 03:43 PM
Last Post: deanhystad
  How I can recognize that member is classmethod of staticmethod? AlekseyPython 0 1,891 Feb-17-2019, 07:01 AM
Last Post: AlekseyPython
  AttributeError: type object 'MyClass' has no attribute 'channel' chris0147 2 8,867 Sep-29-2017, 06:16 PM
Last Post: chris0147

Forum Jump:

User Panel Messages

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