File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
graalpython/com.oracle.graal.python.benchmarks/python/micro Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 3838# SOFTWARE.
3939
4040class CustomIterator :
41+ # Even though this is worse for our generated code, it is increasingly
42+ # common, because the typing PEP explicitly has an example like this:
43+ # https://peps.python.org/pep-0526/#class-and-instance-variable-annotations
44+ #
45+ # While that is a historical document, it is a) still widely referenced and
46+ # b) at the time of writing this comment latest spec still has a similar
47+ # example where a variable is initialized with a default on the class level
48+ # and the __init__ method only conditionally overrides the default *and
49+ # otherwise keeps it on the class* making self.FOO accesses polymorphic:
50+ # https://typing.python.org/en/latest/spec/class-compat.html#classvar
51+ pos = 0
52+
4153 def __init__ (self , obj ):
42- self .pos = 0
4354 self .__obj = obj
4455
4556 def __iter__ (self ):
@@ -70,7 +81,7 @@ def count(num):
7081 val0 = next (it )
7182 val1 = next (it )
7283 val2 = next (it )
73-
84+
7485 return (val0 , val1 , val2 )
7586
7687
You can’t perform that action at this time.
0 commit comments