Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44476

Re: epiphany

Newsgroups comp.lang.python
Date 2013-04-28 14:14 -0700
References <roy-23D9FA.19503324042013@news.panix.com>
Message-ID <3f095bcc-5685-4724-8ecf-8486da458b64@googlegroups.com> (permalink)
Subject Re: epiphany
From 88888 Dihedral <dihedral88888@googlemail.com>

Show all headers | View raw


Roy Smith於 2013年4月25日星期四UTC+8上午7時50分33秒寫道:
> I discovered something really neat today.
> 
> 
> 
> We've got a system with a bunch of rules.  Each rule is a method which 
> 
> returns True or False.  At some point, we need to know if all the rules 
> 
> are True.  Complicating things, not all the rules are implemented.  
> 
> Those that are not implemented raise NotImplementedError.
> 
> 
> 
> We used to have some ugly logic which kept track of which rules were 
> 
> active and only evaluated those.
> 
> 
> 
> So, here's the neat thing.  It turns out that bool(NotImplemented) 
> 
> returns True.  By changing the unimplemented rules from raising 
> 
> NotImplementedError to returning NotImplemented, the whole thing becomes:
> 
> 
> 
>     return all(r() for r in rules)

  Problems of rules in  Boolean algebra or  the bi-level logic
inference engine in AI were all solved long time ago
in the text book about AI.

There are some variations about the multi-level  or 
the continuous level logic engine with some new phases 
in Fuzzy theory  in the expert system.

A dynamical typed language is better to be used in this kind of 
problems.  
 

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

epiphany Roy Smith <roy@panix.com> - 2013-04-24 19:50 -0400
  Re: epiphany Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-25 01:35 +0000
    Re: epiphany Roy Smith <roy@panix.com> - 2013-04-24 21:41 -0400
      Re: epiphany Chris Angelico <rosuav@gmail.com> - 2013-04-25 12:20 +1000
        Re: epiphany Roy Smith <roy@panix.com> - 2013-04-24 22:33 -0400
      Re: epiphany Ethan Furman <ethan@stoneleaf.us> - 2013-04-24 19:28 -0700
    Re: epiphany Ethan Furman <ethan@stoneleaf.us> - 2013-04-24 19:25 -0700
      Re: epiphany Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-25 04:32 +0000
        Re: epiphany Roy Smith <roy@panix.com> - 2013-04-25 08:36 -0400
          Re: epiphany Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-25 12:52 +0000
            Re: epiphany Roy Smith <roy@panix.com> - 2013-04-25 09:15 -0400
  Re: epiphany 88888 Dihedral <dihedral88888@googlemail.com> - 2013-04-28 14:14 -0700

csiph-web