Skip to content

Instantly share code, notes, and snippets.

@mushfiq
Last active December 20, 2015 15:09
Show Gist options
  • Select an option

  • Save mushfiq/6152195 to your computer and use it in GitHub Desktop.

Select an option

Save mushfiq/6152195 to your computer and use it in GitHub Desktop.

Revisions

  1. mushfiq renamed this gist Aug 5, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. mushfiq created this gist Aug 4, 2013.
    16 changes: 16 additions & 0 deletions factory_pattern_basic
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    class Ladder(object):
    def __init__(self):
    self.hight = 20

    class Table(object):
    def __init__(self):
    self.legs = 4

    my_factory = {
    "target1": Ladder,
    "target2": Table,
    }

    if __name__ == '__main__':
    print my_factory ["target1"]().hight