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
Paste phpSoftPro 1.4.1
Bytescout PDF SDK 1.8.1.243
Odoo Crafito Theme 1.0
Uber Clone- Taxi Booking App 4.1
Excel Add-in for BigCommerce 1.7
Online Food Delivery Script php 1.0.3
Break Script | Youtube Clone Script 1.0.3
Advanced Content Manager Magento 2 extension 2.2.x
dbForge Studio for PostgreSQL 1.0
ODBC Driver for Salesforce MC 1.3
Social Media Script 1.0
ByteScout PDF Renderer SDK 9.0.0.3079
Magento Mobile App Builder 2.0.0
Binary MLM Plan 1.0.2
Review Assistant 4.0
Top Code
Online Food Delivery Script php 1.0.3
Online Food Ordeing System 1.0
Simplified Gradient Descent Optimization 1.0
Java-2-Pseudo 1.0
Issue Manager App 1.0
Ping Pong Game Code Script 1.1
Uber Clone- Taxi Booking App 4.1
Memory (a.k.a. Concentration) 1.0
Gradient Descent Visualization 1.0
Planyo online reservation system module 6.x-1.8
Phase Locked Loop Synthesis and Simulation 1.0
Binary MLM Plan 1.0.2
Code Box Editor 1.1
UHEvents - Event management 1.0
Chess Master 1.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
PHP Point of sale 10.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
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