Re: 450 Pound Library Program

2006-02-08 Thread mwt
A million thanks for in-depth critique. I look forward to figuring out half of what you're talking about ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: how to remove using replace function?

2006-02-08 Thread Dylan Moreland
[EMAIL PROTECTED] wrote: > nope didn't work Could you be more specific about the error? Both my example and yours work perfectly on my box. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to remove using replace function?

2006-02-08 Thread localpricemaps
nope didn't work -- http://mail.python.org/mailman/listinfo/python-list

Re: how to remove using replace function?

2006-02-08 Thread localpricemaps
tried that, didn't work for me -- http://mail.python.org/mailman/listinfo/python-list

Re: cx_Oracle entry point error

2006-02-08 Thread Albert Leibbrandt
[EMAIL PROTECTED] wrote: >I downloaded cx_Oracle from >http://www.cxtools.net/default.aspx?nav=cxorlb and selected the windows >installer for Oracle 8i, Python 2.4 > >>From the readme.txt file: >BINARY INSTALL: >Place the file cx_Oracle.pyd or cx_Oracle.so anywhere on your Python >path. > >So I tr

Re: only a simple xml reader value

2006-02-08 Thread Albert Leibbrandt
[EMAIL PROTECTED] wrote: >I'm newbie with that xml stuff. > >The only thing I must read is the response I get from a EPP server. >A response like this: > > >http://www.eurid.eu/xml/epp/epp-1.0"; >xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >xmlns:contact="http://www.eurid.eu/xml/epp/con

Re: Unable to get PIL to load jpeg images

2006-02-08 Thread Amit Khemka
This is because PIL, is not able to find the jpeg library . 1. Install jpeg-libs from sources: (http://www.ijg.org/files/jpegsrc.v6b.tar.gz) 2.0: "clean" the PIL build 2.1 In setup.py that comes with PIL, set the JPEG_ROOT to the jpeg-lib path 3.0 run setup.py I hope that should help .. cheers,

Re: Uses of The 4th Dimension (New Discovery by The Human Race!)

2006-02-08 Thread TheSmokingGnu
Walter Mitty wrote: > > > Jesus. I misread "clock" there for a minute taking into account the > context. Yeuckkk. > Heh. Don't tell me you've got dirty clocks, too? TheSmokingGnu -- http://mail.python.org/mailman/listinfo/python-list

Re: random playing soundfiles according to rating.

2006-02-08 Thread Michael Spencer
[EMAIL PROTECTED] wrote: ... > > But i am stuck on how to do a random chooser that works according to my > idea of choosing according to rating system. It seems to me to be a bit > different that just choosing a weighted choice like so: > ... > > And i am not sure i want to have to go through w

Re: Too Many if Statements?

2006-02-08 Thread [EMAIL PROTECTED]
Juho Schultz wrote: > > However, the following gives a SystemError with only 2500 elif's. SystemErrors should never occur, if you see one it's a bug. [valid program which demonstrates a python bug] > Traceback (most recent call last): >File "iftest.py", line 10, in ? > exec prog > Syste

Re: how to remove using replace function?

2006-02-08 Thread Dylan Moreland
I think you want to use the replace method of the string instance. Something like this will work: # See http://docs.python.org/lib/string-methods.html#l2h-196 txt = "an unfortunate in the middle" txt = txt.replace("", "") -- http://mail.python.org/mailman/listinfo/python-list

how to remove using replace function?

2006-02-08 Thread localpricemaps
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() strTitle = string.replace(strTitle,'','') but it

Re: Replacing curses

2006-02-08 Thread Ian Ward
Ross Ridge wrote: > Thomas Dickey wrote: >>...and send UTF-8 text, keeping track of where you really are on the screen. > You make that sound so easy. I'll have to deal with that anyway, since I'm doing all my own wrapping, justification and clipping of text. (don't talk to me about RtoL text, I'

Re: random playing soundfiles according to rating.

2006-02-08 Thread Steve Holden
[EMAIL PROTECTED] wrote: > I am a little bit stuck > > I want to play a bunch of soundfiles randomly, but i want to give each > soundfile a rating (say 0-100) and have the likelihood that the file be > chosen be tied to its rating so that the higher the rating the more > likely a file is to b

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

2006-02-08 Thread Ian Ward
Jean-Paul Calderone wrote: >> I've looked at newt and snack, but all I really need is: >> - a way to position the cursor at (0,0) >> - a way to hide and show the cursor >> - a way to detect when the terminal is resized >> - a way to query the terminal size > > You might be interested in Twisted Co

Re: still a valid book?

2006-02-08 Thread John Salerno
Scott David Daniels wrote: > John Salerno wrote: >> Jonathan Gardner wrote: >>> You may want to read >>> http://python.org/doc/2.4.2/whatsnew/whatsnew24.html to get an idea of >>> what has changed from 2.3 to 2.4 if you buy the 2.3 book. >>> >> Yeah, I was looking at that, but it seems a little ove

random playing soundfiles according to rating.

2006-02-08 Thread kp87
I am a little bit stuck I want to play a bunch of soundfiles randomly, but i want to give each soundfile a rating (say 0-100) and have the likelihood that the file be chosen be tied to its rating so that the higher the rating the more likely a file is to be chosen. Then i need some addition

Re: removing characters before writing to file

2006-02-08 Thread Frank Potter
r=re.compile(r"(\(')|( '\))|'")print r.sub('',str(output))On 8 Feb 2006 18:35:01 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: hii have some output that returns a lines of tuples egtr('sometext1', 1421248118, 1, 'P ')('sometext2', 1421248338, 2, 'S ')and so onI tried thisre.sub(r" '() ",

Re: removing characters before writing to file

2006-02-08 Thread jawahh
', '.join(map(str,output)) -- http://mail.python.org/mailman/listinfo/python-list

Re: Jython inherit from Java class

2006-02-08 Thread Kent Johnson
Mark Fink wrote: > I wrote a Jython class that inherits from a Java class and (thats the > plan) overrides one method. Everything should stay the same. > > If I run this nothing happens whereas if I run the Java class it says: > usage: java fit.FitServer [-v] host port socketTicket > -v

Re: still a valid book?

2006-02-08 Thread Scott David Daniels
John Salerno wrote: > Jonathan Gardner wrote: >> You may want to read >> http://python.org/doc/2.4.2/whatsnew/whatsnew24.html to get an idea of >> what has changed from 2.3 to 2.4 if you buy the 2.3 book. >> > > Yeah, I was looking at that, but it seems a little over my head right > now. I just d

removing characters before writing to file

2006-02-08 Thread eight02645999
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 the output to a file such that sometext1, 142

Twisted book opinions?

2006-02-08 Thread Jay Parlar
I was hoping to get some c.l.p. opinions on O'Reilly's new Twisted book. I'm coming at Twisted as someone who's been programming mainly in Python for almost 6 years now, but who's never done any Twisted development. I've used some of its prepackaged libraries before (and did some custom tweaks

Re: Pulling all n-sized combinations from a list

2006-02-08 Thread Swroteb
Yes, certainly. I hadn't done any profiling up to that point, but it really seemed like my biggest time sink was inefficiently losing time in obtaining the combinations. -- http://mail.python.org/mailman/listinfo/python-list

Re: Replacing curses

2006-02-08 Thread Ross Ridge
Thomas Dickey wrote: > ...and send UTF-8 text, keeping track of where you really are on the screen. You make that sound so easy. Ross Ridge -- http://mail.python.org/mailman/listinfo/python-list

Re: still a valid book?

2006-02-08 Thread John Salerno
Jonathan Gardner wrote: > You may want to read > http://python.org/doc/2.4.2/whatsnew/whatsnew24.html to get an idea of > what has changed from 2.3 to 2.4 if you buy the 2.3 book. > Yeah, I was looking at that, but it seems a little over my head right now. I just didn't want to learn anything an

Re: Pulling all n-sized combinations from a list

2006-02-08 Thread Paul Rubin
Michael Spencer <[EMAIL PROTECTED]> writes: > This is roughly 30 times faster on my box than the general solution above Good point. You could probably improve the generator version some (probably not 30x) by doing less list arithmetic and slicing though. I just wrote it the most straightforward w

Re: Problem with curses and UTF-8

2006-02-08 Thread Damjan
I just recompiled my python to link to ncursesw, and tried your example with a little modification: import curses, locale locale.setlocale(locale.LC_ALL, '') s = curses.initscr() s.addstr(u'\u00c5 U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE\n'.encode('utf-8') ) s.addstr(u'\u00f5 U+00F5 LATIN SMA

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

2006-02-08 Thread Jean-Paul Calderone
On Wed, 08 Feb 2006 15:10:26 -0500, Ian Ward <[EMAIL PROTECTED]> wrote: >Grant Edwards wrote: >> Depending on what you're tring to do, slang might be an option, > >I've looked at newt and snack, but all I really need is: >- a way to position the cursor at (0,0) >- a way to hide and show the cursor

Re: Pulling all n-sized combinations from a list

2006-02-08 Thread Michael Spencer
Swroteb wrote: > Paul Rubin wrote: >> I think the natural approach is to make a generator that yields a >> 5-tuple for each combination, and then have your application iterate >> over that generator. Here's my version: >> >> def comb(x,n): >> """Generate combinations of n items from li

Re: Replacing curses

2006-02-08 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Thomas Dickey <[EMAIL PROTECTED]> wrote: > Ian Ward <[EMAIL PROTECTED]> wrote: ... > > Also, screen resizing only seems to be reported once by getch() even if > > the user continues to resize the window. I have worked around this by > > calling curses.doupdate() b

Re: still a valid book?

2006-02-08 Thread Jonathan Gardner
You may want to read http://python.org/doc/2.4.2/whatsnew/whatsnew24.html to get an idea of what has changed from 2.3 to 2.4 if you buy the 2.3 book. -- http://mail.python.org/mailman/listinfo/python-list

Re: UnboundMethodType and MethodType

2006-02-08 Thread Scott David Daniels
Kirk McDonald wrote: > Scott David Daniels wrote: > > You know what? That makes perfect sense. Thank you. Thanks a lot for mentioning this. I do try to help out, and sometimes it feels like talking to the wind. A thanks every now and then is greatly appreciated. Just for fun, you can play w

Re: Replacing curses

2006-02-08 Thread Thomas Dickey
Ian Ward <[EMAIL PROTECTED]> wrote: > Thomas Dickey wrote: >> hmm - I've read Urwid, and most of the comments I've read in that regard >> reflect problems in Urwid. Perhaps it's time for you to do a little >> analysis. >> >> (looking forward to bug reports, rather than line noise) > A fair requ

Re: Circe released to public domain!

2006-02-08 Thread Diez B. Roggisch
Kyle Brooks schrieb: > Wednesday, February 8th, 2006. > > Dear all, > > I hereby release Circe to the public domain. > > Our repo is at http://kbrooks.ath.cx/repos/circe. This is the second post I read, followed the link, skimmed through some sources and READMEs, and by now I got the impressi

Re: Replacing curses

2006-02-08 Thread Thomas Dickey
Ian Ward <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: >> Depending on what you're tring to do, slang might be an option, > I've looked at newt and snack, but all I really need is: > - a way to position the cursor at (0,0) > - a way to hide and show the cursor > - a way to detect when the term

Re: Replacing curses

2006-02-08 Thread Thomas Dickey
Grant Edwards <[EMAIL PROTECTED]> wrote: > Depending on what you're tring to do, slang might be an option, perhaps not - he's trying to use UTF-8. I haven't seen any plausible comment that indicates John Davis is interested in updating newt to work with slang2 (though of course he's welcome to s

Re: Problem with curses and UTF-8

2006-02-08 Thread Thomas Dickey
Ian Ward <[EMAIL PROTECTED]> wrote: > Martin v. Löwis wrote: >> If that was Python's configure: don't do that. Instead, hack setup.py >> to make it change the compiler/linker settings, or even edit the >> compiler/linker line manually at first. > Ok, that compiled. same here - though it was not

cx_Oracle entry point error

2006-02-08 Thread lblr33
I downloaded cx_Oracle from http://www.cxtools.net/default.aspx?nav=cxorlb and selected the windows installer for Oracle 8i, Python 2.4 >From the readme.txt file: BINARY INSTALL: Place the file cx_Oracle.pyd or cx_Oracle.so anywhere on your Python path. So I tried this and set PYTHONPATH. I then

Re: Literal Escaped Octets

2006-02-08 Thread Chason Hayes
On Wed, 08 Feb 2006 00:57:45 -0500, Steve Holden wrote: > Chason Hayes wrote: >> On Tue, 07 Feb 2006 01:58:00 +, Steve Holden wrote: >> >> >>>Chason Hayes wrote: >>> On Mon, 06 Feb 2006 13:39:17 +, Steve Holden wrote: >>> >>>[...] >>> >The URL you reference is discussing how you

Re: Tkinter, X-windows and ebay

2006-02-08 Thread James Stroud
Bob Greschke wrote: > When you post something on eBay (and other places) you can use a 'browse' > button on a web page to send a picture file from your hard drive to them for > inclusion in your listing. Can the same kind of thing (not the same exact > thing, of course) be done with a Python/Tk

by reference

2006-02-08 Thread dirvine
I would like to create a dictionary based on a variable i.e read a bunch of filenames and create a dict for each one called the filename filename={} to get the filenames I trraverse teh dirs woth os.path.walk or similar Sorry I'm a bit new to python -- http://mail.python.org/mailman/listinfo/pyt

Re: Problem with curses and UTF-8

2006-02-08 Thread Thomas Dickey
"Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >> I'll test it if someone would dumb down "link with ncursesw instead of >> ncurses" a little for me. >> >> I tried: >> ./configure --with-libs="ncursesw5" >> >> and it failed saying: >> checking size of wchar_t... configure: error: cannot compute siz

Re: Ternary Operator Now?

2006-02-08 Thread Roy Smith
Steve Holden <[EMAIL PROTECTED]> wrote: >> x = y if C : else z >> > >Currently scheduled for next (2.5) release, but not yet implemented. This still makes me barf. Has Python jumped the shark? It looks marginally better if you write it as: x = (y if C else z) -- http://mail.python.org/mailma

Re: apostrophe or double quote?

2006-02-08 Thread Terry Hancock
On Wed, 8 Feb 2006 11:57:00 -0600 [EMAIL PROTECTED] wrote: > Just to present a complete picture, not mentioned in this > thread are triple-quoted strings: > > 'abc' == '''abc''' == "abc" == """abc""" > > Triple-quoted strings are no different than regular > strings, though they do allow liter

Re: Pulling all n-sized combinations from a list

2006-02-08 Thread my . correo . basura
> Ah, this definitely seems to work! It's a lot nicer in appearance than > my previous code, that's for sure. It actually runs in approximately > the same amount of time though. As a side note, this problem will always be "slow". The number of combinations grows exponentially with n. No matter h

Re: Ternary Operator Now?

2006-02-08 Thread Steve Holden
Ben Wilson wrote: > I read somewhere else that Python was getting a ternary operator (e.g. > x = (true/false) ? y : z). I read the PEP about it and that the PEP had > been approved this past Fall. Has this been released into the wild yet? > > IIRC, the operator is like: > > x = y if C : else z >

Re: Ternary Operator Now?

2006-02-08 Thread Xavier Morel
Ben Wilson wrote: > I read somewhere else that Python was getting a ternary operator (e.g. > x = (true/false) ? y : z). I read the PEP about it and that the PEP had > been approved this past Fall. Has this been released into the wild yet? > > IIRC, the operator is like: > > x = y if C : else z >

Re: jump into the interpreter in a script

2006-02-08 Thread Rick Ratzel
pdb might help. Add this to your code: import pdb pdb.set_trace() -- http://mail.python.org/mailman/listinfo/python-list

Re: UnboundMethodType and MethodType

2006-02-08 Thread Kirk McDonald
Scott David Daniels wrote: > To elaborate on this, once 'id' is called, you drop the reference. > This allows quite surprising things like: > >>> id(7**8) == id(8**7) > True > >>> a, b = 7**8, 8**7 > >>> id(a) == id(b) # this time there are other references to a and b > False > > If you wanted

Re: Python 2.4.2 using msvcrt71.dll on Win and compatibility issues

2006-02-08 Thread Christoph Zwerschke
Martin v. Löwis wrote: > Christoph Zwerschke wrote: >> I think this would only shift the problem. Because then I would have to >> convert the msvcr71 stream I get from Python to a msvcrt stream. Using >> fileno() (of msvcrt) to get the file descriptor will probably not work. > > It actually would:

Re: Pulling all n-sized combinations from a list

2006-02-08 Thread Swroteb
Paul Rubin wrote: > I think the natural approach is to make a generator that yields a > 5-tuple for each combination, and then have your application iterate > over that generator. Here's my version: > > def comb(x,n): > """Generate combinations of n items from list x""" > if n

jump into the interpreter in a script

2006-02-08 Thread Brian Blais
Hello, I was wondering if there is a way to, within a script, jump into the interpreter. What I mean is something like the "keyboard" command in Matlab, where the script pauses and you get an interpreter prompt, where you can look at variables, change their values, etc. then when you exit the i

Re: breadth first search

2006-02-08 Thread Charles Krug
On 2006-02-08, News <[EMAIL PROTECTED]> wrote: > I am new in using Python > > Anyone know how to implement breadth first search using Python? Can Python > create list dynamically, I want to implement a program which will read data > from a file and store each line into a list, is this possible? >

RE: module with __call__ defined is not callable?

2006-02-08 Thread Delaney, Timothy (Tim)
Steven D'Aprano wrote: > That's not a _reason_, it is just a (re-)statement of fact. We know > that defining a __call__ method on a module doesn't make it callable. > Why not? The answer isn't "because defining a __call__ method on a > module or an instance doesn't make it callable", that's just a

Re: Pulling all n-sized combinations from a list

2006-02-08 Thread Paul Rubin
"Swroteb" <[EMAIL PROTECTED]> writes: > I'm a little bit confused about your generator suggestion. My list is > a set of references to instantiated objects. I'm just unsure about how > to iterate through every unique combination of those references. Are > you suggesting that I set up methods to

Ternary Operator Now?

2006-02-08 Thread Ben Wilson
I read somewhere else that Python was getting a ternary operator (e.g. x = (true/false) ? y : z). I read the PEP about it and that the PEP had been approved this past Fall. Has this been released into the wild yet? IIRC, the operator is like: x = y if C : else z -- http://mail.python.org/mailma

Re: Another try at Python's selfishness

2006-02-08 Thread Charles Krug
On 2006-02-08, Ben Wilson <[EMAIL PROTECTED]> wrote: > "But the point is, the current situation is not newbie-friendly (I can > tell, I am a newbie)" > > I will agree to that, as I consider myself still new. _But_, it's a > stumbling stone only briefly. Get enough nagging error messages, and > you

Re: Problem with curses and UTF-8

2006-02-08 Thread Ian Ward
Martin v. Löwis wrote: > If that was Python's configure: don't do that. Instead, hack setup.py > to make it change the compiler/linker settings, or even edit the > compiler/linker line manually at first. Ok, that compiled. Now when I run the same test: import curses s = curses.initscr() s.addst

Re: Xah's Edu Corner: Unix damage: color names

2006-02-08 Thread William James
[EMAIL PROTECTED] wrote: > On AIX and Linux (SuSE 9.3) each color name which contains "gray" is > also aliased as "grey" for the benefit of both Yanks and Brits. Thus, Yankee, n. In Europe, an American. In the Northern States of our Union, a New Englander. In the Southern States the word is un

Re: What editor shall I use?

2006-02-08 Thread Benji York
Dylan Moreland wrote: > I myself have just begun using vim. Does anyone have any > tips/convenient tweaks for python programming with it? EnhancedCommentify, ShowFunc, spacehi, svncommand, and pythonhelper are nice Vim plugins to use with Python. They can all be found on vim.org. Not Python-spe

Re: What editor shall I use?

2006-02-08 Thread Tim Chase
> I myself have just begun using vim. Does anyone have any > tips/convenient tweaks for python programming with it? For python programming several settings can make life far less painful (assuming you like 4-spaces-per-tab) : set ai ts=4 sw=4 et or set ai ts=4 sw=4 noet (depen

Re: What editor shall I use?

2006-02-08 Thread Dylan Moreland
Radek Kubicek wrote: > > What editor shall I use if my Python script must contain utf-8 > > characters? > > I use XP > > vim :-) > > > Thank you for reply > > l.b. > > not for all :-) I myself have just begun using vim. Does anyone have any tips/convenient tweaks for python programming with it?

Re: What editor shall I use?

2006-02-08 Thread [EMAIL PROTECTED]
I use JEdit and I like it very much. http://www.jedit.org/ Uros -- http://mail.python.org/mailman/listinfo/python-list

Re: Pulling all n-sized combinations from a list

2006-02-08 Thread Swroteb
Paul Rubin wrote: > "Swroteb" <[EMAIL PROTECTED]> writes: > > Atrocious and slow, I'm sure, but is there a better way? I can't > > simply create a list with the combinations I want, since it won't fit > > into memory. And I'm sure I can do it using a standard paradigm using > > five indexed for

Avoiding FTP server timeout for files based on sockets (long posting)

2006-02-08 Thread Stefan Schwarzer
Hi all! For my FTP library module ftputil [1], some users have asked for a way to avoid server timeouts (FTP status code 421). But I haven't found out yet how I can do this in all cases. I try to explain the problem in more detail. The following is rather special and probably not so easy to under

Circe released to public domain!

2006-02-08 Thread Kyle Brooks
Wednesday, February 8th, 2006. Dear all, I hereby release Circe to the public domain. Our repo is at http://kbrooks.ath.cx/repos/circe. -- http://mail.python.org/mailman/listinfo/python-list

Re: Number Format function

2006-02-08 Thread Rick Zantow
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > def number_format(num, places=0): > """Format a number according to locality and given places""" > locale.setlocale(locale.LC_ALL, "") > return locale.format("%.*f", (places, num), True) > There are some edge

spell check code

2006-02-08 Thread rtilley
What is the most common way to spell check comments in code? Are there any idle plugins or modules that do this? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: os.walk() dirs and files

2006-02-08 Thread rtilley
George Sakkis wrote: > Or a bit more efficiently (no need to allocate a new list for storing > files+dirs): > > from itertools import chain > for root, dirs, files in os.walk(path): > for fs_object in chain(files,dirs): > ADD fs_object to dictionary I like that! itertools is

Re: Pulling all n-sized combinations from a list

2006-02-08 Thread Paul Rubin
"Swroteb" <[EMAIL PROTECTED]> writes: > Atrocious and slow, I'm sure, but is there a better way? I can't > simply create a list with the combinations I want, since it won't fit > into memory. And I'm sure I can do it using a standard paradigm using > five indexed for loops (ie, for i = 1, for j =

Re: sys.path and unicode folder names

2006-02-08 Thread Martin v. Löwis
Nir Aides wrote: > Actually, I already managed to make a Patch for this problem. > I will post it soon on my website and in this group. > > But I find it strange that this problem even exists, and that I could > not find any workarounds on the Internet. Very few people use file names not in their

Re: Problem with curses and UTF-8

2006-02-08 Thread Martin v. Löwis
> I'll test it if someone would dumb down "link with ncursesw instead of > ncurses" a little for me. > > I tried: > ./configure --with-libs="ncursesw5" > > and it failed saying: > checking size of wchar_t... configure: error: cannot compute sizeof > (wchar_t), 77 If that was Python's configure:

Re: Number Format function

2006-02-08 Thread [EMAIL PROTECTED]
This is a little faster: def number_format(num, places=0): """Format a number according to locality and given places""" locale.setlocale(locale.LC_ALL, "") return locale.format("%.*f", (places, num), True) I tested this ok with my test -- http://mail.python.org/mailman/listinfo/pyth

Re: Question about idioms for clearing a list

2006-02-08 Thread Bryan Olson
Magnus Lycka wrote: > Ed Singleton wrote: > >> The point is that having to use del to clear a list appears to the >> inexperienced as being an odd shaped brick when they've already used >> the .clear() brick in other places. > > > Agreed. The smart way to go from this stage of surprise is > not

Re: What editor shall I use?

2006-02-08 Thread Steve Holden
Petr Jakes wrote: > http://www.pspad.com/en/ > > Petr Jakes > Windows provides the perfectly usable Notepad which, while not perfect for Python, is quite good enough to get started. The Save dialog box allows the user to select an encoding, including UTF-8. regards Steve -- Steve Holden

Re: module with __call__ defined is not callable?

2006-02-08 Thread Steve Holden
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 >>code of both modules? What happens if I multiply a module by two -

still a valid book?

2006-02-08 Thread John Salerno
Hi everyone. I have Learning Python 2nd edition (O'Reilly) and I noticed that Wrox has a newer book out (Beginning Python) that covers version 2.4. Do you think that Learning Python is still a good enough book to be an intro to the language? Is there anything so different about 2.4 from 2.3 tha

Pulling all n-sized combinations from a list

2006-02-08 Thread Swroteb
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 do this, but I'm not sure what it is. Here's what I've got so far:

Re: Unable to get PIL to load jpeg images

2006-02-08 Thread Andrew Gwozdziewycz
On 2/7/06, Steve Holden <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Someone out there must surely know - please! > > > > Peter > > Try building the PIL from scratch. It might give you some insight as to which library it exactly is looking for. I can remember when compiling the PIL on

Re: sys.path and unicode folder names

2006-02-08 Thread Nir Aides
Actually, I already managed to make a Patch for this problem. I will post it soon on my website and in this group. But I find it strange that this problem even exists, and that I could not find any workarounds on the Internet. Nir Martin v. Löwis wrote: > Nir Aides wrote: >> I can not restrict

Re: Number Format function

2006-02-08 Thread Edward Hartfield
Thanks. I noticed the bugs later. But after talking with my boss, he suggested something more elegant (again *untested*, yet): import locale def number_format(num, places=0) """Format a number according to locality and given places""" locale.setlocale(locale.LC_ALL, locale.getdefaultloc

Re: breadth first search

2006-02-08 Thread Tim Chase
> Thanks for your reply and the structure of the file structure going to be > read is > > > > ... > > > The aims is to find out the shortest path(s) for the leaf node(s) > > Example: > 9 > 0 1 1 > 0 4 2 > 1 2 3 > 1 3 4 > 4 3 2 > 4 5 1 > 4 8 2 > 5 6 2 > 5 7 2 > -1 > > Output: > Possible solut

Re: Number Format function

2006-02-08 Thread [EMAIL PROTECTED]
Your code has a little bug, I highly recommend to add a test to your code, for an idea see below - I fixed your code as well. #!/usr/bin/env python import math def number_format(num, places=0): """Format a number with grouped thousands and given decimal places""" #is_negative = (num < 0)

Re: Too Many if Statements?

2006-02-08 Thread Paul Rubin
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > SystemError: com_backpatch: offset too large Yeah, that sounds like there's some 16-bit fields in the bytecode format. -- http://mail.python.org/mailman/listinfo/python-list

Python and the health of the public

2006-02-08 Thread Tim Churches
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 several months. Tim C -- http:/

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

2006-02-08 Thread Ian Ward
Grant Edwards wrote: > Depending on what you're tring to do, slang might be an option, I've looked at newt and snack, but all I really need is: - a way to position the cursor at (0,0) - a way to hide and show the cursor - a way to detect when the terminal is resized - a way to query the terminal s

Re: Too Many if Statements?

2006-02-08 Thread [EMAIL PROTECTED]
> > I made a script with 100,000 if's, (code below) and it appears > > to work on a couple systems, including Python 2.4.2 on Win32-XP. > > So at first cut, it doesn't seem to be just the if-count that > > triggers the bug. > > I tried that code. It runs fine. > > However, the following gives a Sy

Re: A __getattr__ for class methods?

2006-02-08 Thread Xavier Morel
Oh, and I wondered too: is your goal to build an ORM, or do you just need an ORM? Cause if it's the latter then Python does already have some fairly good ORMs such as SQLAlchemy or PyDO2, you don't *need* to create yours. -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with curses and UTF-8

2006-02-08 Thread Martin v. Löwis
Thomas Dickey wrote: > no need for debugging - it's a well-known problem. UTF-8 uses more than > one byte per cell, normal curses uses one byte per cell. To handle UTF-8, > you need ncursesw. I tried that, but it didn't improve anything. Regards, Martin -- http://mail.python.org/mailman/listin

Re: email questions

2006-02-08 Thread Scott Frankel
Yes, I was doing something wrong: I was connecting to the localhost after instantiation. All better now. Thanks for the tips! Scott On Feb 8, 2006, at 11:04 AM, Carsten Haese wrote: > > Then you're doing something wrong. The line > > s = smtplib.SMTP("mail.ispname.net") instantiates an SM

Re: Python 2.4.2 using msvcrt71.dll on Win and compatibility issues

2006-02-08 Thread Ross Ridge
Martin v. Löwis wrote: > In general, the only Microsoft-supported strategy is that you > must use only a single msvcrt in the entire application. So > either recompile PostGres, or recompile Python. If you want a compiled version of Python that already uses MSVCRT then you try using pyMingGW:

Re: Dual Core outlook

2006-02-08 Thread malv
Hi All, Thank you for your commentaries. In the meantime, I read up in Python-Dev and came across a post by Johnatan LaCour which kind of nicely sums up the state of affairs: "Its really a shame. There seems to be some consensus about multi-processing, but not a whole lot of interest in making it

Re: Python 2.4.2 using msvcrt71.dll on Win and compatibility issues

2006-02-08 Thread Martin v. Löwis
Christoph Zwerschke wrote: > I think this would only shift the problem. Because then I would have to > convert the msvcr71 stream I get from Python to a msvcrt stream. Using > fileno() (of msvcrt) to get the file descriptor will probably not work. It actually would: #define _fileno(_stream) ((_s

Re: Question about idioms for clearing a list

2006-02-08 Thread Terry Reedy
"Magnus Lycka" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Statements and operators are really fundamental in Python. We > don't support n = 1.add(2), since we have the '+' operator. Actually, since the 2.2 union of type and new-style classes, which gave attributes to all type

Re: A __getattr__ for class methods?

2006-02-08 Thread Xavier Morel
Dylan Moreland wrote: > I'm trying to implement a bunch of class methods in an ORM object in > order to provide functionality similar to Rails' ActiveRecord. This > means that if I have an SQL table mapped to the class "Person" with > columns name, city, and email, I can have class methods such as:

Re: Problem with curses and UTF-8

2006-02-08 Thread Ian Ward
Thomas Dickey wrote: > "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >>The ncurses documentation suggests that you should link with >>ncurses_w instead of linking with ncurses - you might try >>that as well. If it helps, please do report back. > > > ncursesw I'll test it if someone would dumb dow

Re: A __getattr__ for class methods?

2006-02-08 Thread Dylan Moreland
Michael Spencer wrote: > Dylan Moreland wrote: > > I'm trying to implement a bunch of class methods in an ORM object in > > order to provide functionality similar to Rails' ActiveRecord. This > > means that if I have an SQL table mapped to the class "Person" with > > columns name, city, and email,

Re: Is Python good for web crawlers?

2006-02-08 Thread Magnus Lycka
Simon Brunning wrote: > On 2/8/06, Alex Martelli <[EMAIL PROTECTED]> wrote: > >>Bot? me? did I fail a Turing test again without even noticing?! > > > If you'd noticed the test, you'd have passed. No no, it's just a regular expression that notices the word 'bot' close to 'Martelli'. Wouldn't sur

Re: Too Many if Statements?

2006-02-08 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, Pierre Quentel <[EMAIL PROTECTED]> wrote: >This is because Python has a hidden mechanism to detect programs >generated by Perl scripts, and make them crash with no explanation In my case it turned out to be python having a hidden method to detect when you are using

  1   2   3   >