X-FeedAbuse: http://nntpfeed.proxad.net/abuse.pl feeded by 88.191.16.109 Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!nospam.fr.eu.org!usenet-fr.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'example)': 0.07; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'oh,': 0.09; 'received:gator410.hostgator.com': 0.09; 'trailing': 0.09; '~ethan~': 0.09; 'def': 0.15; '**kwargs):': 0.16; '*args,': 0.16; 'comma': 0.16; 'received:72.11': 0.16; 'received:72.11.125': 0.16; 'received:72.11.125.166': 0.16; 'subject: \n ': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.16; 'cc:no real name:2**0': 0.20; '(like': 0.21; 'discussion': 0.22; 'cc:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'happen.': 0.23; 'helper': 0.23; 'objects,': 0.23; 'keyword': 0.24; 'function': 0.27; 'lists': 0.28; 'cc:addr:python.org': 0.30; 'arguments.': 0.30; 'subject:?': 0.31; 'values': 0.32; "isn't": 0.33; 'header:User- Agent:1': 0.34; 'conflicts': 0.34; 'object': 0.35; 'using': 0.37; 'put': 0.37; 'but': 0.37; 'something': 0.37; '(not': 0.38; 'think': 0.38; 'subject:: ': 0.39; 'your': 0.61; 'target': 0.61; 'received:websitewelcome.com': 0.64; 'received:184': 0.67; 'subject:one': 0.77; 'subject:value': 0.84 Date: Wed, 17 Aug 2011 12:52:29 -0700 From: Ethan Furman User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: gc Subject: Re: Syntactic sugar for assignment statements: one value to multiple targets? References: <16ea4848-db0c-489a-968c-ca40700f5806@m5g2000prh.googlegroups.com> In-Reply-To: <16ea4848-db0c-489a-968c-ca40700f5806@m5g2000prh.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator410.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-BWhitelist: no X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: mail.admailinc.com ([192.168.10.136]) [72.11.125.166]:4907 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 1 X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ== Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1313609768 news.xs4all.nl 23870 [2001:888:2000:d::a6]:48510 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:11712 gc wrote: > Target lists using comma separation are great, but they don't work > very well for this task. What I want is something like > > a,b,c,d,e = *dict() This isn't going to happen. From all the discussion so far I think your best solution is a simple helper function (not tested): def repeat(count_, object_, *args, **kwargs): result = [] for _ in range(count_): result.append(object_(*args, **kwargs)) return result a, b, c, d, e = repeat(5, dict) These are each new objects, so depending on the function (like the random.rand_int example) the values may not be the same. Oh, and I put the trailing _ on count and object to minimize possible conflicts with keyword arguments. ~Ethan~