Python Forum
difference between next() and .__next__
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
difference between next() and .__next__
#1
Hi
in the below code:
def g():
    for i in range(3):
        yield i*i
my_g=g()
my_g.__next__()
next(my_g)
#what is difference between .__next__() and next() ?
next() and .__next__() will show next elements to us. what is the difference between them?
Is the usage of them different?
thanks
Reply


Messages In This Thread
difference between next() and .__next__ - by akbarza - Oct-13-2023, 06:57 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020