Why did Python 2.6 add a global next() function?

后端 未结 3 1072
难免孤独
难免孤独 2020-12-17 16:07

I noticed that Python2.6 added a next() to it\'s list of global functions.

next(iterator[, default])

Retrieve the next item from the i         


        
3条回答
  •  星月不相逢
    2020-12-17 16:23

    It calls __next__ internally, but it makes it look more 'functional' than 'object-oriented'. Mind you that's just my opinion, but I don't like next(i) rather than i.next(). But as Steve Mc said, it also helps slightly with consistency.

提交回复
热议问题