How to inherit and extend a list object in Python?

后端 未结 4 1696
盖世英雄少女心
盖世英雄少女心 2020-12-05 04:14

I am interested in using the python list object, but with slightly altered functionality. In particular, I would like the list to be 1-indexed instead of 0-indexed. E.g.:

4条回答
  •  隐瞒了意图╮
    2020-12-05 04:32

    Instead, subclass integer using the same method to define all numbers to be minus one from what you set them to. Voila.

    Sorry, I had to. It's like the joke about Microsoft defining dark as the standard.

提交回复
热议问题