Can Python function return multiple data?
Steven D'Aprano
steve at pearwood.info
Thu Jun 4 19:13:45 EDT 2015
On Fri, 5 Jun 2015 06:52 am, BartC wrote:
> On 04/06/2015 18:11, Steven D'Aprano wrote:
>
>>If there is
>> any language where assignment uses one style and argument passing always
>> uses another, I've never come across it.
>
> My language does that. I'd be very surprised if it was the only one in
> existence that does so.
I would be. That means that
func(x)
and
tmp = x
func(tmp)
behave differently, and that would be very surprising to me (and, I think,
most people).
> Assignments involve a deep copy. Argument passing is something
> in-between by-value and by-reference (depending also on the type of data
> involved).
When you say "something in-between ...", do you mean pass by sharing?
> There is a also an actual by-reference mode (where a pointer
> is passed).
Passing a pointer is not necessarily by reference. Pass by sharing also uses
a pointer.
--
Steven
More information about the Python-list
mailing list