From 6bc016a76205aefad3ba6f21a89053a318eeb88e Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 9 Dec 2009 00:00:48 +0000 Subject: [PATCH] documentation patch for [ticket:1354] --- doc/build/sqlexpression.rst | 6 ++++++ lib/sqlalchemy/sql/expression.py | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/build/sqlexpression.rst b/doc/build/sqlexpression.rst index 0ebcfa7878..06b2eeb5f4 100644 --- a/doc/build/sqlexpression.rst +++ b/doc/build/sqlexpression.rst @@ -426,6 +426,12 @@ If you have come across an operator which really isn't available, you can always >>> print users.c.name.op('tiddlywinks')('foo') users.name tiddlywinks :name_1 +This function can also be used to make bitwise operators explicit. For example:: + + somecolumn.op('&')(0xff) + +is a bitwise AND of the value in `somecolumn`. + Conjunctions ============= diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index b7708c338d..a87ef9bd1b 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -1588,11 +1588,17 @@ class _CompareMixin(ColumnOperators): somecolumn * 5 - operator - a string which will be output as the infix operator between + + :param operator: a string which will be output as the infix operator between this ``ClauseElement`` and the expression passed to the generated function. + This function can also be used to make bitwise operators explicit. For example:: + + somecolumn.op('&')(0xff) + + is a bitwise AND of the value in somecolumn. + """ return lambda other: self.__operate(operator, other) -- 2.47.3