inducer / pymbolic

A simple package to do symbolic math (focus on code gen and DSLs)
http://mathema.tician.de/software/pymbolic
Other
106 stars 25 forks source link

Search for parent class' mapper_method in the Mapper #64

Closed isuruf closed 2 years ago

isuruf commented 2 years ago

First pymbolic will look for mapper_method given by the object and if not found, look for mapper_method class attributes in the object's method resolution order

inducer commented 2 years ago

LGTM. Thanks!

isuruf commented 2 years ago

Thanks

inducer commented 1 year ago

@isuruf Could you remind me why we did this? Shouldn't getattr find attributes from anywhere in the MRO? (I touched this code in #110 and was wondering. We should probably add a comment.)

kaushikcfd commented 1 year ago

I guess if the mapper implementation contains a mapper method for the superclass but not the derived class, then this should come in handy.

inducer commented 1 year ago

Ah right. Somehow I was thinking of the MRO of the mapper, but this is the MRO of the expression node. Nvm, all good.