Hacker News new | past | comments | ask | show | jobs | submit login

I am not sure what your argument is supposed to be. That I am wrong because I haven’t gotten the hang of it after all these years? I do understand generators. For a long time. I still believe they are usually an anti-pattern, same like massive abuse of inheritance where you have 20 classes but only a single instance but you made your code “future proof”.

The point I wanted to make is that using generator, in particular like here, is something that I consider ugly and difficult to maintain and it will probably have to be rewritten when trying to export to TorchScript. I really do not see how “just get a hang for it” can help me reevaluate my perspective

Edit: Maybe you were hung up on my “standardised” - I have to admit I do not know how thoroughly the PEP defines generators and if really all edge cases are defined without needing to check the python source code. From past experiences, my trust in python language standards is a bit shaky, as it had been difficult to reproduce the very exact behaviour using a different language, or python features - without requiring digging through the sources.






Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: