Re: call to function by text variable

2007-03-26 Thread Nanjundi
On Mar 25, 6:36 pm, "ianaré" <[EMAIL PROTECTED]> wrote: > yeah the subject doesn't really make sense does it? > > anyway want I want to do is this: > if n == 1: > > self.operations.insert(pos, operations.Replace.Panel(self, main)) > > elif n == 2: > > self.operations.insert(pos, operations.

Re: call to function by text variable

2007-03-26 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: >Cameron Laird wrote: >> In article <[EMAIL PROTECTED]>, >> Jan Schilleman <[EMAIL PROTECTED]> wrote: >>> Hi, >>> >>> try this: >>> func = getattr(operations, ["Replace", "ChangeCase", "Move"][n]) >>> >>> HTH, >>> Jan >>> >>>

Re: call to function by text variable

2007-03-25 Thread Steve Holden
Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Jan Schilleman <[EMAIL PROTECTED]> wrote: >> Hi, >> >> try this: >> func = getattr(operations, ["Replace", "ChangeCase", "Move"][n]) >> >> HTH, >> Jan >> >> "ianaré" <[EMAIL PROTECTED]> schreef in bericht >> news:[EMAIL PROTECTED] >>> yeah t

Re: call to function by text variable

2007-03-25 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Jan Schilleman <[EMAIL PROTECTED]> wrote: >Hi, > >try this: >func = getattr(operations, ["Replace", "ChangeCase", "Move"][n]) > >HTH, >Jan > >"ianaré" <[EMAIL PROTECTED]> schreef in bericht >news:[EMAIL PROTECTED] >> yeah the subject doesn't really make sense does i

Re: call to function by text variable

2007-03-25 Thread ianaré
On Mar 25, 7:01 pm, "ianaré" <[EMAIL PROTECTED]> wrote: > Cool now I can run it through the translator. > > ops = (_("Directory"), _("Replace"), _("ChangeCase"), >_("Move"), _("Swap"), _("Insert"), _("ChangeLength")) > > self.operations.insert(pos, getattr(operations, ops[n]).Panel(self, >

Re: call to function by text variable

2007-03-25 Thread ianaré
Cool now I can run it through the translator. ops = (_("Directory"), _("Replace"), _("ChangeCase"), _("Move"), _("Swap"), _("Insert"), _("ChangeLength")) self.operations.insert(pos, getattr(operations, ops[n]).Panel(self, main)) Thanks guys! -- http://mail.python.org/mailman/listinfo/p

Re: call to function by text variable

2007-03-25 Thread Jan Schilleman
Hi, try this: func = getattr(operations, ["Replace", "ChangeCase", "Move"][n]) HTH, Jan "ianaré" <[EMAIL PROTECTED]> schreef in bericht news:[EMAIL PROTECTED] > yeah the subject doesn't really make sense does it? > > anyway want I want to do is this: > if n == 1: > >self.operations.insert(p

Re: call to function by text variable

2007-03-25 Thread attn . steven . kuo
On Mar 25, 3:36 pm, "ianaré" <[EMAIL PROTECTED]> wrote: > yeah the subject doesn't really make sense does it? > > anyway want I want to do is this: > if n == 1: > > self.operations.insert(pos, operations.Replace.Panel(self, main)) > > elif n == 2: > > self.operations.insert(pos, operations.

Re: call to function by text variable

2007-03-25 Thread Gabriel Genellina
En Sun, 25 Mar 2007 19:36:26 -0300, ianaré <[EMAIL PROTECTED]> escribió: > list = ["Replace", "ChangeCase", "Move"] > textVariable = list[n] > self.operations.insert(pos, operations.[textVariable].Panel(self, > main)) > > Is something sort of like that possible? Try getattr: textVariable = "Repla

Re: call to function by text variable

2007-03-25 Thread Wojciech Muła
ianaré wrote: > like this: > > > list = ["Replace", "ChangeCase", "Move"] > textVariable = list[n] > self.operations.insert(pos, operations.[textVariable].Panel(self, > main)) > > Is something sort of like that possible? Yes: self.operations.insert( pos, getattr(operations, tex

Re: call to function by text variable

2007-03-25 Thread Steve Holden
ianaré wrote: > yeah the subject doesn't really make sense does it? > > anyway want I want to do is this: > if n == 1: > > self.operations.insert(pos, operations.Replace.Panel(self, main)) > > elif n == 2: > > self.operations.insert(pos, operations.ChangeCase.Panel(self, > main)) > > e

call to function by text variable

2007-03-25 Thread ianaré
yeah the subject doesn't really make sense does it? anyway want I want to do is this: if n == 1: self.operations.insert(pos, operations.Replace.Panel(self, main)) elif n == 2: self.operations.insert(pos, operations.ChangeCase.Panel(self, main)) elif n == 3: self.operations.insert(