Semantic Equivalence (removing try/excepts from Measurement) #243
Replies: 2 comments
-
I would like to remove the try/except pairs on 860 and 871. ENLIGHTEN/enlighten/measurement/Measurement.py Lines 859 to 874 in fd5f071 Starting with 860. We have assignment to The try/except can be removed iff I checked manually that all members of that domain have an associated if/return, and so would not return None (potentially breaking some code downstream of get_metadata). This section could raise an exception if ENLIGHTEN/enlighten/measurement/Measurement.py Lines 774 to 782 in fd5f071 The following call will not exception, but it may return None. If it did return None, the following sections would exception 'Nonetype has no len'. The method can be easily adjusted to handle all branches to avoid this. ENLIGHTEN/enlighten/measurement/Measurement.py Lines 801 to 805 in fd5f071 Next areas of interest will be function calls generated by
In the interest of scope, I'm leaving out the possibilities of certain intermediate expressions being undefined, such as The one on 871, overlaps, with just a different subset of the domain. Overall, it's unlikely either of these sections will incur unhandled exceptions due to the removal of these try/excepts. |
Beta Was this translation helpful? Give feedback.
-
Turns out this was only used the one time |
Beta Was this translation helpful? Give feedback.
-
Critical sections of code tend to become the hardest to maintain. The importance of the area makes it hard to justify refactoring that might introduce bugs. The centrality of these sections tend to make them frequent targets of added complexity.
Here I will accumulate justifications and proofs related to code simplifications.
#199 is a clear example of this and the starting point for this discussion post.
Beta Was this translation helpful? Give feedback.
All reactions