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
Magento Australia Post eParcel Extension 1.0
Airbnb Script - Airbnb Clone 1.0.3
Hotel Restaurant Reviews and Feedback Script 1.0.3
Documenter for MySQL 1.0
ODBC Driver for xBase 1.1
ODBC Driver for FreshBooks 2.0
AnyGantt JS Gantt Charts 8.4.2
The C# Barcode Library 4.0.2.2
ConyEdit for Windows 1.1.0
wolfSSL 3.15.5
Taxi Booking App Like Uber 1.0
IP2Location Geolocation Database 2018
Food Delivery Script 1.0.3
ODBC Driver for Magento 1.3
dbForge Studio for SQL Server 5.6
Top Code
Java-2-Pseudo 1.0
Tron 3 for Microsoft Windows 3.0
MCU 8051 IDE 1.4.7
symwire 1.0
Oracle Dump Viewer 1.0.1
Convert Arabic to Roman 1.0
Free Pageant Contest Source Code 1.0
Fixed Point Radix-4 FFT 1.0
A 32 point FFT in embedded MATLAB using fixed point arithmetic 1.0
Leica image format file loader 1.0
Validation (Time) 1.1
Ajax Live Chat 0.2
Watchdog Live 6.x-1.0
Porting Manager 1.0
ClonalG selection immune algorithm 1.0
Top Rated
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
ICPennyBid Penny Auction Script 4.0
PHP Review Script 1.0
ATN Resume Finder 2.0
ATN Site Builder 3.0
Availability Booking Calendar PHP 1.0
PHP GZ Blog Script 1.1
ATN Jobs Software 4.0
ATN Mall 2.0
WeBuilder 2015 13.3
PHP Digital Download Script 1.0.4
Simple, if naive, class factory recipe in python 
File ID: 64976






Simple, if naive, class factory recipe in python 
Download Simple, if naive, class factory recipe in python http://code.activestate.com/recipes/576951-simple-if-naive-class-factory-recipe-in-python/?in=lang-pythonReport Error Link
License: Freeware
Downloads: 19
Submit Rating:
Simple, if naive, class factory recipe in python  Description
Description: I'm a hack programmer -- no formal education. So, I don't know if this is technically a "factory", "abstract factory" or something else.

It is a way to generate a class dynamically, perhaps based on run-time data.

The point is that you can take a blank class object and dynamically add a constructor, class attributes, and instance methods. In principle, these could be configured dynamically in a program.

Since I don't know anything about programming theory, I welcome any criticism/discussion/suggestion. But, please be gentle!

License: Freeware

Related: class factory

O/S:Windows

Downloads: 19



More Similar Code

This simple function counts Lines Of Code in Python files in two ways: maximal size (source LOC) with blank lines and comments, minimal size (logical LOC) stripping same. It includes a simplified version of my directory tree walker from recipe 52664.



Simple and Fast SNMP Framework written in Python.



SoloTemplate is a simple stand-alone template engine written in Python, designed to load a data file and a template file and from them produce an output file.



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

This code is a stand alone program to generate a signal, at the earphone sockets, of 1KHz.
It is a basic audio signal generator and can be used as a...



Regular string interpolation in Python requires the user to pass an explicit
keyword dictionary. This recipe adds a little bif of magic, so that if
a name is not found in the passed dictionary, it is looked up in the
locals and...



An attribute of a class-object is implicitly mutated into an unbound-method object if it starts out as a Python-coded function; thus, such functions must be wrapped as other callables if "just calling them" (without an instance-argument)...



This recipe can be used to sort very large files (millions of records) in Python. No record termination character is required, hence a record may contain embedded binary data, newlines, etc. You can specify how many temporary files to use and...



This is a simple maze generator & solver written in Python. It is written as a game, consisting of classes which can read mazes from STDIN or a file. It provides a a random maze generator game, which can generate mazes of any dimension and...



This is a variation on the existing recipe "Constants in Python" by Alex Martelli. It binds a variable to the type value at first usage. Further usage is then restricted to values of the same type. This avoids a variable of, say, type...



A simple implementation of the standard UNIX utility tail -f in Python.

User Review for Simple, if naive, class factory recipe in python
- required fields
     

Please enter text on the image