Re: Problem building Python extension

2009-02-14 Thread martijnsteenwijk
On 13 feb, 12:45, Christian Heimes li...@cheimes.de wrote: martijnsteenw...@gmail.com wrote: Thanks a lot for your reply. I downloaded installed Visual C# 2008 express, but unfortunately this doesn't change anything in running the setup file. Unfortunately, still no pyd file is produced...

Re: Pickling classes (not class instances)

2009-02-14 Thread Nicolas M . Thiéry
Dear python developers, I got no answer to my previous post on this thread Pickling classes (not class instances). This issue is a show stopper for our project. Any suggestion for where to ask? Thanks in advance! Best regards, Nicolas Purpose

Re: Problem building Python extension

2009-02-14 Thread martijnsteenwijk
On 14 feb, 09:04, martijnsteenw...@gmail.com wrote: On 13 feb, 12:45, Christian Heimes li...@cheimes.de wrote: martijnsteenw...@gmail.com wrote: Thanks a lot for your reply. I downloaded installed Visual C# 2008 express, but unfortunately this doesn't change anything in running the

Re: [Python-Dev] RELEASED Python 3.0.1

2009-02-14 Thread Martin v. Löwis
Any chance of getting a Mac installer for this one? Chances are non-zero, yes. Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Pickling classes (not class instances)

2009-02-14 Thread Aaron Brady
On Feb 14, 2:19 am, Nicolas M. Thiéry nicolas.thi...@u-psud.fr wrote:          Dear python developers, I got no answer to my previous post on this thread Pickling classes (not class instances). This issue is a show stopper for our project. Any suggestion for where to ask? snip to

Re: Levenshtein word comparison -performance issue

2009-02-14 Thread Peter Otten
Gabriel Genellina wrote: En Fri, 13 Feb 2009 08:16:00 -0200, S.Selvam Siva s.selvams...@gmail.com escribió: I need some help. I tried to find top n(eg. 5) similar words for a given word, from a dictionary of 50,000 words. I used python-levenshtein module,and sample code is as follow.

Re: codecs.open and buffering modes...

2009-02-14 Thread Sam
Hmmm...no one knows the reason for the discrepancy? Should I post on the developers' list to see if anyone knows? Thanks On Feb 9, 6:19 pm, Sam samsli...@gmail.com wrote: codecs.open defaults to line buffering.  But open defaults to using the system buffer size.  Why the discrepancy?  Is it

Re: best set of modules for web automation without javascript

2009-02-14 Thread coldpizza
You should have a look at twill: http://twill.idyll.org It seems to be no longer maintained, but will probably do most of what you expect. And it is built on top of mechanize. On Feb 13, 4:04 pm, News123 news...@free.fr wrote: Hi, I'd like to do some web automation with python 2.5 -

Re: best set of modules for web automation without javascript

2009-02-14 Thread coldpizza
And btw, Selenium scripts can be exported to Python and run under Selenium Remote Control server. I'd say this is the most flexible and advanced way to do webtesting, since you can have a single script that runs with many browsers (opera, firefox, ie, etc), and on many platforms. And combined

Re: Thank you, Tkinter. (easy to use)

2009-02-14 Thread DLitgo
On Feb 12, 12:39 am, r rt8...@gmail.com wrote: Hello, Tkinter is a great GUI toolkit, for what it lacks in prettiness it more than makes up for in simple and quick GUI building. I think this is the main reason Tkinter continues to be Python's built-in GUI toolkit. It is a great place to

Re: String concatenation performance with +=

2009-02-14 Thread Sammo
On Feb 14, 4:47 pm, Steven D'Aprano st...@pearwood.info wrote: Sammo sammo2828 at gmail.com writes: String concatenation has been optimized since 2.3, so using += should be fairly fast. This is implementation dependent and shouldn't be relied upon. It's also a fairly simple optimization

Re: String concatenation performance with +=

2009-02-14 Thread Sammo
On Feb 14, 5:33 pm, Steven D'Aprano st...@pearwood.info wrote: AFAIK, using list mutation and .join only improves performance if the .join is executed outside of the loop. Naturally. If you needlessly join over and over again, instead of delaying until the end, then you might as well do

Re: Turning a signature-changing decorator into a signature-preserving one

2009-02-14 Thread Gustavo Narea
On Feb 14, 6:38 am, Michele Simionato michele.simion...@gmail.com wrote: On Feb 14, 12:56 am, Gustavo Narea m...@gustavonarea.net wrote: Hello, everybody. I have this signature-changing decorator http://paste.chrisarndt.de/paste/15aac02a90094a41a13a1b9b85a14dd6 which I want to turn

encrypting lines from file with md5 module doesn't work?

2009-02-14 Thread Canned
Hi, I need some help with my script. I hope someone can show me the right direction or at least explain to me what did I wrong? I write a small script that read lines from plain text file and encrypt each lines using md5 module. I have a small word list that contain 2000+ words, 1 word/line.

Reading a file

2009-02-14 Thread zaheer . agadi
Hi How do i read a file in Python and search a particular pattern like I have a file char.txt which has Mango=sweet Sky=blue I want to get the strings sweet and blue,How to do this..? Thanks -- http://mail.python.org/mailman/listinfo/python-list

ANN: SuPy 1.2

2009-02-14 Thread Greg Ewing
SuPy 1.2 Available -- http://www.cosc.canterbury.ac.nz/greg.ewing/SuPy/ Changes in this version: - Ruby object and class wrappers now have __class__ and __bases__ attributes that return the right things. As a consequence, isinstance() and issubclass() also work properly

Re: sgmllib parser keeps old tag data?

2009-02-14 Thread Berend van Berkum
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Fri, Feb 13, 2009 at 03:41:52PM +, MRAB wrote: Berend van Berkum wrote: Yes.. tested that and SGMLParser won't let me override __init__, (SGMLParser vars are uninitialized even with sgmllib.SGMLParser(self) call). OK, so SGMLParser

Re: encrypting lines from file with md5 module doesn't work?

2009-02-14 Thread MRAB
Canned wrote: Hi, I need some help with my script. I hope someone can show me the right direction or at least explain to me what did I wrong? I write a small script that read lines from plain text file and encrypt each lines using md5 module. I have a small word list that contain 2000+ words, 1

Re: Turning a signature-changing decorator into a signature-preserving one

2009-02-14 Thread Michele Simionato
On Feb 14, 1:30 pm, Gustavo Narea m...@gustavonarea.net wrote: This is what I get: (Pdb) func.__name__ 'greetings' (Pdb) func.__dict__ {} (Pdb) func.__module__ 'pylonsproject.controllers.root' Which seems correct to me. By the way, I forgot to mention that what is decorated is an

Re: [Python-Dev] RELEASED Python 3.0.1

2009-02-14 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Feb 13, 2009, at 11:46 PM, Benjamin Kaplan wrote: Any chance of getting a Mac installer for this one? I believe Ronald is planning to upload it soon. Barry -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (Darwin)

Function name limit in Python ?

2009-02-14 Thread Linuxguy123
Excuse my ignorance, but is there a limit to the size of function names in Python ? I named a function getSynclientVersion() and I got an error when I called it. I renamed the same function to getSCVersion() and it called fine. Why ? Thanks --

Re: Problem building Python extension

2009-02-14 Thread John Machin
On Feb 14, 7:04 pm, martijnsteenw...@gmail.com wrote: On 13 feb, 12:45, Christian Heimes li...@cheimes.de wrote: martijnsteenw...@gmail.com wrote: Thanks a lot for your reply. I downloaded installed Visual C# 2008 express, but unfortunately this doesn't change anything in running the

Re: how can this iterator be optimized?

2009-02-14 Thread josh logan
On Feb 13, 7:44 pm, Basilisk96 basilis...@gmail.com wrote: On Feb 12, 1:15 am, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: I usually strive for comprehensions if a for loop can be reduced to such. Any particular reason? Only two. 1.) I was impressed by their clarity

Re: Function name limit in Python ?

2009-02-14 Thread MRAB
Linuxguy123 wrote: Excuse my ignorance, but is there a limit to the size of function names in Python ? I named a function getSynclientVersion() and I got an error when I called it. I renamed the same function to getSCVersion() and it called fine. Why ? Probably a just spelling mistake.

Re: Function name limit in Python ?

