DEV Community

Cover image for Polymorphism in Rust and Python. Simple examples

Polymorphism in Rust and Python. Simple examples

Antonov Mike on February 23, 2024

Disclaimer The article contains code samples, but not theory and does not pretend to explain the theoretical basis of polymorphism in de...
Collapse
 
slobodan4nista profile image
Slobi

Nice topic and post :D

One note, in order to get all the methods of String/Integer in python you would have to subclass it, in rust by implementing trait you are just extending what can be done with original struct.

Hope this helps!

Collapse
 
antonov_mike profile image
Antonov Mike

О! Thank you! I didn't even think of that. Anyway, because of my lack of serious experience in production, every time I think I understand something, I doubt it very much, because all this stuff is very far from how it is applied in real work.