-
Notifications
You must be signed in to change notification settings - Fork 97
Closed
Description
Current Results
in gpython
>>>> d_list = {'a' : 1, 'b' : 2}
>>>> for k, v in d_list.items("hi"):
>>>> print(k,':',v)
a : 1
b : 2
in python
>>>> d_list = {'a' : 1, 'b' : 2}
>>>> for k, v in d_list.items("hi"):
>>>> print(k,':',v)
Traceback (most recent call last):
File "test.py", line 2, in <module>
for k, v in d_list.items("hi"):
TypeError: items() takes no arguments (1 given)
Lines 30 to 39 in af17d7d
func init() { | |
StringDictType.Dict["items"] = MustNewMethod("items", func(self Object, args Tuple) (Object, error) { | |
sMap := self.(StringDict) | |
o := make([]Object, 0, len(sMap)) | |
for k, v := range sMap { | |
o = append(o, Tuple{String(k), v}) | |
} | |
return NewIterator(o), nil | |
}, 0, "items() -> list of D's (key, value) pairs, as 2-tuples") | |
} |
I think we should add an error to this part of the code.
Metadata
Metadata
Assignees
Labels
No labels