Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Designing Pythonic Library APIs (benhoyt.com)
3 points by BerislavLopac on June 28, 2023 | hide | past | favorite | 2 comments


The notion of "Pythonic" is to me an expression of a cargo cult.

Python is not special, and despite its slogan of the 90's, has as much bloat as any other language.

It's API design when it comes to class methods (e.g. convention with _ for private) is not pretty, and understanding its eco system is horrible.

It gives no pleasure compared to Ruby et al.

But it works, and it's fine.


I’m not an expert on Python, but I read ‘Pythonic’ as ‘idiomatic for Python’. All languages have ways of doing things that fit the language well, or are recommended. A programming language is incredibly flexible and there are many ways of doing anything, but which are safest, clearest while concise, use the unique features, are performant, or show good architecture? Patterns that overlaps all those become language idioms.

So it’s not a cult, more just doing it the way that best fits.

I fully agree re the _ prefix, by the way. As I’ve been learning Python the lack of some features other languages have for clean code has bothered me (even forward declarations which, so far as I know, don’t exist.) But I view it as something to learn. It didn’t take long before I read _ as ‘private’.




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

Search: