python (12.9k questions)
javascript (9.2k questions)
reactjs (4.7k questions)
java (4.2k questions)
java (4.2k questions)
c# (3.5k questions)
c# (3.5k questions)
html (3.3k questions)
Not quite understanding how passing a value to next() works with yield in JavaScript
The Mozilla Developer Network has the following example of passing a value to next() and how it's captured by yield:
function* fibonacci() {
let current = 0;
let next = 1;
while (true) {
let...

Major Productions
Votes: 0
Answers: 2
Return specific values from a nested dictionary with a generator function
I have a list of dict containing nested dict which looks like below. I would like to use generators and yield to go over reviews list of dict and return all rating given a specific user value. For exa...
elideli
Votes: 0
Answers: 1
Splitting a large file into chunks
I've a file with 7946479 records, i want to read the file line by line and insert into the database(sqlite). My first approach was open the file read the records line by line and insert into the datab...
ABHIJITH EA
Votes: 0
Answers: 4
TypeError: 'str' object is not callable in generator python
def gen_secs():
x = 0
while x < 60:
yield x
x += 1
def gen_minutes():
x = 0
while x < 60:
yield x
x += 1
def gen_hours():
x = 0
while x ...
רועי יצחקוב
Votes: 0
Answers: 1