In article <mailman.6914.1392380171.18130.python-l...@python.org>, Dave Angel <da...@davea.name> wrote:
> Terry Reedy <tjre...@udel.edu> Wrote in message: > > On 2/13/2014 1:37 PM, forman.si...@gmail.com wrote: > >> I ran across this and I thought there must be a better way of doing it, > >> but then after further consideration I wasn't so sure. > >> > >> if key[:1] + key[-1:] == '<>': ... > > > > if key[:1] == '<' and key[-1:] == '>: ... > > is the obvious choice to me. If the first clause is false, it never > > computes the second. > > > And therefore no need for the second colon. > > if key[:1] == '<' and key[-1] == '>: ... I'd leave the second colon in. It makes the statement more uniform, and therefor easier to understand. -- https://mail.python.org/mailman/listinfo/python-list