wsp-sag / network_wrangler

A Python Library for Managing Travel Model Network Scenarios
https://wsp-sag.github.io/network_wrangler/
Apache License 2.0
13 stars 3 forks source link

[FEATURE] Object Mutability Consistency #308

Closed e-lo closed 1 week ago

e-lo commented 1 year ago

User Story

As a user I'd like to have a consistent expectation about if I am modifying an object in-place or creating a mutated copy.

Status

Context

Right now, there is are public methods in roadway and transit network objects that:

This inconsistency in the API has caused lots of confusion and bugs.

Resolution Ideas

Add and implement the following design principle:

Priority

High

Level of Effort

Low

Project

Is there a funder or project associated with this feature?

Who should be involved?

Implementer: Commenters: Users: Reviewers:

Risk

Will this potentially break anything?

Tests

What are relevant tests or what tests need to be created in order to determine that this issue is complete?

e-lo commented 1 year ago

Update: will test performance of deep copy on a real-size network to evaluate if this is an ok default.

e-lo commented 1 year ago

Performance: Copying the instance of the full bay area network takes a little over than a second.

image

@lmz @DavidOry thoughts?

DavidOry commented 1 year ago

Well that's encouraging. Perhaps we create another issue to remind us to test this once version 1 is released, but for now move ahead with your original plan?

e-lo commented 1 month ago

Fixed in https://github.com/wsp-sag/network_wrangler/pull/327