101):
102 # foreach pixel in the screen array using numba parallel
103 for x in numba.prange(width - menu_width):
104 for y in numba.prange(height):105 # define the complex number based on the pixel coordinates, zoom and offset
106 c = (x - offset[0]) * zoom + 1j * (y - offset[1]) * zoom
107 # define the initial value of z and the number of iterations
100 lightness: float = 0.5,
101):
102 # foreach pixel in the screen array using numba parallel
103 for x in numba.prange(width - menu_width):104 for y in numba.prange(height):
105 # define the complex number based on the pixel coordinates, zoom and offset
106 c = (x - offset[0]) * zoom + 1j * (y - offset[1]) * zoom
64):
65 # foreach pixel in the screen array using numba parallel
66 for x in numba.prange(width - menu_width):
67 for y in numba.prange(height): 68 # define the complex number based on the pixel coordinates, zoom and offset
69 z = (x - offset[0]) * zoom + 1j * (y - offset[1]) * zoom
70 # number of iterations
63 lightness: float = 0.5,
64):
65 # foreach pixel in the screen array using numba parallel
66 for x in numba.prange(width - menu_width): 67 for y in numba.prange(height):
68 # define the complex number based on the pixel coordinates, zoom and offset
69 z = (x - offset[0]) * zoom + 1j * (y - offset[1]) * zoom
100 lightness: float = 0.5,
101):
102 # foreach pixel in the screen array using numba parallel
103 for x in numba.prange(width - menu_width):104 for y in numba.prange(height):
105 # define the complex number based on the pixel coordinates, zoom and offset
106 c = (x - offset[0]) * zoom + 1j * (y - offset[1]) * zoom
A non-iterable value is being used in an iterating context, For example, a non-iterable value being passed into a for
loop. This will raise a TypeError
.
Using a non-iterable as object in a loop.
def fx(val=None):
return val
seq = fx()
for val in seq:
print(val)
Because seq
would be None
which is not an iterable, this code snippet will raise an error.
Make sure only an iterable is passed to the iterator.
In our example, tweaking fx
to always return an iterable will fix the problem:
def fx(val=None):
val = val or []
return val
seq = fx()
for val in seq:
print(val)