A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-October/029136.html below:

[Python-Dev] the not operator (and the __not__ special method)

[Python-Dev] the not operator (and the __not__ special method)Guido van Rossum guido@python.org
Thu, 03 Oct 2002 20:19:43 -0400
> [...] I guess it will be also good to have the special methods for
> the logical operations 'and', 'or' and 'not', (something like
> __land__, __lor__ and __lnot__ to distinguish them from the bitwise
> versions __and__ and __or__).
> 
> So, if you overload the proper logical methods, you can write
> something like
> 
>   cond = not (sin(x) > 0.5 ) and ( b <= 0.5 )
> 
> where 'not' and 'and', like '>' and '<=', wil return anything you want.

Sorry, that won't be possible any time soon.  If I allowed these
operators to be overloaded, they would lose their shortcut properties,
which are the reason for their existence.

--Guido van Rossum (home page: http://www.python.org/~guido/)



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4