Posts

Showing posts with the label oop

Binding Class Attributes In Python (Part 2)

Image
Hello everyone, sorry I haven’t blogged for a while but I was busy with other matters and barely managed to allocate enough time over the weeks to write this article. My last article was about how you can use Python to bind to class attributes together so that updating one automatically updates the other. I also demonstrated how we used this method in a college project to implement a MIPS processor by defining each block, defining its inputs and outputs (in terms of inputs) and then, using the demonstrated method, tell Python that the output of this block is connected to the input of the other block and just letting everything evaluate itself automatically. This was, by far, the most viewed article on my blog, so if you haven’t read this article, I recommend you go do that now, just follow this link . The old article also contains a lot of essential background which is required for understanding this article, so if you want to make the most of this article, read the old one firs

Binding Class Attributes In Python

Image
You can also read this article from my LinkedIn here . If you’re not interested in my personal motivation to do this, you can skip right to the Essential Python Background section. Introduction During my last semester, my friends and I were studying a course called Computer Architecture . This course covered topics concerning how a computer processor works and how it is built and wired up internally. As a project, we were asked to build a software simulator that should be given input in the same manner a computer processor is given input, and then it produces the same output as the processor. After a lot of discussion, and despite facing some opposition, we decided that Python was the right tool for the job. The thing is, we had something in mind, that would make the whole process a trivial piece of cake but that something was not offered by default in Python. We had to build it ourselves. I was given the task of making this magic happen and I will explain what this magic wa