python html 2 image (png)

joe Li joehust at gmail.com
Thu Oct 26 09:51:27 CEST 2006


Thanks a lot.
Please forgive my careless mistake, I am completely a new user^-^

2006/10/26, Fredrik Lundh <fredrik at pythonware.com>:
>
> 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, you
> could at least change the subject (but it's a lot nicer to open a new
> thread).
>
> 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
>
> </F>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20061026/af5d6ccd/attachment.html>


More information about the Python-list mailing list