Skip to content

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

@weikou

Description

@weikou

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions