From for loop to bytecode - Discover how python works under the hood #python #howto

preview_player
Показать описание
In this video, we'll peel back the layers of Python and dive deep into the hidden mechanics behind everyday tools like for loops, while loops, iterators, and iterables. Venture with me beyond the surface as we visually explore how the CPython interpreter brings our code to life
Рекомендации по теме
Комментарии
Автор

The use of the walrus operator would make the iteration on the list easier and cleaner
my_list = [ 1, 2, 3, 4 ]
my_iter_list = iter(my_list)
while (current := next(my_iter_list, None) is not None:
print( current)

else :
print('You ran thru the entire list and reached the end!')

print("Now, proceeding with what's after the while")

BokoMoko