Python: Be cautious when using generators/iterators in nested loops
Simply because generators/itertors would drain.
Simply because generators/itertors would drain.
用单个下标 access 直接返回 list 的单个 element,用 slice (或者严格一点说是用一个 slice object 去 access) 返回一个 sub-list,这俩都是很常见的操作。但是:
假设我们有一个 class Test,有一个 @staticmethod foo:
Summary
1. 求 min/max sub-array 或 sub-string 问题的套路
参考 Quicksort with Python
参考:
Question: Find the $k$-th Smallest Element in an Unsorted Array
Looks like I’ve been wrong for years… maybe because I am too familiar with the SQL-style groupby operation.