On Sat, 27 Apr 2013 15:23:40 -0700, Gary Miguel <gar...@gmail.com> 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 _______________________________________________ stdlib-sig mailing list stdlib-sig@python.org http://mail.python.org/mailman/listinfo/stdlib-sig