[Twisted-Python] SMTP patch
Jp Calderone
exarkun at intarweb.us
Fri May 23 10:55:45 MDT 2003
On Fri, May 23, 2003 at 01:13:35PM +1000, Andrew Bennetts wrote:
> On Thu, May 22, 2003 at 11:02:53PM -0400, Jp Calderone wrote:
> > On Fri, May 23, 2003 at 11:05:24AM +1000, Andrew Bennetts wrote:
> > > On Thu, May 22, 2003 at 04:48:35PM +0200, Anders Hammarquist wrote:
> > > > Make sure to drop any references to the file object containing the
> > > > message data.
> > > >
> > >
> > > > + if code in xrange(200,300):
> > >
> > > I think a much better way to do this is:
> > >
> > > if 200 <= code <= 300:
> > >
> >
> > Interestingly, there was a thread on PyPy-dev on this subject. I think
> > I agree with the line of thinking that says "x in y" expresses the intent
> > more accurately and at a higher level than "a <= x < y". xrange() is a hack
> > though, so I would use range() :)
>
> Oops! As you imply, that should've been "200 <= code < 300". I still don't
> like the idea of constructing 100 integers, even lazily, just to test
> bounds, though.
Neither do I. Python should optimize it. ;)
Jp
--
A disciple of another sect once came to Drescher as he was eating his
morning meal. "I would like to give you this personality test," said the
outsider, "because I want you to be happy." Drescher took the paper that was
offered him and put it into the toaster: "I wish the toaster to be happy,
too."
--
up 21 days, 14:40, 0 users, load average: 0.00, 0.00, 0.00
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: </pipermail/twisted-python/attachments/20030523/eee54b52/attachment.sig>
More information about the Twisted-Python
mailing list