function/method assigment
7stud
bbxx789_05ss at yahoo.com
Fri Apr 13 14:37:37 EDT 2007
On Apr 13, 10:14 am, viscr... at gmail.com wrote:
> I have a confusion when I do some practice, the code and output are as
> following,
>
> >>> def fun():
>
> print 'In fun()....'
>
> >>> testfun = fun()
> In fun()....
> >>> print testfun
> None
> >>> testfun2 = fun
> >>> print testfun2
>
> <function fun at 0x00CC1270>>>> print testfun2()
>
> In fun()....
> None
>
>
>
> what is 'testfun'? Why it is 'None'? And print testfun2(), what is the
> meaning of 'None'?
>
> Thanks!
Start with these rules:
1) all function calls in your code are replaced by the function's
return value.
2) if a function doesn't have a return statement, it automatically
returns None.
3 The '()' symbols make the function execute. Without those the
function won't execute.
More information about the Python-list
mailing list