JuliaLang / IJulia.jl

Julia kernel for Jupyter
MIT License
2.78k stars 409 forks source link

copy() seems to behave as deepcopy() in IJulia notebook #1093

Open weikou opened 1 year ago

weikou commented 1 year ago

Hi,

I found a confusing inconsistency between the julia REPL and IJulia notebook.

When I open an IJulia notebook and type in

a = [[1,2,3],[4,5,6]]
b = copy(a)
a[1][1] = 11
b

b does not change (in the IJulia notebook). So, copy() acts the same as deepcopy() here. However, in the normal Julia REPL, as copy() is not recursive, so b[1][1] is changed to 11.

I am using: Julia Version 1.8.1 Commit afb6c60d69a (2022-09-06 15:09 UTC) Platform Info: OS: Linux (x86_64-linux-gnu) CPU: 4 × Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-13.0.1 (ORCJIT, ivybridge) Threads: 1 on 4 virtual cores

My package version of IJulia is: IJulia v1.24.2

fredrikekre commented 1 year ago

I can't reproduce this issue. What version of IJulia are you using? Does it happen in a fresh notebook with no packages loaded?

weikou commented 1 year ago

Dear Fredrik,Ok thanks for your response, that's funny. As I wrote, I am using IJulia version 1.24.2I did try again on a fresh notebook to be sure and got the same result as what I described earlier...All the best, WiebkeVon meinem/meiner Galaxy gesendet -------- Ursprüngliche Nachricht --------Von: Fredrik Ekre @.> Datum: 01.09.23 15:50 (GMT+01:00) An: "JuliaLang/IJulia.jl" @.> Cc: Wiebke Scholz @.>, Author @.> Betreff: Re: [JuliaLang/IJulia.jl] copy() seems to behave as deepcopy() in IJulia notebook (Issue #1093) I can't reproduce this issue. What version of IJulia are you using? Does it happen in a fresh notebook with no packages loaded?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>