AWS – Dynamodb Local

I have been hearing good things about AWS dynamodb for a while I got sometime tonight to try out a few demos from its website.

The picture above is a screenshot of the DynamoDB local client running on my Macbook. It shows the Javascript shell running in my browser.

Here is a tictoctoe game backended by the dynamodb.

Python – PEP8 Style Guide for Python Code

I came across this page, PEP is short for Python Enhancement Proposal, and PEP8 is the proposal which could/should be used as the guidelines for writing Python code.

The article is not too long but definitely not easy to digest in a short time either. Here are a few take-aways that I did not know before hand.

1. leading underscore (_variable) is a indicator that it is “weak internal use”. Also, when you import * from a package, objects start with one leading underscore will not be imported.

2. double leading underscore means name mangling which will concatenate the class name with the method for internal use (class myclass: … __mymethod will be myclass__mymethod__). For example, when you write Python following OOP style, you can declare an attribute with double leading underscore to make that attribute not visible to the outside.
Check out this example.

3. For the variables which have double leading and trailing underscores, those “magic” objects or attributes live in user-controller namespace. Don’t invent them and only use them as documented.

4. when implementing ordering operations with rich comparisons, it is recommended to implement all 6 operations like (__eq__:==, __ne__:!=, __lt__:<, __le__:<=, __gt__:>, __ge__:>=)


Python –

Whenever you play with a python package, you will always see some boilerplate files or structures here and there. is a file that resides in most of the packages. And even sometimes, they are empty, so what they do?

Here is a summary of its functionalities:

1. It will treat the directory where it is as a loadable module.
Here is a real world example showing you what difference even an empty makes.

2. You can define __all__ variable in to decide when user type in from package import *, which modules will be loaded.

Screenshot 2015-01-03 11.18.34

3. Define a commonly used variable, check out this Stackoverflow answer.