newbie: suppressing return values

J

Jim Benson

Hi,

I have a simple newbie question:
It appears that in general functions "show"
their return values. i.e.
.... list = [1,2,3]
.... return list
....
makeList() [1, 2, 3]
a = makeList()

In mathematica one can put a ; at the end of
a function call and the output is suppressed.
In this example if python behaved like mathematica in
this case one would see:
makeList();

makeList() [1, 2, 3]

Is there a simple way (other than the a = makeList())
to do this "suppression" in python?

Thanks,

Jim
 
B

Ben Finney

I have a simple newbie question:
It appears that in general functions "show"
their return values. i.e.
... 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top