Sujet : Re: The best way to copy a list?
De : user7 (at) *nospam* newsgrouper.org.invalid (Colin Macleod)
Groupes : comp.lang.tclDate : 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.ukWarning: Gumption level low, top-up when possible!