Re: subprocess.Popen zombie

2015-05-20 Thread Thomas Rachel
Am 20.05.2015 um 18:44 schrieb Robin Becker: not really, it's just normal to keep event routines short; the routine which beeps is after detection of the cat's entrance into the house and various recognition schemes have pronounced intruder :) You could add a timed "cleanup" routine which .wai

Re: Slices time complexity

2015-05-20 Thread Marko Rauhamaa
Steven D'Aprano : > On Wednesday 20 May 2015 19:56, Bartc wrote: >> But simple data such as small integers and floats are passed by >> value. Bigger data is 'sort of' passed by reference, but not full >> reference (the details are a bit messy, but if an object consists of >> two parts (A,B), then

Find if a file existing within 1000s of folder/sub-folder - each file has a unique presence

2015-05-20 Thread chaotic . sid
Hi All, I have a list of scripts which are present in various folders and this may be present in one of their sub-folder too. There are 1000s of folders and hence parsing through each folder/sub-folder is not an option. So I was trying to dir /s /b using python. Now since the file's path name i

Re: Slices time complexity

2015-05-20 Thread Steven D'Aprano
On Wednesday 20 May 2015 19:56, Bartc wrote: > "Steven D'Aprano" wrote in message > news:555c225b$0$2769$c3e8da3$76491...@news.astraweb.com... > >> The mental gymnastics they go through to force the round peg of pass-by- >> sharing object semantics into the false dichotomy "pass-by-value versus

Re: List semantics [was Re: Slices time complexity]

2015-05-20 Thread Steven D'Aprano
On Wed, 20 May 2015 06:54 pm, Gregory Ewing wrote: > Steven D'Aprano wrote: > >> Code snippet 1: >> >> x = [[1,2],[1,2]] >> >> creates a list bound to the name "x", containing a list containing ints 1 >> and 2, and a second independent list also containing ints 1 and 2. > > Using the word

Re: 'NoneType' in contextmanager prevent proper RuntimeError to be raised

2015-05-20 Thread Cameron Simpson
On 20May2015 16:20, Daniel Gonçalves wrote: When you decorate a function with contextmanager that didn't yield you got an AttributeError instead of a proper RuntimeError "generator didn't yield". For example: @contextlib.contextmanager def foo(): ... pass ... with foo(): ... do_so

Re: 'NoneType' in contextmanager prevent proper RuntimeError to be raised

2015-05-20 Thread Daniel Gonçalves
From the "Lib/contextlib.py": class GeneratorContextManager(object): """Helper for @contextmanager decorator.""" def __init__(self, gen): self.gen = gen def __enter__(self): try: return self.gen.next() except StopIte

Re: 'NoneType' in contextmanager prevent proper RuntimeError to be raised

2015-05-20 Thread MRAB
On 2015-05-21 00:20, Daniel Gonçalves wrote: When you decorate a function with contextmanager that didn't yield you got an AttributeError instead of a proper RuntimeError "generator didn't yield". For example: @contextlib.contextmanager def foo(): ... pass ... with foo(): ... do_so

'NoneType' in contextmanager prevent proper RuntimeError to be raised

2015-05-20 Thread Daniel Gonçalves
When you decorate a function with contextmanager that didn't yield you got an AttributeError instead of a proper RuntimeError "generator didn't yield". For example: >>> @contextlib.contextmanager >>> def foo(): ... pass ... >>> with foo(): ... do_something() ... Traceback (most recent ca

Re: List semantics [was Re: Slices time complexity]

2015-05-20 Thread Gregory Ewing
Terry Reedy wrote: A club roster contains identifiers that refer to and identify the members. Exactly: the roster "refers to" the members, rather than "containing" them. Or equivalently, it contains references to the members. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Slices time complexity

2015-05-20 Thread Christian Gollwitzer
Am 19.05.15 um 15:44 schrieb Steven D'Aprano: Variables are not first class values in C. (I assume you meant *values* rather than "objects", on account of C not being an OOP language.) There is no way, for example, to set x to *the variable y* in either C or Python. If you could, that would imply

Re: Slices time complexity

2015-05-20 Thread Mario Figueiredo
On Wed, 20 May 2015 21:47:46 +0100, Mark Lawrence wrote: >Please provide the figures to back up this claim. Nothing personal but >we've had problems with the RUE (amongst others) making nonsensical >claims, please don't take us down that path, thank you. Alright. My apologies. This answer of

