Is there an expression for an infinite generator in Python?

0 votes
Is there a straight-forward generator expression that can yield infinite elements?

This is a purely theoretical question.
Nov 20, 2018 in Python by Anirudh
• 2,080 points
434 views

1 answer to this question.

0 votes

you can iterate over a callable returning a constant always different than iter()'s sentinel

g1=iter(lambda:0,1)
answered Nov 20, 2018 by Nymeria
• 3,540 points

Related Questions In Python

0 votes
0 answers

Is there any module in Python that I can use for Wiki markup?

Hi all, simple question. Is there any ...READ MORE

Jan 22, 2019 in Python by Anirudh
• 2,080 points
37 views
0 votes
0 answers

is therer an alternative for execfile in python?

can you give an example if there ...READ MORE

Apr 5, 2019 in Python by Waseem
• 4,530 points
102 views
0 votes
1 answer

Is there an equivalent of C’s (?:) ternary operator in python?

Yes, there is. The syntax is as ...READ MORE

answered Jul 25, 2019 in Python by Alia
82 views
0 votes
0 answers

What is the syntax for an empty while loop in python?

What kind of ambiguities are expected for ...READ MORE

Aug 5, 2019 in Python by Waseem
• 4,530 points
81 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,054 views
0 votes
0 answers
0 votes
1 answer

Need help extracting a schema to make use for an avro file in Python

Hi, nice question. So what I daily use ...READ MORE

answered Jan 10, 2019 in Python by Nymeria
• 3,540 points
1,268 views
0 votes
1 answer