On Mar 2, 8:29 am, Veloz <michaelve... at gmail.com> wrote: > Hi all > I'm looking for a queue that I can use with multiprocessing, which has > a peek method. > > I've seen some discussion about queue.peek but don't see anything in > the docs about it. > > Does python have a queue class with peek semantics? Am curious about your use case? Why peek at something that could be gone by the time you want to use it. val = q.peek() if something_i_want(val): v2 = q.get() # this could be different than val Wouldn't it be better to just get() the value and return if you don't need it? val = q.peek() if not something_i_want(val): q.put(val) Raymond
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4