Skip to content

InputOutputSystem.copy makes shallow copies #728

Closed
@roryyorke

Description

@roryyorke

This is may be by design, but I found it unexpected (see below). If it is by design, it would help to add "shallow" to the doctring.

In [220]: g = ct.rss()

In [221]: g.D[0,0]
Out[221]: -1.8274167505512213

In [222]: g2 = g.copy()

In [223]: g2.D[0,0] = 1

In [224]: g.D[0,0]
Out[224]: 1.0

One way to deep copy is to use control.ss; continuing from above:

In [225]: g3 = ct.ss(g)

In [226]: g3.D[0,0] = 5

In [227]: g.D[0,0]
Out[227]: 1.0

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