George Sakkis <[EMAIL PROTECTED]> writes:
> For example, consider the container methods __len__, __iter__ and
> __contains__. The obvious choice for a null container is an empty
> one. When taking __getitem__ into account though, the behaviour
> looks inconsistent:
> >>> Null[3]
> Null
>
I'd like to extend the Null pattern from
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/68205 to
handle special methods (e.g. Null[3], del Null['key'], Null+1) but
it's not always clear how to do it while keeping the behavior
consistent and intuitive.
For example, co