On Apr 3, 5:43 am, "Basilisk96" <[EMAIL PROTECTED]> wrote: > Thanks for the help, guys. > Dictionaries to the rescue! > > Steven, it's certainly true that runtime creation of attributes does > not fit well here. At some point, an application needs to come out of > generics and deal with logic that is specific to the problem. The > example I gave was classification of books, which is relatively easy > to understand. The particular app I'm working with deals with > specialty piping valves, where the list of rules grows complicated > fairly quickly. > > So, having said that "attributes are not known at design time", it > seems that dictionaries are best for the generic core functionality: > it's easy to iterate over arbitrary "key, value" pairs without > hiccups. I can even reference a custom function by a key, and call it > during the iteration to do what's necessary. The input/output > dictionaries would dictate that behavior, so that would be the > implementation-specific stuff. Easy enough, and the core functionality > remains generic enough for re-use. > > Michael, I looked at the sample snippets at that link, and I'll have > to try it out. Thanks!
Hello, If your rules become more complicated and maybe increase in number significantly, it might be an idea to switch to a rule-based system. Take a look at CLIPS and the associated Python bindings: http://www.ghg.net/clips/CLIPS.html http://pyclips.sourceforge.net/ Kind regards, Marco -- http://mail.python.org/mailman/listinfo/python-list