For me as python programmer having a formal definition for the term "pythonic" would be much more important and less subjective compared to asking more rhetoric (non-formal) questions. This may lead to better communication by argumentation being less subjective (as discussed in here).
PEP8 by Guido is assumed as a starting point despite of some religious dogmatism (e.g. PEP20 is more axiomatic, shorter and simpler, but has no code). Having identified minimalism, readability (human comprehension) and unambiguity (explicit code) is actually the same as paraphrasing PEP20. But is it possible to rewrite zen of python in python? Obviously print('Beautiful is better than ugly') does not capture python in python ;-) Any thoughts on this?
Ultimately I would like to get closer to more logical or mathematical interpretation of the matter. Argument in form of the code answering why family of snippets A is pythonic compared to family of snippets B is also acceptable.
EDIT If possible try to reduce your answer to the following outline. Let us consider all possible syntactically correct program texts generated by some procedure (e.g.). Please note that we a considering only programs written in python (which is a formal language with respective grammar). Also being syntactically correct does not mean semantical correctness (programs may be buggy or without any obvious purpose). Further we observe (assume) that ultimate family POmega of all syntactically correct programs in python must contain a subset of programs which are called Pythonic. Now in order to argue about what does it mean to be pythonic we will use a formal method - another language called Reason which would be less ambiguous (consistent, complete) than natural language. We will define a mapping from programs in Omega into Reason. Such mapping we will call interpretation. We will also produce more mappings in similar manner (e.g. as in) for all individual symbols in Python and their combinations (statements). Now if we would argue about images of such mappings, we would do so in form of proofs in Reason language. The question would be if subset Pythonic indeed exists can we follow that up from aximos in Reason built/reformulated from "Zen of python" or other motivating set of concepts? In fact, the whole deductive core of the language Reason would be built from "Zen" or PEP8. We will have to proof that each program from Pythonic will consist only from statements for images of which in Reason can be shown to satisfy initial axioms of the model language. Different outcomes are plausible:
- Subset of Pythonic programs could be empty. We have not found any programs that would satisfy our axioms in Reason.
- It could happen that this set of axioms would turn out to be ambiguous (inconsistent or incomplete). Then our original assumption about existence of Pythonic programs would be wrong.
- Alternatively axiomatic "Zen" could be simple enough and so well-chosen that Pythonic set is non-empty. Now the question is will such (consistent, complete) set be of practical value, i.e. can we say that such set of axioms is indeed a formal definition of "pythonic"?
This is a draft of how one can try to approach answering the question in formal manner. I would appreciate recommendations on a more elegant approach for solution to the problem (everything except ignoring it). But at the end it matters to me to see how such set of axioms looks like. Hence it will allow in precise (quantitative) way to ask and try to explain questions like why programs have "pythonic" qualities once written according to following python "dogmas"?
BTW One can built a more sophisticated model of Reason by introducing an equivalent of "human factor" - a software developer of the programs. Then the question would be - can human formally claim the program he rights belongs to "Pythonic" subset?