Accidentally on purpose.


Install cx-Oracle on Mavericks correctly

cx-Oracle is a Python Oracle DB connection package, ealier today I met some trouble installing on my macbook running Mavericks, after hacking I found the means to install it correctly:

  1. Download and from
  2. Download the cx-Oracle source code from

  3. Create a new directory to place the Oracle client files.

    mkdir -p /opt/oracle/

Contribute your project to the world: submit a package to PyPI

The PyPI(Python Package Index) is a repository of software for the Python programming language. There are currently 45k packages. Anyone can upload a Python project on it. Since your project being successfully uploaded, everybody in the world can simply install it by pip or easy_install. It’s significant to learn how to submit a project on PyPI.

Create the

Assume that you have a project named my_project, firstly you need to move it into an empty folder, then create a file named like this:


Improve you Python: what is metaclass?

The significance of understanding metaclass lies not in using itself, but in understanding what classes are in Python. For the purposes of this post, I will be talking about classes in Python, and try to explain what is metaclass.

Everything in Python is an object.

It is well-known that everything in Python is an object, and classes are used to create objects.

In fact, classes are objects too.

>>> class Dog(object):
... pass
>>> foo = Dog()
>>> type(foo)
<class ''="">
>>> foo
<__main__.Dog object at 0x10baf0f10>

When we defined the classs Dog, Python created an object named Dog, and the object Dog is an object as well as an object creator.

Some questions you may be asked during a Python job interview.

It’s fairly easy to learn the Python syntax, but Python as a full-featured language, is not that easy to be fully mastered.

In my experience, these questions are the most likely be asked during a Python job interview, I wrote down the answers, hope that may help you!

**Q: What is lambda operator in Python, how do you use it?****

A: The lambda operator or lambda function is a way to create small anonymous functions

for example:

>>> f = lambda x, y : x + y
>>> f(2,2)

A fresh start

Recently I shut down my weblog, thinking about how to write articles with more influence. Then I decided to start a brand new blog, and this time I write articles only in English.

For years I’ve been blogging in Chinese, which developed me a bad habit: Always want to translate some nice stuff from English to Chinese, and rarely write something on my own. Due to this, I decided to start a English weblog where I write only original articles.

Besides, I write stuff for improving my English, English is the working language of the hacker culture and the Internet, for better take part in technical discussions, I must improve my fluency in English.

I will share my ideas and thoughts, continue writing interesting stuff here.

So this is the fresh start.

There are no more results.