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
wolfSSL 3.15.3
Aqua Data Studio 19.0
teeChart for .NET 2018
ASPack 2.42
Database Workbench Pro 5.4.4
AnyGantt JS Gantt Charts 8.3.0
CarDekho Script 1.0
ODBC Driver for Firebird 2.4
ODBC Driver for InterBase 2.2
VB.Net PDF 4.4.7
SuiteCRM Survey Rocket Plugin 1.0
Airbnb Clone Script | Airbnb Clone 4.3.1
IP2Location Geolocation Database 2018
ODBC Driver for Salesforce 1.5
Rapid PHP 2018 15.0
Top Code
MMS - Museum Management System 1.0.0
Groupon Clone Script 2.0.1
IP.Board recent topics 1.2
A Win Chat 1.1
A Prolog Expert System 0.2.0
Top Rated
Output Messenger 1.8.0
Aliexpress Clone- Ec21 Script 1
Indiegogo Clone 3.0
Online Food Ordeing System 1.0
PHP Image Resize Script 1.0
Best Spotify Clone 1.0
Get Random Record Based on Weight 1.0.0
Travel Portal Script 9.29
Magento Product Designer 1.0
OFOS - Just Eat Clone Script 1.0
PrestaShop Upload Images Module 1.2.1
Trading Software 1.2.4
Deals and Discounts Website Script 1.0.2
ADO.NET Provider for ExactTarget 1.0
Solid File System OS edition 5.1
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...



Simple Power SQLite class is a simple class written in PHP, useful for standard operation with SQLite:
- database creation,
- connection,
- submit query,
- simple transaction mechanism,
- decode encode binary file,
-...



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...

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

Please enter text on the image