Can I change way functions int, str... are working | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can I change way functions int, str... are working

Can I change way functions int, str, float, list... (basicaly every type-changing function) are working? P.S. magic-methods related question, as sad in tag

11th Jun 2017, 6:08 PM
Superior
Superior - avatar
3 Answers
+ 1
you define a function with the same name as what you want to change and that's it
17th Jun 2017, 12:46 PM
Amaras A
Amaras A - avatar
0
How do I change it
12th Jun 2017, 5:30 AM
Superior
Superior - avatar
- 1
yes, you can. But it is not recommended to do that at work. Also int, str, float... are classes and when you call them, you basically use their constructor
11th Jun 2017, 10:02 PM
Amaras A
Amaras A - avatar