ANN: Python Test Environment

2004-12-15 Thread Michael Foord
Well sort of... Highly experimental - I'm interested in ways of improving this. http://www.voidspace.org.uk/atlantibots/pythonutils.html#testenv I've created a script that will build a 'test environment'. Windoze(tm) only as it uses py2exe. It scans your Python\Lib folder (configurable)

Re: lies about OOP

2004-12-15 Thread Fredrik Lundh
Mike Meyer wrote: If OOP is so beneficial for large projects, why are the Linux kernel, the interpreters for Perl and Python, and most compilers I know written in C rather than C++? Because C++ combines the worst features of C and OO programming. It also makes some defaults go the wrong

Re: thread/queue bug

2004-12-15 Thread Antoon Pardon
Op 2004-12-14, Steve Holden schreef [EMAIL PROTECTED]: Antoon Pardon wrote: Op 2004-12-13, Tim Peters schreef [EMAIL PROTECTED]: [Antoon Pardon] I don't see why starting a thread as a side effect of importing is bad thread practice. Sure python doesn't cater for it, but IMO that seems to be

Re: RegEx: find all occurances of a single character in a string

2004-12-15 Thread Franz Steinhaeusler
On Tue, 14 Dec 2004 14:05:38 +0100, Franz Steinhaeusler [EMAIL PROTECTED] wrote: given a string: st=abcdatraataza ^ ^ ^ ^ (these should be found) I want to get the positions of all single 'a' characters. (Without another 'a' neighbour) [...] Thank you again, Pádraig and Steve, your

Re: Help need with converting Hex string to IEEE format float

2004-12-15 Thread TZOTZIOY
On Tue, 14 Dec 2004 16:57:02 +0100, rumours say that Fredrik Lundh [EMAIL PROTECTED] might have written: how about: # convert to byte string import struct s = .join([chr(int(c, 16)) for c in x]) v = struct.unpack(!f, s) I think that the third line in the snippet above could also

Re: lies about OOP

2004-12-15 Thread Gerrit
binL9yPfo4Fv5.bin Description: application/pgp-encrypted msg.asc Description: Binary data -- http://mail.python.org/mailman/listinfo/python-list

Re: while 1 vs while True

2004-12-15 Thread Nick Coghlan
Paul Rubin wrote: Nick Coghlan [EMAIL PROTECTED] writes: Until this code: . import pdb . pdb.True = 0 . pdb.x = Darn writeable module dictionaries . from pdb import True . True 0 . from pdb import x . x 'Darn writeable module dictionaries' If Python really does behave that way, that bug should be

Re: logging in omniORB for python

2004-12-15 Thread f
Birgit Rahm wrote: Hello newsgroup, Hello Birgit, I haven't found any way to do logging in a standard way. The solution i've implemented is to decorate each method you want to log the call, using the logging module (included in python since 2.3) For example : import logging def

Re: Why are tuples immutable?

2004-12-15 Thread Antoon Pardon
Op 2004-12-13, Fredrik Lundh schreef [EMAIL PROTECTED]: jfj wrote: Why can't we __setitem__ for tuples? http://www.python.org/doc/faq/general.html#why-are-there-separate-tuple-and-list-data-types The way I see it is that if we enable __setitem__ for tuples there doesn't seem to be any

Re: RegEx: find all occurances of a single character in a string

2004-12-15 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: r=re.compile(a+) [m.start() for m in r.finditer(s) if len(m.group()) == 1] Mine runs 100K iterations of 'abcdatraataza','a' in 1.4s whereas Fredrik's does the same in 1.9s sure, but how long did it take you to come up with a working RE? and how many casual RE users

Re: Why are tuples immutable?

2004-12-15 Thread Fuzzyman
Wasn't part of the point, that function call returns ought to be immuntable. Otherwise you can accidentally end up modifying objects that are referenced in other places ? Obviously tuples aren't the *whole* answer... but they help. Regards, Fuzzy

Re: lies about OOP

2004-12-15 Thread Martijn Faassen
Paul McGuire wrote: Martijn Faassen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Paul McGuire wrote: [snip] I would characterize the 80's as the transitional decade from structured programming (which really started to hit its stride when Djikstra published Use of GOTO Considered

Re: Why are tuples immutable?

