[Tutor] repr()

Max Noel maxnoel_fr at yahoo.fr
Tue Jun 7 21:50:51 CEST 2005


On Jun 7, 2005, at 20:42, Bernard Lebel wrote:

> repr( myFunc )
>
> Wich returns
>
> '<function myFunc at 0x009C6630>'
>
>
> Okay then I run
>
> s = repr( myFunc() )
> print s
>
> Wich returns
>
> 'None'

     That's perfectly normal. Your last assignment calls the  
function, then assigns to s the representation of the function's  
return value. A function that doesn't have a return statement returns  
None, and repr(None) == 'None'. Which is what you get.

-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting  
and sweating as you run through my corridors... How can you challenge  
a perfect, immortal machine?"



More information about the Tutor mailing list