TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Should I go from CamelCase to snake_case for Python wrappers for C++?

1 pointsby aleclmalmost 3 years ago
I have a data structure which is used in several places:<p>1. C++: `struct` with CamelCase fields<p>2. YAML serialization (our file format): dictionaries with CamelCase keys (derived from C++);<p>3. Documentation: describes the file format, so the same as YAML;<p>4. Python wrappers: should I stick with CamelCase or convert field names to snake_case?<p>5. TypeScript wrappers: should I stick with CamelCase or convert field names to dromedaryCase?<p>I can easily make the conversion, but I suspect it will make it harder to lookup things in the documentation, which would make Python and TypeScript somewhat second class citizens.<p>On the other hand, if the wrappers do not conform with common practices of the language they are targeting, they feel somewhat second class citizens too.<p>What do you think?

1 comment

eesmithalmost 3 years ago
Stay with CamelCase, for exactly the reasons you mention.<p>See for example Python&#x27;s unittest and xml.sax.saxutils, which follow the Java naming conventions of JUnit and the Java implementation of SAX, respectively.