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,090 points
2,074 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,560 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,090 points
630 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,540 points
644 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
979 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,540 points
766 views
0 votes
2 answers
+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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,458 views
0 votes
1 answer
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,560 points
4,998 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP