Re: what IDE is the best to write python?

2009-02-01 Thread r
On Feb 1, 1:42 am, "mcheun...@hotmail.com" wrote: > Hi all >    what IDE is the best to write python? That's like asking boxers or briefs, everybody thinks their choice is the best. I like freedom if that gives you a hint. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: is python Object oriented??

2009-02-01 Thread Marc 'BlackJack' Rintsch
On Sat, 31 Jan 2009 09:08:25 -0800, thmpsn.m.k wrote: > On Jan 30, 12:15 am, Chris Rebert wrote: >> - Python supports encapsulation. Prefixing an attribute/method with an >> underscore indicates that other programmers should treat it as >> 'private'. However, unlike B&D languages, Python itself d

Re: what IDE is the best to write python?

2009-02-01 Thread Stephen Hansen
On Sat, Jan 31, 2009 at 11:42 PM, mcheun...@hotmail.com wrote:Hi all   what IDE is the best to write python? thanks from Peter (mcheun...@hotmail.com)What OS? And define "IDE"? Do you just want an editing environment with say class browsing capabilities or do you want an integrated debugger an

Re: fastest way to detect a user type

2009-02-01 Thread Steven D'Aprano
Robin Becker wrote: > Whilst considering a port of old code to python 3 I see that in several > places we are using type comparisons to control processing of user > instances (as opposed to instances of built in types eg float, int, str) > > I find that the obvious alternatives are not as fast as

Re: accessing elements of a tuple

2009-02-01 Thread Steven D'Aprano
D'Arcy J.M. Cain wrote: > First of all, list is a reserved word.  Don't use it as a variable name. Unless you mean to. Shadowing built-ins is only a bad thing when you do it by accident. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: fastest way to detect a user type

2009-02-01 Thread Paul Rubin
Steven D'Aprano writes: > First question is, why do you care that it's slower? The difference between > the fastest and slowest functions is 1.16-0.33 = 0.83 microsecond. That's a 71% speedup, pretty good if you ask me. > If you call the slowest function one million times, your code will > run

Re: nth root

2009-02-01 Thread casevh
On Jan 31, 9:36 pm, "Tim Roberts" wrote: > Actually, all I'm interested in is whether the 100 digit numbers have an > exact integral root, or not.  At the moment, because of accuracy concerns, > I'm doing something like > >                     for root in powersp: >                             n

Re: Searching a file for multiple strings (PS)

2009-02-01 Thread Shawn Milochik
On Sun, Feb 1, 2009 at 1:14 AM, John Machin wrote: > On Feb 1, 3:39 pm, Shawn Milochik wrote: > >> Not to discourage the use of Python, but it seems that fgrep with the >> -f flag already does exactly what you want. If you're on Windows, you >> can get the Windows version of fgrep here: http://un

Re: Embedding numpy works once, but not twice??

2009-02-01 Thread Gabriel Genellina
En Sun, 01 Feb 2009 03:47:27 -0200, Deepak Chandran escribió: I have a program in which I have successfully embedded Python. Now, I want to include NumPy as well (and other modules). I am able to import numpy once. Then I close the python console in my program and then re-open it. When I tr

Re: Searching a file for multiple strings (PS)

2009-02-01 Thread John Machin
On Feb 1, 7:34 pm, Shawn Milochik wrote: > On Sun, Feb 1, 2009 at 1:14 AM, John Machin wrote: > > On Feb 1, 3:39 pm, Shawn Milochik wrote: > > >> Not to discourage the use of Python, but it seems that fgrep with the > >> -f flag already does exactly what you want. If you're on Windows, you > >>

Re: what IDE is the best to write python?

2009-02-01 Thread Matthew Sacks
Wingware IDE is pretty good. It's not free though. http://www.wingware.com/ On Sun, Feb 1, 2009 at 12:14 AM, Stephen Hansen wrote: > On Sat, Jan 31, 2009 at 11:42 PM, mcheun...@hotmail.com > wrote: >> >> Hi all >> what IDE is the best to write python? >> thanks >> from Peter (mcheun...@hotmail

Re: SimpleXMLRPCServer question

2009-02-01 Thread Hendrik van Rooyen
"flagg" wrote: >Let me see if i can elaborate on the requirements. I have 20+ >different zone files. I want the xmlrpc server to be able to >determine what zone file to open by looking at the incoming xml >request. For example one of the functions I have now is to show a DNS >record (I am u

Handle SystemExit exception

2009-02-01 Thread asit
My program contains some sys.exit(1) and when its executed an exception known as SystemExit is thrown. I tried to handle bu using following code snippet if __name__ == "__main__": try: main() #main contains sys.exit(1) except KeyboardInterrupt: print "aborted by user"

Re: fastest way to detect a user type

2009-02-01 Thread Steven D'Aprano
Paul Rubin wrote: > Steven D'Aprano writes: >> First question is, why do you care that it's slower? The difference >> between the fastest and slowest functions is 1.16-0.33 = 0.83 >> microsecond. > > That's a 71% speedup, pretty good if you ask me. Don't you care that the code is demonstrably i

Re: Handle SystemExit exception

2009-02-01 Thread Steven D'Aprano
asit wrote: > My program contains some sys.exit(1) and when its executed an > exception known as SystemExit is thrown. > > I tried to handle bu using following code snippet > > if __name__ == "__main__": > try: > main() #main contains sys.exit(1) > except KeyboardInterrupt: >

Re: Handle SystemExit exception

2009-02-01 Thread Gabriel Genellina
En Sun, 01 Feb 2009 07:27:26 -0200, asit escribió: My program contains some sys.exit(1) and when its executed an exception known as SystemExit is thrown. This is normal behaviour - but you should not "see" the SystemExit. Do you mean that a stack trace appears in the console? I tried to

Re: Please help to play 5 jpegs as a slideshow in JES(Jython) --- BEGINNER.

2009-02-01 Thread Steven D'Aprano
st...@savechicago.org wrote: > Hello, I am a brand brand new programming student in Jython and I have > been working on a simple homework assignment in JES for the last 12 > hours and am completely lost. > > Basically, we have to make a jpeg slideshow with 5 different pictures > with audio backgr

Re: What is wrong in my list comprehension?

2009-02-01 Thread Chris Rebert
On Sun, Feb 1, 2009 at 3:22 AM, Hussein B wrote: > Hey, > I have a log file that doesn't contain the word "Haskell" at all, I'm > just trying to do a little performance comparison: > ++ > from datetime import time, timedelta, datetime > start = datetime.now() > print start > lines = [l

Re: what IDE is the best to write python?

2009-02-01 Thread James Stroud
mcheun...@hotmail.com wrote: Hi all what IDE is the best to write python? thanks from Peter (mcheun...@hotmail.com) vim in one terminal, ipython in the other. -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com -- http

Embedded python 2.6 interpreter can't "import sqlite3" on Windows XP

2009-02-01 Thread jdetaeye
I am porting an application which embeds a Python interpreter to Python 2.6. On version 2.5 all is working fine, but importing the sqlite3 module doesn't work any more on 2.6. The statement "import sqlite3" does work fine when executed from in the python command prompt, ie not from the embedded

Re: socket.unbind or socket.unlisten? - socket.error: (48, 'Address already in use')

2009-02-01 Thread Steve Holden
Laszlo Nagy wrote: > >> 8<-- >> >> >>> ... Setting the >>> SO_REUSEADDR flag on POSIX fixes this problem (don't set it on Windows, >>> though). >>> >> >> Why not? I have been merrily setting it, and I have not noticed >> anything weird. >> (yet) >> > Ple

Re: Tkinter w.pack()?

2009-02-01 Thread W. eWatson
Steve Holden wrote: W. eWatson wrote: Steve Holden wrote: W. eWatson wrote: r wrote: On Jan 28, 10:12 pm, "W. eWatson" wrote: Where in the world is a description of pack() for Tkinter widgets? Is it some sort of general method for all widgets? I'm looking in a few docs that use it without e

Re: socket.unbind or socket.unlisten? - socket.error: (48, 'Address already in use')

2009-02-01 Thread Steve Holden
Laszlo Nagy wrote: > >> 8<-- >> >> >>> ... Setting the >>> SO_REUSEADDR flag on POSIX fixes this problem (don't set it on Windows, >>> though). >>> >> >> Why not? I have been merrily setting it, and I have not noticed >> anything weird. >> (yet) >> > Ple

Re: persistent TCP connection in python using socketserver

2009-02-01 Thread BlakeF
On Jan 29, 8:54 pm, Jean-Paul Calderone wrote: > On Thu, 29 Jan 2009 08:38:43 -0800 (PST), markobrie...@gmail.com wrote: > >G'day > > >I'm currently usingsocketserverto build a simple XMLSocket (an XML > >based protocol used for communication between flash and the outside > >world) server. I've go

Re: Embedded python 2.6 interpreter can't "import sqlite3" on Windows XP

2009-02-01 Thread Peter
jdetaeye wrote: I am porting an application which embeds a Python interpreter to Python 2.6. On version 2.5 all is working fine, but importing the sqlite3 module doesn't work any more on 2.6. The statement "import sqlite3" does work fine when executed from in the python command prompt, ie not f

Re: What is wrong in my list comprehension?

2009-02-01 Thread Peter Otten
Hussein B wrote: > Hey, > I have a log file that doesn't contain the word "Haskell" at all, I'm > just trying to do a little performance comparison: > ++ > from datetime import time, timedelta, datetime > start = datetime.now() > print start > lines = [line for line in file('/media/sda

Re: Tkinter w.pack()?

2009-02-01 Thread Steve Holden
W. eWatson wrote: > Steve Holden wrote: >> W. eWatson wrote: >>> Steve Holden wrote: W. eWatson wrote: > r wrote: >> On Jan 28, 10:12 pm, "W. eWatson" wrote: >>> Where in the world is a description of pack() for Tkinter widgets? >>> Is it >>> some sort of general method fo

Re: what IDE is the best to write python?

2009-02-01 Thread Craig
eclipse --- On Sun, 2/1/09, Dennis Lee Bieber wrote: From: Dennis Lee Bieber Subject: Re: what IDE is the best to write python? To: python-list@python.org Date: Sunday, February 1, 2009, 3:31 AM On Sat, 31 Jan 2009 23:42:42 -0800 (PST), "mcheun...@hotmail.com" declaimed the following in comp.

Re: accessing elements of a tuple

2009-02-01 Thread D'Arcy J.M. Cain
On Sun, 01 Feb 2009 19:23:58 +1100 Steven D'Aprano wrote: > D'Arcy J.M. Cain wrote: > > > First of all, list is a reserved word.  Don't use it as a variable name. > > Unless you mean to. Shadowing built-ins is only a bad thing when you do it > by accident. I suppose but I am having a hard time

Re: what IDE is the best to write python?

2009-02-01 Thread Stef Mientki
thanks Matthew, for the extended answer and the great link, I'm going to study that carefully. cheers, Stef MattBD wrote: On Feb 1, 12:19 pm, Stef Mientki wrote: IMHO, scripting languages like Python are generally better suited to working with a text editor than an IDE. I don't un

Re: what IDE is the best to write python?

2009-02-01 Thread MattBD
On Feb 1, 7:42 am, "mcheun...@hotmail.com" wrote: > Hi all >    what IDE is the best to write python? > thanks > from Peter (mcheun...@hotmail.com) I like Vim, that works really well for me when coding in Python. Enable syntax highlighting and it's a great development environment. It's a little t

python alternative to java rapid ajax platform (RAP)?

2009-02-01 Thread markolopa
Hi, Do you know a python alternative to rapid ajax platform (RAP)? For the development of a user interface for mathematical models someone suggested to use eclipse and that tool: http://www.eclipse.org/rap/ http://www.eclipse.org/rap/about.php If I understand correctly it allows you to design v

Re: accessing elements of a tuple

2009-02-01 Thread Steve Holden
Steven D'Aprano wrote: > D'Arcy J.M. Cain wrote: > >> First of all, list is a reserved word. Don't use it as a variable name. > > Unless you mean to. Shadowing built-ins is only a bad thing when you do it > by accident. > Quite. And we should observe that "list" is not a reserved word in the se

Re: fastest way to detect a user type

2009-02-01 Thread Robin Becker
Steven D'Aprano wrote: Paul Rubin wrote: Steven D'Aprano writes: First question is, why do you care that it's slower? The difference between the fastest and slowest functions is 1.16-0.33 = 0.83 microsecond. That's a 71% speedup, pretty good if you ask me. Don't you care that the code is d

Re: is python Object oriented??

2009-02-01 Thread MRAB
David Bolen wrote: thmpsn@gmail.com writes: I don't know how you would do it in C# (or Java for that matter). In C++ you can play with pointers to "get at" some memory location somewhere in the object. The only portable way to know the exact location between the beginning of the object and

Re: is python Object oriented??

2009-02-01 Thread Chris Rebert
On Sat, Jan 31, 2009 at 9:08 AM, wrote: > On Jan 30, 12:15 am, Chris Rebert wrote: >> - Python supports encapsulation. Prefixing an attribute/method with an >> underscore indicates that other programmers should treat it as >> 'private'. However, unlike B&D languages, Python itself does nothing >

Re: Handle SystemExit exception

2009-02-01 Thread asit
Thanx everyone This is my fault. Exception was thrown before the main function. -- http://mail.python.org/mailman/listinfo/python-list

[ANN] XPN 1.2.6

2009-02-01 Thread Nemesis
XPN (X Python Newsreader) is a multi-platform newsreader with Unicode support. It is written with Python+GTK. It has features like scoring/actions, X-Face and Face decoding, muting of quoted text, newsrc import/export, find article and search in the body, spoiler char/rot13, random taglines and con

Re: what IDE is the best to write python?

2009-02-01 Thread MattBD
On Feb 1, 12:19 pm, Stef Mientki wrote: > > IMHO, scripting languages like Python are generally better suited to > > working with a text editor than an IDE. > > I don't understand that, because in my opinion yields >   IDE = texteditor + (much) more > please could you explain (as I'm very interest

Problem with slow httplib connections on Windows (and maybe other platforms)

2009-02-01 Thread Christoph Zwerschke
It cost me a while to analyze the cause of the following problem. The symptom was that testing a local web app with twill was fast on Python 2.3, but very slow on Python 2.4-2.6 on a Win XP box. This boiled down to the problem that if you run a SimpleHTTPServer for localhost like this, BaseHT

Python time measure question (timeit)

2009-02-01 Thread vedrandekovic
Hello, When I run following code with os.popen (for this time measure I'm using python module timeit): for i in range(50): print i I get this result: 0.00246958761519 But when I run same code from IDLE i get this result: 6.4533341528e-005 now, I have two questions: 1) W

Problems installing PySQLite, SQLite and Trac

2009-02-01 Thread kimwlias
My initial goal is to finally install Trac. This is the second day I've been trying to make this possible but I can't find, for the life of me, how to do this. OK, here is the story: My system is a VPS with CentOS 5. I found out that I have two versions of python: 2.4 at /usr/bin/ python2.4 and 2

Re: exception in urllib2

2009-02-01 Thread 7stud
On Feb 1, 3:34 am, asit wrote: > I hv been developing a link scanner. Here the objective is to > recursively scan a particular web site. > > During this, my script methttp://images.google.co.in/imghp?hl=en&tab=wi > and passed it to the scan function, whose body is like this.. > > def scan(site): >

Re: exception in urllib2

2009-02-01 Thread 7stud
On Feb 1, 3:34 am, asit wrote: > I hv been developing a link scanner. Here the objective is to > recursively scan a particular web site. > > During this, my script methttp://images.google.co.in/imghp?hl=en&tab=wi > and passed it to the scan function, whose body is like this.. > > def scan(site): >

exception in urllib2

2009-02-01 Thread asit
I hv been developing a link scanner. Here the objective is to recursively scan a particular web site. During this, my script met http://images.google.co.in/imghp?hl=en&tab=wi and passed it to the scan function, whose body is like this.. def scan(site): log=open(logfile,'a') log.write(site

Problem With py2exe and ConfigParser

2009-02-01 Thread berserker...@gmail.com
Hello, i use python 2.6 + PyQt4. I compile my main.pyw. It is compile, but don't run. In "index.exe.log" error log: >>> File "index.pyw", line 100, in GetVal >>>ConfigParser.NoSectionError: No section: 'Main' >>>Code line 92 to 104 this is class that uses ConfigParser lib: >>>class ConfigAcce

Re: socket.unbind or socket.unlisten? - socket.error: (48, 'Address already in use')

2009-02-01 Thread Grant Edwards
On 2009-02-01, Steve Holden wrote: > I believe this is because Microsoft failed to understand the > original meaning of ___, and persisted with > this ghastly error in the name of backwards compatibility, > justifying it by suggesting that _. Somebody shou

Re: fastest way to detect a user type

2009-02-01 Thread Steven D'Aprano
Robin Becker wrote: > Steven D'Aprano wrote: >> Paul Rubin wrote: >> >>> Steven D'Aprano writes: First question is, why do you care that it's slower? The difference between the fastest and slowest functions is 1.16-0.33 = 0.83 microsecond. >>> That's a 71% speedup, pretty good if

Re: what IDE is the best to write python?

2009-02-01 Thread Stef Mientki
IMHO, scripting languages like Python are generally better suited to working with a text editor than an IDE. I don't understand that, because in my opinion yields IDE = texteditor + (much) more please could you explain (as I'm very interested in user interfaces in general ) cheers, Stef

Re: py2exe + SQLite problem

2009-02-01 Thread Armin
Hello, Thanks to all ... it's working now ! Google isn't always your friend :) I found in the net a lot but wrong examples for specification of "data_files". Now I have the correct one. Best Regards --Armin Gabriel Genellina wrote: En Sat, 31 Jan 2009 11:51:16 -0200, Armin escribió: G

What is wrong in my list comprehension?

2009-02-01 Thread Hussein B
Hey, I have a log file that doesn't contain the word "Haskell" at all, I'm just trying to do a little performance comparison: ++ from datetime import time, timedelta, datetime start = datetime.now() print start lines = [line for line in file('/media/sda4/Servers/Apache/ Tomcat-6.0.14/lo

Re: Embedding numpy works once, but not twice??

2009-02-01 Thread Deepak Chandran
I sort of guessed that was the issue -- doing Py_Initialize/Py_Finalize more than once. Thanks for the help. On Sun, Feb 1, 2009 at 12:43 AM, Gabriel Genellina wrote: > En Sun, 01 Feb 2009 03:47:27 -0200, Deepak Chandran < > dchandr...@tinkercell.com> escribió: > > I have a program in which I ha

Re: Problem With py2exe and ConfigParser

2009-02-01 Thread Diez B. Roggisch
berserker...@gmail.com schrieb: Hello, i use python 2.6 + PyQt4. I compile my main.pyw. It is compile, but don't run. In "index.exe.log" error log: File "index.pyw", line 100, in GetVal ConfigParser.NoSectionError: No section: 'Main' Code line 92 to 104 this is class that uses ConfigPars

Re: Python time measure question (timeit)

2009-02-01 Thread Steve Holden
vedrandeko...@yahoo.com wrote: > Hello, > > When I run following code with os.popen (for this time measure I'm > using python module timeit): > > > for i in range(50): > print i > > > I get this result: 0.00246958761519 > > > But when I run same code from IDLE i get this result: > 6.45

Re: what IDE is the best to write python?

2009-02-01 Thread Christof Donat
Hi, >> IMHO, scripting languages like Python are generally better suited to >> working with a text editor than an IDE. >> > I don't understand that, because in my opinion yields > IDE = texteditor + (much) more > please could you explain (as I'm very interested in user interfaces in > general

Re: is python Object oriented??

2009-02-01 Thread thmpsn . m . k
On Feb 1, 1:50 am, Marc 'BlackJack' Rintsch wrote: > On Sat, 31 Jan 2009 15:28:14 -0800, thmpsn.m.k wrote: > > On Jan 31, 2:27 pm, Christian Heimes wrote: > >> Do you honestly believe that C++'s private members are really private? > >> Privateness is only enforced during parsing time. Nobody can

Re: is python Object oriented??

2009-02-01 Thread Stephen Hansen
Anyway, it doesn't matter. We're losing the point here. The point is that language support for private access, by disallowing user access to private data, provides an unambiguous information hiding mechanism which encourages encapsulation. Python's approach, however, which is only a naming co

Re: is python Object oriented??

2009-02-01 Thread Luis Zarrabeitia
Quoting thmpsn@gmail.com: > > Or ``#define private public`` before including the header files.  Which > > doesn't look complicated to me. > > Which again won't always work, if: > > (a) the header defines another macro, say, "PRIVATE", as "private", > and uses PRIVATE to declare private memb

getting values from a text file (newby)

2009-02-01 Thread vsoler
Hi, My foo.txt file contains the following: 1,"house","2,5" 2,"table","6,7" 3,"chair","-4,5" ... as seen with notepad. This file was created with the OpenOffice Calc spreadsheet, but since I use comma as the decimal separator for numbers, the last value in each line appears sorrounded by quotes

Config files editor

2009-02-01 Thread Tim Michelsen
Hello Python, does anyone know of a Python based project that has a GUI based functionality to edit config files read/written by ConfigParser? I found a command line tool here: pyinieditor - Google Code - http://code.google.com/p/pyinieditor/ But I'd rather go with a GUI tool. Thanks in adva

Re: is python Object oriented??

2009-02-01 Thread Steve Holden
Stephen Hansen wrote: > [...] > don't play with anyone else's > privates. > A good rule in life as well as programming. > The *idea* of encapsulation is good in many cases, it is quite often a > solid design point and admirable goal. The *implementation* of enforced > data encapsulation brings no

Re: Python time measure question (timeit)

2009-02-01 Thread vedrandekovic
On 1 velj, 17:42, Steve Holden wrote: > vedrandeko...@yahoo.com wrote: > > Hello, > > > When I run following code with os.popen  (for this time measure I'm > > using python module timeit): > > > for i in range(50): > >     print i > > > I get this result:  0.00246958761519 > > > But when I run sam

Re: getting values from a text file (newby)

2009-02-01 Thread r
Try the csv module py> import csv py> reader = csv.reader(open(csvfile, "rb")) py> for row in reader: print row ['1', 'house', '2,5 '] ['2', 'table', '6,7 '] ['3', 'chair', '-4,5 '] -- http://mail.python.org/mailman/listinfo/python-list

Re: getting values from a text file (newby)

2009-02-01 Thread Steve Holden
r wrote: > Try the csv module > > py> import csv > py> reader = csv.reader(open(csvfile, "rb")) > py> for row in reader: > print row > > > ['1', 'house', '2,5 '] > ['2', 'table', '6,7 '] > ['3', 'chair', '-4,5 '] And then, to conert the last field to numbers? ... regards Steve -- Steve

Re: Problems installing PySQLite, SQLite and Trac

2009-02-01 Thread Jon Clements
On 1 Feb, 15:48, kimwlias wrote: > My initial goal is to finally install Trac. This is the second day > I've been trying to make this possible but I can't find, for the life > of me, how to do this. OK, here is the story: > > My system is a VPS with CentOS 5. > > I found out that I have two versio

Re: getting values from a text file (newby)

2009-02-01 Thread r
On Feb 1, 11:50 am, Steve Holden wrote: > And then, to conert the last field to numbers? ... Are you asking me Steve? Well i did not want to short-circuit the OP's learning process by spoon-feeding him the entire answer. I thought i would give him a push in the right direction and observe the out

Re: getting values from a text file (newby)

2009-02-01 Thread Stephen Hansen
On Sun, Feb 1, 2009 at 9:24 AM, vsoler wrote:Hi, My foo.txt file contains the following: 1,"house","2,5" 2,"table","6,7" 3,"chair","-4,5" ... as seen with notepad. This file was created with the OpenOffice Calc spreadsheet, but since I use comma as the decimal separator for numbers,

Re: Python time measure question (timeit)

2009-02-01 Thread Steve Holden
vedrandeko...@yahoo.com wrote: > On 1 velj, 17:42, Steve Holden wrote: >> vedrandeko...@yahoo.com wrote: >>> Hello, >>> When I run following code with os.popen (for this time measure I'm >>> using python module timeit): >>> for i in range(50): >>> print i >>> I get this result: 0.00246958761

subprocess.Popen not creating a pipe

2009-02-01 Thread Andrew Parker
I'm having some fun with Popen. I have the following line: process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) print process.stdout Under normal circumstances, this displays: ', mode 'w' at 0xb7f8e068> However, I have a binary that I use to kick of

Re: Pipe stdout && stderr to a TkLabel widget

2009-02-01 Thread rantingrick
Hello, anybody. Any help would be good help Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonic list/tuple/dict layout?

2009-02-01 Thread Aahz
In article <871vur39k7@benfinney.id.au>, Ben Finney wrote: > >I actually use this style: > >foo = { >0: 'spam', >1: 'eggs', >2: 'beans', >} > >because that makes it clear that *all* the indented lines are a >continuation of the same statement, just like a s

Re: is python Object oriented??

2009-02-01 Thread rdmurray
Quoth thmpsn@gmail.com: > Anyway, it doesn't matter. We're losing the point here. The point is > that language support for private access, by disallowing user access > to private data, provides an unambiguous information hiding mechanism > which encourages encapsulation. Python's approach, howe

Re: Pipe stdout && stderr to a TkLabel widget

2009-02-01 Thread rantingrick
PS: The braces are there because i used *arg in the fuction, so that is not a problem now. All i want to do is overide the print statement to sent all it's output to a Tkinter Label widget Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: error on building 2.6.1. (_ctypes)

2009-02-01 Thread Bernard Rankin
> > >> > I am trying to build python 2.6 on a machine (web server) that I do not > have > >> root access to. (has 2.4 installed) > >> > > >> > Python 2.5 builds fine, but I am getting an error when I run "make" for > 2.6.1. > > >> Mmm... my 2.6.1 source show different line numbers, maybe you

Re: nth root

2009-02-01 Thread Peter Pearson
On Sun, 1 Feb 2009 15:36:43 +1000, Tim Roberts wrote: > > Actually, all I'm interested in is whether the 100 digit > numbers have an exact integral root, or not. At the > moment, because of accuracy concerns, I'm doing something > like > > for root in powersp: >

Re: getting values from a text file (newby)

2009-02-01 Thread vsoler
On 1 feb, 19:02, Stephen Hansen wrote: > On Sun, Feb 1, 2009 at 9:24 AM, vsolerwrote:Hi, > My foo.txt file contains the following: > 1,"house","2,5" > 2,"table","6,7" > 3,"chair","-4,5" > ... as seen with notepad. > This file was created with the OpenOffice Calc spreadsheet, but since > I use comm

Re: search speed

2009-02-01 Thread Aaron Watters
On Jan 30, 3:49 am, "Diez B. Roggisch" wrote: > alex23 gave you a set of tools that you can use for full-text-search. > However, that's not necessarily the best thing to do if things have a > record-like structure. In Nucular (and others I think) you can do searches for terms anywhere (full text)

Re: getting values from a text file (newby)

2009-02-01 Thread Steve Holden
Stephen Hansen wrote: > > > On Sun, Feb 1, 2009 at 9:24 AM, vsoler wrote: > > Hi, > > My foo.txt file contains the following: > > 1,"house","2,5" > 2,"table","6,7" > 3,"chair","-4,5" > > ... as seen with notepad. > > This file was created with the OpenOffice Calc

Problem with slow httplib connections on Windows (and maybe other platforms)

2009-02-01 Thread rdmurray
Quoth Christoph Zwerschke : > What actually happens is the following: > > * BaseHTTPServer binds only to the IPv4 address of localhost, because >it's based on TCPServer which has address_family=AF_INET by default. > > * HTTPConnection.connect() however tries to connect to all IP addresses >

Membership of multiple items to a list

2009-02-01 Thread inkhorn
Dear all, I'd like to know how to elegantly check a list for the membership of any of its items to another list. Not caring for elegance, I would use the following code: blah = [1,2,3] yadda = [3,4,5,6] blah[0] or blah[1] or blah[2] in yadda Please tell me how to change the preceding code into

Re: subprocess.Popen not creating a pipe

2009-02-01 Thread Andrew Parker
On Sun, Feb 1, 2009 at 1:46 PM, Andrew Parker wrote: > I'm having some fun with Popen. I have the following line: > >process = subprocess.Popen(command, stdout=subprocess.PIPE, > stderr=subprocess.STDOUT) >print process.stdout > > Under normal circumstances, this displays: > >', mode

Re: Membership of multiple items to a list

2009-02-01 Thread Christian Heimes
inkhorn schrieb: > Dear all, > > I'd like to know how to elegantly check a list for the membership of > any of its items to another list. Not caring for elegance, I would > use the following code: > > blah = [1,2,3] > yadda = [3,4,5,6] > > blah[0] or blah[1] or blah[2] in yadda > > Please tell

Re: Membership of multiple items to a list

2009-02-01 Thread Stephen Hansen
I'd like to know how to elegantly check a list for the membership of any of its items to another list.  Not caring for elegance, I would use the following code: That's one of the useful properties of sets:>>> a = [1,2,3]>>> b = [3,4,5,6]>>> set(a) & set(b)set([3])>>> set(a).intersection(b)set(

Re: Membership of multiple items to a list

2009-02-01 Thread Paul Rubin
inkhorn writes: > blah = [1,2,3] > yadda = [3,4,5,6] > > blah[0] or blah[1] or blah[2] in yadda if set(blah) & set(yadda): print "yes" -- http://mail.python.org/mailman/listinfo/python-list

Re: Membership of multiple items to a list

2009-02-01 Thread inkhorn
Wow thanks for the lightning fast reply! This does exactly the right job. Matt On Feb 1, 3:01 pm, Stephen Hansen wrote: > I'd like to know how to elegantly check a list for the membership of > any of its items to another list.  Not caring for elegance, I would > use the following code: > That's

Re: SimpleXMLRPCServer question

2009-02-01 Thread flagg
On Feb 1, 12:38 am, "Hendrik van Rooyen" wrote: >  "flagg" wrote: > >Let me see if i can elaborate on the requirements.  I have 20+ > >different zone files.  I want the xmlrpc server to be able to > >determine what zone file to open by looking at the incoming xml > >request.  For example one of t

Re: nth root

2009-02-01 Thread Mensanator
On Feb 1, 2:27 am, casevh wrote: > On Jan 31, 9:36 pm, "Tim Roberts" wrote: > > > Actually, all I'm interested in is whether the 100 digit numbers have an > > exact integral root, or not.  At the moment, because of accuracy concerns, > > I'm doing something like > > >                     for ro

Re: Problem with slow httplib connections on Windows (and maybe other platforms)

2009-02-01 Thread Christoph Zwerschke
rdmur...@bitdance.com schrieb: Quoth Christoph Zwerschke : With Py 2.3 (without IPv6 support) this is only the IPv4 address, but with Py 2.4-2.6 the order is (on my Win XP host) the IPv6 address first, then the IPv4 address. Since the IPv6 address is checked first, this gives a timeo

database wrapper ?

2009-02-01 Thread Stef Mientki
hello, Until now I used a simple wrapper around pysqlite and pyodbc to manage my databases. Now I'm looking for a better solution, because I've to support a (for this moment) unknown database, and I'm not the one who will choose the database. Googling, I found SQLalchemy, which looks quit good

Re: getting values from a text file (newby)

2009-02-01 Thread John Machin
On Feb 2, 6:18 am, vsoler wrote: > > r: in the open statement, why do you use 'rb' as 2nd argument? b is > supposed to be binary, and my file is text! Because unlike Stephen, r has read the csv manual. Binary mode is required to handle properly cases like '\n' embedded in a field -- something whi

Re: getting values from a text file (newby)

2009-02-01 Thread vsoler
On 1 feb, 23:57, John Machin wrote: > On Feb 2, 6:18 am, vsoler wrote: > > > > > r: in the open statement, why do you use 'rb' as 2nd argument? b is > > supposed to be binary, and my file is text! > > Because unlike Stephen, r has read the csv manual. Binary mode is > required to handle properly

Re: Problem with slow httplib connections on Windows (and maybe other platforms)

2009-02-01 Thread rdmurray
Quoth Christoph Zwerschke : > rdmur...@bitdance.com schrieb: > > Quoth Christoph Zwerschke : > >>With Py 2.3 (without IPv6 support) this is only the IPv4 address, > >>but with Py 2.4-2.6 the order is (on my Win XP host) the IPv6 address > >>first, then the IPv4 address. Since the IPv6 a

Re: is python Object oriented??

2009-02-01 Thread Rhodri James
On Sun, 01 Feb 2009 17:31:27 -, Steve Holden wrote: Stephen Hansen wrote: [...] don't play with anyone else's privates. A good rule in life as well as programming. Unless, of course, you're both consenting adults. What? Someone had to say it! -- Rhodri James *-* Wildebeeste Herder

Re: database wrapper ?

2009-02-01 Thread Chris Rebert
On Sun, Feb 1, 2009 at 2:56 PM, Stef Mientki wrote: > hello, > > Until now I used a simple wrapper around pysqlite and pyodbc to manage my > databases. > Now I'm looking for a better solution, > because I've to support a (for this moment) unknown database, > and I'm not the one who will choose the

Re: what IDE is the best to write python?

2009-02-01 Thread Aahz
In article , MattBD wrote: > >I like Vim, that works really well for me when coding in Python. >Enable syntax highlighting and it's a great development environment. >It's a little tough at first but run vimtutor and you'll soon start to >get the hang of it. Just to register a contrary opinion: I

Re: database wrapper ?

2009-02-01 Thread Stephen Hansen
Googling, I found SQLalchemy, which looks quit good. SQLAlchemy is very good. I'm very slowly migrating our entire codebase to it.   But as I only want to choose once, I googled for  "SQLalchemy alternatives", but it didn't find many answers. (Storm / Grok are of no interest, because manipu

Re: Where to host a (Python) project?

2009-02-01 Thread Aahz
In article <387f23cd-90e2-46fc-8c91-1c2f6b31c...@u13g2000yqg.googlegroups.com>, andrew cooke wrote: > >However, i am thinking I could really do with: >- a mailing list >- simple bug tracking >- subversion >and am wondering which is the best (free) provider for these (the code >is LGPL open source

Re: database wrapper ?

2009-02-01 Thread andrew cooke
> Is SQLalchemy the best / most popular database wrapper ? SQLAlchemy is the best SQL library I have ever used. But it may depend on who you ask. For me, what makes SQLAlchemy so good is the way it allows you to use SQL from within Python. I have used the ORM side, and that's fine, but it's the

Re: Where to host a (Python) project?

2009-02-01 Thread andrew cooke
On Feb 1, 8:45 pm, a...@pythoncraft.com (Aahz) wrote: > Note that it's fairly easy to get a new list hosted at python.org, just > ask postmaster.  I for one won't participate in any list hosted on > Google because of the need for a Google login. ah well - i guess you can use pyparsing ;o) http://

Using lxml to screen scrap a site, problem with charset

2009-02-01 Thread Дамјан Георгиевски
So, I'm using lxml to screen scrap a site that uses the cyrillic alphabet (windows-1251 encoding). The sites HTML doesn't have the header, but does have a HTTP header that specifies the charset... so they are standards compliant enough. Now when I run this code: from lxml import html doc = htm

  1   2   >