本文整理匯總了Python中x.a.__next__方法的典型用法代碼示例。如果您正苦於以下問題:Python a.__next__方法的具體用法?Python a.__next__怎麽用?Python a.__next__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類x.a
的用法示例。
在下文中一共展示了a.__next__方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_prefix_preservation_4
# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import __next__ [as 別名]
def test_prefix_preservation_4(self):
b = """
next = 5
for a in b:
foo(a) # abc
# def
a.next()
"""
a = """
next = 5
for a in b:
foo(a) # abc
# def
a.__next__()
"""
self.check(b, a, ignore_warnings=True)
示例2: test_method_4
# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import __next__ [as 別名]
def test_method_4(self):
b = """
class A:
def __init__(self, foo):
self.foo = foo
def next(self):
pass
def __iter__(self):
return self
"""
a = """
class A:
def __init__(self, foo):
self.foo = foo
def __next__(self):
pass
def __iter__(self):
return self
"""
self.check(b, a)
示例3: test_shadowing_funcdef_2
# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import __next__ [as 別名]
def test_shadowing_funcdef_2(self):
b = """
def next(a):
pass
class A:
def next(self):
pass
it.next()
"""
a = """
def next(a):
pass
class A:
def __next__(self):
pass
it.__next__()
"""
self.warns(b, a, "Calls to builtin next() possibly shadowed")
示例4: test_prefix_preservation_3
# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import __next__ [as 別名]
def test_prefix_preservation_3(self):
b = """
next = 5
for a in b:
foo(a)
a.next()
"""
a = """
next = 5
for a in b:
foo(a)
a.__next__()
"""
self.check(b, a, ignore_warnings=True)
示例5: test_prefix_preservation_5
# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import __next__ [as 別名]
def test_prefix_preservation_5(self):
b = """
next = 5
for a in b:
foo(foo(a), # abc
a.next())
"""
a = """
next = 5
for a in b:
foo(foo(a), # abc
a.__next__())
"""
self.check(b, a, ignore_warnings=True)
示例6: test_method_1
# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import __next__ [as 別名]
def test_method_1(self):
b = """
class A:
def next(self):
pass
"""
a = """
class A:
def __next__(self):
pass
"""
self.check(b, a)
示例7: test_method_2
# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import __next__ [as 別名]
def test_method_2(self):
b = """
class A(object):
def next(self):
pass
"""
a = """
class A(object):
def __next__(self):
pass
"""
self.check(b, a)
示例8: test_noncall_access_1
# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import __next__ [as 別名]
def test_noncall_access_1(self):
b = """gnext = g.next"""
a = """gnext = g.__next__"""
self.check(b, a)
示例9: test_noncall_access_2
# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import __next__ [as 別名]
def test_noncall_access_2(self):
b = """f(g.next + 5)"""
a = """f(g.__next__ + 5)"""
self.check(b, a)
示例10: test_noncall_access_3
# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import __next__ [as 別名]
def test_noncall_access_3(self):
b = """f(g().next + 5)"""
a = """f(g().__next__ + 5)"""
self.check(b, a)