473,378 Members | 1,383 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Whats up with re module vs pre

This is a very generic observation as I don't have a lot of specifics
with me right now. I have noticed over the past two years that the
python "re" module is somewhat unreliable. At the suggestion of
someone quite some time ago, I started to use the deprecated "pre"
module. "import pre as re". All my problems went away.

So here I am two years later, writing another script and I had
forgotten about "pre" and wallah

$ python proc.py
Traceback (most recent call last):
File "proc.py", line 39, in ?
c = collect("nohup.out")
File "proc.py", line 20, in collect
m = p.search(cont)
RuntimeError: maximum recursion limit exceeded

As soon as I switched "import re" to "import pre as re" my program
worked as expected. In the words of Jerry Sienfeld, what's up with
that?

Jul 18 '05 #1
2 1221
pythonUser_07 wrote:
This is a very generic observation as I don't have a lot of specifics
with me right now. I have noticed over the past two years that the
python "re" module is somewhat unreliable.
What do you mean with unreliable?
Can you show an example where re does not work as expected?
At the suggestion of
someone quite some time ago, I started to use the deprecated "pre"
module. "import pre as re". All my problems went away.

So here I am two years later, writing another script and I had
forgotten about "pre" and wallah

$ python proc.py
Traceback (most recent call last):
File "proc.py", line 39, in ?
c = collect("nohup.out")
File "proc.py", line 20, in collect
m = p.search(cont)
RuntimeError: maximum recursion limit exceeded

As soon as I switched "import re" to "import pre as re" my program
worked as expected. In the words of Jerry Sienfeld, what's up with
that?


Try again with Python 2.4. The re module is now non-recursive
(http://www.python.org/2.4/highlights.html), so you shouldn't get any
"maximum recursion limit exceeded" errors.
Bye,
Dennis
Jul 18 '05 #2
Like I said, I don't have a lot of specifics. This is more of an over
time experience.

I do know that any problem I had with "re" was always resolved by
"pre". Maybe they all had to do with recursion though.

Thanks for the heads up on python2.4. Now all I have to do is get our
admins to install... sigh

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: BillCo | last post by:
Does anyone know of a way to search through the SQL code of queries to find table name matches? Bear in mind there are literilly 1000's of queries in this database and doing it the old fashioned...
4
by: David Lozzi | last post by:
OK simple question. Whats the default value for an string() array? sub LoadStuff(byval one as integer, byval two as string, optional byval three() as string = ??) Its driving me nuts! ...
4
by: jerry.ranch | last post by:
Say, on a data entry form a "HELP" cmbBUTTON that bounces the user off to word file that has help, or is there some other way to do it (like a label object with help on another form) Thanks...
4
by: sophie | last post by:
Whats going on here: Read in a number as a string: scanf("%s", &number); number = 12345, for arguements sake Print it like this its fine:
28
by: mooreit | last post by:
The purpose for my questions is accessing these technologies from applications. I develop both applications and databases. Working with Microsoft C#.NET and Microsoft SQL Server 2000 Production and...
7
by: Mike Barnard | last post by:
It's a simple test... VERY SIMPLE. But... In an external stlyesheet some attributes don't show. With the same styles cut and pasted to the test internally it works as expected. Anyone tell...
7
by: Paulo | last post by:
Hi, what is diference between: File -New Web Site and File -New Project -VB/C# -Web Application ?????? VS 2005
7
by: Rohit | last post by:
Hi, I am working on a switch module which after reading voltage through a port pin and caterogizing it into three ranges(open,low or high), passes this range to a function switch_status() with...
26
by: Muzammil | last post by:
whats the beauty of "malloc" over "new" why its helpful for programmer.for its own memory area.??
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.