Design thought for callbacks

Laura Creighton lac at openend.se
Sun Feb 22 17:29:07 EST 2015


In a message of Sun, 22 Feb 2015 17:09:01 -0500, Cem Karan writes:

>Documentation is a given; it MUST be there.  That said, documenting
>something, but still making it surprising, is a bad idea.  For
>example, several people have been strongly against using a WeakSet to
>hold callbacks because they expect a library to hold onto callbacks.
>If I chose not to do that, and used a WeakSet, then even if I
>documented it, it would still end up surprising people (and from the
>sound of it, more people would be surprised than not).

>Thanks, Cem Karan

No matter what you do, alas, will surprise the hell out of people
because callbacks do not behave as people expect.  Among people who
have used callbacks, what you are polling is 'what are people
familiar with', and it seems for the people around here, now,
WeakSets are not what they are familiar with.

But that is not so surprising.  How many people use WeakSets for
_anything_?  I've never used them, aside from 'ooh! cool shiny
new language feature!  Let's kick it around the park!'  That people
aren't familiar with WeakSets doesn't mean all that much.

The question I have is does this architecture make things harder,
easier or about the same to debug?  To write tests for? to do Test
Driven Design with?

Laura



More information about the Python-list mailing list