A question on modification of a list via a function invocation

Chris Angelico rosuav at gmail.com
Tue Sep 5 15:46:11 EDT 2017


On Wed, Sep 6, 2017 at 5:28 AM, Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
> On 5 Sep 2017 17:57:18 GMT, ram at zedat.fu-berlin.de (Stefan Ram) declaimed
> the following:
>
>>  But what does "a C++ reference" refer to?
>>
>
>         Per Stroustrup (The C++ Programming Language 4th Ed, page 189)
>
> """
>         * ...
>         * A reference always refers to the object to which it was initialized.
>         * ...
>
> A reference is an alternative name for an object, an alias. ...
> """
>
> {Hmmm, and I see that the syntax can be used outside of parameter
> declaration -- which is the only place I'd seen it previously... either
> this is a change from earlier standards, or my classes just didn't feel the
> need to expose a non-parameter reference -- since, based upon the above
> book, you can not declare a bare reference "variable"; it MUST be
> initialized with a real object.}

Outside of parameters, there's very little practical reason for
aliases. Their primary value is that an internal name can be an alias
for an external object, which is achieved with reference parameters.

ChrisA



More information about the Python-list mailing list