In Python, how can you answer method calls that don't exist on an object?

Possible duplicate:
Dynamic crawlers and methods missing in Python

I know you can do it in Ruby, but how to do it in Python?

That way, you could perhaps find a regular expression in a method call that wasn't there and create syntactic sugar.

+3
source share
2 answers

To identify __getattr__.

But the syntax will not do it yet s./.*/, if that is what you mean. Python syntax is nowhere more flexible than Ruby's.

+2
source
+1

Source: https://habr.com/ru/post/1774114/


All Articles