Re: python performance on Solaris

2009-10-14 Thread John Nagle
inaf wrote: I have been following this group for quite some time and I figured (after searching enough on google --and on this group-- and not finding anything useful) I could pose this question here. Can anyone shed some light on python's performance on Solaris? Note that multithreaded com

Re: subprocess hangs on reading stdout

2009-10-14 Thread Minesh Patel
> > Any ideas? comments on code welcome also. Here's something that I would probably do, there may be better ways. This only works on python2.6 for the terminate() method. import signal import subprocess def timeout_handler(signum, frame): print "About to kill process" p.terminate() fo

subprocess hangs on reading stdout

2009-10-14 Thread Tim Arnold
Hi, I'm querying a list of network servers for processes belonging to a specific user. The problem is that when I try to read the stdout from the subprocess it sometimes hangs. Not always though. I thought maybe I needed to set unbufferered to true, so at the beginning of the code I set os.envi

Re: unicode-to-ascii: replace with space, not "?"

2009-10-14 Thread Gabriel Genellina
En Wed, 14 Oct 2009 23:08:53 -0300, Allen Fowler escribió: I've been using "data.encode('ascii','replace')" to force an ASCII string out of Unicode data, with "?" in the place of non-ASCII letters. However, now I want to use a blank space (or maybe a dash) instead of a question mark. U

Re: unicode-to-ascii: replace with space, not "?"

2009-10-14 Thread Mark Tolonen
"Allen Fowler" wrote in message news:59796.73163...@web45608.mail.sp1.yahoo.com... Hello, I've been using "data.encode('ascii','replace')" to force an ASCII string out of Unicode data, with "?" in the place of non-ASCII letters. However, now I want to use a blank space (or maybe a dash) in

Re: id( ) function question

2009-10-14 Thread Erik Max Francis
Tim Chase wrote: CPython has the option to cache frequently used items, and does so for a small range of ints. It's not guaranteed behavior (or a guaranteed range) so you shouldn't rely on it, but it's an efficiency thing. In my current version, it looks like it's ints from -5 to 256. YMMV

Re: Python XMLRPC question

2009-10-14 Thread Gabriel Genellina
En Wed, 14 Oct 2009 22:08:09 -0300, prasanna escribió: Out of curiosity--one more thing I haven't yet figured out, is there a xmlrpc command I can send that stops or restarts the server? If you're using Python 2.6, the easiest way is to register its shutdown() method. Note that it *must*

Re: What command should be use when the testing of arguments is failed?

2009-10-14 Thread Roger Binns
Peng Yu wrote: > I actually wanted to ask what return code should be returned in this > case when the arguments are not right. Thank you1 The BSD world attempted to standardize the codes so you may as well use their definitions. You can see them in /usr/include/sysexits.h on your nearest Linux/Un

Re: id( ) function question

