How to modify meaning of builtin function "not" to "!"?
castironpi at gmail.com
castironpi at gmail.com
Fri May 9 10:01:06 EDT 2008
On May 9, 8:41 am, grbgooglefan <ganeshbo... at gmail.com> wrote:
> I am creating functions, the return result of which I am using to make
> decisions in combined expressions.
> In some expressions, I would like to inverse the return result of
> function.
>
> E.g. function contains(source,search) will return true if "search"
> string is found in source string.
> I want to make reverse of this by putting it as:
> if ( ! contains(s1,s2) ):
> return 1
>
> I found that "!" is not accepted by Python & compile fails with
> "invalid syntax".
> Corresponding to this Boolean Operator we've "not" in Python.
>
> How can I make "not" as "!"?
I have found that not 8, not not 8, and ~8 are all valid. Valid8 is
not.
NameError: name 'Valid8' is not defined, where defined is not defined,
and @Valid8 @Valid8 ...
Late-binding logicals are fine. #Valid8
More information about the Python-list
mailing list