Skip to main content
Tooling
2 votes
2 replies
91 views

I'm trying to optimize a function that processes a very large file line by line. I’ve seen some examples use the yield keyword, but I don't fully understand how it differs from return. When I use ...
Supratim Ghosh's user avatar
1 vote
0 answers
63 views

I'm trying to read .cif files (chemistry) using Pythons openbabel. For most files in my database this works perfectly fine, regardless of their size. For a handful of files, however, my code blocks ...
liz's user avatar
  • 35
4 votes
3 answers
162 views

I want to iterate through a list of size n, with A 1s in it (the rest are 0s), and I want the 1s randomly distributed. n and A are large, so I'm trying to make a generator instead of a list. If they ...
WeCanDoItGuys's user avatar
1 vote
4 answers
77 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
  • 170
1 vote
2 answers
87 views

This is a question about technical terminology. The vobject documentation says "readComponents is a generator", which is consistent with its doc string "Generate one Component at a time ...
user2153235's user avatar
  • 1,265
0 votes
1 answer
143 views

I have a python generator that yields a sample (np.ndarray, size: batchsize x ndim) of a larger dataset (np.ndarray, size: ndata x ndim). I coded a decorator that yields a processed output (dict) of ...
Krill TheWzrd's user avatar
0 votes
1 answer
53 views

While refactoring a middleware interceptor function, I moved this code for getting the db session: if get_async_session in request.app.dependency_overrides: get_session = request.app....
Myrto Pirli's user avatar
3 votes
0 answers
127 views

cppreference.com gives an example on how to use the c++23 std::generator. From https://en.cppreference.com/w/cpp/coroutine/generator.html: #include <generator> #include <iostream> ...
bad's user avatar
  • 111
-3 votes
1 answer
117 views

I have two JavaScript generator functions for permutations. They both provide Heap's enumeration. Question: I would like to know whether one implementation can be derived from the other by some ...
Hubert Kauker's user avatar
0 votes
0 answers
30 views

I was using generators in Dialogflow CX and every output response has a "\n" in the end even after fine tuning the prompt and I even tried it with simple output generations instead of ...
Ajay Kartheek's user avatar
0 votes
0 answers
59 views

I have built a Tensorflow Dataset from a generator but it seems to be very slow when training. In testing I cut the size of the dataset greatly and the training is much faster when uploaded as a ...
AdamS's user avatar
  • 11
2 votes
2 answers
141 views

I'd like to create a generator factory, i.e. a generator that yields generators, in python using a "generator expression" (generator equivalent of list comprehension). Here's an example: ...
njp's user avatar
  • 730
1 vote
0 answers
78 views

I'm trying to copy a generator by using PyGen_New by passing in a frame object. Thus far, I get the following error that I don't understand: Traceback (most recent call last): File "C:\test.py&...
Ben Tonks's user avatar
0 votes
0 answers
128 views

I’m working on a data processing pipeline in Python that needs to handle very large log files (several GBs). I want to avoid loading the entire file into memory, so I’m trying to use generators to ...
Waqas Gondal's user avatar
0 votes
1 answer
60 views

I have used a db.table() function with better-sqlite3 successfully. But, I am now trying to implement an async function and get an error db.table('Foo', { columns: [ 'col' ], rows: async ...
punkish's user avatar
  • 15.6k

15 30 50 per page
1
2 3 4 5
434