[Tutor] Why doesn't this filter FutureWarning?

Terry Carroll carroll at tjc.com
Wed Oct 20 20:08:15 CEST 2004


On Wed, 20 Oct 2004, Kent Johnson wrote:

> At 09:48 PM 10/19/2004 -0700, Terry Carroll wrote:
> > >      num=num & 0xffffffff
> >
> >You know, it occurred to me that ANDing a value with all ones was
> >essentially a no-op
> 
> as long as num <= 0xffffffff ...

You mean as an unsigned number, right?  i.e., as long as it's a 32-bit 
number?  I'm fairly certain I can count on that.  As it turns out, if 
that's wrong, worst case is the function returns incorrect data, which I 
don't use anyway, so I can deal with it.  (The code is a ping routine at 
ftp://ftp.visi.com/users/mdc/ping.py ; I don't care about the time, so 
much as connectivity.)



More information about the Tutor mailing list