2004-12-15 Thread Fredrik Lundh
Antoon Pardon wrote: how would you implement a dictionary where the keys could change, without any performance penalty compared to the current implementation? The performace gained by using tuples as keys in dictionaries is entirely illusional. Sure the fact that you use a tuple which is

Re: do you master list comprehensions?

2004-12-15 Thread Nick Coghlan
Will Stuyvesant wrote: Here is a question about list comprehensions [lc]. The question is dumb because I can do without [lc]; but I am posing the question because I am curious. This: data = [['foo','bar','baz'],['my','your'],['holy','grail']] result = [] for d in data: ... for w in d: ...

Re: jython and concatenation of strings

2004-12-15 Thread Nick Coghlan
Jan Gregor wrote: StringBuffer class from java was right solution - yours looses encoding, and in jython I was unable to get it back - in python it worked fine. If you mean that Jython returned a string, when the inputs were unicode, then that can probably be fixed with: result =

Step by step: Compiling extensions with MS Visual C++ Toolkit 2003 - msvccompiler-patch.txt (0/1)

2004-12-15 Thread Martin Bless
The good news: Along with Python-2.4 comes really good news to Windows users. Yes, you now CAN build extension modules yourself using the SAME C++ compiler and linker Python is built with itself. Everything you need is available at no costs (except download hassle and installation time). Once

Re: Why are tuples immutable?

2004-12-15 Thread Antoon Pardon
Op 2004-12-15, Fredrik Lundh schreef [EMAIL PROTECTED]: Antoon Pardon wrote: how would you implement a dictionary where the keys could change, without any performance penalty compared to the current implementation? The performace gained by using tuples as keys in dictionaries is entirely

KeyError

2004-12-15 Thread rootshell
Hello. Maybe someone will help me with this KeyError: Traceback (most recent call last): File C:\Python\tabla.py, line 929, in -toplevel- tablesDirectory = tablesDirectoryPrefix + os.environ['REMOTE_ADDR'] File C:\Python23\lib\os.py, line 417, in __getitem__

Re: subprocess vs. proctools

2004-12-15 Thread Nick Craig-Wood
Keith Dart [EMAIL PROTECTED] wrote: Nick Craig-Wood wrote: This sounds rather like the new subprocess module... import subprocess rc = subprocess.call([ls, -l]) total 381896 -rw-r--r--1 ncw ncw 1542 Oct 12 17:55 1 [snip] -rw-r--r--1 ncw ncw 713 Nov 16 08:18

Re: KeyError

2004-12-15 Thread Frans Englich
On Wednesday 15 December 2004 13:33, [EMAIL PROTECTED] wrote: Hello. Maybe someone will help me with this KeyError: Traceback (most recent call last): File C:\Python\tabla.py, line 929, in -toplevel- tablesDirectory = tablesDirectoryPrefix +

Re: Import trouble

2004-12-15 Thread Craig Ringer
On Wed, 2004-12-15 at 21:45, Frans Englich wrote: 2) I use Python modules which are not usually installed(libxml2/libxslt) and want to fail gracefully in case the modules aren't available; print an informative message. Since these imports are done in several related programs, I don't want

Re: Import trouble

2004-12-15 Thread Craig Ringer
On Wed, 2004-12-15 at 21:44, Craig Ringer wrote: def import_xml: try: import libxml except ImportError,err: # handle the error return libxml libxml = import_xml() Though my personal approach would actually be: try: import libxml except ImportError,err:

Re: Import trouble

2004-12-15 Thread Frans Englich
On Wednesday 15 December 2004 13:44, Craig Ringer wrote: On Wed, 2004-12-15 at 21:45, Frans Englich wrote: 2) I use Python modules which are not usually installed(libxml2/libxslt) and want to fail gracefully in case the modules aren't available; print an informative message. Since these

Re: Python IDE

2004-12-15 Thread Chris
Try WingIDE if you have some money (about 35 E/$ for the personal version) to spend, it's worth every (euro)cent. But please try SPE first, maybe that's enough for you. SPE? Chris -- http://mail.python.org/mailman/listinfo/python-list

Import trouble

2004-12-15 Thread Frans Englich
Hello all, I have a couple of questions related to module importing. 1) When I start my Python program with `python foo.py` instead of simply adding a interpreter comment on the first line and do `./foo.py`, some local imports fails, I guess because current working directory is different. Is

