Re: Enumerate - int object not subscriptable

2019-08-21 Thread Peter Otten
Sayth Renshaw wrote: > def output_data(s): > serie = fibo(input_length) > x = [] > y = [] > > for num1, num2 in pairwise(serie): > y.append( num2 / num1) It looks like y contains unique values. In that case replace > for item in y: > x.append(y.index(item

Re: absolute path to a file

2019-08-21 Thread tom arnall
Thanks. Hope you found a solution to the problem. On Tue, Aug 20, 2019, 2:51 AM Cameron Simpson wrote: > Please remember to CC the list. > > On 19Aug2019 22:06, Paul St George wrote: > >On 19/08/2019 14:16, Cameron Simpson wrote: > [...] > >>There's a remark on that web page I mentioned that su

itertools cycle() docs question

2019-08-21 Thread Tobiah
In the docs for itertools.cycle() there is a bit of equivalent code given: def cycle(iterable): # cycle('ABCD') --> A B C D A B C D A B C D ... saved = [] for element in iterable: yield element saved.append(element) while saved:

Re: itertools cycle() docs question

2019-08-21 Thread Calvin Spealman
The point is to demonstrate the effect, not the specific implementation. On Wed, Aug 21, 2019 at 2:30 PM Tobiah wrote: > In the docs for itertools.cycle() there is > a bit of equivalent code given: > > def cycle(iterable): > # cycle('ABCD') --> A B C D A B C D A B C D ... >

Re: python requests get from API and post to another API and remote u'

2019-08-21 Thread Heinrich Kruger
‐‐‐ Original Message ‐‐‐ On Tuesday, August 20, 2019 10:18 AM, Chris Angelico wrote: > On Tue, Aug 20, 2019 at 6:59 PM Noah noah-l...@enabled.com wrote: > > > Hi, > > I am trying to migrate information and data between two systems using > > their corresponding APIs. I am using python requ

Re: itertools cycle() docs question

2019-08-21 Thread Rob Gaddi
On 8/21/19 11:27 AM, Tobiah wrote: In the docs for itertools.cycle() there is a bit of equivalent code given:     def cycle(iterable):     # cycle('ABCD') --> A B C D A B C D A B C D ...     saved = []     for element in iterable:     yield element     saved.app

Re: Style suggestions/critiques (rmlibre)

2019-08-21 Thread rmlibre
You might could consider using numpy, and storing the points in a list or list-like class. numpy can convert a list into an array, and then you can do one line binary operations on each element in the list. An example, let's assume we start with your implementation, and make a list of your lines:

Re: itertools cycle() docs question

2019-08-21 Thread Tobiah
On 8/21/19 11:38 AM, Rob Gaddi wrote: On 8/21/19 11:27 AM, Tobiah wrote: In the docs for itertools.cycle() there is a bit of equivalent code given: def cycle(iterable): # cycle('ABCD') --> A B C D A B C D A B C D ... saved = [] for element in iterable: yield element saved.append(element) while

Re: itertools cycle() docs question

2019-08-21 Thread Tim Chase
On 2019-08-21 11:27, Tobiah wrote: > In the docs for itertools.cycle() there is > a bit of equivalent code given: > > def cycle(iterable): > # cycle('ABCD') --> A B C D A B C D A B C D ... > saved = [] > for element in iterable: > yield element >

Re: itertools cycle() docs question

2019-08-21 Thread Chris Angelico
On Thu, Aug 22, 2019 at 5:56 AM Tobiah wrote: > > On 8/21/19 11:38 AM, Rob Gaddi wrote: > > On 8/21/19 11:27 AM, Tobiah wrote: > >> In the docs for itertools.cycle() there is a bit of equivalent code > >> given: > >> > >> def cycle(iterable): # cycle('ABCD') --> A B C D A B C D A B C D > >> ... sa

Re: itertools cycle() docs question

2019-08-21 Thread Ian Kelly
On Wed, Aug 21, 2019 at 12:36 PM Calvin Spealman wrote: > > The point is to demonstrate the effect, not the specific implementation. But still yes, that's pretty much exactly what it does. The main difference between the "roughly equivalent to" code and the actual implementation is that the forme

Re: itertools cycle() docs question

2019-08-21 Thread Dan Sommers
On 8/21/19 2:32 PM, Calvin Spealman wrote: The point is to demonstrate the effect, not the specific implementation. Once you've gone through the iterable once, it's falsey, which means that the while loop will end. But if you copy all the elements to a real list, then the while loop is infinit

Re: itertools cycle() docs question

2019-08-21 Thread Chris Angelico
On Thu, Aug 22, 2019 at 6:55 AM Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 8/21/19 2:32 PM, Calvin Spealman wrote: > > The point is to demonstrate the effect, not the specific implementation. > > Once you've gone through the iterable once, it's falsey, > which means that the whi

Re: itertools cycle() docs question

2019-08-21 Thread Terry Reedy
On 8/21/2019 2:27 PM, Tobiah wrote: In the docs for itertools.cycle() there is a bit of equivalent code given:     def cycle(iterable):     # cycle('ABCD') --> A B C D A B C D A B C D ...     saved = []     for element in iterable:     yield element     saved.ap