#pythoninterview

Python PeakPythonPeak
2026-01-25

What is a generator in Python?

A generator is a function that uses yield instead of return. It returns an iterator that produces values one at a time, only when needed. Generators are memory efficient because they generate values on-the-fly instead of storing them all in memory. You use generators for large datasets or infinite sequences.

...

youtube.com/watch?v=zC4LKQoTnas

Python PeakPythonPeak
2025-12-31

What is the difference between == and is in Python?

The == operator compares the values of two objects, checking if they are equal. The is operator compares the identity of two objects, checking if they are the same object in memory. Use == for value comparison, use is for identity comparison, like checking if a variable is None.

==vsis ...

youtube.com/watch?v=pkbdRLr6n7Q

Python PeakPythonPeak
2025-12-12

What is a decorator in Python?

A decorator is a function that takes another function, adds some extra behavior, and returns a new function. You use it when you want to add common logic, like logging, timing, authentication or validation, without changing the original function code.

youtube.com/watch?v=79vsKNpN4QA

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst