ANN: Leipzig Python User Group - Meeting, September 8, 2009, 08:00pm

2009-09-06 Thread Stefan Schwarzer
=== Leipzig Python User Group === We will meet on Tuesday, September 8 at 8:00 pm at the training center of Python Academy in Leipzig, Germany ( http://www.python-academy.com/center/find.html ). Markus Zapke-Gründemann will talk about the micro web framework Bottle. Food and soft drinks are

TestFixtures 1.6.1 released!

2009-09-06 Thread Chris Withers
Hi All, I'm pleased to announce a new release of TestFixtures. This package is a collection of helpers and mock objects that are useful when writing unit tests or doc tests. This release sees the following changes: - @replace and Replacer.replace can now replace attributes that may not be

xlutils 1.4.1 released!

2009-09-06 Thread Chris Withers
Hi All, I'm pleased to announce a new release of xlutils. This package is a small collection of utilities that make use of both xlrd and xlwt to process Microsoft Excel files. This release includes memory and speed enhancements for xlutils.filter and xlutils.copy. To find out more, please

Re: efficiently splitting up strings based on substrings

2009-09-06 Thread 7stud
On Sep 5, 5:29 pm, per perfr...@gmail.com wrote: On Sep 5, 7:07 pm, Rhodri James rho...@wildebst.demon.co.uk wrote: On Sat, 05 Sep 2009 23:54:08 +0100, per perfr...@gmail.com wrote: On Sep 5, 6:42 pm, Rhodri James rho...@wildebst.demon.co.uk wrote: On Sat, 05 Sep 2009 22:54:41 +0100,

Re: beginner's python help

2009-09-06 Thread Chris Rebert
On Sun, Sep 6, 2009 at 12:00 AM, Maggiela.f...@gmail.com wrote: code practice: test = open (test.txt, r) readData = test.readlines() #set up a sum sum = 0; for item in readData:        sum += int(item) print sum A slightly better way to write this: test = open(test.txt, r) #set up a sum

Re: beginner's python help

2009-09-06 Thread hrishy
Hi I am just a python beginner What you need is exceptions http://docs.python.org/tutorial/errors.html something on the lines of since you expect a integer and you wnat to catch the exception ... try: ... sum = 0; ... for item in readData: ...sum +=

Re: efficiently splitting up strings based on substrings

2009-09-06 Thread 7stud
On Sep 6, 1:14 am, 7stud bbxx789_0...@yahoo.com wrote: On Sep 5, 5:29 pm, per perfr...@gmail.com wrote: On Sep 5, 7:07 pm, Rhodri James rho...@wildebst.demon.co.uk wrote: On Sat, 05 Sep 2009 23:54:08 +0100, per perfr...@gmail.com wrote: On Sep 5, 6:42 pm, Rhodri James

beginner's python help

2009-09-06 Thread Maggie
code practice: test = open (test.txt, r) readData = test.readlines() #set up a sum sum = 0; for item in readData: sum += int(item) print sum test file looks something like this: 34 23 124 432 12 when i am trying to compile this it gives me the error: invalid literal for int() with base

Re: beginner's python help

2009-09-06 Thread hrishy
Hi Chris What if i want to log that bad data and continue processing is there a way to do that ? regards --- On Sun, 6/9/09, Chris Rebert c...@rebertia.com wrote: From: Chris Rebert c...@rebertia.com Subject: Re: beginner's python help To: Maggie la.f...@gmail.com Cc:

Re: File Handling Problem

2009-09-06 Thread joy99
On Sep 5, 11:49 am, Chris Rebert c...@rebertia.com wrote: On Fri, Sep 4, 2009 at 11:39 PM, SUBHABRATABANERJEEsubhakolkata1...@gmail.com wrote: snip And one small question does Python has any increment operator like ++ in C. No. We do  x += 1  instead. Cheers, Chris

Re: efficiently splitting up strings based on substrings

2009-09-06 Thread 7stud
On Sep 6, 1:23 am, 7stud bbxx789_0...@yahoo.com wrote: On Sep 6, 1:14 am, 7stud bbxx789_0...@yahoo.com wrote: On Sep 5, 5:29 pm, per perfr...@gmail.com wrote: On Sep 5, 7:07 pm, Rhodri James rho...@wildebst.demon.co.uk wrote: On Sat, 05 Sep 2009 23:54:08 +0100, per

Re: beginner's python help

2009-09-06 Thread Chris Rebert
On Sun, Sep 6, 2009 at 12:46 AM, hrishyhris...@yahoo.co.uk wrote: Hi Chris What if i want to log that bad data and continue processing is there a way to do that ? Tighten the area included in the try...except: sum = 0 for item in readData: try: sum += int(item) except

Re: beginner's python help

2009-09-06 Thread hrishy
Hi sum = 0 for item in readData: try: sum += int(item) except ValueError: print Oops! That was no valid number. Instead it was:, item So you mean to say this would ignore the bad data and continue processing ? regards --

Question on File Input and AST

2009-09-06 Thread joy99
Dear Group, I have a file test1.txt. Now, as I do the file handling, i try to do any one of the following operations. 1. open_file=open(/python26/test1.txt,r) # FOR READING 2. open_file=open(/python26/test1.txt,r+) # FOR READING AND WRITING BOTH [Either of 1 or 2 to open as the need be] 3.

Re: beginner's python help

2009-09-06 Thread Chris Rebert
On Sun, Sep 6, 2009 at 12:54 AM, hrishyhris...@yahoo.co.uk wrote: Hi sum = 0  for item in readData:     try:         sum += int(item)     except ValueError:         print Oops!  That was no valid number. Instead it was:, item So you mean to say this would ignore the bad data and continue

Re: beginner's python help

2009-09-06 Thread Maggie
On Sep 6, 3:58 am, Chris Rebert c...@rebertia.com wrote: On Sun, Sep 6, 2009 at 12:54 AM, hrishyhris...@yahoo.co.uk wrote: Hi sum = 0  for item in readData:     try:         sum += int(item)     except ValueError:         print Oops!  That was no valid number. Instead it was:, item

Re: beginner's python help

2009-09-06 Thread Chris Rebert
On Sun, Sep 6, 2009 at 1:10 AM, Maggiela.f...@gmail.com wrote: On Sep 6, 3:58 am, Chris Rebert c...@rebertia.com wrote: On Sun, Sep 6, 2009 at 12:54 AM, hrishyhris...@yahoo.co.uk wrote: Hi sum = 0  for item in readData:     try:         sum += int(item)     except ValueError:      

Re: Evil trend report

2009-09-06 Thread Steven D'Aprano
On Sat, 05 Sep 2009 22:43:17 -0700, John Nagle wrote: [snip] Test complete: Evil trend report Right now, Google is winning slightly. It changes from minute to minute, because it's based on the current list of hot search topics from Google. More on this later. What does this mean? What

Re: beginner's python help

2009-09-06 Thread Maggie
On Sep 6, 4:19 am, Chris Rebert c...@rebertia.com wrote: On Sun, Sep 6, 2009 at 1:10 AM, Maggiela.f...@gmail.com wrote: On Sep 6, 3:58 am, Chris Rebert c...@rebertia.com wrote: On Sun, Sep 6, 2009 at 12:54 AM, hrishyhris...@yahoo.co.uk wrote: Hi sum = 0  for item in readData:    

Re: beginner's python help

2009-09-06 Thread Chris Rebert
On Sun, Sep 6, 2009 at 1:28 AM, Maggiela.f...@gmail.com wrote: On Sep 6, 4:19 am, Chris Rebert c...@rebertia.com wrote: On Sun, Sep 6, 2009 at 1:10 AM, Maggiela.f...@gmail.com wrote: On Sep 6, 3:58 am, Chris Rebert c...@rebertia.com wrote: On Sun, Sep 6, 2009 at 12:54 AM,

Re: Question on File Input and AST

2009-09-06 Thread Steven D'Aprano
On Sun, 06 Sep 2009 00:53:43 -0700, joy99 wrote: Dear Group, I have a file test1.txt. Now, as I do the file handling, i try to do any one of the following operations. 1. open_file=open(/python26/test1.txt,r) # FOR READING 2. open_file=open(/python26/test1.txt,r+) # FOR READING AND

Re: Turn-based game - experimental economics

2009-09-06 Thread Paolo Crosetto
Dennis, thanks. Do the clients have to do anything between turns? If not, the simplest thing is to just have these clients block on a read request waiting for data to be returned from the server. the only thing that the clients do is receiving information on the action of other

subclassing Scientific.IO.NetCDFFile

2009-09-06 Thread Jon Beezley
Hi all, I have come across a problem that I am unsure how to get around. What I want to do is create a subclass of Scientific.IO.NetCDFFile, but despite what the docstrings say isn't really a class at all, but a function that returns some sort of data structure from the netcdf C api. I am aware

zip a huge file into multiple small ones

2009-09-06 Thread krishna chaitanya
I am new to dealing with zip files in python. I have a huge file which i need to zip and send as an attachment through email. My email restrictions are not allowing me to send it in one go. Is there a way to split this file into multiple zip files, so that i can mail them separately. All the

Re: Support for Windows 7 ?

2009-09-06 Thread Pascale Mourier
Michel Claveau - MVP a écrit : Bonjour ! Plusieurs points : - Python (ainsi que Pywin32) fonctionne TRÈS bien sous Windows-7 (je l'utilise depuis plus d'un an, sur Win-7 beta, RC, RTM, en 32 bits et en 64 bits). Résultats : AUCUN problème. - Il existe des sources françaises (newsgroups,

Re: Why does this group have so much spam?

2009-09-06 Thread Steven D'Aprano
On Thu, 03 Sep 2009 23:07:48 -0400, Terry Reedy wrote: Suppose that all over the world, people coordinated so that one in three households paid ISPs while a neighbor on each side piggybacked (and perhaps paid the paying househould their one-third share). Do you really think that would have

Re: Support for Windows 7 ?

2009-09-06 Thread Michel Claveau - MVP
Bonjour ! Plusieurs points : - Python (ainsi que Pywin32) fonctionne TRÈS bien sous Windows-7 (je l'utilise depuis plus d'un an, sur Win-7 beta, RC, RTM, en 32 bits et en 64 bits). Résultats : AUCUN problème. - Il existe des sources françaises (newsgroups, sites, forums, etc.) qui

Evil trend report

2009-09-06 Thread John Nagle
Bing A 32.4% () A 10.8% (non_commercial) Q50 40.0% () Q15 12.0% (no_location) U 54.0% (no_website) U33 26.4% (non_commercial) X 10.8% (negative_info) X17 13.6% (no_location) Google A 10.8% () A 4

Re: How to access ODBC databases ?

2009-09-06 Thread Martin P. Hellwig
Timothy Madden wrote: cut Thank you. The precompiled psqlodbca.so driver from apt-get worked on one of the Ubuntu machines that I tried. I would still like o use the Unicode driver if possible. Do you know what the problem could be ? Or where ? pyodbc/unixODBC/psqlodbcw.so ? Thank you,

Managing a Sub-Process

2009-09-06 Thread Greg Lindstrom
I am using Python 2.6 on Gentoo Linux and have a routine that gets/puts files to other servers via sftp. We have an ongoing problem with various sftp processes hanging; that is, it no longer transfers any data but does not shutdown/timeout. I would like to design a routine that will kick off the

Re: beginner's python help

2009-09-06 Thread Benjamin Kaplan
On Sun, Sep 6, 2009 at 4:28 AM, Maggiela.f...@gmail.com wrote: On Sep 6, 4:19 am, Chris Rebert c...@rebertia.com wrote: On Sun, Sep 6, 2009 at 1:10 AM, Maggiela.f...@gmail.com wrote: On Sep 6, 3:58 am, Chris Rebert c...@rebertia.com wrote: On Sun, Sep 6, 2009 at 12:54 AM,

Re: The future of Python immutability

2009-09-06 Thread Adam Skutt
On Sep 5, 7:38 pm, Steven D'Aprano st...@remove- No. Lambdas are a *syntactical construct*, not an object. You wouldn't talk about while objects and if objects and comment objects *because they're not objects*. This rhetoric precludes functions objects as well and is entirely non- compelling.

Re: The future of Python immutability

2009-09-06 Thread Adam Skutt
On Sep 5, 10:34 pm, Terry Reedy tjre...@udel.edu wrote: Adam Skutt wrote: On Sep 5, 11:29 am, Terry Reedy tjre...@udel.edu wrote: This is a pointless replacement for 'def b(x): return x+a' And?  That has nothing to do with anything I was saying whatsoever. Agreed.  However, posts are

Re: beginner's python help

2009-09-06 Thread MRAB
Chris Rebert wrote: On Sun, Sep 6, 2009 at 1:28 AM, Maggiela.f...@gmail.com wrote: On Sep 6, 4:19 am, Chris Rebert c...@rebertia.com wrote: On Sun, Sep 6, 2009 at 1:10 AM, Maggiela.f...@gmail.com wrote: On Sep 6, 3:58 am, Chris Rebert c...@rebertia.com wrote: On Sun, Sep 6, 2009 at 12:54 AM,

Re: The future of Python immutability

2009-09-06 Thread Bearophile
John Nagle: The concept here is that objects have an owner, which is either a thread or some synchronized object.   Locking is at the owner level.  This is simple until ownership needs to be transferred. Can this be made to work in a Pythonic way, without explicit syntax? What we want to

Re: How to refer to data files without hardcoding paths?

2009-09-06 Thread Timothy Madden
Matthew Wilson wrote: When a python package includes data files like templates or images, what is the orthodox way of referring to these in code? I'm working on an application installable through the Python package index. Most of the app is just python code, but I use a few jinja2 templates.

Re: Support for Windows 7 ? Thread closed please

2009-09-06 Thread Pascale Mourier
Many thanks to all contributors! I learnt sth I never realized before: Windows indeed maintains a current directory for each drive! As you may guess, I'm not very fond of DOS / Windows. My training with those OS started with hands-on experience on a machine w/ a single C: drive (namely a 5

Re: The future of Python immutability

2009-09-06 Thread Terry Reedy
Adam Skutt wrote: On Sep 5, 10:34 pm, Terry Reedy tjre...@udel.edu wrote: Adam Skutt wrote: On Sep 5, 11:29 am, Terry Reedy tjre...@udel.edu wrote: This is a pointless replacement for 'def b(x): return x+a' And? That has nothing to do with anything I was saying whatsoever. Agreed.

Re: How to access ODBC databases ?

2009-09-06 Thread Timothy Madden
Martin P. Hellwig wrote: Timothy Madden wrote: cut [...] It has been a couple of years, but I remember vaguely that back in the days of PossgreSQL 6, if you want ODBC support you needed to compile PG a bit different then normal, I am not really sure what options those where and if this

Re: Is #!/usr/bin/env python the better shebang line ?

2009-09-06 Thread Benjamin Kaplan
On Sun, Sep 6, 2009 at 10:01 AM, Timothy Maddenterminato...@gmail.com wrote: Hello Sorry if this has been discussed before, my search did not find it. My questions is if I should use  #!/usr/bin/env python as the shebang line in a portable and open python script and if it does help with

Re: beginner's python help

2009-09-06 Thread Terry Reedy
Maggie wrote: code practice: test = open (test.txt, r) readData = test.readlines() #set up a sum sum = 0; for item in readData: sum += int(item) print sum test file looks something like this: 34 23 124 432 12 when i am trying to compile this it gives me the error: invalid literal for

Is #!/usr/bin/env python the better shebang line ?

2009-09-06 Thread Timothy Madden
Hello Sorry if this has been discussed before, my search did not find it. My questions is if I should use #!/usr/bin/env python as the shebang line in a portable and open python script and if it does help with portability and usage. First, can one not find /usr/bin/python in any standard

Re: Q on explicitly calling file.close

2009-09-06 Thread Terry Reedy
Stephen Hansen wrote: This is precisely why the with statement exists; to provide a cleaner way to wrap a block in setup and teardown functions. Closing is one. Yeah, you get some extra indentation-- but you sorta have to live with it if you're worried about correct code. I think it's a good

HTTPS on Twisted

2009-09-06 Thread koranthala
Hi, For a financial application, I am creating a python tool which uses HTTPS to transfer the data from client to server. Now, everything works perfectly, since the SSL support comes free with Twisted. I have one problem though. As an upgrade, now, I have to send many requests as the same

Re: Python- javascript

2009-09-06 Thread lkcl
On Aug 16, 12:02 am, Mike Paul paul.mik...@gmail.com wrote: I'm trying to scrap a dynamic page with lot ofjavascriptin it. Inorder to get all the data from the page i need to access thejavascript. But i've no idea how to do it. Say I'm scraping some site htttp://www.xyz.com/xyz

Re: Python or ActionScript 3.0

2009-09-06 Thread lkcl
On Aug 15, 9:32 pm, Jaseem jas...@gmail.com wrote: Hi, Is python similar to actionscript 3.0 Which is better to create a rich gui internet application? can i suggest that you read this: http://www.javalobby.org/articles/ajax-ria-overview/ and then take a look at this: http://pyjs.org

Re: Python or ActionScript 3.0

2009-09-06 Thread lkcl
On Aug 16, 1:29 am, Douglas Alan darkwate...@gmail.com wrote: But both python and AS 3.0 is almost identical. No, Python and ActionScript are not almost identical. the AS 3.0 implementation is entirely missing declarative style of programming: it is purely event-driven. i.e. you cannot get

Re: Python or ActionScript 3.0

2009-09-06 Thread lkcl
On Aug 16, 5:43 am, Michel Claveau - MVPenleverlesx_xx...@xmclavxeaux.com wrote: Hi! Python doesn't run in your typical web browser Yes, Python can do it... on Windows. and linux. pyxpcomext. it's a bit of a pig, but perfectly doable: http://pyxpcomext.mozdev.org/tutorials.html Two

Re: Python or ActionScript 3.0

2009-09-06 Thread lkcl
On Sep 6, 3:19 pm, lkcl luke.leigh...@googlemail.com wrote: On Aug 16, 1:29 am, Douglas Alan darkwate...@gmail.com wrote: I think the future of client-side browser programming is actuallyJavaScript, not ActionScript, though that future may morph into one that mostly usesJavaScriptas a

Re: platform-specific overrides of functions and class methods (expanding on imputils demo code)

2009-09-06 Thread lkcl
On Aug 21, 12:58 am, a...@pythoncraft.com (Aahz) wrote: In article 77715735-2668-43e7-95da-c91d175b3...@z31g2000yqd.googlegroups.com, lkcl luke.leigh...@googlemail.com wrote: if somebody would like to add this to the python bugtracker, as a contribution, that would be great.

Re: Support for Windows 7 ?

2009-09-06 Thread jkn
On Sep 5, 4:45 pm, Pascale Mourier pascale.mour...@ecp.fr wrote: YES IT IS! Sorry for the inconvenience. I usually start from this assumption. Yesterday this new student was really agressive, and I assumed he was right! I suggest that (in general) you don't allow the first clause of this

How to debug a forked process with pdb ?

2009-09-06 Thread Timothy Madden
Hello I am trying to write a daemon and I call os.fork() twice to detach from the terminal and other staff. Problem is after the second fork() the child immediately gives an exception and although I get a traceback displayed the process should terminate, the child proces is still live, and its

Re: Q on explicitly calling file.close

2009-09-06 Thread Stephen Hansen
It's just too bad that 'with' doesn't support multiple separate x as y clauses. The developers already agreed with you ;-). With more than one item, the context managers are processed as if multiple with statements were nested: with A() as a, B() as b: suite is equivalent to with

Re: platform-specific overrides of functions and class methods (expanding on imputils demo code)

2009-09-06 Thread Terry Reedy
lkcl wrote: On Aug 21, 12:58 am, a...@pythoncraft.com (Aahz) wrote: In article 77715735-2668-43e7-95da-c91d175b3...@z31g2000yqd.googlegroups.com, lkcl luke.leigh...@googlemail.com wrote: if somebody would like to add this to the python bugtracker, as a contribution, that would be great.

Re: Q on explicitly calling file.close

2009-09-06 Thread Jan Kaliszewski
05-09-2009 r rt8...@gmail.com wrote: i find the with statement (while quite useful in general practice) is not a cure all for situations that need and exception caught. In what sense? I think that: with open(...) as f: foo... is equivalent to: f = open(...) try:

standard way to search through pdf-documents

2009-09-06 Thread krystian stodola
Hi there, I'm interested in searching through a number of pdf-documents by script. I found in the internet one project named PdfSearchGui-0.3 which should be ready for this task. But I always fail because of the following error: Traceback (most recent call last): File main.py, line 3, in

Re: Is #!/usr/bin/env python the better shebang line ?

2009-09-06 Thread Ned Deily
In article 4aa3bfdf$0$282$14726...@news.sunsite.dk, Timothy Madden terminato...@gmail.com wrote: My questions is if I should use #!/usr/bin/env python as the shebang line in a portable and open python script and if it does help with portability and usage. This question came up recently

TestFixtures 1.6.1 released!

2009-09-06 Thread Chris Withers
Hi All, I'm pleased to announce a new release of TestFixtures. This package is a collection of helpers and mock objects that are useful when writing unit tests or doc tests. This release sees the following changes: - @replace and Replacer.replace can now replace attributes that may not be

Re: possible attribute-oriented class

2009-09-06 Thread Ethan Furman
Steven D'Aprano wrote: On Fri, 04 Sep 2009 22:51:39 -0700, Ken Newton wrote: I would think this is much more than just copy from other language styles or 'just' a syntax change -- the apparent widespread use would hint at a deeper need. Apparent is the key word there. There are lots of

xlutils 1.4.1 released!

2009-09-06 Thread Chris Withers
Hi All, I'm pleased to announce a new release of xlutils. This package is a small collection of utilities that make use of both xlrd and xlwt to process Microsoft Excel files. This release includes memory and speed enhancements for xlutils.filter and xlutils.copy. To find out more, please

Re: Q on explicitly calling file.close

2009-09-06 Thread r
On Sep 6, 1:14 pm, Jan Kaliszewski z...@chopin.edu.pl wrote: 05-09-2009 r rt8...@gmail.com wrote: i find the with statement (while quite useful in general practice) is not a cure all for situations that need and exception caught. In what sense? *ahem*! in the sense that the with

Re: possible attribute-oriented class

2009-09-06 Thread Jan Kaliszewski
06-09-2009 o 20:20:21 Ethan Furman et...@stoneleaf.us wrote: In the dbf module I wrote, I use both the attribute access and the key lookup. The attribute access is great for interactive use, and for all the routines that play with the tables we have at work, where all the field names are

Re: Evil trend report

2009-09-06 Thread Che M
On Sep 6, 8:50 am, Grant Edwards gra...@visi.com wrote: On 2009-09-06, John Nagle na...@animats.com wrote: Bing    A     3    2.4%  ()    A     1    0.8%  (non_commercial)    Q    50   40.0%  ()    Q    15   12.0%  (no_location)    U     5    4.0%  (no_website)    U    33   26.4%

Re: Is #!/usr/bin/env python the better shebang line ?

2009-09-06 Thread Timothy Madden
Ned Deily wrote: In article 4aa3bfdf$0$282$14726...@news.sunsite.dk, Timothy Madden terminato...@gmail.com wrote: My questions is if I should use #!/usr/bin/env python as the shebang line in a portable and open python script and if it does help with portability and usage. This question

Re: Q on explicitly calling file.close

2009-09-06 Thread Stephen Hansen
On Sun, Sep 6, 2009 at 4:31 PM, r rt8...@gmail.com wrote: On Sep 6, 1:14 pm, Jan Kaliszewski z...@chopin.edu.pl wrote: 05-09-2009 r rt8...@gmail.com wrote: i find the with statement (while quite useful in general practice) is not a cure all for situations that need and exception

Something confusing about non-greedy reg exp match

2009-09-06 Thread gburde...@gmail.com
If I do this: import re a=re.search(r'hello.*?money', 'hello how are you hello funny money') I would expect a.group(0) to be hello funny money, since .*? is a non-greedy match. But instead, I get the whole sentence, hello how are you hello funny money. Is this expected behavior? How can I

Module for Fisher's exact test?

2009-09-06 Thread gb345
Before I roll my own, is there a good Python module for computing the Fisher's exact test stastics on 2 x 2 contingency tables? Many thanks in advance, Gabe -- http://mail.python.org/mailman/listinfo/python-list

Re: Evil trend report - cancelled

2009-09-06 Thread John Nagle
Steven D'Aprano wrote: On Sat, 05 Sep 2009 22:43:17 -0700, John Nagle wrote: [snip] Test complete: Evil trend report Accidentally posted a private e-mail. Cancelled. Sorry. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: Something confusing about non-greedy reg exp match

2009-09-06 Thread r
On Sep 6, 9:46 pm, gburde...@gmail.com gburde...@gmail.com wrote: If I do this: import re a=re.search(r'hello.*?money',  'hello how are you hello funny money') I would expect a.group(0) to be hello funny money, since .*? is a non-greedy match. But instead, I get the whole sentence, hello

Re: Something confusing about non-greedy reg exp match

2009-09-06 Thread Mark Tolonen
gburde...@gmail.com wrote in message news:f98a6057-c35f-4843-9efb-7f36b05b6...@g19g2000yqo.googlegroups.com... If I do this: import re a=re.search(r'hello.*?money', 'hello how are you hello funny money') I would expect a.group(0) to be hello funny money, since .*? is a non-greedy match. But

Re: Something confusing about non-greedy reg exp match

2009-09-06 Thread r
EDIT: your regex matches the whole string because it means... hello followed by any number of *anythings* up to the first occurrence of money) you see? -- http://mail.python.org/mailman/listinfo/python-list

