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


Groups > comp.lang.python > #64631

Re: generate De Bruijn sequence memory and string vs lists

From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: generate De Bruijn sequence memory and string vs lists
Date 2014-01-23 20:36 +0000
References <CALyJZZVU+j64Jn7fqqzLmwW+KcM=43UMKjo=HW7umnq8MSP2Uw@mail.gmail.com> <lbrjjq$96p$1@ger.gmane.org> <lbrlel$vpq$1@ger.gmane.org> <CALyJZZUn4XvTHSnsJhQwsM7CyXUJJis_BwwoZ8EYAQ209bvfig@mail.gmail.com> <lbrst6$vel$1@ger.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.5907.1390509413.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 23/01/2014 20:10, Peter Otten wrote:
> Vincent Davis wrote:
>
>> On Thu, Jan 23, 2014 at 12:02 PM, Peter Otten <__peter__@web.de> wrote:
>>>
>>> I just noted that the first Python loop can be eliminated:
>
>
> Oops, I forgot to paste
>
> import string
> def chars(a, b):
>      return "".join(map(chr, range(a, b)))
> _mapping = string.maketrans(chars(0, 10), chars(48, 58))
>

FTR string.maketrans is gone from Python 3.2+.  Quoting from 
http://docs.python.org/dev/whatsnew/3.2.html#porting-to-python-3-2 "The 
previously deprecated string.maketrans() function has been removed in 
favor of the static methods bytes.maketrans() and bytearray.maketrans(). 
This change solves the confusion around which types were supported by 
the string module. Now, str, bytes, and bytearray each have their own 
maketrans and translate methods with intermediate translation tables of 
the appropriate type."

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

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


Thread

Re: generate De Bruijn sequence memory and string vs lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-23 20:36 +0000

csiph-web