setup(**config); rookie

Roy Smith roy at panix.com
Mon May 28 09:25:24 EDT 2012


In article 
<d1d3d22a-83f7-48f6-a458-0df36449c8cc at em1g2000vbb.googlegroups.com>,
 cate <catebekensail at yahoo.com> wrote:

> I going thru a 101 and came upon this (http://
> learnpythonthehardway.org/book/ex46.html)
> 
> try:
>     from setuptools import setup
> except ImportError:
>     from distutils.core import setup
> 
> config = {
>     'description': 'My Project',
>     'author': 'My Name',
>     'url': 'URL to get it at.',
>     'download_url': 'Where to download it.',
>     'author_email': 'My email.',
>     'version': '0.1',
>     'install_requires': ['nose'],
>     'packages': ['NAME'],
>     'scripts': [],
>     'name': 'projectname'
> }
> 
> setup(**config)
> 
> What is the construct **?
> 
> Thank you

It calls setup with all the elements of config as if they had been 
passed as discrete arguments.

def x(foo, bar):
    print foo
    print bar

args = {'foo': 1,
        'bar': 2,
        }

x(**args)



More information about the Python-list mailing list