2009-02-14 Thread Paul McGuire
On Feb 14, 8:45 am, Linuxguy123 linuxguy...@gmail.com wrote: Excuse my ignorance, but is there a limit to the size of function names in Python ? I named a function getSynclientVersion() and I got an error when I called it.  I renamed the same function to getSCVersion() and it called fine.

Re: how can this iterator be optimized?

2009-02-14 Thread Paul McGuire
On Feb 11, 7:22 pm, Basilisk96 basilis...@gmail.com wrote: ... where func is a single-argument function that returns either a string or None, but is an expensive call. I am pretty sure that the sorted() construct cannot be improved much further, but... ...does anyone have ideas on improving

confusion about variable scope in a class

2009-02-14 Thread gyro
Hi, I was writing a Python script to perform some data analyses and was surprised by some behavior I noted. A simple test program illustrating the behavior is below. I do not understand why the value of 'data' is being modified. I am obviously missing something obvious, and would certainly

Can Python serial support run at 45.45 baud?

2009-02-14 Thread John Nagle
Can Python's serial port support be made to run at 45.45 baud, the old 60 speed Teletype machine speed? I've restored a Model 15 teletype from WWII. Works great after cleaning, oiling, and adjustment. There's Perl support for this, and a Perl program (http://www.buzbee.net/heavymetal;) that

Re: confusion about variable scope in a class

2009-02-14 Thread andrew cooke
it's not a scope issue. you are confusing variables and objects. a variable is a box that can hold an object so x = 2 puts the object '2' in the box 'x'. following that with x = '3' changes the box 'x' to hold the object '3'. but lists are also boxes, different from variables. so x =

Re: String concatenation performance with +=

2009-02-14 Thread Nick Craig-Wood
Sammo sammo2...@gmail.com wrote: String concatenation has been optimized since 2.3, so using += should be fairly fast. In my first test, I tried concatentating a 4096 byte string 1000 times in the following code, and the result was indeed very fast (12.352 ms on my machine). import

Re: encrypting lines from file with md5 module doesn't work?

2009-02-14 Thread Nick Craig-Wood
Canned u...@domain.invalid wrote: I write a small script that read lines from plain text file and encrypt each lines using md5 module. I have a small word list that contain 2000+ words, 1 word/line. Using the code below, I can save the output to another file to use it with john the ripper

Re: Can Python serial support run at 45.45 baud?

2009-02-14 Thread Grant Edwards
On 2009-02-14, John Nagle na...@animats.com wrote: Can Python's serial port support be made to run at 45.45 baud, the old 60 speed Teletype machine speed? If your hardware and OS supports it, Python can be made to support it. I've restored a Model 15 teletype from WWII. Fun. I worked with

Re: encrypting lines from file with md5 module doesn't work?

2009-02-14 Thread Canned
MRAB schreef: Canned wrote: Hi, I need some help with my script. I hope someone can show me the right direction or at least explain to me what did I wrong? I write a small script that read lines from plain text file and encrypt each lines using md5 module. I have a small word list that

Re: confusion about variable scope in a class

2009-02-14 Thread Diez B. Roggisch
gyro schrieb: Hi, I was writing a Python script to perform some data analyses and was surprised by some behavior I noted. A simple test program illustrating the behavior is below. I do not understand why the value of 'data' is being modified. I am obviously missing something obvious, and would

Re: Can Python serial support run at 45.45 baud?

2009-02-14 Thread MRAB
Grant Edwards wrote: On 2009-02-14, John Nagle na...@animats.com wrote: Can Python's serial port support be made to run at 45.45 baud, the old 60 speed Teletype machine speed? If your hardware and OS supports it, Python can be made to support it. [snip] I had a quick look at the Windows

Re: Function name limit in Python ?

2009-02-14 Thread Albert Hopkins
On Sat, 2009-02-14 at 07:45 -0700, Linuxguy123 wrote: Excuse my ignorance, but is there a limit to the size of function names in Python ? I named a function getSynclientVersion() and I got an error when I called it. You forgot to paste the error. --

Extract an image from a RTF file

2009-02-14 Thread bryan.fodn...@gmail.com
I have a large amount of RTF files where the only thing in them is an image. I would like to extract them an save them as a png. Eventually, I would like to also grab some text that is on the image. I think PIL has something for this. Does anyone have any suggestion on how to start this? --

Re: encrypting lines from file with md5 module doesn't work?

