From garymm at gmail.com Sun Apr 28 00:23:40 2013 From: garymm at gmail.com (Gary Miguel) Date: Sat, 27 Apr 2013 15:23:40 -0700 Subject: [stdlib-sig] binary logical operators in operator module Message-ID: Hi, This is my first time writing to a python list, so sorry if this message is misdirected. Recently I wrote something like: functools.reduce(lambda x, y: x and y, ...) and I was wondering why there is no logical and in the operator module. (http://docs.python.org/3.3/library/operator.html) Is there a reason for its not being there? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rdmurray at bitdance.com Sun Apr 28 00:51:46 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Sat, 27 Apr 2013 18:51:46 -0400 Subject: [stdlib-sig] binary logical operators in operator module In-Reply-To: References: Message-ID: <20130427225147.67C68250066@webabinitio.net> On Sat, 27 Apr 2013 15:23:40 -0700, Gary Miguel wrote: > Hi, > This is my first time writing to a python list, so sorry if this message is > misdirected. > Recently I wrote something like: > functools.reduce(lambda x, y: x and y, ...) > and I was wondering why there is no logical and in the operator module. > > (http://docs.python.org/3.3/library/operator.html) > > Is there a reason for its not being there? Yes. The logical operators are shortcut operators, and therefore there are no magic methods for implementing logical 'and' and 'or', and thus no operator functions for calling them. You may find the 'all' and 'any' built in functions to be of interest. FYI python-list is a better list for this kind of question. You are likely to get faster response there to most questions. This is more of a development list (currently pretty quiescent). --David