[BangPypers] Why the None ?

Anand Balachandran Pillai abpillai at gmail.com
Thu Sep 3 16:25:42 CEST 2009


On Thu, Sep 3, 2009 at 7:29 PM, Carl Karsten <carl at personnelware.com> wrote:

> 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?
>

 Since your function returns nothing, i.e "None" :)
 Python is almost like the English language you see...


> > _______________________________________________
> > BangPypers mailing list
> > BangPypers at python.org
> > http://mail.python.org/mailman/listinfo/bangpypers
> >
> >
>
>
>
> --
> Carl K
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>



-- 
--Anand
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/bangpypers/attachments/20090903/7e86b66d/attachment.htm>


More information about the BangPypers mailing list