
On Fri, Mar 10, 2017 at 11:29 AM, Erik <python@lucidity.plus.com> wrote:
On 09/03/17 23:04, Spencer Brown wrote:
Might make more sense to be dict.default(int), that way it doesn't have redundant dict names.
I thought that, too.
since you could do {1:2, 3:4}.default(int)
Could you?
Python 3.6.0 (default, Mar 9 2017, 00:43:06) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information.
type(dict()) <class 'dict'> type({}) <class 'dict'> type(dict) <class 'type'>
The thing bound to the name 'dict' is not the same as the object returned by _calling_ 'dict'.
Yes, you could; it'd be a classmethod, like dict.fromkeys. IMO it should just ignore any instance argument - same as you see here:
dict.fromkeys(range(3)) {0: None, 1: None, 2: None} {1:2,3:4}.fromkeys(range(3)) {0: None, 1: None, 2: None}
ChrisA