Re: how to remove using replace function?

2006-02-09 Thread Rinzwind
Works for me. >>> txt = "an unfortunate in the middle" >>> print txt.replace("", "") an unfortunate in the middle >>> Though I don't like the 2 spaces it gives ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way of finding terminal width/height?

2006-02-09 Thread Joel Hedlund
> It didn't insert an EOF, it just caused read() to return > "prematurely". You should call read() again until it receives > a _real_ EOF and returns ''. Copy that. Point taken. > There appear to be a couple problems with this description: > > 1) It says that read() in blocking mode without a s

Re: sys.path and unicode folder names

2006-02-09 Thread Nir Aides
If few people use file names not in their respective CP_ACP as you say, why did Microsoft bother to make Windows XP a unicode OS? It does not make any sense. The existence of such bugs is the source of the problem itself. It is because of this situation that people in non-English speaking count

Re: Best way of finding terminal width/height?

2006-02-09 Thread Joel Hedlund
I realised there was funny indentation mishap in my previus email. My mail prog indented the following line signal.signal(signal.SIGWINCH, report_terminal_size_change) while in fact in IDLE it's unindented, which makes a lot more sense: signal.signal(signal.SIGWINCH, report_terminal_size_c

Re: Natural Language Date Processing.

2006-02-09 Thread Michael Amrhein
Andrew Gwozdziewycz schrieb: >> You may take a look at http://labix.org/python-dateutil >> Have fun >> Michael >> > > Looks like it does a good job parsing dates, but doesn't seem to do > english dates. I found a javascript implementation of a few functions > that will probably be relatively easy

Inserting record with Microsoft Access

2006-02-09 Thread jeffhg582003
Hi, I am developing a python script which add records to a microsoft access tables. All my tables have autogenerated number fields. I am trying to capture the number generated from the insert but I am not exactly sure how to do that after an insert. Thanks, Jeff -- http://mail.python.org/mai

Re: by reference

2006-02-09 Thread Rene Pijlman
dirvine: >I would like to create a dictionary based on a variable [...] And what seems to be the problem? -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: Unable to get PIL to load jpeg images

2006-02-09 Thread peter . mosley
Thanks for that tip Following a dialogue in that discussion group it is now working. The problem was that I didn't have the right jpeg library installed (although what I had was enough to show jpegs in gThumb, GIMP and the Gnome and KDE desktops so I don't understand why it wasn't). I had to als

Re: Replacing curses (Was: Re: Problem with curses and UTF-8)

2006-02-09 Thread Joel Hedlund
> The code for handling window resizing isn't jumping out at > me but I'll keep looking. (...jumping out, rather unexpectedly!) You might be interested in an ongoing discussion that I and Grant Edwards are holding in this newsgroup on the subject "Best way of finding terminal width/height?".

Re: how to remove using replace function?

2006-02-09 Thread Duncan Booth
Rinzwind wrote: > Works for me. > txt = "an unfortunate in the middle" print txt.replace("", "") > an unfortunate in the middle > > > Though I don't like the 2 spaces it gives ;) > Although I generally advise against overuse of regular expressions, this is one situation wher

Re: how to remove using replace function?

2006-02-09 Thread Albert Leibbrandt
Rinzwind wrote: >Works for me. > > > txt = "an unfortunate in the middle" print txt.replace("", "") >an unfortunate in the middle > > > > >Though I don't like the 2 spaces it gives ;) > > > so use regex and replace both the double spaces and the cheers albert

OT: Another try at Python's selfishness

2006-02-09 Thread Frithiof Andreas Jensen
"DH" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Frithiof Andreas Jensen wrote: > > <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > >> Having read previous discussions on python-dev I think I'm not the only > >> Python programmer who doesn't particularly like py

Re: how to remove using replace function?

2006-02-09 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > i have some html that looks like this > > > 34 main, Boston, MA > > and i am trying to use the replace function to get rid of the that > i scrape out using this code: > > for oText in incident.fetchText( oRE): > strTitle += oText.strip() Why concatening

Re: PyGTK

2006-02-09 Thread rodmc
Well I have just started using Python and have found wxPython to be pretty good, it is built upon the WxWindows framework.It is also cross-platform. You can find it at www.wxpython.org. It appears to be easy to understand and there are a few GUI builder tools around for it as well. Rod -- http:

Using ioctl

2006-02-09 Thread klappnase
Hello, I am writing an app that records from the soundcard using ossaudiodev. In the OSS programmer's guide they recommend when reading data fragments from the soundcard to use the fragment size as it is requested by the driver. According to the programmer's guide the ioctl call to determine the r

Re: module with __call__ defined is not callable?

2006-02-09 Thread Antoon Pardon
Op 2006-02-08, Steve Holden schreef <[EMAIL PROTECTED]>: > Antoon Pardon wrote: >> Op 2006-02-08, Steve Holden schreef <[EMAIL PROTECTED]>: >> >>>Why should a module be callable? What's the advantage? Should we be able >>>to add two modules together, yielding a module that contains all the >>>co

Re: module with __call__ defined is not callable?

2006-02-09 Thread Antoon Pardon
Op 2006-02-08, Scott David Daniels schreef <[EMAIL PROTECTED]>: > Steven D'Aprano wrote: >> On Wed, 08 Feb 2006 13:58:13 +1100, Delaney, Timothy (Tim) wrote: >> >>> adam johnson wrote: >>> Hi All. I was wondering why defining a __call__ attribute for a module doesn't make it actuall

Re: module with __call__ defined is not callable?

2006-02-09 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > Right. While we're at it, why don't we make strings callable. Calling > a string could call the function whose name (in some namespace or > other) was in the string. Making a string subclass callable works fine: >>> class f(str): ... def __cal

Re: Twisted book opinions?

2006-02-09 Thread Eddie Corns
Jay Parlar <[EMAIL PROTECTED]> writes: >I was hoping to get some c.l.p. opinions on O'Reilly's new Twisted book. Well I certainly felt that I understood it better after reading the book. OTOH I haven't tried to put that knowledge into practice yet. I think calling it a cookbook is misleading, it

Re: module with __call__ defined is not callable?

2006-02-09 Thread Kent Johnson
Antoon Pardon wrote: > This make me wonder. Would it be possible to do something with > metaclasses so that after > > class SomeClass(MetaClass): > ... > > SomeClass() will be equivalent to MetaClass.__call__(SomeClass) I think that's already what happens. IIUC type.__call__ implem

Re: PyGTK

2006-02-09 Thread Jeremy Sanders
Huy wrote: > What I am curious to know is whether anyone has come across any > noteworthy gui development platforms. Cross compatibility is not a > must, but a bonus. Good documentation and clarity is essential for me. > Also, I imagine I can use modules for image manipulation in tandem > with

Re: Inserting record with Microsoft Access

2006-02-09 Thread Albert Leibbrandt
jeffhg582003 wrote: >Hi, > >I am developing a python script which add records to >a microsoft access tables. All my tables have autogenerated number >fields. I am trying to capture the number generated from the insert but >I am not exactly sure how to do that after an insert. > >Thanks, >Jeff >

thread dump

2006-02-09 Thread jsuch
I'm using Fedora core 3 and python 2.4.2, is there any way to obtain the linux pid of a python thread? I need it because I want to know CPU usage per thread. Thanks -- http://mail.python.org/mailman/listinfo/python-list

line wrapping problem

2006-02-09 Thread S Borg
Hello, I am parsing text from one document to another. I have a scheme similar to: for x in myfoobar: print >> mytextfile, "%s" % mydictionary[x], #all on same line print >> mytextfile, '\n' #new line I am getting line breaks before my explicit line break. Am I unwittingly copy

Re: Twisted book opinions?

2006-02-09 Thread Tim Parkin
Eddie Corns wrote: > Jay Parlar <[EMAIL PROTECTED]> writes: > > >>I was hoping to get some c.l.p. opinions on O'Reilly's new Twisted book. > > > Well I certainly felt that I understood it better after reading the book. > OTOH I haven't tried to put that knowledge into practice yet. > > I think

Thread Dump of a python process

2006-02-09 Thread Shanon
Hi, I would to know if there're some way to have a dump of all the threads started by a python process. I want to see the TID corresponding of each thread because I need them to get the CPU time of each thread by the command top. Thanks -- View this message in context: http://www.nabble.com/Thr

