“Function ________ at 0x01D57aF0” return in python

后端 未结 2 1142
不知归路
不知归路 2020-12-12 08:05

I just started using python a week ago although I have some background in C++. I\'m just making some simple user defined functions. Code is below.

def quad         


        
相关标签:
2条回答
  • 2020-12-12 08:38

    Like David Robinson said in his comment, I think the function will run correctly if you enter

    quadratic.quads()
    

    This runs it as a function, as all functions have the two parentheses. Without it, it would be considered a variable in a class.

    0 讨论(0)
  • 2020-12-12 08:39

    You need to use () to call the function.

    Here's a simple test example of defining a trivial function and then calling it using use the name and then the name with () to illustrate the difference:

    Python 2.7.3 (default, Dec 18 2014, 19:10:20) 
    [GCC 4.6.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> def my_func():
    ...     print "yo!"
    ... 
    >>> my_func
    <function my_func at 0x7f3c84c74578>
    >>> my_func()
    yo!
    >>> 
    
    0 讨论(0)
提交回复
热议问题