newbie: suppressing return values
Ben Finney
bignose-hates-spam at and-benfinney-does-too.id.au
Wed Dec 3 22:03:57 EST 2003
On Wed, 3 Dec 2003 19:41:13 -0700 (MST), Jim Benson wrote:
> I have a simple newbie question:
> It appears that in general functions "show"
> their return values. i.e.
>
>>>> def makeList():
> ... list = [1,2,3]
> ... return list
> ...
>>>>
>>>> makeList()
> [1, 2, 3]
>>>> a = makeList()
>>>>
This is only in the interactive Python prompt. Python will show the
"result", for want of a better word, of any callable or displayable
object you type in at the prompt.
So there's nothing inherent in 'return' that makes it output its value;
it's the invocation of that function at the Python interactive prompt
that gives that effect.
--
\ "I washed a sock. Then I put it in the dryer. When I took it |
`\ out, it was gone." -- Steven Wright |
_o__) |
Ben Finney <http://bignose.squidly.org/>
More information about the Python-list
mailing list