adequately good

decent programming advice

written by ben cherry



all articles filed under python

JavaScript-Style Objects in Python

One of JavaScript's most convenient features is the object syntax. Objects are so easy to work with. You've got a lot of ways to make them, although the object literal syntax in particular kicks ass. You can access and assign them with either the dot operator or dictionary syntax. Missing properties just return undefined. This is just a really fantastic object model.

So, today, I sat ...