
ALT # Check more tips / questions at @goCRustedPython from time import sleep from typing import Generator def infinite_seq() -> Generator: counter = 0 while True: yield counter counter += 1 if __name__ == "__main__": lazy = infinite_seq() print("Use Ctrl + c to stop") for i, v in enumerate(lazy): print(f"Call # {i}, result: {v}") sleep(0.1) lazy.close()

ALT # Check more tips / questions at @goCRustedPython from time import sleep from typing import Generator def infinite_seq() -> Generator: counter = 0 while True: yield counter counter += 1 if __name__ == "__main__": lazy = infinite_seq() print("Use Ctrl + c to stop") for i, v in enumerate(lazy): print(f"Call # {i}, result: {v}") sleep(0.1)

ALT # Check more tips / questions at @goCRustedPython from time import sleep def infinite_seq(): counter = 0 while True: yield counter counter += 1 if __name__ == "__main__": lazy = infinite_seq() print("Use Ctrl + c to stop") for i, v in enumerate(lazy): print(f"Call # {i}, result: {v}") sleep(0.1)
![# Check more tips / questions at @goCRustedPython import sys # Normal evaluation values = [x for x in range(1, 2000005)] print("Memory usage in normal mode: ", sys.getsizeof(values)) # Lazy evaluation values_l = (x for x in range(1, 2000005)) print("Memory usage in lazy mode: ", sys.getsizeof(values_l))](https://pbs.twimg.com/media/GGc3DIvbAAA4i2T.jpg?name=small&format=webp)
ALT # Check more tips / questions at @goCRustedPython import sys # Normal evaluation values = [x for x in range(1, 2000005)] print("Memory usage in normal mode: ", sys.getsizeof(values)) # Lazy evaluation values_l = (x for x in range(1, 2000005)) print("Memory usage in lazy mode: ", sys.getsizeof(values_l))










![buffer = "1:2:3:4" one, two, three, four = [int(i) for i in buffer.split(":")] print(f"{one = }, {two = }, {three = } and {four = }")](https://pbs.twimg.com/media/GGOPXavbEAA6_za.jpg?name=small&format=webp)



![/* Check more tips / questions at @goCRustedPython */ #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { char *p = "1 Feb 2024"; printf("Today is %s. Tomorrow will be:\t", p); p[0] = "2"; printf("%s\n", p); return EXIT_SUCCESS; }](https://pbs.twimg.com/media/GFQfBj0a4AAYnmG.jpg?name=small&format=webp)
