[Python] Constructive Criticism Wanted

So, I’ve been working on a project for my Mother. She is the Manager at a Senior Center and has tasked me with creating a Pool Class Check-In program, so that Members can come in, click their name and check in for the day. I’ve been working at it for a few weeks and this is what I have so far:

Here is the code:

Keep in mind this is only the CLI backbone, I am going to attempt to make a GUI for this.

from datetime import datetime
import calendar

def error(code):
    if code == 001:
        print "An error has occured, please restart the program and try again."

def currentDate():
    now = datetime.now()
    date = "%s/%s/%s" % (now.month, now.day, now.year)
    return date
def currentTime():
    now = datetime.now()
    time = "%s:%s:%s" % ((now.hour - 4), now.minute, now.second)
    return time
def currentDay():
    now = datetime.now()
    today = today = calendar.weekday(now.year, now.month, now.day)
    return today

class Member(object):
    def __init__(self, name, monday, tuesday, wednesday, thursday, friday, checkedIn):
        self.name = name
        self.monday = monday
        self.tuesday = tuesday
        self.wednesday = wednesday
        self.thursday = thursday
        self.friday = friday
        self.checkedIn = checkedIn
    def display(self):
        return "%s | %s | Checked In: %s" % (self.name, currentDate(), self.checkedIn)
    def checkIn(self):
        self.checkedIn = True
        today = currentDay()
        if today == 0:
            self.monday = "Yes"
        elif today == 1:
            self.tuesday = "Yes"
        elif today == 2:
            self.wednesday = "Yes"
        elif today == 3:
            self.thursday = "Yes"
        elif today == 4:
            self.friday = "Yes"
            self.checkedIn = False
    def checkInData(self):
        print "Check-In Data for %s:" % (self.name)
        print "Monday: %s" % (self.monday)
        print "Tuesday: %s" % (self.tuesday)
        print "Wednesday: %s" % (self.wednesday)
        print "Thursday: %s" % (self.thursday)
        print "Friday: %s" % (self.friday)

poolRoster = []

def displayRoster():
    for n in range(len(poolRoster)):
        print poolRoster[n].display()

def addMember():
    member = Member(raw_input("Name:"), "No", "No", "No", "No", "No", False)

Here it is in repl.it:

So… What do you think? Good Things? Bad Things? Any improvements I should make?

start with the GUI right away, you might run into problems, and your program will be different given you will have input fields for names and so on

Have you already decided what to use for the GUI? You could consider PyQt, it has built in calender support. What platforms does int need to support? Python is not a common program to write GUI apps


Frankly, I was going to compile it in GitHub, Visual Studio, or something of that nature. If that didn’t work, though, I was considering rewriting the whole thing in Javascript and making an HTML Webpage that would be stored locally.

I haven’t had much experience with PyQt, I’ve been meaning to check it out though. Perhaps now’s the time.

compiling is very tricky with an interpreted language :wink:

this would require a database containing names.

You really have to think this kind of thing through when you have projects like these, othwerise you keep running in circles

You could run a local webserver, that is possible

PyQt also support databases, so that is possible as well.


So let me get this straight… I either have to:

A) Rewrite the entire program in an arguably less powerful language. Then Implement into an HTML Code, which will take forever…


B) Learn an entirely new Python-esque Language.

Well… :dizzy_face:

Neither sounds particularly fun, but then again, I do like a challenge. :smirk:

why? the back-end of your language can be python (flask, django) and the front-end JS

PyQt is “just” a python module


If PyQt is, indeed, “just a python module”, then I think I should just go down that route.

1 Like

It is, but its quit an extensive one.

1 Like