Re: python html 2 image (png)

2006-10-26 Thread joe Li
class Bunch(object):    def __init__(self, **fields):     self.__dict__ = fields    p = Bunch(x=2.3, y=4.5)print p 
print p.__dict__I dont' understand the usage of the double * here, could anyone explain it for me? thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: python html 2 image (png)

2006-10-26 Thread joe Li
Thanks a lot.Please forgive my careless mistake, I am completely a new user^-^2006/10/26, Fredrik Lundh <[EMAIL PROTECTED]>:
joe Li wrote:> **class Bunch(object):> def __init__(self, **fields):
> self.__dict__ = fields>> p = Bunch(x=2.3, y=4.5)> print p>> print p.__dict__>> I dont' understand the usage of the double * here, could anyone explain> it for me?
if you're going to post questions to arbitrarily chosen threads, youcould at least change the subject (but it's a lot nicer to open a newthread).the "**" prefix tells Python to stuff any excess keyword arguments into
the given variable: >>> def func(**kwargs):... print kwargs... >>> func(){} >>> func(spam=1, egg=2){'egg': 2, 'spam': 1}for more on Python's parameter syntax, see the section on "def" in the
language reference; see e.g. http://effbot.org/pyref/def.htm--http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list

virtual function appears in two bases

2006-10-27 Thread joe Li
I saw the following code, but I don't understand the rule for virtual function that appears in two basesCould anyone explain it for me, thanks.class Base1:    def amethod(self):    print "Base1"
class Base2(Base1): passclass Base3:    def amethod(self):    print "Base3"class Derived(Base2, Base3): passaninstance = Derived()aninstance.amethod()
-- 
http://mail.python.org/mailman/listinfo/python-list