Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change def to something else?

I always type in function something():. Is their any way to change def to function? I know this sounds like a silly question, but I would really appreciate any answers.

If their is something like that, can you also change print or input? For example:

name = question("What is your name? ")
answer(f"Hi {name}!")
like image 935
CoderPerson Avatar asked Oct 25 '25 02:10

CoderPerson


1 Answers

This works for print and input:

question = input
answer = print

You can call them like this:

question("What is your name? ")
answer(f"Hi {name}!")

As for changing def you probably would have to modify the source code of your python installation and recompile it to do something like that. That would be a very bad practice as it would then make it your python installation incompatible with almost 100% of python code that can be downloaded and run.

Take a look at this for more info on changing def to function

like image 178
catasaurus Avatar answered Oct 26 '25 15:10

catasaurus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!