Python Forum
Retired and Learning Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Retired and Learning Python
#1
After 50 years of software development from IBM 360 mainframes to Azure cloud I've decided to keep active at home and decided Python looked interesting.

My initial work is calendrical calculations and can be found at: https://github.com/Crooit/Calendrical_Ca...Python.git

I have more scripts in mind. It's a journey.

Comments are always welcomed.
suburbanprojects likes this post
Reply
#2
Never too old to start! I started in 1968, working in disk drive engineering for Honeywell ISI, also worked with BAL on the 360. Now just shy of 80, still writing code, still enjoying it!
Reply
#3
Wow, IBM 360 to Python is impressive! Your calendar project is very interesting, and I can't wait to see more scripts.
Reply
#4
https://github.com/Crooit/Calendrical_Ca...YCoptic.py

Don't use comments like this:
def CurrentDate () -> date: # # Retrieve the current date # return date.today() # End Def def cmFloor (x: float) -> int: # # Largest integer less than or equal to x # return int(math.floor(x)) # End Def def cmMod (x: float, y: float) -> float: # # x MOD y for Real Numbers, y<>0 # return x % y # End Def
Instead make docstrings:

import math from datetime import date def current_date () -> date: """ Retrieve the current date """ return date.today() def cm_floor (x: float) -> int: """ Largest integer less than or equal to x """ return math.floor(x) def cm_mod (x: float, y: float) -> float: """ x MOD y for Real Numbers, y<>0 """ return x % y
  • Changed the name style from PascalCase to snake_case for functions.
  • added docstrings
  • math.floor returns an int

Demonstration of help in interactive Python REPL:
help(math.floor) Help on built-in function floor in module math: floor(x, /) Return the floor of x as an Integral. This is the largest integer <= x. help(cm_floor) Help on function cm_floor in module __main__: cm_floor(x: float) -> int Largest integer less than or equal to x
Some frameworks like FastAPI are using the docstrings to generate help for API Endpoints.
You can also create documentation from Python source code with Sphinx.
noisefloor likes this post
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.