Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone02.am1.xlned.com!bcyclone02.am1.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.019 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'explicitly': 0.05; 'logic': 0.09; 'parameter': 0.09; 'subject:Function': 0.09; 'none.': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'function': 0.29; 'getting': 0.31; 'prints': 0.31; 'alone': 0.33; 'expected': 0.38; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'even': 0.60; 'tell': 0.60 Date: Wed, 1 Oct 2014 17:45:01 -0500 From: Andrew Berg User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: Subject: Re: Function passed as an argument returns none References: In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [2601:2:4780:2fd:3cfa:1b41:db29:34df] X-ClientProxiedBy: CO2PR06CA013.namprd06.prod.outlook.com (10.141.242.13) To DM2PR0301MB0846.namprd03.prod.outlook.com (25.160.215.144) X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB0846; X-Forefront-PRVS: 0351D213B3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(979002)(6009001)(24454002)(199003)(189002)(101416001)(76482002)(64126003)(87266999)(54356999)(107886001)(2351001)(87976001)(89122001)(102836001)(76176999)(65816999)(110136001)(50466002)(59896002)(4396001)(85306004)(120916001)(64706001)(33656002)(47776003)(21056001)(65806001)(65956001)(99396003)(83506001)(105586002)(88552001)(75432002)(80316001)(31966008)(77096002)(46102003)(86362001)(97736003)(80022003)(20776003)(50986999)(92566001)(42186005)(95666004)(107046002)(10300001)(92726001)(23676002)(106356001)(85852003)(89472002)(3826002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR0301MB0846; H:[IPv6:2601:2:4780:2fd:3cfa:1b41:db29:34df]; FPR:; MLV:ovrnspm; PTR:InfoNoRecords; A:0; MX:1; LANG:en; X-OriginatorOrg: my.hennepintech.edu X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 9 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1412203523 news.xs4all.nl 2832 [2001:888:2000:d::a6]:48448 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3824 X-Received-Body-CRC: 3566341780 Xref: csiph.com comp.lang.python:78568 On 2014.10.01 17:37, Shiva wrote: > Only 'None' gets passed on to parameter 'got' instead of the expected value > of 4. > Any idea why 'None' is getting passed even though calling the donuts(4) > alone returns the expected value? donuts() prints what you tell it to ("Number of donuts: 5"), and then returns what you tell it to (nothing). If you don't explicitly make a function return something, it returns None. Whatever other logic you have in the function is irrelevant.