473,507 Members | 11,372 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Writing class factories with the Python/C API?

Hi folks

I'm currently faced with the need to write a class factory in C using
the Python/C API. It's purpose is to automatically wrap C++ objects at
run-time and provide a Python object. Thanks to the magic of Qt's
meta-object system, getting the information required to wrap the C++
object is the easy bit.

What I'm not sure I can do is create 'built-in' Python classes at run
time. I don't need to create classes in response to calls from Python
code, only C code, but the newly created classes do need to be available
to Python code of course. The newly created classes will be fairly
simple subclasses of a more powerful parent, and all they really need to
do is implement a bunch of methods and

So, before I throw myself too deeply into this task, does this sound
like something that's vaguely practical? All I'll really need to do is
add a bunch of methods on the generated subclasses, so I'm hoping so...

--
Craig Ringer

Jul 18 '05 #1
0 1039

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1396
by: Jeff Louie | last post by:
Well I finally finished a Chapter on the use of Type Based and Interface Based Class Factories in C# at: http://www.geocities.com/jeff_louie/OOP/oop18.htm Happy Holidays, Jeff *** Sent...
1
2101
by: Hans-Christian Stadler | last post by:
Hi, I'm wondering how C++ .NET initializes class members. I have code that looks aproximately like this: _gc class SuperClass; // Factory object creates instances _gc class Factory {...
1
2987
by: Patrick Stinson | last post by:
I am trying to create a way to register static members of a **class**, not an object, for making an object factory. The main thing I want is to be able to make a call like class MyClass {...
8
4795
by: deko | last post by:
Which layer should a Factory class go in? DA - Data Access BL - Business Logic UI - User Interface ??
9
1847
by: sashang | last post by:
Hi I'd like to use metaclasses to dynamically generate a class based on a parameter to the objects init function. For example: class MetaThing(type): def __init__(cls, name, bases, dict,...
32
5764
by: Matias Jansson | last post by:
I come from a background of Java and C# where it is common practise to have one class per file in the file/project structure. As I have understood it, it is more common practice to have many...
5
3155
by: JH | last post by:
Hi I found that a type/class are both a subclass and a instance of base type "object". It conflicts to my understanding that: 1.) a type/class object is created from class statement 2.) a...
1
1045
by: Smokey Grindle | last post by:
Any good examples out there of remoting with class factories out there? I want to use interfaces to keep my code server side but also need class factories to make the objects. havent figured out...
6
1644
by: K Viltersten | last post by:
I have a class that reads an XML and according to its contents, it creates a List<Letter>, where Letter is an abstract class that is implemented in Alpha and Beta classes. I use a foreach...
0
7221
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7109
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7313
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7029
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5619
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5039
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1537
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.