Aliasing [was Re: [Tutor] beginning to code]

Antoon Pardon antoon.pardon at vub.be
Wed Sep 27 04:22:54 EDT 2017


Op 27-09-17 om 10:11 schreef Chris Angelico:
> On Wed, Sep 27, 2017 at 5:38 PM, Steven D'Aprano
> <steve+comp.lang.python at pearwood.info> wrote:
>> Twice you have claimed to be able to write such a swap procedure for
>> lists. You can't. If you think you can, it is only because you have
>> misunderstood the problem and are writing something else that does
>> something different from what the Pascal version does.
> I suspect what he's thinking of is a swap_contents() function, which
> gives the appearance that the lists have been swapped. That's entirely
> possible, but doesn't actually achieve what swap() does.

If you refer to languages like Pascal or C, for illustrating that you
can write a swap function in them, the swapping that happens there is
one of content. So claiming that swapping contend doesn't actually
achieves whar swap() does, seems wrong.

-- 
Antoon Pardon.




More information about the Python-list mailing list