Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document behavior of some function cases #781

Open
jd-lara opened this issue Jul 19, 2021 · 2 comments
Open

Document behavior of some function cases #781

jd-lara opened this issue Jul 19, 2021 · 2 comments
Assignees

Comments

@jd-lara
Copy link
Member

jd-lara commented Jul 19, 2021

I recently saw this pattern in a package using PowerSystems.

gens = deepcopy([g for g in get_components(ThermalStandard, sys)])

What happens with gens?

@daniel-thom
Copy link
Contributor

This is certainly not a good idea unless the user understands the internals. If the generators are not attached to a system then they need to change the name and change the UUID (set_name! and IS.assign_new_uuid!). If they are attached to a system then many things will not work correctly. The user will never be able to retrieve the copied generators from the system.

We should add code to ensure that duplicate UUIDs are never added to a system. We currently only check for duplicate names. We would have to add new tracking.

Based on the implementation of Base.deepcopy It might be possible to block the function if the component is attached to a system.

@kdayday
Copy link
Contributor

kdayday commented Dec 30, 2024

@daniel-thom @jd-lara this still a relevant issue that needs to be documented, or can it be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants