Re: Supporting list()

Discussion in 'Python' started by Skip Montanaro, Dec 17, 2012.

  1. > If using __getitem__ it needs to work with integers from 0 to len(f)-1,
    > and raise IndexError for len(f), len(f+1), etc.


    Ah, thanks. I have a __getitem__ method, but it currently doesn't raise
    IndexError. (I'm indexing into a ring buffer, and the usage of the class
    pretty much precludes indexing with an out-of-bounds index.)

    S
     
    Skip Montanaro, Dec 17, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lin Chat
    Replies:
    3
    Views:
    101
    Huw Collingbourne
    May 30, 2008
  2. Skip Montanaro

    Supporting list()

    Skip Montanaro, Dec 17, 2012, in forum: Python
    Replies:
    0
    Views:
    137
    Skip Montanaro
    Dec 17, 2012
  3. Dave Angel

    Re: Supporting list()

    Dave Angel, Dec 17, 2012, in forum: Python
    Replies:
    0
    Views:
    146
    Dave Angel
    Dec 17, 2012
  4. Ethan Furman

    Re: Supporting list()

    Ethan Furman, Dec 17, 2012, in forum: Python
    Replies:
    0
    Views:
    182
    Ethan Furman
    Dec 17, 2012
  5. Ethan Furman

    Re: Supporting list()

    Ethan Furman, Dec 17, 2012, in forum: Python
    Replies:
    0
    Views:
    172
    Ethan Furman
    Dec 17, 2012
Loading...

Share This Page