From: Mike Bayer Date: Wed, 9 Dec 2009 00:00:48 +0000 (+0000) Subject: documentation patch for [ticket:1354] X-Git-Tag: rel_0_6beta1~130 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6bc016a76205aefad3ba6f21a89053a318eeb88e;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git documentation patch for [ticket:1354] --- 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)