[Twisted-Python] twisted.names and multicast DNS

Tim Allen screwtape at froup.com
Mon Jul 11 08:35:16 EDT 2005

On 11 Jul 2005, at 04:16, Jp Calderone wrote:
> What's hacky about this?  It seems like a simple, straightforward 
> solution.  Record classes have comparison defined one way, you want to 
> compare them another way.  Comparison can only be defined one way 
> using the "==" operator, so clearly one of these requirements has to 
> resort to using something other than the "==" operator.

Well, it would be nicer still if the world would conform to my 
requirements. :)

I was sort of hoping that someone would pop their head out of the 
woodwork and say 'No, it was designed this way because it makes 
such-and-such a task much easier', or even 'Nobody much cares either 
way, we're taking patches'.

> I think it's even nicer than you suggest, since the attributes which 
> should be compared are all declared on each class.  eg, 
> Record_NS.compareAttributes == ('name', 'ttl').  You should be able to 
> write a comparison function that looks at this attribute and simply 
> omits ttl.

I was a bit nervous about relying on undocumented instance variables of 
a module marked as 'unstable', but I suppose since I'm already relying 
on an unstable module, one more assumption isn't going to hurt.


More information about the Twisted-Python mailing list