Re: Dynamic method invocation

2009-06-26 Thread jythonuser
Actually let me add that in jython I don't need to always use MyShell. It may be ok to wrapper it with some Jython class which then delegates to MyShell. So something like shell = MyJythonShell() shell.grep (grep_args) So MyJythonShell is defined in Jython which calls MyShell. Am wondering how

Re: Dynamic method invocation

2009-06-26 Thread jythonuser
Sorry for being a little vague. The last part of your response seems like what I would need. So here are more details on what I am trying to do. I have an extensible command shell in java where commmand providers plug in to supply new commands. I have a java class called MyShell which has execC

Re: Dynamic method invocation

2009-06-23 Thread Diez B. Roggisch
jythonuser schrieb: Hi I am new to jythong and was wondering if/how I can do the following - a) register a java object with a given name with jython interpreter using set method b) call methods on the java object - but the methods may not exist on the object, so I would like to call from jython

Dynamic method invocation

2009-06-23 Thread jythonuser
Hi I am new to jythong and was wondering if/how I can do the following - a) register a java object with a given name with jython interpreter using set method b) call methods on the java object - but the methods may not exist on the object, so I would like to call from jython a generic method that

dynamic method question

2008-06-12 Thread Jesse Aldridge
eplace("\n", "").split(", ") for name in method_names: event_name = name.partition("_")[2] event_name = "wx.EVT_" + event_name.upper() exec("def " + name + "(self, e):\n" +

Re: Dynamic method parameter access?

2008-02-14 Thread Peter Otten
Dennis Kempin wrote: > Chris schrieb: >> On Feb 12, 9:38 pm, Dennis Kempin <[EMAIL PROTECTED]> wrote: >>> Hello, >>> >>> I have a set of some objects. With these objects I want to call a Python >>> method. But the writer of the method shall have the option to select >>> from these objects as metho

Re: Dynamic method parameter access?

2008-02-14 Thread Dennis Kempin
Chris schrieb: > On Feb 12, 9:38 pm, Dennis Kempin <[EMAIL PROTECTED]> wrote: >> Hello, >> >> I have a set of some objects. With these objects I want to call a Python >> method. But the writer of the method shall have the option to select >> from these objects as method parameter. >> >> At the mome

Re: Dynamic method parameter access?

2008-02-12 Thread Chris
On Feb 12, 9:38 pm, Dennis Kempin <[EMAIL PROTECTED]> wrote: > Hello, > > I have a set of some objects. With these objects I want to call a Python > method. But the writer of the method shall have the option to select > from these objects as method parameter. > > At the moment i use the following w

Dynamic method parameter access?

2008-02-12 Thread Dennis Kempin
Hello, I have a set of some objects. With these objects I want to call a Python method. But the writer of the method shall have the option to select from these objects as method parameter. At the moment i use the following way to call a method with the a or b or both parameter. try: meth

Re: Dynamic method

2007-07-17 Thread Bruno Desthuilliers
Daniel a écrit : > Bruno Desthuilliers wrote: >>> Another way is to use the 'types' module: >> True - and that's somewhat cleaner since it doesn't expose the internals >> of the descriptor protocol. OTHO, it can lead to strange results with >> callables not implementing the descriptor protocol: >

Re: Dynamic method

2007-07-16 Thread Daniel
Bruno Desthuilliers wrote: > > > Another way is to use the 'types' module: > > True - and that's somewhat cleaner since it doesn't expose the internals > of the descriptor protocol. OTHO, it can lead to strange results with > callables not implementing the descriptor protocol: Actually, the resu

Re: Dynamic method

2007-07-16 Thread Bruno Desthuilliers
Lawrence Oluyede a écrit : > Bruno Desthuilliers <[EMAIL PROTECTED]> > wrote: >>> I agree that in general the solution explained by Alex and you is better. >> They are not "better" - they are correct. > > Another way is to use the 'types' module: True - and that's somewhat cleaner since it doesn'

Re: Dynamic method

2007-07-16 Thread Lawrence Oluyede
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > > I agree that in general the solution explained by Alex and you is better. > > They are not "better" - they are correct. Another way is to use the 'types' module: In [1]: class T(object): ...: pass ...: In [2]: t = T() In [3]: import

Re: Dynamic method

2007-07-11 Thread Bruno Desthuilliers
Daniel Nogradi a écrit : (snip) >> > def method_for_instance( message ): >> >print message >> > >> > class myClass( object ): >> >pass >> > >> > inst = myClass( ) >> > inst.method = method_for_instance >> > >> > inst.method( 'hello' ) (snip) >> This won't work as expected: >> >> class Bidul

Re: Dynamic method

2007-07-11 Thread Daniel Nogradi
> >> I have an issue I think Python could handle. But I do not have the > >> knowledge > >> to do it. > >> > >> Suppose I have a class 'myClass' and instance 'var'. There is function > >> 'myFunc(..)'. I have to add (or bind) somehow the function to the > >> class, or > >> the instance. Any help, i

Re: Dynamic method

2007-07-10 Thread Bruno Desthuilliers
Daniel Nogradi a écrit : >> I have an issue I think Python could handle. But I do not have the >> knowledge >> to do it. >> >> Suppose I have a class 'myClass' and instance 'var'. There is function >> 'myFunc(..)'. I have to add (or bind) somehow the function to the >> class, or >> the instance.

Re: Dynamic method

2007-07-10 Thread Alex Popescu
On Jul 10, 5:07 pm, "Daniel Nogradi" <[EMAIL PROTECTED]> wrote: > > I have an issue I think Python could handle. But I do not have the knowledge > > to do it. > > > Suppose I have a class 'myClass' and instance 'var'. There is function > > 'myFunc(..)'. I have to add (or bind) somehow the function

Re: Dynamic method

2007-07-10 Thread Daniel Nogradi
> I have an issue I think Python could handle. But I do not have the knowledge > to do it. > > Suppose I have a class 'myClass' and instance 'var'. There is function > 'myFunc(..)'. I have to add (or bind) somehow the function to the class, or > the instance. Any help, info or point of reference is

Dynamic method

2007-07-10 Thread Gabor Urban
Hi guys. I have an issue I think Python could handle. But I do not have the knowledge to do it. Suppose I have a class 'myClass' and instance 'var'. There is function 'myFunc(..)'. I have to add (or bind) somehow the function to the class, or the instance. Any help, info or point of referenc