DanielStutzbach / blist

A list-like type with better asymptotic performance and similar performance on small lists
Other
310 stars 36 forks source link

blist.blist subclasses can't have custom operators #42

Open tzot opened 12 years ago

tzot commented 12 years ago

I assume this is categorized as list compatibility.

class CustomList(list):
  def __div__(self, count):
    return 5
>>> l= CustomList()
>>> l/1
5

class CustomBlist(blist.blist):
  def __div__(self, count):
    return 4
>>> l= CustomBlist()
>>> l/1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for /: 'CustomBlist' and 'int'
tzot commented 12 years ago

Sorry for the bad code formatting, I probably misinterpreted the instructions in GitHub Flavored Markdown.