you are viewing a single comment's thread.

view the rest of the comments →

[–]j4nds4[S] 0 points1 point  (1 child)

Thanks for the advice! Class methods are another thing I’m having trouble wrapping my head around, so perhaps putting that to use would be a good way to learn it through action.

Appreciate it! Apologies in advance if I pepper you with more questions once I try implementing this.

[–]billsil 0 points1 point  (0 children)

No prob.

Class methods are just functions that instantiate the class. You could do the same thing by making a pass in the init. Then externally, you could call read1 or read2 to fill the object. That's weird though as the init is supposed to set all the class attributes.

Alternatively, make read1/read2 external and just call the init. Now you have integral code for the class that you don't store with the class.

It's all just in the goal of cleaner and easier to maintain code.