Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Convert TransferFunction's shallow copy to deep copy. #130

Closed
Assignees
slivingston
@dapperfu

Description

@dapperfu

I spent quite a bit of time trying to debug an error and finally stumbled on the documentation:

# Beware: this is a shallow copy! This should be okay,# but be careful.

It took me a bit of digging and debugging before I realized my errors caused by the shallow copy:

>>> print(num)>>> print(type(num[0]))[[1], [2]]<class 'list'>>>> sys1 = control.TransferFunction([num],[den])>>> sys1>>> print(num)>>> print(type(num[0]))[array([1]), array([2])]<class 'numpy.ndarray'>

This can make scripts behave different based on the order of operation:

num = ...den = ...myfunc(num)TransferFunction(num, den)

vs.

num = ...den = ...TransferFunction(num, den)myfunc(num)

To new Python users having the variables 'num' & 'den' behave different before and after callingTransferFunction can be confusing and off-putting.

Metadata

Metadata

Assignees

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


    [8]ページ先頭

    ©2009-2025 Movatter.jp