Re: No ttk in 2.7

2015-05-20 Thread Mark Lawrence
On 20/05/2015 19:52, Cecil Westerhof wrote: Op Wednesday 20 May 2015 18:47 CEST schreef Ned Batchelder: On Wednesday, May 20, 2015 at 12:43:29 PM UTC-4, Ned Batchelder wrote: On Wednesday, May 20, 2015 at 12:35:40 PM UTC-4, Cecil Westerhof wrote: I want to start playing with tkinter, but ther

ASA Conference on Statistical Practice

2015-05-20 Thread Adams, Jean
Python users, Abstracts are now being accepted for the 2016 ASA Conference on Statistical Practice, February 18-20, San Diego, CA, USA. Conference attendees are not typically familiar with Python. It would be great to have someone from the Python community give a brief overview of

Re: Slices time complexity

2015-05-20 Thread Mark Lawrence
On 20/05/2015 20:51, Mario Figueiredo wrote: On Wed, 20 May 2015 03:07:03 +1000, Steven D'Aprano wrote: Yes, a slice can be expensive, if you have (say) a ten billion element list, and take a slice list[1:]. Since nothing seems to surprise you and you seem so adamant on calling anyone being

Re: Slices time complexity

2015-05-20 Thread Chris Angelico
On Thu, May 21, 2015 at 5:51 AM, Mario Figueiredo wrote: > But no one is arguing for that. Instead, it was said that it would be > interesting if Python offered views. It's pretty easy, actually. (Slightly more complicated once you handle more details like negative indexing and strides other than

Re: Slices time complexity

2015-05-20 Thread Ian Kelly
On Wed, May 20, 2015 at 1:51 PM, Mario Figueiredo wrote: > On Wed, 20 May 2015 03:07:03 +1000, Steven D'Aprano > wrote: > >>Yes, a slice can be expensive, if you have (say) a ten billion element list, >>and take a slice list[1:]. > > Since nothing seems to surprise you and you seem so adamant on

Re: Slices time complexity

2015-05-20 Thread Mario Figueiredo
On Wed, 20 May 2015 03:07:03 +1000, Steven D'Aprano wrote: >Yes, a slice can be expensive, if you have (say) a ten billion element list, >and take a slice list[1:]. Since nothing seems to surprise you and you seem so adamant on calling anyone being surprised by it, maybe I will surprise you if y

Re: No ttk in 2.7

2015-05-20 Thread Ian Kelly
On Wed, May 20, 2015 at 12:54 PM, Cecil Westerhof wrote: > Op Wednesday 20 May 2015 19:03 CEST schreef Zachary Ware: >> try: >> import tkinter as tk >> from tkinter import ttk >> except ImportError: >> import Tkinter as tk >> import ttk > > When there goes something wrong with: > from tkinter

Re: No ttk in 2.7

2015-05-20 Thread Cecil Westerhof
Op Wednesday 20 May 2015 18:47 CEST schreef Ned Batchelder: > On Wednesday, May 20, 2015 at 12:43:29 PM UTC-4, Ned Batchelder wrote: >> On Wednesday, May 20, 2015 at 12:35:40 PM UTC-4, Cecil Westerhof wrote: >>> I want to start playing with tkinter, but there are some >>> differences between 2 and

Re: No ttk in 2.7

2015-05-20 Thread Cecil Westerhof
Op Wednesday 20 May 2015 18:43 CEST schreef Ned Batchelder: > On Wednesday, May 20, 2015 at 12:35:40 PM UTC-4, Cecil Westerhof wrote: >> I want to start playing with tkinter, but there are some >> differences between 2 and 3. For this I use at the moment the >> following code: import sys >> >> if

Re: No ttk in 2.7

2015-05-20 Thread Cecil Westerhof
Op Wednesday 20 May 2015 19:03 CEST schreef Zachary Ware: > On Wed, May 20, 2015 at 11:01 AM, Cecil Westerhof wrote: >> >> I want to start playing with tkinter, but there are some >> differences between 2 and 3. For this I use at the moment the >> following code: import sys >> >> if sys.version_i

