Re: deque and thread-safety

2012-10-12 Thread Dieter Maurer
Christophe Vandeplas writes: > ... > From the documentation I understand that deques are thread-safe: >> Deques are a generalization of stacks and queues (the name is pronounced >> “deck” >> and is short for “double-ended queue”). Deques support thread-safe, memory >> efficient appends and pops

Re: serialization and versioning

2012-10-12 Thread Dieter Maurer
Neal Becker writes: > I wonder if there is a recommended approach to handle this issue. > > Suppose objects of a class C are serialized using python standard pickling. > Later, suppose class C is changed, perhaps by adding a data member and a new > constructor argument. > > It would see the pi

Feedback on my python framework I'm building.

2012-10-12 Thread nbvfour
http://giotto.readthedocs.org/en/latest/tutorial.html Can someone give me some feedback on what they think of this framework? I came up with the idea of this framework a few months ago. I gave a talk at a local python user group regarding these ideas, but no one seemed to think I was onto anyth

Re: Basic JSON question: Do I really need the quotes

2012-10-12 Thread rusi
On Oct 13, 5:03 am, Roy Smith wrote: > In article , > >  moo...@yahoo.co.uk wrote: > > I need to define some configuration in a file that will be manually created. > > [...] > > json seemed a quick an easy way of achieving this > > JSON would not be my first choice for a file which needs to be > m

Re: How to use "while" within the command in -c option of python?

2012-10-12 Thread Ned Deily
In article , Herman wrote: > I was just trying to do in a shell to quickly monitor a file. Imagine > instead of printing hello, it is "os.system("cat somefile")", etc. > Look like it works if i press an enter after the "import xxx". Thanks. If you are using a POSIX-compatible shell, the canonic

Re: How to use "while" within the command in -c option of python?

2012-10-12 Thread Herman
I was just trying to do in a shell to quickly monitor a file. Imagine instead of printing hello, it is "os.system("cat somefile")", etc. Look like it works if i press an enter after the "import xxx". Thanks. On Fri, Oct 12, 2012 at 5:29 PM, Dave Angel wrote: > On 10/12/2012 06:51 PM, Herman wrote

Re: How to use "while" within the command in -c option of python?

2012-10-12 Thread Steven D'Aprano
On Fri, 12 Oct 2012 19:04:20 -0400, Etienne Robillard wrote: > On Fri, 12 Oct 2012 15:51:19 -0700 > Herman wrote: > >> python -c "import os; while True: print('hello')" File "", >> line 1 >> import os; while True: print('hello') >> ^ >> SyntaxError: invalid syntax >> --

Re: How to use "while" within the command in -c option of python?

2012-10-12 Thread Dave Angel
On 10/12/2012 06:51 PM, Herman wrote: > python -c "import os; while True: print('hello')" > File "", line 1 > import os; while True: print('hello') > ^ > SyntaxError: invalid syntax See the recent thread: "for-loop on cmd-line" The problem has nothing to do with the com

New Taylor & Francis Int. Journal “CMBBE: Imaging & Visualization”: Announcement and CfP

2012-10-12 Thread tava...@fe.up.pt
- Announcement and Call for Contributions New International Journal: Computer Methods in Biomechanics and Biomedical Engineering: Imaging & Visualization Publisher: Taylor & Francis G

Re: Basic JSON question: Do I really need the quotes

2012-10-12 Thread Roy Smith
In article , moo...@yahoo.co.uk wrote: > I need to define some configuration in a file that will be manually created. > [...] > json seemed a quick an easy way of achieving this JSON would not be my first choice for a file which needs to be maintained by hand. I've only recently started using

Re: How to use "while" within the command in -c option of python?

2012-10-12 Thread Etienne Robillard
On Fri, 12 Oct 2012 15:51:19 -0700 Herman wrote: > python -c "import os; while True: print('hello')" > File "", line 1 > import os; while True: print('hello') > ^ > SyntaxError: invalid syntax > -- > http://mail.python.org/mailman/listinfo/python-list You get a syntax e

How to use "while" within the command in -c option of python?

2012-10-12 Thread Herman
python -c "import os; while True: print('hello')" File "", line 1 import os; while True: print('hello') ^ SyntaxError: invalid syntax -- http://mail.python.org/mailman/listinfo/python-list

Re: Basic JSON question: Do I really need the quotes

2012-10-12 Thread Adam Tauno Williams
On Fri, 2012-10-12 at 19:27 +0200, Roel Schroeven wrote: > moo...@yahoo.co.uk schreef: > > Hi, > > I need to define some configuration in a file that will be manually created. > > Internally, the data will be stored as a dict, which contains various > > properties related to a design > > e.g. Desi

Re: Checking for dlls in ctypes

2012-10-12 Thread Wanderer
On Friday, October 12, 2012 12:29:02 PM UTC-4, Dave Angel wrote: > On 10/12/2012 11:36 AM, Wanderer wrote: > > > I'm trying to write some code that will load one of three dll depending on > > the one available. I've tried the code below, but it doesn't work. The try > > except doesn't catch the

Re: Checking for dlls in ctypes

2012-10-12 Thread Wanderer
On Friday, October 12, 2012 12:57:06 PM UTC-4, MRAB wrote: > On 2012-10-12 16:36, Wanderer wrote: > > > I'm trying to write some code that will load one of three dll depending on > > the one available. I've tried the code below, but it doesn't work. The try > > except doesn't catch the exception

Re: Basic JSON question: Do I really need the quotes

2012-10-12 Thread Roel Schroeven
moo...@yahoo.co.uk schreef: Hi, I need to define some configuration in a file that will be manually created. Internally, the data will be stored as a dict, which contains various properties related to a design e.g. Design Name, dependencies, lists of files (and associated libraries). json seemed

Re: Insert item before each element of a list

2012-10-12 Thread Joshua Landau
On 9 October 2012 13:55, Peter Otten <__pete...@web.de> wrote: > Duncan Booth wrote: > > > mooremath...@gmail.com wrote: > > > >> What's the best way to accomplish this? Am I over-complicating it? > >> My gut feeling is there is a better way than the following: > >> > > import itertools > >>>

Re: Checking for dlls in ctypes

2012-10-12 Thread MRAB
On 2012-10-12 16:36, Wanderer wrote: I'm trying to write some code that will load one of three dll depending on the one available. I've tried the code below, but it doesn't work. The try except doesn't catch the exception. Is there a way to do this? try: self.dll = windll

Re: __setitem__ without position

2012-10-12 Thread Peter Otten
Ethan Furman wrote: > Terry Reedy wrote: >> In 3.x, you would write __setitem__ to recognize that the 'key' is a >> slice object rather than an int and act accordingly. (In 2.x, you would >> write __setslice__.) > > I'm not sure how far back it goes, but at least from 2.4 forward > __setitem__ wo

Re: Checking for dlls in ctypes

2012-10-12 Thread Dave Angel
On 10/12/2012 11:36 AM, Wanderer wrote: > I'm trying to write some code that will load one of three dll depending on > the one available. I've tried the code below, but it doesn't work. The try > except doesn't catch the exception. Is there a way to do this? > > try: > self.dl

Re: __setitem__ without position

2012-10-12 Thread Ethan Furman
Terry Reedy wrote: In 3.x, you would write __setitem__ to recognize that the 'key' is a slice object rather than an int and act accordingly. (In 2.x, you would write __setslice__.) I'm not sure how far back it goes, but at least from 2.4 forward __setitem__ works with slices just fine. ~Et

Checking for dlls in ctypes

2012-10-12 Thread Wanderer
I'm trying to write some code that will load one of three dll depending on the one available. I've tried the code below, but it doesn't work. The try except doesn't catch the exception. Is there a way to do this? try: self.dll = windll.pvcam64 except: prin

Re: Basic JSON question: Do I really need the quotes

2012-10-12 Thread Kwpolska
On Fri, Oct 12, 2012 at 4:09 PM, wrote: > Hi, > I need to define some configuration in a file that will be manually created. > Internally, the data will be stored as a dict, which contains various > properties related to a design > e.g. Design Name, dependencies, lists of files (and associated l

Basic JSON question: Do I really need the quotes

2012-10-12 Thread moogyd
Hi, I need to define some configuration in a file that will be manually created. Internally, the data will be stored as a dict, which contains various properties related to a design e.g. Design Name, dependencies, lists of files (and associated libraries). json seemed a quick an easy way of achiev

Re: deque and thread-safety

2012-10-12 Thread Antoine Pitrou
Hello, Christophe Vandeplas vandeplas.com> writes: > > From the documentation I understand that deques are thread-safe: > > Deques are a generalization of stacks and queues (the name is pronounced “deck” > > and is short for “double-ended queue”). Deques support thread-safe, memory > > efficie

Re: Posix call (execve) breaks mercurial?

2012-10-12 Thread Antoine Pitrou
Hello, Wayne Werner waynewerner.com> writes: > > So... curiouser and curiouser - it looks like it's not *actually* execve's > fault after all. I just compiled the code from the man page, tweaked it to > run 'hg root', and passed it a new environment. No problems. Well, then I > manually call

Re: serialization and versioning

2012-10-12 Thread Robert Kern
On 10/12/12 11:42 AM, Neal Becker wrote: I wonder if there is a recommended approach to handle this issue. Suppose objects of a class C are serialized using python standard pickling. Later, suppose class C is changed, perhaps by adding a data member and a new constructor argument. It would see

Re: deque and thread-safety

2012-10-12 Thread Christophe Vandeplas
Ok sorry for the mail, I found the solution by using deque.count(url) that's available starting from python 2.7 On Fri, Oct 12, 2012 at 2:40 PM, Christophe Vandeplas wrote: > Hello, > > I have a question about deque and thread-safety. > > My application has multiple threads running concurrently

Re: serialization and versioning

2012-10-12 Thread Neal Becker
Etienne Robillard wrote: > On Fri, 12 Oct 2012 06:42:03 -0400 > Neal Becker wrote: > >> I wonder if there is a recommended approach to handle this issue. >> >> Suppose objects of a class C are serialized using python standard pickling. >> Later, suppose class C is changed, perhaps by adding a d

deque and thread-safety

2012-10-12 Thread Christophe Vandeplas
Hello, I have a question about deque and thread-safety. My application has multiple threads running concurrently and doing the same action (downloading pages) To know what has already been downloaded I created the variable: seen = deque('', 1000) (keeps list of max 1000 urls in memory) In on

Re: serialization and versioning

2012-10-12 Thread Etienne Robillard
On Fri, 12 Oct 2012 06:42:03 -0400 Neal Becker wrote: > I wonder if there is a recommended approach to handle this issue. > > Suppose objects of a class C are serialized using python standard pickling. > Later, suppose class C is changed, perhaps by adding a data member and a new > constructo

Re: scipy and numpy for Python3

2012-10-12 Thread chip9munk
ok, i have solved it by the help from the previously mentioned page. python 3.2 should be used, 3.3 has issues with building numpy and scipy. -- http://mail.python.org/mailman/listinfo/python-list

serialization and versioning

2012-10-12 Thread Neal Becker
I wonder if there is a recommended approach to handle this issue. Suppose objects of a class C are serialized using python standard pickling. Later, suppose class C is changed, perhaps by adding a data member and a new constructor argument. It would see the pickling protocol does not directly

scipy and numpy for Python3

2012-10-12 Thread chip9munk
Hello! I am an absolute beginner in this. Does anyone know hot to build scipy for python 3? here: http://scipy.org/Installing_SciPy/Windows it says that it was not yet tested... (?) any help is appreciated! any additional help for numpy is also welcome! Thanx in advance! -- http://mail.python

Re: an error in python lib?

2012-10-12 Thread Ulrich Eckhardt
Am 12.10.2012 00:06, schrieb Wenhua Zhao: On Wed, Oct 10, 2012 at 12:21 PM, Ian Kelly wrote: Can you demonstrate an API bug that is caused by this? A simple demo of this error is: [...] print "in main cv._is_owned: ", cv._is_owned() That is kind of cheating, because as far as I can t