PEP 681: Remove hash alias for unsafe_hash#2454
PEP 681: Remove hash alias for unsafe_hash#2454JelleZijlstra merged 1 commit intopython:mainfrom debonte:hash
Conversation
|
I understand that the field argument is not relevant to this PEP, but it seems like this PEP is kind of enforcing to have a inconsistent naming between decorator ( |
|
@hynek You might want to bring this up on the PEP's discussion thread |
@hynek, I don't see this as an inconsistency. The |
|
The was my first thought too, so I checked the dataclasses docs and it says:
The discouraged part makes it weird to me to have one argument have a different name than the overarching one. Anyhow it’s not that I super care about it, it just sprung into my eye while looking at related attrs code. I’m currently sick though on a phone, so I have no time to work on this in any way (including PEP threads). I try to add the alias for the next release. |
@davidfstr pointed out that having a
hashalias forunsafe_hashis disguising a potentially unsafe feature as safe.We don't remember why we added a
hashalias. It may have been a mistake. Or it may have been added because attrs uses hash instead of unsafe_hash. However, the attrs documentation recommends against setting hash, so this should be unusual. Attrs can add anunsafe_hashalias on their side if needed.cc: @hynek