A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-March/002927.html below:

[Python-Dev] yeah! for Jeremy and Greg

[Python-Dev] yeah! for Jeremy and GregBarry A. Warsaw bwarsaw@cnri.reston.va.us
Tue, 28 Mar 2000 20:02:16 -0500 (EST)
Changing the definition of class Nums to

class Nums:
    def __getitem__(self, i):
        if 0 <= i < 10: return i
        raise IndexError
    def __len__(self):
        return 10

I.e. adding the __len__() method avoids the SystemError.

Either the *arg call should not depend on the sequence being
lenght-able, or it should error check that the length calculation
doesn't return -1 or raise an exception.

Looking at PySequence_Length() though, it seems that m->sq_length(s)
can return -1 without setting a type_error.  So the fix is either to
include a check for return -1 in PySequence_Length() when calling
sq_length, or instance_length() should set a TypeError when it has no
__len__() method and returns -1.

I gotta run so I can't follow this through -- I'm sure I'll see the
right solution from someone in tomorrow mornings email :)

-Barry



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4