Re: Replacing curses

2006-02-09 Thread Thomas Dickey
Ian Ward <[EMAIL PROTECTED]> wrote: > I'm going to look at the Mined text editor for some terminal behavior mined_2000 (there's more than one program named mined, and the other doesn't do UTF-8). > detection code. Mined is able to produce good UTF-8 output on a variety > of terminals, and it li

Re: Twisted book opinions?

2006-02-09 Thread Matt Goodall
Jay Parlar wrote: > I was hoping to get some c.l.p. opinions on O'Reilly's new Twisted book. I think it's a good book to get. I know a fair amount about Twisted but it still made for interesting reading. Tommi Virtanen (aka tv) posted a great review of the book shortly after it was published.

LovePython

2006-02-09 Thread Sridhar Ratna
http://www.lovepython.com/ (a reaction to loveperl.com) This is going to be a weekend project for me. Development not yet started. Still looking for good ideas! I welcome your suggestions. -- Sridhar Ratna | [EMAIL PROTECTED] | http://www.24dot1.com -- http://mail.python.org/mailman/listinfo/py

Re: Inserting record with Microsoft Access

2006-02-09 Thread [EMAIL PROTECTED]
I can't remember the detail right now but look at SELECT @@IDENTITY. Cheers, Davy M -- http://mail.python.org/mailman/listinfo/python-list

Re: line wrapping problem

2006-02-09 Thread Fuzzyman
S Borg wrote: > Hello, > > I am parsing text from one document to another. I have a scheme > similar to: > > for x in myfoobar: >print >> mytextfile, "%s" % mydictionary[x], #all on same line > print >> mytextfile, '\n' #new line > You are using the print command to output the t

Hi reliability files, writing,reading,maintaining

2006-02-09 Thread John Pote
Hello, help/advice appreciated. Background: I am writing some web scripts in python to receive small amounts of data from remote sensors and store the data in a file. 50 to 100 bytes every 5 or 10 minutes. A new file for each day is anticipated. Of considerable importance is the long term availab

Breadth first problem

2006-02-09 Thread Nicky Ng
Hi,   I would like to implement a breadth first serach with Python and read data from a text file with following file format   File structure description First line contains number of node Second line contains node id(s) and distance between node id Last line is -1   Each node or distance i

Re: line wrapping problem

2006-02-09 Thread Juho Schultz
S Borg wrote: > Hello, > > I am parsing text from one document to another. I have a scheme > similar to: > > for x in myfoobar: >print >> mytextfile, "%s" % mydictionary[x], #all on same line > print >> mytextfile, '\n' #new line > > > I am getting line breaks before my explic

Re: Inserting record with Microsoft Access

2006-02-09 Thread Steve Holden
Albert Leibbrandt wrote: > > jeffhg582003 wrote: > > >>Hi, >> >>I am developing a python script which add records to >>a microsoft access tables. All my tables have autogenerated number >>fields. I am trying to capture the number generated from the insert but >>I am not exactly sure how to do t

importing maple into python

2006-02-09 Thread walter kehowski
Hello, Is there for a python program to call maple? Walter Kehowski -- -- http://mail.python.org/mailman/listinfo/python-list

Curios issues with Editors

2006-02-09 Thread rodmc
I recently wrote a program in IDLE and it runs perfectly. However when the same application is executed within SPE I receive errors saying that certain socket items are not callable, in particular AF_INET. I am new to Python, is there a reason why somethings will run in IDLE and not SPE? I could

Re: Curios issues with Editors

2006-02-09 Thread Steve Holden
rodmc wrote: > I recently wrote a program in IDLE and it runs perfectly. However when > the same application is executed within SPE I receive errors saying > that certain socket items are not callable, in particular AF_INET. > > I am new to Python, is there a reason why somethings will run in IDL

Re: removing characters before writing to file

2006-02-09 Thread John Zenger
As mentioned in the thread, it makes sense to build the desired output you want from the tuple, rather than converting the tuple to a string and then doing replace operations on the string. If you do want to go the replace route, you don't need the power of regex substitutions for what you are

