Defining a code object from a function
Emile van Sebille
emile at fenx.com
Thu Apr 5 11:46:46 EDT 2001
In this example, you should be able to do:
retvals = inspect.getargs(plate.hasMoreRows.func_code)
HTH,
--
Emile van Sebille
emile at fenx.com
---------
"Neil Benn" <neil.benn at cambridgeantibody.com> wrote in message
news:3acc9132$0$12241$ed9e5944 at reading.news.pipex.net...
> Hello,
>
> I have a class as follows:-
>
>
> class plate:
>
> NoColumns = 0
> NoRows = 0
>
> currentRow = 0
>
> def __init__(self):
> print "creating plate"
> print "created plate"
>
> def hasMoreRows(self):
> if currentRow < noRows:
> return 1ist
> else:
> return 0
>
> def nextRow(self):
> self.currentRow = self.currentRow + 1
> return self.currentRow
>
> I'm using the inspect module to get information about the method
> arguments back.
>
> However...................
>
> My problem is that the getargs methods of inspect want a code object.
> Looking through the docs on Python.org I can't work out how to convert a
> method call to a code object so that I can then get the arguments back.
>
> Please could someone advise me, pretty please?
>
> Cheers,
>
> Neil Benn
> Automation Informatics Scientist
> CaT
>
>
More information about the Python-list
mailing list