Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1a.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; 'subject:: [': 0.04; 'modify': 0.07; 'advance': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'rows': 0.09; 'subject:number': 0.09; 'def': 0.12; 'jan': 0.12; '10:05': 0.16; '2),': 0.16; '4),': 0.16; 'lambda': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject: \n ': 0.16; 'subject:making': 0.16; 'subject:values': 0.16; 'wrote:': 0.18; 'subject:] ': 0.20; '>>>': 0.22; 'example': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'equivalent': 0.26; 'tables': 0.26; 'this:': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'ease': 0.30; "i'm": 0.30; 'jean': 0.31; 'produces': 0.31; 'universal': 0.31; 'guess': 0.33; 'style': 0.33; 'could': 0.34; 'subject:with': 0.35; 'method': 0.36; 'thanks': 0.36; 'needed': 0.38; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'received:173': 0.61; 'show': 0.63; 'name': 0.63; 'dear': 0.65; 'case?': 0.84; 'clearer': 0.84; 'n):': 0.84; 'received:fios.verizon.net': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: [newbie] making rows of table with discrete values for different number systems Date: Mon, 03 Feb 2014 16:50:06 -0500 References: <515e582f-ed17-4d4e-9872-f07f1fda6ed2@googlegroups.com> <5757c6ca-57d8-440f-9c55-b3f723b23404@googlegroups.com> <3a8c1dff-5b1d-4567-aaab-a81d37a563fd@googlegroups.com> <12f21916-8228-4826-bb9e-7096c77b294d@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-254-207.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: <12f21916-8228-4826-bb9e-7096c77b294d@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391464230 news.xs4all.nl 2847 [2001:888:2000:d::a6]:50097 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65379 On 2/3/2014 10:05 AM, Jean Dupont wrote: > Op maandag 3 februari 2014 02:56:43 UTC+1 schreef Asaf Las: >> On Sunday, February 2, 2014 10:51:15 PM UTC+2, Jean Dupont wrote: >>> Op zondag 2 februari 2014 19:10:32 UTC+1 schreef Peter Otten: >>> >>> I'm looking for an efficient method to produce rows of tables like this: >>> jean >> you can also try to make below universal for all needed bases: >> m = lambda m, n: 1 if m & n else 0 name = lambda xxx is poor style because it produces a function object lacking a proper name. Reusing the function name as a local is also confusing. The above is equivalent to def m(k, n): return 1 if k & n else 0 >> k = [[ m(x,8) , m(x, 4), m(x, 2), m(x, 1)] for x in range(10)] >> print (k) > Dear Asaf, > I'm not at ease with lamba-notation, could you show me how to modify your > example for the base 3 case? I guess then it will be much clearer to me > > thanks in advance > jean > -- Terry Jan Reedy