Re: The best way to copy a list?

Liste des GroupesRevenir à cl tcl 
Sujet : Re: The best way to copy a list?
De : user7 (at) *nospam* newsgrouper.org.invalid (Colin Macleod)
Groupes : comp.lang.tcl
Date : 18. Jun 2025, 13:19:19
Autres entêtes
Message-ID : <1750249159-7@newsgrouper.org>
References : 1 2 3
User-Agent : Newsgrouper/0.7.2
Mark Summerfield <m.n.summerfield@gmail.com> posted:
 
I'm coming to Tcl from Python & Go. In Python saying `a = [1, 2, 3]` and
then `b = a` makes `b` a _reference_ to `a` rather than an independent
variable. Now I realise that Tcl doesn't do it that way and that `set a
$b` works fine.

When I had to do some Python for work, after being familiar with Tcl,
I was quite shocked to find that Python shares values in that way! 😲

--
Colin Macleod ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ https://cmacleod.me.uk

Warning: Gumption level low, top-up when possible!

Date Sujet#  Auteur
18 Jun 25 * The best way to copy a list?8Mark Summerfield
18 Jun 25 +- Re: The best way to copy a list?1Harald Oehlmann
18 Jun 25 `* Re: The best way to copy a list?6Ashok
18 Jun 25  `* Re: The best way to copy a list?5Mark Summerfield
18 Jun 25   +- Re: The best way to copy a list?1Harald Oehlmann
18 Jun 25   +* Re: The best way to copy a list?2Colin Macleod
19 Jun 25   i`- Re: The best way to copy a list?1et99
18 Jun 25   `- Re: The best way to copy a list?1Christian Gollwitzer

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal