<div dir="ltr"><div>I prefer Python's syntax. <br></div><div><br></div><div>In the Keras example, Python pays off compared to the XML or YAML or whatever as soon as you need to define something programmatically. For example, if your model is generated based on some other input. <br></div><div><br></div><div>Anyway, most of your time is not spent typing punctuation. Most of your time is spent debugging.</div><div><br></div><div>I wish that LaTeX, the DSLs I use, were implemented as a Python package. There are a thousand terrible design decision in latex that could all be fixed if it had been done as one good Python package. Maybe LuaTex will end up fullfilling the dream.<br></div><div><br>On Thursday, August 30, 2018 at 9:41:46 PM UTC-4, Guido van Rossum wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir="ltr"><div><div class="gmail_quote">On Fri, Aug 31, 2018 at 3:19 AM, Michael Selik <span dir="ltr"><<a href="javascript:" target="_blank" gdf-obfuscated-mailto="izOiTzQgAgAJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">mi...@selik.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><span><div dir="ltr">On Thu, Aug 30, 2018 at 5:31 PM James Lu <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="izOiTzQgAgAJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">jam...@gmail.com</a>> wrote:<br></div></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><span><div>It would be nice if there was a DSL for describing neural networks (Keras).</div></span><div><pre><code>model.add(Dense(units=<span>64</span>, activation=<span>'relu'</span>, input_dim=<span>100</span>))
model.add(Dense(units=<span>10</span>, activation=<span>'softmax'</span>))</code></pre></div></div></div></blockquote><div><br></div><div>Why not JSON or XML for cross-language compatibility?</div></div></div></blockquote><div><br></div><div>Presumably because those are even harder to read and write for humans.</div><div><br></div><div>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).</div><div><br></div><div>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"?)<br></div></div><br>-- <br><div>--Guido van Rossum (<a href="http://python.org/~guido" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Fpython.org%2F~guido\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGKI5lSgzXFUM7Y5HtkFAp6sQAxEg';return true;" onclick="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Fpython.org%2F~guido\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGKI5lSgzXFUM7Y5HtkFAp6sQAxEg';return true;">python.org/~guido</a>)</div>
</div></div>
</blockquote></div></div>