Python Forum
Improvements for first script?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Improvements for first script?
#2
Addressing style part of code:

I think that it would be good idea to read and implement PEP 8 -- Style Guide for Python Code, specifically 'Function and Variable names':

Quote:Function names should be lowercase, with words separated by underscores as necessary to improve readability.

Variable names follow the same convention as function names.

mixedCase is allowed only in contexts where that's already the prevailing style (e.g. threading.py), to retain backwards compatibility.

I would remove meas part from majority of variable names as it is not needed (but look for not clashing with built-in functions like min, max, range).

I would use f-strings instead of .format:

>>> name = 'Bob'
>>> occupation = 'The Builder'
>>> f'Hello {name} {occupation}'
'Hello Bob The Builder'
There is no need for empty space after print. It will not raise error, but it's not a good style.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
Improvements for first script? - by alloydog - Dec-27-2020, 03:57 PM
RE: Improvements for first script? - by perfringo - Dec-28-2020, 05:25 AM
RE: Improvements for first script? - by Mark17 - Dec-30-2020, 05:41 PM
RE: Improvements for first script? - by alloydog - Dec-28-2020, 07:55 AM
RE: Improvements for first script? - by perfringo - Dec-30-2020, 08:01 AM
RE: Improvements for first script? - by alloydog - Dec-30-2020, 09:25 AM
RE: Improvements for first script? - by DeaD_EyE - Dec-30-2020, 12:28 PM
RE: Improvements for first script? - by alloydog - Dec-30-2020, 05:28 PM
RE: Improvements for first script? - by alloydog - Jan-01-2021, 01:45 PM
RE: Improvements for first script? - by perfringo - Jan-01-2021, 02:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Any improvements Chuck_Norwich 2 2,696 Jul-14-2020, 05:15 AM
Last Post: Gamo
  [split] Any improvements Adamstiffman 1 1,922 May-31-2020, 06:16 AM
Last Post: pyzyx3qwerty
  Coding improvements chris_drak 2 36,654 May-02-2020, 11:39 AM
Last Post: chris_drak

Forum Jump:

User Panel Messages

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