This post relates to class held from Sept 9-Sept 13.
In the first week of class the concept of object oriented programming was discussed. Basic and easy examples to Python classes were presented.
I learned an interesting way of editing a class in-line.
class ARandomClass():
def aRandomFunction(self):ARandomClass.i = 3
return self.i
print(ARandomClass.aRandomFunction(ARandomClass))
as opposed to
The latter definition of the class ARandomClass is much cleaner and easier to work with, however, I have a mild background of working with python among other languages, and have never seen this way of editing a class. The week left me impressed with the level understanding and knowledge coming form the professors. I was very eager to dive into the work and assignments which would come up.class ARandomClass():
def __init__(self):
self.i = 3def aRandomFunction():print(ARandomClass.aRandomFunction(ARandomClass))
return self.i
No comments:
Post a Comment