When learning Python, one of the terms to get used to is Pythonic, basically shorthand for a loosely defined idiomatic Python way of writing code.
Some links to help you get a feel for this:
- [WayBack] The Idiomatic Way to Merge Dictionaries in Python – Trey Hunner
- Python (programming language) – Wikipedia: Features and philosophy
The language’s core philosophy is summarized in the document The Zen of Python (PEP 20), which includes aphorismssuch as:[51]
- Beautiful is better than ugly
- Explicit is better than implicit
- Simple is better than complex
- Complex is better than complicated
- Readability counts
…
the Python philosophy rejects exuberant syntax (such as that of Perl) in favor of a simpler, less-cluttered grammar. As Alex Martelli put it: “To describe something as ‘clever’ is not considered a compliment in the Python culture.”
…
“there should be one—and preferably only one—obvious way to do it”
- [WayBack] PEP 20 — The Zen of Python
- [WayBack] What is Pythonic? | Secret Weblog
- [WayBack] python – What does pythonic mean? – Stack Overflow
- [WayBack] Code Style — The Hitchhiker’s Guide to Python
- [Webcache] Learning the Pythonic Way
Sometime, I am going to dig into learning how to write Pythonic code for merging and joining dictionaries (preferably those of namedtuple entities). Hopefully these links will help me with that:
- [WayBack] How to use Python left outer join using FOR/LIST/DICTIONARY comprehensions (not SQL)? – Stack Overflow
- [WayBack] python left outer join and right outer join of dictonaries · GitHub
- [WayBack] Built-in Functions — Python 3.7.1rc2 documentation: `zip`
- [WayBack] python – How to merge two dictionaries in a single expression? – Stack Overflow
- [WayBack] python – Merge two dict in separate list by id – Code Review Stack Exchange
- [WayBack] The Idiomatic Way to Merge Dictionaries in Python – Trey Hunner
- [WayBack] python – using `map` to construct multiple named tuples – Stack Overflow
- [WayBack] Map-Reduce, Python and Named Tuples – DZone Web Dev
–jeroen