Can Python function return multiple data?

Marko Rauhamaa marko at pacujo.net
Fri Jun 5 09:37:44 EDT 2015


random832 at fastmail.us:

> The normal human-readable representation of a reference is an arrow on
> a diagram, pointing from a box that represents the variable to a box
> that represents the object. But I can't exactly put that in a
> text-based email.

An *lvalue* is anything that can be assigned to:

   x = 3
   a[3] = 2
   d['hello'] = 'world'

An *rvalue* is anything that can be assigned to an lvalue.

In Python, every rvalue is a *reference* to an *object*.

So your first box is an lvalue, your arrow is an rvalue and your second
box is an object.

The words "lvalue" and "rvalue" smell like C, so Python people tend to
want to find loftier terms at the expense of clarity. Thus instead of
saying,

    The lvalue contains a reference to an object.

they prefer saying,

    The reference is bound to an object.

Unfortunately, that practice renders the meaning of a "reference"
ambiguous.


Marko



More information about the Python-list mailing list