Python – Get current function and parent function

When troubleshooting a fairly complex Python script I tend to find it a massive headache when working out the flow of the functions. What function am I currently in? What function called it etc. Looking through the docs I finally discovered the inspect module.

By making the following two functions;

def returnFunction():
return inspect.stack()[1][3]
def returnParent():
return inspect.stack()[2][3]

I can now call these from within my logger.debug lines and output the current function and parent function (the one that called the current function), all as soon as it executes.

An example;

logger.debug(“currentFunction=\”%s\” parentFunction=\”%s\””,returnFunction(),returnParent())

Read More

Beginning JavaScript and jQuery Development – IDE

C, C++ and Python development is something I have done for a while over the past few years now with some professional and academic experience. This has seen me through a lot of projects but now the time has come to expand to web technologies! I’m already good with HTML and CSS so the next step is JavaScript and jQuery, to do this I’m going to need a new integrated development environment (IDE).

Meet Aptana

Its a fully featured web development IDE that’s based on Eclipse, which if you’ve read my previous posts you will already know it is my preferred IDE.

Aptana suppports HTML, CSS and JavaScript code assistance along with PHP and Ruby, an integrated debugger for Ruby and JavaScript and also git integration if you use git for your project management.
Oh and a fair bit more. It also has the decent dark background, eerie colour scheme that I and so many others enjoy when developing.

I will write up a proper review and how-to once I’ve had time to give it a proper test run and put it through its paces, but first I’m going to need to learn some JavaScript! 🙂

Read More