Skip to content

Comment on Python: copying a list the right way

Comments

I went through my code and discovered that I seldom copy lists. I do often make selections from lists in a new list, i.e:

    b = [x for x in a if somecondition(x)]
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.