Views in Python3.1?

前端 未结 3 1019
天命终不由人
天命终不由人 2021-02-18 17:50

What exactly are views in Python3.1? They seem to behave in a similar manner as that of iterators and they can be materialized into lists too. How are iterators and views differ

3条回答
  •  旧时难觅i
    2021-02-18 18:21

    I would recommend that you read this. It seems to do the best job of explaining.

    As far as I can tell, views seem to be associated more with dicts and can be forced into lists. You can also make an iterator out of them, through which you could then iterate (in a for loop or by calling next)

    Update: updated link from wayback machine

提交回复
热议问题