MorneTer / pwp-capstones

0 stars 0 forks source link

Initializing sub-classes using universally accepted syntax #4

Open jmcrey opened 6 years ago

jmcrey commented 6 years ago

https://github.com/MorneTer/pwp-capstones/blob/04fefad0f4be95b01417d24acbe8c23b5f400dee/Submit/TomeRater.py#L86-L88

This version of initializing a child class is perfectly acceptable in Python 2.7.x; however, it will not work in Python 3.x. For Python 3.x, the initialization with super would look like the following:

super().__init__(title, isbn, price)

However, we can make our implementation universally acceptable (i.e. syntactically correct across all of Python's versions) by using the following syntax:

Book.__init__(self, title, isbn, price)

Any way of doing it is absolutely acceptable; it is just a matter of what the software is required to support. Just a note! Either way, great job with this implementation and correctly using super for Python 2.7.x.