Python Forum
ATM machine (deposits/withdrawals) using OOP
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ATM machine (deposits/withdrawals) using OOP
#14
Thank you deanhystad for your reply.

(Mar-10-2022, 09:56 PM)deanhystad Wrote: self is completely a convention, but conventions are important. When calling a method of an instance, Python passes the instance as the first argument. When calling a method of a class, Python passes the class as the first argument. It is convention to use "self" and "cls" for these first arguments. You could use "this" and "class_", but that would confuse others used to the conventions.

Thank you, this does a better job of clarifying the point I was trying to make earlier. When calling a method of an instance, Python passes the instance of the first argument.

Quote:Your error is that self is an instance of Account, not an instance of TimeZone. self is an instance of Account because "deposit()" is an instance method of Account, and the first argument in deposit(self) is an instance of Account. Account does not have an attribute "transaction_time_id_format".

In the latest (and near final I think) iteration of my script (quoted at the end - - one post above), Account now has instantiates TimeZone which now includes a class method that calls transaction_time_id_format.

It seems to work really well now. Any further suggestions, comments, and observations on my script welcome. Dance

Quote:Question is, what should have a timezone? Right now I don't think you have any time zones. You have a class, but did you create any instances? And if you have an instance of Timezone, where is that kept? What is a time zone associated with? The Account? I don't know. I can do banking in different time zones. Is the purpose of TimeZone to convert from UTC to my local time, or is it to convert the time from where the transaction took place to UTC?

I believe these considerations are beyond the scope of the rudimentary ATM bank machine app as set out by the instructor for now, but I may return this in the future if I decide to refine my timezoning features.
Reply


Messages In This Thread
RE: ATM machine (deposits/withdrawals) using OOP - by Drone4four - Mar-14-2022, 09:28 PM

Forum Jump:

User Panel Messages

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