2009-02-14 Thread Canned
Nick Craig-Wood schreef: Canned u...@domain.invalid wrote: I write a small script that read lines from plain text file and encrypt each lines using md5 module. I have a small word list that contain 2000+ words, 1 word/line. Using the code below, I can save the output to another file to

Re: Easier to wrap C or C++ libraries?

2009-02-14 Thread Diez B. Roggisch
argo...@gmail.com schrieb: When creating a Python binding to a C or C++ library, which is easier to wrap, the C lib or the C++ one? Given a choice, if you had to choose between using one of two libs, one written in C, the other in C+ + -- both having approximately the same functionality -- which

Re: Thank you, Tkinter. (easy to use)

2009-02-14 Thread Terry Reedy
DLitgo wrote: Does anyone know of a quick and easy install for PIL + JPEG for Mac OS X (10.5)? If you don't get an answer, try a thread with the above as the title. There may be a python-mac list somewhere too. -- http://mail.python.org/mailman/listinfo/python-list

Financial Modeling in Python

2009-02-14 Thread Ajith Prasad
http://as.wiley.com/WileyCDA/WileyTitle/productCd-0470987847.html now lists the contents of a new book: Financial Modeling in Python Shayne Fletcher, Christopher Gardner ISBN: 978-0-470-98784-1 Hardcover 280 pages August 2009 Wiley List Price: US $130.00 --

Re: Reading a file

2009-02-14 Thread Terry Reedy
zaheer.ag...@gmail.com wrote: Hi How do i read a file in Python and search a particular pattern like I have a file char.txt which has Mango=sweet Sky=blue I want to get the strings sweet and blue,How to do this..? for line in open('char.txt'): if line.find('sweet') != -1 or

Re: Can Python serial support run at 45.45 baud?

2009-02-14 Thread John Nagle
Grant Edwards wrote: On 2009-02-14, John Nagle na...@animats.com wrote: Can Python's serial port support be made to run at 45.45 baud, the old 60 speed Teletype machine speed? If your hardware and OS supports it, Python can be made to support it. OK, tried to open the port, using

Re: Extract an image from a RTF file

2009-02-14 Thread Terry Reedy
bryan.fodn...@gmail.com wrote: I have a large amount of RTF files where the only thing in them is an image. I would like to extract them an save them as a png. Eventually, I would like to also grab some text that is on the image. I think PIL has something for this. Does anyone have any

Re: Can Python serial support run at 45.45 baud?

2009-02-14 Thread MRAB
John Nagle wrote: Grant Edwards wrote: On 2009-02-14, John Nagle na...@animats.com wrote: Can Python's serial port support be made to run at 45.45 baud, the old 60 speed Teletype machine speed? If your hardware and OS supports it, Python can be made to support it. OK, tried to open

Re: How to debug deadlock?

2009-02-14 Thread Aahz
In article bf6fbab3-7ec7-4210-bc15-ad4e2f6a2...@r10g2000prf.googlegroups.com, Victor Lin borns...@gmail.com wrote: I am developing a multi-threading application, I encounter a deadlock. I use Visual C++ Express 2008 to trace the program. Once the deadlock occurs, I just pause the program and

Re: [Python-Dev] RELEASED Python 3.0.1

2009-02-14 Thread Ronald Oussoren
On 14 Feb, 2009, at 9:55, Martin v. Löwis wrote: Any chance of getting a Mac installer for this one? Chances are non-zero, yes. I had hoped to build one last night, but got home way later than I had planned. The installer is building as I type this. Ronald smime.p7s Description:

Re: Can Python serial support run at 45.45 baud?

2009-02-14 Thread John Nagle
John Nagle wrote: OK, tried to open the port, using Python 2.6, latest PySerial and PyWin32: ser = serial.Serial(port, baudrate=baud, bytesize=serial.FIVEBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_TWO) ValueError: Cannot configure

Re: Can Python serial support run at 45.45 baud?

2009-02-14 Thread MRAB
John Nagle wrote: John Nagle wrote: OK, tried to open the port, using Python 2.6, latest PySerial and PyWin32: ser = serial.Serial(port, baudrate=baud, bytesize=serial.FIVEBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_TWO) ValueError:

Re: Can Python serial support run at 45.45 baud?

