Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    MakeObj 0.3

    Download button

    No screenshots available
    Downloads: 59  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Joao Bernardo Oliveira | More programs
    BSD License / FREE
    September 19th, 2012, 14:45 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    MakeObj description

    Powerful Enumeration System

    MakeObj is a Python module, compatible with Python versions 2.6+ and 3.0+, to help developers create powerful enumeration classes that provide support to attributes specific for each element.

    Using it

    MakeObj lets you create enumerations with a simple language like that:

    @obj: RGBColors =:
     @keys = 'red', 'green', 'blue'

     @attr: hex = 'ff0000', '00ff00', '0000ff'

     @attr: is_nice =:
     @default = False
     @set => 'blue': True

    Then you can use like this:

    RGBColors = makeobj.parse(text)

    if RGBColors.blue.is_nice:
     print('I like blue')


    print('The hex value of {0.name} is #{0.hex}'.format(RGBColors.red))

    If you have simple enums, you can use like this:

    RGBColors = makeobj.make('RGBColors', ['red', 'green', 'blue'])

    or, with some more data:

    RGBColors = makeobj.make('RGBColors', {'red': {'hex': 'ff0000'},
     'green': {'hex': '00ff00'},
     'blue': {'hex': '0000ff'}})



    Product's homepage

    Here are some key features of "MakeObj":

    · Enumerations with simple attributes, methods or even small objects with their own attributes.
    · An Enumeration Language for easy creation of objects.
    · The enumeration by default use the values 0 to N-1 but you may specify your own values.
    · The elements of the class are really instances of it and can take advantage of the isinstance function. Because of a metaclass factory, the classes do not share unwanted attributes with the instances.
    · The elements come with two attributes by default: name and value (also _name and _value in case you want to override them).
    · Elements can (and should!) be checked with the is comparison and can be retrieved by name in string form or value from their class: RGBColors('red') or RGBColors[0] or RGBColors.red result in the same object.

    Requirements:

    · Python

      


    TAGS:

    enumeration system | enumeration classes | Python library | Python | enumeration | system

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

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