Answer the question
In order to leave comments, you need to log in
How to create a function in python of the type “significant_type.function(arguments)”?
Suppose we have such an expression
a = "abc"
how should we write the function so that when we try to give the interpreter a record below, an error does not pop up?
a.doThis(_argument)
Answer the question
In order to leave comments, you need to log in
Are you asking for something like extension methods from C#?
Actually, this is not at all pythonic and it is better not to use such hacks.
For normal classes, one could try modifying the __dict__ of the class, or setting an attribute. The attribute can be a method, i.e. function.
But for built-in classes, this number will most likely not work, since their __dict__ is read-only.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question