Attribute - easy way to define interface

Category: Python - Miscellaneous

it is an enhanced property

* initialize attribute in class definition scope

* easily keep the attribute behaviors in sub classes.

* easy to define interface.

* not afraid to forget the super(klass, self).__init__(...) :P Date: 02 March, 2012


Attribute - Interface - Property - Python

Homepage: http://code.activestate.com/recipes/577598-attribute-easy-way-to-define-interface/?in=lang-python

Developer: ilon asolot

License: Freeware

Operating System: Windows

Add a Comment

all are required fields

     
What do you think of this resource?

Select Your Rate:

Votes:0

 

Related Scripts Download

This script defines a dictionary with attribute-style access.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


Python has no inherent provision for a restrictive API that blocks accesses to methods and variables outside an allowed set.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


This script presents a way to introduce proper attribute access protection levels using a generic proxy object.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


Whenever a superclass implements a __init__ method to initialize its attributes, subclasses derived from it have to invoke the __init__ method of the superclass.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


This script contains a few simple descriptor classes to compute and cache attribute value on demand and to define attribute as alias to other.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


This script uses the 'Multicast' class to multiplex messages/attribute requests to objects which share the same interface.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


This script presents an ideom for simplified accessors, that combines typical getter and setter functionality of an attribute into a single overloaded method, that instead of getATTRIBUTE and setATTRIBUTE can now just be called ATTRIBUTE.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


Miraculously, you can estimate.

developer Developer: Raymond Hettinger
license License: Freeware
operating systems Operating System: Windows


Simple 1KHz Audio Function Generator Using Standard Python In Linux - afg.

developer Developer: Barry Walker
license License: Freeware
operating systems Operating System: Windows