[wplug] cores

Tom Rhodes trhodes at FreeBSD.org
Mon Mar 3 13:44:30 EST 2008


On Mon, 3 Mar 2008 09:16:52 -0800 (PST)
terry mcintyre <terrymcintyre at yahoo.com> wrote:

> It appears that python does do bitwise operations:
> 
> http://python.active-venture.com/ref/bitwise.html
> 
> http://wiki.python.org/moin/BitwiseOperators
> 
> 
> --- Tom Rhodes <trhodes at FreeBSD.org> wrote:
> 
> > On Sun, 2 Mar 2008 18:12:31 -0500
> > "Max Putas" <maxblaze at gmail.com> wrote:
> > 
> > > Python's strength is its "batteries included"
> > approach. I've written a
> > > network protocol and a client/server app to go
> > with it in python so I
> > > don't doubt its usefulness ;)
> > > 
> > > As for the IP/netmask problem, there's a package
> > out there that will
> > > handle both IPv4 as well as IPv6 addresses in this
> > regard very nicely:
> > > 
> > > http://pypi.python.org/pypi/IPy/
> > > 
> > > On Sun, Mar 2, 2008 at 5:53 PM, Mackenzie Morgan
> > <macoafi at gmail.com> wrote:
> > > > Seriously....what about Whitespace?  Or Brain
> > Fuck?  Or Shakespeares'
> > > > Programming Language?
> > > >
> > > >
> > > >
> > > > On Sun, Mar 2, 2008 at 5:41 PM, Jonathan S.
> > Billings <wbanguna at gmail.com>
> > > > wrote:
> > > >
> > > > >
> > > > > On Sun, Mar 02, 2008 at 11:23:14AM -0500, Tom
> > Rhodes wrote:
> > > > > > Python is the worst, most useless
> > programming language I have
> > > > > > seen and I DARE ANYONE to argue with me.  :P
> > > > >
> > > > > I think you just haven't seen enough
> > programming languages, if you
> > > > > think Python is the most useless.
> > > > >
> > > > >
> > > > > --
> > > > > Jonathan Billings <wbanguna at gmail.com>
> > > > >
> > _______________________________________________
> > 
> > Still seems to require hardcoding on some level and
> > doesn't
> > really allow me to do the bitwise ops I was
> > expecting.  Either
> > way, I'm dropping this and will probably end up
> > using a
> > completely different language.


>>> x=ctypes.c_uint32(~0)
>>> x
c_ulong(4294967295L)
>>> x << 1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for <<: 'c_ulong' and 'int'

>>> x=ctypes.c_uint32(~0)
>>> x
c_ulong(4294967295L)
>>> x << 1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for <<: 'c_ulong' and 'int'

>>> u=ctypes.c_uint32
>>> x << u(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for <<: 'c_ulong' and 'c_ulong'

With what I want to accomplish, the python types aren't anywhere
near flexible enough to do properly.  I've never said it was
impossible to bitwise operations though, I just noted it doesn't
do it the way I thought/wanted.

-- 
Tom Rhodes


More information about the wplug mailing list