Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Fredrik Lundh
Roger L. Cauvin wrote: Good suggestion. Here are some test cases: xyz123aaabbab accept xyz123aabbaab reject xayz123aaabab accept xaaayz123abab reject xaaayz123aaabab accept $ more test.py import re print gotexpected print -- testsuite = ( (xyz123aaabbab, accept),

Re: Start a python interactive shell from python.

2006-01-26 Thread Bo Peng
I think I find what I need: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/355319 Bo -- http://mail.python.org/mailman/listinfo/python-list

Start a python interactive shell from python.

2006-01-26 Thread Bo Peng
Dear list, This may sound strange but I need to start a python shell from python. The motivation is that I have a bunch of (numeric) python functions to provide to a user. The best way I can think of is packing my python module using py2exe, and because it is easiest to let him run the

Re: Executing script with embedded python

2006-01-26 Thread Andrew Ayre
Farshid Lashkari [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] The problem is that PyObject_CallObject always returns NULL. Is this the correct return value for simply executing a script, as there is no function return value involved? The documentation for PyObject_CallObject

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Dave Hansen
On Thu, 26 Jan 2006 16:26:57 GMT in comp.lang.python, Roger L. Cauvin [EMAIL PROTECTED] wrote: Christos Georgiou [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] [...] Is this what you mean? ^[^a]*(a{3})(?:[^a].*)?$ Close, but the pattern should allow arbitrary sequence of

Re: Returning a tuple-struct

2006-01-26 Thread Christos Georgiou
On Thu, 19 Jan 2006 10:47:35 GMT, rumours say that Giovanni Bajo [EMAIL PROTECTED] might have written: I have a generic solution for this (never submitted to the cookbook... should I?) This is by Andrew Durdin: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303439 This is by me:

Re: Best way to extract an item from a set of len 1

2006-01-26 Thread Christophe
Alex Martelli a écrit : Fredrik Lundh [EMAIL PROTECTED] wrote: ... the obvious solution is item = list(s)[0] but that seems to be nearly twice as slow as [x for x in s][0] under 2.4. hmm. Funny, and true on my laptop too: helen:~ alex$ python -mtimeit -s's=set([23])'

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
Fredrik Lundh [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Roger L. Cauvin wrote: Good suggestion. Here are some test cases: xyz123aaabbab accept xyz123aabbaab reject xayz123aaabab accept xaaayz123abab reject xaaayz123aaabab accept $ more test.py import re print got

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Christos Georgiou
On Thu, 26 Jan 2006 18:01:07 +0100, rumours say that Fredrik Lundh [EMAIL PROTECTED] might have written: Roger L. Cauvin wrote: Good suggestion. Here are some test cases: xyz123aaabbab accept xyz123aabbaab reject xayz123aaabab accept xaaayz123abab reject xaaayz123aaabab accept $ more

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
Christos Georgiou [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Thu, 26 Jan 2006 16:41:08 GMT, rumours say that Roger L. Cauvin [EMAIL PROTECTED] might have written: Good suggestion. Here are some test cases: xyz123aaabbab accept xyz123aabbaab reject xayz123aaabab accept

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
Christos Georgiou [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Thu, 26 Jan 2006 16:26:57 GMT, rumours say that Roger L. Cauvin [EMAIL PROTECTED] might have written: Christos Georgiou [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Thu, 26 Jan 2006 14:09:54 GMT,

Re: How to handle two-level option processing with optparse

2006-01-26 Thread R. Bernstein
Steve Holden [EMAIL PROTECTED] writes: Well you are just as capable ... Yes, I guess you are right. Done. Couldn't find how to suggest an addition to the Python Cookbook (other than some generic O'Reilly email), so I've put a submission to: http://aspn.activestate.com/ASPN/Cookbook/Python/ --

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Christos Georgiou
On Thu, 26 Jan 2006 17:09:18 GMT, rumours say that Roger L. Cauvin [EMAIL PROTECTED] might have written: Thanks, but the second test case I listed contained a typo. It should have contained a sequence of three of the letter 'a'. The test cases should be: xyz123aaabbab accept xyz123aabbaaab

Re: Is there a way to profile underlying C++ code?

2006-01-26 Thread Christophe
Bo Peng a écrit : Travis E. Oliphant wrote: On Linux you can use oprofile (which is pretty nice and easy to use --- no recompiling. Just start the profiler, run your code, and stop the profiler). Thank you very much for the tip. This is a great tool. The source of the problem has

Ovum quote about Python

2006-01-26 Thread Pete Forman
In an article about the Royal Bank of Scotland working with Zope there is this quote from Gary Barnett, a research director at analyst firm Ovum: A lot of banks are using applications like Apache and Perl, but it's interesting to see they're using Python and Zope as it's moderately hardcore

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
Christos Georgiou [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Thu, 26 Jan 2006 18:01:07 +0100, rumours say that Fredrik Lundh [EMAIL PROTECTED] might have written: Roger L. Cauvin wrote: Good suggestion. Here are some test cases: xyz123aaabbab accept xyz123aabbaab reject

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Fredrik Lundh
Roger L. Cauvin wrote: $ python test.py gotexpected --- accept accept reject reject accept accept reject reject accept accept Thanks, but the second test case I listed contained a typo. It should have contained a sequence of three of the letter 'a'. The test

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
Christos Georgiou [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Thu, 26 Jan 2006 17:09:18 GMT, rumours say that Roger L. Cauvin [EMAIL PROTECTED] might have written: Thanks, but the second test case I listed contained a typo. It should have contained a sequence of three of the

mod_python, dates, strings and integers

2006-01-26 Thread marc . wyburn
when POSTing a date from an mod_python psp page to another the date is sent as a string. I'm using form.has_key to pull the POST. I can cut the string up,turn the strings into integers and then use datetime.datetime(y,m,d,hr,mn,se) to create a proper datetime. Is there a simpler way of doing

Re: How to handle two-level option processing with optparse

2006-01-26 Thread R. Bernstein
Magnus Lycka informs: [in response to my comment]: I see how I missed this. Neither disable_.. or enable_.. have document strings. And neither seem to described in the optparser section (6.21) of the Python Library (http://docs.python.org/lib/module-optparse.html).

Re: Tkinter listener thread?

2006-01-26 Thread Steve Holden
gregarican wrote: I have a Python UDP listener socket that waits for incoming data. The socket runs as an endless loop. I would like to pop the incoming data into an existing Tkinter app that I have created. What's the easiest/most efficient way of handling this? Would I create a separate

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
Fredrik Lundh [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Roger L. Cauvin wrote: $ python test.py gotexpected --- accept accept reject reject accept accept reject reject accept accept Thanks, but the second test case I listed contained a typo. It

Re: Using non-ascii symbols

2006-01-26 Thread Runsun Pan
On 1/26/06, Terry Hancock [EMAIL PROTECTED] wrote: On Thu, 26 Jan 2006 01:12:10 -0600 Runsun Pan [EMAIL PROTECTED] wrote: Error) in python. I'd love to see if I can use han char for all those keywords like import, but it doesn't work. Yeah, I'm pretty sure we're talking about the future

Re: Tkinter listener thread?

2006-01-26 Thread Jean-Paul Calderone
On 26 Jan 2006 08:46:11 -0800, gregarican [EMAIL PROTECTED] wrote: I have a Python UDP listener socket that waits for incoming data. The socket runs as an endless loop. I would like to pop the incoming data into an existing Tkinter app that I have created. What's the easiest/most efficient way of

exporting multiple modules from one dll?

2006-01-26 Thread Andras Balogh
I have a dll that contains all kinds of services (input, audio, video, etc..), and I would like to export these to Python as separate modules. Now, if I call Py_InitModule with a name that's different than the dll name, I get an error. So what can I do? Thanks, Andras --

Are there memory limits for external C modules?

2006-01-26 Thread david
I've been working on an external C module for Python in order to use some of the functionality from Ethereal. Right now I'm getting segfaults originating from within the Ethereal source code, but the same code works fine when used normally (i.e. through Ethereal or Tethereal). I'm wondering if

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Tim Chase
The below seems to pass all the tests you threw at it (taking the modified 2nd test into consideration) One other test that occurs to me would be xyz123aaabbaaabab where you have aaab in there twice. -tkc import re tests = [ (xyz123aaabbab,True), (xyz123aabbaaab, False),

Question about isinstance()

2006-01-26 Thread Mr.Rech
Hi all, I've read some thread about isinstance(), why it is considered harmful and how you can achieve the same results using a coding style that doesn't break polymorphism etc... Since I'm trying to improve my Python knowledge, and I'm going to design a class hierarchy from scratch, I'd like to

Re: Tkinter listener thread?

2006-01-26 Thread Grant Edwards
On 2006-01-26, Steve Holden [EMAIL PROTECTED] wrote: gregarican wrote: I have a Python UDP listener socket that waits for incoming data. The socket runs as an endless loop. I would like to pop the incoming data into an existing Tkinter app that I have created. What's the easiest/most

beta.python.org content

2006-01-26 Thread Steve Holden
How does http://beta.python.org/about/beginners/ look? regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.python.org/pycon/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Ovum quote about Python [OT]

2006-01-26 Thread Dave Benjamin
On Thu, 26 Jan 2006, Pete Forman wrote: In an article about the Royal Bank of Scotland working with Zope there is this quote from Gary Barnett, a research director at analyst firm Ovum: A lot of banks are using applications like Apache and Perl, but it's interesting to see they're using

Re: Executing script with embedded python

2006-01-26 Thread Andrew Ayre
Farshid Lashkari [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] The problem is that PyObject_CallObject always returns NULL. Is this the correct return value for simply executing a script, as there is no function return value involved? The documentation for PyObject_CallObject

Re: Are there memory limits for external C modules?

2006-01-26 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: I've been working on an external C module for Python in order to use some of the functionality from Ethereal. Right now I'm getting segfaults originating from within the Ethereal source code, but the same code works fine when used normally (i.e. through Ethereal or

Re: Question about isinstance()

2006-01-26 Thread Rene Pijlman
Mr.Rech: Now, avoiding isinstace() I've written the following code: class foo(object): ... def __eq__(self, other): try: return self.an_attribute == other.an_attribute except AttributeError: return False This may give unexpected results when you compare a foo

jython how to use Fit and Fitnesse

2006-01-26 Thread Mark Fink
Hi there, I want to ask how to use Fit and Fitnesse together to use testcases programmed in Jython. Resently I discussed with John Roth how PyFit would have to be changed to work together with Jython. This seems to be a lot of work and comes maybee with version 0.9 in mid 2006 if at all. I think

Re: Tkinter listener thread?

2006-01-26 Thread gregarican
Grant Edwards wrote: Unless tk.createfilehandler isn't supported no Wni32 platforms?? Unfortunately that's the case. As of Python 2.3.4 under Windows XP the createfilehandler method isn't available. It's only for UNIX as Mac platforms AFAIK. Shame, as it would be relatively easy to implement.

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Michael Spencer
Roger L. Cauvin wrote: Fredrik Lundh [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Roger L. Cauvin wrote: $ python test.py gotexpected --- accept accept reject reject accept accept reject reject accept accept Thanks, but the second test case I listed

Re: exporting multiple modules from one dll?

2006-01-26 Thread Farshid Lashkari
I have a dll that contains all kinds of services (input, audio, video, etc..), and I would like to export these to Python as separate modules. Now, if I call Py_InitModule with a name that's different than the dll name, I get an error. So what can I do? I believe you can export different

Re: beta.python.org content

2006-01-26 Thread Rinzwind
I am not a design professional but since you didn't ask for professionals but for beginners ;-) ... - At the left hand side you used abbreviations (like PSF). Using the full name says more about the option. - I don't like capitals alot either (as used in the menu). - The corporate look of the

Re: Question about isinstance()

2006-01-26 Thread Mr.Rech
Mmm... I've not considered such an event... Would you say it is one of those rare case in which isinstance() can be used? Any other suggestion? Thanks, Andrea -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about isinstance()

2006-01-26 Thread Dave Benjamin
On Thu, 26 Jan 2006, Mr.Rech wrote: I've read some thread about isinstance(), why it is considered harmful and how you can achieve the same results using a coding style that doesn't break polymorphism etc... Since I'm trying to improve my Python knowledge, and I'm going to design a class

Re: Start a python interactive shell from python.

2006-01-26 Thread Fernando Perez
Bo Peng wrote: I think I find what I need: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/355319 That's a nice, lightweight one. Note that if you want to have all the bells and whistles of ipython (and you have ipython already), then a simple if __name__ == '__namin__': from

loading modules in debug

2006-01-26 Thread Andras Balogh
The project I'm working on is written mainly C/C++, spiced with some Python scripts. Now, I have several dlls, which work both as a Python extension modules, exporting functions to Python via initmodule, and as normal dynamic libraries, to which I link dynamically from within my C program.

Re: exporting multiple modules from one dll?

2006-01-26 Thread Andras Balogh
This worked, thanks! Farshid Lashkari wrote: I believe you can export different modules from one dll, but you *MUST* at least export a module that has the same name as the dll. -- http://mail.python.org/mailman/listinfo/python-list

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
Michael Spencer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Roger L. Cauvin wrote: xyz123aaabbab accept xyz123aabbaaab reject xayz123aaabab accept xaaayz123abab reject xaaayz123aaabab accept This passes your tests. I haven't closely followed the thread for other

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
Tim Chase [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] The below seems to pass all the tests you threw at it (taking the modified 2nd test into consideration) One other test that occurs to me would be xyz123aaabbaaabab where you have aaab in there twice. Good suggestion.

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Tim Chase
xyz123aaabbaaabab where you have aaab in there twice. Good suggestion. I assumed that this would be a valid case. If not, the expression would need tweaking. ^([^b]|((?!a)b))*aaab+[ab]*$ Looks good, although I've been unable to find a good explanation of the negative lookbehind

Re: Mining strings from a HTML document.

2006-01-26 Thread Runsun Pan
def extract(text,s1,s2): ''' Extract strings wrapped between s1 and s2. t=this is a spantest/span for spanextract()/span that spandoes multiple extract/span extract(t,'span','/span') ['test', 'extract()', 'does multiple extract'] '''

Re: Question about isinstance()

2006-01-26 Thread Rocco Moretti
Dave Benjamin wrote: On Thu, 26 Jan 2006, Mr.Rech wrote: Suppose I'm writing a base class with an __eq__ special methods, using isinstance() I would have wrote: class foo(object): ... def __eq__(self, other): return isinstance(other, type(self)) and self.an_attribute ==

Re: List of files to be opened

2006-01-26 Thread Ken Starks
yawgmoth7 wrote: Hello, I am currently writing a script that requires a few different files to be opened, and examined. What I need to be able to do is use something like: filelist = os.system(ls) Some way to open the file list and read each file one by one here I cannot think of a way

Re: List of files to be opened

2006-01-26 Thread Carl J. Van Arsdall
Ken Starks wrote: yawgmoth7 wrote: Hello, I am currently writing a script that requires a few different files to be opened, and examined. What I need to be able to do is use something like: filelist = os.system(ls) Some way to open the file list and read each file one by one here

Re: Possible memory leak?

2006-01-26 Thread Tuvas
I have made one confirmation. The only identifiable difference that I have seen is that one runs on python 2.4.2, and the other 2.4.1. Oddly enough, it's the first one that's the one that is having more problems than the second... Why that is, I don't know. It still could be something else, but...

Re: Tkinter listener thread?

2006-01-26 Thread gregarican
Steve Holden wrote: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82965 Thanks. I tried a variation of this Queue posting/Flag checking method and it worked to a tee. The problem was that my UDP socket query was blocking things so that thread was hanging everything up. So I used a

Re: List of files to be opened

2006-01-26 Thread Fredrik Lundh
Carl J. Van Arsdall wrote: os.walk is your friend. Its has wonderful functionality. Don't you mean os.path.walk ? os.walk is a generator-based version of os.path.walk. instead of putting the logic in a callback function, you put it in a for loop: for root, dirs, files in os.walk(top):

Re: beta.python.org content

2006-01-26 Thread Peter Maas
Steve Holden schrieb: How does http://beta.python.org/about/beginners/ look? I like it :) Some minor points: - The logo does indeed resemble a cross. How about rotating it at 45 deg to make it look like an x? Or give it a circular shape? Please note that there are no religious

Re: beta.python.org content

2006-01-26 Thread Roel Schroeven
Steve Holden schreef: How does http://beta.python.org/about/beginners/ look? I think it's OK, apart from the fact that the font size of the text overrides my browser's default. It looks and reads much better without the font-size: 75%. -- If I have been able to see further, it was

Re: Question about isinstance()

2006-01-26 Thread Dave Benjamin
On Thu, 26 Jan 2006, Rocco Moretti wrote: You were better off with what you had before. Equality in this case is left completely open-ended, and as a result, there is no way that you can guarantee that a == b is the same as b == a if a is a foo and b is of unknown type. This can lead to

Re: Question about isinstance()

2006-01-26 Thread Dave Benjamin
On Thu, 26 Jan 2006, Dave Benjamin wrote: On Thu, 26 Jan 2006, Rocco Moretti wrote: You were better off with what you had before. Equality in this case is left completely open-ended, and as a result, there is no way that you can guarantee that a == b is the same as b == a if a is a foo and

Re: beta.python.org content

2006-01-26 Thread Paddy
I find it much better than the current site, thank you! Whilst reading, http://beta.python.org/about/ I had some slight niggles. What do you think about the following changes? About Python Python is an agile programming language often compared to Tcl, Perl, Ruby, Scheme or Java. While it has

Re: Question about isinstance()

2006-01-26 Thread Mr.Rech
All in all it seems that the implementation that uses isinstance() is better in this case... Thanks for your comments, Andrea. -- http://mail.python.org/mailman/listinfo/python-list

Re: beta.python.org content

2006-01-26 Thread Tony Meyer
- The logo does indeed resemble a cross. How about rotating it at 45 deg to make it look like an x? Or give it a circular shape? Please note that there are no religious motives in this remark :) -1. Then what are the motives? A rotated cross looks a lot less clean. Take a look at

Re: Assigning to self.__class__

2006-01-26 Thread Terry Reedy
Paul McGuire [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have some places in pyparsing where I've found that the most straightforward way to adjust an instance's behavior is to change its class. I do this by assigning to self.__class__, and things all work fine. (Converting

Changing numbers into characters using dictionaries

2006-01-26 Thread Danny
Hello again, I am now trying to make something to change some encrypted text into some plain text, here is the code I have so far: text = '@[EMAIL PROTECTED]@[EMAIL PROTECTED]' // some text num = '213654' // Number s1 = '700' s2 = '770' s4 = '707' // it adds these later on. t = text.split('@')

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Peter Hansen
Roger L. Cauvin wrote: Michael Spencer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Roger L. Cauvin wrote: xyz123aaabbab accept xyz123aabbaaab reject xayz123aaabab accept xaaayz123abab reject xaaayz123aaabab accept This passes your tests. I haven't closely followed the thread

How to run a dos executable from python

2006-01-26 Thread lblr33
I have an executable (e.g. myprog.exe) which takes some set number of arguments. This command works ok: os.system(rc:\tmp\myprog.exe arg1 arg2 arg3) The problem is that the path to the program and the arguments are variable at runtime so I need to pass them as arguments. Thanks --

Re: How to run a dos executable from python

2006-01-26 Thread Fredrik Lundh
lblr33 wrote: I have an executable (e.g. myprog.exe) which takes some set number of arguments. This command works ok: os.system(rc:\tmp\myprog.exe arg1 arg2 arg3) The problem is that the path to the program and the arguments are variable at runtime so I need to pass them as arguments.

Re: Changing numbers into characters using dictionaries

2006-01-26 Thread Larry Bates
Danny wrote: Hello again, I am now trying to make something to change some encrypted text into some plain text, here is the code I have so far: text = '@[EMAIL PROTECTED]@[EMAIL PROTECTED]' // some text num = '213654' // Number s1 = '700' s2 = '770' s4 = '707' // it adds these later

2-dimensional data structures

2006-01-26 Thread anthonyberet
Hello again - rather a newbie here... I want to work on a sudoku brute-forcer, just for fun. I am considering different strategies, but first I need to decide on the data-structure to use for the progress/solution grid. This being a square, I would have used a 9x9 2-dimensional array in my

Re: How to run a dos executable from python

2006-01-26 Thread Larry Bates
lblr33 wrote: I have an executable (e.g. myprog.exe) which takes some set number of arguments. This command works ok: os.system(rc:\tmp\myprog.exe arg1 arg2 arg3) The problem is that the path to the program and the arguments are variable at runtime so I need to pass them as arguments.

Re: 2-dimensional data structures

2006-01-26 Thread Carl J. Van Arsdall
anthonyberet wrote: Hello again - rather a newbie here... I want to work on a sudoku brute-forcer, just for fun. I am considering different strategies, but first I need to decide on the data-structure to use for the progress/solution grid. This being a square, I would have used a 9x9

Re: Changing numbers into characters using dictionaries

2006-01-26 Thread snoe
Ok there's a couple things going on here. t = text.split('@') // splits the digits/blocks apart from each other this will give you a list: ['', '7706', '7002', '7075', '7704'] You may want to change the line to skip the first empty value: t = text.split('@')[1:] Next your loop. something = 1

Re: 2-dimensional data structures

2006-01-26 Thread Carl Cerecke
anthonyberet wrote: Hello again - rather a newbie here... I want to work on a sudoku brute-forcer, just for fun. I know what you mean. I wrote one just for fun too. I am considering different strategies, but first I need to decide on the data-structure to use for the progress/solution

Re: 2-dimensional data structures

2006-01-26 Thread Larry Bates
anthonyberet wrote: Hello again - rather a newbie here... I want to work on a sudoku brute-forcer, just for fun. I am considering different strategies, but first I need to decide on the data-structure to use for the progress/solution grid. This being a square, I would have used a 9x9

Re: 2-dimensional data structures

2006-01-26 Thread Tim Chase
I want to work on a sudoku brute-forcer, just for fun. Well, as everybody seems to be doing these (self included...), the sudoku solver may become the hello world of the new world :) What is the equivalent way to store data in python? - It isn't obvious to me how to do it with lists.

Re: How to handle two-level option processing with optparse

2006-01-26 Thread Steven Bethard
R. Bernstein wrote: Magnus Lycka informs: [in response to my comment]: I see how I missed this. Neither disable_.. or enable_.. have document strings. And neither seem to described in the optparser section (6.21) of the Python Library (http://docs.python.org/lib/module-optparse.html).

Re: beta.python.org content

2006-01-26 Thread Peter Maas
Tony Meyer schrieb: - The logo does indeed resemble a cross. How about rotating it at 45 deg to make it look like an x? Or give it a circular shape? Please note that there are no religious motives in this remark :) -1. Then what are the motives? I don't like the shape. Snakes and

Re: www.mywebsite.py

2006-01-26 Thread Terry Reedy
Fuzzyman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Simon Brunning wrote: On 1/24/06, Cyril Bazin [EMAIL PROTECTED] wrote: Does someone ever tried (and succeed) to make an address like www.website.py. I found that the .py extension is given to the paraguay. I found

Re: beta.python.org content

2006-01-26 Thread Rocco Moretti
Peter Maas wrote: - The logo does indeed resemble a cross. How about rotating it at 45 deg to make it look like an x? Or give it a circular shape? Please note that there are no religious motives in this remark :) It looks like a plus sign to me. Do you also advocate renaming C++ to Cxx

Re: 2-dimensional data structures

2006-01-26 Thread Claudio Grondi
anthonyberet wrote: Hello again - rather a newbie here... I want to work on a sudoku brute-forcer, just for fun. I am considering different strategies, but first I need to decide on the data-structure to use for the progress/solution grid. This being a square, I would have used a 9x9

Automatic Logging

2006-01-26 Thread [EMAIL PROTECTED]
Sorry if this is a FAQ but Google returns a *lot* of results for Python Logging :-) I am looking for a tool that will automatically add logging to existing code e.g. Function Entries and Exits, Return values etc. Thanks, Davy Mitchell Mood News - BBC News Headlines Auto-Classified as Good,

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
Peter Hansen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Roger L. Cauvin wrote: Michael Spencer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Roger L. Cauvin wrote: xyz123aaabbab accept xyz123aabbaaab reject xayz123aaabab accept xaaayz123abab reject xaaayz123aaabab

Running a DOS exe file from python

2006-01-26 Thread lblr33
I would like to execute a windows program from python and wait for it to finish before returning to the python script. The script I want to run has a set number of arguments. The following does work fine: os.system(rc:\tmp\myprog.exe arg1 arg2 arg3) The problem I have is that the path to

ODBC

2006-01-26 Thread lblr33
I would like to connect to an Oracle database. In python version 2.1 I used the following code and it worked fine. When I run the code in version 2.4 it says that the odbc moduled does not exist. How do you connect to an Oracle database in v2.4? oradb=odbc.odbc('oracle/scott/tiger')

Re: Running a DOS exe file from python

2006-01-26 Thread lblr33
I posted this earlier on yahoo groups and then realized that the most recent post was 2003. What I didn't realize is that it posted to this group so I posted it again. The other post is:

Re: Possible memory leak?

2006-01-26 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Tuvas wrote: The modified version of my code is now as follows: (Note, a few small changes have been made to simplify things, however, these things don't apply to a full-scale picture, so the shouldn't slow anything down in the slightest.) def

Re: Question about isinstance()

2006-01-26 Thread Steven D'Aprano
On Thu, 26 Jan 2006 19:04:13 +0100, Rene Pijlman wrote: Mr.Rech: Now, avoiding isinstace() I've written the following code: class foo(object): ... def __eq__(self, other): try: return self.an_attribute == other.an_attribute except AttributeError: return False

Re: Are there memory limits for external C modules?

2006-01-26 Thread [EMAIL PROTECTED]
Fredrik Lundh wrote: [EMAIL PROTECTED] wrote: I've been working on an external C module for Python in order to use some of the functionality from Ethereal. Right now I'm getting segfaults originating from within the Ethereal source code, but the same code works fine when used normally

Re: Question about isinstance()

2006-01-26 Thread Rocco Moretti
Mr.Rech wrote: All in all it seems that the implementation that uses isinstance() is better in this case... Well what's better depends on what you want to happen when you compare an unrelated class that also defines 'an_attribute'. Unlike in statically typed languages, certain things are made

Re: beta.python.org content

2006-01-26 Thread Claudio Grondi
Peter Maas wrote: Tony Meyer schrieb: - The logo does indeed resemble a cross. How about rotating it at 45 deg to make it look like an x? Or give it a circular shape? Please note that there are no religious motives in this remark :) -1. Then what are the motives? I don't like

Re: beta.python.org content

2006-01-26 Thread James Stroud
Paddy wrote: I find it much better than the current site, thank you! Whilst reading, http://beta.python.org/about/ I had some slight niggles. What do you think about the following changes? About Python Python is an agile programming language often compared to Tcl, Perl, Ruby, Scheme

Re: beta.python.org content

2006-01-26 Thread James Stroud
Rocco Moretti wrote: (Not that I like the logo, mind you...) Does anyone? There has to be a better logo! I thought the previous requirement as established by the BDFL was no snakes. These are snakes, and they have no personality to boot. -- http://mail.python.org/mailman/listinfo/python-list

Re: Using non-ascii symbols

2006-01-26 Thread Christoph Zwerschke
Claudio Grondi wrote: Speaking maybe only for myself: I don't like implicit rules, so I don't like also any precedence hierarchy being in action, so for safety reasons I always write even 8+6*2 (==20) as 8+(6*2) to be sure all will go the way I expect it. But for people who often use

Re: beta.python.org content

2006-01-26 Thread James Stroud
Claudio Grondi wrote: It looks very commercial and has not the _fun_ and _ease_ in it I get used to face when dealing with Python related icons. The whole site is just as any other more or less commercial site and even if it is sure much better than the old one, I will probably miss the

generating method names 'dynamically'

2006-01-26 Thread Daniel Nogradi
Is it possible to have method names of a class generated somehow dynamically? More precisely, at the time of writing a program that contains a class definition I don't know what the names of its callable methods should be. I have entries stored in a database that are changing from time to time

[IDE] - The Dynamic Opportunity - ActiveState Komodo IDE / Open Source

2006-01-26 Thread Ilias Lazaridis
followup to comp.lang.perl.misc [I will read the other groups, too] - The following suggestions result out of an one-day website review of Active State [1]. - http://lazaridis.com/samples/com/ActiveState/ *Suggestions:* Near Future: *Open* Source the Komodo IDE. Immediately: *Free*

Python String Substitution

2006-01-26 Thread Murali
In Python, dictionaries can have any hashable value as a string. In particular I can say d = {} d[(1,2)] = Right d[(1,2)] = Wrong d[key] = test In order to print test using % substitution I can say print %(key)s % d Is there a way to print Right using % substitution? print %((1,2))s % d

Re: generating method names 'dynamically'

2006-01-26 Thread Farshid Lashkari
Is it possible to have method names of a class generated somehow dynamically? If you don't know the name of the method ahead of time, how do you write the code for it? Do you use some dummy name? If so, once you have the name determined then you could use setattr to set the method name.

Re: Automatic Logging

2006-01-26 Thread Peter Hansen
[EMAIL PROTECTED] wrote: Sorry if this is a FAQ but Google returns a *lot* of results for Python Logging :-) I am looking for a tool that will automatically add logging to existing code e.g. Function Entries and Exits, Return values etc. Perhaps you are looking for nothing more than this

Re: generating method names 'dynamically'

2006-01-26 Thread Murali
import inspect x = ABC() # create an instance of class ABC print inspect.getmembers(x,inspect.ismethod) Most of any introspection stuff can be done using the module inspect. -- http://mail.python.org/mailman/listinfo/python-list

Re: generating method names 'dynamically'

2006-01-26 Thread Peter Hansen
Daniel Nogradi wrote: Is it possible to have method names of a class generated somehow dynamically? More precisely, at the time of writing a program that contains a class definition I don't know what the names of its callable methods should be. I have entries stored in a database that are

<    1   2   3   >