Skip to content

Conversation

Nomos11
Copy link
Collaborator

@Nomos11 Nomos11 commented Jul 28, 2025

No description provided.

@Nomos11 Nomos11 requested a review from shumpohl July 28, 2025 17:24
Copy link

github-actions bot commented Jul 28, 2025

Test Results

    6 files      6 suites   7m 25s ⏱️
1 230 tests 1 168 ✅  62 💤 0 ❌
7 380 runs  7 008 ✅ 372 💤 0 ❌

Results for commit 3229266.

♻️ This comment has been updated with latest results.

@shumpohl
Copy link
Member

shumpohl commented Aug 1, 2025

What is the purpose of the ordering (i.e. not __eq__) comparison methods?

@Nomos11
Copy link
Collaborator Author

Nomos11 commented Aug 1, 2025

Without remembering details I would expect some error occuring when (ab)using this class in the modified linspacebuilder to be the reason - perhaps something like an is_close-check (at least that's where abs() was e.g. called) where this is implicitly called and the result does not relly matter and one can just return False always. Or just leave it out and see what happens, as the definition is not very logical indeed.

@shumpohl
Copy link
Member

shumpohl commented Aug 1, 2025

I would leave it out and move the hack to the location where a potential error occurs. Otherwise, this can lead to very weird and hard to debug bugs in the future.

@Nomos11
Copy link
Collaborator Author

Nomos11 commented Aug 1, 2025

agreed, then omit that for now

@@ -86,7 +104,10 @@ def __rmul__(self, other):
def __truediv__(self, other):
inv = 1 / other
return self.__mul__(inv)


def __hash__(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DynamicLinearValue is not immutable. Either we make it immutable or we remove hash

@Nomos11
Copy link
Collaborator Author

Nomos11 commented Aug 1, 2025

sympy doesn't seem to like the changes


#this is not to circumvent float errors in python, but rounding errors from awg-increment commands.
#python float are thereby accurate enough
def __call__(self, resolution: Optional[float]) -> Union[NumVal,TimeType]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can me make this a method with a proper name?

Copy link
Collaborator Author

@Nomos11 Nomos11 Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one could of course
But since this functionality was the main purpose of the class, I thought it would be most intuitive to mimic a function called with the given resolution instead of having a name overhead by making it a named method

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A reader who is not aware of this class will be very puzzled. In my (non-humble) opinion making a callable class should be reserverd for cases where you need a callable anyways but need class semantics on top. A variable of such a class should then be named like a function. In this case the variable will (likely?) be named according to the context and function that the value has. The effect of calling the value will be opaque to the reader unless he looks up the class.

@shumpohl
Copy link
Member

The tests fail due to coveralls unreliability. I will create a seperate PR to fix that.

@shumpohl
Copy link
Member

@Nomos11 merge if you agree with my changes

@Nomos11 Nomos11 merged commit 21003ab into master Aug 14, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants