Re: The pty module, reading from a pty, and Python 2/3

2012-10-23 Thread David Hutto
in other words, the last two lines of your function should be: statinfo = os.stat(filename) return child_pty.read(statinfo.st_size) -- Best Regards, David Hutto CEO: http://www.hitwebdevelopment.com -- http://mail.python.org/mailman/listinfo/python-list

Re: The pty module, reading from a pty, and Python 2/3

2012-10-23 Thread David Hutto
#better coded for you to understand import sys import pty import os def get_text(filename): try: ( child_pid, fd ) = pty.fork() # OK except OSError as e: print(str(e)) sys.exit(1) if child_pid == 0:

Re: The pty module, reading from a pty, and Python 2/3

2012-10-23 Thread David Hutto
import sys import pty import os def get_text(filename): #you need to find the file size, and place it as an integer in read below, where you return the value statinfo = os.stat(filename) try: ( child_pid, fd ) = pty.fork() # OK except OSError as e:

Re: Split single file into multiple files based on patterns

2012-10-23 Thread Mark Lawrence
On 24/10/2012 06:46, Alain Ketterlin wrote: satyam writes: I have a text file like this A1980JE3937 2732 4195 12.527000 A1980JE3937 3465 9720 22.00 A1980JE3937 2732 9720 18.00 A1980KK18700010 130 303 4.985000 A1980KK18700010 7 4915 0.435000 [...] I want to split the file

Re: turn list of letters into an array of integers

2012-10-23 Thread Chris Rebert
On Tue, Oct 23, 2012 at 10:23 PM, seektime wrote: > Here's some example code. The input is a list which is a "matrix" of letters: >a b a >b b a > > and I'd like to turn this into a Python array: You mean a Python list. The datatype Python calls an `array` is very different and relativ

Re: The pty module, reading from a pty, and Python 2/3

2012-10-23 Thread David Hutto
On Tue, Oct 23, 2012 at 11:41 PM, Evan Driscoll wrote: > OK, one more self-reply. :-) > > I found http://bugs.python.org/issue5380 which seems to be relevant. Sounds > like the OS is returning an error, and that's naturally being propagated > through Python. And further testing reveals the problem

Re: PIL and requests don't get along

2012-10-23 Thread Kushal Kumaran
On 23 Oct 2012 14:06:59 -0400, r...@panix.com (Roy Smith) wrote: > I have a url from which I can get an image. I want to use PIL to > manipulate that image. Getting the image is easy: > > >>> import requests > >>> r = requests.get(url) > > There's a bunch of factory functions for Image, but non

Re: turn list of letters into an array of integers

2012-10-23 Thread Demian Brecht
> Of course, if you want these to be ints, then you can either change the > format of your int list, or map(int, list_) if you don't have control over it. Ugh, I'm tired. Shouldn't map it, the conversion should be done in the list comprehension to avoid a needless second list iteration. K, I'

Re: turn list of letters into an array of integers

2012-10-23 Thread David Hutto
On Wed, Oct 24, 2012 at 1:23 AM, seektime wrote: > Here's some example code. The input is a list which is a "matrix" of letters: >a b a >b b a > > and I'd like to turn this into a Python array: > > 1 2 1 > 2 2 1 > > so 1 replaces a, and 2 replaces b. Here's the code I have so far:

Re: turn list of letters into an array of integers

2012-10-23 Thread Demian Brecht
On 2012-10-23, at 10:45 PM, Demian Brecht wrote: list_ = [d[c] for c in s.strip('\n').split()] list_ > ['1', '2', '1', '2', '2', '1'] Of course, if you want these to be ints, then you can either change the format of your int list, or map(int, list_) if you don't have control over it

Re: Split single file into multiple files based on patterns

2012-10-23 Thread Alain Ketterlin
satyam writes: > I have a text file like this > > A1980JE3937 2732 4195 12.527000 > A1980JE3937 3465 9720 22.00 > A1980JE3937 2732 9720 18.00 > A1980KK18700010 130 303 4.985000 > A1980KK18700010 7 4915 0.435000 [...] > I want to split the file and get multiple files like > A19

Re: turn list of letters into an array of integers

2012-10-23 Thread Demian Brecht
On 2012-10-23, at 10:23 PM, seektime wrote: > My question is how can I turn "seq" into a python array? Something like this perhaps?: >>> alpha = ('a', 'b') >>> numeric = ('1', '2') >>> L = ['a b a\n', 'b b a\n'] >>> s = ' '.join(L) >>> d = dict(zip(alpha, numeric)) >>> list_ = [d[c] for c in s.

Re: Split single file into multiple files based on patterns

2012-10-23 Thread Demian Brecht
On 2012-10-23, at 10:24 PM, David Hutto wrote: > count = 0 Don't use count. > for file_data in turn_text_to_txt: Use enumerate: for count, file_data in enumerate(turn_text_to_txt): > f = open('/home/david/files/%s_%s.txt' % (file_data.split(' ')[0], count), > 'w') Use with: with open('file

turn list of letters into an array of integers

2012-10-23 Thread seektime
Here's some example code. The input is a list which is a "matrix" of letters: a b a b b a and I'd like to turn this into a Python array: 1 2 1 2 2 1 so 1 replaces a, and 2 replaces b. Here's the code I have so far: >>> L=['a b a\n','b b a\n'] >>> s=' '.join(L) >>> seq1=('a','b') >

Re: Split single file into multiple files based on patterns

2012-10-23 Thread David Hutto
On Tue, Oct 23, 2012 at 11:01 PM, satyam wrote: > I have a text file like this > > A1980JE3937 2732 4195 12.527000 > A1980JE3937 3465 9720 22.00 > A1980JE3937 1853 3278 12.50 > A1980JE3937 2732 2732 187.50 > A1980JE3937 19 4688 3.619000 > A1980JE3937 2995 9720 6

Re: The pty module, reading from a pty, and Python 2/3

2012-10-23 Thread Evan Driscoll
OK, one more self-reply. :-) I found http://bugs.python.org/issue5380 which seems to be relevant. Sounds like the OS is returning an error, and that's naturally being propagated through Python. And further testing reveals the problem only surfaces when the child actually exits -- if the child

The pty module, reading from a pty, and Python 2/3

2012-10-23 Thread Evan Driscoll
I have the following program. Everything is sunshine and rainbows when I run in in Python 2, but when I run it under Python 3 I get an IOError. 2to3 only reports one dumb suggestion re. a print call (which I can get rid of by importing __future__'s print_function, and then it just suggests remo

Re: Split single file into multiple files based on patterns

2012-10-23 Thread satyam mukherjee
Thanks I will take a look...My actual data is 2.5Gb in size. Satyam On Tue, Oct 23, 2012 at 10:43 PM, Jason Friedman wrote: > On Tue, Oct 23, 2012 at 9:01 PM, satyam wrote: > > I have a text file like this > > > > A1980JE3937 2732 4195 12.527000 > > A1980JE3937 3465 9720 22.00 > > A1

Re: Split single file into multiple files based on patterns

2012-10-23 Thread Jason Friedman
On Tue, Oct 23, 2012 at 9:01 PM, satyam wrote: > I have a text file like this > > A1980JE3937 2732 4195 12.527000 > A1980JE3937 3465 9720 22.00 > A1980JE3937 1853 3278 12.50 > A1980JE3937 2732 2732 187.50 > A1980JE3937 19 4688 3.619000 > A1980KK18700010 30 186 1.285

Re: Split single file into multiple files based on patterns

2012-10-23 Thread Jason Friedman
> I have a text file like this > > A1980JE3937 2732 4195 12.527000 > A1980JE3937 3465 9720 22.00 > A1980KK18700010 186 3366 4.78 > A1980KK18700010 30 186 1.285000 > A1980KK18700010 30 185 4.395000 > A1980KK18700010 185 186 9.00 > A1980KK18700010 25 30 3.493000 > > I want to spli

Split single file into multiple files based on patterns

2012-10-23 Thread satyam
I have a text file like this A1980JE3937 2732 4195 12.527000 A1980JE3937 3465 9720 22.00 A1980JE3937 1853 3278 12.50 A1980JE3937 2732 2732 187.50 A1980JE3937 19 4688 3.619000 A1980JE3937 2995 9720 6.667000 A1980JE3937 1603 9720 30.00 A1980JE3937 234

Re: The pty module, reading from a pty, and Python 2/3

2012-10-23 Thread Evan Driscoll
Oh, and a little more information: The log.txt file I create has the message that it's "about to execlp", and the exec() *does* actually happen -- the IOError is raised after the child process quits. Evan On 10/23/2012 09:59 PM, Evan Driscoll wrote: I have the following program. Everything

Re: Fast forward-backward (write-read)

2012-10-23 Thread David Hutto
On Tue, Oct 23, 2012 at 8:06 PM, Oscar Benjamin wrote: > On 23 October 2012 15:31, Virgil Stokes wrote: >> I am working with some rather large data files (>100GB) that contain time >> series data. The data (t_k,y(t_k)), k = 0,1,...,N are stored in ASCII >> format. I perform various types of proce

Re: Fast forward-backward (write-read)

2012-10-23 Thread Tim Chase
On 10/23/12 13:37, Virgil Stokes wrote: > Yes, I do wish to inverse the order, but the "forward in time" > file will be in binary. Your original post said: > The data (t_k,y(t_k)), k = 0,1,...,N are stored in ASCII format making it hard to know what sort of data is in this file. So I guess it

Re: Fast forward-backward (write-read)

2012-10-23 Thread Oscar Benjamin
On 23 October 2012 15:31, Virgil Stokes wrote: > I am working with some rather large data files (>100GB) that contain time > series data. The data (t_k,y(t_k)), k = 0,1,...,N are stored in ASCII > format. I perform various types of processing on these data (e.g. moving > median, moving average, an

Re: A desperate lunge for on-topic-ness

2012-10-23 Thread Steven D'Aprano
On Tue, 23 Oct 2012 17:24:34 -0600, Ian Kelly wrote: > On Tue, Oct 23, 2012 at 4:34 PM, Steven D'Aprano > wrote: >> On Tue, 23 Oct 2012 10:50:11 -0600, Ian Kelly wrote: >> if someone is foolish enough to use the from xyz import * notation... >>> >>> It's already a

Re: Fast forward-backward (write-read)

2012-10-23 Thread David Hutto
On Tue, Oct 23, 2012 at 7:35 PM, emile wrote: > On 10/23/2012 04:19 PM, David Hutto wrote: >> >> Whether this is fast enough, or not, I don't know: > > > well, the OP's original post started with > "I am working with some rather large data files (>100GB)..." Well, is this a dedicated system, an

Re: regex function driving me nuts

2012-10-23 Thread cyberdicks
Stripping the line did it !!! Thank you very much to all !!! Cheers! :-) Martin Le mardi 23 octobre 2012 16:36:44 UTC-4, Vlastimil Brom a écrit : > 2012/10/23 MartinD. > > > Hi, > > > > > > I'm new to Python. > > > Does someone has an idea what's wrong. I tried everything. The only regex

Re: Fast forward-backward (write-read)

2012-10-23 Thread Paul Rubin
Virgil Stokes writes: > Yes, I do wish to inverse the order, but the "forward in time" file > will be in binary. I really think it will be simplest to just write the file in forward order, then use mmap to read it one record at a time. It might be possible to squeeze out a little more performan

Re: Getting a TimedRotatingFileHandler not to put two dates in the same file?

2012-10-23 Thread Dave Angel
On 10/23/2012 11:23 AM, David M Chess wrote: > We have a TimedRotatingFileHandler with when='midnight' You give us no clue what's in this class, or how it comes up with the filenames used. > . > > This works great, splitting the log information across files by date, as > long as the process is

Re: Fast forward-backward (write-read)

2012-10-23 Thread emile
On 10/23/2012 04:19 PM, David Hutto wrote: Whether this is fast enough, or not, I don't know: well, the OP's original post started with "I am working with some rather large data files (>100GB)..." filename = "data_file.txt" f = open(filename, 'r') forward = [line.rstrip('\n') for line in f

Re: Fast forward-backward (write-read)

2012-10-23 Thread David Hutto
On Tue, Oct 23, 2012 at 6:53 PM, Steven D'Aprano wrote: > On Tue, 23 Oct 2012 17:50:55 -0400, David Hutto wrote: > >> On Tue, Oct 23, 2012 at 10:31 AM, Virgil Stokes wrote: >>> I am working with some rather large data files (>100GB) > [...] >>> Finally, to my question --- What is a fast way to wr

Re: A desperate lunge for on-topic-ness

2012-10-23 Thread Ian Kelly
On Tue, Oct 23, 2012 at 4:34 PM, Steven D'Aprano wrote: > On Tue, 23 Oct 2012 10:50:11 -0600, Ian Kelly wrote: > >>> if someone is foolish enough to use the >>> >>> from xyz import * >>> >>> notation... >> >> It's already a SyntaxError to use a wildcard import anywhere other than >> the mo

Re: SQLAlchemy: How to do Table Reflection and MySQL?

2012-10-23 Thread Nick Sabalausky
On Tue, 23 Oct 2012 22:42:08 + "Prasad, Ramit" wrote: > Nick Sabalausky wrote: > > On Mon, 22 Oct 2012 14:35:23 -0700 (PDT) > > darnold wrote: > > > > > > i'm not brave enough to dig too deeply into SQLAlchemy, but maybe > > > this will help? : > > > > > > http://kashififtikhar.blogspot.com/

Re: Fast forward-backward (write-read)

2012-10-23 Thread David Hutto
Whether this is fast enough, or not, I don't know: filename = "data_file.txt" f = open(filename, 'r') forward = [line.rstrip('\n') for line in f.readlines()] backward = [line.rstrip('\n') for line in reversed(forward)] f.close() print forward, "\n\n", "\n\n", backward, "\n"

Re: Fast forward-backward (write-read)

2012-10-23 Thread Demian Brecht
> This is a classic example of why the old external processing algorithms > of the 1960s and 70s will never be obsolete. No matter how much memory > you have, there will always be times when you want to process more data > than you can fit into memory. But surely nobody will *ever* need more t

Re: Fast forward-backward (write-read)

2012-10-23 Thread Steven D'Aprano
On Tue, 23 Oct 2012 17:50:55 -0400, David Hutto wrote: > On Tue, Oct 23, 2012 at 10:31 AM, Virgil Stokes wrote: >> I am working with some rather large data files (>100GB) [...] >> Finally, to my question --- What is a fast way to write these variables >> to an external file and then read them in

Re: Fast forward-backward (write-read)

2012-10-23 Thread David Hutto
> Missed the part about it being a file. Use: > > forward = ["%i = %s" % (i,chr(i)) for i in range(33,126)] > backward = ["%i = %s" % (i,chr(i)) for i in range(126,32,-1)] > > print forward,backward > This was a dud, let me rework it real quick, I deleted what i had, and accidentally wrote the wro

RE: SQLAlchemy: How to do Table Reflection and MySQL?

2012-10-23 Thread Prasad, Ramit
Nick Sabalausky wrote: > On Mon, 22 Oct 2012 14:35:23 -0700 (PDT) > darnold wrote: > > > > i'm not brave enough to dig too deeply into SQLAlchemy, but maybe this > > will help? : > > > > http://kashififtikhar.blogspot.com/2010/07/using-sqlalchemy-reflection-with-pylons.html > > > > that came up fr

Re: Fast forward-backward (write-read)

2012-10-23 Thread David Hutto
> Don't forget to use timeit for an average OS utilization. > > I'd suggest two list comprehensions for now, until I've reviewed it some more: > > forward = ["%i = %s" % (i,chr(i)) for i in range(33,126)] > backward = ["%i = %s" % (i,chr(i)) for i in range(126,32,-1)] > > for var in forward: >

Re: A desperate lunge for on-topic-ness

2012-10-23 Thread Steven D'Aprano
On Tue, 23 Oct 2012 10:50:11 -0600, Ian Kelly wrote: >> if someone is foolish enough to use the >> >> from xyz import * >> >> notation... > > It's already a SyntaxError to use a wildcard import anywhere other than > the module level, so its use can only affect global variables. In Python

Re: SQLAlchemy: How to do Table Reflection and MySQL?

2012-10-23 Thread Nick Sabalausky
On Mon, 22 Oct 2012 14:35:23 -0700 (PDT) darnold wrote: > > i'm not brave enough to dig too deeply into SQLAlchemy, but maybe this > will help? : > > http://kashififtikhar.blogspot.com/2010/07/using-sqlalchemy-reflection-with-pylons.html > > that came up from googling "sqlalchemy table reflecti

Re: Fast forward-backward (write-read)

2012-10-23 Thread David Hutto
On Tue, Oct 23, 2012 at 10:31 AM, Virgil Stokes wrote: > I am working with some rather large data files (>100GB) that contain time > series data. The data (t_k,y(t_k)), k = 0,1,...,N are stored in ASCII > format. I perform various types of processing on these data (e.g. moving > median, moving ave

Re: problem with ThreadingTCPServer Handler

2012-10-23 Thread Miki Tebeka
According to the docs (http://docs.python.org/library/socketserver.html#requesthandler-objects) there's self.server available. -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with ThreadingTCPServer Handler

2012-10-23 Thread David M Chess
> jorge > I'm programming a server that most send a message to each client > connected to it and nothing else. this is obviously a base of what i > want to do. the thing is, I made a class wich contains the Handler class > for the ThreadingTCPServer and starts the server but i don't know how

ANN: Urwid 1.1.0 - Usability and Documentation

2012-10-23 Thread Ian Ward
Announcing Urwid 1.1.0 -- Urwid home page: http://excess.org/urwid/ Manual: http://excess.org/urwid/docs/ Package: http://pypi.python.org/pypi/urwid/1.1.0 About this release: === This is a major feature release for Urwid. The first focus for this rel

Re: regex function driving me nuts

2012-10-23 Thread Vlastimil Brom
2012/10/23 MartinD. : > Hi, > > I'm new to Python. > Does someone has an idea what's wrong. I tried everything. The only regex > that is tested is the last one in a whole list of regex in keywords.txt > Thanks! > Martin > > > > def checkKeywords( str, lstKeywords ): > > for regex

Re: regex function driving me nuts

2012-10-23 Thread Ian Kelly
On Tue, Oct 23, 2012 at 1:51 PM, MartinD. wrote: > Hi, > > I'm new to Python. > Does someone has an idea what's wrong. I tried everything. The only regex > that is tested is the last one in a whole list of regex in keywords.txt > Thanks! > Martin How do you know that it's the only one being tes

RE: regex function driving me nuts

2012-10-23 Thread Prasad, Ramit
MartinD wrote: > Hi, > > I'm new to Python. > Does someone has an idea what's wrong. I tried everything. The only regex > that is tested is the last one in a > whole list of regex in keywords.txt > Thanks! > Martin > > > > def checkKeywords( str, lstKeywords ): > > for regex in

Re: can we append a list with another list in Python ?

2012-10-23 Thread Joshua Landau
On 23 October 2012 21:06, Joshua Landau wrote: > On 23 October 2012 21:03, Joshua Landau wrote: > >> On 23 October 2012 12:07, Jean-Michel Pichavant >> wrote: >> >>> - Original Message - >>> >>> > Thankyou.. but my problem is different than simply joining 2 lists >>> > and it is done now

Re: can we append a list with another list in Python ?

2012-10-23 Thread inshu chauhan
ok I got it guys... On Tue, Oct 23, 2012 at 10:08 PM, Joshua Landau wrote: > On 23 October 2012 21:06, Joshua Landau wrote: > >> On 23 October 2012 21:03, Joshua Landau wrote: >> >>> On 23 October 2012 12:07, Jean-Michel Pichavant >>> wrote: >>> - Original Message - > Th

Re: can we append a list with another list in Python ?

2012-10-23 Thread Joshua Landau
On 23 October 2012 21:03, Joshua Landau wrote: > On 23 October 2012 12:07, Jean-Michel Pichavant wrote: > >> - Original Message - >> >> > Thankyou.. but my problem is different than simply joining 2 lists >> > and it is done now :) >> >> >> A lot of people though you were asking for j

Re: Fast forward-backward (write-read)

2012-10-23 Thread Cousin Stanley
Virgil Stokes wrote: > Not sure about "tac" --- could you provide more details on this > and/or a simple example of how it could be used for fast reversed > "reading" of a data file ? tac is available as a command under linux $ whatis tac tac (1) - concatenate and print files in re

Re: can we append a list with another list in Python ?

2012-10-23 Thread Joshua Landau
On 23 October 2012 12:07, Jean-Michel Pichavant wrote: > - Original Message - > > > Thankyou.. but my problem is different than simply joining 2 lists > > and it is done now :) > > > A lot of people though you were asking for joining lists, you description > was misleading. > > I'll ta

regex function driving me nuts

2012-10-23 Thread MartinD.
Hi, I'm new to Python. Does someone has an idea what's wrong. I tried everything. The only regex that is tested is the last one in a whole list of regex in keywords.txt Thanks! Martin def checkKeywords( str, lstKeywords ): for regex in lstKeywords: match

Re: Fast forward-backward (write-read)

2012-10-23 Thread Virgil Stokes
On 23-Oct-2012 19:56, Tim Chase wrote: On 10/23/12 12:17, Virgil Stokes wrote: On 23-Oct-2012 18:09, Tim Chase wrote: Finally, to my question --- What is a fast way to write these variables to an external file and then read them in backwards? Am I missing something, or would the fairly-standar

Re: PIL and requests don't get along

2012-10-23 Thread Alex Clark
On 2012-10-23 18:06:59 +, Roy Smith said: I have a url from which I can get an image. I want to use PIL to manipulate that image. Getting the image is easy: import requests r = requests.get(url) There's a bunch of factory functions for Image, but none of them seem to take anything that

PIL and requests don't get along

2012-10-23 Thread Roy Smith
I have a url from which I can get an image. I want to use PIL to manipulate that image. Getting the image is easy: >>> import requests >>> r = requests.get(url) There's a bunch of factory functions for Image, but none of them seem to take anything that requests is willing to give you. Image.ne

Re: Fast forward-backward (write-read)

2012-10-23 Thread Tim Chase
On 10/23/12 12:17, Virgil Stokes wrote: > On 23-Oct-2012 18:09, Tim Chase wrote: >>> Finally, to my question --- What is a fast way to write these >>> variables to an external file and then read them in >>> backwards? >> Am I missing something, or would the fairly-standard "tac" >> utility do the r

Re: Style help for a Smalltalk-hack

2012-10-23 Thread Ian Kelly
On Tue, Oct 23, 2012 at 9:13 AM, Travis Griggs wrote: > > On Oct 22, 2012, at 6:33 PM, MRAB wrote: > >> Another way you could do it is: >> >> while True: >>chunk = byteStream.read(4) >>if not chunk: >>break >>... >> >> And you could fetch multiple signatures in one read: >> >>

Re: Fast forward-backward (write-read)

2012-10-23 Thread Virgil Stokes
On 23-Oct-2012 18:35, Dennis Lee Bieber wrote: On Tue, 23 Oct 2012 16:31:17 +0200, Virgil Stokes declaimed the following in gmane.comp.python.general: Finally, to my question --- What is a fast way to write these variables to an external file and then read them in backwards? Stuff th

Re: Fast forward-backward (write-read)

2012-10-23 Thread Virgil Stokes
On 23-Oct-2012 18:17, Paul Rubin wrote: Virgil Stokes writes: Finally, to my question --- What is a fast way to write these variables to an external file and then read them in backwards? Seeking backwards in files works, but the performance hit is significant. There is also a performance hit

Re: Fast forward-backward (write-read)

2012-10-23 Thread Virgil Stokes
On 23-Oct-2012 18:09, Tim Chase wrote: On 10/23/12 09:31, Virgil Stokes wrote: I am working with some rather large data files (>100GB) that contain time series data. The data (t_k,y(t_k)), k = 0,1,...,N are stored in ASCII format. I perform various types of processing on these data (e.g. moving

Re: Fast forward-backward (write-read)

2012-10-23 Thread Paul Rubin
Tim Chase writes: > Again, the conversion to/from decimal hasn't been a great cost in my > experience, as it's overwhelmed by the I/O cost of shoveling the > data to/from disk. I've found that cpu costs both for processing and conversion are significant. Also, using a binary format makes the fil

Re: Fast forward-backward (write-read)

2012-10-23 Thread Tim Chase
On 10/23/12 11:17, Paul Rubin wrote: > Virgil Stokes writes: >> Finally, to my question --- What is a fast way to write these >> variables to an external file and then read them in backwards? > > Seeking backwards in files works, but the performance hit is > significant. There is also a performa

Re: A desperate lunge for on-topic-ness

2012-10-23 Thread Ian Kelly
On Mon, Oct 22, 2012 at 7:39 PM, Dennis Lee Bieber wrote: > On Mon, 22 Oct 2012 16:02:34 -0600, Ian Kelly > declaimed the following in gmane.comp.python.general: > >> On my wishlist for Python is a big, fat SyntaxError for any variable >> that could be interpreted as either local or nonlocal and

Re: get each pair from a string.

2012-10-23 Thread Ian Kelly
On Tue, Oct 23, 2012 at 12:47 AM, wrote: > The latest Python version is systematically slower > than the previous ones as soon as one uses non "ascii > strings". No, it isn't. You've previously demonstrated a *microbenchmark* where 3.3 is slower than 3.2. This is a far cry from demonstrating t

Re: Compiling extension module (linker error)

2012-10-23 Thread MRAB
On 2012-10-23 08:00, Paul Volkov wrote: 2012/10/22 MRAB : By the way, the recommendation is for module names to be lowercase with underscores, so "fund_rose" instead of "FundRose". Try this code: I tried as you suggested, but the linker error (unresolved external) is still there. I found a

Re: Fast forward-backward (write-read)

2012-10-23 Thread Paul Rubin
Paul Rubin writes: > Seeking backwards in files works, but the performance hit is > significant. There is also a performance hit to scanning pointers > backwards in memory, due to cache misprediction. If it's something > you're just running a few times, seeking backwards the simplest > approach.

Re: Fast forward-backward (write-read)

2012-10-23 Thread Paul Rubin
Virgil Stokes writes: > Finally, to my question --- What is a fast way to write these > variables to an external file and then read them in backwards? Seeking backwards in files works, but the performance hit is significant. There is also a performance hit to scanning pointers backwards in memor

Re: Fast forward-backward (write-read)

2012-10-23 Thread Tim Chase
On 10/23/12 09:31, Virgil Stokes wrote: > I am working with some rather large data files (>100GB) that contain time > series > data. The data (t_k,y(t_k)), k = 0,1,...,N are stored in ASCII format. I > perform > various types of processing on these data (e.g. moving median, moving > average,

Getting a TimedRotatingFileHandler not to put two dates in the same file?

2012-10-23 Thread David M Chess
We have a TimedRotatingFileHandler with when='midnight'. This works great, splitting the log information across files by date, as long as the process is actually up at midnight. But now the users have noticed that if the process isn't up at midnight, they can end up with lines from two (or I g

Re: Style help for a Smalltalk-hack

2012-10-23 Thread Travis Griggs
On Oct 22, 2012, at 6:33 PM, MRAB wrote: > By the way, in Python the recommended style for variable names (well, > what you'd call a 'variable' in other languages :-)) is lowercase with > underscores, e.g. "byte_stream". We went with the "...mixedCase is allowed only in contexts where that's

Re: Style help for a Smalltalk-hack

2012-10-23 Thread Travis Griggs
On Oct 22, 2012, at 6:33 PM, MRAB wrote: > Another way you could do it is: > > while True: >chunk = byteStream.read(4) >if not chunk: >break >... > > And you could fetch multiple signatures in one read: > > signatures = list(struct.unpack('>{}I'.format(valveCount), byteStr

Fast forward-backward (write-read)

2012-10-23 Thread Virgil Stokes
I am working with some rather large data files (>100GB) that contain time series data. The data (t_k,y(t_k)), k = 0,1,...,N are stored in ASCII format. I perform various types of processing on these data (e.g. moving median, moving average, and Kalman-filter, Kalman-smoother) in a sequential man

problem with ThreadingTCPServer Handler

2012-10-23 Thread jorge
I'm programming a server that most send a message to each client connected to it and nothing else. this is obviously a base of what i want to do. the thing is, I made a class wich contains the Handler class for the ThreadingTCPServer and starts the server but i don't know how can i access the m

Re: can we append a list with another list in Python ?

2012-10-23 Thread Dave Angel
On 10/23/2012 03:36 AM, inshu chauhan wrote: > can we append a list with another list in Python ? using the normal routine > syntax but with a for loop ?? > > To combine list a with list b, you can do any of: c = a + b a += b a.extend(b) Obviously, the first leaves a unmodified, while the other

RE: Fastest template engine

2012-10-23 Thread Andriy Kornatskyy
Python template engines offer high reusability of markup code and the following features are used by content developers most of the time: * Includes: useful to incorporate some snippets of content that in most cases are common to the site, e.g. footer, scripts, styles, etc. * Extends: useful t

Re: get each pair from a string.

2012-10-23 Thread Mark Lawrence
On 23/10/2012 07:47, wxjmfa...@gmail.com wrote: Why bother with speeed? The latest Python version is systematically slower than the previous ones as soon as one uses non "ascii strings". Python users are discussing "code optimizations" without realizing the tool they are using, has killed itse

Re: get each pair from a string.

2012-10-23 Thread Neil Cerutti
On 2012-10-23, wxjmfa...@gmail.com wrote: > Why bother with speeed? Because the differences between O(N), O(log(N)) and O(N ** 2) operations are often relevant. A Python string replace function experiencing a slow-down from previous versions doesn't absolve me from making informed choices of alg

dirty tara lynn takes on multiple cocks

2012-10-23 Thread Constantine
dirty tara lynn takes on multiple cocks http://www.google.com/search?hl=en&q=dirty+tara+lynn+takes+on+multiple+cocks+site:wxwusqxeh470.blogspot.com&btnI=I%27m+Feeling+Lucky -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a way to programmatically turn on remote registry?

2012-10-23 Thread Kevin Holleran
Tim, I am re-implementing in my script now. I'll let you know how it goes... I just realized that the key that I sent over was completely wrong I am not sure how I even got it as it is the combination of two different keys from two different scripts... must have been working too long and ever

Re: can we append a list with another list in Python ?

2012-10-23 Thread Jean-Michel Pichavant
- Original Message - > Thankyou.. but my problem is different than simply joining 2 lists > and it is done now :) A lot of people though you were asking for joining lists, you description was misleading. I'll take a guess: you want to flatten a list of list. "Nested" list comprehe

Re: Making `logging.basicConfig` log to *both* `sys.stderr` and `sys.stdout`?

2012-10-23 Thread Daniel Dehennin
Hello, >> Unfortunately this setup makes `logging.basicConfig` pretty useless. >> However, I believe that this is something that more people could >> benefit from. I also believe, that it just "makes sense" to send >> warnings (and above) to `stderr`, the rest to `stdout`. [...] > Python 2.x is

Re: can we append a list with another list in Python ?

2012-10-23 Thread inshu chauhan
Thankyou.. but my problem is different than simply joining 2 lists and it is done now :) On Tue, Oct 23, 2012 at 11:38 AM, Joshua Landau wrote: > On 23/10/2012, inshu chauhan wrote: > > can we append a list with another list in Python ? using the normal > routine > > syntax but with a for lo

Re: can we append a list with another list in Python ?

2012-10-23 Thread Joshua Landau
On 23/10/2012, inshu chauhan wrote: > can we append a list with another list in Python ? using the normal routine > syntax but with a for loop ?? I assume you want to join two lists. You are corrrect that we can do: >>> start = [1, 2, 3, 4] >>> end = [5, 6, 7, 8] >>> >>> for end_item in end: >>

Re: python scripts for web

2012-10-23 Thread chip9munk
On Friday, October 19, 2012 12:32:48 PM UTC+2, Gilles wrote: > In that case, are you sure a web script is a good idea? If you're > thinking web to make it easy for people to upload data, click on a > button, and get the results back, you might want to write the UI in > Python but write the number c

Fwd: can we append a list with another list in Python ?

2012-10-23 Thread inshu chauhan
-- Forwarded message -- From: Zero Piraeus Date: Tue, Oct 23, 2012 at 11:14 AM Subject: Re: can we append a list with another list in Python ? To: inshu chauhan : On 23 October 2012 05:01, inshu chauhan wrote: > this is because this makes a single list out of 2 lists.. but I w

Re: can we append a list with another list in Python ?

2012-10-23 Thread Adnan Sadzak
> ... but I'm not sure what you mean by "... with a for loop"? > > -[]z. > > Maybe this? : - x = [1,2,3] y = [10,20,30] for z in y: x.append(z) print x - But list.extend should be right way. Cheers -- http://mail.python.org/mailman/listinfo/python-list

Re: can we append a list with another list in Python ?

2012-10-23 Thread Zero Piraeus
: On 23 October 2012 03:36, inshu chauhan wrote: > can we append a list with another list in Python ? using the normal routine > syntax but with a for loop ?? The standard way to append the contents of one list to another is list.extend: >>> a = [1, 2, 3] >>> b = [4, 5, 6] >>> a.extend(b) >>> a

Re: can we append a list with another list in Python ?

2012-10-23 Thread Daniel Fetchinson
> can we append a list with another list in Python ? using the normal routine > syntax but with a for loop ?? x = [1,2,3] y = [10,20,30] x.extend( y ) print x this will give you [1,2,3,10,20,30] which I guess is what you want. Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress

Re: Is there a way to programmatically turn on remote registry?

2012-10-23 Thread Tim Golden
On 22/10/2012 21:01, Kevin Holleran wrote: > Tim, > > I am looking here: > > SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{BF9F6FB0-C999-4D19-BED0-144F77E2A9D6} > > Enumerating the keys for a BusType == 5, then grabbing the values of > DriverDesc, DriverDate, & DriverVersion. > > So I am

Re: can we append a list with another list in Python ?

2012-10-23 Thread Alec Taylor
Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> [1,2,3,4,5] + [99,88,77,66,0] [1, 2, 3, 4, 5, 99, 88, 77, 66, 0] On Tue, Oct 23, 2012 at 6:36 PM, inshu chauhan wrote: > can we append a li

Re: A desperate lunge for on-topic-ness

2012-10-23 Thread Joshua Landau
On 23/10/2012, Dennis Lee Bieber wrote: > On Mon, 22 Oct 2012 16:02:34 -0600, Ian Kelly > declaimed the following in gmane.comp.python.general: > >> On my wishlist for Python is a big, fat SyntaxError for any variable >> that could be interpreted as either local or nonlocal and is not >> explicit

Re: Compiling extension module (linker error)

2012-10-23 Thread Paul Volkov
2012/10/22 MRAB : > By the way, the recommendation is for module names to be lowercase with > underscores, so "fund_rose" instead of "FundRose". > > Try this code: > I tried as you suggested, but the linker error (unresolved external) is still there. I'm sure python33.lib is properly added because