23 AUG 2019

Class properties as __dict__: we saw that all of the properties in a class are stored in a dictionary property called __dict__. whenever we add a property to the object (i.e. using self.name = name) then the property (‘name’ [and its value]) is added into this dictionary (__dict__). this gives us the flexibility of adding properties into the class dynamically- by simply adding entries into __dict__ (or even set the dictionary as a whole). this could also assist us in writing a generic __str__- by simply printing all of the key-values inside of the __dict__

Representational State Transfe (REST) client in python: we saw how to fire a GET HttpRequest from python to a REST web service. then we took the JSON string result and parsed it into a dictionary… and now we can create an object properties from this dictionary (as mentioned above, using __dict__)

More topics covered:

  • REST architecture
  • GET POST PUT DELETE
  • Single Page Application (SPA)
  • python requests install
  • python json import
  • json.loads command
  • list class requires repr implementation 

Links:

Leave a comment