problem on multi-threading

2014-07-25 Thread 水静流深
The right program is as following,everything is ok. import requests import threading import queue class webdata(object): def __init__(self,name): self.jobs=queue.Queue() for x in name: url='http://stockhtm.finance.qq.com/sstock/ggcx/%s.shtml' %x se

How to index an array with even steps?

2014-07-25 Thread fl
Hi, I have an array arr which is indexed from 0 to 999. I would like to construct a column in two steps. The first step is input from 200 data, evenly spread from 0 to 999 of the target array. Then, I want to use interpolate it from 200 to 1000 with interpolate method. In Python, ':' is used to

Re: How to index an array with even steps?

2014-07-25 Thread Steven D'Aprano
On Fri, 25 Jul 2014 04:45:31 -0700, fl wrote: > Hi, > > I have an array arr which is indexed from 0 to 999. I would like to > construct a column in two steps. The first step is input from 200 data, > evenly spread from 0 to 999 of the target array. Then, I want to use > interpolate it from 200 to

Re: How to index an array with even steps?

2014-07-25 Thread fl
On Friday, July 25, 2014 7:45:31 AM UTC-4, fl wrote: > to 999 of the target array. Then, I want to use interpolate it from 200 to > 1000 > > with interpolate method. > > In Python, ':' is used to indicate range (while in Matlab I know it can be > used > to control steps). How to index an array

Re: How to index an array with even steps?

2014-07-25 Thread Akira Li
fl writes: > In Python, ':' is used to indicate range (while in Matlab I know it can be > used > to control steps). How to index an array with 0, 5, 10, 15...995? Just use slicing: >>> L = range(1000) # your array goes here >>> L[::5] [0, 5, 10, 15, ..., 995] # Python 2 range(0, 1000,

Re: Exploring Python for next desktop GUI Project

2014-07-25 Thread Noble Bell
On Thursday, July 24, 2014 6:35:02 PM UTC-5, Terry Reedy wrote: > On 7/24/2014 1:04 PM, Chris "Kwpolska" Warrick wrote: > > > > > And it might be better to stay with Python 2, there are still > > > things that don't work with Py3k that you might find crucial. > > > > It is true that there ar

Page layout in Python

2014-07-25 Thread maurog
The first step in grabbing information from a pdf file is to translate it into text format with pdftotext -layout command. Is it available any specific python tool or library to describe the layout of a page with ascii characters and to help in identifying and extracting the useful pieces of in

Re: .Net Like Gui Builder for Python?

2014-07-25 Thread Orochi
Edit: I did went for IronPythonStudio but its dead now and they are not updating it anymore -- https://mail.python.org/mailman/listinfo/python-list

.Net Like Gui Builder for Python?

2014-07-25 Thread Orochi
Hi, This Question may sound lame ,but I am searching for .Net Like Gui Builder for Python. I tried PyQt Designer' and 'Glade', No doubt its great but it created only interface. I have to code all the things in separate file. what I was searching for is Visual Studio .Net like Gui builder where yo

rpath alike feature for python scripts

2014-07-25 Thread Olaf Hering
Hello, ELF binaries have a concept of RPATH, that means the interpreter looks for libraries first in a list of directories provided by the binary before falling back to default system directories. Since python scripts also do some sort of library loading, but lack an RPATH like feature, I'm aski

ArgumentParser maps dash to underscore in flags, but not positional arguments?

2014-07-25 Thread Roy Smith
I'm using Python 2.7.3. It looks like ArgumentParser maps "--foo-bar" to "foo_bar" in the argument namespace, but doesn't do the same kind of mapping for positional arguments. Is this intentional? I can't find in the docs where it describes this mapping, but it's certainly convenient, and see

Re: .Net Like Gui Builder for Python?

2014-07-25 Thread Jerry Hill
On Fri, Jul 25, 2014 at 10:55 AM, Orochi wrote: > So,Is there any Gui App builder like Visual Studio or having features like > Visual Studio for Python. I'm not aware of anything with the same level of functionality as Visual Studio's GUI building tools. Glade is the closest I've seen, and as y

Re: Exploring Python for next desktop GUI Project

2014-07-25 Thread Sturla Molden
Zachary Ware wrote: > How so? Like any other facet of programming, using Tk(inter) has it's > frustrations, but for the most part it has always worked as expected > for me. Granted, I haven't done anything terribly fancy. In my experience, tkinter and ttk is fine until you need to do something

Re: .Net Like Gui Builder for Python?

2014-07-25 Thread Sturla Molden
Orochi wrote: > I tried PyQt Designer' and 'Glade', No doubt its great but it created only > interface. > I have to code all the things in separate file. That's what you should do. Keep autogenerated and hand-written code separate. Also take a look at wxFormBuilder. > what I was searching fo

Re: problem on multi-threading

2014-07-25 Thread Sturla Molden
"水静流深" <1248283...@qq.com> wrote: > name=['60', '01', '600319', '600531','600661', '600983', '600202', > '600149'] > x=webdata(name) > x.run()‍ > > never quit from the thread ,why? Call .start() instead of .run() -- https://mail.python.org/mailman/listinfo/python-list

Re: .Net Like Gui Builder for Python?

2014-07-25 Thread Dietmar Schwertberger
Am 25.07.2014 16:55, schrieb Orochi: So,Is there any Gui App builder like Visual Studio or having features like Visual Studio for Python. Unfortunately there's nothing like that. IMHO the lack of such a tool is a major blocking point in many (corporate) environments... From the GUI builders

Re: What is the simplest method to get a vector result?

2014-07-25 Thread fl
On Thursday, July 24, 2014 9:49:14 AM UTC-4, Vlastimil Brom wrote: > 2014-07-24 14:53 GMT+02:00 fl : > internally): > http://mpmath.org/ > Using the sensible defaults, the plotting of a function can be as simple as: > > mpmath.plot(mpmath.sin) > > As for your original question, you can use a libr

Strange Error with pip install.

2014-07-25 Thread Bruce Whealton
Hello, I am using Windows 8.1 (I do have a linux box setup with virtualbox also) and I've used python previously but now it is giving me problems whenever I try to install anything from PyPI using pip. The error I get from the command line is "Cannot fetch index base URL http://pypi.pyth

Prob. Code Downloaded for Programming the Semantic Web (python code)

2014-07-25 Thread Bruce Whealton
Hello all, I downloaded some code accompanying the book "Programming the Semantic Web." This question is not Semantic Web related and I doubt that one needs to know anything about the Semantic Web to help me with this. It's the first code sample in the book, I'm embarrassed to say. I

Re: Prob. Code Downloaded for Programming the Semantic Web (python code)

2014-07-25 Thread Skip Montanaro
> OK, Eclipse with PyDev doesn't like this first line, with the function: > def add(self, (sub, pred, obj)): > > It complains about the parentheses just before sub. Seems like this code is Python 2.x. Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: What is the simplest method to get a vector result?

2014-07-25 Thread Ian Kelly
On Fri, Jul 25, 2014 at 5:08 PM, fl wrote: > I want to use your reply about numpy, but I find only the following works: > > import numpy as numpy > > Do you have other ways to import? (I find the above import a little more > letters) What's wrong with: import numpy -- https://mail.python.org/m

Re: Prob. Code Downloaded for Programming the Semantic Web (python code)

2014-07-25 Thread Dan Stromberg
On Fri, Jul 25, 2014 at 5:21 PM, Skip Montanaro wrote: >> OK, Eclipse with PyDev doesn't like this first line, with the function: >> def add(self, (sub, pred, obj)): >> >> It complains about the parentheses just before sub. > > Seems like this code is Python 2.x. For me, this code ran on all of 2

Re: Prob. Code Downloaded for Programming the Semantic Web (python code)

2014-07-25 Thread Ian Kelly
On Jul 25, 2014 6:54 PM, "Dan Stromberg" wrote: > > On Fri, Jul 25, 2014 at 5:21 PM, Skip Montanaro wrote: > >> OK, Eclipse with PyDev doesn't like this first line, with the function: > >> def add(self, (sub, pred, obj)): > >> > >> It complains about the parentheses just before sub. > > > > Seems

Re: one to many (passing variables)

2014-07-25 Thread C.D. Reimer
On 7/24/2014 2:58 AM, Ben Finney wrote: Here is an article on good API design; the principles apply to Python http://blog.isnotworking.com/2007/05/api-design-guidelines.html>. You know your API and its requirements better than we; see whether that sheds any light on improvements to make. Thank y

Re: What is the simplest method to get a vector result?

2014-07-25 Thread fl
On Friday, July 25, 2014 8:37:14 PM UTC-4, Ian wrote: > On Fri, Jul 25, 2014 at 5:08 PM, fl wrote: > > Do you have other ways to import? (I find the above import a little more > > letters) > > What's wrong with: > > import numpy I was wrong, maybe some careless key inputs. "import numpy" works

Re: .Net Like Gui Builder for Python?

