Python Forum
Is inheritnace the only option
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is inheritnace the only option
#2
inheritance would make sense here.

But a couple things
  1. you can get rid of the private variables as well as the getters and setters. If you need the class variables, just use them.
  2. use format not concatenation 
Quote:return "ID: " + self.iden + " " + " First: " + self.first_name + " Last Name: " + self.last_name + " " + " Type: " + self.student_type
'
return "ID: {} First: {} Last Name: {} Type: {}".format(self.iden, self.first_name, self.last_name, self.student_type)
Recommended Tutorials:
Reply


Messages In This Thread
Is inheritnace the only option - by QueenSvetlana - Oct-29-2017, 10:43 PM
RE: Is inheritnace the only option - by metulburr - Oct-29-2017, 11:50 PM
RE: Is inheritnace the only option - by snippsat - Oct-30-2017, 05:51 PM
RE: Is inheritnace the only option - by metulburr - Oct-30-2017, 10:49 PM
RE: Is inheritnace the only option - by metulburr - Oct-31-2017, 01:41 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020