Skip to main content
1 vote
4 answers
89 views

Python 3 seems not to execute the beginning of a generator function, from its first line up to the first yield at the time when the function is first called. Python seems to defer the initial ...
dakra137's user avatar
  • 178
0 votes
0 answers
118 views

I'm encountering an issue with the Boost.Asio library. My program uses a single io_context instance and multiple worker threads that call io_context::run(). Tasks are posted using spawn or post on the ...
Zohar81's user avatar
  • 5,216
1 vote
0 answers
98 views

So far I know, we use it mostly for list/array comprehension. Here is two codes: [ for x in range do (yield expression)] else we can also drop the yield and still it works [ for x in range do ...
Clemens Bartholdy's user avatar
-1 votes
3 answers
190 views

Very simple case: I have a list of items (1, 2, 3, 4, 5, 6, 7, 8, 9, 10). I need to filter it and drop a few first elements and a few last elements and to get a few items from the middle (for example ...
Andrew's user avatar
  • 33
0 votes
0 answers
68 views

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0&...
Ian Lewis's user avatar
2 votes
2 answers
276 views

When using for await...of to iterate over an async generator, the final value (return value) seems to be consumed and inaccessible afterward. Here's a minimal example: async function* exampleGenerator(...
Ron Zano's user avatar
  • 670
1 vote
1 answer
68 views

In the book "The Well-Grounded Rubyist" edition 3 on page 185 is the code. And the code for my_each is on page 183. It also involve code on page 184: Class Array # Put the definition of ...
Retufom's user avatar
  • 45
2 votes
2 answers
76 views

I created a generator to perform pagination on an api: def page_helper(req, timeout=5, page=1, **kwargs): print(f"Page {page}", end="\r") try: response = req(params=...
Jeroen Vermunt's user avatar
0 votes
1 answer
92 views

Nothing crazy what I am trying to achieve but I pull my hair on it for days. I basically want to achieve the following: a long running process does internet accesses and processing of data with many ...
Stéphane de Luca's user avatar
0 votes
1 answer
60 views

I have the following XML file: <?xml version="1.0" encoding="UTF-8"?> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:okp=&...
monopoly's user avatar
  • 686
1 vote
3 answers
118 views

I have var DICTIONARY, which is a dictionary where the keys are English letters and the values are words that start with the corresponding letter. The initial filling of DICTIONARY looks like this: ...
ERJAN's user avatar
  • 24.6k
-1 votes
1 answer
57 views

i have var DICTIONARY, which is a dictionary where the keys are English letters and the values are words that start with the corresponding letter. The initial filling of DICTIONARY looks like this: ...
ERJAN's user avatar
  • 24.6k
0 votes
1 answer
59 views

I have a Flask application that uses a RAG pipeline in the background, and I stream responses from vLLM. I'm currently using a function to parse and yield the streamed JSON responses. However, I'm ...
Cihan Yalçın's user avatar
0 votes
1 answer
118 views

Today, while programming, I found myself managing a resource (ssh connection) inside a generator function, something similar to the following: #I decided to use a generator to avoid looping through ...
Afelium's user avatar
  • 65
1 vote
1 answer
309 views

Inside an async method in C#, I need to defer the execution (return the execution to the caller), and also to clear the synchronization context before proceeding with the execution. The statement ...
Ricardo Rocha's user avatar

15 30 50 per page
1
2 3 4 5
121