I'm learning programming with the goal of becoming an AI/ML engineer. Since libraries provide thousands of ready-made functions, should I still practice writing loops and functions myself? I'm wondering what happens when a library cannot handle very large datasets, changing data formats, or unusual input. Is understanding and occasionally rebuilding these operations from scratch important for working on real-world systems, or is it enough to learn how to use the existing libraries effectively?
1 Answer
Writing small versions of common operations is excellent practice, especially while learning. Try implementing things like filtering, searching, sorting, aggregation, and simple numerical operations so you understand the logic and the trade-offs. In professional work, though, you would normally use reliable, tested libraries rather than replacing them just because the dataset is large. When scale becomes a problem, the solution may involve better algorithms, batching, vectorization, distributed processing, memory management, or a different data system—not simply rewriting a loop.

Also remember that library code is usually more thoroughly tested and optimized than a quick personal implementation. Rebuild it to learn, then use the established tool when it is appropriate.