Re: getopt: Make argument mandatory

2004-12-15 Thread Fredrik Lundh
Frans Englich wrote: In my use of getopt.getopt, I would like to make a certain parameter mandatory. but you just did: if configurationFile == : print You must pass an URL/path to a configuration file, see --help. sys.exit(common.exitCodes[parameter]) Is it

Re: Why are tuples immutable?

2004-12-15 Thread Roel Schroeven
Antoon Pardon wrote: Op 2004-12-15, Fredrik Lundh schreef [EMAIL PROTECTED]: sorry, but I don't understand your reply at all. are you saying that dictionaries could support mutable keys (e.g lists) by making a copy of the key? how would such a dictionary pick up changes to the original key

Re: gather information from various files efficiently

2004-12-15 Thread Paul McGuire
Klaus Neuner [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I need to gather information that is contained in various files. Like so: file1: = foo : 1 2 bar : 2 4 baz : 3 = file2: = foo : 5 bar : 6 baz

RE: Import trouble

2004-12-15 Thread Doran_Dermot
Hi Craig, How about creating your own module that does this in __init__.py. You could create a directory (Eg craig_init) and in that directory create the file __init__.py containing the following code: try: import libxml except: # Blah, blah, blah. A clever bit of code goes here! WARNING:

Re: Small Problem P 2.4 (line2048 Bytes)

2004-12-15 Thread Walter Dörwald
[...] After search, I had found that the problem come from a long line (more than 2048 caracters), with begin : mappingcharmaj = { chr(97):'A', chr(98):'B', chr(99):'C', ... And, if I break in multiples lines, the problem is solved. This sounds like bug

Re: flex/bison like module in Python?

2004-12-15 Thread Fredrik Lundh
Jerry Sievers wrote: Curious if there exists in Python package(s) for use as lexer/parser for implementation of language grammars? (s) indeed: http://www.nedbatchelder.com/text/python-parsers.html /F -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Python Test Environment

2004-12-15 Thread Fuzzyman
Sorry they're not reaching google groups, which is what I'm posting from. From http://groups-beta.google.com/group/comp.lang.python posts usually show up within a few minutes. The thing is, when I posted by email it showed up in seconds... Anyway - sorry about that and thanks for

Re: Why are tuples immutable?

2004-12-15 Thread Antoon Pardon
Op 2004-12-15, Roel Schroeven schreef [EMAIL PROTECTED]: Antoon Pardon wrote: Op 2004-12-15, Fredrik Lundh schreef [EMAIL PROTECTED]: sorry, but I don't understand your reply at all. are you saying that dictionaries could support mutable keys (e.g lists) by making a copy of the key? how

Re: Why are tuples immutable?

2004-12-15 Thread Jp Calderone
On Wed, 15 Dec 2004 14:18:21 GMT, Roel Schroeven [EMAIL PROTECTED] wrote: Antoon Pardon wrote: Op 2004-12-15, Fredrik Lundh schreef [EMAIL PROTECTED]: sorry, but I don't understand your reply at all. are you saying that dictionaries could support mutable keys (e.g lists) by making a copy

Re: Help need with converting Hex string to IEEE format float

2004-12-15 Thread Peter Hansen
Christos TZOTZIOY Georgiou wrote: s = .join(x).decode(hex) I am not sure I remember in which version of Python the hex codec was added, but it is handy. Of course, binascii could do this since 2.0 or so, but not having to import another module *is* nice: 'ff12'.decode('hex') '\xff\x12' import

Efficient grep using Python?

2004-12-15 Thread sf
Just started thinking about learning python. Is there any place where I can get some free examples, especially for following kind of problem ( it must be trivial for those using python) I have files A, and B each containing say 100,000 lines (each line=one string without any space) I want to do

Data problem

2004-12-15 Thread Jeffrey Maitland
Hello all, I am using the MySQLdb module and I am writing to a MySQL database. My write statement is something like. cursor.execute(INSERT INTO Data(Name, X, Y, Z, Data) VALUES('%s', '%s', '%s', '%f', '%f', '%f', '%s') % (name, high_x, high_y, high_z, data)) I can write the

Re: Why are tuples immutable?

2004-12-15 Thread Steve Holden
Antoon Pardon wrote: Op 2004-12-15, Roel Schroeven schreef [EMAIL PROTECTED]: Antoon Pardon wrote: Op 2004-12-15, Fredrik Lundh schreef [EMAIL PROTECTED]: sorry, but I don't understand your reply at all. are you saying that dictionaries could support mutable keys (e.g lists) by making a copy of

Re: while 1 vs while True

2004-12-15 Thread Peter Hansen
Paul Rubin wrote: Nick Coghlan [EMAIL PROTECTED] writes: Until this code: . import pdb . pdb.True = 0 . pdb.x = Darn writeable module dictionaries . from pdb import True . True 0 . from pdb import x . x 'Darn writeable module dictionaries' If Python really does behave that way, that bug should be

Re: Efficient grep using Python?

2004-12-15 Thread Tim Peters
[sf [EMAIL PROTECTED]] I have files A, and B each containing say 100,000 lines (each line=one string without any space) I want to do A - (A intersection B) Essentially, want to do efficient grep, i..e from A remove those lines which are also present in file B. [Fredrik Lundh]

Re: Flow based programming python coding style

2004-12-15 Thread Carlos Ribeiro
On Wed, 15 Dec 2004 15:16:44 GMT, Jp Calderone [EMAIL PROTECTED] wrote: On Wed, 15 Dec 2004 12:30:07 -0200, Carlos Ribeiro [EMAIL PROTECTED] wrote: Hi, A friend of mine passed me some links about a great concept (not new in fact, only new to me): --

Re: Fill a Server

2004-12-15 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: Also, my first attempt at this did a recursive copy creating subdirs in dirs as it copied. It would crash everytime it went 85 subdirs deep. This is an NTFS filesystem. Would this limitation be in the filesystem or Python? see the Max File Name Length on this page

Re: Fill a Server

2004-12-15 Thread Fredrik Lundh
Also, my first attempt at this did a recursive copy creating subdirs in dirs as it copied. It would crash everytime it went 85 subdirs deep. This is an NTFS filesystem. Would this limitation be in the filesystem or Python? see the Max File Name Length on this page (random google link) for

Re: Fill a Server

2004-12-15 Thread Peter Hansen
[EMAIL PROTECTED] wrote: [snip code involving copyfile:] shutil.copyfile(os.path.join(root, f), The problem with this is that it only copies about 35 GB/hour. I would like to copy at least 100 GB/hour... more if possible. I have tried to copy from the IDE CD drive to the SATA array with the same

Re: Fill a Server

2004-12-15 Thread [EMAIL PROTECTED]
You are correct Peter, the exception read something like this: Folder 85 not found. I am paraphrasing, but that is the crux of the error. It takes about an hour to produce the error so if you want an exact quote from the exception, let me know and give me awhile. I looked through the nested dirs

Multithreading tkinter question

2004-12-15 Thread Mark English
Is there a safe way to run tkinter in a multithreaded app where the mainloop runs in a background thread ? Here's some test code demonstrating the problem. I'm running Python2.4 under Windows 2000. Code snip starts- from Tkinter import * def GetTkinterThread():

change windows system path from cygwin python?

2004-12-15 Thread gry
[Windows XP Pro, cygwin python 2.4, *nix hacker, windows newbie] I want to write some kind of install script for my python app that will add c:\cygwin\usr\bin to the system path. I don't want to walk around to 50 PC's and twiddle through the GUI to: My Computer -- Control Panel -- System --

Re: getopt: Make argument mandatory

2004-12-15 Thread Frans Englich
On Wednesday 15 December 2004 20:12, Marc 'BlackJack' Rintsch wrote: In [EMAIL PROTECTED], Frans Englich wrote: Hello, In my use of getopt.getopt, I would like to make a certain parameter mandatory. Isn't a *mandatory option* a contradiction? Why don't you turn it into an argument?

A beginner's problem...

2004-12-15 Thread Amir Dekel
Hello everyone, First, I have to say that Python is one of the coolest programing languages I have seen. And now for the problem (must be a silly one): When I import a module I have wrote, and then I find bugs, it seems that I can't import it again after a fix it. It always shows the same

Module question

2004-12-15 Thread Bill Turczyn
Does python have a module similiar to the perl Spreadsheet::WriteExcel Thanks, Bill -- http://mail.python.org/mailman/listinfo/python-list

Re: A beginner's problem...

2004-12-15 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Amir Dekel wrote: When I import a module I have wrote, and then I find bugs, it seems that I can't import it again after a fix it. It always shows the same problem. I try del module but it doesn't work. (I use Python 2.4 with the ActivePython pack (PythonWin IDE)

Re: New versions breaking extensions, etc.

2004-12-15 Thread David Bolen
Martin v. Löwis [EMAIL PROTECTED] writes: Can you elaborate? To me, that problem only originates from the OS lack of support for deleting open files. If you could delete a shared libary that is still in use (as you can on Unix), the put the new version of the DLL in the place, (...) Note

Re: Step by step: Compiling extensions with MS Visual C++ Toolkit 2003 - msvccompiler-patch.txt (0/1)

2004-12-15 Thread Mike C. Fletcher
Martin Bless wrote: ... Two things first - not to forget: (1) In contrast to what Mike writes I had to use a different registry key (see step 9) Which is expected (even noted on the page), particularly if you have a different version of the SDKs. The keys in the patch were extracted from an

Re: while 1 vs while True

2004-12-15 Thread Terry Reedy
import pdb pdb.x = Darn writeable module dictionaries from pdb import x x 'Darn writeable module dictionaries' If Python really does behave that way, that bug should be fixed immediately. The fact that the attributes of Python modules, like those of classes (and functions and

Re: NO REALLY

2004-12-15 Thread Martijn Faassen
Jive wrote: Isn't there a comp.lang.flame or something? I've doublechecked, but I didn't see any significant flaming in this article (and I'm generally not very tolerant of it). My PSU posting was certainly not intended as a flame, in case that was misinterpreted. What'd I miss? Regards,

Re: from string to raw string

2004-12-15 Thread Scott David Daniels
Dan Perl wrote: Is there a way to convert a regular string to a raw string so that one could get from '\bblah' to r'\bblah' other than parsing the string and modifying the escapes? Assuming you might mean something else, that something else might be: s = r'no_tab_\t_here' len(s.split()) ==

Re: lies about OOP

2004-12-15 Thread Peter Hansen
Martijn Faassen wrote: Peter Hansen wrote: Well, in any case, thanks for setting the record straight, Martjin. That of course also happens to me once every while. I can take care of myself though -- Dijkstra however needs an advocate for the correct spelling of his name in this earthly realm.

Dejavu 1.2.6, a Python ORM

2004-12-15 Thread Robert Brewer
The Dejavu Object-Relational Mapper (version 1.2.6) is now available and in the public domain. Get it at svn://casadeamor.com/dejavu/trunk. Dejavu is an Object-Relational Mapper for Python applications. It is designed to provide the Model third of an MVC application. Dejavu avoids making

Re: How do I convert characters into integers?

2004-12-15 Thread Scott David Daniels
Markus Zeindl wrote: Hello, I want to write a simple encrypter, but I've got a problem: How can I convert characters into integers? Check this out, you'll like it even more than ord/chr: import array def mangle(message): a = array.array('B') a.fromstring(message)

Re: A beginner's problem...

2004-12-15 Thread DogWalker
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] said: In [EMAIL PROTECTED], Amir Dekel wrote: When I import a module I have wrote, and then I find bugs, it seems that I can't import it again after a fix it. It always shows the same problem. I try del module but it doesn't work. (I use Python

Re: Is Python good for graphics?

2004-12-15 Thread Esmail Bonakdarian
Fredrik Lundh wrote: how about: http://vpython.org/ hi, thanks, I didn't know about that. do you (or anyone else) have a recommendation for 2D type graphics? Thanks, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Unpacking Binary Data - not using struct module

2004-12-15 Thread Geoffrey
I am working on a file conversion project that reads data from a one file format, reformats in and writes in out to another. The data is records of informations - names address, account number,statistics. The numeric values in the original file are stored in what appears to be a packed data

Re: NO REALLY

2004-12-15 Thread Peter Hansen
Brian van den Broek wrote: Peter Hansen said unto the world upon 2004-12-15 17:39: I could easily see this thread descending into a flame war in, oh, about another ten posts. That would be so freaky... Without a doubt that is the most ignorant and small-minded thought that ever has been, and

spawn* or exec* and fork, what should I use and how ?

2004-12-15 Thread Lingyun Yang
Hi, I want to use python as a shell like program, and execute an external program in it( such as mv, cp, tar, gnuplot) I tried: os.execv(/bin/bash,(/usr/bin/gnuplot,'-c gnuplot plot.tmp')) since it's in a for-loop, it should be executed many times, but It exits after the first time running. so

Re: spawn* or exec* and fork, what should I use and how ?

2004-12-15 Thread Binu K S
exec calls will replace the script process with the new process. From the execv documentation: These functions all execute a new program, replacing the current process; they do not return. On Unix, the new executable is loaded into the current process, and will have the same process ID as the

Re: spawn* or exec* and fork, what should I use and how ?

2004-12-15 Thread Lingyun Yang
Peter Hansen wrote: Lingyun Yang wrote: I want to use python as a shell like program, and execute an external program in it( such as mv, cp, tar, gnuplot) os.execv(/bin/bash,(/usr/bin/gnuplot,'-c gnuplot plot.tmp')) I would suggest checking out the subprocess module, new in Python 2.4. It

Re: ftp

2004-12-15 Thread Binu K S
Try retrbinary instead of retrlines in the original script (the one without write('\n')). retrlines fetches the file in ASCII mode and that must be altering the line terminations. On 15 Dec 2004 15:49:31 -0800, hawkmoon269 [EMAIL PROTECTED] wrote: I would like to write a small ftp script that I

Re: from string to raw string

2004-12-15 Thread Dan Perl
This is not what I meant. My posting was a judgement error. You are right though that my intuition was leading me to something like this. However, I didn't realize that it was not necessary for what I was doing. But this is very educational too. It made me look up string decode, encode,

Re: lies about OOP

2004-12-15 Thread Andrew Dalke
Peter Hansen: (Darn those Norwegians, influencing people's ideas of how a name like Hansen ought to be spelled, grumble, grumble. And then there's my sister, a Nelson, who drove with friends of their's, the Olsons, to visit our aunt and uncle, the Larsons, and my grandmother, born a Hanson.

Re: Performance (pystone) of python 2.4 lower then python 2.3 ???

2004-12-15 Thread Dan
Skip Montanaro wrote: Dan I also see an 8-10% speed decrease in 2.4 (I built) from 2.3.3 Dan (shipped w/Fedora2) in the program I'm writing (best of 3 trials Dan each). Memory use seems to be about the same. How do you how the compiler flags were the same if you didn't compile both

Re: Zope side-by-side with Python 2.4

2004-12-15 Thread Terry Hancock
On Friday 03 December 2004 02:04 pm, Robert wrote: If I have Python 2.4 installed and I want to install the latest stable Zope, will Zope have problems or does Zope looks to its own setup and not my install of Python 2.4? The latest version of Zope (2.7 or later) runs fine with Python 2.3 and

Re: Is Python good for graphics?

2004-12-15 Thread Robert Kern
Esmail Bonakdarian wrote: Fredrik Lundh wrote: how about: http://vpython.org/ hi, thanks, I didn't know about that. do you (or anyone else) have a recommendation for 2D type graphics? I like Kiva (but then, I also help develop it). The best place to get it right now is the SVN repository,

Re: NO REALLY

2004-12-15 Thread Eric Pederson
Jive [EMAIL PROTECTED] taunted: Subject: NO REALLY Isn't there a comp.lang.flame or something? Oh, my, don't you have BIG CAPS! Someone should wash them, thoroughly! Why don't you come up to my room, big boy. -DIRK [is that flaming enough?] --

Re: How do I convert characters into integers?

2004-12-15 Thread Adam DePrince
On Tue, 2004-12-14 at 18:18, Paul Rubin wrote: Markus Zeindl [EMAIL PROTECTED] writes: Now I get every character with a loop: code buffer = for i in range(len(message)): ch = message[i-1:i] You mean ch = message[i] what you have does the wrong thing when i = 0. Here is

Re: Why are tuples immutable?

2004-12-15 Thread Adam DePrince
On Mon, 2004-12-13 at 17:23, jfj wrote: Yo. Why can't we __setitem__ for tuples? The way I see it is that if we enable __setitem__ for tuples there doesn't seem to be any performance penalty if the users don't use it (aka, python performance independent of tuple mutability). On the

Re: lies about OOP

2004-12-15 Thread Adam DePrince
On Tue, 2004-12-14 at 18:27, Roy Smith wrote: Terry Reedy [EMAIL PROTECTED] wrote: I did not really 'get' OOP until after learning Python. The relatively simple but powerful user class model made more sense to me than C++. So introducing someone to Python, where OOP is a choice, not a

Re: Efficient grep using Python?

2004-12-15 Thread Tim Peters
[Jane Austine] fromkeys(open(f).readlines()) and fromkeys(open(f)) seem to be equivalent. Semantically, yes; pragmatically, no, in the way explained before. When I pass an iterator instance(or a generator iterator) to the dict.fromkeys, it is expanded at that moment, I don't know what

Re: Html or Pdf to Rtf (Linux) with Python

2004-12-15 Thread Chas Emerick
I haven't seen any solid responses come across the wire, and I suspect there isn't a product or package that will do exactly what you want. blatent_self_promotion However, our company's product, PDFTextStream does do a phenomenal job of extracting text and metadata out of PDF documents. It's

Re: Python mascot proposal

2004-12-15 Thread Terry Hancock
In reply to the OP, I think the snake mascot drawing is cute and pretty compelling. On Sunday 12 December 2004 05:49 pm, Luis M. Gonzalez wrote: 1) I think that Python's logo should reflect its power. If we use a mascot as its image, we would be giving the wrong idea: that Python is a toy

Python compiler method

2004-12-15 Thread Lady_Valerie
hello guys! i just want to ask favor, coz i want to know how python compiler method could be done? im really clueless of this programming language hope anyone coule help me with this topic... im just focusing only on the compiler of the python.thanks a lot!!! lady valerie --

Re: Python vs. Perl

2004-12-15 Thread Dan
I'm inexperienced in both languages, and am toying around with both now, so I offer these comments with warnings of the blind leading the blind. As far as regular expressions go I can't offer much information. They both meet my needs. I prefer the Python syntax, however: it is possible in both

RE: Python compiler method

2004-12-15 Thread Delaney, Timothy C (Timothy)
Lady_Valerie wrote: hello guys! i just want to ask favor, coz i want to know how python compiler method could be done? im really clueless of this programming language hope anyone coule help me with this topic... im just focusing only on the compiler of the python.thanks a lot!!! This should

Re: Is Python good for graphics?

2004-12-15 Thread Doug Holton
Esmail Bonakdarian wrote: First of all, I *really* like Python ;-) I need some help with the graphical side of things. I would like to do some basic graphics with Python, but I am not sure what the best/most effective way for me to do what I want. Basically, I would like to be able to create some

Re: lies about OOP

2004-12-15 Thread Dave Benjamin
In article [EMAIL PROTECTED], Adam DePrince wrote: On Tue, 2004-12-14 at 18:27, Roy Smith wrote: Terry Reedy [EMAIL PROTECTED] wrote: I did not really 'get' OOP until after learning Python. The relatively simple but powerful user class model made more sense to me than C++. So introducing

libxml2/xpath

2004-12-15 Thread Maxim Khesin
I am trying to do some xpath on http://fluidobjects.com/doc.xhtml but cannot get past 'point A' (that is, I am totally stuck): import libxml2 mydoc = libxml2.parseDoc(text) mydoc.xpathEval('/html') [] this returns an empty resultlist, which just seems plain wrong. Can anyone throw a

Re: Html or Pdf to Rtf (Linux) with Python

2004-12-15 Thread Axel Straschil
Hallo! However, our company's product, PDFTextStream does do a phenomenal job of extracting text and metadata out of PDF documents. It's crazy-fast, has a clean API, and in general gets the job done very nicely. It presents two points of compromise from your idea situation: 1. It only

Re: Python IDE

2004-12-15 Thread dataangel
fuzzylollipop wrote: TruStudio for Eclipse is nice for those everything must be free socialists. ActiveState Komodo is probably the best commerical Python IDE and the ActiveState Python plugin for Visual Studio is great for those that do VS. It's also great for those college students looking to

Re: Regular Expression

2004-12-15 Thread Fredrik Lundh
Michael McGarry wrote: I am horrible with Regular Expressions, can anyone recommend a book on it? Also I am trying to parse the following string to extract the number after load average. load average: 0.04, 0.02, 0.01 how can I extract this number with RE or otherwise? others have

Small Problem P 2.4 (line2048 Bytes)

2004-12-15 Thread Michel Claveau - abstraction méta-galactique non triviale en fuite perpétuelle.
Hi, all ! I have un python script of 75 kB, who make a COM server. It's run OK with Python 2.3 + PyWin + P.I.L. But, with Python 2.4, I obtain a windows error (sorry, it's in french) : python.exe a rencontrée un problème, et doit fermer. erreur sur module: ntdll.dll

Re: PyQt on MAC OS X

2004-12-15 Thread Ronald Oussoren
On 14-dec-04, at 0:42, Michael McGarry wrote: Kevin, thanks that did the trick!!! One problem is my Window created in Qt appears underneath all others on the screen and focus never goes completely onto this window. Kind of weird. Any ideas? Did you use pythonw to start your script? If you use

Re: lies about OOP

2004-12-15 Thread Gregor Horvath
Daniel T. wrote: [EMAIL PROTECTED] wrote: A paper finding that OOP can lead to more buggy software is at http://www.leshatton.org/IEEE_Soft_98a.html Sure, OOP *can* lead to more buggy software, that doesn't mean it always does. I think that costs(=time) to develop and maintain software depends

xmlrpclib with technorati

2004-12-15 Thread Alan Little
I'm trying to write a generic weblog update notifier using xmlrpclib, starting with technorati. What I want to do is something like this : XML config file that would look like this: server url=http//whatever,technorati.org methodname=technoratiMethod param sequence=1 source=myAttrib1 /

Re: PEP 338: Executing modules inside packages with '-m'

2004-12-15 Thread Nick Coghlan
Martin Bless wrote: [Nick Coghlan [EMAIL PROTECTED]] One thing I stumbled across with the current implementation: Why doesn't python -m abc work with ./abc/ ./abc/__init__.py assuming ./abc/ is directly on the path? In analogy to normal module import? It doesn't work because abc is a package,

Re: save an opengl canvas (wxPython)

2004-12-15 Thread Zunbeltz Izaola
Mike C. Fletcher [EMAIL PROTECTED] writes: There's sample code in PyOpenGL and OpenGLContext for saving canvases to PNG or JPEG formats using PIL. Saving to Postscript requires considerably more work (if you're implying saving as triangles, lines and the like). There is a GPL library which

Re: logging in omniORB for python

2004-12-15 Thread Diez B. Roggisch
Does anyone know, were the log data is? And how I can store it in a file? By the way I ask also the omniORB mailing list, but here are the python experts. it gets written to stdout - and then looks like this: omniORB: ObjRef(IDL:ehotel.de/omphalos/Domain:1.0) -- deleted. omniORB:

Re: jython and concatenation of strings

2004-12-15 Thread Jan Gregor
StringBuffer class from java was right solution - yours looses encoding, and in jython I was unable to get it back - in python it worked fine. Jan I don't use Jython, but are you not able to do something like: string_list = [] for ... in ...: ... string_list.append(...) ...

Re: Suggestion for syntax error: ++i, --i

2004-12-15 Thread Nick Craig-Wood
Richard Brodie [EMAIL PROTECTED] wrote: Terry Reedy [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] You could propose to the author of Pychecker that he include, if possible, an option to check for and warn about '++', '--'. It does already. $ cat plusplus.py def

Re: lies about OOP

2004-12-15 Thread Ilja Preuß
Daniel T. wrote: Mr. Hatton suffers from the same problem that many OO critics suffer. He thinks that the language choice decides whether the program written is an OO program. I've seen plenty of very non-OO systems written in OO languages, I've seen expert OO systems written in non-OO

Re: Regular Expression

2004-12-15 Thread Roy Smith
Michael McGarry [EMAIL PROTECTED] wrote: I am horrible with Regular Expressions, can anyone recommend a book on it? I just did a search on the Barnes Noble site for regular expression and came up with a bunch of books. The following looks reasonable:

Flow based programming python coding style

2004-12-15 Thread Carlos Ribeiro
Hi, A friend of mine passed me some links about a great concept (not new in fact, only new to me): -- http://www.jpaulmorrison.com/fbp/ -- http://c2.com/cgi/wiki?FlowBasedProgramming I found many of the explanations and examples strangely familiar. The C2 Wiki contains a good discussion that

  1   2   >