Re: How to go about. On read/write locks

2009-04-05 Thread Diez B. Roggisch
Emanuele D'Arrigo schrieb: Hi everybody, I'm having a threading-related design issue and I suspect it has a name that I just don't know. Here's a description. Let's assume a resource (i.e. a dictionary) that needs to be accessed by multiple threads. A simple lock will do the job but in some ci

Re: Painful?: Using the ast module for metaprogramming

2009-04-05 Thread Joseph Garvin
On Mon, Apr 6, 2009 at 1:33 AM, "Martin v. Löwis" wrote: >> -If I have the source to a single function definition and I pass it to >> ast.parse, I get back an ast.Module. Why not an ast.FunctionDef? > > Because it is easier for processing if you always get the same type of > result. Typically, you

Re: Cannot find text in *.py files with Windows Explorer?

2009-04-05 Thread Gabriel Genellina
En Sun, 05 Apr 2009 16:36:05 -0300, Gerhard Häring escribió: John Machin wrote: On Apr 4, 3:21 pm, John Doe wrote: Anybody have a solution for Windows (XP) Explorer search not finding ordinary text in *.py files? Get a grep on yourself! http://gnuwin32.sourceforge.net/packages/grep.htm T

Re: Python wrapper for Ebay

2009-04-05 Thread Jeroen Ruigrok van der Werven
-On [20090406 07:37], Nagraj Rao (nagraj.si...@gmail.com) wrote: >Shud I directly make use of the REST APIs and parse the xml out for info? Or >is there a better way to do it? http://developer.ebay.com/DevZone/shopping/docs/CallRef/GetSingleItem.html#sampledescriptionItemSpecifics That's what Eba

Re: Cannot find text in *.py files with Windows Explorer?

2009-04-05 Thread Gabriel Genellina
En Sun, 05 Apr 2009 16:36:05 -0300, Gerhard Häring escribió: John Machin wrote: On Apr 4, 3:21 pm, John Doe wrote: Anybody have a solution for Windows (XP) Explorer search not finding ordinary text in *.py files? Get a grep on yourself! http://gnuwin32.sourceforge.net/packages/grep.htm T

Re: Python wrapper for Ebay

2009-04-05 Thread Nagraj Rao
Hey guys, I'm just wondering whether I've asked a wrong question at a wrong place, since I'm not getting any replies. Please suggest me whats the best way to talk to Ebay from Python. I just want to extract certain product info from ebay and not really perform "add item" or so. Shud I directly

Re: Painful?: Using the ast module for metaprogramming

2009-04-05 Thread Martin v. Löwis
> -If I have the source to a single function definition and I pass it to > ast.parse, I get back an ast.Module. Why not an ast.FunctionDef? Because it is easier for processing if you always get the same type of result. Typically, you don't know what's in the source code, so you need to parse, then

Re: Painful?: Using the ast module for metaprogramming

2009-04-05 Thread Paul Rubin
Joseph Garvin writes: > I decided to try using the ast module to see how difficult or not it > was to use for metaprogramming. Maybe you really want Lisp? ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Need advise about an application

2009-04-05 Thread azrael
On Apr 5, 9:48 pm, Dennis Lee Bieber wrote: > On Sun, 5 Apr 2009 10:14:08 -0700 (PDT), azrael > declaimed the following in gmane.comp.python.general: > > > DB saving, and anotherone for statistics and other stuff because it is > > very important to save the signal which comes every second. if the

Re: How to free /destroy object created by PyTuple_New

2009-04-05 Thread grbgooglefan
Regarding PyTuple_New, when I pass this tuple with variable values set to some evaluation function like PyObject_CallObject, do I need to increment reference for this tuple & then decrement again after the call returns? If I've not configured my libpython with threads when compiling, will PyGILSta

Painful?: Using the ast module for metaprogramming

2009-04-05 Thread Joseph Garvin
I decided to try using the ast module to see how difficult or not it was to use for metaprogramming. So I tried writing a decorator that would perform a simple transformation of a function's code. It was certainly not as easy as I had guessed, but I did succeed so it's not impossible. The issues I

Re: Killing threads

2009-04-05 Thread ericwoodworth
On Apr 5, 11:07 pm, Dennis Lee Bieber wrote: > On Sun, 5 Apr 2009 17:27:15 -0700 (PDT), imageguy > declaimed the following in > gmane.comp.python.general: > > > In threading.Event python 2.5 docs say; > > "This is one of the simplest mechanisms for communication between > > threads: one thread si

