Re: N-grams

2016-11-10 Thread Steven D'Aprano
On Thursday 10 November 2016 17:53, Wolfram Hinderer wrote: [...] > 1. The startup looks slightly ugly to me. > 2. If n is large, tee has to maintain a lot of unnecessary state. But n should never be large. If practice, n-grams are rarely larger than n=3. Occasionally you might use n=4 or even

Re: N-grams

2016-11-10 Thread Peter Otten
srinivas devaki wrote: Interesting approach. > def myngrams(iterable, n=2): > t = list(tee(iterable, 1)) I don't think I've seen tee(iterable, 1) before. Did you do this for aesthetic reasons or is there an advantage over t = [iter(iterable)] ? > for _ in range(n - 1): >

Re: N-grams

2016-11-10 Thread Peter Otten
Paul Rubin wrote: > This can probably be cleaned up some: > > from itertools import islice > from collections import deque > > def ngram(n, seq): > it = iter(seq) > d = deque(islice(it, n)) > if len(d) != n: > return > for s in it: >

Re: is modulefinder.ModuleFinder working at all?

2016-11-10 Thread Wolfgang Maier
On 10.11.2016 01:02, Steve D'Aprano wrote: On Thu, 10 Nov 2016 08:08 am, Wolfgang Maier wrote: Hi, I just used the stdlib's modulefinder.ModuleFinder (intended to find modules used by a script) for the first time in my life and it just doesn't seem to work like documented at all. Not sure what

Re: Python rules!

2016-11-10 Thread alister
On Wed, 09 Nov 2016 20:45:45 -0600, Skip Montanaro wrote: > On Wed, Nov 9, 2016 at 7:53 PM, Chris Angelico wrote: >> It's called Jython. :) > > Well, sure, but that didn't look enough like Python, so no chance that I > would mistake it for Jython. I suspect that whoever worked out that > arrange

Re: Help me cythonize a python routine!

2016-11-10 Thread BartC
On 09/11/2016 21:25, breamore...@gmail.com wrote: On Wednesday, November 9, 2016 at 7:34:41 PM UTC, BartC wrote: However according to your mindset nothing matters provided it's fast, > accuracy does not matter to users. Hence your recent comment on another thread about converting invalid in

Why I took October off from OSS volunteering

2016-11-10 Thread breamoreboy
http://www.snarky.ca/why-i-took-october-off-from-oss-volunteering -- https://mail.python.org/mailman/listinfo/python-list

Re: Why I took October off from OSS volunteering

2016-11-10 Thread Ethan Furman
On 11/09/2016 11:35 PM, breamore...@gmail.com wrote: http://www.snarky.ca/why-i-took-october-off-from-oss-volunteering Good article, Mark, thanks for sharing. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: I want to insert beacon scan result in to a database using python and mysql

2016-11-10 Thread Michael Torrie
On 11/10/2016 06:15 AM, Dennis Lee Bieber wrote: > On Wed, 9 Nov 2016 21:05:50 -0800 (PST), sudeeratechn...@gmail.com > declaimed the following: > >> >> sql = "insert into beacon VALUES(null, '%s')" % \ >> (beacon) >> > DON'T DO THAT... Wouldn't hurt to include a brief why on this, and the

Re: N-grams

2016-11-10 Thread srinivas devaki
On Thu, Nov 10, 2016 at 2:26 PM, Peter Otten <__pete...@web.de> wrote: > > I don't think I've seen tee(iterable, 1) before. Did you do this for > aesthetic reasons or is there an advantage over > > t = [iter(iterable)] Yeah just to be aesthetic, there's no extra advantage over that as with n

Re: Python rules!

2016-11-10 Thread Skip Montanaro
Alister> i think whoever did that WAS a tool Perhaps, but maybe she is a Python programmer forced to write Java (not Jython). If so, props to her for making the best of a bad situation. :-) Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: I want to insert beacon scan result in to a database using python and mysql

2016-11-10 Thread Chris Angelico
On Fri, Nov 11, 2016 at 2:36 AM, Michael Torrie wrote: > On 11/10/2016 06:15 AM, Dennis Lee Bieber wrote: >> On Wed, 9 Nov 2016 21:05:50 -0800 (PST), sudeeratechn...@gmail.com >> declaimed the following: >> >>> >>> sql = "insert into beacon VALUES(null, '%s')" % \ >>> (beacon) >>> >> DON'T D

Re: I want to insert beacon scan result in to a database using python and mysql

2016-11-10 Thread Michael Torrie
On 11/10/2016 11:32 AM, Chris Angelico wrote: > The easiest way is to use a parameterized query: > > cur.execute("insert into beacon VALUES(null, %s)", (beacon,)) > > I don't understand why so many people conflate parameterized with > prepared. "Prepared statements" have a two-step execution. > "

Fwd: Error message

2016-11-10 Thread Keenan C
To whom this may concern, I am continuously receiving this error after the installation of Python 3.5.2. The purpose of using this program is for a class I am currently enrolled in at a University. (I am running Windows 7 Home Premium 64-bit paired with an i3-2100 processor and 6 gb of ram. I d

Windows: subprocess won't run different Python interpreter

2016-11-10 Thread Thorsten Kampe
Hi, I'm trying to run a script with a different Python version by extending the path variable and executing "python.exe". It looks like subprocess will always run the current executing Python. The following snippet demonstrates the problem: """ import os, subprocess os.environ['PATH'] = '' prin

Re: Windows: subprocess won't run different Python interpreter

2016-11-10 Thread Thomas Nyberg
On 11/10/2016 04:58 PM, Thorsten Kampe wrote: Hi, I'm trying to run a script with a different Python version by extending the path variable and executing "python.exe". It looks like subprocess will always run the current executing Python. > [...] > Thorsten Have you tried using the full pa

Re: Windows: subprocess won't run different Python interpreter

2016-11-10 Thread Thorsten Kampe
* Thomas Nyberg (Thu, 10 Nov 2016 17:07:35 -0500) > > On 11/10/2016 04:58 PM, Thorsten Kampe wrote: > > Hi, > > > > I'm trying to run a script with a different Python version by > > extending the path variable and executing "python.exe". It looks like > > subprocess will always run the current exe

Re: Windows: subprocess won't run different Python interpreter

2016-11-10 Thread Thomas Nyberg
On 11/10/2016 05:32 PM, Thorsten Kampe wrote: Yes. That works. But it's not like subprocess should work. It certainly is odd. I can at least confirm that when I try to run your code I get the error that you're expecting, but I run debian. Have you tried using os.unsetenv()? https://docs.py

Re: Windows: subprocess won't run different Python interpreter

2016-11-10 Thread eryk sun
On Thu, Nov 10, 2016 at 9:58 PM, Thorsten Kampe wrote: > > I'm trying to run a script with a different Python version by > extending the path variable and executing "python.exe". It looks like > subprocess will always run the current executing Python. WinAPI CreateProcess checks the application d

Re: Error message

2016-11-10 Thread eryk sun
On Thu, Nov 10, 2016 at 9:37 PM, Keenan C wrote: > > I am continuously receiving this error after the installation of Python > 3.5.2. The purpose of using this program is for a class I am currently > enrolled in at a University. (I am running Windows 7 Home Premium 64-bit > paired with an i3-210

Re: Fwd: Error message

2016-11-10 Thread MRAB
On 2016-11-10 21:37, Keenan C wrote: To whom this may concern, I am continuously receiving this error after the installation of Python 3.5.2. The purpose of using this program is for a class I am currently enrolled in at a University. (I am running Windows 7 Home Premium 64-bit paired with an

Re: I want to insert beacon scan result in to a database using python and mysql

2016-11-10 Thread Michael Torrie
On 11/10/2016 06:10 PM, Dennis Lee Bieber wrote: > {I could swear I'd included an example of a parameterized query in my > response... I didn't want to go into the details of "SQL injection attack" > as, based on the rest of the OPs post, it would have needed a large > explanation... And the bigges

what is the procedure or how to plan how many nodes of dispy need for dsolve differential system in amazon cloud in limited time such as 1 hour, 2 hours.etc

2016-11-10 Thread meInvent bbird
what is the procedure or how to plan how many nodes of dispy need for dsolve differential system in amazon cloud in limited time such as 1 hour, 2 hours.etc ? #For Amazon Linux, the user name is ec2-user. For RHEL5, the user name is either root or ec2-user. #For Ubuntu, the user name is ubunt

Re: Windows: subprocess won't run different Python interpreter

2016-11-10 Thread Thorsten Kampe
* eryk sun (Thu, 10 Nov 2016 23:04:02 +) > > On Thu, Nov 10, 2016 at 9:58 PM, Thorsten Kampe > wrote: > > > > I'm trying to run a script with a different Python version by > > extending the path variable and executing "python.exe". It looks like > > subprocess will always run the current exec

Re: Windows: subprocess won't run different Python interpreter

2016-11-10 Thread Thorsten Kampe
* Thomas Nyberg (Thu, 10 Nov 2016 17:46:06 -0500) > > On 11/10/2016 05:32 PM, Thorsten Kampe wrote: > > Yes. That works. But it's not like subprocess should work. > > > > It certainly is odd. I can at least confirm that when I try to run your > code I get the error that you're expecting, but I r

Re: Windows: subprocess won't run different Python interpreter

2016-11-10 Thread eryk sun
On Fri, Nov 11, 2016 at 6:01 AM, Thorsten Kampe wrote: > * eryk sun (Thu, 10 Nov 2016 23:04:02 +) >> >> On Thu, Nov 10, 2016 at 9:58 PM, Thorsten Kampe >> wrote: >> > >> > I'm trying to run a script with a different Python version by >> > extending the path variable and executing "python.exe"