Saga – a heroic narrative
I first coded in python in October 2009. I had an idea for a chess website, and decided to try out Django. I had coded a fair bit in Ruby, and explored rails too. So, the dynamic aspect of python and magical qualities of Django did not overwhelm me. It took me just 7 days to launch the website. The users could solve chess combinations. So, I consider it a small success. But, then I did not take the site any further. Now, in the beginning of 2011, I came up with the idea of adding a new feature – Solitaire Chess. This time around, I had to dig deeper in python. And, these are some of my learnings -
I needed a class which would generate FEN string, based on the position on the chessboard. Now, FENgenerator.py had class FENGenerator. The module name is FENgenerator(the name of the file itself). I imported “FENgenerator”, and tried
to create an object, FEN = FENGenerator(), and got the above “TypeError”.
In python, everything is an object, including a module.The above import statement, does not import names in the module. So, to create an object, I had to do – FEN = FENGenerator.FENGenerator
The code –
if matter == "Urgent":
givep = "yes
givep = "low"
easy_install django-extensions -> downloads all the packages from an online repository