Re: [Tutor] Ask a class for it's methods

2008-12-15 Thread Kent Johnson
On Fri, Dec 12, 2008 at 6:06 PM, Shrutarshi Basu wrote: > Is there a way to ask an object for a list of it's > methods (with argument requirements if possible)? Take a look at the inspect module. If it does not directly give you what you need, look at the source - it looks at function attributes

Re: [Tutor] Ask a class for it's methods

2008-12-13 Thread Lie Ryan
On Sat, 13 Dec 2008 10:19:34 +0100, Andreas Kostyrka wrote: > On Sat, Dec 13, 2008 at 08:03:10AM +, Lie Ryan wrote: >> On Sat, 13 Dec 2008 02:59:34 +0100, Andreas Kostyrka wrote: >> >> > On Fri, Dec 12, 2008 at 06:06:35PM -0500, Shrutarshi Basu wrote: >> >> I have a list containing strings li

Re: [Tutor] Ask a class for it's methods

2008-12-13 Thread Andreas Kostyrka
On Sat, Dec 13, 2008 at 08:03:10AM +, Lie Ryan wrote: > On Sat, 13 Dec 2008 02:59:34 +0100, Andreas Kostyrka wrote: > > > On Fri, Dec 12, 2008 at 06:06:35PM -0500, Shrutarshi Basu wrote: > >> I have a list containing strings like : > >> > >> func1[] > >> func2[1,2] > >> func3[blah] > >> > >>

Re: [Tutor] Ask a class for it's methods

2008-12-13 Thread Lie Ryan
On Sat, 13 Dec 2008 02:59:34 +0100, Andreas Kostyrka wrote: > On Fri, Dec 12, 2008 at 06:06:35PM -0500, Shrutarshi Basu wrote: >> I have a list containing strings like : >> >> func1[] >> func2[1,2] >> func3[blah] >> >> I want to turn them into method calls (with numeric or string >> arguments) o

Re: [Tutor] Ask a class for it's methods

2008-12-12 Thread Andreas Kostyrka
On Fri, Dec 12, 2008 at 06:06:35PM -0500, Shrutarshi Basu wrote: > I have a list containing strings like : > > func1[] > func2[1,2] > func3[blah] > > I want to turn them into method calls (with numeric or string > arguments) on a supplied object. I'm trying to figure out the best way > to do this

Re: [Tutor] Ask a class for it's methods

2008-12-12 Thread Lie Ryan
On Fri, 12 Dec 2008 20:05:23 -0500, Shrutarshi Basu wrote: > I normally would use exceptions, because I think exceptions are a great > idea. But since the functions may be time-consuming graphics functions > and the lists could easily be hundreds of such calls, I don't want the > user to sit aroun

Re: [Tutor] Ask a class for it's methods

2008-12-12 Thread Shrutarshi Basu
I normally would use exceptions, because I think exceptions are a great idea. But since the functions may be time-consuming graphics functions and the lists could easily be hundreds of such calls, I don't want the user to sit around for something that might fail. Of course, I'm just starting so my

Re: [Tutor] Ask a class for it's methods

2008-12-12 Thread Alan Gauld
"Shrutarshi Basu" wrote I have a list containing strings like : func1[] func2[1,2] func3[blah] I want to turn them into method calls (with numeric or string arguments) on a supplied object. The easiest way is to call getattr() which will return a reference to the method if it exists. be r

[Tutor] Ask a class for it's methods

2008-12-12 Thread Shrutarshi Basu
I have a list containing strings like : func1[] func2[1,2] func3[blah] I want to turn them into method calls (with numeric or string arguments) on a supplied object. I'm trying to figure out the best way to do this. Since these lists could be very big, and the methods could be rather complex (mai