Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Class objects
#4
That's the default representation of a function when printed (as opposed to when the function is executed). It's very similar for functions outside of a class as well. Are you expecting some other type of output?

>>> def myfunc():
...   return("Hello")
...
>>> print(myfunc)      # No parenthesis after the name.  We are referring to the object
<function myfunc at 0x105f07620>
>>> print(myfunc())    # Parenthesis after the name.  We are calling the object as a function
Hello
Reply


Messages In This Thread
Class objects - by Python_User - Aug-25-2020, 07:32 PM
RE: Class objects - by ndc85430 - Aug-25-2020, 07:36 PM
RE: Class objects - by jefsummers - Aug-25-2020, 07:38 PM
RE: Class objects - by bowlofred - Aug-25-2020, 07:40 PM
RE: Class objects - by Python_User - Aug-26-2020, 06:43 PM
RE: Class objects - by ndc85430 - Aug-26-2020, 06:49 PM
RE: Class objects - by snippsat - Aug-26-2020, 07:10 PM
RE: Class objects - by jefsummers - Aug-26-2020, 07:10 PM
RE: Class objects - by Python_User - Aug-26-2020, 07:16 PM
RE: Class objects - by buran - Aug-26-2020, 07:18 PM
RE: Class objects - by jefsummers - Aug-26-2020, 07:22 PM
RE: Class objects - by snippsat - Aug-26-2020, 07:26 PM
RE: Class objects - by Python_User - Aug-27-2020, 08:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I access objects or widgets from one class in another class? Konstantin23 3 1,087 Aug-05-2023, 08:13 PM
Last Post: Konstantin23
  How to create and define in one line a 2D list of class objects in Python T2ioTD 1 2,089 Aug-14-2020, 12:37 PM
Last Post: Yoriz
  printing class properties from numpy.ndarrays of objects pjfarley3 2 1,992 Jun-08-2020, 05:30 AM
Last Post: pjfarley3
  Help with lists and class objects AlluminumFoil 15 5,687 Jan-15-2020, 07:32 PM
Last Post: AlluminumFoil
  How to serialize custom class objects in JSON? Exsul1 4 3,551 Sep-23-2019, 08:27 AM
Last Post: wavic
  How do I write class objects to a file in binary mode? Exsul1 7 5,869 Sep-14-2019, 09:33 PM
Last Post: snippsat
  Do objects get their own copy of the class methods? Charles1 1 2,131 Feb-02-2019, 04:40 PM
Last Post: ichabod801
  AttributeError: 'NoneType' object has no attribute 'n' in list of class objects jdrp 4 5,805 Jun-19-2018, 02:44 PM
Last Post: jdrp
  How to check if class instance exists in a list of class instance objects? sonicblind 23 20,641 May-27-2018, 05:44 AM
Last Post: buran
  Class Objects... zowhair 2 3,024 Mar-10-2018, 08:01 AM
Last Post: wavic

Forum Jump:

User Panel Messages

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