2009-10-14 Thread Luis Alberto Zarrabeitia Gomez
> It's believable if id({}) does the following: > > 1. Construct an empty dict > 2. Take the id of the dict > 3. Reduce the reference-count on the now-unneeded dict. > > It's not too hard for the second empty dict to get allocated in the same > memory that the first one (now dereferenced and de

Re: id( ) function question

2009-10-14 Thread Mel
Chris Rebert wrote: > Although I have no idea how it is that `id({}) == id({})` as a prior > posted showed; FWIW, I can't manage to reproduce that outcome. Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more informa

unicode-to-ascii: replace with space, not "?"

2009-10-14 Thread Allen Fowler
Hello, I've been using "data.encode('ascii','replace')" to force an ASCII string out of Unicode data, with "?" in the place of non-ASCII letters. However, now I want to use a blank space (or maybe a dash) instead of a question mark. How do I do this? Thank you, :) -- http://mail.py

Re: The rap against "while True:" loops

2009-10-14 Thread Mensanator
On Oct 14, 12:07�pm, Ethan Furman wrote: > Mensanator wrote: > > On Oct 14, 2:19 am, Dennis Lee Bieber wrote: > > >>On Tue, 13 Oct 2009 15:02:09 -0700 (PDT), Mensanator > >> declaimed the following in > >>gmane.comp.python.general: > > >>>You're not getting away that easy. > > >>>What's YOUR opin

Re: What command should be use when the testing of arguments is failed?

2009-10-14 Thread Cameron Simpson
On 14Oct2009 19:58, Peng Yu wrote: | On Wed, Oct 14, 2009 at 7:57 PM, Joe Riopel wrote: | > On Wed, Oct 14, 2009 at 8:53 PM, Peng Yu wrote: | >> I have the following python code snippet. I'm wondering what command I | >> should use to terminate the program if the arguments are not right. | > | >

Re: What command should be use when the testing of arguments is failed?

2009-10-14 Thread Xavier Ho
On Thu, Oct 15, 2009 at 10:58 AM, Peng Yu wrote: > I actually wanted to ask what return code should be returned in this > case when the arguments are not right. Thank you1 > > I think that depends on the design of the program. Is there a return value that would make sense to be returned by defaul

Re: Python XMLRPC question

2009-10-14 Thread prasanna
On Oct 13, 1:22 pm, "Gabriel Genellina" wrote: > En Tue, 13 Oct 2009 16:55:09 -0300, Falcolas escribió: > > > > > > > On Oct 13, 12:47 pm,prasanna wrote: > >> In using Python's XMLRPC, there is a statement that gets printed on > >> stdout of the form: > >>                  localhost - - [12/Oct/2

Re: The rap against "while True:" loops

2009-10-14 Thread Mensanator
On Oct 14, 6:08�pm, Steven D'Aprano wrote: > On Wed, 14 Oct 2009 09:34:28 -0700, Mensanator wrote: > > On Oct 14, 2:19 am, Dennis Lee Bieber wrote: > >> On Tue, 13 Oct 2009 15:02:09 -0700 (PDT), Mensanator > >> declaimed the following in > >> gmane.comp.python.general: > > >> > You're not gettin

Re: What command should be use when the testing of arguments is failed?

2009-10-14 Thread Peng Yu
On Wed, Oct 14, 2009 at 7:57 PM, Joe Riopel wrote: > On Wed, Oct 14, 2009 at 8:53 PM, Peng Yu wrote: >> I have the following python code snippet. I'm wondering what command I >> should use to terminate the program if the arguments are not right. > > I usually use sys.exit. I actually wanted to a

Re: What command should be use when the testing of arguments is failed?

2009-10-14 Thread Joe Riopel
On Wed, Oct 14, 2009 at 8:53 PM, Peng Yu wrote: > I have the following python code snippet. I'm wondering what command I > should use to terminate the program if the arguments are not right. I usually use sys.exit. -- http://mail.python.org/mailman/listinfo/python-list

What command should be use when the testing of arguments is failed?

2009-10-14 Thread Peng Yu
I have the following python code snippet. I'm wondering what command I should use to terminate the program if the arguments are not right. #!/usr/bin/env python import sys import os if len(sys.argv) <= 1: print "usage:", os.path.basename(sys.argv[0]), '' return ## what command should be used

Re: The rap against "while True:" loops

2009-10-14 Thread Paul Rubin
Steven D'Aprano writes: > Why should Python make that guarantee about this hypothetical "loop > forever" construct? It doesn't make much sense for Python as normally practiced. Termination proofs (aka proofs of progress) are used in formal verification systems to make sure that the verification

Re: id( ) function question

2009-10-14 Thread Stephen Hansen
On Wed, Oct 14, 2009 at 4:19 PM, Chris Rebert wrote: > Although I have no idea how it is that `id({}) == id({})` as a prior > posted showed; FWIW, I can't manage to reproduce that outcome. > With Python 2.5.1 on MacOS X, I can; it looks like there's an optimization in there where its 'saving' di

Re: id( ) function question

2009-10-14 Thread Christian Heimes
Chris Rebert wrote: > The built-ins aren't mutable, and the singletons are each immutable > and/or unique; so in no case do objects that are both different and > mutable have the same ID. Correct, the fact allows you to write code like "type(egg) is str" to check if an object *is* an instance of s

Re: id( ) function question

2009-10-14 Thread Stephen Hansen
On Wed, Oct 14, 2009 at 1:37 PM, Laszlo Nagy wrote: > > Andre Engels schrieb: >> >>> >>> None, True, False, NotImplemented are guaranteed to be singletons, all >> builtin types and exceptions can be considered as singletons, too. >> >> > I thought that different mutable objects always have differ

Re: id( ) function question

2009-10-14 Thread Chris Rebert
On Wed, Oct 14, 2009 at 1:37 PM, Laszlo Nagy wrote: >> Andre Engels schrieb: >>> What is going on is that a few objects that are often used, in >>> particular the small (how small is small depends on the >>> implementation) integers, are 'preloaded'. When one of these is then >>> referred to, a ne

Re: The rap against "while True:" loops

2009-10-14 Thread Steven D'Aprano
On Wed, 14 Oct 2009 20:17:40 +, Jorgen Grahn wrote: >> But we have exceptions. And I know somebody, in other languages, thinks >> it's a Best Practice to avoid using exceptions for flow control. > > A lot of C++ programmers think so, and Stroustrup himself says > "exceptions are for exception

Re: The rap against "while True:" loops

2009-10-14 Thread Steven D'Aprano
On Wed, 14 Oct 2009 18:30:06 +0100, Tim Rowe wrote: > 2009/10/14 Dennis Lee Bieber : > >>        If anything -- I'd suggest a proposal to add a plain    loop >>           as a >> keyword in Python, whose effect is equivalent to a "while True", but a >> break    must be used to exit said loop (wel

Re: The rap against "while True:" loops

2009-10-14 Thread Steven D'Aprano
On Wed, 14 Oct 2009 09:34:28 -0700, Mensanator wrote: > On Oct 14, 2:19�am, Dennis Lee Bieber wrote: >> On Tue, 13 Oct 2009 15:02:09 -0700 (PDT), Mensanator >> declaimed the following in >> gmane.comp.python.general: >> >> > You're not getting away that easy. >> >> > What's YOUR opinion of "whil

Re: id( ) function question

2009-10-14 Thread Laszlo Nagy
Andre Engels schrieb: What is going on is that a few objects that are often used, in particular the small (how small is small depends on the implementation) integers, are 'preloaded'. When one of these is then referred to, a new object is not created, but the pre-defined object is used. 10 i

Re: The rap against "while True:" loops

2009-10-14 Thread Rhodri James
On Wed, 14 Oct 2009 02:26:17 +0100, Mensanator wrote: On Oct 13, 5:38�pm, "Rhodri James" wrote: On Tue, 13 Oct 2009 22:59:04 +0100, Mensanator wrote: > And I'm not saying John nor the OP should stop > using what works for them. But there are certainly > valid reasons for "don't use while T

Re: efficient running median

2009-10-14 Thread Ethan Furman
Janto Dreijer wrote: On Oct 13, 7:37 pm, Ethan Furman wrote: Janto Dreijer wrote: I'm looking for code that will calculate the running median of a sequence, efficiently. (I'm trying to subtract the running median from a signal to correct for gradual drift). My naive attempt (taking the me

Re: The rap against "while True:" loops

2009-10-14 Thread Tim Rowe
2009/10/12 RDrewD : > I was a bit surprised that nobody in this discussion so far bantered > around the phrase "loop invariant", but then I looked in > http://en.wikipedia.org/wiki/Loop_invariant and found it was draped in > so much formalism that it's sure to put off all but the most dedicated > o

Re: The rap against "while True:" loops

2009-10-14 Thread Jack Norton
kj wrote: I'm coaching a group of biologists on basic Python scripting. One of my charges mentioned that he had come across the advice never to use loops beginning with "while True". Of course, that's one way to start an infinite loop, but this seems hardly a sufficient reason to avoid the con

Re: Poll on Eval in Python

2009-10-14 Thread TerryP
On Oct 14, 9:48 pm, Kazimir Majorinc wrote: > Do you think > it would be better if I asked that? That result would > be significantly different? > Not really. The eval, exec, and compile builtins are more or less related and serve similar purposes, but don't seem to be highly used in Python. Ther

Re: Help with regex and optional substring in search string

2009-10-14 Thread Timur Tabi
On Wed, Oct 14, 2009 at 10:30 AM, Zero Piraeus wrote: > '(?:etc)' instead of '(etc)' are non-grouping parentheses (since you > apparently don't care about that bit). Ah yes, thanks. > '[^\]]' instead of '[\w\s]' matches "everything except a closing bracket". I originally had just '[^\]', and I

Re: efficient running median

2009-10-14 Thread Janto Dreijer
On Oct 14, 4:53 pm, Peter Otten <__pete...@web.de> wrote: > Some numbers: > > 10.197 seconds for running_median_scipy_medfilt > 25.043 seconds for running_median_python > 13.040 seconds for running_median_python_msort > 14.280 seconds for running_median_python_scipy_median > 4.024 seconds for runni

Re: Poll on Eval in Python

2009-10-14 Thread Kazimir Majorinc
On 14.10.2009 17:55, TerryP wrote: And what about exec? (note: exec in python is more in spirit of eval then C-style exec functions) I thought about that, but decided not to ask about it in poll, because I wanted to compare opinions on eval specifically, not on all similar features. Do you t

Re: windows side-by-side configuration woes on windows HPC

2009-10-14 Thread Nick Touran
I've made enough progress to get my setup working! I attempted to apply the patch and recompile the packages that complained but got in too deep while compiling matplotlib on windows (I don't have admin privileges and can't install the prereqs) so I dug deeper. I found this: http://blog.kalmbachne

Re: python performance on Solaris

2009-10-14 Thread inaf
On Oct 14, 7:15 am, Antoine Pitrou wrote: > inaf gmail.com> writes: > > > > > Good point. I failed to compare the CPU power on these machines.. 32 > > bit linux box I have is 2666 Mhz vs the Solaris zone is 1415 Mhz.. I > > guess that explains :) Thank you for the tip.. > > You have to compare no

