From 75ceae6ea6493d44d616df1f21d180b3e7a2e8f5 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 9 Mar 2017 17:38:21 -0500 Subject: [PATCH] - add a note as to why we have this very complicated Annotated system Change-Id: I7d4048b92fcd3a7c7630c43aa9390d983f447c0a --- lib/sqlalchemy/sql/annotation.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/sqlalchemy/sql/annotation.py b/lib/sqlalchemy/sql/annotation.py index 834c93912f..e6f6311c48 100644 --- a/lib/sqlalchemy/sql/annotation.py +++ b/lib/sqlalchemy/sql/annotation.py @@ -26,6 +26,13 @@ class Annotated(object): reason of keeping its hash value current. When GC'ed, the hash value may be reused, causing conflicts. + .. note:: The rationale for Annotated producing a brand new class, + rather than placing the functionality directly within ClauseElement, + is **performance**. The __hash__() method is absent on plain + ClauseElement which leads to significantly reduced function call + overhead, as the use of sets and dictionaries against ClauseElement + objects is prevalent, but most are not "annotated". + """ def __new__(cls, *args): -- 2.47.2