Jun. 21st, 2007

dzz: Dizzy の春 (Default)
Лёгким движением руки ускорил чужой код на питоне примерно в 60 раз ;)))

Было:

rows = [] cols = [] for key in values.keys(): row, col = key if not col in cols: cols.append(col) if not row in rows: rows.append(row) n_rows = max(rows) n_cols = max(cols)
Стало:
n_rows = 0 n_cols = 0 for key in values.keys(): row, col = key if row > n_rows: n_rows = row if col > n_cols: n_cols = col


В общем, типическое "Кто так пишет..." :)))

April 2026

S M T W T F S
   1 2 34
56 7 891011
1213141516 1718
19202122232425
2627282930  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Apr. 20th, 2026 06:43 pm
Powered by Dreamwidth Studios