RE: Optimizing Small Python Code

2021-06-24 Thread Avi Gross via Python-list
thon-list@python.org Subject: Re: Optimizing Small Python Code On 24 Jun 2021, at 16:58, Avi Gross via Python-list mailto:python-list@python.org> > wrote: Now a has a length of 53! It now looks like this: b'x\x9c3\xe4R\x00\x03\x03.#8\x0bB\x1br\x19c\x88(\x18q\x99p!q\xc1\x00\xa6\x

Re: Optimizing Small Python Code

2021-06-24 Thread Barry Scott
> On 24 Jun 2021, at 16:58, Avi Gross via Python-list > wrote: > > Now a has a length of 53! > > It now looks like this: > > b'x\x9c3\xe4R\x00\x03\x03.#8\x0bB\x1br\x19c\x88(\x18q\x99p!q\xc1\x00\xa6\xd1\x98\xcb\x14S\x03\x9a\n\x13.3\x82j > \xb4\t\x94\x86\x99\t\x00\xdc\x87\x14\xb7' > > So

Re: Optimizing Small Python Code

2021-06-24 Thread jan via Python-list
1 > 2 > 3 > 4 > 5 > > Of course, the above has overhead as you have a line to import the library > as well as the darn function names but for larger amounts of text, those > stay fixed. > > I note again this won't fool humans but some on-line courses

RE: Optimizing Small Python Code

2021-06-24 Thread Avi Gross via Python-list
ooled. -Original Message- From: jan Sent: Thursday, June 24, 2021 3:01 AM To: Avi Gross Cc: python-list@python.org Subject: Re: Optimizing Small Python Code If I'm not mistaken, the original output is O(n^2) in quantity of chars, and as output time is proportional to the length of the o

Re: Optimizing Small Python Code

2021-06-24 Thread jan via Python-list
thon-list On > Behalf Of Michael F. Stemper > Sent: Wednesday, June 23, 2021 10:23 AM > To: python-list@python.org > Subject: Re: Optimizing Small Python Code > > On 23/06/2021 08.17, Stefan Ram wrote: >> "Avi Gross" writes: >>> This can be made a one-line

RE: Optimizing Small Python Code

2021-06-23 Thread Avi Gross via Python-list
of the string and uncompressed it, you might have code like: print(unzip("n*n&!~se")) -Original Message- From: Python-list On Behalf Of Michael F. Stemper Sent: Wednesday, June 23, 2021 10:23 AM To: python-list@python.org Subject: Re: Optimizing Small Python Code On 23/06/2021

Re: Optimizing Small Python Code

2021-06-23 Thread Michael F. Stemper
On 23/06/2021 08.17, Stefan Ram wrote: "Avi Gross" writes: This can be made a one-liner too! LOL! print( '1\n 0\n2\n 0\n 1\n3\n 0\n 1\n 2\n4\n 0\n 1\n 2\n 3\n5\n 0\n 1\n 2\n 3\n 4\n6\n 0\n 1\n 2\n

Re: Optimizing Small Python Code

2021-06-23 Thread Dieter Maurer
Kais Ayadi wrote at 2021-6-22 08:03 -0700: >Hi There! >this is a small python code executed in 61 steps > >for n in range(1, 7): >print (n) >for x in range(0, n): >print(" ", x) > >can this code be more optimised? You should proceed as follows: implement a task in the most

RE: Optimizing Small Python Code

2021-06-22 Thread Avi Gross via Python-list
Now why you want this is beyond me! -Original Message- From: Python-list On Behalf Of Greg Ewing Sent: Tuesday, June 22, 2021 7:05 PM To: python-list@python.org Subject: Re: Optimizing Small Python Code On 23/06/21 3:03 am, Kais Ayadi wrote: > for n in range(1, 7): > print (n)

Re: Optimizing Small Python Code

2021-06-22 Thread Benjamin Schollnick
How would you measure the steps that it takes? - Benjamin > On Jun 22, 2021, at 7:04 PM, Greg Ewing wrote: > > On 23/06/21 3:03 am, Kais Ayadi wrote: >> for n in range(1, 7): >> print (n) >> for x in range(0, n): >> print(" ", x) >> can this code be more

Re: Optimizing Small Python Code

2021-06-22 Thread Greg Ewing
On 23/06/21 3:03 am, Kais Ayadi wrote: for n in range(1, 7): print (n) for x in range(0, n): print(" ", x) can this code be more optimised? Optimised for what? Readability? Execution speed? Code size? Memory usage? -- Greg --

Optimizing Small Python Code

2021-06-22 Thread Kais Ayadi
Hi There! this is a small python code executed in 61 steps for n in range(1, 7): print (n) for x in range(0, n): print(" ", x) can this code be more optimised? -- https://mail.python.org/mailman/listinfo/python-list