... | @@ -93,7 +93,7 @@ where this would impact performance, use an `rpython.compat.iteritems` function. |
... | @@ -93,7 +93,7 @@ where this would impact performance, use an `rpython.compat.iteritems` function. |
|
We should keep these methods in some py2-only test snippets, to check we still support
|
|
We should keep these methods in some py2-only test snippets, to check we still support
|
|
them.
|
|
them.
|
|
|
|
|
|
### Making a `\_\_hash\_\_` of it
|
|
### Making a \_\_hash\_\_ of it
|
|
|
|
|
|
If a class implements `__eq__` it will now need `__hash__` to end up in a dictionary or
|
|
If a class implements `__eq__` it will now need `__hash__` to end up in a dictionary or
|
|
set. I'd love to go with something like `hash(repr(self))`, but I think the inclusion of
|
|
set. I'd love to go with something like `hash(repr(self))`, but I think the inclusion of
|
... | @@ -103,6 +103,14 @@ variant of `hash(tuple(self.__dict__.items()))` is a good default? |
... | @@ -103,6 +103,14 @@ variant of `hash(tuple(self.__dict__.items()))` is a good default? |
|
Note: we only need to implement this for things we want to hash. Some experimentation
|
|
Note: we only need to implement this for things we want to hash. Some experimentation
|
|
is needed.
|
|
is needed.
|
|
|
|
|
|
|
|
### Comparing \_\_cmp\_\_ and \_\_lt\_\_
|
|
|
|
|
|
|
|
We need an `rpython.compat.cmp` and, for classes implementing `__cmp__` ideally a way of auto-defining `__lt__`, `__gt__` and friends from this.
|
|
|
|
|
|
|
|
### Comparison is no longer default for classes
|
|
|
|
|
|
|
|
We will need to use e.g. `key=id` in sort functions
|
|
|
|
|
|
### Relative imports
|
|
### Relative imports
|
|
|
|
|
|
We will probably need a few imports from `import foo` to `from . import foo`.
|
|
We will probably need a few imports from `import foo` to `from . import foo`.
|
... | | ... | |