Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #65379

Re: [newbie] making rows of table with discrete values for different number systems

From Terry Reedy <tjreedy@udel.edu>
Subject Re: [newbie] making rows of table with discrete values for different number systems
Date 2014-02-03 16:50 -0500
References <515e582f-ed17-4d4e-9872-f07f1fda6ed2@googlegroups.com> <mailman.6309.1391364617.18130.python-list@python.org> <5757c6ca-57d8-440f-9c55-b3f723b23404@googlegroups.com> <3a8c1dff-5b1d-4567-aaab-a81d37a563fd@googlegroups.com> <12f21916-8228-4826-bb9e-7096c77b294d@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.6365.1391464230.18130.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[newbie] making rows of table  with discrete values for different number systems Jean Dupont <jeandupont314@gmail.com> - 2014-02-02 09:44 -0800
  Re: [newbie] making rows of table  with discrete values for different number systems Roy Smith <roy@panix.com> - 2014-02-02 13:07 -0500
    Re: [newbie] making rows of table  with discrete values for different number systems Jean Dupont <jeandupont314@gmail.com> - 2014-02-03 07:06 -0800
  Re: [newbie] making rows of table with discrete values for different number systems Peter Otten <__peter__@web.de> - 2014-02-02 19:10 +0100
    Re: [newbie] making rows of table with discrete values for different number systems Jean Dupont <jeandupont314@gmail.com> - 2014-02-02 12:51 -0800
      Re: [newbie] making rows of table with discrete values for different number systems Asaf Las <roegltd@gmail.com> - 2014-02-02 17:56 -0800
        Re: [newbie] making rows of table with discrete values for different number systems Jean Dupont <jeandupont314@gmail.com> - 2014-02-03 07:05 -0800
          Re: [newbie] making rows of table with discrete values for different number systems Asaf Las <roegltd@gmail.com> - 2014-02-03 07:34 -0800
            Re: [newbie] making rows of table with discrete values for different number systems Jean Dupont <jeandupont314@gmail.com> - 2014-02-03 11:37 -0800
              Re: [newbie] making rows of table with discrete values for different number systems Asaf Las <roegltd@gmail.com> - 2014-02-03 11:50 -0800
                Re: [newbie] making rows of table with discrete values for different number systems Jean Dupont <jeandupont115@gmail.com> - 2014-02-04 01:18 -0800
              Re: [newbie] making rows of table with discrete values for different number systems Asaf Las <roegltd@gmail.com> - 2014-02-03 11:52 -0800
          Re: [newbie] making rows of table with discrete values for different number systems Terry Reedy <tjreedy@udel.edu> - 2014-02-03 16:50 -0500
            Re: [newbie] making rows of table with discrete values for different number systems Rustom Mody <rustompmody@gmail.com> - 2014-02-03 18:48 -0800
  Re: [newbie] making rows of table  with discrete values for different number systems Denis McMahon <denismfmcmahon@gmail.com> - 2014-02-04 00:11 +0000

csiph-web