Re: sys.path and unicode folder names

2006-02-07 Thread Nir Aides
I can not restrict the name to CP_ACP. I am interested in the general case of Unicode. Windows XP is a native Unicode OS. Martin v. Löwis wrote: > Nir Aides wrote: >> Is there a solution or a work around for the sys.path problem with >> unicode folder names on Windows XP? >> >> I need to be able

Re: Too Many if Statements?

2006-02-07 Thread Pierre Quentel
This is because Python has a hidden mechanism to detect programs generated by Perl scripts, and make them crash with no explanation Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: RPy / R

2006-02-07 Thread Eddie
Hi Jason I had more success, being able to run a few test programs. Not sure why yours would be crashing - I have a similar setup (Win XP SP2 with all updates) - my version of Python is the Activestate download (ActivePython-2.4.2.10-win32-x86.msi). Have you installed Numeric? If all else fails

Re: Too Many if Statements?

2006-02-07 Thread [EMAIL PROTECTED]
Alan Morgan wrote: > > generated (I'm ashamed to admit) by a perl script. Is there any good reason > why > it is failing? I'd prefer a "Too many silly walks in your program. Reduce!" > to > a crash. Everyone, Please file a bug report anytime you make Python crash! http://sourceforge.net

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

2006-02-07 Thread vdrab
I WISH TO KNOW THE TRUTH: WHEN WILL WE HAVE PYPY? -- http://mail.python.org/mailman/listinfo/python-list

Re: how to copy a Python object

2006-02-07 Thread Alex Martelli
Schüle Daniel <[EMAIL PROTECTED]> wrote: ... > >>> class X(object): > ... def __init__(self,lst): > ... self.lst = lst > ... def copy(self): > ... return X(self.lst[:]) > ... def __str__(self): > ... return "lst has id %i" % id(self.lst) ... >

Re: Literal Escaped Octets

2006-02-07 Thread Steve Holden
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 represent arbitrary values in string literals. If you already ha

Re: Literal Escaped Octets

2006-02-07 Thread Chason Hayes
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 represent arbitrary values >>>in string literals. If you already have the data in a Python string the

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

2006-02-07 Thread Rich Teer
On Tue, 7 Feb 2006, Xah Lee wrote: More of his usual bollocks. ___ /| /| | | ||__|| | Please do | / O O\__ NOT |

Re: HTML page into a string

2006-02-07 Thread Tempo
Perfect. Thanks a bunch for clearing that all up for me. You have delayed some long lost hours for me. -- http://mail.python.org/mailman/listinfo/python-list

Mark Hammond's pipe service

2006-02-07 Thread Guilligan
Hello to all, I'm trying to reproduce the PipeService1 from Mark Hammond's "Python programming on win32" (which you can get on M. Hammond web site, in the sample package, chapter 18). I googled this but there's not much posts about this topic. I'm trying to use the Service frame in that exampl

Re: HTML page into a string

2006-02-07 Thread Jason Earl
"Tempo" <[EMAIL PROTECTED]> writes: > In my last post I received some advice to use urllib.read() to get a > whole html page as a string, which will then allow me to use > BeautifulSoup to do what I want with the string. But when I was > researching the 'urllib' module I couldn't find anything abo

Re: apostrophe or double quote?

2006-02-07 Thread Steve Holden
Huy wrote: > I've been unable to find information clarifying this but. What is the > difference between 'somestring' and "somestring"? When I use type() it > still reports as string. If there is a difference could someone point > me to documentation or explain when to use and when not to? Hope

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

2006-02-07 Thread Ian Ward
Martin v. Löwis wrote: >Ian Ward wrote: > > >>Any Ideas? >> >> > >I think there is one or more ncurses bugs somewhere. > >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.

Re: HTML page into a string

2006-02-07 Thread Steve Holden
Tempo wrote: > In my last post I received some advice to use urllib.read() to get a > whole html page as a string, which will then allow me to use > BeautifulSoup to do what I want with the string. But when I was > researching the 'urllib' module I couldn't find anything about its > sub-section '.r

Re: apostrophe or double quote?

2006-02-07 Thread James Stroud
Huy wrote: > I've been unable to find information clarifying this but. What is the > difference between 'somestring' and "somestring"? When I use type() it > still reports as string. If there is a difference could someone point > me to documentation or explain when to use and when not to? Hope

Re: module with __call__ defined is not callable?

2006-02-07 Thread limodou
On 2/8/06, Delaney, Timothy (Tim) <[EMAIL PROTECTED]> wrote: > limodou wrote: > > > On 2/8/06, adam johnson <[EMAIL PROTECTED]> wrote: > >> Thanks for you answer. > >> > >> I was under the impression that you could tack methods onto an > >> object at any time, your example almost works with old sty

Re: Question about idioms for clearing a list

2006-02-07 Thread Raymond Hettinger
[Ed Singleton] > Is it obvious to a newbie what the difference between mappings and > "not-mappings", and is it obvious exactly what is and isn't a mapping? FWIW, there is a glossary in the tutorial: http://docs.python.org/tut/node18.html -- http://mail.python.org/mailman/listinfo/python-lis

RE: module with __call__ defined is not callable?

2006-02-07 Thread Delaney, Timothy (Tim)
limodou wrote: > On 2/8/06, adam johnson <[EMAIL PROTECTED]> wrote: >> Thanks for you answer. >> >> I was under the impression that you could tack methods onto an >> object at any time, your example almost works with old style classes >> and would with a function instead of a method. In fact it

apostrophe or double quote?

2006-02-07 Thread Huy
I've been unable to find information clarifying this but. What is the difference between 'somestring' and "somestring"? When I use type() it still reports as string. If there is a difference could someone point me to documentation or explain when to use and when not to? Hope I sound clear. --

Re: Detecting line endings

2006-02-07 Thread Alex Martelli
Fuzzyman <[EMAIL PROTECTED]> wrote: ... > I can't open with a codec unless an encoding is explicitly supplied. I > still want to detect UTF16 even if the encoding isn't specified. > > As I said, I ought to test this... Without metadata I wonder how Python > determines it ? It doesn't. Python

Re: module with __call__ defined is not callable?

2006-02-07 Thread limodou
On 2/8/06, adam johnson <[EMAIL PROTECTED]> wrote: > Thanks for you answer. > > I was under the impression that you could tack methods onto an object at any > time, your example almost works with old style classes and would with a > function instead of a method. > > >>> class A: > ... def __ini

Re: UnboundMethodType and MethodType

2006-02-07 Thread Kirk McDonald
Schüle Daniel wrote: > Hello all, > > >>> class Q: > ... def bar(self): > ... pass > ... > >>> import types > >>> types.UnboundMethodType is types.MethodType > True > >>> > >>> type(Q.bar) > > >>> > >>> q = Q() > >>> type(q.bar) > > >>> > >>> type(q.bar) is types.Unboun

Re: module with __call__ defined is not callable?

2006-02-07 Thread adam johnson
Thanks for you answer.I was under the impression that you could tack methods onto an object at any time, your example almost works with old style classes and would with a function instead of a method.>>> class A: ... def __init__(self):... self.__call__ = A.hello... def hello(se

Re: module with __call__ defined is not callable?

2006-02-07 Thread limodou
On 2/8/06, Delaney, Timothy (Tim) <[EMAIL PROTECTED]> wrote: > adam johnson wrote: > > > Hi All. > > I was wondering why defining a __call__ attribute for a module > > doesn't make it actually callable. > > For the same reason that the following doesn't work > > class A (object): > > de

Re: Hi reliability files, writing,reading and maintaining

2006-02-07 Thread Peter Hansen
John Pote wrote: > I would wish to secure this data gathering against crashes of the OS, > hardware failures and power outages. My first thought when reading this is "SQLite" (with the Python wrappers PySqlite or APSW). See http://www.sqlite.org where it claims "Transactions are atomic, consis

RE: module with __call__ defined is not callable?

2006-02-07 Thread Delaney, Timothy (Tim)
adam johnson wrote: > Hi All. > I was wondering why defining a __call__ attribute for a module > doesn't make it actually callable. For the same reason that the following doesn't work class A (object): def __init__(self): self.__call__ = A.hello def hello (self

HTML page into a string

2006-02-07 Thread Tempo
In my last post I received some advice to use urllib.read() to get a whole html page as a string, which will then allow me to use BeautifulSoup to do what I want with the string. But when I was researching the 'urllib' module I couldn't find anything about its sub-section '.read()' ? Is that the ri

Re: module with __call__ defined is not callable?

2006-02-07 Thread limodou
On 2/8/06, adam johnson <[EMAIL PROTECTED]> wrote: > Hi All. > I was wondering why defining a __call__ attribute for a module doesn't make > it actually callable. > > I don't have any reason for doing so, I was just wondering if it worked, and > found out it didn't. > > $ cat mod.py > """ > Test ca

module with __call__ defined is not callable?

2006-02-07 Thread adam johnson
Hi All.I was wondering why defining a __call__ attribute for a module doesn't make it actually callable.I don't have any reason for doing so, I was just wondering if it worked, and found out it didn't.$ cat mod.py"""Test callable module"""def __call__():    return "in mod.__call__">>> import mod>>

UnboundMethodType and MethodType

2006-02-07 Thread Schüle Daniel
Hello all, >>> class Q: ... def bar(self): ... pass ... >>> import types >>> types.UnboundMethodType is types.MethodType True >>> >>> type(Q.bar) >>> >>> q = Q() >>> type(q.bar) >>> >>> type(q.bar) is types.UnboundMethodType True >>> q.bar > >>> I think is not very c

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

2006-02-07 Thread TheSmokingGnu
But the real question is: Will it walk the dog for me? Wipe my bottom after I use the bathroom? Clean my clock? Water the flowers? Cris-cross-cut my potatos? I think not. TheSmokingGnu -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about idioms for clearing a list

2006-02-07 Thread bonono
Tim Hochberg wrote: > [EMAIL PROTECTED] wrote: > > Fredrik Lundh wrote: > > > >>>Python now has, what, three built-in mutable collections types: > >>>lists, dictionaries, and sets. Dicts and sets both have a clear() > >>>method and lists do not. > >> > >>dicts and sets are mappings, and lists are

Re: Question about idioms for clearing a list

2006-02-07 Thread Tim Hochberg
[EMAIL PROTECTED] wrote: > Fredrik Lundh wrote: > >>>Python now has, what, three built-in mutable collections types: >>>lists, dictionaries, and sets. Dicts and sets both have a clear() >>>method and lists do not. >> >>dicts and sets are mappings, and lists are not. mappings don't >>support slici

Re: Hi reliability files, writing,reading and maintaining

2006-02-07 Thread Larry Bates
John Pote wrote: > 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 > i

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

2006-02-07 Thread alex . gman
So why don't you use Windows XP then? It's just like what you are using now, but even more awesome! -- http://mail.python.org/mailman/listinfo/python-list

Re: Using RAW_SOCKETS on win XP SP2

2006-02-07 Thread billie
"Up" :-) -- http://mail.python.org/mailman/listinfo/python-list

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

2006-02-07 Thread usenet
Xah Lee wrote: > usually located in /lib/rgb.txt. on AIX and Linux (SuSE 9.3) the file is in /lib/X11/rgb.txt > neither a continuity in selected color values nor in color names (for > example, darkgray but lightgrey) On AIX and Linux (SuSE 9.3) each color name which contains "gray" is also alias

Re: Question about idioms for clearing a list

2006-02-07 Thread Fredrik Lundh
Steven D'Aprano wrote: > As for the earlier suggestion that it would be obvious if only I'd done > the tutorial, if you need to be taught something it is hardly obvious > is it? Otherwise "obvious" loses all meaning, and we can say any feature, > no matter how obscure, is obvious if only you'd rea

Re: Literal Escaped Octets

2006-02-07 Thread Chason Hayes
On Tue, 07 Feb 2006 15:06:49 +, Bengt Richter wrote: > On Mon, 06 Feb 2006 04:40:31 GMT, Chason Hayes <[EMAIL PROTECTED]> wrote: > >>I am trying to convert raw binary data to data with escaped octets in >>order to store it in a bytea field on postgresql server. I could do this >>easily in c/c

Re: Hi reliability files, writing,reading and maintaining

2006-02-07 Thread Paul Rubin
"John Pote" <[EMAIL PROTECTED]> writes: > 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). It's

Re: Question about idioms for clearing a list

2006-02-07 Thread bonono
Fredrik Lundh wrote: > > Python now has, what, three built-in mutable collections types: > > lists, dictionaries, and sets. Dicts and sets both have a clear() > > method and lists do not. > > dicts and sets are mappings, and lists are not. mappings don't > support slicing. lists do. I am confus

Re: Question about idioms for clearing a list

2006-02-07 Thread bonono
Fredrik Lundh wrote: > > Python now has, what, three built-in mutable collections types: > > lists, dictionaries, and sets. Dicts and sets both have a clear() > > method and lists do not. > > dicts and sets are mappings, and lists are not. mappings don't > support slicing. lists do. I am confus

Re: Python Class use

2006-02-07 Thread Magnus Lycka
Roel Schroeven wrote: > import MyModule > > x = MyModule.MyClass() > x.f() > > Or you could directly import MyClass into the global namespace like this: > > from MyModule import MyClass > > x = MyClass() > x.f() > > But that's not recommended since it clutters the global namespace and > makes

Xah's Edu Corner: Unix damage: color names

2006-02-07 Thread Xah Lee
http://en.wikipedia.org/wiki/X11_color_names excerpt: « In computing, on the X Window System, X11 color names are represented in a simple text file, which maps certain strings to RGB color values. It is shipped with every X11 installation, hence the name, and is usually located in /lib/rgb.txt. I

Re: Too Many if Statements?

2006-02-07 Thread [EMAIL PROTECTED]
slogging_away wrote: > Hmmm - good responses all around. Thank you all for your valued > feedback. > > Perhaps it's too may 'if' statements under the for XXX in range(x,x,x) Have you tried xrange() instead of range()? > statement as most of the 'if' statements appear there. It could be > somet

Re: Too Many if Statements?

2006-02-07 Thread Bryan Olson
Terry Reedy wrote: > "Bryan Olson" wrote: > >>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. > > The OP did not specify whether al

Re: tricky regular expressions

2006-02-07 Thread Ernesto
Petr Jakes wrote: > PS: just wonder why are you asking the same question in two different > topics Thanks for the help Peter. That happened accidentally. I meant to only put that in python topic. Aplogies... -- http://mail.python.org/mailman/listinfo/python-list

Re: Hi reliability files, writing,reading and maintaining

2006-02-07 Thread Xavier Morel
Terry Reedy wrote: > "John Pote" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> I would wish to secure this data gathering against crashes of the OS, > > I have read about people running *nix servers a year or more without > stopping. > He'd probably want to check the various

Re: Hi reliability files, writing,reading and maintaining

2006-02-07 Thread Scott David Daniels
John Pote wrote: > Hello, help/advice appreciated. > 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

Re: Strange behavior with os call in cgi script

2006-02-07 Thread Vinay Sajip
Rene Pijlman wrote: > It struck me as somewhat complicated as well. > > Looking at the basic example: > http://www.python.org/doc/2.3.5/lib/node304.html > > ... the things that first-time users shouldn't be bothered with IMO are: > > 1. Getting a logger by name from a hierarchical namespace. There

Re: Too Many if Statements?

2006-02-07 Thread Alan Morgan
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 numerous checks >>>on text files, (configuratio

RE: Too Many if Statements?

2006-02-07 Thread Delaney, Timothy (Tim)
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??). I'm pretty sure the OP has hit the python script line limit (32767?). Goggle searches haven't turned up the

Re: Question about idioms for clearing a list

2006-02-07 Thread Steven D'Aprano
On Tue, 07 Feb 2006 22:32:40 +0100, Fredrik Lundh wrote: > are you sure you know Python ? Oh my, a little tetchy today aren't we? Obviousness is a subjective matter! It is one thing to say that 9 out of 10 programmers not only discover this technique (by reading the tutorial perhaps) but remembe

Re: Too Many if Statements?

2006-02-07 Thread Terry Reedy
"Bryan Olson" <[EMAIL PROTECTED]> wrote in message news:[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. The OP

Re: Problem with curses and UTF-8

2006-02-07 Thread Martin v. Löwis
Ian Ward wrote: > Any Ideas? I think there is one or more ncurses bugs somewhere. 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. Ultimately, somebody will need to debug ncurs

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

2006-02-07 Thread Martin v. Löwis
Christoph Zwerschke wrote: >> So here is another strategy: flush the stream before going >> into postgres, then obtain the fileno() of the stream, and >> fdopen it with postgres' iostreams library. That might also >> be tricky to implement, but could work. > > > I understand what you mean. But th

Re: Hi reliability files, writing,reading and maintaining

2006-02-07 Thread Terry Reedy
"John Pote" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I would wish to secure this data gathering against crashes of the OS, I have read about people running *nix servers a year or more without stopping. > hardware failures To transparently write to duplicate disks, lookup

Re: Too Many if Statements?

2006-02-07 Thread slogging_away
Hmmm - good responses all around. Thank you all for your valued feedback. Perhaps it's too may 'if' statements under the for XXX in range(x,x,x) statement as most of the 'if' statements appear there. It could be something entirely else. I'm afraid its a bug with Python, (if I try and run it sev

Re: tricky regular expressions

2006-02-07 Thread Petr Jakes
try to google for "finit state machine" OR "state machine" OR FSM titles =["USELESS DATA","Request : Play", "USELESS DATA","Title: Beethoven's 5th", "USELESS DATA","Request : next","USELESS DATA", "Title: song# 2 ","USELESS DATA","Request : Play", "USELESS DATA","Title: Beethoven's 5th", "USELESS

450 Pound Library Program

2006-02-07 Thread mwt
So in a further attempt to learn some Python, I've taken the little Library program (http://groups.google.com/group/comp.lang.python/browse_thread/thread/f6a9ccf1bc136f84) I wrote and added several features to it. Readers now quit when they've read all the books in the Library. Books know how many

Re: Question about idioms for clearing a list

2006-02-07 Thread Ed Singleton
On 07/02/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Ed Singleton wrote > > > I'm not mud-slinging, I'm just saying that people are very dismissive > > of making the language easier to use for newbies. > > no, you're telling people who have long experience in explaining things > to "newbies" tha

Re: tricky regular expressions

2006-02-07 Thread Xavier Morel
Ernesto wrote: > Xavier Morel wrote: >> Ernesto wrote: >>> I'm not sure if I should use RE's or some other mechanism. Thanks >>> >> I think a line-based state machine parser could be a better idea. Much >> simpler to build and debug if not faster to execute. > > What is a line-based state machine

Re: Question about idioms for clearing a list

2006-02-07 Thread Bryan Olson
Fredrik Lundh wrote: > Bryan Olson wrote: > > >>So is consistency; it ain't Perl, thank Guido. > > consistency is the hobgoblin of little minds. Look up that saying. Any clues? >>Python now has, what, three built-in mutable collections types: >>lists, dictionaries, and sets. Dicts and sets bo

Re: Is Python good for web crawlers?

2006-02-07 Thread Tempo
I agree. I think the way that I will learn to use most of it is by going through the source code. -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about idioms for clearing a list

2006-02-07 Thread Fredrik Lundh
Ed Singleton wrote > I'm not mud-slinging, I'm just saying that people are very dismissive > of making the language easier to use for newbies. no, you're telling people who have long experience in explaining things to "newbies" that their experiences don't count, and that you are the only newbie

Re: Question about idioms for clearing a list

2006-02-07 Thread Ed Singleton
On 7 Feb 2006 07:08:17 -0800, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > As a general rule of thumb, I would say that if a person is struggling > > with a language, it is primarily a problem with the language, and than > > problem with the documentation, and lastly a problem with the person.

Re: Question about idioms for clearing a list

2006-02-07 Thread Ed Singleton
On 07/02/06, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > Again we unfortunately have a bit of an attitude problem > > > towards anyone posting here that doesn't know whatever the experts > > > think is obvious. > > > > I agree wholeheartedly with this, particularly as there often seems to > >

Re: Easy way to make Numarray Bool use 1 bit?

2006-02-07 Thread andrewfelch
Ahh, I figured it out. The key is to set up the shapes so they broadcast like an outerproduct, but using bitwise_and as the operation and the second operand as the bit filter. So we temporarily expand each bit to a byte for numarray to be able to use it for dot products. If you use a temporary Bo

Re: Too Many if Statements?

2006-02-07 Thread Bryan Olson
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 numerous checks >>on text files, (configuration files), so discrepancies can be reported. >>The script works fine but it app

Re: Question about idioms for clearing a list

2006-02-07 Thread Ed Singleton
On 07/02/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Bryan Olson wrote: > > > So is consistency; it ain't Perl, thank Guido. > > consistency is the hobgoblin of little minds. > > > Python now has, what, three built-in mutable collections types: > > lists, dictionaries, and sets. Dicts and sets b

Re: tricky regular expressions

2006-02-07 Thread Ernesto
Xavier Morel wrote: > Ernesto wrote: > > I'm not sure if I should use RE's or some other mechanism. Thanks > > > I think a line-based state machine parser could be a better idea. Much > simpler to build and debug if not faster to execute. What is a line-based state machine ? -- http://mail.pyt

Re: Question about idioms for clearing a list

2006-02-07 Thread Aahz
In article <[EMAIL PROTECTED]>, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > >dicts and sets are mappings, and lists are not. mappings don't >support slicing. lists do. > >are you sure you know Python ? Actually, after spending some time thinking about this, I've decided that sets are *not* mappin

Re: tricky regular expressions

2006-02-07 Thread Mitja Trampus
[hint: posting the same question in newsgroups generally does not help to get responses any quicker] Ernesto wrote: > The string I'm getting data from looks like this: > [USELESS DATA] > Request : Play > [USELESS DATA] > Title: Beethoven's 5th > [USELESS DATA] > Request : next > [USELESS

Re: Is Python good for web crawlers?

2006-02-07 Thread Paul Rubin
Xavier Morel <[EMAIL PROTECTED]> writes: > BeautifulSoup... > The API of the package is extremely simple, straightforward and... obvious. I did not find that. I spent a few minutes looking at the documentation and it wasn't obvious at all how to use it. Maybe I could have figured it out with mor

Re: Is Python good for web crawlers?

2006-02-07 Thread Xavier Morel
Paul Rubin wrote: > Generally I use urllib.read() to get > the whole html page as a string, then process it from there. I just > look for the substrings I'm interested in, making no attempt to > actually parse the html into a DOM or anything like that. > BeautifulSoup works *really* well when you

Re: Question about idioms for clearing a list

2006-02-07 Thread Fredrik Lundh
Bryan Olson wrote: > So is consistency; it ain't Perl, thank Guido. consistency is the hobgoblin of little minds. > Python now has, what, three built-in mutable collections types: > lists, dictionaries, and sets. Dicts and sets both have a clear() > method and lists do not. dicts and sets are m

Re: tricky regular expressions

2006-02-07 Thread Xavier Morel
Ernesto wrote: > I'm not sure if I should use RE's or some other mechanism. Thanks > I think a line-based state machine parser could be a better idea. Much simpler to build and debug if not faster to execute. -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about idioms for clearing a list

2006-02-07 Thread Bryan Olson
Fredrik Lundh wrote: > Steven D'Aprano wrote: [...] >>del L[:] works, but unless you are Dutch, it fails the >>obviousness test. > > > unless you read some documentation, that is. del on sequences > and mappings is a pretty fundamental part of Python. so are slicings. So is consistency; it ain

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

2006-02-07 Thread Christoph Zwerschke
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. Hm, that's really inconvenient (even more so under Windows). > In the specific case, having PQprin

Easy way to make Numarray Bool use 1 bit?

2006-02-07 Thread andrewfelch
I need to be able to store thousands of one-million-length bit arrays. The first operations use the & operator. But eventually I must perform an inner product with a one-million-length integer array (summing at all the indices of the integer operand where the boolean operand has a "1"). If I use

Re: Question about idioms for clearing a list

2006-02-07 Thread Tom Anderson
On Tue, 7 Feb 2006, Ben Sizer wrote: > Raymond Hettinger wrote: >> [Steven D'Aprano] The Zen isn't "only one way to do it". If it were, we wouldn't need iterators, list comps or for loops, because they can all be handled with a while loop (at various costs of efficiency, clarit

tricky regular expressions

2006-02-07 Thread Ernesto
So regular expressions have been good to me so far, but now my problem is a bit trickier. The string I'm getting data from looks like this: myString = [USELESS DATA] Request : Play [USELESS DATA] Title: Beethoven's 5th [USELESS DATA] Request : next [USELESS DATA] Title: song #2 . I'm using

tricky regular expressions

2006-02-07 Thread Ernesto
I'm trying to get the right syntax for my regular expression. The string I'm trying to parse is: # myString [USELESS DATA] Request: Play [USELESS DATA] Name: David Dude [USELESS DATA] Request: Next [USELESS DATA] Name: Ernesto Python User # Right now, I'm using the following code: patter

Re: Too Many if Statements?

2006-02-07 Thread Casey Hawthorne
Try the state(s) pattern! "slogging_away" <[EMAIL PROTECTED]> 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 numerous checks >on text files, (configuration files), so discrepancies can be reported. > The scrip

Problem with curses and UTF-8

2006-02-07 Thread Ian Ward
When I run the following code in a terminal with the encoding set to UTF-8 I get garbage on the first line, but the correct output on the second. import curses s = curses.initscr() s.addstr('\xc3\x85 U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE\n') s.addstr('\xc3\xa5 U+00F5 LATIN SMALL LETTER O

Re: Regular Expression Syntax Help

2006-02-07 Thread Ernesto
So now I need to add the requirement that only "Name:" 's which are followed by "Request: Play" or "Request: Next" ANYWHERE between the previous titles and the new titles. Can I use RE's for that ? Ernesto wrote: > I'm trying to get the right syntax for my regular expression. The > string I'm

Re: Python Class use

2006-02-07 Thread Roel Schroeven
S Borg schreef: > Hello, > > I am running Python on Mac OS X. The interpreter has been great for > learning the basics, but I would now like to be able to reuse code. > How do I write reusable code? I have done it "The Java way": write > the class, and save it to my home directory, then call it

QOTW candidate...

2006-02-07 Thread skip
> "Roy" == Roy Smith <[EMAIL PROTECTED]> writes: Roy> There is much about traditional OO which translates well to Python, Roy> but sometimes it is difficult to read a treatise on OO and tell Roy> which bits are "traditional OO" and which are "OO in C++/Java". +1 QOTW... Skip --

Re: Object Oriented vs Pythonic Code, and Pythonic standards

2006-02-07 Thread Bruno Desthuilliers
Carl J. Van Arsdall a écrit : > It seems the more I come to learn about Python as a langauge and the way > its used I've come across several discussions where people discuss how > to do things using an OO model and then how to design software in a more > "Pythonic" way. Well, Python being mostl

Re: Dual Core outlook

2006-02-07 Thread Tom Anderson
On Tue, 7 Feb 2006, malv wrote: > Maybe this is too simplistic, but given two programs, one in Python the > other in Java or C#. Would this mean that running the latter on a dual > core processor would significantly increase execution speed, whereas the > Python program would be running in one

Re: Python Class use

2006-02-07 Thread Fabiano Sidler
Huh? You definitely must import that module. Then, is your homedir listed in sys.path? Greetings, F. Sidler -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Class use

2006-02-07 Thread Roy Smith
S Borg <[EMAIL PROTECTED]> wrote: > I am running Python on Mac OS X. The interpreter has been great for > learning the basics, but I would now like to be able to reuse code. Excellent. Code reuse is what it's all about! > How do I write reusable code? I have done it "The Java way": write > the c

Re: * 'struct-like' list *

2006-02-07 Thread Ernesto
Thanks tons ! -- http://mail.python.org/mailman/listinfo/python-list

Re: Is Python good for web crawlers?

2006-02-07 Thread Paul Rubin
"Tempo" <[EMAIL PROTECTED]> writes: > I was wondering if python is a good language to build a web crawler > with? For example, to construct a program that will routinely search x > amount of sites to check the availability of a product. Or to search > for news articles containing the word 'XYZ'. Th

Jython inherit from Java class

2006-02-07 Thread Mark Fink
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 verbose I think this is b

Python Class use

2006-02-07 Thread S Borg
Hello, I am running Python on Mac OS X. The interpreter has been great for learning the basics, but I would now like to be able to reuse code. How do I write reusable code? I have done it "The Java way": write the class, and save it to my home directory, then call it from the interpreter, here

Re: Thread imbalance

2006-02-07 Thread Tuvas
Adding that bit of code seems to have fixed the problem, thanks alot! -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter: is there a has_focus method or property for a window?

2006-02-07 Thread James Stroud
Harlin Seritt wrote: > I have two windows. One is a main config window. The other is an 'Add > Setting' window. Both are using two different classes. > > Once the Add Setting button is clicked on the Add Setting window, the > setting is written to file. At that time the main config window should >

Re: The problem of anonymity with decorators

2006-02-07 Thread skip
Franck> My problem is that the errors comes from a function named Franck> "wrapped" while I'd prefer to see here the name of the wrapped Franck> function. Take a look at http://wiki.python.org/moin/PythonDecoratorLibrary In particular, check out the Decorator decorator. Skip --

  1   2   3   >