Re: Help for a newbie regarding code & physical switches

2015-05-20 Thread Terry Reedy
On 5/20/2015 3:54 AM, Howard Spink wrote: Thanks for your help. I want the python to run automatically after boot and show a blank white screen, This part if for a RasPy group. when a combination of GP10 inputs are HIGH python displays one of 150 JPEGS. Is this possible? Number the n inputs

Re: List semantics [was Re: Slices time complexity]

2015-05-20 Thread Terry Reedy
On 5/20/2015 4:54 AM, Gregory Ewing wrote: At this point the student thinks, "Um... what? How can an object contain another object *twice*?" If he's still thinking in physical terms, this sentence is nonsensical. It gets even worse with: x = [1, 2] x[1] = x Now you have to say that the list c

Re: fork/exec & close file descriptors

2015-05-20 Thread Ian Kelly
On Tue, May 19, 2015 at 7:10 PM, Gregory Ewing wrote: >> On Tue, May 19, 2015 at 8:54 AM, Chris Angelico > > wrote: >> >> On Linux (and possibly some other Unixes), /proc/self/fd may be of >> use. > > > On MacOSX, /dev/fd seems to be the equivalent of this. Not a

Re: Best approach to create humongous amount of files

2015-05-20 Thread Denis McMahon
On Wed, 20 May 2015 17:14:15 +0530, Parul Mogra wrote: > Hello everyone, > My objective is to create large amount of data files (say a million > *.json files), using a pre-existing template file (*.json). Each file > would have a unique name, possibly by incorporating time stamp > information. The

Re: No ttk in 2.7

2015-05-20 Thread Zachary Ware
On Wed, May 20, 2015 at 11:01 AM, Cecil Westerhof wrote: > > I want to start playing with tkinter, but there are some differences > between 2 and 3. For this I use at the moment the following code: > import sys > > if sys.version_info[0] < 3: > import Tkinter as tk > import

Re: No ttk in 2.7

2015-05-20 Thread Ned Batchelder
On Wednesday, May 20, 2015 at 12:43:29 PM UTC-4, Ned Batchelder wrote: > On Wednesday, May 20, 2015 at 12:35:40 PM UTC-4, Cecil Westerhof wrote: > > I want to start playing with tkinter, but there are some differences > > between 2 and 3. For this I use at the moment the following code: > > imp

Re: No ttk in 2.7

2015-05-20 Thread Ned Batchelder
On Wednesday, May 20, 2015 at 12:35:40 PM UTC-4, Cecil Westerhof wrote: > I want to start playing with tkinter, but there are some differences > between 2 and 3. For this I use at the moment the following code: > import sys > > if sys.version_info[0] < 3: > import Tkinter as tk >

Re: subprocess.Popen zombie

2015-05-20 Thread Robin Becker
On 20/05/2015 16:42, Alain Ketterlin wrote: Robin Becker writes: . The code I used to use with os.spawnl was even worse in leaving zombies around. For the same reason (os.wait() and os.waitpid() let you ... wait for child-processes). I suppose I needed to keep a record of all t

No ttk in 2.7

2015-05-20 Thread Cecil Westerhof
I want to start playing with tkinter, but there are some differences between 2 and 3. For this I use at the moment the following code: import sys if sys.version_info[0] < 3: import Tkinter as tk import ttk else: import tkinter as tk from tkinter import

Re: Help regarding python run time

2015-05-20 Thread Ian Kelly
On Wed, May 20, 2015 at 9:48 AM, Irmen de Jong wrote: > Or measure the actual CPU clock cycles taken instead of the wall clock run > time. > Then you should get a fairly constant number, if the program does the same > work every > time you run it. > > phobos:~ irmen$ time python test.py > real

Re: Best approach to create humongous amount of files

