Can Python function return multiple data?
Mark Lawrence
breamoreboy at yahoo.co.uk
Wed Jun 3 17:56:28 EDT 2015
On 03/06/2015 22:35, Chris Angelico wrote:
> On Wed, Jun 3, 2015 at 11:56 PM, Thomas Rachel
> <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915 at spamschutz.glglgl.de>
> wrote:
>> Am 03.06.2015 um 01:56 schrieb Chris Angelico:
>>
>>> and it's pretty convenient. In C, the nearest equivalent is passing a
>>> number of pointers as parameters, and having the function fill out
>>> values. Python's model is a lot closer to what you're saying than C's
>>> model is :)
>>
>>
>> At least, C functions can return structs...
>
> Oh, yes, I forgot about that. Thought that was C++ but not C, partly
> because I never do it in either language. Although in a sense, a
> struct is still a single "thing".
>
> ChrisA
>
Don't forget that C functions can accept structs as input. Possibly not
a good idea as I found out many years ago pre ANSIC when I forgot that
little old ampersand, so the compiler didn't pick it up, but then with
modern computers having so much memory who really cares if you burn a
little bit of stack on structures rather than pointers to structures?
Now does Python pass by value or by reference? Happily sits back and
waits for 10**6 emails to arrive as this is discussed for the 10**6th time.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
More information about the Python-list
mailing list