[BangPypers] Why the None ?

Carl Karsten carl at personnelware.com
Thu Sep 3 15:59:58 CEST 2009


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<ideamonk at gmail.com> 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
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>
>



-- 
Carl K


More information about the BangPypers mailing list