detecting that a SQL db is running

2006-11-30 Thread bill ramsay
Hi I wonder if anyone can help me with a problem that I have with MSDE SQL db. [I am changing to SQL server soon]. I have an app that runs on a server that communicates with remote devices using email, this and other similar servers then sends XML/SOAP messages to a master application. I am in

RE: [help] Is it true to call obj.__str__() while executing printobj?

2006-11-30 Thread Metal Zong
Thanks. Please refer to following snipt: 1 class Printable(type): 2 ... def __str__(cls): 3 ... return This is class %s % cls.__name__ 4 ... 5 class C(object): 6 ... __metaclass__ = Printable 7 ... 8 9 C.__str__ 10 slot wrapper '__str__' of 'object' objects 11 12 print C 13

Re: why would anyone use python when java is there?

2006-11-30 Thread gavino
gregarican wrote: gavino wrote: wtf You have to be trolling I would think. For most people I think they would like to code in Python if they had a personal choice. But for professional reasons they are likely forced to code in Java because of the sheep mentality of the large corporate

Re: Remarkable results with psyco and sieve of Eratosthenes

2006-11-30 Thread bearophileHUGS
George Sakkis: You can also save an attribute lookup for append; just add append = primes.append outside of the loop and replace primes.append(x) with append(x) That should cut down a few fractions of second. We were talking about Psyco, and I think with Psyco (just released for Py 2.5, BTW)

Re: Python Question About Compiling.

2006-11-30 Thread Tim Roberts
Scheol Service [EMAIL PROTECTED] wrote: Im just unsure on how to compile python code into .exe executionable files. Is there a simple way to do this? Sort of. Python code is not compiled to machine language. Instead, it is compiled to an intermediate language that is then interpreted. That

Re: Why are slice indices the way they are in python?

2006-11-30 Thread Ant
Steve Bergman wrote: ... Why? It doesn't seem intuitive to me. To me, it makes it harder, not easier, to work with slices than if indexing started at 1 and the above expression got you the 2nd throught the 5th character. Dijkstra has an article about this:

Re: Good script editor for Python on Mac OS 10.3

2006-11-30 Thread martin . laloux
I work with Python on mac os 10.3.9 First of all : Install a newer version of python for mac, from http://pythonmac.org/packages/ (python 2.4.4 - http://pythonmac.org/packages/py24-fat/index.html) (python 2.5 - http://pythonmac.org/packages/py25-fat/index.html) you have a more standard python

Re: SPE refuses.

2006-11-30 Thread egbert
On Wed, Nov 29, 2006 at 03:15:45PM -0800, SPE - Stani's Python Editor wrote: Do you have python-wxversion installed? $sudo apt-get install python-wxversion That helped. But why isn't it included in the wxPython download ? Anyway, the first screen looks great. I will explore spe. Thanks. e.

Re: for i in range() anti-pattern [was Re: trouble writing results to files]

2006-11-30 Thread Roberto Bonvallet
Steven D'Aprano wrote: On Wed, 29 Nov 2006 17:00:30 +0100, Fredrik Lundh wrote: Neil Cerutti wrote: BTW, iterating over range(len(a)) is an anti-pattern in Python. Unless you're modifying elements of a, surely? and needs to run on a Python version that doesn't support enumerate.

question on pygtk and accessibility on windows.

2006-11-30 Thread krishnakant Mane
has any one tried py gtk on windows? I tried to do a google search for accessibility related issues but did not find any thing specific to pygtk and windows accessibility. I even tried to search for just gtk and windows accessibility but again no result. so I am now posting this message as a last

Slicing versus loops, was Re: for i in range() anti-pattern

2006-11-30 Thread Peter Otten
Steven D'Aprano wrote: And remember that if alist is truly huge, you may take a performance hit due to duplicating all those megabytes of data when you slice it. Having the same object in two lists simultaneously does not double the total amount of memory; you just need space for an extra

Re: SPE refuses.

2006-11-30 Thread SPE - Stani's Python Editor
On 30 nov, 10:50, egbert [EMAIL PROTECTED] wrote: On Wed, Nov 29, 2006 at 03:15:45PM -0800, SPE - Stani's Python Editor wrote: Do you have python-wxversion installed? $sudo apt-get install python-wxversionThat helped. But why isn't it included in the wxPython download ? I was surprised as

Re: Slicing versus loops, was Re: for i in range() anti-pattern

2006-11-30 Thread Duncan Booth
Peter Otten [EMAIL PROTECTED] wrote: That example was chosen to prove your point. The real contender for the swap items problem are slices. def swap_slice(items): left = items[::2] items[::2] = items[1::2] items[1::2] = left return items It makes no difference to the

Re: Slicing versus loops, was Re: for i in range() anti-pattern

2006-11-30 Thread Peter Otten
Duncan Booth wrote: items[::2], items[1::2] = items[1::2], items[::2] Cool. I really should have found that myself. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: why would anyone use python when java is there?

2006-11-30 Thread Richie Hindle
[Adam] For the life of me I can't understand why he would troll comp.lang.python when comp.lang.lisp is there. +1 QOTW! -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: SPE refuses.

2006-11-30 Thread Thomas Ploch
SPE - Stani's Python Editor schrieb: On 30 nov, 10:50, egbert [EMAIL PROTECTED] wrote: On Wed, Nov 29, 2006 at 03:15:45PM -0800, SPE - Stani's Python Editor wrote: Do you have python-wxversion installed? $sudo apt-get install python-wxversionThat helped. But why isn't it included in the

Re: SPE refuses.

2006-11-30 Thread SPE - Stani's Python Editor
which version of SPE are you using? You'll need SPE 0.8.3.c for wxPython 2.7 I've fixed this bug already in the latest version. http://prdownload.berlios.de/python/SPE-0.8.3.c-wx2.6.1.0-no_setup.zip Stani On 30 nov, 12:23, Thomas Ploch [EMAIL PROTECTED] wrote: SPE - Stani's Python Editor

Python language extension mechanism for Python 3000... Worth for PEP?

2006-11-30 Thread Petr Prikryl
Do you think that the following could became PEP (pre PEP). Please, read it, comment it, reformulate it,... Abstract Introduction of the mechanism for language extensions via modules written using other languages. Extensions of Python could be done via special interpreter extensions.

Re: why would anyone use python when java is there?

2006-11-30 Thread Stephen Eilert
gavino escreveu: I want to learn to program and I can't seem to pick a direction. A java guy I know makes a lot of $, but a lot of reading I have done shows lisp smalltalk and haskell to be really nice, as well as of course python. It seems python is 4/5 way to lisp yet has a lot of

Re: why would anyone use python when java is there?

2006-11-30 Thread Paul Boddie
Richie Hindle wrote: [Adam] For the life of me I can't understand why he would troll comp.lang.python when comp.lang.lisp is there. +1 QOTW! Overruled! ;-) Mostly because comp.lang.lisp seems to have become a much better place to get quotes of the week about Python than comp.lang.python

Re: why would anyone use python when java is there?

2006-11-30 Thread Richie Hindle
[Adam] For the life of me I can't understand why he would troll comp.lang.python when comp.lang.lisp is there. [Richie] +1 QOTW! [Paul] Overruled! ;-) Mostly because comp.lang.lisp seems to have become a much better place to get quotes of the week about Python than comp.lang.python

Re: Slicing versus loops, was Re: for i in range() anti-pattern

2006-11-30 Thread Steven D'Aprano
On Thu, 30 Nov 2006 11:17:17 +0100, Peter Otten wrote: Steven D'Aprano wrote: And remember that if alist is truly huge, you may take a performance hit due to duplicating all those megabytes of data when you slice it. Having the same object in two lists simultaneously does not double the

Re: Slicing versus loops, was Re: for i in range() anti-pattern

2006-11-30 Thread Duncan Booth
Steven D'Aprano [EMAIL PROTECTED] wrote: Everybody always forgets corner cases... like lists with odd number of items... *wink* I didn't forget. I just assumed that raising an exception was a more useful response. Here is a version that handles both odd and even length lists: def

Re: PythonTidy

2006-11-30 Thread Roberto Bonvallet
Chuck Rhode wrote: I couldn't find a routine to clean up, regularize, and reformat Python code, so I wrote one: http://www.lacusveris.com/PythonTidy/PythonTidy.python Now, I'm looking for beta-testers. Compensation is a bit on the low side. In fact it's limited to the satisfaction of

Re: IEC Controller and head element

2006-11-30 Thread Danny Scaleno
Maybe this help someone else. The solution comes with old VB6. It's COM Land so introspecting the VB WebBrowser Control object I found properties and methods to correctly access all parts of the python IEC.Document object returned by the IEC Controller

Re: PythonTidy

2006-11-30 Thread Laurent Pointal
Roberto Bonvallet a écrit : Chuck Rhode wrote: I couldn't find a routine to clean up, regularize, and reformat Python code, so I wrote one: http://www.lacusveris.com/PythonTidy/PythonTidy.python Now, I'm looking for beta-testers. Compensation is a bit on the low side. In fact it's

Re: PythonTidy

2006-11-30 Thread Richie Hindle
[Roberto] # vim: set fileencoding=utf-8 : ... # -*- coding: utf-8 -*- ... About changing the encoding declaration from vim-style to emacs-style: I'll take it as an insult :) [Laurent] This is not emacs-style, this is Python normalized source encoding directive for correct interpretation

Re: PythonTidy

2006-11-30 Thread Roberto Bonvallet
Laurent Pointal wrote: ... # vim: set fileencoding=utf-8 : ... # -*- coding: utf-8 -*- ... This is not emacs-style, this is Python normalized source encoding directive for correct interpretation of u... strings by Python interpreter. See http://www.python.org/dev/peps/pep-0263/ The

Re: PythonTidy

2006-11-30 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Laurent Pointal wrote: Roberto Bonvallet a écrit : # vim: set fileencoding=utf-8 : ... # -*- coding: utf-8 -*- ... About changing the shebang line: I'll take it as a bug. About changing the encoding declaration from vim-style to emacs-style: I'll take it as an

Re: PythonTidy

2006-11-30 Thread Laurent Pointal
Laurent Pointal a écrit : See http://www.python.org/dev/peps/pep-0263/ Aye, sorry for my missreading... [seem I hurt the emacs guy] -- http://mail.python.org/mailman/listinfo/python-list

Re: Remarkable results with psyco and sieve of Eratosthenes

2006-11-30 Thread Pekka Karjalainen
In article [EMAIL PROTECTED], Steve Bergman wrote: BTW, can this code be made any more efficient? def primes(): primes=[3] for x in xrange(5,1000,2): maxfact = int(math.sqrt(x)) flag=True for y in primes: if y maxfact: break [...]

More elegant to get a name: o.__class__.__name__

2006-11-30 Thread alf
Hi, is there a more elegant way to get o.__class__.__name__. For instance I would imagine name(o). -- alf -- http://mail.python.org/mailman/listinfo/python-list

Re: Remarkable results with psyco and sieve of Eratosthenes

2006-11-30 Thread Klaus Alexander Seistrup
Pekka Karjalainen wrote: You can omit the call to math.sqrt if you test this instead. y*y x in place of if y maxfact: . Or use sqrt = lambda x: x ** .5 Cheers, -- Klaus Alexander Seistrup http://klaus.seistrup.dk/ -- http://mail.python.org/mailman/listinfo/python-list

Re: More elegant to get a name: o.__class__.__name__

2006-11-30 Thread Carl Banks
alf wrote: Hi, is there a more elegant way to get o.__class__.__name__. For instance I would imagine name(o). def name_of_type(o): return o.__class__.__name__ name_of_type(o) Carl Banks P.S. name(o) suggests it's the name of the object, not the type P.P.S. you could use

Re: More elegant to get a name: o.__class__.__name__

2006-11-30 Thread Paul McGuire
alf [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, is there a more elegant way to get o.__class__.__name__. For instance I would imagine name(o). -- alf name = lambda o : o.__class__.__name__ name(1) 'int' Go for it! -- Paul --

Re: pickle and infinity

2006-11-30 Thread Bart Ogryczak
Grant Edwards wrote: On 2006-11-29, Bart Ogryczak [EMAIL PROTECTED] wrote: Fredrik Lundh wrote: Bart Ogryczak wrote: I´ve got this problem with pickle, it seems it doesn´t handle correctly infinite values (nor does Python return overflow/underflow error). Python 2.X relies

Re: PythonTidy

2006-11-30 Thread Chuck Rhode
Roberto Bonvallet wrote this on Thu, Nov 30, 2006 at 01:21:55PM +. My reply is below. About changing the shebang line: I'll take it as a bug. About changing the encoding declaration from vim-style to emacs-style: I'll take it as an insult :) Ooh! wounded Both are comments, and should

Re: fork and exit needed?

2006-11-30 Thread Vincent Delporte
On Tue, 28 Nov 2006 04:30:09 -0600, Nick Craig-Wood [EMAIL PROTECTED] wrote: I'm not sure how you do open stdout to /dev/null in python though! I suspect something like this... import posix posix.close(1) posix.open(/dev/null, posix.O_WRONLY) Thanks everyone, but no go :-/ Neither the

Re: Python language extension mechanism for Python 3000... Worth for PEP?

2006-11-30 Thread John Roth
Petr Prikryl wrote: Do you think that the following could became PEP (pre PEP). Please, read it, comment it, reformulate it,... Abstract Introduction of the mechanism for language extensions via modules written using other languages. Extensions of Python could be done via special

Re: fork and exit needed?

2006-11-30 Thread Vincent Delporte
On Thu, 30 Nov 2006 15:38:11 +0100, Vincent Delporte [EMAIL PROTECTED] wrote: Here's my Python rewrite: http://codecomplete.free.fr/asterisk/python_cid.txt More information. Here's what Asterisk says when I call in: *CLI -- Executing LookupCIDName(SIP/fxo-0844e458, ) in new stack --

Re: fork and exit needed?

2006-11-30 Thread Vincent Delporte
On Thu, 30 Nov 2006 15:48:53 +0100, Vincent Delporte [EMAIL PROTECTED] wrote: -- Launched AGI Script /var/lib/asterisk/agi-bin/ncid.python.agi Failed to execute '/var/lib/asterisk/agi-bin/ncid.python.agi': Exec format error Stupid me :-/ Forgot the all-important #!/usr/bin/python Sorry for

Re: PythonTidy

2006-11-30 Thread Roberto Bonvallet
Chuck Rhode wrote: [...] Thanks, too, for trying *PythonTidy*. No, thanks you for writing such a tool! [...] nevertheless, most [options] are declared near the beginning where they sit just begging for end-user involvement. See: CODING_SPEC and SHEBANG. The fact that I immediately noticed

Re: why would anyone use python when java is there?

2006-11-30 Thread A. Lloyd Flanagan
On Nov 30, 3:19 am, gavino [EMAIL PROTECTED] wrote: I want to learn to program and I can't seem to pick a direction. A java guy I know makes a lot of $, but a lot of reading I have done shows lisp smalltalk and haskell to be really nice, as well as of course python. It seems python is 4/5

Re: fork and exit needed?

2006-11-30 Thread Mike C. Fletcher
Vincent Delporte wrote: On Thu, 30 Nov 2006 15:38:11 +0100, Vincent Delporte [EMAIL PROTECTED] wrote: Here's my Python rewrite: http://codecomplete.free.fr/asterisk/python_cid.txt First line of your script should be: #! /usr/bin/env python which is how Linux knows what interpreter

Threading

2006-11-30 Thread Gheorghe Postelnicu
Hi, I have a very simple Python script that performs some batch processing as follows: a list of system commands is set up in an automated way and then each of the processes is launched separately using threads - a basic producer-consumer thing. I found a recipe on ASPN on how to intercept

Re: why would anyone use python when java is there?

2006-11-30 Thread Steve Bergman
Bruce Eckel states the case pretty well in this interview: http://www.artima.com/intv/aboutme.html Bruce is the author of Thinking In Java and other excellent books, but has migrated from the Java camp. (I'm excited to see him getting at least a bit involved in TurboGears. He has a lot to offer

Re: fork and exit needed?

2006-11-30 Thread Vincent Delporte
On Thu, 30 Nov 2006 10:18:24 -0500, Mike C. Fletcher [EMAIL PROTECTED] wrote: which is how Linux knows what interpreter to use for the script. Thanks. That's what I found out after a bit more research. I didn't pay attention to this because it's not needed to run under Windows, and I was focusing

Re: question on pygtk and accessibility on windows.

2006-11-30 Thread faulkner
if by 'accessibility' you mean 'usable' (like python and firefox are usable), then yes. there are pygtk bindings for windows, and they work. http://python-forum.org/py/viewtopic.php?t=116 if by 'accessibility' you mean 'usable for the blind/deaf', then i think that is up to you as an application

Re: why would anyone use python when java is there?

2006-11-30 Thread Istvan Albert
gavino wrote: I want to learn to program and I can't seem to pick a direction. A Learning how to program and learning a programming language are completely different things. The former far more difficult then the latter. There is nothing better than Python to learn how to program because it

EasyInstall under Windows - strange behaviour

2006-11-30 Thread Norbert
Hello all, i try to install ZSI under python 2.5 and windows 2000. I Downloaded the egg and tried the following c:\Python25\Scriptseasy_install.exe c:\download\ZSI-2.0_rc3-py2.5.egg The result is that pythonwin pops up and shows the file : c:\Python25\Scripts\easy_install-script.py :

Re: a quickie: range - x

2006-11-30 Thread Kent Johnson
Steven D'Aprano wrote: On Wed, 29 Nov 2006 19:42:16 -0800, rjtucke wrote: I want an iterable from 0 to N except for element m (=M). x = range(m-1) + range(m+1, N) Should be range(m) + range(m+1, N) Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: EasyInstall under Windows - strange behaviour

2006-11-30 Thread [EMAIL PROTECTED]
Norbert wrote: Hello all, i try to install ZSI under python 2.5 and windows 2000. I Downloaded the egg and tried the following c:\Python25\Scriptseasy_install.exe c:\download\ZSI-2.0_rc3-py2.5.egg The result is that pythonwin pops up and shows the file :

*** Rogue OFFICIAL Bastards DEFAME the NAME of UNITED STATES of AMERICA ***

2006-11-30 Thread st911
The written apology reads: The United States of America apologizes to Mr. Brandon Mayfield and his family for the suffering caused by the FBI's misidentification of Mr. Mayfield's fingerprint and the resulting investigation of Mr. Mayfield, including his arrest as a material witness in connection

*** ARE The FBI Bastards are making movies of YOUR PRIVATE MARITAL SEXUAL MOMENTS ***

2006-11-30 Thread st911
The written apology reads: The United States of America apologizes to Mr. Brandon Mayfield and his family for the suffering caused by the FBI's misidentification of Mr. Mayfield's fingerprint and the resulting investigation of Mr. Mayfield, including his arrest as a material witness in connection

*** DONT HESITATE TO SUE THE OFFICIAL BASTARDS IN THE GOVERNMENT, FEDERAL, STATE OR CITY ***

2006-11-30 Thread st911
The written apology reads: The United States of America apologizes to Mr. Brandon Mayfield and his family for the suffering caused by the FBI's misidentification of Mr. Mayfield's fingerprint and the resulting investigation of Mr. Mayfield, including his arrest as a material witness in connection

Re: Why are slice indices the way they are in python?

2006-11-30 Thread [EMAIL PROTECTED]
Why? It doesn't seem intuitive to me. To me, it makes it harder, not easier, to work with slices than if indexing started at 1 and the above expression got you the 2nd throught the 5th character. Zero-based indices and excluding last index often works nicer, it is not the rule, but all my

Python Worship

2006-11-30 Thread Nick
http://www.sciencedaily.com/releases/2006/11/061130081347.htm World's Oldest Ritual Discovered -- Worshipped The Python 70,000 Years Ago Nick -- http://mail.python.org/mailman/listinfo/python-list

extremely slow array indexing?

2006-11-30 Thread Grace Fang
Hi, I am writing code to sort the columns according to the sum of each column. The dataset is huge (50k rows x 300k cols), so i need to read line by line and do the summation to avoid the out-of-memory problem. But I don't know why it runs very slow, and part of the code is as follows. I suspect

Re: why would anyone use python when java is there?

2006-11-30 Thread gregarican
I would recommend learning one language out of each of three potential groups. Just my $0.02 USD: 1) Larger commercial languages - Java, C++, C#. 2) Fun, productive scripting languages - Python, Ruby 3) Academic languages - C, Lisp, Haskell, Smalltalk This doesn't mean that Python can't be a

Re: Threading

2006-11-30 Thread fumanchu
Gheorghe Postelnicu wrote: I found a recipe on ASPN on how to intercept keyboard interrupts and that is useful if I need to brutally kill the launching process. However, my question regards killing the actual children threads - they are spending lots of time in system calls, so I cannot

shtoom making PC2Phone calls

2006-11-30 Thread Croteam
Hello, Can somebody give me shtoom examples or source code for making PC2Phone calls and pc to pc calls. (if you give me source code,please give me full url to that source or send me to email: [EMAIL PROTECTED]) Thanks,I will really appreciate that --

Re: failure building python 2.5 on mac os x 10.3.9

2006-11-30 Thread Markus Rosenstihl
On 2006-11-19 15:50:14 +0100, Thomas Ploch [EMAIL PROTECTED] said: Hello, I followed the instructions in the Mac/README file. I ran ./configure --enable-framework But when I try to build from source with gcc 4.0.2, following happens: [snip] libtool: can't locate file for:

Tkinter

2006-11-30 Thread Boneh
The module is not found on the system, althouhg I can use python2.4. i am using fedoralinux5 Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: extremely slow array indexing?

2006-11-30 Thread Will McGugan
Grace Fang wrote: Hi, I am writing code to sort the columns according to the sum of each column. The dataset is huge (50k rows x 300k cols), so i need to read line by line and do the summation to avoid the out-of-memory problem. But I don't know why it runs very slow, and part of the code

Re: Python Worship

2006-11-30 Thread Thomas Ploch
Nick schrieb: http://www.sciencedaily.com/releases/2006/11/061130081347.htm World's Oldest Ritual Discovered -- Worshipped The Python 70,000 Years Ago Nick That's really interesting since there is an indio tribe in the amazonas jungle which also worships python. That just tells me

Re: Problem with imaplib (weird result if mailbox contains a %)

2006-11-30 Thread Donn Cave
In article [EMAIL PROTECTED], Antoon Pardon [EMAIL PROTECTED] wrote: ... $ telnet machine.domain imap Trying xxx.xxx.xxx.xxx... Connected to machine.domain Escape character is '^]'. * OK maxi Cyrus IMAP4 v2.2.13 server ready 0001 LOGIN ... 0001 OK User logged in 0002 LIST

Re: failure building python 2.5 on mac os x 10.3.9

2006-11-30 Thread Thomas Ploch
Markus Rosenstihl schrieb: On 2006-11-19 15:50:14 +0100, Thomas Ploch [EMAIL PROTECTED] said: Hello, I followed the instructions in the Mac/README file. I ran ./configure --enable-framework But when I try to build from source with gcc 4.0.2, following happens: [snip] libtool: can't

Automatic increment

2006-11-30 Thread Gheorghe Postelnicu
Hi, I have a situation of the following type: for line in lineList: for item in line.split() myArray[counter, itemCounter] itemCounter = itemCounter + 1 counter = counter +1 Is there a way to get rid of the manual incrementation of the 2 counters? Thanks, -- Gheorghe

Re: extremely slow array indexing?

2006-11-30 Thread Grace Fang
Hi will,Thanks for your reply. The simplified code is as follows, and you can run it if you like. It takes 7 seconds to process 1000 rows, which is tolerable, but I wonder why it takes so long, because I also did one for loop through all of the same rows without accessing array, which only takes 1

Re: Threading

2006-11-30 Thread utabintarbo
Gheorghe Postelnicu wrote: ... However, my question regards killing the actual children threads - they are spending lots of time in system calls, so I cannot insert some while loop in a derived Thread class. Any suggestions would be apreciated. Have the threads look for a semaphore file. If

Re: Automatic increment

2006-11-30 Thread [EMAIL PROTECTED]
Gheorghe Postelnicu wrote: Hi, I have a situation of the following type: for line in lineList: for item in line.split() myArray[counter, itemCounter] itemCounter = itemCounter + 1 counter = counter +1 Is there a way to get rid of the manual incrementation of the

Trying to understand rfc822.Message() behaviour

2006-11-30 Thread Phoe6
Hi all, Have a look at this snippet, I have a file direct.txt and I want to read it as rfc8222.Message() so that I get the Subject: and Mood: as Dict Keys and content separately, but I am unable to get the Content Properly. fhandle = open('direct.txt','r') print fhandle.read() Subject: testing

Re: Automatic increment

2006-11-30 Thread Thomas Ploch
Gheorghe Postelnicu schrieb: Hi, I have a situation of the following type: for line in lineList: for item in line.split() myArray[counter, itemCounter] itemCounter = itemCounter + 1 counter = counter +1 Is there a way to get rid of the manual incrementation of

Re: Trying to understand rfc822.Message() behaviour

2006-11-30 Thread Fredrik Lundh
Phoe6 wrote: Have a look at this snippet, I have a file direct.txt and I want to read it as rfc8222.Message() so that I get the Subject: and Mood: as Dict Keys and content separately, but I am unable to get the Content Properly. fhandle = open('direct.txt','r') print fhandle.read()

Re: Trying to understand rfc822.Message() behaviour

2006-11-30 Thread Neil Cerutti
On 2006-11-30, Phoe6 [EMAIL PROTECTED] wrote: Hi all, Have a look at this snippet, I have a file direct.txt and I want to read it as rfc8222.Message() so that I get the Subject: and Mood: as Dict Keys and content separately, but I am unable to get the Content Properly. fhandle =

Re: Automatic increment

2006-11-30 Thread Neil Cerutti
On 2006-11-30, Thomas Ploch [EMAIL PROTECTED] wrote: Gheorghe Postelnicu schrieb: Hi, I have a situation of the following type: for line in lineList: for item in line.split() myArray[counter, itemCounter] itemCounter = itemCounter + 1 counter = counter +1 Is

Re: extremely slow array indexing?

2006-11-30 Thread John Machin
Will McGugan wrote: Grace Fang wrote: Hi, I am writing code to sort the columns according to the sum of each column. The dataset is huge (50k rows x 300k cols), so i need to read line by line and do the summation to avoid the out-of-memory problem. But I don't know why it runs very

Re: Trying to understand rfc822.Message() behaviour

2006-11-30 Thread Phoe6
Fredrik Lundh wrote: Phoe6 wrote: Have a look at this snippet, I have a file direct.txt and I want to read it as rfc8222.Message() so that I get the Subject: and Mood: as Dict Keys and content separately, but I am unable to get the Content Properly. because the rfc822.Message parser

Re: Automatic increment

2006-11-30 Thread John Machin
Gheorghe Postelnicu wrote: Hi, I have a situation of the following type: for line in lineList: for item in line.split() myArray[counter, itemCounter] What do you imagine that the above line is doing? Alternatively, should you be posting in comp.lang.somelanguageotherthanPython

Re: Tkinter

2006-11-30 Thread Boneh
Boneh wrote: The module is not found on the system, althouhg I can use python2.4. i am using fedoralinux5 Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: extremely slow array indexing?

2006-11-30 Thread Robert Kern
John Machin wrote: Hi Grace, What Will McGugan said, plus: 1. Post *much* more of your code e.g. all relevant parts :-) Note that Grace has also posted this to numpy-discussion and with prompting provided the following snippet as a distillation of the key slow part: from numpy import *

Re: Tkinter

2006-11-30 Thread Fredrik Lundh
Boneh wrote: The module is not found on the system, althouhg I can use python2.4. i am using fedoralinux5 I see lots of question marks, but I don't see a question. are you asking why a module you haven't installed isn't installed? have you tried

DDE (eSignal)

2006-11-30 Thread BBands
I have a Python ap that needs current stock prices, which I want to get from eSignal's DDE server. Following the win32all example: import win32ui import dde server = dde.CreateServer() server.Create(eSignalDDE) conversation = dde.CreateConversation(server) conversation.ConnectTo(WINROS, Last)

Is there an easier way to express this list slicing?

2006-11-30 Thread John Henry
If I have a list of say, 10 elements and I need to slice it into irregular size list, I would have to create a bunch of temporary variables and then regroup them afterwords, like: # Just for illustration. Alist can be any existing 10 element list a_list=(,)*10 (a,b,c1,c2,c3,d1,d2,d3,d4,d5)=a_list

Python spam?

