Python doesn't have complicated lifetime errors, confusing trait not being satisfied errors. Python function declarations don't need three lines of code.
I mean wtf is this?
fn accumulate<'a, T: Monoid>(tuples: &[(&'a str, &Fn(i32) -> bool)], i: i32) -> Option<T>
where T: From<&'a str>
there's about ten language features in these lines of code that Python doesn't haveI would argue that Rust has a higher learning curve overall than any dynamic language because of its type system.
I would think it's the latter, but I don't know, to be honest.
You will find examples of this mostly in libraries, but rarely its something a beginner would write. You can actually do a lot without ever using lifetimes. Eventually you'll need to learn to read this though, and its just a matter of getting used to it. I'd say none of those is any harder to understand then let say nested list comprehension in python.
It could be T: Concatenable for all I care, but the rest of the function needs to look this way, more or less.
I only have one type parameter, that's very common. I'm abstracting over String and Cow<str> because I want to bench the performance of both. (Cow<str> is always faster)
(I don't disagree that Rust is more complicated than Python, just addressing GP's comment whether or not this is "good" rust.)
C style pointer tricks are better left for level two, so to speak.
Probably a good approach teach Rust's OO way is to introduce traits as kind of extensible modules that can be composed and go from there.
It is not 100% correct, but I guess it is easier to teach than going full theory with traits being a kind of type classes and do on.
A foreknowledge of pointers helps, but for anyone for whom Rust is their first systems language, it's going to be Rust's task to teach them e.g. the stack/heap distinction, or what "aliasing" means, or why there are two string types (let's hope they're already versed in Unicode...), or how to design a system in the absence of pure OO.