I am using package listings to import my Python source code into my LaTeX document. I use the command \lstinputlistings. I have a Python source like
class MyClass(Yourclass):
def __init__(self, myvar, yours):
bla bla bla...
What should I write in my \lstset command in order to enlight words MyClass, init etc.? I wouldn't want to write any word I want to be highlighted. I tried using moredelims=[s][\color{teal}]{class}{(} inside lstset but it doesn't work.
And why is morekeywords={...} not working with lstinputlistings. It does with lstlistings environment, but doesn't with input from a source file.

moredelimsoption. Will\lstset{language=Python,morekeywords={as,init}, moredelim=*[s][\color{teal}]{MyClass}{)}, moredelim=*[s][\color{teal}]{__}{)}}work for you? If you provide a minimal working example (MWE) and perhaps post your output or clarify what you are trying to achieve, then you may get better help. – hpesoj626 Nov 22 '12 at 02:30