Skip to content
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

Describe Template.__hash__() behavior in the spec. (And verify we like Template.__eq__().) #19

Closed
davepeck opened this issue Oct 22, 2024 · 0 comments
Assignees

Comments

@davepeck
Copy link
Owner

davepeck commented Oct 22, 2024

Given our definition of Template.__eq__(), probably it falls out as:

class Template:
    def __hash__(self):
        return hash(self.args)

class Interpolation:
    def __hash__(self):
        return hash((self.value, self.expr, self.conv, self.format_spec))

Which implies that Template is only hashable if all of its values is.

But @lysnikolaou perhaps something different will fall out of implementation?

@davepeck davepeck converted this from a draft issue Oct 22, 2024
@davepeck davepeck moved this to In Progress in PEP 750 Remaining Work Oct 22, 2024
@davepeck davepeck moved this from In Progress to Todo in PEP 750 Remaining Work Oct 22, 2024
@davepeck davepeck moved this from Todo to Done in PEP 750 Remaining Work Nov 12, 2024
@davepeck davepeck closed this as completed by moving to Done in PEP 750 Remaining Work Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants