This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author methane
Recipients methane
Date 2012-12-19.12:14:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1355919289.81.0.186820029813.issue16728@psf.upfronthosting.co.za>
In-reply-to
Content
http://docs.python.org/3.3/glossary.html#term-sequence

__getitem__ and __len__ are required for sequence type.
(__iter__ is not required because types having __getitem__ are already iterator.)

.__contains__(), .index() and .count() is not required for sequence.

For example, following class should be sequence.

class Foo:
    def __getitem__(self, index):
        if not isinstance(index, int):
            raise TypeError
        if index >= 3:
            raise IndexError
        return index

    def __len__(self):
        return 3
History
Date User Action Args
2012-12-19 12:14:49methanesetrecipients: + methane
2012-12-19 12:14:49methanesetmessageid: <1355919289.81.0.186820029813.issue16728@psf.upfronthosting.co.za>
2012-12-19 12:14:49methanelinkissue16728 messages
2012-12-19 12:14:49methanecreate