Re: Something confusing about non-greedy reg exp match

2009-09-06 Thread George Burdell
On Sep 6, 10:06 pm, Mark Tolonen metolone+gm...@gmail.com wrote: gburde...@gmail.com wrote in message news:f98a6057-c35f-4843-9efb-7f36b05b6...@g19g2000yqo.googlegroups.com... If I do this: import re a=re.search(r'hello.*?money',  'hello how are you hello funny money') I would expect

Re: Something confusing about non-greedy reg exp match

2009-09-06 Thread George Burdell
On Sep 6, 10:22 pm, George Burdell gburde...@gmail.com wrote: On Sep 6, 10:06 pm, Mark Tolonen metolone+gm...@gmail.com wrote: gburde...@gmail.com wrote in message news:f98a6057-c35f-4843-9efb-7f36b05b6...@g19g2000yqo.googlegroups.com... If I do this: import re

Re: The future of Python immutability

2009-09-06 Thread John Nagle
Bearophile wrote: John Nagle: The concept here is that objects have an owner, which is either a thread or some synchronized object. Locking is at the owner level. This is simple until ownership needs to be transferred. Can this be made to work in a Pythonic way, without explicit syntax?

Re: Something confusing about non-greedy reg exp match

2009-09-06 Thread George Burdell
On Sep 6, 10:06 pm, Mark Tolonen metolone+gm...@gmail.com wrote: gburde...@gmail.com wrote in message news:f98a6057-c35f-4843-9efb-7f36b05b6...@g19g2000yqo.googlegroups.com... If I do this: import re a=re.search(r'hello.*?money',  'hello how are you hello funny money') I would expect

