Skip to content

Why does the SQLAlchemy code distinguish between bound=object and bound=Any? #9835

Discussion options

You must be logged in to vote

I recall coming across this difference but i dont recall what the error was, it was also an older version of mypy. I will say that typing tools are very liberal when they see Any in a different way when they see any other type, even object which is the base type of literally everything in the Python interpreter.

Let's try right now to see if theres any difference; first apply this diff:

diff --git a/lib/sqlalchemy/orm/_typing.py b/lib/sqlalchemy/orm/_typing.py
index 36dc6ddb9c..c433d98a72 100644
--- a/lib/sqlalchemy/orm/_typing.py
+++ b/lib/sqlalchemy/orm/_typing.py
@@ -55,7 +55,7 @@ _T_co = TypeVar("_T_co", bound=Any, covariant=True)
 
 # I would have preferred this were bound=object how…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@pamelafox
Comment options

@zzzeek
Comment options

@zzzeek
Comment options

Answer selected by pamelafox
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants