Re: How to read space separated file in python?

2008-11-21 Thread ganesh gajre
Hey Steve and Joe , Thank you very much. There is yet little problem. But sure all the Pythonist will help me in that. Ginovation, "Every thing is impossible unless you make it possible" On Sat, Nov 22, 2008 at 5:10 AM, Steve Holden <[EMAIL PROTECTED]> wrote: > Joe Strout wrote: > [...] > > Par

Re: Best strategy for finding a pattern in a sequence of integers

2008-11-21 Thread Gerard flanagan
Slaunger wrote: Hi Gerard, This definitely looks like a path to walk along, and I think your code does the trick, although I have to play a little around with the groupby method, of which I had no prior knowledge. I think I will write some unit test cases to stress test you concept (on Monday, wh

Re: Best strategy for finding a pattern in a sequence of integers

2008-11-21 Thread Gerard flanagan
Anton Vredegoor wrote: On Fri, 21 Nov 2008 18:10:02 +0100 Gerard flanagan <[EMAIL PROTECTED]> wrote: data = ''' 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3

Re: Need help converting text to csv format

2008-11-21 Thread John Machin
On Nov 22, 11:04 am, r0g <[EMAIL PROTECTED]> wrote: > >> On Nov 21, 10:18 am, Chuck Connors <[EMAIL PROTECTED]> wrote: > >>> Any help, pseudo code, or whatever push in the right direction would > >>> be most appreciated.  I am a novice Python programmer but I do have a > >>> good bi

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-21 Thread greg
Aaron Brady wrote: Call-by-value has other characteristics that Python does not meet. The designers of most other dynamic languages don't seem to share that opinion, since they use the term call-by-value just as though it *does* mean call- by-assignment and nothing more. -- Greg -- http://mai

Re: RELEASED Python 3.0rc3

2008-11-21 Thread Mensanator
On Nov 21, 9:06 am, Barry Warsaw <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On behalf of the Python development team and the Python community, I   > am happy to announce the third and last planned release candidate for   > Python 3.0. > > This is a release cand

Re: Re: how to get all repeated group with regular expression

2008-11-21 Thread scsoce
MRAB wrote: Steve Holden wrote: Please keep this on the list. scsoce wrote: Steve Holden wrote: scsoce wrote: say, when I try to search and match every char from variable length string, such as string '123456', i tried re.findall( r'(\d)*, '12346' ) I think you will find you misse

Re: initialization in argument definitions

2008-11-21 Thread Terry Reedy
George Sakkis wrote: On Nov 21, 4:25 pm, Brentt <[EMAIL PROTECTED]> wrote: Hi, I know this is a terribly simple question, but the docs seem to be designed for people who probably find a the answer to this question terribly obvious. But its not at all obvious to me. Don't worry, it's not obvio

Re: how to dynamically instantiate an object inheriting from several classes?

2008-11-21 Thread Steven D'Aprano
On Fri, 21 Nov 2008 15:11:20 -0700, Joe Strout wrote: > I have a function that takes a reference to a class, Hmmm... how do you do that from Python code? The simplest way I can think of is to extract the name of the class, and then pass the name as a reference to the class, and hope it hasn't

Re: 404 not found on for Python 2.6 Itanium

2008-11-21 Thread Terry Reedy
Christopher wrote: Yes. It's too much effort to build, and too few users that actually use it. Users are still free to build it themselves, and to share the build with others. I guess that I don't understand why you feel there is so much effort involved. I developed a set of makefiles that bui

Re: initialization in argument definitions

2008-11-21 Thread Steven D'Aprano
On Fri, 21 Nov 2008 13:25:45 -0800, Brentt wrote: > I can't figure out why when I define a function, a variable > (specifically a list) that I define and initialize in the argument > definitions, will not initialize itself every time its called. Because you haven't told the function to initializ

Re: Best strategy for finding a pattern in a sequence of integers

2008-11-21 Thread Paul McGuire
So I think you just need to find the first two complete sequences of 1,6,10 and 0,3,9, remove any repetitions and then you're done. data = ''' 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 7 3 0 3 3 0 3 3 0 10 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 10 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3

Re: how to dynamically instantiate an object inheriting from several classes?

2008-11-21 Thread Steve Holden
Joe Strout wrote: > On Nov 21, 2008, at 6:06 PM, Ned Deily wrote: > >>> Where would I find documentation on this nifty function? >> >> Where built-in functions are documented, the Python Library Reference: >> >> > > Perfect, thank you. (O

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-21 Thread Aaron Brady
On Nov 21, 7:06 pm, greg <[EMAIL PROTECTED]> wrote: > Aaron Brady wrote: > > Tell me, what happens during a call to the following C++ function? > > > void f( std::vector< int > x ); > > The same thing as would happen if you wrote > >    std::vector x = actual_parameter_expression; > > > what happen

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-21 Thread greg
Steven D'Aprano wrote: You've just *assumed* that assignment in Algol 60 doesn't involving copying. I've done no such thing. I've *refrained* from assuming that the "assignment" in the definition always has to refer to Algol 60 assignment. You're the one insisting on tying everything to Algol.

Re: how to dynamically instantiate an object inheriting from several classes?

2008-11-21 Thread Joe Strout
On Nov 21, 2008, at 6:06 PM, Ned Deily wrote: Where would I find documentation on this nifty function? Where built-in functions are documented, the Python Library Reference: Perfect, thank you. (Odd that the index entry for type() d

Re: RELEASED Python 3.0rc3

2008-11-21 Thread James Mills
On Sat, Nov 22, 2008 at 1:06 AM, Barry Warsaw <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On behalf of the Python development team and the Python community, I am > happy to announce the third and last planned release candidate for Python > 3.0. Whoohoo! :) Grea

Re: Python 3 __cmp__ semantic change?

2008-11-21 Thread Steven D'Aprano
On Fri, 21 Nov 2008 17:26:21 +, Arnaud Delobelle wrote: [...] > As classes can be decorated in Python 3, you can write a decorator to > make a class totally ordered. Here is a very simplified proof of > concept such decorator: > > def totally_ordered(cls): > if not hasattr(cls, '__gt__')

Re: how to dynamically instantiate an object inheriting from several classes?

2008-11-21 Thread Ned Deily
In article <[EMAIL PROTECTED]>, Joe Strout <[EMAIL PROTECTED]> wrote: > On Nov 21, 2008, at 3:30 PM, Arnaud Delobelle wrote: > > Of course it's possible: use type(name, bases, dict). > Thanks, I never knew about that form of type(). Neither does the > 2.5.2 reference manual, whose only index en

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-21 Thread greg
Aaron Brady wrote: Tell me, what happens during a call to the following C++ function? void f( std::vector< int > x ); The same thing as would happen if you wrote std::vector x = actual_parameter_expression; what happens during a call to the following Python function? def f( x ): ... T

Re: Need help converting text to csv format

2008-11-21 Thread alex23
On Nov 22, 2:28 am, Joe Strout <[EMAIL PROTECTED]> wrote: > A follow-up question here... is it really necessary to close things   > like files in Python? Not if you use a context manager (2.6+, available in 2.5 from __future__): with open('data.csv', 'wb') as csvfile: writer = csv.writer(csvfil

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-21 Thread greg
Aaron Brady wrote: But wait, is that true assignment? It's assignment, but it's not really copying an object. No new objects are being created -- rather, some of the items within the lhs object are being rebound to already-existing objects. It would be possible for the lhs object's __setitem_

Re: 404 not found on for Python 2.6 Itanium

2008-11-21 Thread r0g
Martin v. Löwis wrote: >> In any case, my concern with dropping a stock python itanium distro >> involves the vastly diminished probability that others will provide >> Itanium versions of, for example py2exe and pywin32. > > Well, I had been providing Itanium binaries for 2.4 and 2.5, and neither

Re: Best strategy for finding a pattern in a sequence of integers

2008-11-21 Thread Slaunger
On 21 Nov., 18:10, Gerard flanagan <[EMAIL PROTECTED]> wrote: > Slaunger wrote: > > Hi all, > > > I am a Python novice, and I have run into a problem in a project I am > > working on, which boils down to identifying the patterns in a sequence > > of integers, for example > > > 1 6 6 1 6 6 1 6

Re: Best strategy for finding a pattern in a sequence of integers

2008-11-21 Thread Slaunger
On 21 Nov., 23:36, Mensanator <[EMAIL PROTECTED]> wrote: > Your rules appear to be incomplete and inconsistent. OK. Let me try to clarify then... > > 3. Pattern A only consists of the numbers 0, 3, and 9. 3, 3 is always > > followed by 0 > > But does a 3 always follow a 3? Can you have 3, 0, 3, 0?

Re: Best strategy for finding a pattern in a sequence of integers

2008-11-21 Thread Slaunger
> > > I am pretty sure I can figure out how to do that, but I would like to > > have some guidance on the most pythonic approach to this. > > Then it would be a good starting point to write some code. Then you > could post it and ask how it can be made more 'pythonic'. > That is actually a good poi

Re: Need help converting text to csv format

2008-11-21 Thread r0g
>> On Nov 21, 10:18 am, Chuck Connors <[EMAIL PROTECTED]> wrote: >>> Any help, pseudo code, or whatever push in the right direction would >>> be most appreciated. I am a novice Python programmer but I do have a >>> good bit of PHP programming experience. John Machin wrote: > If

Re: Programming exercises/challenges

2008-11-21 Thread Edwin
On Nov 20, 10:32 pm, [EMAIL PROTECTED] wrote: >     >> I am constantly amazed at work that people open a separate emacs for >     >> each file they want to edit.  Most of them seem not to even know that >     >> find-file exists. > >     Edwin> Come on mate... it's already a bit hard to post in a n

Re: Custom Formatting The Output Of subprocess.Popen

2008-11-21 Thread Steve Holden
[EMAIL PROTECTED] wrote: > On Nov 21, 8:50 pm, Scott David Daniels <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >>> Hello, >>> I'm launching a script as follows: >>> >>> p = subprocess.Popen(['./p.py', 'aa']) >>> p.wait() >>> >>> If p.py writes to sys.stdout, then it is shown on t

Re: Using eval, or something like it...

2008-11-21 Thread r0g
Scott David Daniels wrote: > I forgot to include a few cases: > > (1) Inspired by your calling the class attributes "templates": I did no such thing, I likened classes to templates and as far as I can tell they are _like_ templates albeit dynamic ones. > class Demo3(object): > All the abov

Re: How to read space separated file in python?

2008-11-21 Thread Steve Holden
Joe Strout wrote: [...] > Partition handles these cases correctly (at least, within the OP's > specification that the value of "b" should be whatever comes after the > first space). I believe if you read the OP's post again you will see that he specified two non-space items per line. You really *

Re: Best strategy for finding a pattern in a sequence of integers

2008-11-21 Thread Anton Vredegoor
On Fri, 21 Nov 2008 18:10:02 +0100 Gerard flanagan <[EMAIL PROTECTED]> wrote: > data = ''' > 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6 > 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6 > 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 1

Re: RELEASED Python 3.0rc3

2008-11-21 Thread Steve Holden
Terry Reedy wrote: > Barry Warsaw wrote: >> >>http://www.python.org/download/releases/3.0/ > > The new Windows binaries are already present. > Yeah, what's up with that? Until now we've been able to complain at the release manager for announcing a release before the Windows binaries are avail

Re: matching exactly a 4 digit number in python

2008-11-21 Thread harijay
Thanks John Machin and Mark Tolonen .. SO I guess the correct one is to use the word boundary meta character "\b" so r'\b\d{4}\b' is what I need since it reads a 4 digit number in between word boundaries Thanks a tonne, and this being my second post to comp.lang.python. I am always amazed at ho

Re: Module Structure/Import Design Problem

2008-11-21 Thread Steve Holden
Stef Mientki wrote: > Gabriel Genellina wrote: [...] > Sorry I don't understand all that pep-talk (I'm not a programmer ;-) And I'm not a plumber. The difference between us is that I don't write blogs telling people how to lay out and connect their pipework. regards Steve PS: Q: What's the diff

Re: initialization in argument definitions

2008-11-21 Thread Egon Frerich
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Brentt schrieb: | Hi, I know this is a terribly simple question, but the docs seem to be | designed for people who probably find a the answer to this question | terribly obvious. But its not at all obvious to me. | | I can't figure out why when I defi

Re: matching exactly a 4 digit number in python

2008-11-21 Thread skip
>> I am a few months new into python. I have used regexps before in perl >> and java but am a little confused with this problem. >> I want to parse a number of strings and extract only those that >> contain a 4 digit number anywhere inside a string >> However the regexp >

Re: matching exactly a 4 digit number in python

2008-11-21 Thread MRAB
George Sakkis wrote: On Nov 21, 4:46 pm, harijay <[EMAIL PROTECTED]> wrote: Hi I am a few months new into python. I have used regexps before in perl and java but am a little confused with this problem. I want to parse a number of strings and extract only those that contain a 4 digit number any

Re: Python / Debian package dependencies

2008-11-21 Thread Stephane Bulot
Steven, apt-get uses /etc/apt/sources.list file to know where packages must be downloaded from. Usually from a http repository. But, you can use a file destination: deb file:/path/to/file unstable main contrib non-free I advise you to read the debian maintainer guide and the apt-get and sources.l

Re: how to dynamically instantiate an object inheriting from several classes?

2008-11-21 Thread Joe Strout
On Nov 21, 2008, at 3:30 PM, Arnaud Delobelle wrote: Of course it's possible: use type(name, bases, dict). Thanks, I never knew about that form of type(). Neither does the 2.5.2 reference manual, whose only index entry for the type() function is

Re: RELEASED Python 3.0rc3

2008-11-21 Thread Terry Reedy
Barry Warsaw wrote: http://www.python.org/download/releases/3.0/ The new Windows binaries are already present. -- http://mail.python.org/mailman/listinfo/python-list

Re: initialization in argument definitions

2008-11-21 Thread Terry Reedy
Brentt wrote: Hi, I know this is a terribly simple question, but the docs seem to be designed for people who probably find a the answer to this question terribly obvious. But its not at all obvious to me. I can't figure out why when I define a function, a variable (specifically a list) that I de

Re: how to dynamically instantiate an object inheriting from several classes?

2008-11-21 Thread George Sakkis
On Nov 21, 5:11 pm, Joe Strout <[EMAIL PROTECTED]> wrote: > I have a function that takes a reference to a class, and then   > instantiates that class (and then does several other things with the   > new instance).  This is easy enough: > >     item = cls(self, **itemArgs) > > where "cls" is the cla

Re: Best strategy for finding a pattern in a sequence of integers

2008-11-21 Thread Mensanator
On Nov 21, 9:13 am, Slaunger <[EMAIL PROTECTED]> wrote: > Hi all, > > I am a Python novice, and I have run into a problem in a project I am > working on, which boils down to identifying the patterns in a sequence > of integers, for example > > 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3

Re: Build of extension module depending on external lib fails on Solaris 10

2008-11-21 Thread Graham Dumpleton
On Nov 22, 2:07 am, "Eric Brunel" <[EMAIL PROTECTED]> wrote: > Hello all, > > I've got a brand new Solaris 10 computer and I'm trying to build Python   > and extension modules for it. The Python build didn't have any problem and   > I have a working Python interpreter. But I can't succeed to build

Re: how to dynamically instantiate an object inheriting from several classes?

2008-11-21 Thread Arnaud Delobelle
Joe Strout <[EMAIL PROTECTED]> writes: > I have a function that takes a reference to a class, and then > instantiates that class (and then does several other things with the > new instance). This is easy enough: > >item = cls(self, **itemArgs) > > where "cls" is the class reference, and itemA

Re: matching exactly a 4 digit number in python

2008-11-21 Thread George Sakkis
On Nov 21, 4:46 pm, harijay <[EMAIL PROTECTED]> wrote: > Hi > I am a few months new into python. I have used regexps before in perl > and java but am a little confused with this problem. > > I want to parse a number of strings and extract only those that > contain a 4 digit number anywhere inside

Re: __new__ woes with list

2008-11-21 Thread Arnaud Delobelle
macaronikazoo <[EMAIL PROTECTED]> writes: > ok thansk - i will search again. i did try searching but didn't find > anything relevant... Here's a link to the thread on google groups: http://groups.google.com/group/comp.lang.python/browse_thread/thread/7aff4eabc6182858 Unfortunately two threads

Re: function parameter scope python 2.5.2

2008-11-21 Thread Terry Reedy
J Kenneth King wrote: I was working on a program of some complexity recently and quickly caught the issue in my tests. I knew what was going on and fixed it expediently, but the behaviour confused me and I couldn't find any technical documentation on it so I figured I just didn't know what it wa

Re: 404 not found on for Python 2.6 Itanium

2008-11-21 Thread Martin v. Löwis
> In any case, my concern with dropping a stock python itanium distro > involves the vastly diminished probability that others will provide > Itanium versions of, for example py2exe and pywin32. Well, I had been providing Itanium binaries for 2.4 and 2.5, and neither py2exe nor pywin32 ever emerge

Re: matching exactly a 4 digit number in python

2008-11-21 Thread John Machin
On Nov 22, 8:46 am, harijay <[EMAIL PROTECTED]> wrote: > Hi > I am a few months new into python. I have used regexps before in perl > and java but am a little confused with this problem. > > I want to parse a number of strings and extract only those that > contain a 4 digit number anywhere inside a

how to dynamically instantiate an object inheriting from several classes?

2008-11-21 Thread Joe Strout
I have a function that takes a reference to a class, and then instantiates that class (and then does several other things with the new instance). This is easy enough: item = cls(self, **itemArgs) where "cls" is the class reference, and itemArgs is obviously a set of keyword arguments f

Re: matching exactly a 4 digit number in python

2008-11-21 Thread Mark Tolonen
"harijay" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I want to parse a number of strings and extract only those that contain a 4 digit number anywhere inside a string Try: p = re.compile(r'\b\d{4}\b') -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Python / Debian package dependencies

2008-11-21 Thread Steven Samuel Cole
That's exactly the piece of information I needed! :-) The control file created by setdeb (stdeb_run_setup, to be precise) looks like this (some lines will get wrapped): Source: Maintainer: Section: python Priority: optional Build-Depends: python-setuptools (>= 0.6b3-1), python-all-dev (>=

Re: matching exactly a 4 digit number in python

2008-11-21 Thread Mr . SpOOn
2008/11/21 harijay <[EMAIL PROTECTED]>: > Hi > I am a few months new into python. I have used regexps before in perl > and java but am a little confused with this problem. > > I want to parse a number of strings and extract only those that > contain a 4 digit number anywhere inside a string > > How

Re: 404 not found on for Python 2.6 Itanium

2008-11-21 Thread Martin v. Löwis
> I guess that I don't understand why you feel there is so much effort > involved. I developed a set of makefiles that build Python and all > dependencies from the command line using nmake. The only thing you > have to do is specify debug and cpu. The rest is taken care of by the > Makefiles. O

matching exactly a 4 digit number in python

2008-11-21 Thread harijay
Hi I am a few months new into python. I have used regexps before in perl and java but am a little confused with this problem. I want to parse a number of strings and extract only those that contain a 4 digit number anywhere inside a string However the regexp p = re.compile(r'\d{4}') Matches even

Re: initialization in argument definitions

2008-11-21 Thread John Machin
On Nov 22, 8:25 am, Brentt <[EMAIL PROTECTED]> wrote: > Hi, I know this is a terribly simple question, but the docs seem to be > designed for people who probably find a the answer to this question > terribly obvious. But its not at all obvious to me. > > I can't figure out why when I define a funct

Re: __new__ woes with list

2008-11-21 Thread macaronikazoo
ok thansk - i will search again. i did try searching but didn't find anything relevant... -- http://mail.python.org/mailman/listinfo/python-list

Re: initialization in argument definitions

2008-11-21 Thread George Sakkis
On Nov 21, 4:25 pm, Brentt <[EMAIL PROTECTED]> wrote: > Hi, I know this is a terribly simple question, but the docs seem to be > designed for people who probably find a the answer to this question > terribly obvious. But its not at all obvious to me. Don't worry, it's not obvious to *anyone* new

Re: __new__ woes with list

2008-11-21 Thread Arnaud Delobelle
macaronikazoo <[EMAIL PROTECTED]> writes: > i'm having a hell of a time getting this to work. basically I want to > be able to instantiate an object using either a list, or a string, but > the class inherits from list. > > if the class is instantiated with a string, then run a method over it > to

Re: can the sequence of entries in a dictionary be depended on?

2008-11-21 Thread Arnaud Delobelle
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > Priya wrote: > >> Hi, >> I'm writing a program where i iterate through the entries in a >> dictionary using a for loop. This for-loop is enclosed by another loop >> which traverses through a list and checks the relation between each >> entry in the

__new__ woes with list

2008-11-21 Thread macaronikazoo
i'm having a hell of a time getting this to work. basically I want to be able to instantiate an object using either a list, or a string, but the class inherits from list. if the class is instantiated with a string, then run a method over it to tokenize it in a meaningful way. so how come this do

Re: Custom Formatting The Output Of subprocess.Popen

2008-11-21 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: ... so, it seems to me that if I would know how to write a file object, then I could write one that prefixes each line, and that would be fine, no? I don't see how this would necessitate waiting for p.py's termination, or matter that it is a different process. I just do

Re: initialization in argument definitions

2008-11-21 Thread Chris Rebert
On Fri, Nov 21, 2008 at 1:25 PM, Brentt <[EMAIL PROTECTED]> wrote: > Hi, I know this is a terribly simple question, but the docs seem to be > designed for people who probably find a the answer to this question > terribly obvious. But its not at all obvious to me. > > I can't figure out why when I d

initialization in argument definitions

2008-11-21 Thread Brentt
Hi, I know this is a terribly simple question, but the docs seem to be designed for people who probably find a the answer to this question terribly obvious. But its not at all obvious to me. I can't figure out why when I define a function, a variable (specifically a list) that I define and initial

Re: Need help converting text to csv format

2008-11-21 Thread John Machin
On Nov 22, 7:38 am, George Sakkis <[EMAIL PROTECTED]> wrote: > On Nov 21, 2:01 pm, Richard Riley <[EMAIL PROTECTED]> wrote: > > > > > George Sakkis <[EMAIL PROTECTED]> writes: > > > On Nov 21, 11:05 am, Steve Holden <[EMAIL PROTECTED]> wrote: > > >> George Sakkis wrote: > > >> > On Nov 21, 10:18 am

Re: Building Python 2.5.2 for Itanium

2008-11-21 Thread Martin v. Löwis
> I need to compile that module for that release and platform, but I > have been unable to discover which MS compiler version and runtime was > used to generate the binaries. My understanding is that Python 2.5.2 > in general uses Visual Studio 2003, but MS does not appear to have > shipped an I

Re: Need help converting text to csv format

2008-11-21 Thread George Sakkis
On Nov 21, 2:01 pm, Richard Riley <[EMAIL PROTECTED]> wrote: > George Sakkis <[EMAIL PROTECTED]> writes: > > On Nov 21, 11:05 am, Steve Holden <[EMAIL PROTECTED]> wrote: > >> George Sakkis wrote: > >> > On Nov 21, 10:18 am, Chuck Connors <[EMAIL PROTECTED]> wrote: > > >> >> Any help, pseudo code,

Re: Module Structure/Import Design Problem

2008-11-21 Thread Stef Mientki
Gabriel Genellina wrote: En Thu, 20 Nov 2008 17:36:11 -0200, Stef Mientki <[EMAIL PROTECTED]> escribió: I'm not an expert, I even don't fully understand your problem, but having struggled with imports in the past, I've a solution now, which seems to work quit well. That's not very helpful, i

Re: How to read space separated file in python?

2008-11-21 Thread Gabriel Genellina
En Fri, 21 Nov 2008 14:13:23 -0200, Joe Strout <[EMAIL PROTECTED]> escribió: Right -- so using split() gives you the wrong answer for two different reasons. Try these: >>> line = "1 x" >>> a, b = line.split() # b == "x", which is correct >>> line = "2 " >>> a, b = line.split() # co

Re: Custom Formatting The Output Of subprocess.Popen

2008-11-21 Thread thedsadude
On Nov 21, 8:50 pm, Scott David Daniels <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > >   Hello, > > >   I'm launching a script as follows: > > > > p = subprocess.Popen(['./p.py', 'aa']) > > > p.wait() > > > > >   If p.py writes to sys.stdout, then it is shown on the console > > You

Re: Module Structure/Import Design Problem

2008-11-21 Thread Stef Mientki
Rafe wrote: On Nov 21, 2:36 am, Stef Mientki <[EMAIL PROTECTED]> wrote: I'm not an expert, I even don't fully understand your problem, but having struggled with imports in the past, I've a solution now, which seems to work quit well. That's not very helpful, is it? Were you planning

Re: Need help converting text to csv format

2008-11-21 Thread r0g
Chuck Connors wrote: > Hey guys. I'm working on a little program to help my wife catalog her/ > our coupons. I found a good resource but need help formatting the > text data so that I can import it into a mysql database. Here's the > data format: > > 40922003 Life Fitness Products $1 (12-13-

Re: Need help converting text to csv format

2008-11-21 Thread Richard Riley
George Sakkis <[EMAIL PROTECTED]> writes: > On Nov 21, 11:05 am, Steve Holden <[EMAIL PROTECTED]> wrote: >> George Sakkis wrote: >> > On Nov 21, 10:18 am, Chuck Connors <[EMAIL PROTECTED]> wrote: >> >> >> Any help, pseudo code, or whatever push in the right direction would >> >> be most appreciate

Re: Problem with writing fast UDP server

2008-11-21 Thread Greg Copeland
On Nov 21, 11:05 am, Krzysztof Retel <[EMAIL PROTECTED]> wrote: > On Nov 21, 4:48 pm, Peter Pearson <[EMAIL PROTECTED]> wrote: > > > On Fri, 21 Nov 2008 08:14:19 -0800 (PST), Krzysztof Retel wrote: > > > I am not sure what do you mean by CPU-bound? How can I find out if I > > > run it on CPU-bound?

Re: Custom Formatting The Output Of subprocess.Popen

2008-11-21 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: Hello, I'm launching a script as follows: p = subprocess.Popen(['./p.py', 'aa']) p.wait() If p.py writes to sys.stdout, then it is shown on the console You seem to be missing the fact that ./py is run in a different process. The "sys.stdout" that p.py uses

Re: Using eval, or something like it...

2008-11-21 Thread Scott David Daniels
I forgot to include a few cases: (1) Inspired by your calling the class attributes "templates": class Demo3(object): pass d = Demo3() print d.non_template # raises exception d.non_template = 45 print d.non_template print Demo3.non_template # raises exception

Re: can the sequence of entries in a dictionary be depended on?

2008-11-21 Thread Diez B. Roggisch
Priya wrote: > Hi, > I'm writing a program where i iterate through the entries in a > dictionary using a for loop. This for-loop is enclosed by another loop > which traverses through a list and checks the relation between each > entry in the list and each entry in the dictionary. > while I know th

can the sequence of entries in a dictionary be depended on?

2008-11-21 Thread Priya
Hi, I'm writing a program where i iterate through the entries in a dictionary using a for loop. This for-loop is enclosed by another loop which traverses through a list and checks the relation between each entry in the list and each entry in the dictionary. while I know that dictionaries are 'unord

Re: special editor support for indentation needed.

2008-11-21 Thread Andreas Roehler
Eric S. Johansson wrote: > Andreas Roehler wrote: > >> IMO Jeremiah Dodds is right. With all the time spent on this discussion, you >> could write the needed function in elisp probably. BTW your request seems >> reasonable. Other python programmers may use it too. > > I tried learning lisp about

Re: Need help converting text to csv format

2008-11-21 Thread George Sakkis
On Nov 21, 11:05 am, Steve Holden <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > On Nov 21, 10:18 am, Chuck Connors <[EMAIL PROTECTED]> wrote: > > >> Any help, pseudo code, or whatever push in the right direction would > >> be most appreciated.  I am a novice Python programmer but I do have

Re: Best strategy for finding a pattern in a sequence of integers

2008-11-21 Thread Arnaud Delobelle
Slaunger <[EMAIL PROTECTED]> writes: > I am a Python novice, and I have run into a problem in a project I am > working on, which boils down to identifying the patterns in a sequence > of integers, for example > > 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6 > 1 6 6 1 6 6 1

Re: how to get all repeated group with regular expression

2008-11-21 Thread MRAB
Steve Holden wrote: Please keep this on the list. scsoce wrote: Steve Holden wrote: scsoce wrote: say, when I try to search and match every char from variable length string, such as string '123456', i tried re.findall( r'(\d)*, '12346' ) I think you will find you missed a quote out

Re: Need help converting text to csv format

2008-11-21 Thread Joe Strout
On Nov 21, 2008, at 10:26 AM, MRAB wrote: The file will be closed automatically when the file object is garbage-collected. CPython uses reference-counting, so the file object is garbage- collected as soon as there are no references to it. Jython (and IronPython?) are garbage-collected in t

Re: Need help converting text to csv format

2008-11-21 Thread M.-A. Lemburg
On 2008-11-21 16:18, Chuck Connors wrote: > Hey guys. I'm working on a little program to help my wife catalog her/ > our coupons. I found a good resource but need help formatting the > text data so that I can import it into a mysql database. Here's the > data format: > > 40922003 Life Fitnes

Re: how to get all repeated group with regular expression

2008-11-21 Thread M.-A. Lemburg
On 2008-11-21 15:31, scsoce wrote: > say, when I try to search and match every char from variable length > string, such as string '123456', ??? That's a strange requirement. If you want to match every character, then why are you using a regular expression for this ? > i tried re.findall( r'(\d)

Re: Python 3 __cmp__ semantic change?

2008-11-21 Thread Arnaud Delobelle
Hyuga <[EMAIL PROTECTED]> writes: > On Nov 21, 4:09 am, Duncan Booth <[EMAIL PROTECTED]> wrote: >> Johannes Bauer <[EMAIL PROTECTED]> wrote: >> > Seems it was removed on purpose - I'm sure there was a good reason for >> > that, but may I ask why? Instead of the sleek __cmp__ function I had >> > ea

Re: Need help converting text to csv format

2008-11-21 Thread MRAB
Tim Golden wrote: Joe Strout wrote: A follow-up question here... is it really necessary to close things like files in Python? I've been slumming it in the REALbasic community for the last decade, where you generally don't worry about such things, as any object that represents something "open"

Building Python 2.5.2 for Itanium

2008-11-21 Thread Christopher
Hello, A tool that we use needs to be ported to Itanium. It wsa written for Python 2.5.2, and so I was happily using the Itanium version of that release. However, as I have gotten deeper into the port, I see that ctypes was not included with the Itanium Python 2.5.2 release. I need to compi

Re: Best strategy for finding a pattern in a sequence of integers

2008-11-21 Thread Banibrata Dutta
Haven't followed the entire thread, so I could be making a silly, out-of-place remark, and apologies in advance for the same.However, to me it looks like Slaunger wants to find 2 of the longest repeating patterns, and not just 2 specific patterns (though from the introductory test, it appears to be

Re: Best strategy for finding a pattern in a sequence of integers

2008-11-21 Thread Gerard flanagan
Slaunger wrote: Hi all, I am a Python novice, and I have run into a problem in a project I am working on, which boils down to identifying the patterns in a sequence of integers, for example 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6

Re: function parameter scope python 2.5.2

2008-11-21 Thread J Kenneth King
Peter Pearson <[EMAIL PROTECTED]> writes: > On Fri, 21 Nov 2008 10:12:08 -0500, J Kenneth King wrote: >> Steven D'Aprano <[EMAIL PROTECTED]> writes: >>> >>> I am curious why you thought that. What made you think Python should/did >>> make a copy of weird_obj.words when you pass it to a function?

Re: Problem with writing fast UDP server

2008-11-21 Thread Krzysztof Retel
On Nov 21, 4:48 pm, Peter Pearson <[EMAIL PROTECTED]> wrote: > On Fri, 21 Nov 2008 08:14:19 -0800 (PST), Krzysztof Retel wrote: > > I am not sure what do you mean by CPU-bound? How can I find out if I > > run it on CPU-bound? > > CPU-bound is the state in which performance is limited by the > avail

Re: Need help converting text to csv format

2008-11-21 Thread Tim Golden
Tim Chase wrote: yes, the CSV module has some wonderful stuff in it, and I regularly use it for *reading* CSV files. But for writing them, it's often just as fast (for my purposes) to simply code my 1st post's quickie as it is to scrounge in the docs/docstrings to remember how to let the CSV d

Re: Dynamic features used

2008-11-21 Thread George Sakkis
On Nov 21, 7:55 am, [EMAIL PROTECTED] wrote: > It's not easy to define what my point was :-) I try again, but the > following questions don't cover all the points: > - What are the dynamic features of Python that you use in your code? > (excluding ones that can can be done with a good static templ

Re: Problem with writing fast UDP server

2008-11-21 Thread Peter Pearson
On Fri, 21 Nov 2008 08:14:19 -0800 (PST), Krzysztof Retel wrote: > I am not sure what do you mean by CPU-bound? How can I find out if I > run it on CPU-bound? CPU-bound is the state in which performance is limited by the availability of processor cycles. On a Unix box, you might run the "top" uti

Re: function parameter scope python 2.5.2

2008-11-21 Thread Peter Pearson
On Fri, 21 Nov 2008 10:12:08 -0500, J Kenneth King wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >> >> I am curious why you thought that. What made you think Python should/did >> make a copy of weird_obj.words when you pass it to a function? [snip] > Of course if there is any further readin

Re: 404 not found on for Python 2.6 Itanium

2008-11-21 Thread Christopher Nelson
I'm not sure what to say about that. The company I work for is committed to Python (our product is mostly Python source), and my current job is to make our software work on Itanium, which means providing an Itanium build of Python. As long as I have this job I suspect that I will be maintaining i

Re: Need help converting text to csv format

2008-11-21 Thread Tim Chase
Tim Golden wrote: Tim Chase wrote: >>> qfields = ['"' + fld.strip() + '"' for fld in (num,desc,date)] >>> out = qfields.join(',') Just a quick note here to prevent the confusion of the OP...this should be ','.join(qfields) To be honest, it's so easy to use the stdlib csv module that I'd

  1   2   >