2015-05-20 Thread Tim Chase
On 2015-05-20 17:59, Peter Otten wrote: > Tim Chase wrote: > > wordlist[:] = [ # just lowercase all-alpha words > > word > > for word in wordlist > > if word.isalpha() and word.islower() > > ] > > Just a quick reminder: if the data is user-provided you have to > sanitize it: Thu

Re: Best approach to create humongous amount of files

2015-05-20 Thread Peter Otten
Tim Chase wrote: > On 2015-05-20 22:58, Chris Angelico wrote: >> On Wed, May 20, 2015 at 9:44 PM, Parul Mogra >> wrote: >> > My objective is to create large amount of data files (say a >> > million *.json files), using a pre-existing template file >> > (*.json). Each file would have a unique name

Re: Help regarding python run time

2015-05-20 Thread Irmen de Jong
On 20-5-2015 17:23, Ian Kelly wrote: > On Wed, May 20, 2015 at 7:02 AM, AKHIL RANA wrote: >> Hi, >> >> I am student at IIT Kanpur and working on a Opencv based Python project. I >> am working on program development which takes less time to execute. For that >> i have tested my small program hello

Re: subprocess.Popen zombie

2015-05-20 Thread Alain Ketterlin
Robin Becker writes: > As part of a long running PyQT process running as a window app in Arch > linux I needed an alert sound, I decided to use the beep command and > the app code then looked like > > pid = Popen(['/home/robin/bin/mybeep', '-r3', '-f750', '-l100', '-d75']).pid > > the mybeep scri

Re: Best approach to create humongous amount of files

2015-05-20 Thread paul . anton . letnes
There's a module called "template" that I've used before, for the find/replace part. I never investigated its performance, but my script used less than 1 s for 100 files IIRC :-) Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Best approach to create humongous amount of files

2015-05-20 Thread Tim Chase
On 2015-05-20 22:58, Chris Angelico wrote: > On Wed, May 20, 2015 at 9:44 PM, Parul Mogra > wrote: > > My objective is to create large amount of data files (say a > > million *.json files), using a pre-existing template file > > (*.json). Each file would have a unique name, possibly by > > incorpo

Re: Help regarding python run time

2015-05-20 Thread Ian Kelly
On Wed, May 20, 2015 at 7:02 AM, AKHIL RANA wrote: > Hi, > > I am student at IIT Kanpur and working on a Opencv based Python project. I > am working on program development which takes less time to execute. For that > i have tested my small program hello word on python to now the time taken by > th

Re: subprocess.Popen zombie

