[Tutor] advice on creating and working with a complex datastructure
Wayne
srilyk at gmail.com
Tue Jul 21 13:54:29 CEST 2009
On Mon, Jul 20, 2009 at 6:05 PM, Alan Gauld <alan.gauld at btinternet.com>wrote:
> "Serdar Tumgoren" <zstumgoren at gmail.com> wrote
>
>> Aha, okay, the multiple classes approach makes sense. But would these
>> be nested classes,
>>
>
> No although they would probably have attributes containing
> the related lists. Thus Race might have a list of Candidates.
> And Candidate would have a list of Committees etc.
>
> perhaps inheriting attributes from their parent
>> classes? E.g.:
>>
>
> I do not think any of these meet the criteria for inheritance. None of them
> "is a" kind of any of the others.
>
> class Race
>>
>> class Candidate
>>
>> class Committee
>>
>> class Filing
>>
>
> I don;t like the use of Filing for a class name, it sounds like a
> collection and in Python we don;t usually need to crteate collection
> classes, we can just use a standard collection type. Maybe File would be
> better although it could be confused with a comuter file... Maybe Record
> would be best?
If the candidate can file reports, perhaps the candidate should have a
member list (or some other appropriate container) called reports and a
method/function called file_report?
-Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090721/b5b19cfe/attachment.htm>
More information about the Tutor
mailing list