Python Forum
difference between next() and .__next__
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
difference between next() and .__next__
#3
(Oct-13-2023, 06:57 AM)akbarza Wrote: what is the difference between them?
Globally speaking, I would say that next() and iter() are a public interface while __next__() and __iter__() are an implementation interface of the iterator protocol.

Functionally speaking, there is a difference in that next() and iter() accept a second argument as explained in their documentation.
akbarza likes this post
Reply


Messages In This Thread
RE: difference between next() and .__next__ - by Gribouillis - Oct-13-2023, 07:35 AM

Forum Jump:

User Panel Messages

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