Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Equipment Portal
#2
It's unclear what your code is supposed to do and in any case we can comment on your code/implementation and we can hardly suggest new features. That's why I will comment on your signature.
  • dad_has_cigs is obviously a bool. Comparing it to True and False is redundant. while dad_has_cigs: and if not dad_has_cigs: is enough.
  • If dad_has_cigs is True and you enter the loop, there is no was that consecutive if dad_has_cigs == False: condition to be evaluated True and execute the body. You never change the value of dad_has_cigs so it will never be executed, unless it's considered to be global variable and changed independently in different thread (i.e. dad smokes in a different threat).
  • Indentation is unclear, but I guess last 3 lines are indented.
  • I hope this comment will not be taken too seriously, but some lessons will be learnt :-)


And some comments on your "main" code
  • Cryptic [one-letter] names.
  • No comments
  • Mix of GUI and logic
  • heavy use of global variables
  • repetitive code, in need of refactoring
I guess it's clear all of the above is considered bad practice.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
Equipment Portal - by jamesaarr - Sep-22-2021, 07:52 AM
RE: Equipment Portal - by buran - Sep-23-2021, 07:22 AM
RE: Equipment Portal - by jamesaarr - Sep-23-2021, 09:08 AM
RE: Equipment Portal - by ndc85430 - Sep-23-2021, 11:23 AM
RE: Equipment Portal - by buran - Sep-23-2021, 11:24 AM
RE: Equipment Portal - by ndc85430 - Sep-23-2021, 12:07 PM

Forum Jump:

User Panel Messages

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