[bind10-dev] Python classes vs modules vs other funny stuff

Michael Graff mgraff at isc.org
Mon Oct 12 14:22:27 UTC 2009


Right now, the message en/decoding library I wrote uses this format:

   m = ISC.CC.Message()
   wire_format = m.to_wire({...})
   decoded = m.from_wire(wire_format)

What I would like is this:

   wire_format = ISC.CC.Message.to_wire({...})
   decoded = ISC.CC.Message.from_wire(wire_format)

That is, I don't need an instance of a class here, as there is no 
internal state.  Each encode/decode is merely a function, under 
ISC.CC.Message name space.

I do not know how to do this in Python.  Can someone shed some light on 
this?

--Michael



More information about the bind10-dev mailing list