2009-02-14 Thread MRAB
John Nagle wrote: [snip] So the correct combination, 5 bits with 1.5 stop bits, isn't supported in Python. 1 stop bit will not physically work on Baudot teletypes; the main camshaft doesn't come around fast enough. (Yes, there's an actual mechanical reason for 1.5 stop bits.) Requesting 2

Re: Can Python serial support run at 45.45 baud?

2009-02-14 Thread Roy Smith
In article 49970ce7$0$1665$742ec...@news.sonic.net, John Nagle na...@animats.com wrote: At the hardware level, there's a clock rate, a counter, and a divisor, so arbitrary baud rates can be set. Is that really true of modern hardware? The last time I looked at serial port hardware, UARTs

Re: Extract an image from a RTF file

2009-02-14 Thread Curt Hash
On Sat, Feb 14, 2009 at 11:01 AM, Terry Reedy tjre...@udel.edu wrote: bryan.fodn...@gmail.com wrote: I have a large amount of RTF files where the only thing in them is an image. I would like to extract them an save them as a png. Eventually, I would like to also grab some text that is on

Re: Easier to wrap C or C++ libraries?

2009-02-14 Thread argo785
On Feb 14, 12:14 pm, Diez B. Roggisch de...@nospam.web.de wrote: The answer is easy: if you use C, you can use ctypes to create a wrapper - with pure python, no compilation, no platform issues. Which IMHO makes a strong point for C - if you need OO, it's bolted on easily using Python itself,

Re: Easier to wrap C or C++ libraries?

2009-02-14 Thread Hrvoje Niksic
Diez B. Roggisch de...@nospam.web.de writes: The answer is easy: if you use C, you can use ctypes to create a wrapper - with pure python, no compilation, no platform issues. The last part is not true. ctypes doesn't work on 64-bit architectures, nor does it work when Python is built with

Re: Easier to wrap C or C++ libraries?

2009-02-14 Thread Christian Heimes
Hrvoje Niksic schrieb: Diez B. Roggisch de...@nospam.web.de writes: The answer is easy: if you use C, you can use ctypes to create a wrapper - with pure python, no compilation, no platform issues. The last part is not true. ctypes doesn't work on 64-bit architectures, nor does it work

Re: Fortran array in python (f2py?)...

2009-02-14 Thread tripp
OK. It sounds like it would be easiest for me, then, to dump the arrays to a binary file (much faster than dumping it to a text) from the fortran program. Then use f2py to load a fortran module to read it.?. How well does python handle binary files? Maybe I could skit the f2py all together if

Re: Fortran array in python (f2py?)...

2009-02-14 Thread Kurt Smith
On Sat, Feb 14, 2009 at 2:06 PM, tripp trippl...@gmail.com wrote: OK. It sounds like it would be easiest for me, then, to dump the arrays to a binary file (much faster than dumping it to a text) from the fortran program. Then use f2py to load a fortran module to read it.?. I've done

Re: Fortran array in python (f2py?)...

2009-02-14 Thread Scott David Daniels
tripp wrote: ... dump the arrays to a binary file (much faster than dumping it to a text) from the fortran program How well does python handle binary files? Maybe I could skit the f2py all together if I can get python to read the fortran binary file... Likely your best plan. Look

Re: Can Python serial support run at 45.45 baud?

2009-02-14 Thread John Nagle
MRAB wrote: John Nagle wrote: [snip] So the correct combination, 5 bits with 1.5 stop bits, isn't supported in Python. 1 stop bit will not physically work on Baudot teletypes; the main camshaft doesn't come around fast enough. (Yes, there's an actual mechanical reason for 1.5 stop bits.)

Rapidshare to Megaupload script

2009-02-14 Thread aiwarrior
I've made this script and would like to have some input and share it with the community. I also have a page with some code i produce on my spare time. http://pneves.net Thanks # -*- coding: utf-8 -*- ## I Paulo Neves am the owner of this script and i do not allow the copy or distribution ## of

PySerial write should accept bytearray

2009-02-14 Thread John Nagle
PySerial, which is basically a binary input/output system, is still requiring str instead of bytearray, even under Python 2.6. For file-like objects, write functions are supposed to accept bytearray now, and read functions should return a bytearray. John Nagle

Re: PySerial write should accept bytearray

2009-02-14 Thread Tino Wildenhain
John Nagle wrote: PySerial, which is basically a binary input/output system, is still requiring str instead of bytearray, even under Python 2.6. For file-like objects, write functions are supposed to accept bytearray now, and read functions should return a bytearray. I'm sure patches are

Re: Can Python serial support run at 45.45 baud?

2009-02-14 Thread John Nagle
Roy Smith wrote: In article 49970ce7$0$1665$742ec...@news.sonic.net, John Nagle na...@animats.com wrote: At the hardware level, there's a clock rate, a counter, and a divisor, so arbitrary baud rates can be set. Is that really true of modern hardware? The last time I looked at serial port

Re: ANN: SuPy - Script Sketchup with Python

2009-02-14 Thread r
Great work Greg, you are a Python zen master! -- http://mail.python.org/mailman/listinfo/python-list

Re: Untangling pythonWin and IDLE Processes on XP Pro

2009-02-14 Thread Thorsten Kampe
* Rhodri James (Fri, 13 Feb 2009 22:57:42 -) On Fri, 13 Feb 2009 11:13:38 -, W. eWatson notval...@sbcglobal.net wrote: OK, enough tinkering with the code and others matters on my end trying to find a work around. Somehow after much successful use of IDLE's execution

Re: Untangling pythonWin and IDLE Processes on XP Pro

2009-02-14 Thread Thorsten Kampe
* W. eWatson (Fri, 13 Feb 2009 20:58:33 -0800) Scott David Daniels wrote: OK, you are using the oldest and least useful revision control system, rename and remember. I'd suggest you get and use bazaar, but you'll just ask for shortcuts on how to use it without understanding what it does.

Re: Rapidshare to Megaupload script

2009-02-14 Thread James Matthews
This can be used as a great guide on writing pythonic code. Don't look at the specific code that is being corrected but look at how the improvements are being presented. I would recommend someone who is learning python read this guide. On Sun, Feb 15, 2009 at 12:17 AM, MRAB

Re: Reading a file

2009-02-14 Thread Philipp Pagel
zaheer.ag...@gmail.com wrote: Hi How do i read a file in Python and search a particular pattern like I have a file char.txt which has Mango=sweet Sky=blue I want to get the strings sweet and blue,How to do this..? If your entire file consists of such key=value pairs you may want to

Re: Rapidshare to Megaupload script

2009-02-14 Thread MRAB
aiwarrior wrote: I've made this script and would like to have some input and share it with the community. I also have a page with some code i produce on my spare time. http://pneves.net Thanks [snip] def from_rapidshare(url): '''Check if this is a rapidshare link''' return

Re: Untangling pythonWin and IDLE Processes on XP Pro

2009-02-14 Thread Rhodri James
On Sat, 14 Feb 2009 05:03:13 -, W. eWatson notval...@sbcglobal.net wrote: See my response to Scott. Thanks for your reply. I did. It was fundamentally mistaken in so many respects that I formally give up on you. -- Rhodri James *-* Wildebeeste Herder to the Masses --

GetKeyboardLayoutName Win32API

2009-02-14 Thread Tsolakos Stavros
Hi all. I was trying to find a way to read the currently selected input layout from an app written in python. I am aware that if the app were written in C, I would have to call the GetKeyboardLayoutName() function. How can this be done in Python? I want to avoid writing an extension just for

ImportError: dynamic module does not define init function (inittypes)

2009-02-14 Thread konteya joshi
Hi, Iam trying to run a programs which resides insides ..\pythonroot. I see the following error on running the program: 'import site' failed; use -v for traceback Traceback (most recent call last): File skyline\alpine_kickoff.py, line 6, in ? import re File

Re: Function name limit in Python ?

2009-02-14 Thread Steven D'Aprano
Linuxguy123 wrote: Excuse my ignorance, but is there a limit to the size of function names in Python ? I named a function getSynclientVersion() and I got an error when I called it. No no, don't tell us what error you got! I love guessing games. I'm guessing you got either a SyntaxError

Re: String concatenation performance with +=

2009-02-14 Thread Steven D'Aprano
Nick Craig-Wood wrote: The optimized += depends on their being no other references to the string.  Strings are immutable in python.  So append must return a new string.  However the += operation was optimised to do an in-place append if and only if there are no other references to the string.

Re: Can Python serial support run at 45.45 baud?

2009-02-14 Thread Grant Edwards
On 2009-02-14, John Nagle na...@animats.com wrote: John Nagle wrote: OK, tried to open the port, using Python 2.6, latest PySerial and PyWin32: ser = serial.Serial(port, baudrate=baud, bytesize=serial.FIVEBITS, parity=serial.PARITY_NONE,

Re: Can Python serial support run at 45.45 baud?

2009-02-14 Thread Grant Edwards
On 2009-02-14, John Nagle na...@animats.com wrote: Roy Smith wrote: In article 49970ce7$0$1665$742ec...@news.sonic.net, John Nagle na...@animats.com wrote: At the hardware level, there's a clock rate, a counter, and a divisor, so arbitrary baud rates can be set. Is that really true of

Re: PySerial write should accept bytearray

2009-02-14 Thread Grant Edwards
On 2009-02-14, John Nagle na...@animats.com wrote: PySerial, which is basically a binary input/output system, is still requiring str instead of bytearray, even under Python 2.6. For file-like objects, write functions are supposed to accept bytearray now, and read functions should return a

Re: Reading a file

2009-02-14 Thread Steven D'Aprano
Philipp Pagel wrote: zaheer.ag...@gmail.com wrote: Hi How do i read a file in Python and search a particular pattern like I have a file char.txt which has Mango=sweet Sky=blue I want to get the strings sweet and blue,How to do this..? If your entire file consists of such

Re: doctest fails to see tests in decorated functions

2009-02-14 Thread Steven D'Aprano
Steven D'Aprano wrote: I've just spotted a bug in doctest that it fails to see tests inside decorated functions. It's been reported before: http://bugs.python.org/issue1108 but the patch submitted doesn't work for me. Never mind, it was a PEBCAK error. I failed to notice that applying a

Re: doctest fails to see tests in decorated functions

2009-02-14 Thread Michele Simionato
On Feb 15, 6:31 am, Steven D'Aprano st...@pearwood.info wrote: Never mind, it was a PEBCAK error. I failed to notice that applying a decorator to a function shadows the functions docstring. Normally I would use functools.wraps, but I am currently limping along on a Python 2.4 installation

Byte type?

2009-02-14 Thread John Nagle
With bytearray, the element type is considered to be unsigned byte, or so says PEP 3137: The element data type is always 'B' (i.e. unsigned byte). Let's try: Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on win32 xx = b'x' repr(xx) 'x' repr(xx[0]) 'x'

Re: Byte type?

2009-02-14 Thread Lie Ryan
On Sat, 14 Feb 2009 22:10:41 -0800, John Nagle wrote: xx = b'x' Isn't this creating a regular byte? Shouldn't creation of bytearray be: xx = bytearray(b'x') -- http://mail.python.org/mailman/listinfo/python-list

Re: Byte type?

2009-02-14 Thread Erik Max Francis
John Nagle wrote: With bytearray, the element type is considered to be unsigned byte, or so says PEP 3137: The element data type is always 'B' (i.e. unsigned byte). Let's try: Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on win32 xx = b'x' repr(xx)

Re: Byte type?

2009-02-14 Thread Chris Rebert
On Sat, Feb 14, 2009 at 9:56 PM, Lie Ryan lie.1...@gmail.com wrote: On Sat, 14 Feb 2009 22:10:41 -0800, John Nagle wrote: xx = b'x' Isn't this creating a regular byte? Shouldn't creation of bytearray be: xx = bytearray(b'x') Indeed, and slicing that does give back a single byte (which

Setuptools Python 3.0

2009-02-14 Thread Sylvain Rabot
Hi, I would like to know if the official maintainers of setuptools are working on a release for Python 3.0. Regards. -- http://mail.python.org/mailman/listinfo/python-list

How to peek inside a decorated function

2009-02-14 Thread Steven D'Aprano
Suppose I have a function f() which I know has been decorated, but I don't have access to the original undecorated function any longer: def reverse(func): def f(*args): args = list(args) args.reverse() return func(*args) return f def say(*args): print args

multiprocessing python2.6.1

2009-02-14 Thread km
Dear all, I have a problem with multiprocessing module usage with python2.6.1 Here Pool object is to be instantiated with 50 processes and the method 'run' has to be called with pool object. My actual requirement is to reuse the 50 processes for further processing until 100 items.

[issue4627] Add Mac OS X Disk Images to Python.org homepage

2009-02-14 Thread Carl Johnson
Carl Johnson c...@carlsensei.com added the comment: Fair enough. In this case though, I'm not complaining for myself, since I can compile config, make, install source (although I don't know how to build a Mac Installer, or else I would just do it). I'm complaining on behalf of all the

[issue5179] subprocess leaves open fds on construction error

2009-02-14 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: I would, but how this fails is likely to be highly platform-specific. Can you try it on Windows and tell me what the resulting exception is? ___ Python tracker rep...@bugs.python.org

[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-02-14 Thread Eric Smith
Eric Smith e...@trueblade.com added the comment: auto_number_formatter_2.py lets you experiment with this with a syntax more similar to what ''.format() looks like: $ ./python Python 2.7a0 (trunk:69608, Feb 14 2009, 04:51:18) [GCC 4.1.2 20070626 (Red Hat 4.1.2-13)] on linux2 Type help,

[issue1762561] unable to serialize Infinity or NaN on ARM using marshal

2009-02-14 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Thanks Martin and Mark Miller for the comments and testing. I'm going to close this as won't fix. This doesn't preclude ARM OABI becoming a supported platform at some point in the future, just not right now. -- resolution: - wont

[issue2279] distutils sdist add_defaults does not add data_files

2009-02-14 Thread Tarek Ziadé
Tarek Ziadé ziade.ta...@gmail.com added the comment: Right, but if MANIFEST.in is removed, I can see cases where you would need the same kind of mini-syntax in your setup.py. For instance, how would you tell sdist to recursively add files located in a directory (like the current

[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-02-14 Thread Eric Smith
Eric Smith e...@trueblade.com added the comment: Okay, one last version. This one lets you use object access within the replacement string: from auto_number_formatter_3 import formatter as _ _('{} {} {}').format(3, 'pi', 3.14) '3 pi 3.14' _('{:#b} {!r:^10} {.imag}').format(3, 'pi', 3j+1)

[issue5252] 2to3 should detect and delete import of removed statvfs module

2009-02-14 Thread Stephen J. Turnbull
Stephen J. Turnbull step...@xemacs.org added the comment: Benjamin Peterson writes: Hmm. 2to3 doesn't currently mess with the stat module and os.stat the more common function. Also the new interface (attributes on the objects returned) has been around since 2.2. So what? You *can't*

[issue2279] distutils sdist add_defaults does not add data_files

2009-02-14 Thread Tarek Ziadé
Tarek Ziadé ziade.ta...@gmail.com added the comment: Right, but if MANIFEST.in is removed, I can see cases where you would need the same kind of mini-syntax in your setup.py. For instance, how would you tell sdist to recursively add files located in a directory (like the current

[issue2279] distutils sdist add_defaults does not add data_files

2009-02-14 Thread Tarek Ziadé
Changes by Tarek Ziadé ziade.ta...@gmail.com: ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2279 ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue5104] getsockaddrarg() casts port number from int to short without any warning

2009-02-14 Thread Roman Zeyde
Roman Zeyde roman.ze...@gmail.com added the comment: I've checked Python 3.0.1 today (at http://svn.python.org/projects/python/tags/r301/Modules/socketmodule.c) and it seems that the bug above has been fixed there too. ___ Python tracker

[issue886488] WinPython 2.3.3 crashes using popen2 to spawn lots of child

2009-02-14 Thread Daniel Diniz
Changes by Daniel Diniz aja...@gmail.com: -- stage: - test needed versions: -Python 2.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue886488 ___

[issue892902] problem with pickling newstyle class instances

2009-02-14 Thread Daniel Diniz
Daniel Diniz aja...@gmail.com added the comment: Confirmed on trunk. -- nosy: +ajaksu2 stage: - test needed versions: +Python 2.6 -Python 2.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue892902

[issue894936] Have a split corresponding with os.path.join

2009-02-14 Thread Daniel Diniz
Changes by Daniel Diniz aja...@gmail.com: -- components: +Library (Lib) -None stage: - test needed type: - feature request versions: +Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue894936

  1   2   3   4   >