Re: Fire Method by predefined string!

2013-11-17 Thread Mark Lawrence
On 18/11/2013 01:41, Steven D'Aprano wrote: On Sun, 17 Nov 2013 17:20:52 -0500, Roy Smith wrote: In article , Tamer Higazi wrote: I want the param which is a string to be converted, that I can fire directly a method. Is it somehow possible in python, instead of writing if else statements

Re: Fire Method by predefined string!

2013-11-17 Thread Steven D'Aprano
On Sun, 17 Nov 2013 17:20:52 -0500, Roy Smith wrote: > In article , > Tamer Higazi wrote: >> I want the param which is a string to be converted, that I can fire >> directly a method. Is it somehow possible in python, instead of writing >> if else statements ???! > > I'm not sure why you'd want

Re: Fire Method by predefined string!

2013-11-17 Thread Rick Johnson
On Sunday, November 17, 2013 4:23:11 PM UTC-6, Rick Johnson wrote: > 2. Never start a function or method with a lowercase letter. > Please read PEP8 Urm... let me correct that: 2. Never start a function or method with a UPPERCASE letter. Initial uppercase should be reserved for class names only

Re: Fire Method by predefined string!

2013-11-17 Thread Rick Johnson
On Sunday, November 17, 2013 3:46:16 PM UTC-6, Tamer Higazi wrote: > class(object): > def Fire(self,param) > #possible ?! > self.__param(): > def _DoSomething(self): > print 'I did it!' 1. First off your class declaration is not valid -- it needs an identifier! 2.

Re: Fire Method by predefined string!

2013-11-17 Thread Roy Smith
In article , Tamer Higazi wrote: > Hi people! > > Assume we have 2 methods, one called Fire and the other __DoSomething. > > I want the param which is a string to be converted, that I can fire > directly a method. Is it somehow possible in python, instead of writing > if else statements ???! >

Re: Fire Method by predefined string!

2013-11-17 Thread Ian Kelly
On Sun, Nov 17, 2013 at 2:46 PM, Tamer Higazi wrote: > Hi people! > > Assume we have 2 methods, one called Fire and the other __DoSomething. > > I want the param which is a string to be converted, that I can fire > directly a method. Is it somehow possible in python, instead of writing > if else s

Fire Method by predefined string!

2013-11-17 Thread Tamer Higazi
Hi people! Assume we have 2 methods, one called Fire and the other __DoSomething. I want the param which is a string to be converted, that I can fire directly a method. Is it somehow possible in python, instead of writing if else statements ???! Tamer class(object): def Fire(self,param)