Design question about pretree classifier

Aahz aahz at pythoncraft.com
Mon Jan 4 20:35:24 EST 2010


In article <mailman.2090.1261159213.2873.python-list at python.org>,
Steve Holden  <steve at holdenweb.com> wrote:
>Julian wrote:
>> 
>> But:
>> 
>> - none classification: return an exception or None? I think None is
>> better, hence its not an exception that there is no classification but
>> a defined state. What do you think?
>> - many classifications: what to do? retun a sequence of strings? raise
>> an exception and implement another method wich returns than the
>> classifications? what should I do here?
>
>Always return a list or tuple. For no classifications it should be
>empty, for one classification it should have one element, ... , for N
>classifications it should have N elements.

Why not a set?  If you're only going list classifications, a tuple or
list would be fine, but if you're going to probe classifications, you
should use something that isn't O(N).
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Weinberg's Second Law: If builders built buildings the way programmers wrote 
programs, then the first woodpecker that came along would destroy civilization.



More information about the Python-list mailing list