Looking for programmer experienced in Python/Django/Git/Unix

2009-10-14 Thread TMChris
Hi everyone, We're looking for an expert in Python, Django, Git and Unix. We have multiple projects needed paid on hourly basis. Do you have a strong confidence in all of these? If so, please provide a resume and a little bit about yourself in regards to these. Thank you, Chris -- http://mail.

Re: The rap against "while True:" loops

2009-10-14 Thread Paul Rubin
Raymond Hettinger writes: > IIRC, the C++ admonition against using exceptions for flow control > was rooted in performance concerns specific to that language and > its compilers. It was not stylistic advice and did not deny that > flow control exceptions could provide elegant solutions to some >

Re: how to handle broken pipes

2009-10-14 Thread Jorgen Grahn
On Wed, 2009-10-14, Igor Mikushkin wrote: > Hello all! > > Could anyone please say me what is the right way to handle broken > pipes in Python? > I can wrap all my print statements with try/except blocks but it looks > like overkill for me. > > I'm using my Python script this way: my_script | less

Re: The rap against "while True:" loops

2009-10-14 Thread Raymond Hettinger
> And I know somebody, in other languages, thinks > it's a Best Practice to avoid using exceptions for flow control. Ah, now we have two code prions in just one thread. I hope no newbie or supervisor reads this thread and latches on to those two counter-productive ideas. ISTM, both ideas are dang

Re: The rap against "while True:" loops

2009-10-14 Thread Jorgen Grahn
On Wed, 2009-10-14, Marco Mariani wrote: > Dennis Lee Bieber wrote: > >> One thing to note is that "break" ONLY exits the innermost loop -- >> Ada adds the confusion that one could define a label on the loops, and >> have the innermost use >> exit outer_label [when condition] >> >> >>

how to handle broken pipes

2009-10-14 Thread Igor Mikushkin
Hello all! Could anyone please say me what is the right way to handle broken pipes in Python? I can wrap all my print statements with try/except blocks but it looks like overkill for me. I'm using my Python script this way: my_script | less The script produces a lot of data. So usually when I fin

where's self.assertMatch (for Django)?

2009-10-14 Thread Phlip
Hypo Nt: Been a while, now I'm back, and the first helpless question is... When I google (including codesearch) for assertMatch, I get a mishmash of opinions. Am I missing the One True assertMatch(), or isn't there one and I gotta write it? or copy and use one of the pretenders? Distractingl

Re: The rap against "while True:" loops

2009-10-14 Thread Jorgen Grahn
On Mon, 2009-10-12, Grant Edwards wrote: > On 2009-10-12, Gabriel Genellina wrote: > >>> my_prissy_little_indicator_variable = true >>> while (my_prissy_little_indicator_variable){ >>> >>> } >>> isn't satisfying because it doesn't guard the with any >>> assurance that the loop invariant will

Re: The rap against "while True:" loops

2009-10-14 Thread Jorgen Grahn
On Mon, 2009-10-12, RDrewD wrote: ... > I was a bit surprised that nobody in this discussion so far bantered > around the phrase "loop invariant", but then I looked in > http://en.wikipedia.org/wiki/Loop_invariant and found it was draped in > so much formalism that it's sure to put off all but the

Re: python performance on Solaris

2009-10-14 Thread James Matthews
I use python in almost the same environment. I use it on Joyent and on the Rackspace cloud. Joyent is faster for a few reasons (cpu bursting and faster disks) but these aren't real benchmarks until they are on the same machines. James On Wed, Oct 14, 2009 at 9:59 AM, Jorgen Grahn > wrote: > On

Re: Why is python so sad?

2009-10-14 Thread James Matthews
This posting just made my day! On Wed, Oct 14, 2009 at 2:59 PM, Dotan Cohen wrote: > > ;-) > > > > Be careful, that looks dangerously close to PHP: > function(); > > > -- > Dotan Cohen > > http://what-is-what.com > http://gibberish.co.il > -- > http://mail.python.org/mailman/listinfo/python-list

Re: Why is python so sad?

2009-10-14 Thread Dotan Cohen
> ;-) > Be careful, that looks dangerously close to PHP: function(); -- Dotan Cohen http://what-is-what.com http://gibberish.co.il -- http://mail.python.org/mailman/listinfo/python-list

win32com.client import problem : solved

2009-10-14 Thread Threader Slash
-- Forwarded message -- From: Dave Angel To: Threader Slash Date: Wed, 14 Oct 2009 07:04:21 -0400 Subject: Re: win32com.client import problem Threader Slash wrote: > Hi Everybody, > > I have 2 imports: > > import pythoncom > from win32com.client import Dispatch > > if I run it on

Re: The rap against "while True:" loops

2009-10-14 Thread Ethan Furman
Mensanator wrote: On Oct 14, 2:19�am, Dennis Lee Bieber wrote: On Tue, 13 Oct 2009 15:02:09 -0700 (PDT), Mensanator declaimed the following in gmane.comp.python.general: You're not getting away that easy. What's YOUR opinion of "whilr True"? � � � � Uhm... that it isn't valid in any l

Re: Parsing email attachments: get_payload() produces unsaveable data

2009-10-14 Thread dpapathanasiou
On Oct 4, 10:27 am, dpapathanasiou wrote: > I'm using python to access an email account via POP, then for each > incoming message, save any attachments. > > This is the function which scans the message for attachments: > > def save_attachments (local_folder, msg_text): >     """Scan the email mess

Re: python along or bash combined with python (for manipulating files)

2009-10-14 Thread Falcolas
On Oct 13, 10:18 pm, TerryP wrote: > On Oct 14, 2:13 am, Peng Yu wrote: > > > Bash is easy to use on manipulating files and directories (like change > > name or create links, etc) and on calling external programs. For > > simple functions, bash along is enough. However, bash does not support > >

Re: python along or bash combined with python (for manipulating files)

2009-10-14 Thread edexter
On Oct 14, 3:42 am, Jean-Michel Pichavant wrote: > Peng Yu wrote: > > Bash is easy to use > > +JOTW > > :) > > JM why choose.. http://shython.sourceforge.net/ I don't think this is the most recent I would also try the package index -- http://mail.python.org/mailman/listinfo/python-list

Re: The rap against "while True:" loops

2009-10-14 Thread Tim Rowe
2009/10/14 Dennis Lee Bieber : >        If anything -- I'd suggest a proposal to add a plain    loop    as a > keyword in Python, whose effect is equivalent to a "while True", but a > break    must be used to exit said loop (well, we'll ignore raising an > exception ) And with enough static analy

Re: RotatingFileHandler issue

2009-10-14 Thread Max Lynch
I never got a response back from this, but I'm noticing even more odd behavior, see inline: On Wed, Sep 30, 2009 at 4:38 PM, Max Lynch wrote: > Hi. > I have a RotatingFileHandler for my logging system. I have it set to > rotate once the file becomes 5MB in size. Here is the conf line I have in

Re: Pyusb

2009-10-14 Thread Chris Withers
Ronn Ross wrote: Does anyone know where I can download a copy of PyUSB 1.0? I can only find 0.x versions on sourceforge. I'm following a tutorial that requires 1.0. Thanks Googling "pyusb" gives me loads of hits and the newer versions appear to be on about the 3rd link down... Chris -- Sim

Re: Why is python so sad?

2009-10-14 Thread Chris Withers
Zac Burns wrote: There are 10741 occurences of ): or :( in our source code and only 2 occurrences of :) or (:. Not what you would expect from a language named after a comedian. def ...(...): ... class ...(...): ... etc ;-) Chris -- Simplistix - Content Management, Batch Processing & Py

Re: XML-RPC(using SimpleXMLRPCServer) slow on the first call

2009-10-14 Thread Mahi Haile
-- Forwarded message -- > From: "Gabriel Genellina" > To: python-list@python.org > Date: Wed, 14 Oct 2009 00:52:13 -0300 > Subject: Re: XML-RPC(using SimpleXMLRPCServer) slow on the first call > En Mon, 12 Oct 2009 18:58:45 -0300, Mahi Haile > escribió: > > Hello all,I have an xm

Re: The rap against "while True:" loops

2009-10-14 Thread MRAB
Dennis Lee Bieber wrote: On Tue, 13 Oct 2009 15:02:09 -0700 (PDT), Mensanator declaimed the following in gmane.comp.python.general: You're not getting away that easy. What's YOUR opinion of "whilr True"? Uhm... that it isn't valid in any language having English influence upon it's k

Why is python so sad?

2009-10-14 Thread Zac Burns
There are 10741 occurences of ): or :( in our source code and only 2 occurrences of :) or (:. Not what you would expect from a language named after a comedian. -- Zachary Burns (407)590-4814 Aim - Zac256FL Production Engineer (Digital Overlord) Zindagi Games -- http://mail.python.org/mailman/list

Pyusb

2009-10-14 Thread Ronn Ross
Does anyone know where I can download a copy of PyUSB 1.0? I can only find 0.x versions on sourceforge. I'm following a tutorial that requires 1.0. Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: The rap against "while True:" loops

2009-10-14 Thread Mensanator
On Oct 14, 2:19�am, Dennis Lee Bieber wrote: > On Tue, 13 Oct 2009 15:02:09 -0700 (PDT), Mensanator > declaimed the following in > gmane.comp.python.general: > > > You're not getting away that easy. > > > What's YOUR opinion of "whilr True"? > > � � � � Uhm... that it isn't valid in any language

Re: The rap against "while True:" loops

2009-10-14 Thread TerryP
When all is said and done, is not all looping *basically* equivalent to something like this? begin_loop: unless TEST goto end_loop ;; loop body here if TEST goto begin_loop end_loop: Which could likely be used to implement something like: while TEST: # loop body

Re: Are there any modules for IRC, that work with Python 3.1?

2009-10-14 Thread Jorgen Grahn
On Sat, 2009-10-10, TerryP wrote: > Does anyone know of any modules for dealing with the IRC protocol, > that will work with Python 3.1? It doens't have to be super great, > just less time consuming then playing with sockets directly (and obv. > stable). The only module in my systems package manage

Re: ANN: Testoob 1.15 released

2009-10-14 Thread Jorgen Grahn
On Thu, 2009-10-08, oripel wrote: > Testoob is the advanced Python test runner and testing framework that > spices up any existing unittest test suite. > > Home: http://code.google.com/p/testoob But this sentence on the home page The documentation is sadly outdated, but may be a starting

Re: The rap against "while True:" loops

2009-10-14 Thread Tim Rowe
2009/10/14 Marco Mariani : > Dennis Lee Bieber wrote: > >>        One thing to note is that "break" ONLY exits the innermost loop -- >> Ada adds the confusion that one could define a label on the loops, and >> have the innermost use >>        exit outer_label [when condition] >> >> >>        THAT I

Re: Help with regex and optional substring in search string

2009-10-14 Thread Zero Piraeus
: 2009/10/14 Timur Tabi : > Never mind ... I figured it out.  The middle block should have been [\w > \s/]* This is fragile - you'll have to keep adding extra characters to match if the input turns out to contain them. -[]z. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with regex and optional substring in search string

2009-10-14 Thread Zero Piraeus
: 2009/10/14 Timur Tabi : > I'm having trouble creating a regex pattern that matches a string that > has an optional substring in it.  What I'm looking for is a pattern > that matches both of these strings: > > Subject: [PATCH 08/18] This is the patch name > Subject: This is the patch name > > Wha

Re: Python and USB

2009-10-14 Thread Gabriel Genellina
En Wed, 14 Oct 2009 09:55:15 -0300, Ronn Ross escribió: I'm new to Python and would like to capture mouse movements. I envision writing a script that will just write out the mouse movements in the term. Is this possible? Can someone point me in the right direction? Capture mouse movement

Re: Help with regex and optional substring in search string

2009-10-14 Thread Timur Tabi
On Oct 14, 9:51 am, Timur Tabi wrote: > I'm having trouble creating a regex pattern that matches a string that > has an optional substring in it.  What I'm looking for is a pattern > that matches both of these strings: > > Subject: [PATCH 08/18] This is the patch name > Subject: This is the patch

Re: Clear interface for mail class

2009-10-14 Thread Francesco Bochicchio
On Oct 14, 2:39 pm, Benedict Verheyen wrote: > Hi, > > I'm trying to come up with a decent interface for my email class. > Basically, i have one email function but it has many (too many?) variables: > >     send_mail(self, send_from, send_to, send_cc, subject, text, > separate_emails = False, fil

Re: efficient running median

2009-10-14 Thread Peter Otten
Janto Dreijer wrote: > On Oct 13, 6:12 pm, Peter Otten <__pete...@web.de> wrote: >> Janto Dreijer wrote: >> > I'm looking for code that will calculate the running median of a >> > sequence, efficiently. (I'm trying to subtract the running median from >> > a signal to correct for gradual drift). >>

Help with regex and optional substring in search string

2009-10-14 Thread Timur Tabi
I'm having trouble creating a regex pattern that matches a string that has an optional substring in it. What I'm looking for is a pattern that matches both of these strings: Subject: [PATCH 08/18] This is the patch name Subject: This is the patch name What I want is to extract the "This is the p

Pyusb

2009-10-14 Thread Ronn Ross
I'm running Python 2.6 on windows. I'm install Pyusb and I'm having trouble including the library in my script. Can someone point me in the right direction to get this working or know of a good tutorial to help me out. Best regards -- http://mail.python.org/mailman/listinfo/python-list

Re: What is Islam?-1

2009-10-14 Thread Aahz
In article , J wrote: >On Tue, Oct 13, 2009 at 20:05, Aahz wrote: Mensanator: > >There's no point in trying to reason with a Muslim. That's not funny, and if you were being serious, that was incredibly rude. >>> >>>Not as much as posting in comp.lang.python. >> >> What

Re: MUD Game Programmming - Python Modules in C++

2009-10-14 Thread Gabriel Genellina
En Wed, 14 Oct 2009 05:19:06 -0300, Ulrich Eckhardt escribió: Gabriel Genellina wrote: #ifdef _DEBUG #undef _DEBUG #include #define _DEBUG #else #include #endif [...to keep Python from linking against non-existant debug libraries.] No, don't do that. Just compile your application in relea

Re: Clear interface for mail class

2009-10-14 Thread Joe Riopel
On Wed, Oct 14, 2009 at 8:39 AM, Benedict Verheyen wrote: > This kind of problems seems to happen sometimes: i need to fix something > quickly, > build a script for it, and then i realise that the code i've written is not > the best in > terms of reusability and has some "not so great" functions

Re: Unexpected exit of Python script

2009-10-14 Thread Diez B. Roggisch
vicky wrote: > On Oct 14, 5:52 pm, "Diez B. Roggisch" wrote: >> vicky wrote: >> > Hello All, >> >> > I am a new Python user and don't know much about it. >> >> > I just want to know that, due to any reason if a script exits, is >> > their some way to release all the resources acquired by the scri

Re: python performance on Solaris

2009-10-14 Thread Jorgen Grahn
On Wed, 2009-10-14, Antoine Pitrou wrote: > inaf gmail.com> writes: >> >> Good point. I failed to compare the CPU power on these machines.. 32 >> bit linux box I have is 2666 Mhz vs the Solaris zone is 1415 Mhz.. I >> guess that explains :) Thank you for the tip.. > > You have to compare not only

Re: Unexpected exit of Python script

2009-10-14 Thread vicky
On Oct 14, 5:52 pm, "Diez B. Roggisch" wrote: > vicky wrote: > > Hello All, > > > I am a new Python user and don't know much about it. > > > I just want to know that, due to any reason if a script exits, is > > their some way to release all the resources acquired by the script > > during execution

Re: Clear interface for mail class

2009-10-14 Thread Benedict Verheyen
Marco Mariani wrote: > Benedict Verheyen wrote: > >> Any ideas are welcome. > > easy_install turbomail > > :) > Looks good but i'm still interested in how one would make a clean class interface for this type of problem. Having said that, turbomail looks quite good :) Thanks -- http://mail.

Re: cpython compilation parameter

2009-10-14 Thread Jorgen Grahn
On Thu, 2009-10-08, Diez B. Roggisch wrote: > cEd wrote: > >> Hello, >> >> I'm wondering how to compile python to get good performance. >> Because when I compare this ugly code which find prime number: ... >> between : >> - the python distributed with my ubuntu >> #time python prime_number.py

Re: Unexpected exit of Python script

2009-10-14 Thread Mick Krippendorf
vicky schrieb: > Actually In my system I want to execute some piece of code at the time > of script exit (expected or unexpected) to ensure the release of all > the resources. I don't know how to do that :( You maybe want to use a context manager. Look for 'with statement' and 'contextlib' in your

Re: Unexpected exit of Python script

2009-10-14 Thread Donn
On Wednesday 14 October 2009 14:23:11 vicky wrote: > I just want to know that, due to any reason if a script exits, is > their some way to release all the resources acquired by the script > during execution ? Python cleans-up after itself so I would not worry about that until you are an expert and

Python and USB

2009-10-14 Thread Ronn Ross
I'm new to Python and would like to capture mouse movements. I envision writing a script that will just write out the mouse movements in the term. Is this possible? Can someone point me in the right direction? -- http://mail.python.org/mailman/listinfo/python-list

Re: Multi-arrays python

2009-10-14 Thread Piet van Oostrum
> bbarb...@inescporto.pt (b) wrote: >b> Hi again! >b> After testing the whole day, I have got my goals from the last email, but >b> as always, another issues came up! and now that Ive been able to save a >b> list of list (or multi-arrays) as below : >b> ['100.mp3\n' '10008.mp3\n' '10005.mp3

Re: Unexpected exit of Python script

2009-10-14 Thread Diez B. Roggisch
vicky wrote: > Hello All, > > I am a new Python user and don't know much about it. > > I just want to know that, due to any reason if a script exits, is > their some way to release all the resources acquired by the script > during execution ? > > Actually In my system I want to execute some pie

Re: Clear interface for mail class

2009-10-14 Thread Marco Mariani
Benedict Verheyen wrote: Any ideas are welcome. easy_install turbomail :) -- http://mail.python.org/mailman/listinfo/python-list

Clear interface for mail class

2009-10-14 Thread Benedict Verheyen
Hi, I'm trying to come up with a decent interface for my email class. Basically, i have one email function but it has many (too many?) variables: send_mail(self, send_from, send_to, send_cc, subject, text, separate_emails = False, files=[], inline_files=[], server="localhost", charset="iso-

Unexpected exit of Python script

2009-10-14 Thread vicky
Hello All, I am a new Python user and don't know much about it. I just want to know that, due to any reason if a script exits, is their some way to release all the resources acquired by the script during execution ? Actually In my system I want to execute some piece of code at the time of script

Re: id( ) function question

2009-10-14 Thread Christian Heimes
Andre Engels schrieb: > What is going on is that a few objects that are often used, in > particular the small (how small is small depends on the > implementation) integers, are 'preloaded'. When one of these is then > referred to, a new object is not created, but the pre-defined object > is used. 1

Re: id( ) function question

2009-10-14 Thread Tim Chase
But if I chose as a value another number (a big one, let say 1e10) I get what I will expect also in the case of the chose of the integer 10 showed above: a=1e10 d=1e10 d is a False id(a) 11388984 id(d) 11388920 CPython has the option to cache frequently used items, and does so for a small

Re: id( ) function question

2009-10-14 Thread Andre Engels
What is going on is that a few objects that are often used, in particular the small (how small is small depends on the implementation) integers, are 'preloaded'. When one of these is then referred to, a new object is not created, but the pre-defined object is used. 10 is apparently a preloaded cons

Re: id( ) function question

2009-10-14 Thread Christian Heimes
raffaele ponzini schrieb: > Dear all, > I have a question concerning the output of the id() function. > In particular since is should: > "" > Return the identity of an object. This is guaranteed to be unique among > simultaneously existing objects. (Hint: it's the object's memory address.) > "" >

Re: python performance on Solaris

2009-10-14 Thread Antoine Pitrou
inaf gmail.com> writes: > > Good point. I failed to compare the CPU power on these machines.. 32 > bit linux box I have is 2666 Mhz vs the Solaris zone is 1415 Mhz.. I > guess that explains :) Thank you for the tip.. You have to compare not only CPU frequencies but the CPU models. Recently Sun h

Re: win32com.client import problem

2009-10-14 Thread Dave Angel
Threader Slash wrote: Hi Everybody, I have 2 imports: import pythoncom from win32com.client import Dispatch if I run it on my Python 2.6 Console, it works nicely. However, when I go to Eclipse IDE, open a project, open a main.py file, and try run, it gives the error: import pythoncom ImportEr

Re: the usage of 'yield' keyword

2009-10-14 Thread Dave Angel
Peng Yu wrote: http://docs.python.org/reference/simple_stmts.html#grammar-token-yield_stmt The explanation of yield is not clear to me, as I don't know what a generator is. I see the following example using 'yield'. Could somebody explain how 'yield' works in this example? Thank you! def brange

id( ) function question

2009-10-14 Thread raffaele ponzini
Dear all, I have a question concerning the output of the id() function. In particular since is should: "" Return the identity of an object. This is guaranteed to be unique among simultaneously existing objects. (Hint: it's the object's memory address.) "" i expect that for two differnt objects it

  1   2   >