2014-07-25 Thread Chris Angelico
On Sat, Jul 26, 2014 at 7:23 AM, Dietmar Schwertberger wrote: > Am 25.07.2014 16:55, schrieb Orochi: > >> So,Is there any Gui App builder like Visual Studio or having features like >> Visual Studio for Python. > > Unfortunately there's nothing like that. > IMHO the lack of such a tool is a major b

Re: one to many (passing variables)

2014-07-25 Thread Chris Angelico
On Sat, Jul 26, 2014 at 11:47 AM, C.D. Reimer wrote: > Isn't a zero-length array, empty collection and null all the same thing? Definitely not. In C++ and Java, which he's primarily looking at, there's a definite difference in usage, and potentially in memory usage/performance. > Or does the "De

Re: Prob. Code Downloaded for Programming the Semantic Web (python code)

2014-07-25 Thread Steven D'Aprano
On Fri, 25 Jul 2014 17:06:17 -0700, Bruce Whealton wrote: > OK, Eclipse with PyDev doesn't like this first line, with the function: > def add(self, (sub, pred, obj)): In Python 2, you could include parenthesised parameters inside function declarations as above. That is effectively a short cut for

Re: Prob. Code Downloaded for Programming the Semantic Web (python code)

2014-07-25 Thread Chris Angelico
On Sat, Jul 26, 2014 at 10:06 AM, Bruce Whealton wrote: > OK, Eclipse with PyDev doesn't like this first line, with the function: > def add(self, (sub, pred, obj)): As others have said, this is something that changed in Python 3. So you have two parts to the problem: firstly, your code is bound t

Re: .Net Like Gui Builder for Python?

2014-07-25 Thread Michael Torrie
On 07/25/2014 08:55 AM, Orochi wrote: > Hi, This Question may sound lame ,but I am searching for .Net Like > Gui Builder for Python. I tried PyQt Designer' and 'Glade', No doubt > its great but it created only interface. I have to code all the > things in separate file. what I was searching for is

Re: one to many (passing variables)

2014-07-25 Thread Steven D'Aprano
On Fri, 25 Jul 2014 18:47:55 -0700, C.D. Reimer wrote: > On 7/24/2014 2:58 AM, Ben Finney wrote: >> Here is an article on good API design; the principles apply to Python >> http://blog.isnotworking.com/2007/05/api-design-guidelines.html>. >> You know your API and its requirements better than we; s

Re: .Net Like Gui Builder for Python?

2014-07-25 Thread TP
On Fri, Jul 25, 2014 at 7:40 PM, Chris Angelico wrote: > The OP asked for two things, which I'll separate because they're > actually quite different. > > 1) Drag and drop widgets to create a window > 2) Double-click a widget to edit its code (presumably event handler) > > I have used a number of

Re: .Net Like Gui Builder for Python?

2014-07-25 Thread Chris Angelico
On Sat, Jul 26, 2014 at 2:13 PM, TP wrote: > Not that I disagree with the overall point of just using a text editor > (especially for Python GUIs) but apparently you've never created a C# WPF > app using Visual Studio? WPF fully supports layout controls, is *not* > generally pixel based it's more

Re: rpath alike feature for python scripts

2014-07-25 Thread dieter
Olaf Hering writes: > ELF binaries have a concept of RPATH, that means the interpreter looks > for libraries first in a list of directories provided by the binary > before falling back to default system directories. > > Since python scripts also do some sort of library loading, but lack an > RPAT

Re: Strange Error with pip install.

2014-07-25 Thread dieter
Bruce Whealton writes: > I am using Windows 8.1 (I do have a linux box setup with virtualbox > also) and I've used python previously but now it is giving me problems > whenever I try to install anything from PyPI using pip. The error I get from > the command line is > "Cannot fetch ind

回复: problem on multi-threading

2014-07-25 Thread 水静流深
>>> x=webdata(name) >>> x.start() Traceback (most recent call last): File "", line 1, in AttributeError: 'webdata' object has no attribute 'start'‍ There is a relation with jobs.join() method in threading module,your answer is wrong. -- 原始邮件 -- 发件人: "Sturla

Re: problem on multi-threading

2014-07-25 Thread Chris Kaynor
On Fri, Jul 25, 2014 at 12:45 AM, 水静流深 <1248283...@qq.com> wrote: > > never quit from the thread ,why? > I am going to guess that you can actually run code in the interpreter here. When printing from threads, the prompt will end up in the wrong place as the prompt is printed in the main thread.

python template lint

2014-07-25 Thread Noah
Hi there List, I am looking for a little guidance here. I am taking a series of template files for building configuration. I want to design some simple lint rules to check for some of the syntax of the template files I created. For instance if an open brace is seen indent 4 spaces each tim