Closed JohannesVerherstraeten closed 2 weeks ago
This pull request implements hash, equality, and inequality operations for the TShape class in the TopoDS module. It addresses an issue where these operations were not properly implemented, leading to unexpected behavior when comparing TShape objects or using them in sets/dictionaries.
classDiagram
class TopoDS_TShape {
+__hash__() size_t
+__eq__(self, right) bool
+__ne__(self, right) bool
}
note for TopoDS_TShape "Added hash, eq, and neq operations"
Change | Details | Files |
---|---|---|
Implement hash, eq, and ne methods for TopoDS_TShape |
|
src/SWIG_files/wrapper/TopoDS.i |
Add unit tests for new TShape operations |
|
test/test_core_wrapper_features.py |
Thank you @JohannesVerherstraeten for this contribution. It is strange the _neq__ or eq operators are not handled by default for the TopoDS_TShape class, all c++ classes that implement the != operator should benefit from this addition.
superseded by #1382
Thanks tpaviot, I'll close this PR
thank you @JohannesVerherstraeten feel free to contribute swig stuff whenever you want, I'll review changes as fast as I can
Fixes the issue where the
__hash__
,__eq__
and__neq__
operators of TopoDS_TShape are not implemented, giving unexpected results like:This fix allows properly comparing TopoDS_TShapes and using them in sets/dictionaries.
Summary by Sourcery
Implement hash, equality, and inequality operators for TopoDS_TShape to fix comparison issues and enable usage in sets and dictionaries, and add corresponding tests.
New Features:
__hash__
,__eq__
, and__neq__
operators for TopoDS_TShape to enable proper comparison and usage in sets and dictionaries.Tests:
__hash__
,__eq__
, and__neq__
operators of TopoDS_TShape to ensure correct functionality.