exporting symbols with ctypes?

2009-04-05 Thread Brian
I'd like to load a library that expects executables which link against it to provide a particular symbol. Is there a way to do the inverse of the in_dll() operation? I'd prefer to avoid creating a brand new library on the fly just to satisfy this one dependency. -- http://mail.python.org/mailman/

Re: statvfs clearance

2009-04-05 Thread Cameron Simpson
On 04Apr2009 03:56, Sreejith K wrote: | Python's statvfs module contains the following indexes to use with | os.statvfs() that contains the specified information | statvfs.F_BSIZE | Preferred file system block size. [...] | Can anyone tell me (or give me some links to know) what are these | va

Re: Tab completion

2009-04-05 Thread Miles
On Thu, Apr 2, 2009 at 10:59 AM, Steven D'Aprano wrote: > Does anyone use the tab-completion recipe in the docs? > > http://docs.python.org/library/rlcompleter.html#module-rlcompleter > > suggests using this to enable tab-completion: > > try: >    import readline > except ImportError: >    print "M

Example for readline module usage?

2009-04-05 Thread Grant Edwards
I want to use the readline module to allow the user to edit input that is typed into my Python program. [Isn't that what the readline module is for? It's certainly what the readline library is used for in C programs.] I've read and re-read the readline moudle documentaion, and I still have absol

Re: with open('com1', 'r') as f:

2009-04-05 Thread Lawrence D'Oliveiro
In message , Terry Reedy wrote: > Lawrence D'Oliveiro wrote: > >> All Python objects are reference-counted. > > Nope. Only in CPython, and even that could change. Why should it? >> Once the file object becomes >> inaccessible, it is automatically closed. Simple. > > Even in CPython, that wou

Re: Killing threads

2009-04-05 Thread imageguy
> For more info, see the slides from my thread > tutorial:http://pythoncraft.com/OSCON2001/ > -- > Aahz (a...@pythoncraft.com)           <*>        http://www.pythoncraft.com/ > Aahz, thanks for this reference and link to your presentation. At the risk of highjacking the OP's question, I am bit

tk - askopenfilenames parsing

2009-04-05 Thread daku9999
Hello, I'm having trouble with the output from askopenfilenames...: --- root = tkinter.Tk() root.withdraw() files = tkinter.filedialog.askopenfilenames(parent=root, title='Choose file(s)') if not files: tkinter.messagebox.showerror("No input file", "No input file given

RE: Python Goes Mercurial

2009-04-05 Thread Delaney, Timothy (Tim)
Sorry - it's early and I didn't force Outlook to not top-post. Unfortunately, I get asked to top-post here at work ... Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

RE: Python Goes Mercurial

2009-04-05 Thread Delaney, Timothy (Tim)
As someone who has to use ClearCase UCM at work (damned politics!) I can tell you that I very much prefer creating a separate view (directory) for each branch as I used to do in Base ClearCase. All too often you end up having to deliver multiple activities together because someone else made a cha

How to go about. On read/write locks

2009-04-05 Thread Emanuele D'Arrigo
Hi everybody, I'm having a threading-related design issue and I suspect it has a name that I just don't know. Here's a description. Let's assume a resource (i.e. a dictionary) that needs to be accessed by multiple threads. A simple lock will do the job but in some circumstances it will create an

Re: Module Names with . (dots)?

2009-04-05 Thread bearophileHUGS
activescott: > BTW: I decided to go with 'scottsappengineutil'. scottsappengineutil is hard to read and understand. The name split with underscores is more readable: scott_appengine_util Or just: app_engine_util Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Module Names with . (dots)?

2009-04-05 Thread activescott
On Apr 5, 5:42 pm, Chris Rebert wrote: > On Sun, Apr 5, 2009 at 11:41 AM, activescott wrote: > > My understanding is that module names must not have a dot in them. For > > example, I tried to create a module like scott.appengine.util.py  and > > put misc utility classes in there. However, python

Re: Module Names with . (dots)?

2009-04-05 Thread activescott
On Apr 5, 5:42 pm, Chris Rebert wrote: > On Sun, Apr 5, 2009 at 11:41 AM, activescott wrote: > > My understanding is that module names must not have a dot in them. For > > example, I tried to create a module like scott.appengine.util.py  and > > put misc utility classes in there. However, python

Re: Module Names with . (dots)?

2009-04-05 Thread Chris Rebert
On Sun, Apr 5, 2009 at 11:41 AM, activescott wrote: > My understanding is that module names must not have a dot in them. For > example, I tried to create a module like scott.appengine.util.py  and > put misc utility classes in there. However, python gives the error "No > module named scott.appengi

Re: Module Names with . (dots)?

2009-04-05 Thread John Machin
On Apr 6, 4:41 am, activescott wrote: > My understanding is that module names must not have a dot in them. For > example, I tried to create a module like scott.appengine.util.py  and > put misc utility classes in there. However, python gives the error "No > module named scott.appengine.util". No I

Re: CPython and C++ object GC

2009-04-05 Thread Aahz
[posted & e-mailed] In article <4425af5f-b188-4c3e-9114-eb7673165...@r33g2000yqn.googlegroups.com>, wrote: > >I would like to use a C++ gui library with the following (simplified) >interface in Python. Given the lack of responses on c.l.py, try the capi-sig mailing list. -- Aahz (a...@pythoncr

Re: Creating a session in windows to auth to remote machines

2009-04-05 Thread ericwoodworth
On Apr 5, 9:09 am, ericwoodwo...@gmail.com wrote: > On Apr 5, 2:11 am, Tim Golden wrote: > > > > > > > ericwoodwo...@gmail.com wrote: > > > Hi, > > >      I'm trying to auth to remote machines so I can plunder WMI to get > > > logs and settings and the like.  My script works for most of my > > > m

Re: Best Compatible JS Lib for Django

2009-04-05 Thread ntwrkd
I didn't realize there was a Django list. I will direct my questions there. Thanks for the suggestions. On Sun, Apr 5, 2009 at 12:31 PM, Gerhard Häring wrote: > Daniel Fetchinson wrote: >>> Does anyone have experience with using JS Libraries with Django? >>> Do some work better than others and ar

Re: with open('com1', 'r') as f:

2009-04-05 Thread gert
On Apr 5, 12:24 am, "Gabriel Genellina" wrote: > En Sat, 04 Apr 2009 14:11:12 -0300, gert escribió: > > > On Apr 4, 5:20 pm, Kushal Kumaran wrote: > >> On Fri, 03 Apr 2009 22:10:36 +0200 > >> Christian Heimes wrote: > >> > gert wrote: > >> > > I do understand, and I went looking into pySerial,

Re: Cannot find text in *.py files with Windows Explorer?

2009-04-05 Thread Gerhard Häring
John Machin wrote: > On Apr 4, 3:21 pm, John Doe wrote: >> Anybody have a solution for Windows (XP) Explorer search not finding >> ordinary text in *.py files? >> > > Get a grep on yourself! > > http://gnuwin32.sourceforge.net/packages/grep.htm There's something even better: "ack -- better tha

Re: mmap resizing macosx unix

2009-04-05 Thread David Pratt
For sake of documenting for list, I ended up opening file a second time with 'a', padding it to extend its size (previous size + additional bytes to accommodate the insertion), closing file, open file with 'r+', open a second mmap with with new size, moving text to new location, then inser

Re: Best Compatible JS Lib for Django

2009-04-05 Thread Gerhard Häring
Daniel Fetchinson wrote: >> Does anyone have experience with using JS Libraries with Django? >> Do some work better than others and are easier to code with? > > You might want to ask this on the django list. Or on a JavaScript list ;-) It doesn't matter much in what context you use the JavaScript

Re: Re-raising exceptions with a different type and message, preserving existing information

2009-04-05 Thread Aahz
In article <87ljqnpo6o@benfinney.id.au>, Ben Finney wrote: > >What I need is to “wrap” the exception caught such that it has a >different type and message. But I don't want to lose the existing >type, message, and stack trace; that's all useful information for >someone trying to debug the

Re: Testing dynamic languages

2009-04-05 Thread Aahz
In article <641a30b8-c659-4212-9f31-b9eb401ad...@r37g2000yqn.googlegroups.com>, barisa wrote: >On Apr 4, 9:57=A0pm, bearophileh...@lycos.com wrote: > >> that. Don't fight the language. Use doctests). My other suggestion is >> to read code coming from 5+ Python programs written by other >> (differ

Re: CGIXMLRPCRequestHandler example

2009-04-05 Thread Aahz
[posted & e-mailed, please respond on-group] In article , Phoe6 wrote: > >I have the following CGIXMLRPCRequestHandler usage example. >handler = SimpleXMLRPCServer.CGIXMLRPCRequestHandler() >handler.register_instance(Foo()) >handler.handle_request() What happens when you telnet localhost 80

Re: Help with wxPython program :.: return 1?

2009-04-05 Thread Vlastimil Brom
2009/4/5 Kenny x : > Hello, I have a problem with my wxPython 2.8 Application. > The program opens and closes and on KomodoEdit it says "wxstreamredirect.py > returned 1.' >  What's wrong? > http://paste.pocoo.org/show/80/ > > P.S. I compared my source code to the source code in wxPython in Act

Re: Generators/iterators, Pythonicity, and primes

2009-04-05 Thread Scott David Daniels
Steven D'Aprano wrote: On Sun, 05 Apr 2009 00:28:17 -0400, Miles wrote: def prime_gen(): ... That's pretty sweet, but we can make it even faster. We can speed things up by incrementing by two instead of one, to avoid pointlessly testing even numbers that we know must fail. We can also speed th

Module Names with . (dots)?

2009-04-05 Thread activescott
My understanding is that module names must not have a dot in them. For example, I tried to create a module like scott.appengine.util.py and put misc utility classes in there. However, python gives the error "No module named scott.appengine.util". No I've read about packages (http://docs.python.org

Re: Need advise about an application

2009-04-05 Thread azrael
I guess that this is not an option because of the case that the calculation of the needed statistics takes not always the same time nad I am afraid tht using sleep() would after a couple of time periods skip a meassurement. -- http://mail.python.org/mailman/listinfo/python-list

Re: time.strptime() milliseconds

2009-04-05 Thread acet
On Apr 5, 6:43 pm, acet wrote: > I have a log file with hours,minutes,seconds and milliseconds, which > im trying to use, so if i say for example: > a = time.strptime("01:01:26:449", "%H:%M:%S:%?") > is there a directive for milliseconds where the '?' should be? i cant > seem to find it if there i

Re: Generators/iterators, Pythonicity, and primes

2009-04-05 Thread John Posner
>> > g = (lambda primes = []: >> > (n for n in count(2) if >> > (lambda x, primes: >> > (primes.append(x) or True >> > if all(x%p for p in primes if p <= sqrt(x)) >> > else False) >> > )(n, primes) >> >

Re: logging - string formating problems

2009-04-05 Thread MRAB
Werner F. Bruhin wrote: I see the following exception with a string formating problem. TypeError: not all arguments converted during string formatting Traceback (most recent call last): File "/usr/lib/python2.5/logging/__init__.py", line 744, in emit msg = self.format(record) File "/usr/lib

Help with wxPython program :.: return 1?

2009-04-05 Thread Kenny x
Hello, I have a problem with my wxPython 2.8 Application. The program opens and closes and on KomodoEdit it says "wxstreamredirect.py returned 1.' What's wrong? http://paste.pocoo.org/show/80/ P.S. I compared my source code to the source code in wxPython in Action, and it looks the same! Why

time.strptime() milliseconds

2009-04-05 Thread acet
I have a log file with hours,minutes,seconds and milliseconds, which im trying to use, so if i say for example: a = time.strptime("01:01:26:449", "%H:%M:%S:%?") is there a directive for milliseconds where the '?' should be? i cant seem to find it if there is -- http://mail.python.org/mailman/listin

logging - string formating problems

2009-04-05 Thread Werner F. Bruhin
I see the following exception with a string formating problem. TypeError: not all arguments converted during string formatting Traceback (most recent call last): File "/usr/lib/python2.5/logging/__init__.py", line 744, in emit msg = self.format(record) File "/usr/lib/python2.5/logging/__init

RE: Testing dynamic languages

2009-04-05 Thread Nick Stinemates
Plenty. Try github.com for starters. -Original Message- From: python-list-bounces+nick=stinemates@python.org [mailto:python-list-bounces+nick=stinemates@python.org] On Behalf Of barisa Sent: Sunday, April 05, 2009 10:22 AM To: python-list@python.org Subject: Re: Testing dynamic lan

Re: Testing dynamic languages

2009-04-05 Thread barisa
On Apr 4, 9:57 pm, bearophileh...@lycos.com wrote: > that. Don't fight the language. Use doctests). My other suggestion is > to read code coming from 5+ Python programs written by other > (different) people. You will see how to use Python. > > Bye, > bearophile Is there some online repository for

Re: Need advise about an application

2009-04-05 Thread Stef Mientki
azrael wrote: I am currently working on an application and I need a advise. I am supposed to read data from a device connected to a serial port. I am reading data using pySerial. The devise is sending signals with a time between two signals of one second. The application is supposed to collect

Re: python docs redirect on python.org is old

2009-04-05 Thread barisa
On Apr 5, 3:46 am, "Martin v. Löwis" wrote: > Brandon Craig Rhodes wrote: > > When I visit ... > > >    http://www.python.org/doc/lib/lib.html > > > ... I get redirected to ... > > >    http://www.python.org/doc/2.5.2/lib/lib.html > > > ... which seems a bit old. > > That is intentional. Use > > h

Re: Need advise about an application

2009-04-05 Thread azrael
On 5 tra, 14:48, 一首诗 wrote: > Do you have to show these data on GUI? If so, why not use the event > pattern? > As far as I know, it's the standard way wxPython works. Yes, I have to show the signaled data, but also create some statistical meassurement datasets as also some graphical represenata

Re: Generators/iterators, Pythonicity, and primes

2009-04-05 Thread Kay Schluehr
On 5 Apr., 18:47, John Posner wrote: > Kay Schluehr wrote: > > > That's because it is *one* expression. The avoidance of named > > functions makes it look obfuscated or prodigious. Once it is properly > > dissected it doesn't look that amazing anymore. > > > > Start with: > > > > (n for n i

Re: Generators/iterators, Pythonicity, and primes

2009-04-05 Thread John Posner
Kay Schluehr wrote: > That's because it is *one* expression. The avoidance of named > functions makes it look obfuscated or prodigious. Once it is properly > dissected it doesn't look that amazing anymore. > > Start with: > > (n for n in count(2) if is_prime(n, primes)) > > The is_prime function

RE: Generators/iterators, Pythonicity, and primes

2009-04-05 Thread Nick Stinemates
I thought it was beautiful. Reminded me of lisp and I haven't seen that done in Python before. -Original Message- From: python-list-bounces+nick=stinemates@python.org [mailto:python-list-bounces+nick=stinemates@python.org] On Behalf Of Kay Schluehr Sent: Sunday, April 05, 2009 8:37

Re: statvfs clearance

2009-04-05 Thread Scott David Daniels
Dave Angel wrote: The term we used to use for these is "magic numbers." Using magic-numbers directly in your code is a good way to ensure future time debugging. And perhaps, in these job-scarce days, future employment. I am reminded of a saying we had in the OS group at TymShare: "A wizard i

Re: Python3: to add, remove and change

2009-04-05 Thread Joe P. Cool
On 2 Apr., 09:39, bearophileh...@lycos.com wrote: > To change: + is a commutative operation, No, it _is_ not. It is rather _used_ frequently as a symbol for adding numbers, which happens to be a commutative operation. For me '+' means composing instances of a kind. If we are to narrow minded about

Re: Generators/iterators, Pythonicity, and primes

2009-04-05 Thread Kay Schluehr
On 5 Apr., 17:14, John Posner wrote: > Kay Schluehr said: > > > g = (lambda primes = []: > > (n for n in count(2) \ > > if > > (lambda n, primes: (n in primes if primes and > n<=primes[-1] \ > > else > > (primes.append(n) or True \ > >

Re: Empty string when reading a file

2009-04-05 Thread MRAB
nxri...@googlemail.com wrote: Hi, I'm reading in a file of 250 bytes. At the 55th byte, read() will return an empty string although this isn't the end of the file. This is what I have: for i in range(os.path.getsize("inputFile")): bitsInFile = inputFile.read(1) inputFile.seek(i) byt

Re: Generators/iterators, Pythonicity, and primes

2009-04-05 Thread John Posner
Kay Schluehr said: > g = (lambda primes = []: > (n for n in count(2) \ > if > (lambda n, primes: (n in primes if primes and n<=primes[-1] \ > else > (primes.append(n) or True \ > if all(n%p for p in primes if p <= sqrt(n)) \ >

Re: mmap resizing macosx unix

2009-04-05 Thread David Pratt
Hi Phillip. I appreciate your reply. I think perhaps I will need to create a new mmap as a work around and write to locations of the second mmap based on my regex searches in the first. I should have said I am using 2.5.4 as well to be clear. I am wondering if I should recommend change to d

Empty string when reading a file

2009-04-05 Thread nxri...@googlemail.com
Hi, I'm reading in a file of 250 bytes. At the 55th byte, read() will return an empty string although this isn't the end of the file. This is what I have: for i in range(os.path.getsize("inputFile")): bitsInFile = inputFile.read(1) inputFile.seek(i) byteFromFile = ord(bitsInFile) Rea

Re: mmap resizing macosx unix

2009-04-05 Thread Philip Semanchuk
On Apr 5, 2009, at 10:28 AM, David Pratt wrote: Hi. I have been experimenting with mmap recently. I determined how to read and write properly from it and so search and replace on large files. The problem I am having is with replaces that are larger than the mmap. In this instance I need to

mmap resizing macosx unix

2009-04-05 Thread David Pratt
Hi. I have been experimenting with mmap recently. I determined how to read and write properly from it and so search and replace on large files. The problem I am having is with replaces that are larger than the mmap. In this instance I need to * rewind * resize the mmap to accomodate the tex

Re: replacement for new.instancemethod in Python3?

2009-04-05 Thread Michele Simionato
On Apr 5, 3:58 pm, s...@pobox.com wrote: >     Michele> There is no need for new.instancemethod for new style classes: > >     >>> class C: pass >     ... >     >>> c=C() >     >>> def f(self): pass >     ... >     >>> c.f = f.__get__(c, C) >     >>> c.f >     > > > Like a chimpanzee I can mimic yo

Re: replacement for new.instancemethod in Python3?

2009-04-05 Thread skip
Michele> There is no need for new.instancemethod for new style classes: >>> class C: pass ... >>> c=C() >>> def f(self): pass ... >>> c.f = f.__get__(c, C) >>> c.f > Like a chimpanzee I can mimic your use of __get__ (that is, use the pattern you've defined wit

Re: Killing threads

2009-04-05 Thread Aahz
In article <53ebfff9-448f-438f-aa93-a2187bf13...@f1g2000prb.googlegroups.com>, imageguy wrote: >On Apr 4, 10:43=A0pm, ericwoodwo...@gmail.com wrote: >> >> The issue that I'm having is...I don't know how to kill this app in >> window. > >I am not an expert either, however, I think the standard p

Re: Python Goes Mercurial

2009-04-05 Thread skip
>> If Martin - which is well above the average programmer - says that he >> would need help with Git, I take this as meaning that most people >> would get lost with Git. Lawrence> I don't feel lost with Git. Does that make me an above-average Lawrence> programmer? No, perhaps

Re: Spring-like IoC in python?

2009-04-05 Thread David Stanek
On Sun, Apr 5, 2009 at 9:24 AM, andrew cooke wrote: > David Stanek wrote: > [...] >> The documentation is a little lacking, but that will be changing in >> the next few days. Examples of using snake-guice with CherryPy, Django >> and TurboGears are just a few days off as well. The API tests[3] sho

Re: Spring-like IoC in python?

2009-04-05 Thread andrew cooke
David Stanek wrote: [...] > The documentation is a little lacking, but that will be changing in > the next few days. Examples of using snake-guice with CherryPy, Django > and TurboGears are just a few days off as well. The API tests[3] show > simple clear examples. [...] > 3. > http://code.google.c

Re: Creating a session in windows to auth to remote machines

2009-04-05 Thread ericwoodworth
On Apr 5, 2:11 am, Tim Golden wrote: > ericwoodwo...@gmail.com wrote: > > Hi, > >      I'm trying to auth to remote machines so I can plunder WMI to get > > logs and settings and the like.  My script works for most of my > > machines because they're all in the same domain and I run the script > >

Re: Killing threads

2009-04-05 Thread imageguy
On Apr 4, 10:43 pm, ericwoodwo...@gmail.com wrote: > Hi, >      I'm new to python and even newer to threading and it seems as > though I'm missing something fundamental about threads.  Basically I > have a program that looks like this: > > class ThreadOne(threading.Thread): >      while 1: >      

Re: Need advise about an application

2009-04-05 Thread 一首诗
Do you have to show these data on GUI? If so, why not use the event pattern? As far as I know, it's the standard way wxPython works. BTW : If it's not complicated, I think maybe some wysiwyg solution is better. I use python for almost every thing, except these related to GUI. On Apr 5, 8:31 pm,

Re: Spring-like IoC in python?

2009-04-05 Thread David Stanek
On Sun, Apr 5, 2009 at 5:51 AM, Giovanni Giorgi wrote: > Hi all, I have just read the Thread "Thoughts on language-level > configuration support?" started by jfager. > I have worked in the past days with Java Spring. > I found very valuable the ideas behind Inversion of Control (IoC). > I think it

Need advise about an application

2009-04-05 Thread azrael
I am currently working on an application and I need a advise. I am supposed to read data from a device connected to a serial port. I am reading data using pySerial. The devise is sending signals with a time between two signals of one second. The application is supposed to collect the data and pu

Re: Best way to pickle functions

2009-04-05 Thread azrael
As in Python everythong is an object you could use __name__. >>> import cPickle >>> def def1(): ...pass >>> def def2(): ...pass >>> def1.__name__ def1 >>> def2.__name__ def2 in this case you can combine __name__ to get the object name and then combine it with eval to pickle. >>> pickleSt

Re: replacement for new.instancemethod in Python3?

2009-04-05 Thread Michele Simionato
On Apr 5, 2:02 pm, s...@pobox.com wrote: > Is there a replacement in Python3 for new.instancemethod?  That is, given an > arbitrary instance (not its class) how can I add a new appropriately defined > function as a method to it? There is no need for new.instancemethod for new style classes: >>> c

replacement for new.instancemethod in Python3?

2009-04-05 Thread skip
> Is there a replacement in Python3 for new.instancemethod? I think I can answer my own question: functools.partial: >>> class C: ... pass ... >>> def meth(self, x): ... self.x = x ... >>> c = C() >>> c.meth = meth >>> c.meth(5) Traceback (most recent

replacement for new.instancemethod in Python3?

2009-04-05 Thread skip
Is there a replacement in Python3 for new.instancemethod? That is, given an arbitrary instance (not its class) how can I add a new appropriately defined function as a method to it? Thx, -- Skip Montanaro - s...@pobox.com - http://www.smontanaro.net/ "XML sucks, dictionaries rock" - Dave

Re: python needs leaning stuff from other language

2009-04-05 Thread Tim Wintle
On Sat, 2009-04-04 at 15:36 -0500, Robert Kern wrote: > On 2009-04-04 12:07, Tim Wintle wrote: > >>> (I didn't expect such strong responses btw!) > >> You are proposing the removal of a general, orthogonal feature (and > >> breaking > >> code in consequence!) just because of a new syntax for a sin

How Do I think of import?

2009-04-05 Thread Andy
Hi: Sorry for the detail of this question but I hope its useful to others as well as myself. I'm planning to do a Python wrapper for an existing GUI environment that is not one of the standard environments. So I have complete freedom. Ive done various smaller things in Python with some succes

Re: Generators/iterators, Pythonicity, and primes

2009-04-05 Thread Steven D'Aprano
On Sun, 05 Apr 2009 00:28:17 -0400, Miles wrote: > def prime_gen(): > primes = [] > return (primes.append(n) or n for n in count(2) if all(n%p for p > in primes if p<=sqrt(n))) > > That version is only marginally faster than your original version. The > biggest performance penalty is that

Re: with open('com1', 'r') as f:

2009-04-05 Thread Steven D'Aprano
On Sun, 05 Apr 2009 18:52:58 +1200, Lawrence D'Oliveiro wrote: > In message <01e842d6$0$20654$c3e8...@news.astraweb.com>, Steven D'Aprano > wrote: > >> Firstly, what you describe is an implementation detail of CPython, not >> Python the language. Jython does not close files as soon as they become

Re: Killing threads

2009-04-05 Thread Francesco Bochicchio
On Sat, 04 Apr 2009 22:45:23 -0700, ericwoodworth wrote: > On Apr 5, 12:22 am, a...@pythoncraft.com (Aahz) wrote: >> In article >> <4b52f7d7-81d5-4141-9385-ee8cfb90a...@l1g2000yqk.googlegroups.com>, >> >>   wrote: >> >> >I'm using queues to talk between these threads so I could certainly >> >put

Re: Python Goes Mercurial

2009-04-05 Thread Lawrence D'Oliveiro
In message <5f1038cd-b2c7-420d- bf6e-5872d556f...@u8g2000yqn.googlegroups.com>, Michele Simionato wrote: > The relevance for me is that at work we use Subversion, > but now that Python uses mercurial I am sure there will > be coworkers wanting to switch to Mercurial and I would > like to understan

Spring-like IoC in python?

2009-04-05 Thread Giovanni Giorgi
Hi all, I have just read the Thread "Thoughts on language-level configuration support?" started by jfager. I have worked in the past days with Java Spring. I found very valuable the ideas behind Inversion of Control (IoC). I think it should be a very nice feature to get into python too. In detail,

Re: Python Goes Mercurial

2009-04-05 Thread Jeroen Ruigrok van der Werven
-On [20090405 11:15], Ben Finney (ben+pyt...@benfinney.id.au) wrote: >If you can look at the process that was followed in this decision and >see “push one solution over all others without regard to what the >current situation demands” you're not looking very hard. I did not argue th

Re: Python Goes Mercurial

2009-04-05 Thread Ben Finney
Jeroen Ruigrok van der Werven writes: > -On [20090405 09:35], Lawrence D'Oliveiro (l...@geek-central.gen.new_zealand) > wrote: > >Tell you what, keep the ad-hominem bullshit out of this discussion, > >and I agree to do the same. Deal? > > I guess I touched

Re: Python Goes Mercurial

2009-04-05 Thread David Cournapeau
On Sun, Apr 5, 2009 at 3:48 PM, Jeroen Ruigrok van der Werven wrote: > -On [20090405 06:05], Michele Simionato (michele.simion...@gmail.com) wrote: >>P.S. the thing I do not understand if why we are moving >>away from Subversion. Will all the new features entered >>in 1.5

Re: Python Goes Mercurial

2009-04-05 Thread Jeroen Ruigrok van der Werven
-On [20090405 09:35], Lawrence D'Oliveiro (l...@geek-central.gen.new_zealand) wrote: >Most of the people using Subversion seem to be corporates with a >centralized, top-down-controlled policy for development. Not just corporations. An open source or other type of organisation might j

Re: Accessing mail box tree of Thunderbird/Seamonkey?

2009-04-05 Thread Cameron Simpson
On 05Apr2009 01:16, Chris Rebert wrote: | On Sun, Apr 5, 2009 at 1:04 AM, robert wrote: | > Is there a API/possibilty for reading&writing (live) in the mail box tree of | > Thunderbird/Seamonkey with Python? | | >From what I can google, they're already in mbox format, so you can use | mailbox.mb

Re: Accessing mail box tree of Thunderbird/Seamonkey?

2009-04-05 Thread Chris Rebert
On Sun, Apr 5, 2009 at 1:04 AM, robert wrote: > Is there a API/possibilty for reading&writing (live) in the mail box tree of > Thunderbird/Seamonkey with Python? >From what I can google, they're already in mbox format, so you can use mailbox.mbox to read/write to them. See http://docs.python.org/

Re: How to free /destroy object created by PyTuple_New

2009-04-05 Thread Hrvoje Niksic
[ You can also ask questions like this on the specialized capi-sig list; see http://mail.python.org/mailman/listinfo/capi-sig ] grbgooglefan writes: > In my case, my C application has multiple threads & they are accessing > a single Python Interpreter which was initialized by 1st main thread.

Accessing mail box tree of Thunderbird/Seamonkey?

2009-04-05 Thread robert
Is there a API/possibilty for reading&writing (live) in the mail box tree of Thunderbird/Seamonkey with Python? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Goes Mercurial

2009-04-05 Thread Michele Simionato
On Apr 5, 8:50 am, Lawrence D'Oliveiro wrote: > Michele wrote: > > the thing I do not understand if why we are moving > > away from Subversion. > > Because it's still centralized. That means different developers cannot pursue > parallel branches on their own, those branches must be represented on

Re: Python Goes Mercurial

2009-04-05 Thread Lawrence D'Oliveiro
In message , Jeroen Ruigrok van der Werven wrote: > There's situations where a centralised system like SVN works and there's > situations where a DVCS works better. Most of the people using Subversion seem to be corporates with a centralized, top-down-controlled policy for development. Conway'

Python2.4 and HTTPS

2009-04-05 Thread Good Z
Dear all, I am using Python 2.4.3 for my project. We need to use HTTPS with python2.4.3 unfortunately it seems httplib is not working fine for me. Below is small code that works well with Python2.6.1 but not with Python2.4.3. Unfortunately its not possible for me to move away from Python 2.4.3.