Some of you who follow me may have noticed a tendency of mine to “hack” programming languages more than really use them (other than reflection via annotations in languages such as Java; I hate that stuff), and today is no different. Today, we look as using what would be normal higher-order functions as Python decorators to create new functions that encapsulate the idea of both the higher-order function as well as the passed-in function under one name. Continue Reading
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
Well, my Watch Later playlist on YouTube is extra full now! A bunch of videos from really big programming conferences have just dropped.
PyCon 2017: 144 Videos!
Google IO 2017: 158 Videos!
Now, obviously not all videos are going to interest everyone, but there’s something for just about any Python programmer in the PyCon list, and I only went through the Android videos for GoogleIO and I got 10 videos added.
With Google IO came a really cool announcement for Kotlin-Android developers, too: Kotlin is now getting first class support from Google for Android!
Sorry about being terrible at keeping up to date with my blog; Legend of Zelda Breath of the Wild is partially to blame, but it’s still all my fault 🙂 Even this new post isn’t a proper post.
I just wanted to make sure as many people as possible have heard about the latest Humble Bundle! At the $1+ level, you get Automate the Boring Stuff with Python (a pretty decent book; I’ve looked through it), Doing Math with Python, Teach Your Kids to Code, and the No Starch Sampler (No Starch Press is the publisher of most, if not all the books in the bundle). At the $8+ level, there’s Gray Hat Python, Python Playground: Geeky Projects for the Curious Programmer, and Python for Kids. In the final, $15+ level, you get Black Hat Python, Invent Your Own Computer Games With Python, and Python Crash Course: A Hands-On, Project-Based Introduction to Programming.
This is a crazy deal, since most of these books are worth more than $10 individually. PLUS, the money you pay can be divided however you like between No Starch Press, HumbleBundle.com, and the Python Software Foundation! I focused mostly on supporting the PSF, but made sure to share some with the other two as well. I hope many of you go and purchase some level of this bundle and help support Python and Python publishers!
So, this post was going to be completely different. I was going to do a post on how you can restrict the creation and scoping of certain objects using Python’s
with code blocks. Unfortunately,
with doesn’t restrict scope. Take the following code sample: Continue Reading
Hey everyone! It’s my first post of the new year! Usually, I do a bunch of book reviews at the beginning of the year, and I will certainly do that in upcoming posts. UPDATE: No, I won’t. Not this year. Sorry.
Also, don’t worry that I may have given up on my video series; I haven’t. I’m simply being a moron and doing other, less important things in my free time. I’m sure I’ll whip myself into shape soon enough.
Lastly, I’ve received a bunch of free copies of my book from Apress, so I’ll be coming up with some way to give those away sometime soon.
Onto THIS article now.
I need to start this article with a disclaimer: this isn’t really even a good idea. It’s really just a thought experiment that I did, and I’d like to show you how it could be done if you ever wanted to do it. Continue Reading