Ah, that would take care of subclass checks too. If someone wanted to add their own postprocessor to an existing class they'd need to subclass it, but that's fine (it is adding behavior to a class, so subclassing makes sense).
We should think about ordering. set() ordering is (effectively) random, which is not so great. We could sort them, but people might want to be able to make sure their processor fires before some other one. Maybe there should be some kind of priority key that classes could add to specify this. Aaron Meurer On Wed, Mar 22, 2017 at 7:58 PM, Francesco Bonazzi <[email protected]> wrote: > > > On Wednesday, 22 March 2017 18:48:15 UTC+1, Aaron Meurer wrote: >> >> >> How would it work as a set? How do you know which function to call? >> > > I was thinking about something like this: > > > class Add: > _check_postprocess = False > > @classmethod > def flatten(cls, seq): > postprocess = set([]) > if cls._check_postprocess: > for i in seq: > if hasattr(i, "_postprocess_function_Add"): > postprocess.add(i._postprocess_function_Add) > > [ ... body of flatten ... ] > [ call `expr` the returning expression ] > > for i in postprocess: > expr = i(expr) > return expr > > > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/c6e46bef-173a-40fd-aacc-c0c5ae9ba5ba%40googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6LB6PQFXmC5VvqMHrtSt5vo6aJWRY4Vpn6sGBOnTXM1og%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