problems opening IDLE

2006-02-09 Thread Bennie Tilma
I'm having trouble with opening the IDLE and running programs. Every time I try to open it, it says: 1. Socket error: Connection refused 2. IDLE's subprocess didn't make connection. Either IDLE can't start a subprocess or personal firewall software is blocking the connection. Point is, I allread

Re: line wrapping problem

2006-02-09 Thread John Zenger
S Borg wrote: > print >> mytextfile, '\n' #new line Wouldn't this print two line breaks--the one you specify in the string, plus the one always added by print if there is no comma at the end of the statement? -- http://mail.python.org/mailman/listinfo/python-list

Re: PyGTK

2006-02-09 Thread Dave Cook
On 2006-02-08, Huy <[EMAIL PROTECTED]> wrote: > Hi, I'm new to Python, and GUI development, but am no novice to backend > programming. Aside from mastering the standard language, I will > eventually be developing applications dealing with images and controls. > Thus forth I have been testing out

Re: Number Format function

2006-02-09 Thread Sion Arrowsmith
Rick Zantow <[EMAIL PROTECTED]> wrote: print number_format( 2312753.4450, 2 ) >2,312,753.44 print number_format( 2312753.4451, 2 ) >2,312,753.45 > >I would expect the first to produce the same results as the second, but, >I suppose because of one of floating point's features, it

Re: Curios issues with Editors

2006-02-09 Thread rodmc
As I said I am most likely to have made an error, being a newbie and all that. Here is the offending function. I said i would not post source code but there you go... As I said I plan to change this function, so it will no doubt be out of date quite soon. def senddata(msg): host = "localhost"

Re: problems opening IDLE

2006-02-09 Thread rtilley
Bennie Tilma wrote: > I'm having trouble with opening the IDLE and running programs. Every > time I try to open it, it says: > 1. Socket error: Connection refused > 2. IDLE's subprocess didn't make connection. Either IDLE can't start a > subprocess or personal firewall software is blocking the co

Re: line wrapping problem

2006-02-09 Thread ZeD
Ciao, Juho Schultz! Che stavi dicendo? > should work. IMO file.write() is self-explanatory but "print >> file" is > a bit obscure. is obscure only if you have never used a shell :) -- Evangelion e' la storia yaoi di un angelo che vuole portarsi a letto un ragazzo che si intreccia con la storia

Re: how to remove using replace function?

2006-02-09 Thread Sion Arrowsmith
Duncan Booth <[EMAIL PROTECTED]> wrote: >Although I generally advise against overuse of regular expressions, this is >one situation where regular expressions might be useful: [ ... ] nobr = re.compile('\W*\W*', re.I) Agreed (on both counts), but r'\s*\s*' might be better (consider what happ

Re: apostrophe or double quote?

2006-02-09 Thread Sion Arrowsmith
Terry Hancock <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] wrote: >> Just to present a complete picture, not mentioned in this >> thread are triple-quoted strings: >> [ ... ] >Also in the mode of beating a dead horse ... ;-) > >Some people prefer to use single quotes for 'labels' (i.e. a >name wh

Re: removing characters before writing to file

2006-02-09 Thread Peter Otten
[EMAIL PROTECTED] wrote: > i have some output that returns a lines of tuples eg > > ('sometext1', 1421248118, 1, 'P ') > ('sometext2', 1421248338, 2, 'S ') > and so on > > > I tried this > re.sub(r" '() ",'',str(output)) but it only get rid of the ' and not > the braces. I need to write the

Re: line wrapping problem

2006-02-09 Thread Peter Otten
S Borg wrote: > I am parsing text from one document to another. I have a scheme > similar to: > > for x in myfoobar: >print >> mytextfile, "%s" % mydictionary[x], #all on same line print >> mytextfile # minimal fix > I am getting line breaks before my explicit line break. Am

Re: module with __call__ defined is not callable?

2006-02-09 Thread Scott David Daniels
Kent Johnson wrote: > Antoon Pardon wrote: >> This make me wonder. Would it be possible to do something with >> metaclasses so that after >> >> class SomeClass(MetaClass): >> ... >> >> SomeClass() will be equivalent to MetaClass.__call__(SomeClass) > > I think that's already what happ

Re: Hi reliability files, writing,reading,maintaining

2006-02-09 Thread Martin P. Hellwig
John Pote wrote: > So my request: > 1. Are there any python modules 'out there' that might help in securely > writing such files. > 2. Can anyone suggest a book or two on this kind of file management. (These > kind of problems must have been solved in the financial world many times). > I can't a

Re: removing characters before writing to file

2006-02-09 Thread bonono
[EMAIL PROTECTED] wrote: > hi > i have some output that returns a lines of tuples eg > > ('sometext1', 1421248118, 1, 'P ') > ('sometext2', 1421248338, 2, 'S ') > and so on > > > I tried this > re.sub(r" '() ",'',str(output)) but it only get rid of the ' and not > the braces. I need to write

Re: Curios issues with Editors

2006-02-09 Thread Robert Boyd
On 9 Feb 2006 04:46:21 -0800, rodmc <[EMAIL PROTECTED]> wrote: > As I said I am most likely to have made an error, being a newbie and > all that. Here is the offending function. I said i would not post > source code but there you go... > > As I said I plan to change this function, so it will no dou

Re: Using ioctl

2006-02-09 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: >From reading the fcntl module's docs, I came to the following solution: > > try: > f = array.array('h', [0]) > fcntl.ioctl(audio_fd, ossaudiodev.SNDCTL_DSP_GETBLKSIZE, f, 1) > frag_size = f.tolist()[0] > except: > frag_size = -1 >

Re: Twisted book opinions?

2006-02-09 Thread gene tani
Matt Goodall wrote: > Jay Parlar wrote: > > I was hoping to get some c.l.p. opinions on O'Reilly's new Twisted book. > > I think it's a good book to get. I know a fair amount about Twisted but > it still made for interesting reading. > > Tommi Virtanen (aka tv) posted a great review of the book sh

Parsing XML scheme (xsd) to python objects

2006-02-09 Thread Bizarro-02
I have a XML scheme (xsd) from which I have created with xjc (a java binding compiler (JAXB)) my java objects with all the get and set methods. Now I have to use this scheme and do the same in python but I can't find a tool which can read the scheme. I already tried generateDS.py but it couldn't p

Re: Question about idioms for clearing a list

2006-02-09 Thread Magnus Lycka
Bryan Olson wrote: > The original question was about idioms and understanding, but > there's more to the case for list.clear. Python is "duck typed". > Consistency is the key to polymorphism: type X will work as an > actual parameter if and only if X has the required methods and > they do the expec

Re: by reference

2006-02-09 Thread Martin P. Hellwig
Rene Pijlman wrote: > dirvine: >> I would like to create a dictionary based on a variable [...] > > And what seems to be the problem? > I think that this is his problem: >>> 'somename'={} SyntaxError: can't assign to literal But I'm puzzled why he wants that route, while I'm still pretty new t

Re: Curios issues with Editors

2006-02-09 Thread SPE - Stani's Python Editor
How do you run your code in SPE? I advise you to run it with Tools>Run/Stop (Ctrl+R) There would be no reason why it wouldn't work. Stani -- http://mail.python.org/mailman/listinfo/python-list

Test indexers...how do they work?

2006-02-09 Thread Raja Raman Sundararajan
Hello guys, I was investigating how one can use the "text indexers" in python and I stumbled across several ones. eg., pylucene I wanted to know how the algorithm of indexers look like. I have heard people talking about B-Trees. But this info. is simply know enough. I would like to know exactl

Re: Getting Tkinter Text contents before destruction

2006-02-09 Thread Eric Brunel
On Mon, 6 Feb 2006 20:11:28 -0700, Bob Greschke <[EMAIL PROTECTED]> wrote: > Hi! > > I want to grab the contents of a Text widget when the frame it's on gets > destroyed. I tried TextWidget.bind(""... , but the widget is > gone > before the call gets made, and I'd really hate to do something wi

Re: Twisted book opinions?

2006-02-09 Thread Andrew Gwozdziewycz
> It's really more of an example based tutorial book than cookbook. > What it does do really well is 'networking programming essentials'. I > found it quite a good book and managed to write a distributed ssh cron > tool in an evening after reading the sections on SSH. I would second that. The exam

Re: Python and the health of the public

2006-02-09 Thread Magnus Lycka
Tim Churches wrote: > The use of Python in a public health surveillance system is described > here (see references 15 and 26): > http://www.biomedcentral.com/1471-2458/5/141 > > Some more papers describing Python's starring role in some other public > health projects should appear in the next seve

Re: Unable to get PIL to load jpeg images

2006-02-09 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > The problem was that I didn't have the right jpeg library installed > (although what I had was enough to show jpegs in gThumb, GIMP and the > Gnome and KDE desktops so I don't understand why it wasn't). I had to > also install a jpeg development library, which fortu

Re: email questions

2006-02-09 Thread Carsten Haese
On Thu, 2006-02-09 at 00:50, Dennis Lee Bieber wrote: > On Wed, 8 Feb 2006 10:49:27 -0800, Scott Frankel <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > > > > mail..net > > Not sure why you feel you need to hide it -- I'm presuming it is the > same ISP in

cursesw+setlocale fixes it! (was: Re: Problem with curses and UTF-8)

2006-02-09 Thread Ian Ward
Damjan wrote: > import curses, locale > locale.setlocale(locale.LC_ALL, '') > s = curses.initscr() Hey, that works for me. Combined characters and wide characters are working too. Now the real problem.. how do I convince the python higher-ups to link against cursesw by default? At the very le

Re: Getting Tkinter Text contents before destruction

2006-02-09 Thread Eric Brunel
On Mon, 06 Feb 2006 19:32:52 -0800, James Stroud <[EMAIL PROTECTED]> wrote: > If TextWidgetsFrame inherets from frame, you can override the destroy() > method which gets called when the parent gets destroyed. Unfortunately, it doesn't get called. Everything actually happens at tk level, where

CGI Python FTP

2006-02-09 Thread [EMAIL PROTECTED]
I know PHP has support for uploading files from the browser to the server, but does python (not mod_py) have any modules for going about this? If not post your ideas on how I should do this. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting Tkinter Text contents before destruction

2006-02-09 Thread Fredrik Lundh
Bob Greschke wrote: > I want to grab the contents of a Text widget when the frame it's on gets > destroyed. I tried > TextWidget.bind(""... , but the widget is gone before the call gets > made, and I'd really > hate to do something with the function that gets called with > TextWidgetsFrame.b

Re: CGI Python FTP

2006-02-09 Thread Rene Pijlman
[EMAIL PROTECTED]: >I know PHP has support for uploading files from the browser to the >server, but does python (not mod_py) have any modules for going about >this? http://www.python.org/doc/2.3.2/lib/node403.html http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/273844 -- René Pijlman --

Re: line wrapping problem

2006-02-09 Thread Juho Schultz
ZeD wrote: > Ciao, Juho Schultz! Che stavi dicendo? > Moro, ZeD! Kunhan pulisen. Should we stick to English? > >>should work. IMO file.write() is self-explanatory but "print >> file" is >>a bit obscure. > > is obscure only if you have never used a shell :) > (I have used the shell a bit. I star

Re: Thread Dump of a python process

2006-02-09 Thread Peter Hansen
Shanon wrote: > I would to know if there're some way to have a dump of all the threads > started by a python process. I want to see the TID corresponding of each > thread because I need them to get the CPU time of each thread by the command > top. threading.enumerate() will return a list of all th

Re: removing characters before writing to file

2006-02-09 Thread Stefan Neumann
[EMAIL PROTECTED] wrote: > hi > i have some output that returns a lines of tuples eg > > ('sometext1', 1421248118, 1, 'P ') > ('sometext2', 1421248338, 2, 'S ') > and so on > > If the braces are always at the begining and at the end of the string, you could also use: >>> "('sometext1

Re: Too Many if Statements?

2006-02-09 Thread slogging_away
Terry Reedy wrote: > The OP did not specify whether all of his if-tests were sequential as in > your test or if some were nested. I vaguely remember there being an indent > limit (40??). Most of the if statements are nested. Almost all of them fall under a central 'for xxx in range(x,x,x)', (th

Re: thread dump

2006-02-09 Thread Peter Hansen
jsuch wrote: > I'm using Fedora core 3 and python 2.4.2, is there any way to obtain > the linux pid of a python thread? I need it because I want to know CPU > usage per thread. Not sure if you were the same person that posted this request not six minutes earlier under a thread titled "Thread Dump

Re: Test indexers...how do they work?

2006-02-09 Thread gene tani
Raja Raman Sundararajan wrote: > Hello guys, > I was investigating how one can use the "text indexers" in python > and I stumbled across several ones. eg., pylucene > > I wanted to know how the algorithm of indexers look like. I have heard > people talking about B-Trees. But this info. is simp

super(...).__init__() vs Base.__init__(self)

2006-02-09 Thread Kent Johnson
Are there any best practice guidelines for when to use super(Class, self).__init__() vs Base.__init__(self) to call a base class __init__()? The super() method only works correctly in multiple inheritance when the base classes are written to expect it, so "Always use super()" seems like ba

Re: Replacing curses

2006-02-09 Thread Ross Ridge
Ian Ward wrote: > I'll have to deal with that anyway, since I'm doing all my own wrapping, > justification and clipping of text. In general it's impossible to know how many display positions some random Unicode character might use. For example, Chinese characters normally take two display positio

Re: Best way of finding terminal width/height?

2006-02-09 Thread Grant Edwards
On 2006-02-09, Joel Hedlund <[EMAIL PROTECTED]> wrote: >> It didn't insert an EOF, it just caused read() to return >> "prematurely". You should call read() again until it receives >> a _real_ EOF and returns ''. > > Copy that. Point taken. > >> There appear to be a couple problems with this descri

Re: Too Many if Statements?

2006-02-09 Thread Florian Diesch
Alan Morgan <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Bryan Olson <[EMAIL PROTECTED]> wrote: >>Alan Morgan wrote: >>> slogging_away wrote: >>> Hi - I'm running Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32, and have a script that makes

Problem using epydoc with python2.4 and restructured text

2006-02-09 Thread Yuan HOng
I wish to document my project written in python2.4 with restructured text syntax. From the various python documentation tools it seems only epydoc supports rst as the documentation format. It seems however that epydoc, the last version being 2.1 released in 2004, doesn't support python2.4 well. I

Re: Pulling all n-sized combinations from a list

2006-02-09 Thread Jack Diederich
On Wed, Feb 08, 2006 at 12:50:19PM -0800, Swroteb wrote: > Hi there, > > I've got a reasonably sized list of objects that I'd like to pull out > all combinations of five elements from. Right now I have a way to do > this that's quite slow, but manageable. I know there must be a better > way to d

Re: Twisted book opinions?

2006-02-09 Thread Tim Parkin
Andrew Gwozdziewycz wrote: >>What I'd really like now is a 'Web Application Development with >>Twisted/Nevow' book that takes off where this 'network protocol' >>oriented book leaves off. > > > I thought the O'Reilly book was pretty decent at describing how to > setup a web application. It's not

Finding the public callables of self

2006-02-09 Thread Russell Warren
Is there any better way to get a list of the public callables of self other than this? myCallables = [] classDir = dir(self) for s in classDir: attr = self.__getattribute__(s) if callable(attr) and (not s.startswith("_")): myCallables.append(s) #collect the names (n

Re: random playing soundfiles according to rating.

2006-02-09 Thread JW
I think of it this way: you randomly pick a entry out of a dictionary, then roll a 100-side die to see if the pick is "good enough". Repeat until you find one, or give up. import random def rand_weighted_pick(weighted_picks): for i in range(100): name, prob = random.choice(weighted_p

Re: super(...).__init__() vs Base.__init__(self)

2006-02-09 Thread Michele Simionato
I remember there was somewhere a page called "super considered harmful", some googling should find it. It was discussing the issue you are alluding to, as well others. Also google in the newsgroup, there are lots of threads about super and its shortcomings. Michele Simionato -- http://mail.pyt

Re: Finding the public callables of self

2006-02-09 Thread Lonnie Princehouse
import inspect myCallables = [name for name, value in inspect.getmembers(self) if not name.startswith('_') and callable(value)] Instance methods aren't in self.__dict__ because they're a part of the class. To made a comprehensive list of all the attributes available to an instance, you have to t

Re: sys.path and unicode folder names

2006-02-09 Thread Martin v. Löwis
Nir Aides wrote: > If few people use file names not in their respective CP_ACP as you say, > why did Microsoft bother to make Windows XP a unicode OS? Because it simplifies their implementation, in the long run. > It is because of this situation that people in non-English speaking > countries pre

Re: line wrapping problem

2006-02-09 Thread Kent Johnson
S Borg wrote: > Hello, > > I am parsing text from one document to another. I have a scheme > similar to: > > for x in myfoobar: >print >> mytextfile, "%s" % mydictionary[x], #all on same line > print >> mytextfile, '\n' #new line > > > I am getting line breaks before my explic

Re: cursesw+setlocale fixes it!

2006-02-09 Thread Martin v. Löwis
Ian Ward wrote: > Hey, that works for me. Combined characters and wide characters are > working too. > > Now the real problem.. how do I convince the python higher-ups to link > against cursesw by default? That's very easy. Contribute a working patch. That patch should support all possible situa

Re: Finding the public callables of self

2006-02-09 Thread Kent Johnson
Russell Warren wrote: > Is there any better way to get a list of the public callables of self > other than this? > > myCallables = [] > classDir = dir(self) > for s in classDir: > attr = self.__getattribute__(s) > if callable(attr) and (not s.startswith("_")): > myC

Re: Too Many if Statements?

2006-02-09 Thread ajones
slogging_away wrote: > Terry Reedy wrote: > > > The OP did not specify whether all of his if-tests were sequential as in > > your test or if some were nested. I vaguely remember there being an indent > > limit (40??). > > Most of the if statements are nested. Almost all of them fall under a > ce

Re: Finding the public callables of self

2006-02-09 Thread Sion Arrowsmith
Russell Warren <[EMAIL PROTECTED]> wrote: >Is there any better way to get a list of the public callables of self >other than this? > >myCallables = [] >classDir = dir(self) >for s in classDir: > attr = self.__getattribute__(s) > if callable(attr) and (not s.startswith("_")): >

newbie needs serious help

2006-02-09 Thread Hunsberger, Joy
OK. Never used python. I need it to install the Google Sitemap program on our WindowsServer2003(SE) server. I cannot for the life of me figure out how to configure this thing. Please keep in mind that I do not know ANYTHING about servers. What I did: I downloaded the Python 2.4.2 msi

Rethinking the Python tutorial

2006-02-09 Thread Magnus Lycka
While the official Python Tutorial has served its purpose well, keeping it up to date is hardly anyones top priority, and there are others who passionately create really good Python tutorials on the web. I think 'A Byte of Python' by Swaroop C H is a good beginners tutorial, and 'Dive Into Python'

New editions of several Python books.

2006-02-09 Thread Magnus Lycka
While I work at a company that uses Python a lot (and would have had a hard time finding such a place a few years ago) I don't really have a clear opinion on whether Python's marketshare (or mindshare) is growing significantly. Perl seems to be in decline, but on the other hand, Ruby is attracting

Re: newbie needs serious help

2006-02-09 Thread Tim Chase
> I downloaded the Python 2.4.2 msi file, and installed it. > All went well. Now, I have no idea what to do. > I read the documentation, README files, etc., and it looks like I'm > supposed to configure it with a ./configure command,and then a magical > make command. I suspect you were reading in

Re: importing maple into python

2006-02-09 Thread Robert Kern
walter kehowski wrote: > Hello, > > Is there for a python program to call maple? http://sage.sourceforge.net -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter -- http://mail.python.org/mailman/lis

Re: newbie needs serious help

2006-02-09 Thread Robert Boyd
On 2/9/06, Hunsberger, Joy <[EMAIL PROTECTED]> wrote: > OK. Never used python. I need it to install the Google Sitemap program on > our WindowsServer2003(SE) server. > > I downloaded the Python 2.4.2 msi file, and installed it. > > All went well. Now, I have no idea what to do. > And I tried to

  1   2   >