Are you a contributor or core dev on one of those packages? That would be useful context to have.
Also, did you see Jim Baker's module? How do you propose to translate Patsy's ':' operator? On Sun, Feb 23, 2020 at 5:22 PM Aaron Hall via Python-ideas < python-ideas@python.org> wrote: > > Is there an existing function in one of the libraries you mention > > that has the desired behavior (in the context of that library)? That > would > > help. > > Yes, and we are currently parsing and evaluating strings to convey the > meaning. > > Patsy is currently used by statsmodels to parse strings in the following > way: > > ``` > from patsy import ModelDesc, Term, EvalFactor > ModelDesc([Term([EvalFactor("y")])], > [Term([]), > Term([EvalFactor("a")]), > Term([EvalFactor("a"), EvalFactor("b")]), > Term([EvalFactor("np.log(x)")]) > ]) > ``` > "Compare to what you get from parsing the above formula:" > > ``` > ModelDesc.from_formula("y ~ a + a:b + np.log(x)") > ``` > > In the past when we have been eval'ing strings, we added functionality so > users could avoid it (`getattr`, et. al.). > > Sympy is rather new, but I think they'd appreciate it since they have an > entire subpackage for distributions: > > https://docs.sympy.org/latest/modules/stats.html > > I do envision other usages, but these are the strongest cases I have right > now. > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/MZFA265UAJR46KDAGFZ7BWMRHG4RX77H/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/C2R7FJEMOTDBEP2P7S3IUNW7XEHW2FTM/ Code of Conduct: http://python.org/psf/codeofconduct/