Hi again guys!

Maybe I solve my own question :) See the piece of code follow:

#--------------------
def createClass(class1, class2):
  class x(class1, class2):
    name=class2.name
    bla=lambda self, trans=None: class2.bla(self, trans)
  return x
                                                                       
                                                                       
             
class A:
  name='"Class A"'
  def execute(self):
    print '... calling methods from A and the content (', self.name,
'-->', self.bla(), ') inside the A structure.'
  def bla(self, trans=None):
    return 'blablabla'
                                                                       
                                                                       
             
class B:
  name='"Class B"'
  def execute(self):
    print '... calling methods from B and the content (', self.name,
'-->', self.bla(), ') inside the B structure.'
  def bla(self, trans=None):
    return 'nonono'
                                                                       
                                                                       
             
C=createClass(A, B)
                                                                       
                                                                       
             
if __name__=='__main__':
  A().execute()
  B().execute()
  C().execute()
#--------------------

I done what I looking for using lambda, now I ask, is this correct or
is there a better way, someone faced some similar need?

Sorry to polute the list with a self solved question and sorry my poor
english :)

seeya

=====
--
Michel Thadeu Sabchuk
Curitiba/PR


        
        
                
_______________________________________________________
Yahoo! Mail agora com 100MB, anti-spam e antivírus grátis!
http://br.info.mail.yahoo.com/


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to