[BangPypers] Why the None ?

Mehndi, Sibtey sibtey.mehndi at genpact.com
Thu Sep 3 16:03:14 CEST 2009

Any python function by default return None in your gimmetaste function you are not returning any value. That's why gimmetaste returns None

-----Original Message-----
From: bangpypers-bounces+sibtey.mehndi=genpact.com at python.org [mailto:bangpypers-bounces+sibtey.mehndi=genpact.com at python.org] On Behalf Of Abhishek Mishra
Sent: Thursday, September 03, 2009 7:27 PM
To: bangpypers at python.org
Subject: [BangPypers] Why the None ?

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 -

I wonder why I get a None in the output?
BangPypers mailing list
BangPypers at python.org
This e-mail (and any attachments), is confidential and may be privileged. It may be read, copied and used only
by intended recipients. Unauthorized access to this e-mail (or attachments) and disclosure or copying of its 
contents or any action taken in reliance on it is unlawful. Unintended recipients must notify the sender immediately 
by e-mail/phone & delete it from their system without making any copies or disclosing it to a third person.

More information about the BangPypers mailing list