6
Chatted with a 15 year old at the library who showed me a cleaner way to write loops
He was working on a Python project and pointed out I was doing it the long way with extra variables when a simple list comprehension would have done the same job. Has anyone else had a younger coder completely change how you think about something basic?
2 comments
Log in to join the discussion
Log In2 Comments
grant_torres11d ago
Man, I totally used to think that "old school" way of writing code was just how it's done. I figured if it worked and wasn't totally broken, why mess with it? But seeing a kid just casually show you a simpler approach really shakes that up. It made me realize I was holding onto habits just because they were comfortable, not because they were good. Kinda forces you to admit your way isn't always the smartest way, you know?
7
diana_bell7411d ago
My nephew did the same thing to me with recursion last year. I was literally writing a 30 line function to traverse a nested folder structure and he just casually showed me how to do it in 6 lines with a proper base case. Honestly felt like I'd been doing it wrong my whole career even though it worked fine. Ngl it's humbling but kind of awesome seeing how these kids pick stuff up so naturally.
5