Checking if a variable is a dictionary

Guillermo guillermo.listas at googlemail.com
Sun Mar 9 08:20:41 EDT 2008


>A protocol is just an interface that an object agrees to implement. In
>your case, you would state that every object stored in your special
>dict must implement the to_tagged_value method with certain agreeable
>semantics.

Hm... I've searched about the implementation of protocols and now (I
believe) I know how to implement the iterable protocol, for instance,
but have no clue about how to define my own... I'm surely not thinking
the right way, but I don't seem to be able to wrap my head around the
implementation details of "custom" protocols... Is it just a matter of
extending the different object classes (dict, list, tuple...)? Where
do you put the interface/protocol code? :-?

Regards,

Guillermo



More information about the Python-list mailing list