Efficiency of using a Python list as a queue

后端 未结 5 2057
南笙
南笙 2021-01-30 00:51

A coworker recently wrote a program in which he used a Python list as a queue. In other words, he used .append(x) when needing to insert items and .pop(0)

5条回答
  •  天涯浪人
    2021-01-30 01:30

    it sounds like a bit of empirical testing might be the best thing to do here - second order issues might make one approach better in practice, even if it's not better in theory.

提交回复
热议问题