[Tutor] where is this returning from??

Lennart Andersen lennart at rogers.com
Thu Aug 26 16:13:55 CEST 2004


* Alan Gauld <alan.gauld at blueyonder.co.uk> [2004-08-26 08:52+0100]
> > def printTwice(output):
> >   print output, output
> >
> > def chantTwice(p1,p2):
> >   cat = p1 + p2
> >   printTwice(cat)
> >
> >   if name == noun:
> >     print chantTwice(p1, p2)
> 
> This is printing the return value of chantTwice()
> But looking at the definition of chantTwice() there
> is no return value, it simply calls printTwice()
> When no explicit return value is specified Python
> returns a default value of None.
> 
> So your program calls chantTwice(), which calls
> PrintTwice(), which prints a message, then Python
> returns None from chantTwice() which is printed
> by the print command inside the if statement.
> 
> HTH,
> 
> Alan G
> Author of the Learn to Program web tutor
> http://www.freenetpages.co.uk/hp/alan.gauld/tutor2/
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

Hi,

I can't seem to get to Mr. Gauld's home pages, does anyone else have this
problem?

-- 
 Lennart Andersen 
 St Thomas, Ontario
 landersen at rogers.com
---------------------        
  - Libranet/Debian - when code matters more than commercials
  


More information about the Tutor mailing list