Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Libraries

    cykooz.sequence 1.0.2

    Download button

    No screenshots available
    Downloads: 165  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Cykooz | More programs
    ZPL / FREE
    May 18th, 2011, 14:08 GMT [view history]
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    cykooz.sequence description

    Generates a persistent sequence

    cykooz.sequence is a fork of gocept.sequence (http://pypi.python.org/pypi/gocept.sequence/) originally created by Daniel Havlik and Sebastian Wehrmann.

    cykooz.sequence

    Generates a persistent sequence.

    Sequences

    >>> import persistent
    >>> import zope.annotation.interfaces
    >>> from zope.interface import implements


    We need a testobject, where the SequenceGenerator stores his data:

    >>> class Dummy(persistent.Persistent):
    ... implements(zope.annotation.interfaces.IAttributeAnnotatable)

    >>> test_object = zope.annotation.interfaces.IAnnotations(Dummy())


    You get a SequenceGenerator by adapting to ISequenceGenerator:

    >>> from cykooz.sequence.interfaces import ISequenceGenerator
    >>> seq_gen = ISequenceGenerator(test_object)


    You get a sequence like this:

    >>> seq_gen.getNextValue()
    1
    >>> seq_gen.getNextValue()
    2
    >>> seq_gen.getNextValue()
    3


    You can also set the generator to a value:

    >>> seq_gen.setNextValue(1)
    >>> seq_gen.getNextValue()
    1

    >>> seq_gen.setNextValue(5)
    >>> seq_gen.getNextValue()
    5
    >>> seq_gen.getNextValue()
    6
    >>> seq_gen.getNextValue()
    7
    >>> seq_gen.getNextValue()
    8


    But setNextValue only accepts integer arguments:

    >>> seq_gen.setNextValue('1')
    Traceback (most recent call last):
    ...
    ValueError: setNextValue expected Integer, < type 'str' > found.


    >>> seq_gen.setNextValue(3.14)
    Traceback (most recent call last):
    ...
    ValueError: setNextValue expected Integer, < type 'float' > found.



    Product's homepage

    Requirements:

    · Python

    What's New in This Release: [ read full changelog ]

    · Fix tests.

      


    TAGS:

    gocept.sequence fork | persistent sequence | gocept.sequence | fork | persistent

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM