Module vopu :: Class InitAttributes
[show private | hide private]
[frames | no frames]

Type InitAttributes

object --+
         |
        InitAttributes


Base class for objects whose constructor initializes all attributes.

>>> obj = InitAttributes(myattr=u"value1", self=10)
>>> obj.myattr
u'value1'
>>> obj.self
10

Method Summary
  __init__(*args, **kwargs)
Create a new InitAttributes object.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Method Details

__init__(*args, **kwargs)
(Constructor)

Create a new InitAttributes object.

All keyword arguments are converted into attributes. No positional arguments are allowed:

>>> obj = InitAttributes(100, myattr=u"value1")
Traceback (most recent call last):
    ...
TypeError: this constructor takes only keyword arguments

For security reasons, all keywords must start with an alphabetic character:

>>> obj = InitAttributes(_myattr=2)
Traceback (most recent call last):
    ...
NameError: invalid attribute name: '_myattr'
Overrides:
__builtin__.object.__init__

Generated by Epydoc 2.1 on Sun Aug 31 15:41:30 2008 http://epydoc.sf.net