You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@pschanely thanks! Be aware that we used __new__ intensively to impose constraints on primitive types in https://github.com/mristin/python-by-contract. That was a "canonical" way for me, and also the efficient one as values can not be mutated.
Indeed; I recall some of that! In general, CrossHair should be able to construct via the signatures on __new__ and __init__ appropriately.
Even after construction, though, I expect some additional hurdles for classes extending some of the core types: str, list, dict, etc. Needs more investigation!
I believe many of the python-by-contract classes were never actually instantiated - that is, the __new__ just returned its argument. Those cases hopefully aren't subject to such challenges.
As shown in this example, extending native types (that CrossHair cares about) doesn't work as expected.
I suspect there may be multiple layers of problems, the first of which is that a correct constructor signature is harder to deduce for these types.
cc @mristin
The text was updated successfully, but these errors were encountered: