473,548 Members | 2,691 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Antwort: Play with classes ['LBBW': checked]


I have the following classes defined

ModeA, ModeB, TypeA, TypeB, TypeC, SubtypeA, SubtypeB.

Supose the user whant to combine ModeA with TypeB and SubtypeB, so I need
something like

class UserClass(ModeA , TypeB, SubtypeB):
pass
_______________ _______________ ___

You might do
class A: .... a=1
.... class B: .... b=2
.... exec("class UserClass(A, B): pass")
u = UserClass()
u <__main__.UserC lass instance at c7930>

or even with methods, but you need correct indentation: exec(""" .... class UserClass(A, B):
.... def __init__(self):
.... print "UserClass.__in it__"
.... """) UserClass <class __main__.UserCl ass at b7880> u=UserClass()

UserClass.__ini t__

Greetings
Holger

Der Inhalt dieser E-Mail ist vertraulich. Falls Sie nicht der angegebene
Empfänger sind oder falls diese E-Mail irrtümlich an Sie adressiert wurde,
verständigen Sie bitte den Absender sofort und löschen Sie die E-Mail
sodann. Das unerlaubte Kopieren sowie die unbefugte Übermittlung sind nicht
gestattet. Die Sicherheit von Übermittlungen per E-Mail kann nicht
garantiert werden. Falls Sie eine Bestätigung wünschen, fordern Sie bitte
den Inhalt der E-Mail als Hardcopy an.

The contents of this e-mail are confidential. If you are not the named
addressee or if this transmission has been addressed to you in error,
please notify the sender immediately and then delete this e-mail. Any
unauthorized copying and transmission is forbidden. E-Mail transmission
cannot be guaranteed to be secure. If verification is required, please
request a hard copy version.


Jul 18 '05 #1
0 968

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

Similar topics

18
8724
by: vrillusions | last post by:
I've been using functions since I first started using php, but I've been hearing more and more about classes, which I never really looked at that much. I understand the whole OO programming aspect, but are there any advantages to having classes as opposed to just functions? I've heard that the classes are better because they only load the...
0
1052
by: Holger Joukl | last post by:
You can use the exec statement (note that I set the if-condition to 1=true for the example, and I used different names for outer and inner loop indexes): >>> for index in range(1,4): .... list = .... for inner in range(1,7): .... if 1: .... list.append(inner) .... foo = "list_" + str(index) +...
0
1652
by: Holger Joukl | last post by:
Hi, what version of python are you using? I got the same error when invoking a customized, 2-year-old version of distutils with python 2.3.3 (instead of 1.5.2, as before). Reason is code in dist.py, using dir() to look up the attributes of a class instance. But dir() nowadays also returns the class methods, __doc__ etc. Changing this in...
0
1449
by: Holger Joukl | last post by:
You could use the str() builtin, returning the string representation of the list object: >>> params = (1, 2, 3) >>> "select * from T where C1 not in %s" % str(params) 'select * from T where C1 not in (1, 2, 3)' >>>
9
1503
by: Zunbeltz Izaola | last post by:
Hi to all! I wonder if it possible (i'm sure python can do :-) ) to define classes on runtime. My problem (schematically) is the folowwin. The User can choise betwenn 3 property of an object. Mode, Type and Subtype. I have the following classes defined
31
6783
by: Axel Dahmen | last post by:
I try to combine properties of several classes. This is done by assigning a space separated list of class definitions to an element. However, IE shows a kind of preference when choosing the right property which I think is probably wrong. Here's what it does: If two classes are defined in a stylesheet providing the same property, and if...
22
2511
by: The Road To Utopia | last post by:
Here's one for the trolls...a common jibe from them is setting up audio/video hardware under linux. Ok, true story: at work today, someone asked me if I could tell him why his XP Home would play the video from a DVD but not the audio. He had been searching for an answer for days on support.microsoft.com but found none. I suggested Google...
5
1265
by: Maarten | last post by:
hi all, I have a usercontrol with a checked listbox this usercontrol is placed on a form1 is there a way to get the checked items of the checkedlisbox in the usercontrol with a command from form1? i beleave i have to do this with "get" and "set in a class
1
1432
by: Homa | last post by:
I have a web service that want to print something to a printer connected on another computer in the network. And that printer happens to be a non-plug and play printer (It's a thermal printer). I tried to install the printer to the server directly and it works fine (I use PrinterSettings.PrinterName to set the printer). But when I set it up...
0
7711
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7954
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7467
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7805
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5367
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5085
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3497
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3478
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1054
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.