Brent Fischer
Aug 1, 2023

--

Rust Traits certify that a data type can perform certain operations. This allows us to create code which will work for all data types with proper certifications. Python's Protocol is pretty similiar in my opinion (in terms of static typechecking). But even more, think about implementing __add__() in python, which gives an object the ability to override the +-Operator. Python and Rust cannot be compared of course, but they share similarities.

--

--

Brent Fischer
Brent Fischer

Written by Brent Fischer

Python Developer, Python Trainer, Geek, RPGs, Pizza, Traveller. Loves Rust, C, Linux. Drop by at friendlybytes.net

Responses (1)