Python中最好的队列实现是什么? [英] What is the best queue implemetation in Python?
问题描述
我想编写一个代码用于图表的广度第一Traveral,它需要一个
队列来实现。
我想知道这么强大语言为Python,对于传统的FIFO队列是否有更好更简单的实现?
谢谢!
I want to write a code for Breadth First Traveral for Graph, which needs a
queue to implement.
I wonder that for such a powerful language as Python, whether there is a
better and simpler implementation for a traditional FIFO queue?
Thanks!
推荐答案
2月23日上午11点12分,John < rds1 ... @ sh163.netwrote:
On Feb 23, 11:12 am, "John" <rds1...@sh163.netwrote:
我想编写一个代码用于图表的广度优先交易,需要一个
队列实现。
我想知道对于像Python这样强大的语言,传统的FIFO队列是否有更好更简单的实现?
I want to write a code for Breadth First Traveral for Graph, which needs a
queue to implement.
I wonder that for such a powerful language as Python, whether there is a
better and simpler implementation for a traditional FIFO queue?
比* WHAT *更好更简单?
Better and simpler than *WHAT*?
比C或PASCAL
我的意思是,Python中的列表或字典比传统的
数组强大得多。也许我可以利用它?
" John Machin" < sj ****** @ lexicon.netwrote in message
news:11 ********************** @ v45g2000cwv .googlegr oups.com ...
Than C or PASCAL
I mean, list or dictionary in Python are so powerful than the traditional
array. Maybe I can make use of it?
"John Machin" <sj******@lexicon.netwrote in message
news:11**********************@v45g2000cwv.googlegr oups.com...
2月23日上午11点12分,John < rds1 ... @ sh163.netwrote:
On Feb 23, 11:12 am, "John" <rds1...@sh163.netwrote:
我想编写一个代码用于图表的广度优先交易,需要
I want to write a code for Breadth First Traveral for Graph, which needs
a
a
要实施的队列。
我想知道对于像Python这样强大的语言,传统的FIFO队列是否有更好更简单的实现?
queue to implement.
I wonder that for such a powerful language as Python, whether there is a
better and simpler implementation for a traditional FIFO queue?
比* WHAT *更好更简单?
Better and simpler than *WHAT*?
2月23日上午11点24分,John < rds1 ... @ sh163.netwrote:
On Feb 23, 11:24 am, "John" <rds1...@sh163.netwrote:
比C或PASCAL
我的意思是,Python中的列表或字典是如此强大比传统的
数组。也许我可以利用它?
Than C or PASCAL
I mean, list or dictionary in Python are so powerful than the traditional
array. Maybe I can make use of it?
嗯,你可以使用Python列表来自己的队列管理器,
但是......
你有这种奇怪的不愿意查看文档。你试过谷歌吗?b
?尝试 http://docs.python.org/lib/deque-objects .html
或者您可能需要/需要Queue模块或heapq模块。
*您*找到它们并且*你*找出最适合*你*需要的东西。
如果你有一个你自己无法回答的问题,那就问吧。
这里。
HTH,
John
Well, you could wite your own queue manager using Python lists,
but ...
You have this strange reluctance to look in the documentation. Have
you tried Google? Try http://docs.python.org/lib/deque-objects.html
Or perhaps you want/need the Queue module or the heapq module.
*You* find them and *you* work out what is best for *your* needs.
If you have a question that you could not answer yourself, then ask it
here.
HTH,
John
>
" John Machin" < sjmac ... @ lexicon.netwrote in message
news:11 ********************** @ v45g2000cwv.googlegr oups.com ...
>
"John Machin" <sjmac...@lexicon.netwrote in message
news:11**********************@v45g2000cwv.googlegr oups.com...
2月23日上午11点12分,John < rds1 ... @ sh163.netwrote:
On Feb 23, 11:12 am, "John" <rds1...@sh163.netwrote:
我想编写一个代码用于图表的广度优先交易,需要
I want to write a code for Breadth First Traveral for Graph, which needs
a
a
要实施的队列。
queue to implement.
我想知道对于像Python这样强大的语言,是否有
更好,更简单的传统FIFO队列实现?
I wonder that for such a powerful language as Python, whether there is a
better and simpler implementation for a traditional FIFO queue?
比* WHAT *更好更简单?
Better and simpler than *WHAT*?
这篇关于Python中最好的队列实现是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!