practice oop in python

I would like to practice OOP
(I have made below example working but not use python and not OOP)

below procedure is my beginning but got stuck now .

Question1: if I have 10000+ applications ,means I will need to create 10000+ instance ?

me: use loop to create instances ? cost lots of memory ?

Question2: How can I only get instance which status is false from all instance?

me: use another list to record the status which is false while using loop to create new instance?

Example: install 30 applications if my computer not install

*Environment: Python, Windows7

*my procedure:

  class app:
   def __init__(self,name , guid , path  ):
   ....self.application_name = name
   ....self.application_guid = guid
   ....self.execution_path = path
   ....self.status = self.is_installed()

   def is_installed():
   ....import winreg 
   ....read GUID in registry HKLM/..../uninstall/
   ....if no exception then return True
   ....else return False 

what I did now without OOP

array[1000][3]={{"MSSQL","{XXXX-XXX}","C:"},.....}

(store application’s name, guid, path)

Function()
# use loop to check all applications' status and return another array(B) 
# process installation according to array(B) 


Source: oop

Leave a Reply