Vladimir

10%
Flag icon
A search like k in my_dict.keys() is efficient in Python 3 even for very large mappings because dict.keys() returns a view, which is similar to a set, as we’ll see in “Set Operations on dict Views”. However, remember that k in my_dict does the same job, and is faster because it avoids the attribute lookup to find the .keys method.
Fluent Python: Clear, Concise, and Effective Programming
Rate this book
Clear rating
Open Preview