Python : Crating Dynemic Functions

Posted by jigar on Stack Overflow See other posts from Stack Overflow or by jigar
Published on 2011-01-03T06:38:38Z Indexed on 2011/01/03 6:54 UTC
Read the original article Hit count: 210

Filed under:

I have issue where i want to create Dynamic function which will do some calculation based to values retrieved from database, i am clear with my internal calculation but question in how to create dynamic class:

My Structure is something like this :

class xyz:

def Project():

   start = 2011-01-03

   def Phase1():
      effort = '2d'
   def Phase2():
      effort = '3d'
   def Phase3():
      effort = '4d'

Now want to generate those all PhaseX() function dynamically so can any one suggest me how to achieve such thing using Python Code

Waiting for Positive reply Regards Thank You

© Stack Overflow or respective owner

Related posts about python