You can dynamically write attributes to a function, since they're also objects.
f.x = 42
# output: 42
It's got nothing to do with inheritance, but does it do what you need?
EDIT: Hm, Swim got the same idea, so prolly not...
but ~ swim ~ they are not called just like the method, in a class where you can then use method and its attributes, in that your example you defined text_one.x in the above function, not just using it when x is only defined in the function
karzan, we just wanted to help. If you prefer it, we can leave you alone.
I seriously doubt that someone will be able to tell you anything about function inheritance, though.
It's just not the right term.
Hey we are not arguing here. We just want to help. So we are just providing the solution that is coming to the mind and answering what is asked by others or giving clarifications for what we wrote :)
Guys I am not arguing but your guys trying to find others ways to solve the question but your answers are not right. I told you I have done it before so please if you don't know the answer wait until someone will give us the answer. If I figure it out in my old codes I will post the answer so we all learn.
HonFu I appreciate the feedback and the answers I am just trying to find the correct answer. I am 100% sure I have done it before. Maybe it's not called inheritance. Maybe it's something else but it could be easily done in Python. Trust me.
Are you maybe thinking of closures?
Well, probably not, since that also needs return.
Generators? They need yield, which is also a form of return.
It would be best if you describe the program you have in mind, so that we get an idea of what you're trying to do.
Please do not post unnecessarily. Q/A section and someone else's thread is not a right place for Hi/Hello.
Please follow the guidelines. Go through the link below.