# Changeset 9940:a4af8643d113 in orange for Orange/misc/counters.py

Ignore:
Timestamp:
02/07/12 18:40:51 (2 years ago)
Branch:
default
Message:

Fixed failing doctest in misc/counters.

File:
1 edited

Unmodified
Removed
• ## Orange/misc/counters.py

 r9871 One way to use the counter is within a for-loop: >>> for r in Orange.misc.counters.BooleanCounter(3): >>> for r in BooleanCounter(3): ...    print r [0, 0, 0] You can also call it manually. >>> r = Orange.misc.counters.BooleanCounter(3) >>> r = BooleanCounter(3) >>> r.next() [0, 0, 0] from 0 to 1, but to the limits that are specified individually for each digit. >>> for t in Orange.misc.counters.LimitedCounter([3, 5, 2]): >>> for t in LimitedCounter([3, 5]): ...     print t [0, 0, 0] [0, 0, 1] [0, 1, 0] [0, 1, 1] [0, 2, 0] [0, 2, 1] [0, 3, 0] [0, 3, 1] [0, 4, 0] [0, 4, 1] [1, 0, 0] [1, 0, 1] [1, 1, 0] [1, 1, 1] [0, 0] [0, 1] [0, 2] [0, 3] [0, 4] [1, 0] [1, 1] [1, 2] [1, 3] [1, 4] [2, 0] [2, 1] [2, 2] [2, 3] [2, 4] .. attribute:: state Counter returns all consecutive subset lists of length ``m`` out of ``n`` where ``m`` <= ``n``. >>> for t in Orange.misc.counters.MofNCounter(3,7): >>> for t in MofNCounter(3,7): ...     print t ... Or, with an example >>> for t in Orange.misc.counters.NondecreasingCounter(4): >>> for t in NondecreasingCounter(4): ...     print t ... The sequences generated are equivalent to all possible functions from a set of cardinality of the sequences length. >>> for t in Orange.misc.counters.CanonicFuncCounter(4): >>> for t in CanonicFuncCounter(4): ...     print t ...
Note: See TracChangeset for help on using the changeset viewer.