Cause for using objects?
Chris Smith
smitty_one_each at bigfoot.com
Fri Jun 17 19:19:25 EDT 2005
>>>>> "John" == John Heasly <jheasly at guardnet.com> writes:
John> Given: [{"mugshot": "nw_gradspeaker4_0608", "width": 67.0,
John> "height": 96.0}, \ {"mugshot": "nw_gradspeaker2_0608",
John> "width": 67.0, "height": 96.0}, \ {"freehand":
John> "b1.developreport.0614", "width": 154.0, "height": 210.0}, \
John> {"graphic": "bz_cafeparadiso_0613", "width": 493.0,
John> "height": 341.0}]
John> Return: {"mugshot1": "nw_gradspeaker4_0608",
John> "mugshot1.width": 67.0, "mugshot1.height": 96.0,\
John> "mugshot2": "nw_gradspeaker2_0608", "mugshot2.width": 67.0,
John> "mugshot2.height": 96.0, \ "freehand1":
John> "b1.developreport.0614", "freehand1.width": 154.0,
John> "freehand1.width": 210.0, \ "graphic1":
John> "bz_cafeparadiso_0613", "graphic1.width": 493.0,
John> "graphic1.height": 341.0}
John> I'm trying to teach myself some OOP. Does grinding the Given
John> above into the Return seem like a good candidate?
John> John H. Eugene, Ore. jheasly at guardnet dot com
If your table of photo data has several types of photos, and you find
yourself saying
if is_mugshot:
#something
elif is_freehand:
#something
else:
#something
then OOP will help organize your code.
If it's just a flat table of data, and you lay down a deeply nested
hierarchy of stuff, you may have over-engineered.
Best,
Chris
More information about the Python-list
mailing list