Search
Code Directory
 ASP
 ASP.NET
 C/C++
 CFML
 CGI/PERL
 Delphi
 Development
 Flash
 HTML
 Java
 JavaScript
 Pascal
 PHP
 Python
 SQL
 Tools
 Visual Basic & VB.NET
 XML
New Code
Inventory Manager For Dynamics CRM 4.0
Dockit Migrator for SharePoint 11.8.6905
Australia Post Shipping For Magento 2 1.0.0
StarTrack Shipping For Magento 2 2.0.0
Mydala script 1.3
dotConnect for FreshBooks 1.8
Odoo Kingfisher Theme 1.0
Bitcoin Mining Software - Bitcoin Mining Script 1.0.2
Excel Add-in for Magento 1.7
Excel Add-in for MailChimp 1.7
Devart Excel Add-in for QuickBooks 1.7
Excel Add-in for PostgreSQL 1.7
Devart Excel Add-in for MySQL 1.7
Devart Excel Add-in for NetSuite 1.7
Excel Add-in for Salesforce 1.7
Top Code
ATN Site Builder 3.0
ATN Resume Finder 2.0
PHP Review Script 1.0
Invoice Manager by PHPJabbers 3.0
ICPennyBid Penny Auction Script 4.0
Excel Add-in for PostgreSQL 1.1
Excel Add-in for Salesforce 1.1
Excel Add-in for MailChimp 1.1
Aglowsoft SQL Query Tools 8.2
Classified Ad Lister 1.0
Solid File System OS edition 5.1
ADO.NET Provider for ExactTarget 1.0
Deals and Discounts Website Script 1.0.2
dotConnect for FreshBooks 1.8
Excel Add-in for Magento 1.6
Top Rated
phpEnter 5.1.
Single Leg MLM 1.2.1
Azizi search engine script PHP 4.1.10
Paste phpSoftPro 1.4.1
Extreme Injector 3.7
Deals and Discounts Website Script 1.0.2
ADO.NET Provider for ExactTarget 1.0
Solid File System OS edition 5.1
Classified Ad Lister 1.0
Aglowsoft SQL Query Tools 8.2
Invoice Manager by PHPJabbers 3.0
ICPennyBid Penny Auction Script 4.0
PHP Review Script 1.0
ATN Resume Finder 2.0
ATN Site Builder 3.0
Automating simple property creation 
File ID: 66693






Automating simple property creation 
Download Automating simple property creation http://code.activestate.com/recipes/273085-sample-with-replacement/?in=lang-pythonReport Error Link
License: Freeware
Downloads: 2
Submit Rating:
Automating simple property creation  Description
Description: The following are a set of functions for creating simple properties -
like Ruby's attr_reader, attr_writer, and attr_accessor.

If, inside a class definition, you write:

&nbsp &nbsp &nbsp &nbsp attribute(foo=1, bar=2)

simple properties named 'foo' and 'bar' are created for this class.
Also, private instance variables '__foo' and '__bar' will be added
to instances of this class.

By "simple properties", I mean something like the following:

&nbsp &nbsp &nbsp &nbsp ''' assume we're inside a class definition and
&nbsp &nbsp &nbsp &nbsp self.__foo and self.__bar have been instantiated.
&nbsp &nbsp &nbsp &nbsp '''
&nbsp &nbsp &nbsp &nbsp def get_foo(self):
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp return self.__foo
&nbsp &nbsp &nbsp &nbsp def set_foo(self, value):
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp self.__foo = value
&nbsp &nbsp &nbsp &nbsp def del_foo(self):
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp del self.__foo
&nbsp &nbsp &nbsp &nbsp def get_bar(self):
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp return self.__bar
&nbsp &nbsp &nbsp &nbsp def set_bar(self, value):
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp self.__bar = value
&nbsp &nbsp &nbsp &nbsp def del_bar(self):
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp del self.__bar
&nbsp &nbsp &nbsp &nbsp foo = property(fget=get_foo, fset=set_foo, fdel=del_foo, doc="foo")
&nbsp &nbsp &nbsp &nbsp bar = property(fget=get_bar, fset=set_bar, fdel=del_bar, doc="bar")

License: Freeware

Related: Oop

O/S:Windows

Downloads: 2



More Similar Code

This recipe provides a function that will automate simple property creation, while allowing its users to provide specific fget/fset/fdel methods.



Simple Component Creation Tutorial - Part 1 is a tutorial through which beginners can learn more about COM components and its uses. In this tutorial author tells the way to access the functionalities to execute an application and the method to...



This recipe suggests an idiom for property creation that avoids cluttering the class space with get/set/del methods that will not be used directly.



OpenNabu is a standalone personal wiki, featuring fast and simple content creation combined with highly customizable HTML export. All information is stored in plain text files and no additional server or database is needed.



A simple podcast creation and editing tool.



This is a simple property system for .NET 2.0 written in C#.



Presented in this recipe is a function prop, with that a property myprop can be created as simple as:

@prop
def myprop(): pass


It has only 7 lines of code, easy to understand, easy to customize, will make the code...



The Property class provides basic functionality that allows class level control over how a particular attribute is managed. In its simplest form a Property attribute works exactly like a regular attribute on an instance while providing...



This is a simple TreeView component that utilizes COM interfaces to display an Explorer like Browsing Window. Simple property hooks, and a way to view the TreeView while designing the form. I finally finished the first real version of the...



kI18N is a library to add localization to J2ME applications. Features: 1. Translations save in simple property like format. 2. If string isn't find in user locale, library willn't use only default locale. Locale file may set locales, which...

User Review for Automating simple property creation
- required fields
     

Please enter text on the image