Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: Overriding logical operators? (http://www.velocityreviews.com/forums/t334714-re-overriding-logical-operators.html)

Terry Reedy 08-21-2004 07:35 AM

Re: Overriding logical operators?
 

"Andrew Durdin" <adurdin@gmail.com> wrote in message
news:59e9fd3a04082022392b749256@mail.gmail.com...
> I noticed that, although there are special methods for most operators,
> they are conspicuously absent for the logical "or" and "and". I'm
> guessing that the reason for this is that these operators
> short-circuit if their first operand answers the whole question?


If you think of a op b as being an alternate, abbreviated syntax for the
function call op(a,b), then short-circuiting 'and' and 'or' are not really
operators. Various Lisp dialects have various terms, such as 'special
form' for syntax that looks like a normal function call but isn't. I think
we need a special term in Python also, such as 'pseudo-op' or 'syntax
operator' to flag 'and' and 'or' as importantly different from regular
operators.

Terry J. Reedy




Greg Ewing 08-24-2004 04:52 AM

Re: Overriding logical operators?
 
Terry Reedy wrote:
> I think
> we need a special term in Python also, such as 'pseudo-op' or 'syntax
> operator' to flag 'and' and 'or' as importantly different from regular
> operators.


They're really control structures, like 'if' and 'while'.
The fact that they happen to look a bit like operators is
purely coincidental...

--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg


Terry Reedy 08-24-2004 05:49 AM

Re: Overriding logical operators?
 

"Greg Ewing" <greg@cosc.canterbury.ac.nz> wrote in message
news:2ovvrmFcu6r6U1@uni-berlin.de...
> Terry Reedy wrote:
> > I think
> > we need a special term in Python also, such as 'pseudo-op' or 'syntax
> > operator' to flag 'and' and 'or' as importantly different from regular
> > operators.

>
> They're really control structures, like 'if' and 'while'.
> The fact that they happen to look a bit like operators is
> purely coincidental...


Ok, I'll think of them as 'control words' for now.

tjr





All times are GMT. The time now is 08:13 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.