Package fuzzy :: Module utils
[hide private]
[frames] | no frames]

Module utils

source code

Helper functions for pyfuzzy.

Functions [hide private]
 
prop(func)
Function decorator for defining property attributes
source code
 
checkRange(value, ranges)
Checks if the value is in the defined range.
source code
Variables [hide private]
  __revision__ = '$Id: utils.py,v 1.8 2010-01-19 21:45:35 rliebs...
  inf = inf
  inf_p = inf
  inf_n = -inf
  __package__ = None
Function Details [hide private]

prop(func)

source code 

Function decorator for defining property attributes

The decorated function is expected to return a dictionary containing one or more of the following pairs:

  • fget - function for getting attribute value
  • fset - function for setting attribute value
  • fdel - function for deleting attribute

This can be conveniently constructed by the locals() builtin function; see: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/205183

checkRange(value, ranges)

source code 

Checks if the value is in the defined range.

The range definition is a list/iterator from:

  • float values belonging to the defined range x \in {a}
  • 2-tuples of two floats which define a range not including the tuple values itself x \in ]a,b[
  • 2-list of two floats which define a range including the list values x \in [a,b]

The order of elements is not important. So could define the set of integer numbers by a generator returning the following sequence: 0,1,-1,2,-2,3-,3,... .

It returns True if the value is in one of the defined ranges. Otherwise it returns false.


Variables Details [hide private]

__revision__

Value:
'$Id: utils.py,v 1.8 2010-01-19 21:45:35 rliebscher Exp $'