-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot subclass? #40
Comments
Hi @pombredanne, given that |
* FIX Fixes implementation of del x[123] operator which was wrongly defined as __del__ rathern than __delitem__. (Closes inveniosoftware-contrib#40) Signed-off-by: Samuele Kaplun <[email protected]> Reported-by: Philippe Ombredanne <[email protected]>
Dear @pombredanne, the proposed PR should fix the So to implement your initialization you could for example write: from intbitset import intbitset
class MySet(intbitset):
def __init__(self, a1, a2):
# self is already an initalized empty intbitset
self.union_update(range(a1, a2)) |
* FIX Fixes implementation of `del x[123]` operator which was wrongly defined as `__del__` rathern than `__delitem__`. (closes inveniosoftware-contrib#40) Signed-off-by: Samuele Kaplun <[email protected]> Reported-by: Philippe Ombredanne <[email protected]>
* FIX Fixes implementation of `del x[123]` operator which was wrongly defined as `__del__` rathern than `__delitem__`. (closes inveniosoftware-contrib#40) Signed-off-by: Samuele Kaplun <[email protected]> Reported-by: Philippe Ombredanne <[email protected]>
* FIX Fixes implementation of `del x[123]` operator which was wrongly defined as `__del__` rather than `__delitem__`. (closes inveniosoftware-contrib#40) Signed-off-by: Samuele Kaplun <[email protected]> Reported-by: Philippe Ombredanne <[email protected]>
Ah additionally:
This will not always work because the hash function of In [1]: {set([1,2,3]): 1}
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-1-d01249751226> in <module>()
----> 1 {set([1,2,3]): 1}
TypeError: unhashable type: 'set' See also: #16 |
@kaplun Thanks ++ But there is still something not right though IMHO:
I would expect a MySet object instead of an intbitset. For instance with a set:
I get the right subclass:
|
That's probably due to the fact that the |
@kaplun hold that thought then. I may able to get the exact same results by delegation rather than inheritance. |
FWIW, you may want to reopen this |
Do you mean WRT operators returning explicitly |
Actually |
For instance this works nicely...
well I still need to override union though
|
Hi:
I am trying to create a simple subclass of
intbitset
without luck:and then in the same session as above:
The text was updated successfully, but these errors were encountered: