On Fri, Aug 31, 2018 at 3:19 AM, Michael Selik <m...@selik.org> wrote:
> On Thu, Aug 30, 2018 at 5:31 PM James Lu <jam...@gmail.com> wrote: > >> It would be nice if there was a DSL for describing neural networks >> (Keras). >> >> model.add(Dense(units=64, activation='relu', input_dim=100)) >> model.add(Dense(units=10, activation='softmax')) >> >> > Why not JSON or XML for cross-language compatibility? > Presumably because those are even harder to read and write for humans. I believe that the key issue with using Python as a DSL has to do with its insistence on punctuation -- the above example uses nested parentheses, commas, equal signs, and quotation marks. Those are in general needed to avoid ambiguities, but DSLs are often highly stylized, and a language that doesn't need them has a certain advantage. For example if a shell-like language was adopted, the above could probably be written with spaces instead of commas, parentheses and equal signs, and dropping the quotes (though perhaps it would be more readable if the equal signs were kept). I'm not sure how we would go about this though. IIRC there was a proposal once to allow top-level function calls to be written without parentheses, but it was too hard to make it unambiguous (e.g. would "foo +1" mean "foo(+1)" or "foo + 1"?) -- --Guido van Rossum (python.org/~guido)
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/