Package csb :: Package core :: Class enum

[frames] | no frames]

# Class enum

source code

    object --+
             |
      EnumBase --+
                 |
                enum

Known Subclasses:
  - bio.structure.AngleUnits
  - , bio.structure.ChemElements
  - , bio.structure.SecStructures
  - , bio.sequence.AlignmentFormats
  - , bio.sequence.AlignmentTypes
  - , bio.sequence.NucleicAlphabet
  - , bio.sequence.ProteinAlphabet
  - , bio.sequence.UnknownAlphabet
  - , bio.sequence.StdProteinAlphabet
  - , bio.sequence.SequenceTypes
  - , bio.hmm.ScoreUnits
  - , bio.hmm.States

Base class for all enumeration types. Supports both string and integer enumeration values. Examples:

    >>> class MolTypes(enum): DNA, RNA = range(2)
    <MolTypes: RNA=1, DNA=0>
    >>> class MolTypes(enum): DNA=1; RNA=2
    <MolTypes: RNA=2, DNA=1>
    >>> MolTypes.DNA
    1
    >>> MolTypes.DNA == 1
    True
    >>> int(MolTypes.DNA)
    1
    >>> repr(MolTypes.DNA)
    'DNA'
    >>> type(MolTypes.DNA)
    L{EnumItem} instance

Note: The recommended way to create an enum is to define a public subclass of enum in the global namespace of your module. Nesting the enum in another class for example will break pickling.

Instance Methods

__init__(self) x.__init__(...) initializes x; see help(type(x)) for signature | source code

Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties
Inherited from `object`: `__class__`

Method Details

### __init__(self)
(Constructor)

source code

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
  (inherited documentation)