
Ron Adam <rrr@ronadam.com> wrote:
There are enough correct uses of it in the wild to keep the behavior, but it can be done in a better way.
I feel it really should be called set_keys and implemented as a method that operates on the current dictionary instead of being a constructor for a new dictionary. That will allow you to add keys with a default value to an already existing dictionary, or to create a new one with a dictionary constructor.
dict().set_keys(s, v=None) # The current fromkeys behavior.
The problem with that is that when a method mutates an object, it shouldn't return the object. Your new .set_keys() method violates this behavior that is used in lists, sets, dicts, deques, arrays, etc. I don't have time to comment on the rest at the moment, will do when I get a chance. - Josiah