Andrew Dalke <[EMAIL PROTECTED]> writes:
> What does
>   a = MyClass()
>   b = AnotherClass()
>   for x in a .. b:
>     print x
> 
> do?  That is, what's the generic protocol?  

".." just becomes an operator like + or whatever, which you can define
in your class definition:

    class MyClass:
       def __dotdot__(self, other):
          return xrange(self.whatsit(), other.whatsit())

The .. operation is required to return an iterator.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to