Re: [Python-ideas] Why shouldn't Python be better at implementing Domain Specific Languages?

2018-08-31 Thread Matthew Einhorn
On Thu, Aug 30, 2018 at 8:31 PM James Lu wrote: > Why shouldn't Python be better at implementing Domain Specific Languages? > > [snip] > > It would be nice if there was a DSL for describing neural networks (Keras). > The current syntax looks like this: > > model.add(Dense(units=64, activation='re

Re: [Python-ideas] Why shouldn't Python be better at implementing Domain Specific Languages?

2018-08-31 Thread Abdur-Rahmaan Janhangeer
the implementation is very easy just a program and some ifs if you need more complex, just some reading on tokens etc but the first choice is enough if in py competitions people are solving regex like questions and word extractions without knowing they are solving compiler theory problems, implem

Re: [Python-ideas] Extend the warnings module with Deprecation utility methods and classes

2018-08-31 Thread Ilya Kulakov
Very nice, thank you. It would be a good start to collect usage patterns like this as seen in the wild for design consideration and test cases. > On Aug 30, 2018, at 10:43 PM, Joshua Harlow wrote: > > And mirrored at https://github.com/openstack/debtcollector >

Re: [Python-ideas] Why shouldn't Python be better at implementing Domain Specific Languages?

2018-08-31 Thread Steven D'Aprano
On Fri, Aug 31, 2018 at 11:39:16AM -0400, James Lu wrote: > We should all take a look at Ruby Blocks and think about how Python > could benefit from something similar. You are not the first person to suggest Ruby-like anonymous blocks or multi-statement lambdas. https://duckduckgo.com/?q=pytho

Re: [Python-ideas] Why shouldn't Python be better at implementing Domain Specific Languages?

2018-08-31 Thread Steven D'Aprano
On Fri, Aug 31, 2018 at 11:14:35AM +0400, Abdur-Rahmaan Janhangeer wrote: > let me take an example : > > a DSL to calculate the cost of houses [...] > --- file --- > house num 1,000 > house price 250,000 > calculate sum > > --- output --- > $ 250 000 000 I don't think the problem is people comi

Re: [Python-ideas] Why shouldn't Python be better at implementing Domain Specific Languages?

2018-08-31 Thread James Lu
We should all take a look at Ruby Blocks and think about how Python could benefit from something similar. > On Aug 31, 2018, at 3:14 AM, Abdur-Rahmaan Janhangeer > wrote: > > i believe a DSL is simple enough for an enthusiastic py programmer to write > if you really wanted one > > just write

Re: [Python-ideas] Fix some special cases in Fractions?

2018-08-31 Thread Oscar Benjamin
On Thu, 30 Aug 2018 at 17:36, Stephan Houben wrote: > > I would also like to point out that the current behavior of Fraction > is consistent with other parts of the numeric system, e.g. > 1/1 produces 1.0 (rather than 1) > math.sqrt(4) produces 2.0 (rather than 2) > 1j-1j produces 0j (rather than

Re: [Python-ideas] Why shouldn't Python be better at implementing Domain Specific Languages?

2018-08-31 Thread Abdur-Rahmaan Janhangeer
as for elm, you have to look twice not to see the python of it Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ Mauritius ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduc

Re: [Python-ideas] Why shouldn't Python be better at implementing Domain Specific Languages?

2018-08-31 Thread Jeff Allen
The word "domain" appears in this sense on the first page of Aho and Ullman and ANTLR (which I know you've used) describes itself as a tool for building domain-specific languages. Both pre-date Ruby I'm fairly sure. James Lu, quoting Jonathan Fine, used the term "internal DSL" and although tha

Re: [Python-ideas] Why shouldn't Python be better at implementing Domain Specific Languages?

2018-08-31 Thread Jonathan Fine
James Lu started this thread by quoting me. Thank you, James, for the compliment. And I feel somewhat obliged to contribute here, are at removed I started the thread. In the message James quoted, I also said But most strengths, in another situation, can be a weakness. Language design is often a

Re: [Python-ideas] Why shouldn't Python be better at implementing Domain Specific Languages?

2018-08-31 Thread Paul Moore
On Fri, 31 Aug 2018 at 06:36, Steven D'Aprano wrote: > Please no, Ruby has that, and the meaning of expressions depends on > whether you put whitespace around operators or not. > > Given: > > def a(x=4) > x+2 > end > b = 1 > > the result of "a+b" depends on the spaces around the plus sign: >

Re: [Python-ideas] Fix some special cases in Fractions?

2018-08-31 Thread Neil Girdhar
On Thu, Aug 30, 2018 at 9:03 AM Steven D'Aprano wrote: > On Wed, Aug 29, 2018 at 09:39:05PM -0700, Neil Girdhar wrote: > > > Would there be any problem with changing: > > > > In [4]: Fraction(1, 1) ** Fraction(2, 3) > > Out[4]: 1.0 > > > > In [5]: Fraction(-1, 1) ** Fraction(2, 3) > > Out[5]: (-0

Re: [Python-ideas] On evaluating features

2018-08-31 Thread Stephen J. Turnbull
Executive summary: Although I'm obviously not particularly in favor of this feature, my opinion is no more valuable than anyone else's. The point of this post is to show how features have been advocated successfully in the past. James Lu writes: > > By comparison, > > > > x, y += a, b > >

Re: [Python-ideas] Why shouldn't Python be better at implementing Domain Specific Languages?

2018-08-31 Thread Abdur-Rahmaan Janhangeer
i believe a DSL is simple enough for an enthusiastic py programmer to write if you really wanted one just write the tasks you need to accomplish, the data needed, the constrcuts needed (if needed), the feel/look of it on your editor plan first, come up with a good mock, then implement it. impleme