Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #59801

Fire Method by predefined string!

Date 2013-11-17 22:46 +0100
From Tamer Higazi <th982a@googlemail.com>
Subject Fire Method by predefined string!
Newsgroups comp.lang.python
Message-ID <mailman.2807.1384725251.18130.python-list@python.org> (permalink)

Show all headers | View raw


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)
        #possible ?!
        self.__param():


    def _DoSomething(self):
        print 'I did it!'

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Fire Method by predefined string! Tamer Higazi <th982a@googlemail.com> - 2013-11-17 22:46 +0100
  Re: Fire Method by predefined string! Roy Smith <roy@panix.com> - 2013-11-17 17:20 -0500
    Re: Fire Method by predefined string! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-11-18 01:41 +0000
      Re: Fire Method by predefined string! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-18 02:29 +0000
  Re: Fire Method by predefined string! Rick Johnson <rantingrickjohnson@gmail.com> - 2013-11-17 14:23 -0800
    Re: Fire Method by predefined string! Rick Johnson <rantingrickjohnson@gmail.com> - 2013-11-17 14:38 -0800

csiph-web