Skip to content

some more typing of core#907

Open
tias wants to merge 4 commits intomasterfrom
mypy_core3
Open

some more typing of core#907
tias wants to merge 4 commits intomasterfrom
mypy_core3

Conversation

@tias
Copy link
Copy Markdown
Collaborator

@tias tias commented Apr 3, 2026

one notable change is about 'implies' and simplification...

one principle is that we typically don't simplify expressions at creation time, only at transformation time (subject to some exceptions).

I now make this more explicit, making 'simplify' an option to implies (which we don't activate anywhere at the moment). So for the user we wont delete expressions and variables unexpectedly, and for us, if we want it to activate we can.

@tias tias requested a review from IgnaceBleukx April 3, 2026 21:33
Copy link
Copy Markdown
Collaborator

@IgnaceBleukx IgnaceBleukx left a comment

Choose a reason for hiding this comment

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

Great, that should do away with a lot of weird cases in the transformation stack...
Maybe also add the optional argument to expressions.utils.implies? We use it when we're not sure the lhs is an expression

def deepcopy(self, memodict={}):
""" DEPRECATED: use copy.deepcopy() instead

Will be removed in stable version.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could probably be removed by now... We'll do a major release next time anyway

"""Implication constraint: ``self -> other``.

Python does not offer relevant syntax for implication, call this method instead.
For double implication, use equivalence ``self == other``.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Double reification?


Args:
other (ExprLike): the right-hand-side of the implication
simplify (bool): if True, simplify True/False constants (might remove expressions & there variables from user-view)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

typo there -> their

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