Traits

Explicitly typed attributes for Python.
Download

Traits Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • Enthought, Inc.
  • Publisher web site:
  • http://code.enthought.com

Traits Tags


Traits Description

Explicitly typed attributes for Python. Traits is at the center of all development we do at Enthought and has changed the mental model we use for programming in the already extremely efficient Python programming language. We encourage everyone to join us in enjoying the productivity gains from using such a powerful approach.A trait is a type definition that can be used for normal Python object attributes, giving the attributes some additional characteristics: * Initialization: A trait has a default value, which is automatically set as the initial value of an attribute before its first use in a program. * Validation: A trait attribute's type is explicitly declared . The type is evident in the code, and only values that meet a programmer-specified set of criteria (i.e., the trait definition) can be assigned to that attribute. Note that the default value need not meet the criteria defined for assignment of values. * Delegation: The value of a trait attribute can be contained either in the defining object or in another object delegated to by the trait. * Notification: Setting the value of a trait attribute can notify other parts of the program that the value has changed. * Visualization: User interfaces that allow a user to interactively modify the value of a trait attribute can be automatically constructed using the trait's definition.A class can freely mix trait-based attributes with normal Python attributes, or can opt to allow the use of only a fixed or open set of trait attributes within the class. Trait attributes defined by a classs are automatically inherited by any subclass derived from the class.The Traits package works with version 2.4 and later of Python, and is similar in some ways to the Python property language feature. Standard Python properties provide the similar capabilities to the Traits package, but with more work on the part of the programmer.Traits UIThe Traits UI package is a set of user interface tools designed to complement Traits. In the simplest case, it can automatically generate a user interface for editing a Traits-based object, with no additional coding on the part of the programmer-user. In more sophisticated uses, it can implement a Model-View-Controller (MVC) design pattern for Traits-based objects. "The brilliance of Traits UI is that you don't really have to think about the mapping between model and GUI. You can concentrate on the model, and the GUI automatically reflects changes to the model ... and vice versa." — Danny Shevitz, Los Alamos NM NOTE: While the Traits UI API is included in the Traits project, in order to display a user interface, you need to also get the TraitsGUI project, a Python GUI toolkit, and the corresponding Traits "backend" project. Requirements: · Python · NumPy · setuptools


Traits Related Software