metaclass ???

BruceKL WhoH BruceWhoHKL at gawab.com
Wed Aug 18 21:59:30 EDT 2004


Mike C. Fletcher:

	Thanks,I have downloaded your pdf and code. But I'm still confused.
    What I'm trying to do is :
    I want to make two class, they are just subtly different,for example

class A:
    def f(self):
        print 'a'
    ...#other codes

class B:
    def f(self):
        print 'b'
    ...#other codes

all other codes are identical,just f is different.
    So can I use meta-class here? Or I should do this by another way?

    BTW,your pdf is quite nice,how do you make it? Beamer,pdfscreen, or PPT ?

======= 2004-08-18 21:58:11 Mike C. Fletcher wrote: =======

>BruceKL WhoH wrote:
>
>>Hi,
>>     I have just read David Mertz's Metaclass programming in Python,but I'm still confused.
>>can someone show me an example to explain when metaclass is needed?
>>  
>>
>In large part this is the question that my PyCon presentation was trying
>to explore. If you're interested, you can find the presentation and
>sample code here:
>http://www.vrplumber.com/programming/
>
>>     I think metaclass can be treated as a class factory,but how to specify the class generated? For example:
>>  
>>
>See particularly the metainitialisation.py sample code for the
>presentation, which does approximately what I think you're trying to do
>with your example.
>
>HTH,
>Mike
>
>________________________________________________
>  Mike C. Fletcher
>  Designer, VR Plumber, Coder
>  http://www.vrplumber.com
>  http://blog.vrplumber.com
>
>-- 
>http://mail.python.org/mailman/listinfo/python-list
>.

= = = = = = = = = = = = = = = = = = = =
			

        BruceKL WhoH
        BruceWhoHKL at gawab.com
          2004-08-19



More information about the Python-list mailing list