shithon

Jul. 6th, 2021 01:11 am
[personal profile] ex0_planet
СЯУ что fold в python НЕ ИДИОМАТИЧЕН. Ну, то есть, существует functools.reduce, но там много своих гитик. Т.е. свернуть конструкцию
result=[]
for i in items:
  result.extend(i.members())

примерно никак. Слушайте песню «Валенки».

Отдельно доставляет питонский стековерфлоу, который в упор не отличает конкретику от абстрактного вопроса. Т.е. диалог в стиле:
— Чем заменить в питоне foldl, НАПРИМЕР в таком коде: "foldl (+) 0 [1,2,3,4,5]"
— А чем тебя sum не устраивает?

Практики, блин.
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

ex0_planet

April 2023

S M T W T F S
      1
234567 8
910111213 1415
16171819202122
23242526272829
30      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Apr. 25th, 2026 10:14 am
Powered by Dreamwidth Studios