+ 1

Book recommendation for closures, currying and decorators, wrapper classes in Python and general?

I'm thinking of Irv Kalb's POOP(he did it, not me), solely because it focuses on some of this. I've read stuff passively on the internet yet examples, imo, are chosen so badly that the ones I've seen either fail to answer why anyone would choose to use these to do what's done in the example(except for the same reasons as why SL does) or they are too detailed. I really want to start it off and build it up, it's getting in the way of my learning. The thing is there's a dearth of exercises that level up. You cannot find stuff that the source lets you know you better do with said methods which you can get the hang of as you keep doing and truly discern the advantages of. For this reason I am also considering Tibor Santa's SICP recommendation, though not with JS but Scheme, (I hope the app works) . But I need to do these in parallel. I see people saying Python is not the best language to understand some of these (ds like linked lists included). So can you just mention some useful sources?

4th Sep 2022, 2:55 PM
Korkunç el Gato
Korkunç el Gato - avatar
7 ответов
+ 4
the most depictive use of decorators in python for me is a time measuring function. it's very useful and easy: take some other function as an argument, then run these steps: record the current time run the function record current time again substract old time record from the one the result is how much time elapsed the best part is that you can wrap any function in this time measuring benchmark by using decorator - just add @ and its name before function definition! (that's how it works in python) it's a very useful and logical concept actually
5th Sep 2022, 5:35 PM
Patrick
Patrick - avatar
+ 3
Korkunç el Gato I learned them while studying python, so yes, it's a nice way to.
6th Sep 2022, 6:31 AM
Patrick
Patrick - avatar
+ 2
Korkunç el Gato no! you did it 😅😂
4th Sep 2022, 3:03 PM
Sandeep
Sandeep - avatar
+ 2
Sandeep 😶😅What did I do😬 - Oh. Nevermind. Lol. I have a habit
4th Sep 2022, 3:09 PM
Korkunç el Gato
Korkunç el Gato - avatar
+ 2
As far as the functional concepts go, like currying, recursion, higher order functions and higher order types: I recommend everyone to spend a few weeks learning Haskell, for example with "Learn you a Haskell". After that, all these concepts will be second nature because it's how you do everything in Haskell, and imo it's great fun to write Haskell programs.
4th Sep 2022, 5:59 PM
Schindlabua
Schindlabua - avatar
+ 1
[I am weak in classes too, very weak, and internet sources compare the functional and oop methods, that's why I mentioned the oop source for python]
4th Sep 2022, 3:00 PM
Korkunç el Gato
Korkunç el Gato - avatar
+ 1
Patrick Would you try to learn these concepts with Python, though?
5th Sep 2022, 9:40 PM
Korkunç el Gato
Korkunç el Gato - avatar