2015-05-20 Thread Cecil Westerhof
Op Wednesday 20 May 2015 15:16 CEST schreef Robin Becker: > As part of a long running PyQT process running as a window app in > Arch linux I needed an alert sound, I decided to use the beep > command and the app code then looked like > > pid = Popen(['/home/robin/bin/mybeep', '-r3', '-f750', '-l10

REST framework Editor in Python

2015-05-20 Thread subhabrata . banerji
Dear Group, I am trying to put one search engine interface in REST. To do this I am trying to learn Restframework and Django. One question occurred to me is, whether there is any Restframework editor which may do this job. Is there any? I was trying to find out https://pypi.python.org/pypi/re

subprocess.Popen zombie

2015-05-20 Thread Robin Becker
As part of a long running PyQT process running as a window app in Arch linux I needed an alert sound, I decided to use the beep command and the app code then looked like pid = Popen(['/home/robin/bin/mybeep', '-r3', '-f750', '-l100', '-d75']).pid the mybeep script handles module loading if req

Help regarding python run time

2015-05-20 Thread AKHIL RANA
Hi, I am student at IIT Kanpur and working on a Opencv based Python project. I am working on program development which takes less time to execute. For that i have tested my small program hello word on python to now the time taken by this program. I had run many time. and every time it run it gives

Re: Best approach to create humongous amount of files

2015-05-20 Thread Chris Angelico
On Wed, May 20, 2015 at 9:44 PM, Parul Mogra wrote: > My objective is to create large amount of data files (say a million *.json > files), using a pre-existing template file (*.json). Each file would have a > unique name, possibly by incorporating time stamp information. The files > have to be gen

Re: Looking for direction

2015-05-20 Thread darnold via Python-list
I recommend getting your hands on "Automate The Boring Stuff With Python" from no starch press: http://www.nostarch.com/automatestuff I've not read it in its entirety, but it's very beginner-friendly and is targeted at just the sort of processing you appear to be doing. HTH, Don -- https://ma

Best approach to create humongous amount of files

2015-05-20 Thread Parul Mogra
Hello everyone, My objective is to create large amount of data files (say a million *.json files), using a pre-existing template file (*.json). Each file would have a unique name, possibly by incorporating time stamp information. The files have to be generated in a folder specified. What is the be

Re: Slices time complexity

2015-05-20 Thread Oscar Benjamin
On 20 May 2015 at 10:56, Bartc wrote: > > However, I was so impressed with how (C)Python does things (working > exclusively with pointers, doing assignments by simply copying pointers, and > using reference counting to manage memory), that I'm experimenting with > letting my language work the same

Re: Slices time complexity

2015-05-20 Thread Bartc
"Steven D'Aprano" wrote in message news:555c225b$0$2769$c3e8da3$76491...@news.astraweb.com... > The mental gymnastics they go through to force the round peg of pass-by- > sharing object semantics into the false dichotomy "pass-by-value versus > pass-by-reference" is just crazy. > > One consequenc

Re: List semantics [was Re: Slices time complexity]

2015-05-20 Thread Gregory Ewing
Steven D'Aprano wrote: Code snippet 1: x = [[1,2],[1,2]] creates a list bound to the name "x", containing a list containing ints 1 and 2, and a second independent list also containing ints 1 and 2. Using the word "contains" here is misleading, because it conjures a mental picture of phy

Re: Help for a newbie regarding code & physical switches

2015-05-20 Thread alister
On Wed, 20 May 2015 00:54:40 -0700, Howard Spink wrote: > Thanks for your help. I want the python to run automatically after boot > and show a blank white screen, when a combination of GP10 inputs are > HIGH python displays one of 150 JPEGS. Is this possible? what sort of > boot times can I get wi

Re: Help for a newbie regarding code & physical switches

2015-05-20 Thread Howard Spink
Thanks for your help. I want the python to run automatically after boot and show a blank white screen, when a combination of GP10 inputs are HIGH python displays one of 150 JPEGS. Is this possible? what sort of boot times can I get with Arch? On Wednesday, 20 May 2015 08:14:50 UTC+1, Christian

Re: Slices time complexity

2015-05-20 Thread Marko Rauhamaa
Rustom Mody : > On Wednesday, May 20, 2015 at 12:16:49 PM UTC+5:30, Marko Rauhamaa wrote: >> Rustom Mody : >> >> > In short any language that is implemented on von Neumann hw will >> > need to address memory. >> >> I don't think von Neumann hardware plays a role here. I think the >> data model i

Re: Rule of order for dot operators?

2015-05-20 Thread Ben Finney
Thomas 'PointedEars' Lahn writes: > Ned Batchelder wrote: > > > Be considerate. Be respectful. > > And who appointed you moderator? Ned is telling you how we are all expected to behave here, and that you have violated the norms of behaviour to other participants here. He does so with authority

List semantics [was Re: Slices time complexity]

2015-05-20 Thread Steven D'Aprano
On Wednesday 20 May 2015 16:23, Rustom Mody wrote: > I dont like teaching this. viz that in python > x = [[1,2],[1,2]] > is equal to y defined as > z = [1,2] > y = [z,z] > And although they are equal as in '==' they are not equal as in behavior, > memory usage etc, a fact that can only be elucidat

Re: Slightly OT: Seeking (python-based) project diary tool, or framework to write one

2015-05-20 Thread jkn
Hi Frank On Wednesday, 20 May 2015 06:33:33 UTC+1, Frank Millman wrote: > "jkn" wrote in message > news:99067d97-cad4-42f8-8fd1-b1884bed7...@googlegroups.com... > > Hi All > >as in the title, this is a little bit OT - but since ideally I'd like a > > tool written in Python, and I know reade

Re: Help for a newbie regarding code & physical switches

2015-05-20 Thread Christian Gollwitzer
Am 20.05.15 um 08:49 schrieb Howard Spink: I have a Pi + SD card with Pi OS + PiTfT screen I am trying to display specific JPEGs when certain combination of GP10 inputs are HIGH. I would like to use Python, I have no background in programming. Can someone point me on the right tracks? No bg

Re: Slices time complexity

2015-05-20 Thread Rustom Mody
On Wednesday, May 20, 2015 at 12:16:49 PM UTC+5:30, Marko Rauhamaa wrote: > Rustom Mody : > > > In short any language that is implemented on von Neumann hw will need > > to address memory. > > I don't think von Neumann hardware plays a role here. I think the data > model is inherent in Python/Jav