Can Python function return multiple data?
Steven D'Aprano
steve at pearwood.info
Thu Jun 4 18:45:44 EDT 2015
On Fri, 5 Jun 2015 04:17 am, Alain Ketterlin wrote:
> Steven D'Aprano <steve at pearwood.info> writes:
>
> [...]
>> But you still find a few people here and there who have been exposed to
>> Java foolishness, and will argue that Python is "pass by value, where the
>> value is an implementation dependent reference to the thing that you
>> thought was the value".
>
> I find this clear and concise. Can you exhibit an example that would not
> match this description?
>
>> In other words, according to this Java philosophy, following `x = 23`,
>> the value of x is not 23 like any sane person would expect, but some
>> invisible and unknown, and unknowable, reference to 23.
>
> No, Java doesn't work like that for primitive types (assuming that by
> "Java" you mean the language and execution environment defined in
> reference documents).
Perhaps the fact that I used Python syntax was too ambiguous <wink> but I
was talking about Python. However, the same applies to Java, if you
substitute an object for the primitive value:
Integer x = new Integer(23);
According to the Java philosophy, the value of x is not the object
Integer(23) like any sane person would expect, but some invisible and
unknown reference to that object.
Clear now?
--
Steven
More information about the Python-list
mailing list