Skip to content

Show the type of the return value in "hash" #137659

@Locked-chess-official

Description

@Locked-chess-official

Feature or enhancement

Proposal:

Sometimes showing the type of the result can be helpful to debug:

class A:
    def hash(self):
        return exit
a = A()
m= {}
m[a] = 1

The new message is : "cannot use 'A' as a dict key (__hash__ method should return an integer, returned 'Quitter')"

Sometimes there may be one or more paths that __hash__ doesn't return an integer, show what was returned can be helpful to find the mistake.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions