Shell Plus, iPython or Shell Prompt Looks Screwed Up

If your prompt ever looks like this:

Python 2.7.3 (default, Oct 22 2012, 06:12:32)
Type "copyright", "credits" or "license" for more information.

IPython 0.13 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
[0;34mIn [[1;34m1[0;34m]: [0m

To fix, simply run: easy_install -a readline

Why I chose Python

F*ck me. Had enough of these m*thf**kin snakes. I need a Royale with Cheese

As a newbie learning to code, the first question that you are faced with is: which programming language to choose? The purists would say it doesn’t matter. The customers don’t care if your site is coded in ASP.NET or PHP. As long as it’s solving a problem for them, it might as well have been written in Punjabi, no one gives a shit.

But this is one of those decisions that are less reversible down the road. So I wanted to make an informed decision. It came down to a choice between C#, Python, PHP or Ruby. I decided to tap on the infinite wisdom of the internet by asking questions. Its quite funny to see how quickly a shitstorm can be created with such a subjective and personal topic.





Hacker News

This was the best advice in my opinion:

Working with a language is usually a personal preference. Pick a language out of the 3 you mentioned and build something relatively simple:

  • One simple web page
  • How media(css, js) is handled in the framework
  • Connect to a database
  • One table to store your data
  • A form to save information into the table
  • Deploy it live

Do the above with all 3 of the languages and pick the one that makes your life easy. You won’t know which language fits your personality until you try them all to achieve the same task.

Decisions, decisions, decisions.

I went back to basics. My goal is to launch another startup. To do that, I needed to hunt for a technical cofounder. The personality that a technical cofounder ought to exhibit would lead him to naturally explore new languages and technology beyond his comfort zone. In this way, I generally regard C# as a safe corporate language to pursue a career in – not quite the hacker trait. From what I have read, PHP is just an inferior language to Python and Ruby. Even though a lot of people are using PHP because it is easy to get started, it seems to be easier to develop bad habits with PHP. Why jump on a bandwagon when you obviously know is broken? Granted there might be a bigger talent pool to choose from, all it means is there are more bad PHP programmers to sift through IMO.

So it came down to Python or Ruby. This is where it got a bit more arbitrary. In terms of popularity, Python and Ruby are probably the ‘in’ languages to know now. So my hacker technical cofounder would probably know either if not both. At this point, I did a quick search for number of questions tagged with Python vs. Ruby on Stackoverflow.

When I did it 1.5 months ago:

  1. Python – 43,082
  2. Ruby – 16,836

Now (FYI):

  1. Python – 48,040
  2. Ruby – 18,937

More questions asked in Python roughly means more people to answer my newbie questions down the road. So with that, I chose the snake over the gem.

How I am learning Python from Scratch

Obligatory Python reference

First the context – I come from a finance major. My background in application programming is close to zero. I am probably a typical ‘business’ guy with no technical skills and no MBA.

At my last startup, I spent approximately 1.5 years on and off working in T-SQL on SQL Server 2005/2008. I’ve written hundreds of stored procedures during that period.

Now, I am teaching myself to code in Python with the aim of creating a databound web application all by myself. I have found that a lot of Python books just ‘talk at you’ which I don’t particularly like. I learn most when I’m hands-on with the tutorial so my learning process has a lot of ‘doing’. Traditionally, the HeadFirst series of books are good at this kind of teaching but I really didn’t like their book on Python. (Their HTML/CSS one was brilliant though)

This is the current learning process that I used:

  1. Read Learn Python the Hard Way. This is for a complete beginner and it forces you to learn by doing. I have to admit, I skipped some parts because author got really into his game example. Also note that some basic concepts like list comprehensions are not mentioned in his book.
  2. Having done that, I tried applying my newfound knowledge by practising exercises from the CS department at the Michigan State University here . I found their site randomly. Whilst doing the questions, I had to ask a lot of basic questions on Stackoverflow like this and this. Some of my questions started to get down voted because it seemed as if I didn’t do my research/homework properly. There were also some comments saying Learn Python the Hard Way is not an ideal starting book. So with that, I realised I had to strengthen my basics and read other books and tutorials
  3. The next beginner book was Think Like a Computer Scientist. I liked this book a lot but it does assume some basic prior knowledge in Python. I followed up by doing questions from the MIT open Python course which can be found here. I did all the questions there except for the last bit on creating a Tetris game. I wasn’t too keen on that so I skipped it.
  4. In between the books, I also watched some video tutorials. I found thenewboston good in explaining OOP concepts. He has a very laid back relaxed approach to his tutorials and his videos are all in bite-sized chunks.
  5. Currently, I am internalising all my knowledge by doing exercises. I found a good one at I like the fact they have a leaderboard game mechanic template on their site. There are 165 questions in total and so far only 1 dude could be asked to finish all the questions. I’m skipping all the questions about matrics just because I don’t think I would be needing that knowledge in creating a webapp. Are you purists flippin’ out now?

So far, I have devoted on an average of 15 hours per week for the last 3-4 weeks. Once I finish the questions at Pyschools, I would consider myself an ‘expert beginner’.

It’s probably worth noting that I spent 1/2 days dabbling in Django. Because I was using a windows machine, I spent a lot of time messing about the configuration and setting it up. Once I did though, I realised I wasn’t good enough in Python to fully understand what was going on.

At this juncture, I am probably going to attempt a simple OOP programme with classes and methods. Following which, I will attempt to learn Django again and see how it goes. If I feel my Python is still not up to scratch, I will probably attempt Dive In Python 3 as a lot of Stackoverflowers and HN-ers have been recommending it.

Hope this helps the next wannabe Pythonista (Yes, that’s what they call themselves). Feel free to add resources and recommendations to the learning process in the comments.

Part 2


Some other helpful links: (not tested) (not tested ) (not tested). (Ruby)