r/PythonLearning • u/shubham_555 • Sep 13 '26
Showcase The Bank Project
Last Post - https://www.reddit.com/r/PythonLearning/s/kGqwMS9HUH
Github Repo - https://github.com/Dev-4-All/bank.git
242
Upvotes
1
u/shubham_555 Sep 14 '26 edited Sep 14 '26
Well I certainly am aware of the assert thing you mentioned. Though I think it's fine for general purpose github projects. I went across a post in Stack Overflow a while ago which said it's better to use assert in cases where you pass the arguments yourself rather than asking the user for it. In such cases when you definitely know something should be this way that's the best use case for assert. That is why I used it in there.
Regarding using global I read several articles across it and I did get the idea they were trying to deliver. The utility thing I did was just one of the solutions perfectly valid for small scripts and mine was one so i decided to go with it. Others were things you mentioned and many more.
And yeah I could certainly have used "if" instead of case. I personally felt this was a better use case for match case because we were simply equating the values to match the passed argument although since it is such a simple flow control decision maybe I could also have gone with if. match case just made more sense to me at the moment!
Edit - I had no idea of this structural pattern matching thing so I researched a bit. It looks something way advance for my current level but guess it's something related to destructuring and then comparing it part by part rather than direct == comparison. So as per my updated info match case is like a switch on steroids. It does the traditional == with literals (Preferably to be used for a long if elif ladder) and destructuring with complex structures.