2006-11-30 Thread Aahz
Anyone else getting Python-related spam? So far, I've seen messages from Barry Warsaw and Skip Montanaro (although of course header analysis proves they didn't send it). -- Aahz ([EMAIL PROTECTED]) * http://www.pythoncraft.com/ Usenet is not a democracy. It is a weird cross

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread Thomas Ploch
John Henry schrieb: If I have a list of say, 10 elements and I need to slice it into irregular size list, I would have to create a bunch of temporary variables and then regroup them afterwords, like: # Just for illustration. Alist can be any existing 10 element list a_list=(,)*10

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread Chris Mellon
On 11/30/06, Thomas Ploch [EMAIL PROTECTED] wrote: John Henry schrieb: If I have a list of say, 10 elements and I need to slice it into irregular size list, I would have to create a bunch of temporary variables and then regroup them afterwords, like: # Just for illustration. Alist can

Re: DDE (eSignal)

2006-11-30 Thread Thomas Heller
BBands schrieb: I have a Python ap that needs current stock prices, which I want to get from eSignal's DDE server. Following the win32all example: import win32ui import dde server = dde.CreateServer() server.Create(eSignalDDE) conversation = dde.CreateConversation(server)

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread John Henry
Well, pardoon me. Next. Thomas Ploch wrote: John Henry schrieb: If I have a list of say, 10 elements and I need to slice it into irregular size list, I would have to create a bunch of temporary variables and then regroup them afterwords, like: # Just for illustration. Alist can be any

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread mdsteele
John Henry wrote: Can I say something to the effect of: (a,b,c[0:2],d[0:5])=a_list# Obviously this won't work Your best bet is probably: x = [...some list...] a,b,c,d = x[:1],x[1:2],x[2:5],x[5:] I am asking this because I have a section of code that contains *lots* of things like this.

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread Neil Cerutti
On 2006-11-30, John Henry [EMAIL PROTECTED] wrote: If I have a list of say, 10 elements and I need to slice it into irregular size list, I would have to create a bunch of temporary variables and then regroup them afterwords, like: # Just for illustration. Alist can be any existing 10 element

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread Neil Cerutti
On 2006-11-30, Neil Cerutti [EMAIL PROTECTED] wrote: On 2006-11-30, John Henry [EMAIL PROTECTED] wrote: If I have a list of say, 10 elements and I need to slice it into irregular size list, I would have to create a bunch of temporary variables and then regroup them afterwords, like: # Just

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread Paul McGuire
John Henry [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] If I have a list of say, 10 elements and I need to slice it into irregular size list, I would have to create a bunch of temporary variables and then regroup them afterwords, like: # Just for illustration. Alist can be any

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread Paul McGuire
Paul McGuire [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] John Henry [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] snip G... that's what I get for not keeping editor and interpreter windows in sync. My post was referencing vars I had defined in the interpreter,

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread John Henry
[EMAIL PROTECTED] wrote: John Henry wrote: Can I say something to the effect of: (a,b,c[0:2],d[0:5])=a_list# Obviously this won't work Your best bet is probably: x = [...some list...] a,b,c,d = x[:1],x[1:2],x[2:5],x[5:] Dude! Why didn't I think of that (tunnel vision). Thanks,

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread John Henry
Paul McGuire wrote: Paul McGuire [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] John Henry [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] snip G... that's what I get for not keeping editor and interpreter windows in sync. My post was referencing vars I had

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread John Henry
John Henry wrote: Paul McGuire wrote: Paul McGuire [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] John Henry [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] snip G... that's what I get for not keeping editor and interpreter windows in sync. My post was

Re: DDE (eSignal)

2006-11-30 Thread BBands
Thomas Heller wrote: Looks like a bug, either in the dde module or the dde server. But it's easy to find a workaround: '1402.6700\x00\x12\x00*\x00\x00\x004\xfb\x12\x00\xfd\x1a\xd9w4\xc1\x00'.split(\0)[0] '1402.6700' float(last.split(\0)[0]) works for me. Thanks for that!

Is there a reason not to do this?

2006-11-30 Thread Ron Garret
One of the things I find annoying about Python is that when you make a change to a method definition that change is not reflected in existing instances of a class (because you're really defining a new class when you reload a class definition, not actually redefining it). So I came up with

Re: Python spam?

2006-11-30 Thread Thomas Heller
Aahz schrieb: Anyone else getting Python-related spam? So far, I've seen messages from Barry Warsaw and Skip Montanaro (although of course header analysis proves they didn't send it). I'm getting spam not only from Barry, but also from myself ;-) with forged headers. But I'm not sure what

  1   2   >