Re: Something confusing about non-greedy reg exp match

2009-09-06 Thread Gary Herron
George Burdell wrote: On Sep 6, 10:06 pm, Mark Tolonen metolone+gm...@gmail.com wrote: gburde...@gmail.com wrote in message news:f98a6057-c35f-4843-9efb-7f36b05b6...@g19g2000yqo.googlegroups.com... If I do this: import re a=re.search(r'hello.*?money', 'hello how are you

Re: Something confusing about non-greedy reg exp match

2009-09-06 Thread Ben Finney
George Burdell gburde...@gmail.com writes: I want to find every occurrence of money, and for each occurrence, I want to scan back to the first occurrence of hello. How can this be done? By recognising the task: not expression matching, but lexing and parsing. For which you might find the

Re: The future of Python immutability

2009-09-06 Thread Steven D'Aprano
On Sun, 06 Sep 2009 06:18:23 -0700, Adam Skutt wrote: On Sep 5, 7:38 pm, Steven D'Aprano st...@remove- No. Lambdas are a *syntactical construct*, not an object. You wouldn't talk about while objects and if objects and comment objects *because they're not objects*. This rhetoric precludes

Re: The future of Python immutability

2009-09-06 Thread Steven D'Aprano
On Sun, 06 Sep 2009 10:12:56 -0400, Terry Reedy wrote: Adam Skutt wrote: There's nothing inappropriate about using a lambda for a function I don't care to give a name. That's the entire reason they exist. But you did give a name -- 'b' -- and that is when a lambda expression is

using python interpreters per thread in C++ program

2009-09-06 Thread grbgooglefan
Hi I've a multi-threaded C++ program, in which I want to use embedded python interpreter for each thread. I am using Python 2.6.2 on Linux for this. When I tried to embed python interpreter per thread, I got crash when the threads were calling Python's C APIs. Can we not use python interpreters

simple string question

2009-09-06 Thread jwither
Given a string (read from a file) which contains raw escape sequences, (specifically, slash n), what is the best way to convert that to a parsed string, where the escape sequence has been replaced (specifically, by a NEWLINE token)? James Withers --

Re: using python interpreters per thread in C++ program

2009-09-06 Thread sturlamolden
On 7 Sep, 07:17, grbgooglefan ganeshbo...@gmail.com wrote: What is best way to embed python in multi-threaded C++ application? Did you remeber to acquire the GIL? The GIL is global to the process (hence the name). void foobar(void) { PyGILState_STATE state = PyGILState_Ensure(); /*

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-06 Thread The Music Guy
On Sat, Sep 5, 2009 at 8:41 PM, Carl Bankspavlovevide...@gmail.com wrote: Out of curiosity, did you try this and are reporting that it resulted in an AttributeError, or did you merely deduce that it would raise AttributeError based on your knowledge of Python's inheritance? I ask this

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-06 Thread The Music Guy
Sorry, that last code had a typo in it: #!/usr/bin/python def main(): foox = FooX() fooy = FooY() fooz = FooZ() foox.method_x(I, AM, X) print fooy.method_x(ESTOY, Y, !) print fooz.method_x(100, 200, 300) class MyMixin(object): def method_x(self, a, b, c):

Re: The future of Python immutability

2009-09-06 Thread Terry Reedy
Dennis Lee Bieber wrote: On Sun, 06 Sep 2009 20:29:47 -0700, John Nagle na...@animats.com declaimed the following in gmane.comp.python.general: Python has the advantage that a sizable fraction of its objects, especially the very common ones like numbers and strings, are immutable.

[issue6836] Mismatching use of memory APIs

2009-09-06 Thread Tim Peters
Tim Peters tim.pet...@gmail.com added the comment: Yup, it's a good idea. In fact, storing info in the debug malloc blocks to identify the API family used was part of the plan, but got dropped when time ran out. serialno should not be abused for this purpose, though. On a 32-bit box, a 24-bit

[issue6846] bytearray.pop() returns negative ints

2009-09-06 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Fixed in r74673 (trunk), r74674 (release26-maint), r74675 (py3k) and r74676 (release31-maint). Thanks! -- nosy: +marketdickinson resolution: - fixed stage: - committed/rejected status: open - closed

[issue6847] Exception strings for bytearray say bytes

2009-09-06 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Thanks. Fixed in revisions r74677 through r74680. -- nosy: +marketdickinson resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org

[issue6802] build fails on Snow Leopard

2009-09-06 Thread Ronald Oussoren
Ronald Oussoren ronaldousso...@mac.com added the comment: Fixed in r74672 (trunk), r74681 (2.6), r74682 (3.x) and r74683 (3.1) With the default configure flags you'll end up with a 64-bit build of Python on Snow Leopard, including a 64-bit copy of IDLE. -- resolution: accepted - fixed

[issue6245] Add intel universal architecture on OSX

2009-09-06 Thread Ronald Oussoren
Ronald Oussoren ronaldousso...@mac.com added the comment: I've attached a new patch arch-intel-v2.patch that relects my current thinking about this patch. This adds two new options to the --with-univeral-archs option for configure: intel and 3-way. The former builds a universal binary with

[issue6812] Snow Leopard python program fails because _PyType_Modified is missing from python framework

2009-09-06 Thread Ronald Oussoren
Ronald Oussoren ronaldousso...@mac.com added the comment: This seems to be a problem with Apple's copy of Python or with your machine. Could you try the following: * In terminal.app run /usr/bin/python * Then use 'import objc' from Python's prompt. * Does this work or does it give the same

[issue5514] Darwin framework libpython3.0.a is not a normal static library

2009-09-06 Thread Ronald Oussoren
Ronald Oussoren ronaldousso...@mac.com added the comment: I'm closing this issue because the user does not respond to my questions and because I don't agree there is a problem. -- resolution: - invalid status: open - closed ___ Python tracker

[issue6552] Build Applet.app

2009-09-06 Thread Ronald Oussoren
Ronald Oussoren ronaldousso...@mac.com added the comment: Build Applet is not present in Python 3 because the implementation uses Python modules that aren't present in Python 3 (in particular the long deprecated Carbon bindings). The best alternative to the Build Applet functionality is

[issue6441] Tkinter cannot find *64 bit* Tcl/Tk on Mac OS X

2009-09-06 Thread Ronald Oussoren
Ronald Oussoren ronaldousso...@mac.com added the comment: I found an easier way to test with a 64-bit Tcl/Tk: run Snow Leopard ;-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6441 ___

[issue4937] Mac DMG install missing version.plist required by bundlebuilder.py

2009-09-06 Thread Ronald Oussoren
Ronald Oussoren ronaldousso...@mac.com added the comment: This will be fixed in the next release of 2.6 and 2.7: bundlebuilder shouldn't have tried to copy version.plist in the first place. The actual revisions in which this was fixed: r74684 (trunk), r74685 (2.6) -- resolution: -

[issue6802] build fails on Snow Leopard

2009-09-06 Thread Joshua Root
Joshua Root josh+pyt...@root.id.au added the comment: I tried release26-maint just now (r74683) and it errored out during make install. New log attached. -- Added file: http://bugs.python.org/file14846/release26-maint.log ___ Python tracker

[issue6839] zipfile can't extract file

2009-09-06 Thread Ronald Oussoren
Ronald Oussoren ronaldousso...@mac.com added the comment: The zipfile is technically incorrect, the zipfile specification prescribes that all filenames use '/' as the directory separator. Even without that caveat the file is corrupt because the zipfile directory header and the per-file header

[issue6802] build fails on Snow Leopard

2009-09-06 Thread Ronald Oussoren
Ronald Oussoren ronaldousso...@mac.com added the comment: Could you retry the build after cleaning the target directory? I've seem simular failures in the past and haven't been able to find the root cause of that problem. -- ___ Python tracker

[issue6802] build fails on Snow Leopard

2009-09-06 Thread Joshua Root
Joshua Root josh+pyt...@root.id.au added the comment: Tried again after ensuring that ~/test was completely empty; no difference. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6802 ___

[issue6848] curses module build failure (ncurses 5.7)

2009-09-06 Thread Mark Dickinson
New submission from Mark Dickinson dicki...@gmail.com: There seems to be a problem building the curses module on systems with ncurses 5.7. The following output was produced on OS X 10.6, on a trunk build; I'm not sure whether this problem is Mac-specific (or 64-bit specific). building

  1   2   >