Try this, it should all become clear:
------------------------------------------------
def gimmetaste(length=5):
print "A", length
return length * 2
if __name__ == '__main__':
print "B", gimmetaste()
------------------------------------------------
On Thu, Sep 3, 2009 at 8:57 AM, Abhishek Mishra<[email protected]> wrote:
> Hi, I'm trying to pass 5 as default value for this function...
>
> ------------------------------------------------
> def gimmetaste(length=5):
> print length
>
> if __name__ == '__main__':
> print gimmetaste()
> ------------------------------------------------
>
> Output -
> 5
> None
>
> I wonder why I get a None in the output?
> _______________________________________________
> BangPypers mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/bangpypers
>
>
--
Carl K
_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers