2
votes
4answers
81 views

Python OO Code Review for small blogging script

I've recently re-written a Python script I use to run a couple of lightweight blogs. Looking over the horrible code I'd written before, I decided to rewrite it using object-oriented concepts. I wanted ...
1
vote
2answers
92 views

Is this class structure good?

I'm writing a pong game in Python and I created classes for the game objects. The top level class is Object, and Ball and Paddle inherit from it. And ComputerPaddle is a child class of Paddle. # ...
4
votes
2answers
119 views

Strategy Design Pattern in Python

I'm reading the awesome Head First Design Patterns book. As an exercise I converted first example (or rather a subset of it) to Python. The code I got is rather too simple, i.e. there is no abstract ...
0
votes
1answer
48 views

Instance of one class to contain arbitrary number of instances of another class in Python

I'm trying to see if there is a better way to design this. I have a class Animal that is inherited by Male and Female classes (Female class has an additional attribute). I also have a class called ...
3
votes
0answers
370 views

How can I do this the most pythonic way

I'm developing model for web application. The database that I use is Redis. I created special DbField objects like HashDbField, SortedSetDbField, ScalarDbField and so on, for each data type in Redis. ...
3
votes
3answers
126 views

Python Time Class definition and methods, use of __init__

I've written a Time class that records the time of day and performs simple timing operations (add 2 times, convert a time object to an integer and back again,etc.) following the prompts in How to ...
8
votes
1answer
260 views

D&D Monster Organiser

I've made a python script to properly organise D&D monster stats in a directory. The script brings up the stats as instance variables of a Monster (class) instance. For those unfamiliar with the ...
2
votes
1answer
119 views

OOP design of code representing units of measurement

I am developing a meta-data framework for monitoring systems such that I can easily create data adapters that can pull in data from different systems. One key component is the unit of measurement. To ...
1
vote
2answers
325 views

This is a python program I have written. I need a bit of help using OOP

This is an OOP program I wrote in Python, I am just learning about using classes and I'd appreciate some advice on how to improve it. # rock.py # example of OOP import random class Rock: def ...
1
vote
1answer
196 views

JPEG metadata processor

I am looking to make the below code a bit more efficient / OOP based. As can be seen by the X, Y & Z variables, there is a bit of duplication here. Any suggestions on how to make this code more ...
4
votes
7answers
2k views

Python - Rock papers scissors

Am a newbie to python and started object oriented programming recently. I have implemented a "rock paper scissors" application in OOP's. I request the SO community to help me to evaluate my code, ...