[Solved] User Extension Classes
Posted: Tue Oct 19, 2021 5:49 pm
I have a C Extension Module 'database' which implements a 'lookup' user type, which implements a 'phone_number' method. That allows -
But how would I need to implement that such that I can drop the parenthesis after lookup, would allow -
Rather than return an object which is a user type, I am guessing I need to return something which is an actual class.
I could not see anything in existing MicroPython C Modules which do that themselves, and Googling did not help. I might be looking in the wrong place, searching for the wrong thing, using the wrong terminology, so any pointers would be appreciated.
Code: Select all
>>> database.lookup().phone_number("Operator")
'100'
Code: Select all
>>> database.lookup.phone_number("Operator")
I could not see anything in existing MicroPython C Modules which do that themselves, and Googling did not help. I might be looking in the wrong place, searching for the wrong thing, using the wrong terminology, so any pointers would be appreciated.