Last week, I showed you my new implementation for instance-level properties in Python. This week, we’ll take another look at it by implementing a few Delegated Properties and helpers to make using them just a hair nicer.
Recreating Kotlin’s Built-In Delegates
For inspiration of what Delegated Properties to create, we’ll start by recreating the ones built into Kotlin, starting with
Lazy. Continue Reading
A while back, I did a post on making instance-level properties in Python where the implementation of it required inheritance as well as messing with
__setattr__(), which are a little dangerous to mess with. Then I had another idea last night (as of the time of writing this): Use normal descriptors to delegate to “Delegated Properties” (name taken from Kotlin, the original inspiration). These Delegated Properties can be designed very simply in a way that they only have to worry about the value on one instance, instead of figuring out how to store the value per instance. Continue Reading
Some of you may know that Apress contacted me a little bit ago, wanting to publish my book under their brand. Well all the work is done now, and the book is up for sale on their web site, and soon it will be up on Amazon!
So go add the book to your wish lists!
Thanks for all your support, everyone. If I didn’t have a decent following, I’m not sure I would have written the book in the first place.
P.S. My second video is recorded. I just need to do some editing, and it will be put up soon.
Making Descriptors that act as specialized properties can be tricky, especially when it comes to storing the data the property controls. I should know, I literally wrote the book. Looking at how other languages do it – especially Kotlin’s Delegated Properties – I felt that Python could use a system that works more like that. Continue Reading
So here’s my attempt at accomplishing the closest thing possible toward making object literals in Python. Continue Reading
It’s time that I got a bit more real with you guys. Pretty much ever since I learned Python, I’ve been touting it as a super amazing language. I’ve been doing the same with Kotlin, but this is about Python.
Now, this doesn’t mean I’m going to be changing my tune from here on out; after this, I’m not really going to bringing up the weak points of Python. I’m just going to continue talking about strong principles, practices, features, and tips and tricks. But this article was just inspired by a small revelation, and I decided to just roll with it.
That inspiration was due to the revelation that the official Python logo looks vaguely like a yin yang symbol (apparently, it’s called the Taijitu). To prove it, I made an alteration to the symbol, changing just the colors.
So, let’s look at the pros and cons of Python. Continue Reading
Today, I give you the second (and last) excerpt from my book, and it’s the last chapter. It brushes over some of the cooler examples of descriptors out there. It’s a short sample, and I feel kind of bad not giving you something juicier, but too much of the rest of the book has references to other chapters and discussed ideas, making it difficult to use as an excerpt. Continue Reading