From clpy at snakefarm.org Mon Dec 3 08:39:51 2001 From: clpy at snakefarm.org (Carsten Gaebler) Date: Mon, 03 Dec 2001 14:39:51 +0100 Subject: xmlrpc tutorial? References: <3C063569.8230ADD0@snakefarm.org> <3C07961D.9A7970FA@snakefarm.org> <3C07B7A3.2A6443C9@snakefarm.org> Message-ID: <3C0B80A7.2D810618@snakefarm.org> Stephen Coursen wrote: > Ah ha, the problem is due to how you're using TCPServer. Try: > > SocketServer.TCPServer.reuse_address = 1 > server = SocketServer.TCPServer( ('', 8000), TestRequestHandler ) > server.serve_forever( ) Skip Montanaro wrote: > In my server I override the server_bind method like so: > > def server_bind(self): > self.socket.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1) > self.socket.bind(self.server_address) Thanks for your suggestions, but none of these work. Could it be I'm doing something terribly wrong? At least I could reduce the problem: If I start the server and immediately shut it down via Ctrl-C, the address can be reused. If I shut it down after it has served at least one request, it says it cannot reuse the address, the socket is in state TIME_WAIT then. This is the code I use to make a request: import xmlrpclib remote = xmlrpclib.Server("http://localhost:8000") remote.do_something_nasty() cg. From mhammond at skippinet.com.au Thu Dec 27 18:16:15 2001 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 27 Dec 2001 23:16:15 GMT Subject: REPOST: Re: Fate of win32all? References: <7876a8ea.0112212116.2ebabc23@posting.google.com> Message-ID: <7$--$$_----_-$-_%$@news.noc.cabal.int> Thanks to everyone who replied to this thread - I really appreciate the supportive words. I am very sure I will land on my feet, so there is no need to worry (now if someone would just tell that to my girlfriend :) I will be here for the forseeable future, so please don't write eulogies for any Python related work I am involved in ;) FWIW, it is this very community spirit that makes Python such a pleasure to be involved in - so that yourselves as much as me - if not for this spirit I would not have been here in the first place! Thanks all! Now-back-to-a-win32all-release ly, Mark. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Mark Hammond Newsgroups: comp.lang.python Subject: cmsg cancel <3C2BABD5.1070907 at skippinet.com.au> Control: cancel <3C2BABD5.1070907 at skippinet.com.au> Date: Mon, 31 Dec 2001 02:47:09 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775513 27193 211.57.49.2 (31 Dec 2001 05:11:53 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:11:53 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From johnroth at ameritech.net Mon Dec 10 13:35:12 2001 From: johnroth at ameritech.net (John Roth) Date: Mon, 10 Dec 2001 10:35:12 -0800 Subject: A common GUI define like rebol VID? References: <9v12k6$ak9$1@mail.cn99.com> Message-ID: "luckey" wrote in message news:9v12k6$ak9$1 at mail.cn99.com... > I don't understand why not python define a common GUI like REBOL VID ? > > It's being worked on. See the anygui project on sourceforge. If it takes off (which will take a while to evaluate) it might be proposed for the Python core. It's too soon to tell. John Roth From dyoo at hkn.eecs.berkeley.edu Sun Dec 30 19:54:30 2001 From: dyoo at hkn.eecs.berkeley.edu (Daniel Yoo) Date: Mon, 31 Dec 2001 00:54:30 +0000 (UTC) Subject: REPOST: Re: Is learning Python "extraordinary"? References: Message-ID: <4$--$$_----___%_$$@news.noc.cabal.int> Tim Peters wrote: : [Jesse F. W] :> I am a high school senior, and like many others, I am applying :> to college. I am applying to MIT (as well as many other schools). :> MIT describes what they are looking for as students who do or have :> done "extraordinary things". My question is this, Is teaching myself :> Python (with the aid of the Python tutorials and some help from the :> various lists) an "extraordinary thing"? > It shows intellectual curiosity and self-motivation, two things any > admissions board smiles on. However, for MIT, you should make clear > that your studies have convinced you Python is merely a bad > implementation of Scheme . Or that one can use Python to implement a Scheme... *grin* http://hkn.eecs.berkeley.edu/~dyoo/python/pyscheme/pyscheme-0.01.tar.gz ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsfeed.berkeley.edu!ucberkeley!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Daniel Yoo Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:21:35 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009773988 27193 211.57.49.2 (31 Dec 2001 04:46:28 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:46:28 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From timr at probo.com Sun Dec 30 17:25:27 2001 From: timr at probo.com (Tim Roberts) Date: Sun, 30 Dec 2001 14:25:27 -0800 Subject: REPOST: Re: odd problem, most likely stupid one too :-) References: Message-ID: <6$--$$_----____$$$@news.noc.cabal.int> Dave Harrison wrote: >Ive written a class named packet, and I have a list on >values that I am using to create my packets by passing >the values in as I instantiate the classes I am creating. > >I do the creation in a for loop, > >for item in itemlist: > PACKET = Packet(item) > paclist.append(PACKET) > >except that when I try to go back through and see the >packets in my paclist they are all exactly the same as >the final one that I store in the list. As in I do, > >for pac in paclist: > print pac.getVal() > >and I get exactly the same value, despite the fact that >I know for sure they are different. This might happen if, for example, you were storing the packets in a class variable or a global variable instead of an instance variable. This class, for example, would behave exactly as you describe: class Packet: value = Null def __init__(self,pkt): value = pkt def getVal(self): return self.value The solution is to skip the class global: class Packet: def __init__(self,pkt): self.value = pkt def getVal(self): return self.value -- - Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!zeus.visi.com!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Tim Roberts Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:15:36 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774037 27193 211.57.49.2 (31 Dec 2001 04:47:17 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:47:17 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From nika at kassube.de Sun Dec 30 08:14:07 2001 From: nika at kassube.de (Nils Kassube) Date: 30 Dec 2001 14:14:07 +0100 Subject: REPOST: Re: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> <3C2E498B.6DC757E0@stroeder.com> Message-ID: <2$--$$_----__%$-_$@news.noc.cabal.int> Cliff Wells writes: > My sentiments exactly: C is excellent as the equivalent of a modern > assembly language. Usually an assembly language is well defined. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Nils Kassube Newsgroups: comp.lang.python Subject: cmsg cancel <87itaorgtc.fsf at kursk.kassube.de> Control: cancel <87itaorgtc.fsf at kursk.kassube.de> Date: Mon, 31 Dec 2001 02:53:14 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774237 27193 211.57.49.2 (31 Dec 2001 04:50:37 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:50:37 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From augspies at charter.net Mon Dec 3 15:03:59 2001 From: augspies at charter.net (Jeremy Gibson) Date: Mon, 03 Dec 2001 15:03:59 -0500 Subject: Problem with pipes (win32pipe) Message-ID: I am having a bear of a time trying to get my python program to talk to a windows process. The program I am trying to run is call nrcmd. It is a cisco program that is used for administering router clusters. Here is what I have done so far(BTW) the kludgey readlines are going to be replaced with some pattern matching I just wanted to get talking first. ***************************************************** import os, win32pipe os.chdir('c:\\program files\\network registrar\\bin') fin, fout = win32pipe.popen2('nrcmd') c = 0 while c < 6: fout.readline() c = c+1 fout.read(7) ***************************************************** The output from this is: ***************************************************** 100 Ok\n cluster = nnn.nnn.nnn.nnn\n default-format = user\n user-name = user \n visibility = 5\n nrcmd> ***************************************************** At this point any fin.write() will be accepted without complaint, but nothing is happening. If I attpempt to fout.read() again the program hangs and must be killed. I assume this is happening because I am attempting to read a null byte. The return from a successfull (or unsuccessfull) write should fill the fout buffer with something to read. I am sending newlines in the fin.writes I've tried and I've even tried sending \r\n since this is a windows machine I'm working with. I've also tried fin.flush() after a write. If anyone has any ideas or thoughts on where I might find illumination for this problem please write to my email, or post to the group. Thanks, Jeremy Gibson From aahz at panix.com Sat Dec 29 17:06:33 2001 From: aahz at panix.com (Aahz Maruch) Date: 29 Dec 2001 14:06:33 -0800 Subject: REPOST: Re: Is learning Python "extraordinary"? References: Message-ID: <4$--$$_----___%%%$@news.noc.cabal.int> In article , Jesse F. W wrote: > > I am a high school senior, and like many others, I am applying >to college. I am applying to MIT (as well as many other schools). >MIT describes what they are looking for as students who do or have >done "extraordinary things". My question is this, Is teaching myself >Python (with the aid of the Python tutorials and some help from the >various lists) an "extraordinary thing"? How many python-list'ers are >high school students? No, it's not an extraordinary thing. We used to have an 11-year old posting here. However, I *would* say that learning Python is extraordinarily smart. If you have a taste for masochism, learning Perl well enough to be a guru would be extraordinary. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 2 days and counting ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: aahz at panix.com (Aahz Maruch) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:01:15 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774533 27193 211.57.49.2 (31 Dec 2001 04:55:33 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:55:33 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From citykid at nospam.edu Fri Dec 14 22:05:21 2001 From: citykid at nospam.edu (Les Ander) Date: Fri, 14 Dec 2001 19:05:21 -0800 Subject: perl style formating Message-ID: Hi, i am new to python. say i wanted to print out 3 variable in the following format: $name is left justified and has the width of size 10 $comment is left justified and starts at column 11 and ends at 40 $line starts at 41 and is of variable length) in perl i would write it as: format OUT = @<<<<<<<<<< >@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >@* $name, $comment, $line; . $~="OUT"; how do i write it in python? thanks les From bas.vangils at home.nl Wed Dec 19 02:43:08 2001 From: bas.vangils at home.nl (Bas van Gils) Date: Wed, 19 Dec 2001 08:43:08 +0100 Subject: Update Oreilly books? In-Reply-To: <3C1E3805.6090009@home.com> References: <3C1E3805.6090009@home.com> Message-ID: <20011219074308.GA30387@kub.nl> On Mon, Dec 17, 2001 at 12:23:01PM -0600, Luke wrote: > I agree... Programming Python is a massive treasure trove of topics. It > just covers so much. The Tkinter section is great and pretty extensive, > the networking and CGI areas are good as well. Then there are the > sections on system scripting and so forth. It is well rounded. My only > complaint is the excessive code redundancy--they could have shaved > 100-200 pages off the thing by not reprinting an entire code example > when one or two lines change... I am a believer as well :-) The first edition of PP was my intro in the world of Python. I still think mr. Lutz dit an excellent job on that one. I recently purchased the second edition and am reading it back to back. IMHO the book is written in a consistent manner, has lots of humor in it and many insightfull examples. However, I agree that some improvements should be made on the index. It is sometimes hard to find what one needs. Thats why I also bought "Python Pocket Reference"... hope this helps :-) yours Bas van Gils -- Bas van Gils - http://members.home.nl/bas.vangils Build a system that even a fool can use, and only a fool will want to use it. From issac at myfirstlink.net Sun Dec 30 22:29:27 2001 From: issac at myfirstlink.net (Issac) Date: Sun, 30 Dec 2001 21:29:27 -0600 Subject: listtree.py crash References: <015a01c1919f$967df7f0$6401a8c0@mojave> Message-ID: <001d01c191ab$5a448680$6401a8c0@mojave> Oops, nevermind. PyQt is exactly what I need. Such a beautiful piece of software! Issac > ActiveState Python 2.1.1 and 2.2 both reject the listtree.py tkinter demo > (from the Python 2.2 source distro) : > > $ python listtree.py listtree.py > Traceback (most recent call last): > File "listtree.py", line 37, in ? > main() > File "listtree.py", line 33, in main > list = listtree(f, app) > File "listtree.py", line 11, in listtree > listnodes(list, app, '.', 0) > File "listtree.py", line 15, in listnodes > klass = list.send(app, 'winfo', 'class', widget) > File "c:\Python21\lib\lib-tk\Tkinter.py", line 582, in send > return self.tk.call(('send', interp, cmd) + args) > TclError: invalid command name "send" > > Does anyone know how to fix this? > > Issac > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.310 / Virus Database: 171 - Release Date: 12/19/2001 > > > -- > http://mail.python.org/mailman/listinfo/python-list --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.310 / Virus Database: 171 - Release Date: 12/19/2001 From chrishbarker at attbi.com Fri Dec 7 18:23:25 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Fri, 07 Dec 2001 15:23:25 -0800 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C100BB2.6446E896@cosc.canterbury.ac.nz> <7da8d8f8.0112070206.49e1bef4@posting.google.com> Message-ID: <3C114F6D.D1E2D291@attbi.com> Harald Hanche-Olsen wrote: > There are some problems with using a seconds count as the basis for > calendrical calculations. A big one is that nobody knows when leap > seconds will happen in the future. So you might schedule an event for > the time 2038-01-19 03:14:08 UTC, but you cannot know how many seconds > that is from now, That sounds to me like a really good reason why we don't have to worry about femtoseconds. Resolving time down to units that small is simply incompatable with calender dates. > I think that keeping calendrical calculations and time issues strictly > separate is a good idea myself. I would even go so far as to suggest > a completely separate module just for dates and calendars. > advantage is that you can deal with that without even getting into the > mess of leap seconds, time zones and daylight saving time. > Leave that for another module. I disagree. A Date module that doesn't even understand hours would have pretty limited usefulness. > An advantage of this scheme is that a date module > has at least a chance of becoming simple enough to become a part of > python. I will make no such assertions about time. It has to be both simple and useful. I think it would fail the useful test. A DateTime module that doesn't resolve any finer than seconds would be very usefull, and I think doable. With all this leap-second stuff, resolving finer than that just isn't worth it. I really would like to see SOMETHING get into the standard library, however. The current time module is far too limiting. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From beej at piratehaven.org Wed Dec 5 19:39:27 2001 From: beej at piratehaven.org (beej at piratehaven.org) Date: 6 Dec 2001 00:39:27 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: <9umenv09k0@enews4.newsguy.com> In article , Courageous wrote: >For vim users: >set et This is cool if you always want your tabs expanded, but expanded tabs suck (IMHO) in, say, C code. So you can do this instead in your ~/.vimrc: au BufNewFile,BufRead *.py set et This sets an autocommand for files that end in ".py" to "set et". Only works if the file extension is ".py" obviously, but maybe there's another way around that. -Beej From ssthapa at classes.cs.uchicago.edu Thu Dec 13 19:45:04 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Fri, 14 Dec 2001 00:45:04 GMT Subject: Python CPAN beta test Message-ID: I've gotten ciphon to the point where I tihnk it's ready for beta testing and am looking for people willing to help test it. Currently ciphon has readline support, dependency handling, automatic updates of server and package lists and a few other things. There are currently 5 packages in the repository (wxpython, pygresql, numeric, pil, and egenix-mx-base) but I'll be adding more. Basically, if you would like to beta test ciphon you can get the latest release by anonymous ftp from ftp.community.tummy.com (thanks to Sean Reifschneider) in /pub/python-packages. If there are any modules you would like to get into the repository then email me a link to the module's homepage and I'll try to add it to the repository. If you're an author and want to help me in getting your module included in the repository, then you can just grab the ciphon tar ball, run the createspec.py script in the utils directory, and email me the generated file along with a location where I can get the source for your module. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From LLoeffler at home.com Sun Dec 9 19:24:27 2001 From: LLoeffler at home.com (Luke) Date: Sun, 09 Dec 2001 18:24:27 -0600 Subject: Populating a list References: Message-ID: <3C1400BB.7040500@home.com> > states = [] > f=open('/home/mlorfeld/states.txt', 'r+').readlines() > for i in f: > states.append(i.rstrip()) > f.close() > print states f.close() will fail because f is a list, not a file object. > f=open('/home/mlorfeld/states.txt', 'r+').readlines() This line while being fine, probably isn't the best idea in the interest of clairity as f traditionally denotes a file pointer, not a list. I would give it a more meaningful name. From woodsplitter at rocketmail.com Mon Dec 24 20:24:01 2001 From: woodsplitter at rocketmail.com (stalin) Date: 24 Dec 2001 17:24:01 -0800 Subject: Confusion with Classes References: <20011224023708.28093.00000469@mb-cq.news.cs.com> Message-ID: <7876a8ea.0112241724.1a00a584@posting.google.com> kirifam1 at cs.com (Kirifam1) wrote in message news:<20011224023708.28093.00000469 at mb-cq.news.cs.com>... > I am pretty new to Python and object oriented programming in general. > I am writing a gui module... we all need to write our own code sometimes... I don't intend to be unfriendly or condescending here, but I think your approach is a bit skewed. I agree that "we all need to write our own code sometimes", but I think that time had better not be when we're "new to Python and object oriented programming in general". It's like trying to write a novel without ever having read a novel. Why not learn an existing GUI toolkit or two before you try to write your own? From timr at probo.com Wed Dec 5 02:46:05 2001 From: timr at probo.com (Tim Roberts) Date: Tue, 04 Dec 2001 23:46:05 -0800 Subject: How many threads can I create ??? References: <3C0BAF40.EBC30CFC@softax.com.pl> Message-ID: Bartosz Zembrzuski wrote: > >I've got problem with creating large number of threads on Linux. >... >86th thread gives me an error: >... >thread.error: can't start new thread > >I've no idea what's going on. Under Windows I've created over 2000 >python threads until error occures. >Similar program written in C (using pthreads) lets me create over 300 >threads (on the same linux machine) > >Any suggestions are welcome :))) OK, here's a suggestion: don't do that. The only use for your test is to establish the limits. Now you know the limit: 85. However, that fact is not particularly useful. It is counterproductive to launch an application with a hundred threads. You will simply waste CPU time thrashing in the scheduler. -- - Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From nigel at pc714.maths.usyd.edu.au Fri Dec 14 06:18:22 2001 From: nigel at pc714.maths.usyd.edu.au (nigel at pc714.maths.usyd.edu.au) Date: 14 Dec 2001 22:18:22 +1100 Subject: reading 6-byte ("real48") Borland Pascal Floating Point numbers References: <3c19262e.1671423@news.muenster.de> <3C192B25.4F1BD2F9@indra.com> Message-ID: <87lmg6f3sx.fsf@pc714.maths.usyd.edu.au> Ron Reidy writes: > Martin Bless wrote: > > > > I have to convert those "good (?) old" 6-byte, "real48" floating point > > numbers used in Borland's Pascal to nowadays "normal" floating points. > > > > Has is already been done? > > > > Martin > You will have to do this using pack(). > -- > Ron Reidy > Oracle DBA > Reidy Consulting, L.L.C. The little-known xdrlib in the standard python distro should do part of the job. http://www.python.org/doc/current/lib/module-xdrlib.html >From what I can see in RFC1014 (http://www.faqs.org/rfcs/rfc1014.html) the XDR and IEEE formats coincide for floating point. The real48 format (http://www.borland.com/techpubs/delphi/delphi5/oplg/memory.html) looks similar enough to IEEE that a bit of byte-shifting should do the conversion, and xdrlib.pack_double(data) gives you your number. nigel ( at maths. usyd. edu. au ) From rdsteph at earthlink.net Sat Dec 29 23:33:49 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sun, 30 Dec 2001 04:33:49 GMT Subject: Python Popularity, python at sourceforge References: Message-ID: <3C2E9A26.81C731DB@earthlink.net> Mr. Rengelink, I have taken the liberty of posting a copy of the statistics you have so assiduously compiled below, on my web site at http://www.awaretek.com/plf.html for future reference. If you would rather they not be so presented, let me know and I'll immeditely take the page down. rs Roeland Rengelink wrote: > Hi, > > As was remarked earlier in this thread, a measure of Python's > popularity, if not quality, can be obtained by looking at the number > of sourceforge projects using Python. Below you'll find a number of > tables comparing sourceforge projects using Python to those using > Perl, PHP, Java, C and C++. These numbers were obtained by > screen-scraping the sourceforge trove pages. > > I started this analysis expecting to find clear evidence for Python's > - exploding popularity > - cross-platform usability > - ease of development > > Alas, the numbers are far more ambigious than I'd hoped. To summarize: > > 1. Python is the smallest of the 6 languages discussed here. > 2. Python is currently growing slower than PHP and Java, but faster > than C and Perl. > - Python has only been gaining on Perl for the last 6 months > - the difference in growth w.r.t PHP and Java may be getting smaller > 3. Java is more cross-platform than Python. Perl, C, C++ are less. > 4. There is no clear evidence for Python's ease of development. > > The most interesting result (I think) is Python's changing role from a > glue/scripting language to a stand-alone development language. > Cross-language development statistics are investigated at the end of > this post. > > 1. All projects > > The following two tables list the cumulative number and quarterly > growth rates of sourceforge projects using Python, Perl, PHP, Java or > C++ as one of their programming languages. Note that projects using > more than one of these languages contribute to the numbers of each of > those languages. > > The following conclusions can be drawn > - Python is only half as big as any of the other languages. > - The growth rate of Perl, as compared to Python, has been steadily > declining since ther third quarter of 2000. It has become smaller > than Python's growth rate in the third quarter of 2001. > - The growth rates of PHP and Java have been much larger than > Python's. However, up to the third quarter of 2001 their growth rates > declined relative to Python. > - Since the third quarter of 2000, C has been the slowest growing > language. > - The growth rate of Python is most similar to that of C++ > > To summarize: > > Early 2000 Python was the slowest growing language. Currently only PHP > and Java are growing faster, and the gap is closing > > Table 1a. Cumulative number of projects > Python=1 > Python Perl PHP Java C C++ Perl PHP Java C C++ > 00-03-01 98 172 84 139 529 361 1.8 0.9 1.4 5.4 3.7 > 00-06-01 221 417 251 371 1220 882 1.9 1.1 1.7 5.5 4.0 > 00-09-01 374 785 555 756 2030 1518 2.1 1.5 2.0 5.4 4.1 > 00-12-01 528 1178 883 1257 2827 2220 2.2 1.7 2.4 5.4 4.2 > 01-03-01 701 1575 1328 1841 3706 2949 2.2 1.9 2.6 5.3 4.2 > 01-06-01 898 2020 1867 2539 4652 3806 2.2 2.1 2.8 5.2 4.2 > 01-09-01 1097 2406 2326 3164 5513 4589 2.2 2.1 2.9 5.0 4.2 > 01-12-01 1266 2690 2745 3774 6189 5285 2.1 2.2 3.0 4.9 4.2 > > Table 1b. Quarterly growth rates > Percentage growth Python=1 > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 125 142 198 166 130 144 1.1 1.6 1.3 1.0 1.1 > 00-09-01 69 88 121 103 66 72 1.3 1.7 1.5 1.0 1.0 > 00-12-01 41 50 59 66 39 46 1.2 1.4 1.6 1.0 1.1 > 01-03-01 32 33 50 46 31 32 1.0 1.5 1.4 0.9 1.0 > 01-06-01 28 28 40 37 25 29 1.0 1.4 1.3 0.9 1.0 > 01-09-01 22 19 24 24 18 20 0.9 1.1 1.1 0.8 0.9 > 01-12-01 15 11 18 19 12 15 0.8 1.2 1.3 0.8 1.0 > > 2. Cross platform projects > > Python advertises itself as a cross-platform development language. > Here, I assume that cross-platform means either OS-independent, or for > 2 or more of the the different OS families [Unix, Win, Mac] > > The conclusion here is pretty much expected: > - Python is more 'cross-platform' than Perl, C and C++, but less so > than Java, and comparable to PHP > > Table 2a Cumulative number of cross-platform projects > Python=1 > Python Perl PHP Java C C++ Perl PHP Java C C++ > 00-06-01 157 273 172 311 590 484 1.7 1.1 2.0 3.8 3.1 > 00-12-01 365 722 598 1047 1317 1159 2.0 1.6 2.9 3.6 3.2 > 01-06-01 626 1243 1298 2135 2122 1939 2.0 2.1 3.4 3.4 3.1 > 01-12-01 900 1658 1959 3198 2836 2701 1.8 2.2 3.6 3.2 3.0 > > Table 2b Cross-platform projects as fraction of all new projects > Python=1 > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 71 65 68 83 48 54 0.9 1.0 1.2 0.7 0.8 > 00-12-01 67 59 67 83 45 50 0.9 1.0 1.2 0.7 0.7 > 01-06-01 70 61 71 84 44 49 0.9 1.0 1.2 0.6 0.7 > 01-12-01 74 61 75 86 46 51 0.8 1.0 1.2 0.6 0.7 > > 3. Active projects > > Python also advertises itself for its ease of development. One could > expect that easy projects are more active than difficult projects. > > The following tables list statistics for projects that have an > activiy_ranking of more than 80 %. Since I don't know how this > activity is measured I can't really interpret these numbers. > > Activity ranking is a relative measure of a projects activity, which > is computed over all sourceforge projects. An activity ranking of 80% > means 80% as active as the most active sourceforge project. Activity > seemt to comprise both developer activity (checkins, bug fixes) and > user activity (downloads, bug reports). > > The most notable result from these tables is probably that the numbers > are so similiar. Hence, my tentative conclusion: > > - Project activity is largely independent from the choice of > programming language and therefore also independent of the > 'accessability' of the language > > Table 3a Cumulative number of active projects > Python=1 > Python Perl PHP Java C C++ Perl PHP Java C C++ > 00-06-01 24 36 21 33 156 94 1.5 0.9 1.4 6.5 3.9 > 00-12-01 43 59 49 74 268 174 1.4 1.1 1.7 6.2 4.0 > 01-06-01 59 95 81 127 368 263 1.6 1.4 2.2 6.2 4.5 > 01-12-01 74 120 128 182 441 347 1.6 1.7 2.5 6.0 4.7 > > Table 3b Percentage active as fraction of all projects > Python=1 > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 10 8 8 8 12 10 0.8 0.8 0.8 1.2 1.0 > 00-12-01 6 3 4 4 6 5 0.5 0.7 0.7 1.1 1.0 > 01-06-01 4 4 3 4 5 5 1.0 0.8 1.0 1.3 1.3 > 01-12-01 4 3 5 4 4 5 0.9 1.3 1.1 1.2 1.4 > > 4 Mature projects > > Ease of development may also be reflected in what percentage of > projects reaches a mature development status. The following tables > give numbers for projects that reached a mature or production/stable > development status. > > The data suggest that Perl and C project reach a mature development > status more often than Python, PHP, Java and C++ projects. > > Note that development status is assessed by the project developers > themselves > > Table 4a Cumulative number of mature projects > Python=1 > Python Perl PHP Java C C++ Perl PHP Java C C++ > 00-06-01 43 118 41 59 294 168 2.7 1.0 1.4 6.8 3.9 > 00-12-01 87 233 109 161 599 342 2.7 1.3 1.9 6.9 3.9 > 01-06-01 122 367 194 286 887 503 3.0 1.6 2.3 7.3 4.1 > 01-12-01 160 455 280 399 1110 644 2.8 1.8 2.5 6.9 4.0 > > Table 4b Percentage mature as fraction of all projects started. > Python=1 > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 19 28 16 15 24 19 1.5 0.8 0.8 1.2 1.0 > 00-12-01 14 15 10 11 18 13 1.1 0.8 0.8 1.3 0.9 > 01-06-01 9 15 8 9 15 10 1.7 0.9 1.0 1.7 1.1 > 01-12-01 10 13 9 9 14 9 1.3 0.9 0.9 1.4 0.9 > > 5. Cross language development > > The most interesting results are obtained when we compare projects > that use a single language with those that use multiple languages. The > follwing tables compare the fraction of projects that use more than > one language, to those that only use a single language. > > There are many trends here. > > - Python, Perl, PHP and Java projects are increasingly becoming > single-language projects. > - The percentage of cross-language projects in cross-platform projects > is lower for Python, Perl, PHP and Java, while its substantially > higher for C and C++ projects. > - Of the currently active Python projects nearly all old projects > included other languages, while only a third of the new projects > does so. > - Perl is the only language for which the fraction of multi-language > projects is larger for active projects. > - For the mature Python projects there is also a large difference in > the fraction of cross-language projects between old and new > projects. > - For all languages the percentage of mature projects that use more > than one language is smaller. > > One conclusion > > - Python is increasingly used a stand-alone development language, > especially in active and mature projects. > > Table 5a Percentage of all new projects > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 55 51 41 35 47 46 0.9 0.8 0.6 0.9 0.8 > 00-12-01 52 42 37 33 47 46 0.8 0.7 0.6 0.9 0.9 > 01-06-01 51 48 39 30 46 46 0.9 0.8 0.6 0.9 0.9 > 01-12-01 45 42 31 26 47 43 0.9 0.7 0.6 1.0 1.0 > > Table 5b Percentage of new cross platform projects > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 52 47 44 32 56 51 0.9 0.8 0.6 1.1 1.0 > 00-12-01 50 40 33 30 54 50 0.8 0.7 0.6 1.1 1.0 > 01-06-01 51 43 36 27 54 52 0.8 0.7 0.5 1.1 1.0 > 01-12-01 44 39 28 24 56 48 0.9 0.7 0.6 1.3 1.1 > > Table 5c Percentage of active projects > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 87 58 19 12 51 44 0.7 0.2 0.1 0.6 0.5 > 00-12-01 68 60 17 46 44 51 0.9 0.3 0.7 0.7 0.7 > 01-06-01 50 55 40 32 47 37 1.1 0.8 0.6 0.9 0.7 > 01-12-01 33 64 25 19 52 47 1.9 0.8 0.6 1.6 1.4 > > Table 5c Percentage of mature projects > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 58 36 34 27 37 37 0.6 0.6 0.5 0.6 0.6 > 00-12-01 47 26 20 32 37 44 0.5 0.4 0.7 0.8 0.9 > 01-06-01 45 37 32 24 34 36 0.8 0.7 0.5 0.8 0.8 > 01-12-01 34 31 25 22 36 40 0.9 0.7 0.6 1.1 1.2 > > Undoubtedly there's more to be gained from these numbers. But this is > starting to look like work, so... > > Roeland > > -- > r.b.rigilink at chello.nl > > "Half of what I say is nonsense. Unfortunately I don't know which half" From emile at fenx.com Fri Dec 28 20:27:25 2001 From: emile at fenx.com (Emile van Sebille) Date: Fri, 28 Dec 2001 17:27:25 -0800 Subject: need help with class of arrays which have attibutes References: Message-ID: "Rob" wrote in message news:pan.2001.12.28.15.45.35.83.2001 at ieee.org... > Hi, > > I'm trying to contruct a class of arrays which have attributes. This one > respresents a wire[] array which can have x,y,z etc coordinates. I just > can't figure out how to do it. Here is what I have so far: (it uses > Numpy) You need to review and work some with classes. Start with section 9 in the tutorial http://www.python.org/doc/current/tut/node11.html and look at the __init__ references, which is used to initialize class instances. HTH, -- Emile van Sebille emile at fenx.com --------- From fperez528 at yahoo.com Thu Dec 20 16:33:44 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Fri, 21 Dec 2001 21:01:44 +2328 Subject: Another distutils question References: <9vumpp$hn2$1@peabody.colorado.edu> Message-ID: Martin von Loewis wrote: > Fernando =?ISO-8859-1?Q?P=E9rez?= writes: > >> Thanks Martin. I actually have PyXML and did see the setupext/ >> stuff, I just didn't want to add yet another extraneous module to my >> package. I'm trying to stick to the standard tools when possible, >> and my case was simple enough that an ugly kludge allowed me to make >> it work (but *really* ugly). > > Please understand that I'm still using standard tools. distutils was > specifically designed to allow commands to be overridden, and this > is what I'm doing (thanks to Rene Liebscher, BTW, for providing the > original version of install_data). I understand. What I meant to say is I don't want to add another module to my package, and using yours (or Rene's, I guess) would require adding it in, since it isn't 'standard' in the sense of being included in Python's distribution. Does that make sense or am I still mistaken? >> I did like a lot the enhanced install though. It seems like the kind >> of functionality that's badly needed in distutils. Any chance of >> that making it into the standard for new releases? > > distutils is currently unmaintained. Volunteer contributions are > greatly appreciated. Big bummer. Unfortunately I have my hands more than full right now, so I'll have to live with my ugly hacks. At least they work, for now. If in the future I need more, I might just use Rene's install_x package and be done with it. Thanks for your info though. I hope distutils doesn't die though. It seems like an important part of Python. Cheers, f From teg at redhat.com Wed Dec 26 08:19:47 2001 From: teg at redhat.com (Trond Eivind =?iso-8859-1?q?Glomsr=F8d?=) Date: 26 Dec 2001 08:19:47 -0500 Subject: /usr/bin/env: python: No such file or directory References: <9vivft$593$1@peabody.colorado.edu> <171220010818339518%jwbaxter@spamcop.net> <9vnvue$m5d$1@peabody.colorado.edu> <9vo6ng$mhs$1@nntp6.u.washington.edu> Message-ID: nbecker at fred.net writes: > The correct solution is for Redhat to put: > #!/usr/bin/python1.5 The scripts don't depend on Python 1.5 - they depend on having certain modules available, with the same functionality as they were developed on. -- Trond Eivind Glomsr?d Red Hat, Inc. From jeff at ccvcorp.com Thu Dec 27 14:22:15 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Thu, 27 Dec 2001 11:22:15 -0800 Subject: REPOST: Re: cmp References: Message-ID: <4$--$$_----_-$-%_$@news.noc.cabal.int> Matt Russell wrote: > Well, I just made myself look silly. I admit it... > > when I type 1==1 into the interpreter, I thought if it was true, the > result is 1 - this is right. But cmp(1,1) actually returns 0 (in > accordance to the docs) > > But why then are we given the mechanism to compare instances of > classes via the __cmp__ def ? > > Collegues of mine have used this to return 1 (truth) if two instances > are equal (instanceA==instanceB).... this obviously wasn't the > intended purpose. (__cmp__ shuold return 0 if the result of cmp(a,b) > is to be trusted?? > > Perhaps then could someone explain to me how one compares classes > useing the == operator, or indeed if this bad programming practice. > > I hope I didn't waste too much of guido's time when I posted a bug on > sourceforge :( cmp(a, b) is not a boolean function, as your colleagues apparently feel it should be. It's actually a trinary function--it can return -1, 0, or +1, representing a being less than, equal to, or greater than b, respectively. Comparing classes with the == operator is fine. If you've declared a __cmp__() for your class, then == will use that. If you haven't, then == uses 'is' -- in other words, it tests for object identity. Note that if cmp(a, b) returns 0, then a == b will evaluate to 1. >>> class test: ... def __init__(self, val): ... self.value = val ... def __cmp__(self, other): ... try: ... return cmp(self.value, other.value) ... except: ... return -1 ... >>> a = test(1) >>> b = test(2) >>> c = test(2) >>> a < b 1 >>> b is c 0 >>> b == c 1 >>> Jeff Shannon Technician/Programmer Credit International ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Jeff Shannon Newsgroups: comp.lang.python Subject: cmsg cancel <3C2B74E6.597B894D at ccvcorp.com> Control: cancel <3C2B74E6.597B894D at ccvcorp.com> Date: Mon, 31 Dec 2001 04:07:35 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775633 27193 211.57.49.2 (31 Dec 2001 05:13:53 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:13:53 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From bernhard at intevation.de Tue Dec 18 06:41:34 2001 From: bernhard at intevation.de (Bernhard Reiter) Date: 18 Dec 2001 11:41:34 GMT Subject: ANNOUNCE: SCons 0.01 now available References: Message-ID: <9vna1e$ghtj3$1@ID-89274.news.dfncis.de> [Posted and mailed] Steven: Contratulations to your first release of SCons. I've been watching the project loosely from a distance and now I will check it out the next time I need make or similiar. I've been wondering: How is the plan to make the transistion to actually use SCons to build itself? :) I am not sure that SCon should rely on another tools... The webpages is missing some nice and simple examples. It is really hard from the documents to have a quick impression on how a SConstruct file will really look like that replaces one Makefile. Thanks, Bernhard In article , Steven Knight writes: > I'm pleased to announce that the first alpha release of SCons, version > 0.01, has been released and is available for download. You can download > SCons from the download page at the SCons web site: > > http://www.scons.org/ > > Or through the download link at the SCons project page at SourceForge: > > http://sourceforge.net/projects/scons/ > > RPM and Debian packages and a Win32 installer are all available, in > addition to the traditional .tar.gz files. > > SCons is a software construction tool (build tool, make tool) written in > Python. Its design is based on the ScCons design which won the Software > Carpentry build tool design competition in August 2000, which is in turn > based on the design of the Perl-based Cons build tool. > > Distinctive features of SCons include: > > - configuration files are Python scripts, allowing the full use of a > real scripting language to solve build problems > - a modular architecture allows the SCons Build Engine to be > embedded in other Python software > - a global view of all dependencies; no multiple passes to get > everything built > - the ability to scan files for implicit dependencies (#include files); > - improved parallel build (-j) support > - use of MD5 signatures to decide if a file has changed > - easily extensible through user-defined Builder and Scanner objects > > This alpha release has been a long time coming (we initially hoped to > release in September), but the tradeoff is that the extra time has > allowed us to provide more functionality than just a toy. Owing to a > rigorous testing methodology that we've followed throughout development, > we believe the quality and functionality in SCons 0.01 to be sufficient > to support "real work" from day one. > > That said, this *is* an alpha release, and we fully expect that some > of you will exercise end cases that our current tests don't cover. We > eagerly await your bug reports. > > An scons-users mailing list has been created for those interested in > getting started using SCons. You can subscribe at: > > http://lists.sourceforge.net/lists/listinfo/scons-users > > Lastly, I'd like to acknowledge the entire SCons team, who have put in > many hours contributing ingenious solutions to a thorny set of problems: > Chad Austin, Charles Crain, Steven Leblanc, and Anthony Roach. > > We're anxious for your feedback, so don't be shy about letting us know > what's good, what's not, and how SCons can be improved to help you solve > your build problems. > > On behalf of the SCons team, > > --SK > > -- Professional Service around Free Software (intevation.net) The FreeGIS Project (freegis.org) Association for a Free Informational Infrastructure (ffii.org) FSF Europe (fsfeurope.org) From chrishbarker at attbi.com Wed Dec 19 14:37:52 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Wed, 19 Dec 2001 11:37:52 -0800 Subject: dynamic modules References: <9vo01n$9j8$1@news.tpi.pl> <9vo2s4$noo$1@peabody.colorado.edu> Message-ID: <3C20EC90.3BA07F2F@attbi.com> Michael Hudson wrote: > Fernando P?rez writes: > > import plugin1 as p1 > > > > ... > > > > del p1 > > In the next gc pass it should get picked up. > > This won't work; consider sys.modules. while you can't delete an entire module, can you delete some of it's members? Example: import plugin # do stuff del plugin.largedatastructure If I did this, would the datastructure be deleted? If so, it would acomplish most of what the OP wanted. The module would still be there, but the large data structure wouldn't be. It also looks like a reload() would bring back the data, although I'm not sure how well that would work with a compiled module. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From xavier at perceval.net Wed Dec 12 05:28:10 2001 From: xavier at perceval.net (Xavier Defrang) Date: Wed, 12 Dec 2001 11:28:10 +0100 (CET) Subject: mod_python vs mod_snake Message-ID: Hi, I've got a Python CGI performing XSLT transforms and I experience really poor performance because it has to import plenty of modules. I was then thinking using an interpreter embedded within Apache 1.3. I want to rely at least on a minimal application framework so I don't feel like using pcgi. Now the question is should I use mod_python or mod_snake? Both have pros and cons... mod_python looks more mature, more documented and has a much simpler architecture than mod_snake. What I need here is a simple persistent Python environment to run a few rather simple scripts, I was likely to use mod_python with its standard publish handler but I noticed that I had to rebuild the interpreter without thread support... And what about the security of these modules? I already googled to look out for vulnerabilities involving mod_(python|snake) and I havn't found anything... I'd be glad to hear any good/bad experience in this field too... Regards, Xavier From tim.one at home.com Sat Dec 29 23:11:22 2001 From: tim.one at home.com (Tim Peters) Date: Sat, 29 Dec 2001 23:11:22 -0500 Subject: Is learning Python "extraordinary"? In-Reply-To: <3C2DC53F.31010.D9D6B0A@localhost> Message-ID: [Jesse F. W] > I am a high school senior, and like many others, I am applying > to college. I am applying to MIT (as well as many other schools). > MIT describes what they are looking for as students who do or have > done "extraordinary things". My question is this, Is teaching myself > Python (with the aid of the Python tutorials and some help from the > various lists) an "extraordinary thing"? It shows intellectual curiosity and self-motivation, two things any admissions board smiles on. However, for MIT, you should make clear that your studies have convinced you Python is merely a bad implementation of Scheme . oops-i-guess-sucking-up-isn't-extraordinary-after-all-ly y'rs - tim From manutd8611 at softhome.net Wed Dec 19 23:32:54 2001 From: manutd8611 at softhome.net (Evan Roman) Date: 19 Dec 2001 20:32:54 -0800 Subject: Newbie Programming Message-ID: <84fd22ef.0112192032.14c75f8a@posting.google.com> I have just begun programming in Python a couple months ago. While i feel like i am doing OK, i don't think im getting any better. The problem is i can't think of anything to program... I think I have most of the fundamentals down, but i can't think of any ways to use them. I was just wondering if there was some website that gives ideas of little projects to do so that one could sharpen his programming skills. Thanx in advance for all the help. -Evan From sholden at holdenweb.com Wed Dec 19 11:23:19 2001 From: sholden at holdenweb.com (Steve Holden) Date: Wed, 19 Dec 2001 11:23:19 -0500 Subject: Cygwin socket library status enquiry References: <20011218131502.GA2268@dothill.com> <2JJT7.22497$PA.5674@atlpnn01.usenetserver.com> Message-ID: "Steve Holden" wrote in message news:Vl1U7.38055$PA.31332 at atlpnn01.usenetserver.com... > [posted & mailed] > "Jason Tishler" wrote ... > > On Tue, Dec 18, 2001 at 08:52:20PM +0000, Michael Hudson wrote: > > > "Steve Holden" writes: > > > > I'll see what I need to omit to get it to build, and follow up if I > > > > make progress. > > > > > > You need to build _socket statically. > > > > Please try the following instead: > > > > http://cygwin.com/ml/cygwin/2001-12/msg00894.html > > > > and report back to the list. > > > [Jason's URL specifies rebasing a number of Cygwin and Python DLLs to > overcome some known bugs in the Cygwin build] > > OK, I got the build to work. Win98 didn't have all the same libraries, so > I'd recommend that the rebase tool silently, or with a simple comment, > ignores file arguments it can't find. But it did rebase everything it found. > > I'm getting conflicting results on the tests. I omitted test_hotshot, which > seems to hang, and test_select (because it's a known troublemaker). I > actually got through to the end of the test cycle and restarted on the > compiled code, and was in the middle of a post to explain about the five > tests which failed, when test_popen2 hung my machine. Solid, not even the > three-fingered salute would break in. > > I had hoped to provide a test output with the summary I saw from phase 1, > but unfortunately it looked like "tee" hadn't debuffered the critical part, > so I'm going to have to try again. Sorry this is so inconclusive, but the > build did pass test_socket. > > This was with configure --without-thread, by the way. Let me know if you'd > like me to repeat it --with-thread. > > Let me know what else you need - I'm afraid work is interfering with all > this testing, so things are going a little more slowly than I'd like. With > 2.2 so close maybe this will have to (and should?) wait for 2.3... > Well, the Windows 98 news is slightly better now. Running the tests (omitting test_hotshot and test_select manually) gives the following results, and *does* complete (I may have been in too much of a hurry earlier): 150 tests OK. 5 tests failed: test_dircache test_gdbm test_mhlib test_mmap test_os 29 tests skipped: test_al test_asynchat test_bsddb test_cd test_cl test_curses test_dbm test_dl test_fork1 test_gl test_imgfile test_largefile test_linuxaudiodev test_locale test_minidom test_nis test_ntpath test_pyexpat test_sax test_socket_ssl test_socketserver test_sunaudiodev test_thread test_threaded_import test_threadedtempfile test_threading test_unicode_file test_winreg test_winsound Ask someone to teach regrtest.py about which tests are expected to get skipped on cygwin. make: [test] Error 1 (ignored) I'll do some checking on the individual failing tests if I get time later, but it most probably won't be in the next eight hours. Let me know if there are specific tests you'd like carried out. regards Steve -- http://www.holdenweb.com/ From TomH at optiscan.com Mon Dec 10 16:11:26 2001 From: TomH at optiscan.com (Tom Harris) Date: Tue, 11 Dec 2001 08:11:26 +1100 Subject: FW: Strange behaviour of __del__ Message-ID: Greetings, Playing around with the __del__ method of classes led me to this odd observation: <> class A: def __init__(self, a): if a: raise RuntimeError def __del__(self): print 'In __del__()...' import Script1 >>> a = Script1.A(1) Traceback (most recent call last): File "", line 1, in ? File "Script1.py", line 4, in __init__ raise RuntimeError RuntimeError >>> del a In __del__()... Traceback (most recent call last): File "", line 1, in ? NameError: name 'a' is not defined >>> Why is the __del__ method being called? Note that Python raised a NameError. If 'a' is not defined, how does Python find, let alone call a method on it. Am I expectiong Python to be like C++ where a class instance is not constructed until it falls off the last brace of the constructor? Tom Harris, Software Engineer Optiscan Imaging, 15-17 Normanby Rd, Notting Hill, Melbourne, Vic 3168, Australia email tomh at optiscan.com ph +61 3 9538 3333 fax +61 3 9562 7742 This email may contain confidential information. If you have received this email in error, please delete it immediately,and inform us of the mistake by return email. Any form of reproduction, or further dissemination of this email is strictly prohibited. Also, please note that opinions expressed in this email are those of the author, and are not necessarily those of Optiscan Pty Ltd. From jeff at ccvcorp.com Mon Dec 3 18:16:45 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Mon, 03 Dec 2001 15:16:45 -0800 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <3C0BE492.5DACEA18@mega-nerd.com> Message-ID: <3C0C07DD.AD717FCF@ccvcorp.com> David Bolen wrote: > Erik de Castro Lopo writes: > > > You really ought to try using nothing but tabs for indentation and > > setting the tab width in your editor to whatever you prefer. > > > > This is so easy and works **SO** well. > > Always curious about this in an "all tab" world - how do you align > continuation lines that aren't on a tab stop? And even if you *do* so, then how are they going to stay aligned when the next person to look at it uses a different tab size? Jeff Shannon Technician/Programmer Credit International From syring at email.com Fri Dec 28 03:22:11 2001 From: syring at email.com (Karl M. Syring) Date: Fri, 28 Dec 2001 09:22:11 +0100 Subject: Literally thousands of Pythonic online articles References: <3C2AF56C.1DDF68E7@earthlink.net> Message-ID: "Ron Stephens" schrieb > Bored with the holidays? Then maybe you should check out the list of > online Python related articles generated by Hans Nowak's Pythonic > Webcrawler at http://www.awaretek.com/plf.html Ron, your news service is quite good, but I have a complaint about your gray/red/blue color scheme. That is somewhat hard on the eyes. Karl M. Syring -- IWon acquired the rights to Excite.com through Bellevue, Wash.-based InfoSpace Inc., which bought the Web site last month for $10 million, a staggering discount from the portal's $6.7 billion sales price in 1999. From loewis at informatik.hu-berlin.de Mon Dec 3 05:59:36 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 03 Dec 2001 11:59:36 +0100 Subject: Regular expression as dictionary key? References: <3C0B2DE9.5040308@home.com> <9ufdkn$21dk$1@agate.berkeley.edu> <3C0B408C.8030908@home.com> Message-ID: Luke writes: > So you add a few lines to go exhaustively through the keys and > accumulate matches... Still linear. I admitedly don't know much about > the C implementation of dicts, but it seems there should be a way to > leverage the dict's arrangement for fast regex keys. You mean, you can inspect every element of a set in sub-linear time? I guess you can solve P==NP as well :-) Regards, Martin From tim at zope.com Tue Dec 11 16:50:01 2001 From: tim at zope.com (Tim Peters) Date: Tue, 11 Dec 2001 16:50:01 -0500 Subject: os.mkdir() errno inconsistency on Windows? In-Reply-To: <9v5rmb$36u$1@news1.xs4all.nl> Message-ID: [Irmen de Jong] > On windows (2000), Python 2.1: > Why does os.mkdir() return a different errno when trying to create an > already-existing directory, or trying to create the drive root directory? Only Microsoft knows: Python reports the errno value set by Microsoft's _mkdir() function. You'll see the same values if your do the same things from C code. From buzzard at urubu.freeserve.co.uk Tue Dec 18 11:48:39 2001 From: buzzard at urubu.freeserve.co.uk (Duncan Smith) Date: Tue, 18 Dec 2001 16:48:39 -0000 Subject: gmpy / binary() Message-ID: <9vns33$j9j$1@news6.svr.pol.co.uk> My code: bit_stuff.py ---------------------------------------------- import gmpy def combinations(n, k): comb = gmpy.mpz(1) for i in range(k): comb = comb.setbit(i) #first combination print comb, comb.binary() max = comb << (n-k) #last combination print max, max.binary() ------------------------------------------------------ >>> reload(bit_stuff) >>> bit_stuff.combinations(13,6) 63 ? 8064 ? #actually a ? followed by a shaded box with the letters US >>> bit_stuff.combinations(14,6) 63 ? 16128 >>> x = gmpy.mpz(8064) >>> x.binary() '\200\037' >>> y = gmpy.mpz(16128) >>> y.binary() '\000?' >>> z = gmpy.mpz(63) >>> z.binary() '?' Why the different output? eg. ? versus '\200\037' and nothing versus '\000?'. Thanks in advance. Duncan From imvenki at hotmail.com Tue Dec 18 01:30:50 2001 From: imvenki at hotmail.com (venkatakrishnan.k) Date: 17 Dec 2001 22:30:50 -0800 Subject: Bus Error in HP-UX 11.00 Message-ID: <950ee0f0.0112172230.1d7eba3f@posting.google.com> Hai all, I have a program which runs good in linux systems.When i tried to port it to HP i got this strange error called "bus error" and my program core-dumped. Since i am new to HP i dont know how to solve it and i am not even sure whether the problem lies with my code. I would be very pleased to get a solution for this as this is very urgent. bye, venkatakrishnan.k From missive at frontiernet.net Sun Dec 2 08:37:57 2001 From: missive at frontiernet.net (Lee Harr) Date: Sun, 02 Dec 2001 13:37:57 -0000 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: > You'll not find tabs in any code that I touch. Literally. I've got my > editor configured to save spaces, not tabs. > Same here. I am just wondering that if letting people actually use tabs is causing trouble, why not get rid of that "feature". Seems much less controversial than *cough* integer arithmetic *cough* anyhow... From rdsteph at earthlink.net Sat Dec 29 20:22:12 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sun, 30 Dec 2001 01:22:12 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <4VlX7.6657$l93.1694996@newsb.telia.net> Message-ID: <2$--$$_----__$%--$@news.noc.cabal.int> You are probably aware of the Stackless Python project, I don't know off hand where its web site is, and it's not a compiler I don't think, but a different implementation of a Python interpreter that is a little faster in program execution (a lot faster ??). I know it's not what you are after exactly, but I guess if you want speed of execution, it could be of interest. I bet someday someone or some group creates an "optimized" compiler for Python, but I hear it would be an enormously difficult and complex job. My guess is that, if Python becomes popular *enough*, then someone will find the difficulty worth tackling. On another related tangent, I hope someday someone makes a .Net implementation of Python. Mark Hammond, who was I think involved in ActiveState's prototype effort to do just that, has stated how difficult a job it is. But again, if Python becomes popular enough then someone may do it. One last aside, I keep seeing news about Mono, there was a nice interview/article in, I think Linux Journal recently by Miguel de Icaza (sp?) and it sounds like they are making real progress. I wonder, would a Python.Mono be just as difficult as a Python.net (I guess it would). Would a Python.mono and a Python.net be do-able as a joint project? Wouldn't a Python.Mono be nice ;-)))) Ron Stephens ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E6D60.81031B00 at earthlink.net> Control: cancel <3C2E6D60.81031B00 at earthlink.net> Date: Mon, 31 Dec 2001 02:40:28 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774700 27193 211.57.49.2 (31 Dec 2001 04:58:20 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:58:20 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From store_li at sina.com Wed Dec 19 21:41:14 2001 From: store_li at sina.com (Kick) Date: Thu, 20 Dec 2001 10:41:14 +0800 Subject: Can I change a unicode char to gb2312 using python? References: <9vq6d9$gvc5p$1@ID-12869.news.dfncis.de> Message-ID: <9vrj7s$hd448$1@ID-12869.news.dfncis.de> Thank you! But what I want to change is a variable. How can I use this method? Just f.encode("gb2312")? But python told me that out of range(128).What shall I do ? Thank you! "Oleg Broytmann" wrote in message news:mailman.1008770961.5358.python-list at python.org... > On Wed, Dec 19, 2001 at 09:46:41PM +0800, Kick wrote: > > I know that Java have a method that can manually encode string, like that, > > System.out.println(new String("some chinese char".getBytes()"GB2312")) > > > > Is there any python function or method can do the same work? > > http://www.python.org/doc/current/lib/string-methods.html > > Python strings has method "encode": > > u'sigma'.encode('gb2312') > > Oleg. > -- > Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru > Programmers don't die, they just GOSUB without RETURN. > From sfam at mailandnews.com Sun Dec 2 02:27:34 2001 From: sfam at mailandnews.com (Kaden) Date: 2 Dec 2001 07:27:34 GMT Subject: Help with classes References: <9uc9v5$g69$1@news.xmission.com> <3C09C85E.94379059@earthlink.net> Message-ID: <9ucl56$jjq$1@news.xmission.com> On Sun, 02 Dec 2001 06:21:24 GMT, Hans Nowak wrote: > Kaden wrote: >> class Basket: >> >> def __init__(self,contents=None): >> self.contents = contents or [] >> >> def add(self,element): >> self.contents.append(element) >> print "You put the", element, "in your basket." >> >> def remove(self,element): >> self.contents.remove(element) >> print "You remove the", element, "from your basket." >> >> def print_me(self): >> result = "" >> for element in self.contents: >> result = result + " " + `element` >> print "You look in your basket and see:" + result >> >> class NiceBasket(Basket): >> >> def open(self): >> print "You open your basket." >> state = "open" >> >> def close(self): >> print "You close your basket." >> state = "closed" >> >> Now then, the above class works. However, I want to be able to add some >> checks, such as checking to see if NiceBasket is closed when you try to >> add soemthing to it. I can't figure out how to do this. > By overloading methods. For example, add a new 'add' method to > NiceBasket, that checks, and if the check is successful, it calls > its parents' add method: > > def add(self, element): > if self.state == "open": > Basket.add(self, element) > else: > print "The basket is not open." I was thinking along those lines and I was _sort_of_ close. This is what I had: def add(Basket,element): if state == "closed": print "You need to open it first!" As you can see, I had no idea how to properly call the Basket class (which was what I was trying to ask in the first place, I just couldn't phrase it right), and I had no idea how to have the 'else' call 'Basket', which is why it's conspicuously missing. At this point my mind went completely blank and I gave up and made the post. > I see that in your open and close methods, you use 'state' as a local > variable. This won't work; I knew this, I just didn't know how to make it accessible. I tried declaring it outside any methods, just after the 'def NiceBasket()', but it didn't like that. > Initializing this state variable is probably a good idea too. To > do so, override the __init__ constructor in NiceBasket: > > def __init__(self, contents=None): > Basket.__init__(self, contents) > self.state = "closed" # or open, depending on what you want More than a good idea. Required. At least with my version of Python (2.1.1). I tried it without and it got mad: >>> from Basket import NiceBasket >>> b = NiceBasket(['eggs']) >>> b.open() Traceback (most recent call last): File "", line 1, in ? File "Basket.py", line 28, in open if self.state == "open": AttributeError: NiceBasket instance has no attribute 'state' >>> I know these errors look pretty stupid to the experienced readers, but I didn't think it was too bad considering that the only tutorials I could find that mentioned classes only dealt with communicating with other members of the same class. None of them ever talked about how to move from one class to the other. Except, of course, for the matter of inheritance. Other than that they didn't mention anything. Anyway, thanks for the help, Hans. The information was very helpful. From claird at starbase.neosoft.com Fri Dec 28 09:05:22 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 28 Dec 2001 08:05:22 -0600 Subject: OT: Wine applicability (was: Python Popularity: Questions and Comments) References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9901.998345FB@earthlink.net> Message-ID: <29D69352B05A5CDB.572DD1F16BBDAB9A.554D3155ECE12A85@lp.airnews.net> In article , Alex Martelli wrote: . . . >I don't do much gaming, but I still have to use Windows (mostly in win4lin >under Linux) for a few needs (e.g., SOME durned webpages that I need won't >show correcty under any browser except Internet Explorer). Not to mention >that think3 is a mostly-Windows shop, too. > >Linux is my preferred platform for most tasks, except that my firewall/etc >machine runs OpenBSD (sometimes security is more important than richness >of features, support for strange hardware, and so on). . . . I'm a tiny surprised; I sincerely thought you were most comfortable with Windows for COM and ADO riches. Alex, do you have any sense of how well "SOME durned webpages ..." look when viewed with IE under Wine on Linux? Are you saying that they *are* acceptable through win4lin-plus-IE? -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From tim at vegeta.ath.cx Sun Dec 2 16:49:20 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Sun, 02 Dec 2001 21:49:20 GMT Subject: The Editor Poll results are in! References: <3bfd7f87@news.airtel.net> <9u4cbu$2ts$1@news.xmission.com> Message-ID: Roy Katz graced us by uttering: > (and I find that Python fits in with my youthful ideals nicely among > others such as Esperanto & being vegan) Is this a 90's thing, where your idealistic fantasies and your programming LOC must be compatible? I take it Lisp and Smalltalk went out with polyester, then? I've heard many people say Smalltalk embodies freedom better than any other language. OTOH, as a vegan, perhaps you can tell me: what's "organic coffee"? > it'd also be cool to see the relative age of new pythonistas -- I > suspect that they're young, but this is completely unfounded. My opinion has always been that new Pythonistas have found Python the same way I did: by keeping their ears open. I heard about Python when its virtues were extolled in comp.lang.perl.misc, so one should never judge their enemies too harshly. ;) Tim Hammerquist -- But the price of getting what you want is getting what you once wanted. -- Morpheus, The Sandman From tripp81 at yahoo.com Thu Dec 6 10:39:29 2001 From: tripp81 at yahoo.com (Tripp Scott) Date: Thu, 06 Dec 2001 22:39:29 +0700 Subject: simple, lightweight component based development in python? Message-ID: <5.1.0.14.2.20011206222835.0507af98@202.95.131.154> is there already a lightweight component framework in python? i need cross platform compatibility so COM is out of my list. there's CORBA and XPCOM and their python ORBs/binding, but i'm still looking for something simpler, straightforward, and more lightweight. i do not see the need to interface to other languages in the near future so a python-only solution will do -- though the possibility of bridging to COM or CORBA would certainly be nice. what i want is a framework that allows me to specifically deal with "components" (i.e.: i design interfaces, implement them with one or more python classes, and later assemble the components). the framework should provide the following functions: - enable a client to locate components which implement a desired interface, and instantiates them; - instantiate a remote component (probably with a simple proxy object mechanism); - transactional feature would certainly be nice; however, i do not desire these features: - some registry database in a binary format of some kind (i'd rather put all my components in a directory and it's automatically "registered"); the application i am building is a non-visual one (to be run over the Web); i am still looking here and there for an existing solution for a couple of weeks, but if none such beast exists will consider to build one myself -- probably only the minimal feature set first. t From tim at vegeta.ath.cx Thu Dec 27 14:12:14 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Thu, 27 Dec 2001 19:12:14 GMT Subject: REPOST: Re: The Python community needs a lighter heart to it. References: <40dbad98.0112261431.3e928cf2@posting.google.com> Message-ID: <7$--$$_-----$%$%-$@news.noc.cabal.int> Chris Gonnerman graced us by uttering: > Tim Hammerquist wrote: > > Your boredom is not cause per se to change the society at large. > > I second that motion. > > I just have one question: Who is Andrew Nguyen and why should we > follow him around anyway? Excellent question! We're gonna seem a few answers. FETCH THE COMFY CHAIR! Tim Hammerquist -- How do I type "for i in *.dvi do xdvi i done" in a GUI? -- discussion in comp.os.linux.misc ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.media.kyoto-u.ac.jp!news.ksw.feedmania.org!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Tim Hammerquist Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:59:20 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775637 27193 211.57.49.2 (31 Dec 2001 05:13:57 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:13:57 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From chrishbarker at attbi.com Tue Dec 4 13:59:33 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Tue, 04 Dec 2001 10:59:33 -0800 Subject: Reading mixed ASCII/bin file-HOW? References: <9uilvj$djm$1@hermes.shef.ac.uk> Message-ID: <3C0D1D15.CA38A24B@attbi.com> josegomez at gmx.net wrote: > I want to read a number of files, all of which have a header, > and then some data. More often than not :-), the data will be binary. I have done this a few times myself. > 31/05/00 16:59:01 > COMMENTS > Cal - C Band. 12 cm tri > ENDOFCOMMENTS > NETWORK ANALYSER SETTINGS > 4, Start Freq (GHz) > 6, End Freq (GHz) > 1601, No. of Freqs per Step > > The order of the parameters (and units) is always the same, so > what I want to do is to read all that information into a dictionary. For > the previous example, that'd be > data = {'Date':"31/05/00", > 'Time':"16:59:01", > 'Comments':"Cal - C Band, 12 cm tri", > 'StartFreq':4.0, > 'EndFreq':6.0, > 'NumFreq':1601} > > Now, I don't reallu understand how this is done, but I guess > that I could parse it through a number of readline() calls. There has to > be a better way though... What's wrong with that way?? A bunch of readline() calls is exactly what you want. For example: data['Date'],data['Time'] = file.readline().strip().split() while 1: line = file.readline().strip() comments = [] if line == "ENDOFCOMMENTS": break comments.append(line) data['Comments'] = "\n".join(comments) .... etc. With a header that is as free-form as this, you really don't have much choice. The NETWORK ANALYSER SETTINGS section could be parsed out all in the same way, but if really has only 3 lines, I'd just read them in and set the values. Note that if you want the numbers as numbers, rather than strings, you'll want to use int() or float() > OK, and now we get to the problem of what to do if the file is > mixed binary/ascii. Basically, after the header, I get a "delimiter" > in ASCII and a bunch of datapoints (to be calculated from the > information on the header). First of all, make sure to open the file in binary mode so your binary data won't get mangled. If you are on *nix, it won't matter, but it's a good habit to get into. On Windows, you are going to get some extra \r-s, but they are whitespace and will be removed with strip(), so it's no big deal. open(filename,'b') look for your delimiter, and after it, read the data with file.read(numbytes). I assumeyou have the number of bytes form the info in the header. To convert the binary data to something Python can understand, you have three options (at least): use the struct module use the array module, and either fromstring or fromfile. use Numeric (http://sourceforge.net/projects/numpy) and the fromstring() function. I highly recommend Numeric, if you are working with a large 2-d array, it is indespensible. > Also, if the data isn't binary and is ascii, > I get a lot of lines containing to numbers. I'm assuming you will know when you read the header. For large tables of ascii numbers, native Python is not so good. You can read() or readline() or readlines() or xreadlines() the data, and then use .split() and int() or float() and maybe map: data = map(float, file.readline().strip().split()) that works fine, but it is kind of slow. For better alternatives, check out SciPy (www.scipy.org), and look for io stuff (also search the web for TableIO and others) > In general, these datapoints fit neatly into a 2D complex array, > and I have to convert the pairs of reals into complex number (Re+j*Im), > for both ASCII and binary types. if the format is right, you might be able to read them straight into a NumPy Complex Array, otherwise, you can easily do: A = zeros((m,n),Complex) A[:,:] = realpart + 1j * complexpart That should get you started. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From aahz at panix.com Thu Dec 27 13:10:09 2001 From: aahz at panix.com (Aahz Maruch) Date: 27 Dec 2001 10:10:09 -0800 Subject: REPOST: Re: A new message board is up References: <40dbad98.0112262232.1868734e@posting.google.com> <40dbad98.0112271006.b98e822@posting.google.com> Message-ID: <2$--$$_----_%_-_-$@news.noc.cabal.int> In article <40dbad98.0112271006.b98e822 at posting.google.com>, Andrew Nguyen wrote: > >and yes, python does need a lighter heart. With friends like these.... -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 4 days and counting ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: aahz at panix.com (Aahz Maruch) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:05:15 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775695 27193 211.57.49.2 (31 Dec 2001 05:14:55 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:14:55 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From uwe at rocksport.de Thu Dec 6 07:40:06 2001 From: uwe at rocksport.de (Uwe Schmitt) Date: 6 Dec 2001 12:40:06 GMT Subject: pickle question Message-ID: <9unov6$c4on9$1@hades.rz.uni-sb.de> Hi, I pickled some data on my local unix machine. When I try to read this data on a windows machine, nothing is pickled at all. Is this a plattform dependend thing ? Any hints, tips ? Greetings, Uwe. -- Dr. rer. nat. Uwe Schmitt Uwe.Schmitt at num.uni-sb.de Universitaet des Saarlandes Angewandte Mathematik Building 36.1 Room 4.17 PO-Box 151150 D-66041 Saarbruecken Mobile:0177/6806587 Fax:+49(0)681/302-4435 Office:+49(0)681/302-2468 From nika at kassube.de Sat Dec 29 14:33:30 2001 From: nika at kassube.de (Nils Kassube) Date: 29 Dec 2001 20:33:30 +0100 Subject: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> Message-ID: <871yhd7red.fsf@kursk.kassube.de> gerson.kurz at t-online.de (Gerson Kurz) writes: [Error checking without exceptions] Okay, now think about how useful your approach is if you call more than one function and there is more than one possible way of things going wrong. Do you really want to maintain error codes this way and give 'em to the function calling your function? > So ? After all, C doesn't need it, and I think few C programmers would > call this feature the "most missing", or? C and programmers who like C should die a slow and painful death for holding back the computer industry for two decades. From rpm1deletethis at frontiernet.net Thu Dec 27 20:47:51 2001 From: rpm1deletethis at frontiernet.net (RPM1) Date: Thu, 27 Dec 2001 20:47:51 -0500 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: "Ron Stephens" wrote in message > I recently read an interview with a Digital Creations top manager where he said > that he hopes someone starts a successful business based solely on providing > ISP services using Zope, with full technical support. Is anyone looking into > this? Does anyone think this could be a successful business model? I am > interested in opinions on this. > "full technical support" That's what gets thrown in my face whenever I mention Python. (And I mention it a lot). The company I work for writes point of sale software in C and VB, because "there's support" and "customers won't pay for something made with freeware." I think if Python wants to get "bigger" or more acceptable, it needs marketing. The guy with the bag of money needs to say, "Oh yeah, Python, I've heard of that." Customers ask us if we have a Java 'solution', they don't ask if we have a Python 'solution'. That's got to change if Python 'wants' to grow more, (I don't know that it does). It seems to me, (with my limited experience), that the most dedicated audience Python has is the scientific community. I would start there. Get some big chemical, pharmaceutical, or biological corporations to use Python, (by catering to their needs), and then they will in turn support the language when they see the wonderful end product. Then people like me can say to my boss, "look Dow, Johnson & Johnson, and ADM all use Python heavily, so there's nothing to be afraid of." Maybe I'm wrong. But it seems to me that Microsoft is ahead, not because of the high quality of their product, but because of there timing and marketing. Patrick From lfini at arcetri.astro.it Wed Dec 5 05:02:41 2001 From: lfini at arcetri.astro.it (Luca Fini) Date: Wed, 5 Dec 2001 11:02:41 +0100 Subject: Learning resources needed In-Reply-To: <9ukp40$90u84$1@ID-106629.news.dfncis.de> References: <9ukp40$90u84$1@ID-106629.news.dfncis.de> Message-ID: On Wed, 5 Dec 2001, Duke wrote: > I am looking to learn Python/Tkinter. I'm a competent C/C++/Java > programmer, however I don't have any experience with Tcl/Tk. I think I can > easily pick up Python from the stuff I found linked on python.org, however I > would be interested in any or all resources specifically addressing > Tkinter - if there are any which cater to a beginning Python user, all the > better. The Tkinter tutorial was good for me. I had a little experience in window based programming in IDL and some development with LabWindows/CVI. See: http://www.pythonware.com/library/tkinter/introduction/index.htm > The other alternative is to buy a book. There only seems to be one specific > to this (Python and Tkinter Programming, John E. Grayson) and it's gotten > mixed reviews as far as I can tell. Should I give Tcl a shot as well? I didn't and lived quite well > Seems to me that Python is, in a way, competing with Tcl as the scripting > engine behind the Tk toolkit. If I learn Tcl/Tk first would it be > relatively simple to move over to Python/Tkinter? I do not believe so. I do not know tcl at all but I've had a look to a "python/tcl/basic" based introduction to programming tutorial (http://www.crosswinds.net/~agauld/) for the very beginner and tcl looks very ugly as a programming language. My feeling is that Tk will survive only because it has very strong bundles with python and perl. > And oh yeah, I've always hated GOOEY programming and this is the first > compromise I am willing to make to get something going on the > non-command-line front ;) > > Thx. > > P.S. Anyone recommending vxPython instead? My main gripe would be that it > wouldn't run in KDE while Tkinter should run in both it & GNOME. Easy[er] > Windblows client libs install is a plus. I started a thread some days ago about a comparison of various widget building environments, namely Tkinter, wxWindows, PyQt and pygtk. You can look in dejanews for the details. Anyway applications built from all of the toolkits can run indifferently on KDE, Gnome and windows too. Cheers, l.f. -- -------------------------------------------------------------------------- -- ) Luca Fini Tel: +39 055 2752 307 ___ |\ Osservatorio Astrofisico di Arcetri Fax: +39 055 2752 292 / | | |-_ L.go E.Fermi, 5 +----------------------------------------- (___|___//___) 50125 Firenze / WWW: http://www.arcetri.astro.it/~lfini (_) (_) Italia / e-mail: lfini at arcetri.astro.it -----------------------------+-------------------------------------------- From sabren at manifestation.com Thu Dec 13 17:36:35 2001 From: sabren at manifestation.com (Michal Wallace) Date: Thu, 13 Dec 2001 17:36:35 -0500 (EST) Subject: Ordered dictionaries? In-Reply-To: <20011213214515.61016.qmail@web21106.mail.yahoo.com> Message-ID: On Thu, 13 Dec 2001, David Brady wrote: > Hello, > > One last Perl module that I need to replace to > complete my Python toolkit is a custom module that let > me create a dictionary whose keys were settable and > retrievable in a particular order. Essentially, this > let us have a list whose ordered elements were also > accessible by name. > > Has anyone done this? If not, what class operators > would I need to override to create my own class that > does this? IdxDict from my zdc package is along these lines. Code is below. Cheers, - Michal http://www.sabren.net/ sabren at manifestation.com ------------------------------------------------------------ Give your ideas the perfect home: http://www.cornerhost.com/ cvs - weblogs - php - linux shell - perl/python/cgi - java ------------------------------------------------------------ """ an indexed dictionary (cross between list and dict) """ __ver__="$Id: IdxDict.py,v 1.5 2001/01/02 02:00:59 sabren Exp $" import UserDict class IdxDict(UserDict.UserDict): __super = UserDict.UserDict def __init__(self): self.__super.__init__(self) self.idx = [] def _toStringKey(self, key): """Convert numeric keys into string keys. Leaves string keys as is""" # handle numeric keys: if type(key)==type(0): if not (0 <= key < len(self.idx)): ## oddly enough, it is this IndexError here ## that allows you to do "for x in myIdxDict:" raise IndexError, `key` + " is out of bounds." # convert it to a string key key = self.idx[key] return key def __setitem__(self, key, item): """ we can only use a numeric key if it's bigger than the length of the index.. eg,after: >>> idx['a'] = 'abc' idx[0] now maps to "a", so: >>> idx[0] = 'xyz' is a reassignment. BUT: >>> idx[1] = 'efg' is a normal assignment. To handle the magic of figuring out the last index, use 'append': >>> idx.append('hijk') >>> idx.keys() ['a', 1, 2] >>> idx[2] 'hijk' """ if (type(key) == type(0)) and (key < len(self.idx)): key = self._toStringKey(key) if not key in self.idx: self.idx.append(key) self.data[key] = item def __getitem__(self, key): key = self._toStringKey(key) return self.data[key] def __repr__(self): res = "{" for key in self.idx: res = res + repr(key) + ": " + repr(self.data[key]) + ", " # strip that last comma and space: if len(res) > 1: res = res[:-2] res = res + "}" return res #### these are so we can treat it like its a list ###### def __len__(self): return len(self.idx) def clear(self): self.__super.clear(self) self.idx = [] def __getslice__(self, i, j): i = max(i, 0); j = max(j, 0) res = [] for item in self.idx[i:j]: res.append(self.data[item]) return res def append(self, other): self[len(self.idx)]=other ### .. or like a dictionary: ######### def keys(self): return self.idx def values(self): return self[:] ### << is a magical append operator ########## def __lshift__(self, other): self.append(other) #@TODO: what should __delitem__ do?? # I'm not going to worry about it now, because # I don't need to delete anything from my lists. From sholden at holdenweb.com Mon Dec 3 17:11:00 2001 From: sholden at holdenweb.com (Steve Holden) Date: Mon, 3 Dec 2001 17:11:00 -0500 Subject: pythoncookbook.com available to good home References: Message-ID: David: I already inherited pythonista.com, and pythoncookbook would be a nice addition if you don't mond passing it on. regards Steve -- http://www.holdenweb.com/ "David Edwards" wrote in message news:mailman.1007387944.12764.python-list at python.org... > Hi, > > I registered the domain pythoncookbook.com a couple of years ago but > never used it. It will be up for renewal in February and I probably > won't renew it. If someone has a use for it that will benefit the > Python community, I will gladly tranfer it to them. > > > David Edwards > From tuttledon at mailandnews.com Fri Dec 28 17:18:28 2001 From: tuttledon at mailandnews.com (Don Tuttle) Date: Fri, 28 Dec 2001 22:18:28 GMT Subject: REPOST: Re: ETA for Win32all under Python 2.2? References: Message-ID: <4$--$$_----_--_%_$@news.noc.cabal.int> FYI, Mark is in transition as he is no longer with ActiveStake. (Seems more accurate then "ActiveState") Read the recent thread "Fate of Win32all" http://groups.google.com/groups?hl=en&threadm=7876a8ea.0112212116.2ebabc23%4 0posting.google.com&rnum=1&prev=/groups%3Fq%3Dfate%2Bof%2Bwin32all%26hl%3Den %26group%3Dcomp.lang.python.*%26rnum%3D1%26selm%3D7876a8ea.0112212116.2ebabc 23%2540posting.google.com Don "David Brady" wrote in message news:mailman.1009566632.18455.python-list at python.org... > GAAAAAH! It doesn't exist yet! > > I want to say something bitter, like "Python is dead > to me," but saying "Python 2.2 is as yet unborn to me" > just comes off wobbly and obtuse. > > Mark, I recall a poster I had in the mid-80's that had > definitions of various computer terms on it. It had > the following definition: > > CHAINING: Method of attaching programmers to their > desks to increase output. > > Is Win32all for 2.2 done yet? If you write back to > say no, I'll be forced to beat you for fiddling with > e-mail when you should be writing code... :-) > > Ah, but seriously. Great package. So great that I > really can't afford to move to Python 2.2 until > Win32all supports it... so, if threats don't work, > I'll resort to bribes and then to begging. Tell me > where you want the cookies sent. :-) > > Any idea of an ETA? > > So-anxiously-awaiting-Win32all-that-I'm-copying-Mark's-sig-style > ly, > > -dB > P.S. There's a longstanding rule in my family: you're > not allowed to complain about anything you could fix > yourself. I'd offer to help, but "a beating" was the > funnier of the two threats. :-) > > ===== > David Brady > daves_spam_dodging_account at yahoo.com > I'm feeling very surreal today... or *AM* I? > > __________________________________________________ > Do You Yahoo!? > Send your FREE holiday greetings online! > http://greetings.yahoo.com > ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!nycmny1-snh1.gtei.net!news.gtei.net!newsfeed.mathworks.com!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Don Tuttle" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:39:32 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775017 27193 211.57.49.2 (31 Dec 2001 05:03:37 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:03:37 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From loewis at informatik.hu-berlin.de Wed Dec 26 19:48:03 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 27 Dec 2001 01:48:03 +0100 Subject: REPOST: Re: references for shifting from Py1.5.2 to Py2.2? References: <3c2a5cd1_2@corp.newsgroups.com> Message-ID: <7$--$$-$$$$%__%%-$@news.noc.cabal.int> "Joshua Muskovitz" writes: > One thing I *don't* need is a porting guide -- I'm not trying to move *code* > from 1.5.2 to 2.2, just my own understanding of the language for my own > future projects. I recommend to read Andrew Kuchlings "What's new" summaries in sequence (i.e. for 2.0, 2.1, 2.2); you'll find them on the release pages for each release. Reading them should a) not take more than an hour or so, b) should give you a good overview of what's new, and c) allow you to dig deeper into things that are interesting. You'll find that there hasn't changed that much; for some problems, there is now more than one way to do it. If it is the new libraries you are after, you should find the "more important" ones listed in Andrew's summaries as well - you can then go to the library documentation. If that is not detailed enough, search the library documentation for "versionadded" markup. If that is still not detailed enough, read Misc/NEWS. If you merely want to have a book for reference on your desk, please understand that books will be always behind. Finding a book today that has all details on Python 2.2 will turn out impossible, unless you print out the library documentation. HTH, Martin ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Martin von Loewis Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:16:45 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009776103 27193 211.57.49.2 (31 Dec 2001 05:21:43 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:21:43 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From mwh at python.net Mon Dec 3 04:47:07 2001 From: mwh at python.net (Michael Hudson) Date: Mon, 3 Dec 2001 09:47:07 GMT Subject: Python-2.2b2 bug? Misc/Makefile.pre.in References: Message-ID: Marcin 'Qrczak' Kowalczyk writes: > Sat, 01 Dec 2001 20:59:05 GMT, Fredrik Lundh pisze: > > > Fri Oct 26 14:54:16 2001 UTC (5 weeks, 1 day ago) by akuchling > > FILE REMOVED > > Delete Makefile.pre.in (BDFL pronouncement) > > 1. postgresql needs it to build. I copied the version from an older > Python and it seems to work. What should postgresql do instead? Use distutils. > 2. Python-2.2b2 has installed Makefile.pre.in from the root of the > source tree instead, which is different from one in Misc (e.g. no > 'boot' target). Was it supposed to work? I think that's something else entirely. Could be wrong though. Cheers, M. -- same software, different verbosity settings (this one goes to eleven) -- the effbot on the martellibot From rdsteph at earthlink.net Sat Dec 29 20:01:35 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sun, 30 Dec 2001 01:01:35 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <458b194a.0112282052.1123341@posting.google.com> Message-ID: <6$--$$_----_-%$_-$@news.noc.cabal.int> Good points, if Python had "food enough" database, gui, and web components on top of Python, it coudl be a ture "killer language" for these times.... By the way, I am re-checking out PythonCard today, and i am impressed again, especially tha tthe documentation has progressed quite a bit. Good stuff....check out the documentation at http://pythoncard.sourceforge.net/toc.html ... robin at brainexeculink.com wrote: > rcena at epcor.ca (Resty Cena) wrote: > > >Whichever can provide what it is that VB > >developers like about VB on top of what Python and Ruby natively offer > >will hit the jackpot. To me these are: (a) Visual drag-and-drop > >application builder with data aware controls, and (b) good support for > >the big databases (Oracle, Sybase, Informix). > > Yes. > > Snap-in database support -- not only for the big databases but for > lightweight solutions as well -- makes VB popular. And it's a big > reason people use PHP (to wander into another branch of this thread). > > Python needs standard database modules with a high degree of interface > conformance -- more than what the current DB API provides. And these > need to *work*. I can't tell you how much time our company wasted > looking for the best PostgreSQL interface, for example. > > Since I'm talking databases, I wish someone with more time and brains > than I would pick up the Gadfly project and bring it up to date. We > need a pure Python SQL database. That too would help "sell" the > language. > > As far as GUIs go, either Boa Constructor or something like the anygui > project has the potential to be the Python "killer app". > > A third application domain that needs to grow in maturity and > standardisation is server-side web pages. Not everyone wants to write > their own framework (though I have). There should be an out-of-the-box > module that easily integrates Python with Apache and takes care of > most of the dirty work. > > Standardisation is more important than sophistication. > > I would love for all the brilliant Python contributors to stop right > here at version 2.2 and put all their talents into these three areas. > The core language is just fine, thank you. The existing modules are > mostly very good. What is needed are database, gui, and web components > to turn this language into a full development package. > > The payoff would be immense. > > >With VB.NET, VB > >programmers will ask, "What's the point?" Might as well dive into C#. > > I did precisely one project in VB way back in version 2-3 days. It > didn't take me very long to say "What's the point?" Then I went out > and bought some C++ books. [shudder] > > VB is popular even though it doesn't work. PHP is popular even though > it works in a small domain. But both products work "well enough". > That's the key. > > Python does not yet work "well enough" in the most common problem > domains. It requires too much wheel re-invention. > > ----- > robin > robin at brainexeculink.com > (remove "brain" to reply) ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E688C.13DE2394 at earthlink.net> Control: cancel <3C2E688C.13DE2394 at earthlink.net> Date: Mon, 31 Dec 2001 03:55:05 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774859 27193 211.57.49.2 (31 Dec 2001 05:00:59 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:00:59 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From usenet at thinkspot.net Sun Dec 30 01:02:57 2001 From: usenet at thinkspot.net (Sheila King) Date: Sat, 29 Dec 2001 22:02:57 -0800 Subject: Is learning Python "extraordinary"? References: <3C2E5706.5880983E@engcorp.com> <3C2EAD4D.77564075@engcorp.com> Message-ID: On Sun, 30 Dec 2001 00:59:41 -0500, Peter Hansen wrote in comp.lang.python in article <3C2EAD4D.77564075 at engcorp.com>: > It is still my opinion that a bright person who has learned > several computer languages can learn Python enough to start > working on non-trivial tasks with not much more than a week > of learning, but that opinion is based solely on observation > of a dozen perhaps quite bright people doing just that. I agree with the above assessment. Still, it is unusual, in the least to find high school students that know 3+ programming languages. (Well, maybe not in the heart of the Silicon Valley.) Anyhow, I think Jesse has probably decided by now, that it is certainly worth mentioning in his essay. ;) -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org/ From news-fr at maniacosex.com Tue Dec 4 20:54:08 2001 From: news-fr at maniacosex.com (news-fr at maniacosex.com) Date: Wed, 05 Dec 2001 02:54:08 +0100 Subject: [MANIACOSEX.COM] Ajoutez vos sites et galeries ! Message-ID: <20011205021213.5792F36161@mail2.fr.clara.net> Bonjour, Ce message s'adresse a tous les webmasters X. Vous pouvez d?s a pr?sent inscrire votre site, vos galeries photos et vid?os sur notre annuaire International du Sex MANIACOSEX.COM Version fran?aise : http://www.fr.maniacosex.com/html/sommaire.cfm English version : http://www.uk.maniacosex.com/html/sommaire.cfm Versi?n espa?ola : http://www.sp.maniacosex.com/html/sommaire.cfm Deutsche Version : http://www.de.maniacosex.com/html/sommaire.cfm Rejoignez l'un des futurs plus grands portails du Sex et syst?mes TGP du WEB. Notre site fera grimper, grimper, grimper votre audience... A tr?s bient?t. Si vous ne souhaitez plus recevoir nos messages Cliquez ici pour vous d?sabonner : http://www.fr.maniacosex.com/html/mailing.cfm?email=python-list at cwi.nl&state=remove From tanzer at swing.co.at Mon Dec 3 02:38:43 2001 From: tanzer at swing.co.at (Christian Tanzer) Date: Mon, 03 Dec 2001 08:38:43 +0100 Subject: A modest indentation proposal In-Reply-To: Your message of "03 Dec 2001 05:20:12 GMT." Message-ID: quinn at krone.ugcs.caltech.edu (Quinn Dunkan) wrote: > For example, I'm often tempted to use __getattr__ for delegation or lazy > evaluation or plain old getters/setters. But (IMO) language flaws make > __getattr__ and __setattr__ very hard to use, because of their interaction > with all the __magic__ attributes. (snip) > Since new magic attributes seem to pop up every day, what about > existing __getattr__-using code that had all the holes patched up, but > is now going to explode because suddenly python wants to look up an > __eq__ method where it never did before? I fell into the same trap once or twice and nowadays I always start a __getattr__ with: if name.startswith("__") and name.endswith("__"): raise AttributeError, name If I really want to handle a magic attribute I can always do it explicitly -- don't think I ever did yet. -- Christian Tanzer tanzer at swing.co.at Glasauergasse 32 Tel: +43 1 876 62 36 A-1130 Vienna, Austria Fax: +43 1 877 66 92 From grahamd at dscpl.com.au Sun Dec 23 18:02:52 2001 From: grahamd at dscpl.com.au (Graham Dumpleton) Date: 23 Dec 2001 15:02:52 -0800 Subject: Leading distributed object packages for python? References: Message-ID: Syver Enstad wrote in message news:... > I am checking out Fnorb, and Pyro, and have already used win32com. Are > these the leading distributed object packages for pyton? Somewhat related is OSE. Check out: http://ose.sourceforge.net From carlca at dircon.co.uk Fri Dec 14 16:16:11 2001 From: carlca at dircon.co.uk (Carl Caulkett) Date: Fri, 14 Dec 2001 21:16:11 -0000 Subject: Fallen Angels, Originators of Evil on Planet Earth? References: Message-ID: In article , news at originsofevil.com says... > FREE INTERNET BROADCAST TALK ON: > Tuesday, December 18, 2001, at 7 PM (CST) > http://www.originsofevil.com/ > > Fallen Angels, Originators of Evil on Planet Earth? Okay. I think this Tab vs Space thread has gone just far enough. -- Carl From oren-py-l at hishome.net Sun Dec 2 08:06:26 2001 From: oren-py-l at hishome.net (Oren Tirosh) Date: Sun, 2 Dec 2001 08:06:26 -0500 Subject: Draft PEP: string interpolation with backquotes Message-ID: <20011202080626.A76724@hishome.net> PEP: XXXX Title: String interpolation with backquotes Author: oren at hishome.net (Oren Tirosh) Created: 2-Dec-2001 Abstract This document proposes a string interpolation feature for Python to allow easier string formatting. The suggested syntax change is the introduction of a new 'i' prefix for strings that triggers the special interpretation of the backquote "`" character within a string. Example: i"X=`x`, Y=`calc_y(x)`." Copyright This document is in the public domain. Specification A new character prefix "i" is defined for strings. This prefix precedes the "u" and "r" prefixes, if present. The prefix "i" stands for "interpolation" or "in-line". Within a string with an "i" prefix an expression enclosed in backquotes is converted into its string representation and embedded into the string. An empty interpolation ("``") is not allowed. The expression may be any valid Python expression not containing the backquote character. Since the backquote character may be replaced with the repr() function this does not present any actual limitation on embedded expressions. Rationale A similar proposal was made by Marnix Klooster in a python-list posting [1] without the "i" prefix. Marnix noted that this is the way it is done in Python's ancestor ABC from which it inherits many features and design decisions. The most apparent difference between this proposal and a previous proposal by Ka-Ping Yee [2] is the use of backquotes rather than the '$' character. Backquotes are familiar to Pythoneers as equivalent to the repr() function whereas the $ notation is alien to Python. With backquotes there is only one interpolation format with simple rules compared to $ interpolation which uses a tricky algorithm to detect the end of the interpolation or the use of an alterative format with braces. A more significant but less apparent difference is that with this proposal the embedded expressions are not characters in a string - they are real Python expressions compiled into byte code and the validity of the interpolation syntax and the syntax of embedded expressions is fully checked at compile-time. This design does not sneak runtime evaluation or lazy evaluation into the language in the back door. To get lazy-evaluated string interpolation the programmer may explicitly use a lambda function consisting of a single interpolated string. Implementation notes Most of the logic of this proposal is in the tokenizer. The example above is broken down into the following tokens: - INTERPOLATE - NAME <`, Y=`> - INTFRAG (interpolation fragment) - NAME <(> - LPAR - NAME <)> - RPAR <`."> - DETERPOLATE An INTERPOLATE token instructs the compiler to start a tuple. An INTFRAG is similar to a comma separating items in a tuple and the DETERPOLATE token terminates the tuple. The code generated by this form of interpolation may be the same as that generated by the "%" operator. The INTERPOLATE, INTFRAG, and DETERPOLATE tokens are concatenated together, any "%" characters in the string are replaced with "%%", the now-empty backquotes "``" are replaces with "%s". Finally, the "%" operator is applied to the resulting string and the tuple. Correctly generating INTFRAG and DETERPOLATE tokens requires some stateful logic in the tokenizer. If the INTERPOLATE token started with a single quote an INTFRAG may not contain and unescaped single quote and DETERPOLATE ends with a single quote. Similar rules apply to interpolations with double quotes, triple single quotes and triple double quotes. State 0 - Default state. A backquote is a single character BACKQUOTE token. State 1 - backquote starts an INTFRAG or DETERPOLATE that ends with "'". State 2 - backquote starts an INTFRAG or DETERPOLATE that ends with '"'. State 3 - backquote starts an INTFRAG or DETERPOLATE that ends with "'''". State 4 - backquote starts an INTFRAG or DETERPOLATE that ends with '"""'. Reference implementation A reference implementation in the form of a preprocessor for Python sources files is available at: http://www.tothink.com/python/interpp This prepreocessor is based on a modified version of Ka-Ping Yee's tokenize.py module. Security String interpolation involving actual run-time parsing of a string opens many potential security holes. This form of interpolation should be secure against this class of attacks. References [1] 1996/11/07 python-list posting (Marnix Klooster) http://groups.google.com/groups?group=comp.lang.python &selm=328195a1.1211700%40news.worldonline.nl [2] PEP 215, String Interpolation (Ka-Ping Yee) http://www.python.org/peps/pep-0215.html From fperez528 at yahoo.com Thu Dec 6 13:08:56 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Fri, 07 Dec 2001 17:36:56 +2328 Subject: Hiding stuff like passwords in source? References: Message-ID: <9urnd7$ph6$1@peabody.colorado.edu> David Brady wrote: > > What I'm wondering is if there's a way to encrypt, > hide or otherwise modify the way I'm using my user > info so that unless I am logged in at my machine, the > user info is unusable and unreadable. > Of course what I'm going to suggest gives only *mild* security, not real one, I know. But it's a lot better than what you have, and easy. Write your scripts so that by default they all read certain info from a file such as .personal_info stored in your home directory (and read-accessible only for you, so that people have a slightly harder time snooping into it). This file would be plaintext and of the form user _name_ pass xxxxx key value ... Just a bland list of key/value pairs which you can then read (not import). If you mail the script to anyone else, they can write a similar file with their info for their own use. Your scripts can be set up so that if such file is missing they just ask for the info on-screen, that way they operate interactively for anyone but have a convenient (if not too secure) way to get automated. A number of ftp programs out there work on this principle. If someone can have physical access to your machine, then you need real security, and that's a different tune altogether. This is convenience for the day to day stuff while blocking at least the most stupid security breaches, not the serious problems. Cheers, f From wurmy at earthlink.net Tue Dec 18 01:02:54 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Tue, 18 Dec 2001 06:02:54 GMT Subject: Dear python-list New Lolitas Site For You References: Message-ID: <3C1EDA7F.5F6D7BDF@earthlink.net> beauchjo at kai.ee.cit.ac.nz wrote: > > Hi. > Only best young girls are selected for you on this site! > http://hot-sexy.cc > Nothing impossible in lolitas world! Cool! Can they help me with my cgi module? From logiplexsoftware at earthlink.net Thu Dec 20 16:52:34 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Thu, 20 Dec 2001 13:52:34 -0800 Subject: /usr/bin/env: python: No such file or directory In-Reply-To: <3C225488.AF5C93F4@attbi.com> References: <915a998f.0112161542.2ab07235@posting.google.com> <3C222B16.C1B1BC8D@attbi.com> <3C225488.AF5C93F4@attbi.com> Message-ID: <20011220135234.084d3cbb.logiplexsoftware@earthlink.net> On Thu, 20 Dec 2001 13:13:44 -0800 Chris Barker wrote: > There are two problems here: > > 1) This would only work if we all, as a community, established this > convention. So far I have only seem "python" used, for all versions... Very true. > 2) It only applies to *nix. Windows and the Macintosh would need > different conventions. I think a platform independent Python based > solution is a better way to go. I don't disagree. [snip] > > >> It might be helpful if the python interpreter took a flag such as > >> --required-version or >> --minimum-version so that a warning could > >> be printed if the script requires a version different than what is > >> available on the system. > > How would the interpreter know what version was required? That's exactly > what I think we need...A way to tell the interpreter what version is > required by a script. That is what the flags would be for: to tell the interpreter what version/minimum version is required. Of course, since only Unix supports shebang scripts (does Mac OS X ? It is Unix, isn't it? Sort of?) this wouldn't be much help on other platforms. How about #pragma directives? =) Regards, -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From jason at jorendorff.com Thu Dec 20 04:49:20 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Thu, 20 Dec 2001 03:49:20 -0600 Subject: threading.py -> winthreading.c : Call for benchmark code In-Reply-To: Message-ID: Everyone, I am reimplementing parts of threading.py in non-portable Win32-only C. Lock and RLock are already working. Tests show: winthreading.Lock is about 25% faster than threading.Lock. winthreading.RLock is about 26 times as fast as threading.Lock! But I'm not sure these numbers translate into real-world gains. So: I'm looking for Python code that shows how these objects (Lock, RLock, Condition, Semaphore, Event) are used in the wild. If you're interested in a 26x faster RLock, please send me real-world Python code that could benefit. Thanks in advance, Jason Orendorff [Technical note: I discovered something neat. Everything I do, or check, or set, or increment in C code is protected by the global interpreter lock. This eliminates a lot of the complexity of writing good threading code, because I don't have to worry about doing anything atomically! I can avoid functions like InterlockedIncrement() and InterlockedExchange(). The resulting code is clearer and faster.] From chrishbarker at attbi.com Mon Dec 3 16:43:20 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Mon, 03 Dec 2001 13:43:20 -0800 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <3C0BE492.5DACEA18@mega-nerd.com> Message-ID: <3C0BF1F8.FD0BA512@attbi.com> Erik de Castro Lopo wrote: > You really ought to try using nothing but tabs for indentation and setting the > tab width in your editor to whatever you prefer. > > This is so easy and works **SO** well. until you post your code to a milaing list or newsgroup...sigh. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From richard at bizarsoftware.com.au Mon Dec 3 17:43:01 2001 From: richard at bizarsoftware.com.au (Richard Jones) Date: Tue, 4 Dec 2001 09:43:01 +1100 Subject: HOWTO: Programming S/MIME in Python with M2Crypto In-Reply-To: <3C074399.17CA2613@stroeder.com> References: <3C074399.17CA2613@stroeder.com> Message-ID: <200112032242.fB3MgS327627@bigboy.bizarsoftware.com.au> On Friday 30 November 2001 19:30, Michael Str?der wrote: > Richard Jones wrote: > > Netscape 6+ aka Mozilla aka "nobody uses S/MIME, it's not important, > > so we won't bother implementing it" aka *grrr* ... > > Currently there is work done on S/MIME in the Mozilla project. Ah yes, but until enough people said "WTF?" they were happy to see it implemented some time after their 1.0 release. > > You need to revert to a _useful_ email package, like the one with > > Netscape 4.7 or Outlook (the only two mail packages that I know of that > > support S/MIME in a graphical environment.) > > Note that Netscape 4.x has interoperability problems with e.g. > wrapped header lines which affects e.g. S/MIME e-mails sent by > Outlook... On the other hand, Outlook doesn't handle an S/MIME sub-part and Netscape does. Ahh, it's an imperfect world :) Richard From matt at avaquest.com Thu Dec 13 11:25:31 2001 From: matt at avaquest.com (Matthew King) Date: Thu, 13 Dec 2001 11:25:31 -0500 Subject: distutils, shared libraries and Mac OS X References: <3C17C2B5.8060607@avaquest.com> Message-ID: <3C18D67B.6060505@avaquest.com> Matthew King wrote: > this worked, but I'm curious if there was a better way to do it? update... there is a better way. patch #450862 in sourceforge already addresses this. - matt From duncan at NOSPAMrcp.co.uk Thu Dec 13 07:51:16 2001 From: duncan at NOSPAMrcp.co.uk (Duncan Booth) Date: Thu, 13 Dec 2001 12:51:16 +0000 (UTC) Subject: Calling member functions? References: Message-ID: "David Dawkins" wrote in news:U60S7.9819$hg1.986922 at news6-win.server.ntlworld.com: > I can't quite get this right. How can I give an object instance and a > method as a callback for some other module/class to call at a later > point? Generally you dont. You just pass the method on its own: class Handler: def Callback(self): print "Callback called" class Notifier: def __init__(self, method): self.m_method = method def notify(self): self.m_method() h = Handler() n = Notifier(h.Callback) n.notify() # Calls h.Callback() h.Callback is a bound method. If you call it, then it calls the Callback method on the h instance. What you were doing was attempting to use it as though it were an unbound method. Calls to h.Callback take no arguments. Handler.Callback would be the unbound method. Calls to Handler.Callback take one argument. Your original code probably works if you pass in h and Handler.Callback, but usually it is cleaner to pass a single object for the callback rather than two. A third option is to pass in h and the name of the callback method as a string and call it using getattr, but while this is sometimes useful it is generally messy. -- Duncan Booth duncan at rcp.co.uk int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3" "\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure? From ssthapa at classes.cs.uchicago.edu Tue Dec 18 12:13:43 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Tue, 18 Dec 2001 17:13:43 GMT Subject: How to know that a second application has finished? References: <3C1F6F21.C03A3ABC@cicei.ulpgc.es> Message-ID: Enrique wrote: > Let me put my question again, in a different and more >general form. I have a Python program that launches a GUI >application in a separate window via COM. I am using Python >2.1.1 with win32 extensions in MS-Windows (win95/98/NT) > >Is it possible to suspend the main Python program until the >COM application has finished? (has been closed). >I want to resume from that point onwards. How the main >program gets information of the state of other applications >launched from it? I'm not sure about COM but on unix one way to do this would be to do a os.fork(), followed by a os.wait. On windows I believe you could do something like os.spawnv with the P_WAIT flag. Instead of spawning the application directly, maybe you could spawn another python script that then controls the GUI app using COM. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From phd at phd.pp.ru Fri Dec 21 04:04:33 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Fri, 21 Dec 2001 12:04:33 +0300 Subject: PyGame on Lamp Message-ID: <20011221120433.A4938@phd.pp.ru> http://www.onlamp.com/pub/a/python/2001/12/20/pygame.html Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From syver-en+usenet at online.no Mon Dec 17 21:12:05 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 18 Dec 2001 03:12:05 +0100 Subject: Python CPAN beta test References: Message-ID: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) writes: > I've gotten ciphon to the point where I tihnk it's ready for beta > > testing and am looking for people willing to help test it. Currently > ciphon has readline support, dependency handling, automatic updates > of server and package lists and a few other things. There are > currently 5 packages in the repository (wxpython, pygresql, numeric, > pil, and egenix-mx-base) but I'll be adding more. Very cool, but I have problems accessing the site, trying both with emacs and with internet explorer. -- Vennlig hilsen Syver Enstad From jp at NOSPAMdemonseed.net Fri Dec 14 12:47:02 2001 From: jp at NOSPAMdemonseed.net (jason petrone) Date: Fri, 14 Dec 2001 17:47:02 +0000 Subject: Unsung Python modules References: <3dsnad226b.fsf@ute.mems-exchange.org> Message-ID: Andrew Kuchling wrote: > What's your favorite unsung module? I'm unsure what counts, but if PIL is considered unsung, I suppose I can claim Numeric as my favorite module. With Numeric I can use python for Real Work. Who needs Mathematica? Who cares about Matlab? I have python+numeric+gnuplot. Also, I love VIM's embedded python interpreter. I use xemacs occasionally for english writing(as opposed to code). My .emacs file is almost 400 lines of custom elisp. Thankfully customization of VIM doesn't require thinking polish-- I can just write python code to do the heavy stuff. Now if only my window manager(sawfish) spoke python instead of lisp... jp From tim at vegeta.ath.cx Sat Dec 15 16:22:53 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Sat, 15 Dec 2001 21:22:53 GMT Subject: Unsung Python modules References: <3dsnad226b.fsf@ute.mems-exchange.org> Message-ID: Tim Hammerquist graced us by uttering: > Skip Montanaro graced us by uttering: >> I agree on the readline module (don't have a lot of need to text >> file processing that sys.stdin.readlines() won't handle). > > ... Sure, sys.stdin.readlines() will do until I have to parse a > daemon log or flat text db; then there's no good reason or even > advantage to loading the whole file in memory at once. I found an excellent example of this in the course of almost crashing my computer: Using kpackage I tried to get the list of files included in the mozilla-0.9.5 rpm that came with my Mandrake 7.2 distro. There were a lot of files. Not to put too find a point on it, but if I hadn't doubled the recommended size of my swap partition, kpackage would've crashed the machine! This is no big deal for the command-line rpm because it iterates over the filenames as it reaches them, and doesn't have to store them a single, huge memory glob. ...which is why: for x in fileobject.xreadlines(): ... ...is more scalable than: for x in fileobject.readlines(): ... ...and isn't scalability the buzzword that everyone drops when promoting Python? =) Tim Hammerquist -- The biggest problem with communication is the illusion that it has occurred. From sabren at manifestation.com Sun Dec 16 16:27:46 2001 From: sabren at manifestation.com (Michal Wallace) Date: Sun, 16 Dec 2001 16:27:46 -0500 (EST) Subject: dictionary viewer In-Reply-To: <9vj1db$fpa$1@news.doit.wisc.edu> Message-ID: On Sun, 16 Dec 2001, Erika Skoe wrote: > are there any tools for viewing a dictionary and its contents in some > formatted form? i have pickled dictionaries which are made of several > layers of nested dictionaries, and would like a way to view the whole thing > at once. check out the standard pprint module. Cheers, - Michal http://www.sabren.net/ sabren at manifestation.com ------------------------------------------------------------ Give your ideas the perfect home: http://www.cornerhost.com/ cvs - weblogs - php - linux shell - perl/python/cgi - java ------------------------------------------------------------ From teg at redhat.com Mon Dec 3 10:43:27 2001 From: teg at redhat.com (Trond Eivind =?iso-8859-1?q?Glomsr=F8d?=) Date: 03 Dec 2001 10:43:27 -0500 Subject: pygettext examples? References: Message-ID: Martin von Loewis writes: > teg at redhat.com (Trond Eivind =?iso-8859-1?q?Glomsr=F8d?=) writes: > > > gettext.textdomain(PROGNAME) > > _=gettext.gettext > > I would recommend against setting the textdomain globally. Instead, > always use dgettext. That makes it possible to use your code as a > library in a different program as well, with little coding overhead. The code was snipped from a small startup program using those libraries :) -- Trond Eivind Glomsr?d Red Hat, Inc. From phd at phd.pp.ru Wed Dec 19 23:02:39 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Thu, 20 Dec 2001 07:02:39 +0300 Subject: SMPP module in Python ? In-Reply-To: ; from infobot@skinnyhippo.com on Thu, Dec 13, 2001 at 08:56:20PM -0800 References: Message-ID: <20011220070239.B22021@phd.pp.ru> On Thu, Dec 13, 2001 at 08:56:20PM -0800, chas wrote: > Has anybody's done any work with SMPP with Python, and > perhaps even created the beginnings of an SMPP module ? I have SMPP module in my archive. It is not mine, I downloaded it (3-4 years ago) from the Net and adapted a bit to my needs. I sent patches to the module author (I found him with Google)... but I repeated the search now, and it seems he disappeared. I can find the module in my archives. Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From bkc at Murkworks.com Wed Dec 19 19:45:16 2001 From: bkc at Murkworks.com (Brad Clements) Date: Wed, 19 Dec 2001 19:45:16 -0500 Subject: Update Oreilly books? References: <3C1E3805.6090009@home.com> <20011219074308.GA30387@kub.nl> <47d2cd7c.0112190715.5898f485@posting.google.com> Message-ID: <3c21352f$1_2@news.newsgroups.com> I'd like to see a Pocket Reference for Python 2.2 I'd certainly buy that, just like I did the first edition. -- Brad Clements, DevNet Sysop 5 Developer Network Sysop Team "Laura Lewin" wrote in message news:47d2cd7c.0112190715.5898f485 at posting.google.com... > Hi, > I'm glad you like the new pocket reference (Python Pocket Reference, > 2nd Edition). It does fit well as an adjunct to Programming Python, > 2nd Edition. As I've noted earlier, I have heard a lot of feedback on > Programming Python, 2nd Edition requiring more language reference > material, and we will certainly take that into account for the third > edition (though we are not revising the book just yet--Lutz is working > on Learning Python, 2nd Edition at the moment with David Ascher). In > the meantime, I hope the new edition of Python Pocket Reference fills > that gap (I'm hearing it does). > Look forward to more feedback like this. I do take your comments very > seriously. > Laura > LLewin at oreilly.com > > Kirill Miazine wrote in message news:... > > * Bas van Gils [20011219 08:43]: > > > > I agree... Programming Python is a massive treasure trove of topics. It > > > > just covers so much. The Tkinter section is great and pretty extensive, > > > > the networking and CGI areas are good as well. Then there are the > > > > sections on system scripting and so forth. It is well rounded. My only > > > > complaint is the excessive code redundancy--they could have shaved > > > > 100-200 pages off the thing by not reprinting an entire code example > > > > when one or two lines change... > > > > > > I am a believer as well :-) The first edition of PP was my intro in the > > > world of Python. I still think mr. Lutz dit an excellent job on that > > > > Mine too, but I started with PP2. > > > > > one. I recently purchased the second edition and am reading it back to > > > back. IMHO the book is written in a consistent manner, has lots of humor > > > in it and many insightfull examples. > > > > Yes. But as I mentioned before, some people (including me) expected more > > of a reference book (like Programming Perl is). But examples are always > > great and Python Pocket Reference together with Programming Python make an > > unbeatable combination. > > > > > However, I agree that some improvements should be made on the index. It > > > is sometimes hard to find what one needs. Thats why I also bought > > > "Python Pocket Reference"... > > > > I got my Python Pocket Reference 2 Edition yesterday. It's a lot better > > than PPR1. Highly recommended. -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- From quinn at hurl.ugcs.caltech.edu Tue Dec 18 23:35:54 2001 From: quinn at hurl.ugcs.caltech.edu (Quinn Dunkan) Date: 19 Dec 2001 04:35:54 GMT Subject: Dictionaries as records References: Message-ID: On Tue, 18 Dec 2001 18:24:44 -0600, Skip Montanaro wrote: > > Bill> I have a file with 200K records and 16 fields. This file is > Bill> parsed and each row is put into a dictionary and the dictionary is > Bill> added to a list. The raw file is only about 50mb. > > Bill> I was shocked to see that my memory use jumped to 500MB! When I > Bill> delete the list the memory is returned to the system, so I know > Bill> that the memory is being used in the dictionaries. > > ... > > Bill> Can someone who has faced this issue and found a workaround please > Bill> fill me in. I know one can use a list of lists or a list of > Bill> tuples, but had rather stick to the dictionaries because of some > Bill> library issues. > >You might want to consider storing it in an on-disk mapping object. Check >out the anydbm, bsddb, gdbm modules and the like. Aside from not chewing up >gobs of RAM, script startup should be faster as well, because you won't have >to parse the file and initialize the dict. You could use a list of tuples stored in a class which will wrap up an element however you want: class DB: records = [(foo, bar, ...), (baz, faz, ...), ...] def name(self, n): name, age, spin = self.index_by_name[n] return {'name': name, 'age': age, 'spin': spin} # or return Foo_object(name, age, spin) I've used this for largish (but not large enough to bother with a 'real' DB) DBs. This won't work if your 'library issues' want to mutate the record in place. Well, it would work, but could be clumsy: ent = db.name('fred') library.issue(ent) db.update(ent) ... but maybe that's good because then you don't have to worry about library.issue exploding half way through and leaving the record broken. If you want to be all cute you could have DB wrap records in a dict-like that keeps a (weak, cuz of cycles) reference to the DB and whose __setitem__ mutates the DB. You could then turn around and marshal the whole thing to disk, but if you can control the format of the data input file, you might be better of with Skip's suggestion. From chrishbarker at attbi.com Mon Dec 3 16:42:26 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Mon, 03 Dec 2001 13:42:26 -0800 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BE445.2D4EDF72@mega-nerd.com> Message-ID: <3C0BF1C2.E12421D0@attbi.com> Erik de Castro Lopo wrote: > > I've considered that on many occasions; one such step might be to > > simply REJECT a commit of a .py file with tabs in it. > > How about a counter proposal? > > Reject all .py files with spaces for indentation. Either one would be fine with me...and better than allowing either (especially mixed...Yikes!!!) -Chris -- Christopher Barker, Ph.D. ChrisHBarker at home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From hgg9140 at seanet.com Fri Dec 28 16:16:07 2001 From: hgg9140 at seanet.com (Harry George) Date: 28 Dec 2001 13:16:07 -0800 Subject: UML/XMI et al Message-ID: I'm working with several CASE tools, some of which have XMI interfaces. I want to drive code in and out of them (and generate SQL code for several DBMS's) using python. Anyone working in this area? I have already done a generator for UML/XMI DTD --> python classes, and MySQL and PostgreSQL SQL code generators. Also looking at tcm and dia (e.g., hooking up to dia2code). -- Harry George hgg9140 at seanet.com From phd at phd.pp.ru Wed Dec 19 23:38:04 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Thu, 20 Dec 2001 07:38:04 +0300 Subject: Can I change a unicode char to gb2312 using python? In-Reply-To: <9vrk0m$h6rua$1@ID-12869.news.dfncis.de>; from store_li@sina.com on Thu, Dec 20, 2001 at 10:54:29AM +0800 References: <9vq6d9$gvc5p$1@ID-12869.news.dfncis.de> <9vrk0m$h6rua$1@ID-12869.news.dfncis.de> Message-ID: <20011220073804.E22021@phd.pp.ru> On Thu, Dec 20, 2001 at 10:54:29AM +0800, Kick wrote: > One piece additional, the python said unknown encoding. :-< There is a seprate project somewhere on sf.net that hs many oriental encodings. I don't rememeber its name, and cnnot find it... but it should be there. Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From peter at engcorp.com Fri Dec 28 11:52:15 2001 From: peter at engcorp.com (Peter Hansen) Date: Fri, 28 Dec 2001 11:52:15 -0500 Subject: pth files - can they prepend to sys.path? References: Message-ID: <3C2CA33F.20274814@engcorp.com> Skip Montanaro wrote: > > Is it possible to force a directory mentioned in a .pth file to be inserted > at the beginning of sys.path instead of appended to the end? I guess you could change site.py, but the standard on one my Windows Python 2.2 installation does appends only. -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From osuchw at ecn.ab.ca Sun Dec 23 01:37:12 2001 From: osuchw at ecn.ab.ca (waldekO) Date: 22 Dec 2001 22:37:12 -0800 Subject: Fate of win32all? References: <7876a8ea.0112212116.2ebabc23@posting.google.com> <3C242A7F.2060805@skippinet.com.au> Message-ID: Thank you Mark for your efforts. I assume that presently you would prefer a steady, well paying job than my thanks but I would like to thank you anyway. Your work introduced me into Python world and just for that I am forever in your debt. waldekO (Waldemar Osuch) From km-list-python at miazine.net Wed Dec 19 16:16:45 2001 From: km-list-python at miazine.net (Kirill Miazine) Date: Wed, 19 Dec 2001 22:16:45 +0100 Subject: Update Oreilly books? In-Reply-To: References: <3C1E3805.6090009@home.com> <20011219074308.GA30387@kub.nl> Message-ID: <20011219221645.J8417@poff.miazine.net> * Courageous [20011219 17:42]: > > >I got my Python Pocket Reference 2 Edition yesterday. It's a lot better > >than PPR1. Highly recommended. > > How would you compare it to _Essential Python Reference_? I suppose, > at a minium, it would have to be more succcint? I can't as I don't have Essential Python Reference. Just found http://diveintopython.org/, looks nice. -- Kirill From bokr at accessone.com Tue Dec 11 21:04:36 2001 From: bokr at accessone.com (Bengt Richter) Date: Wed, 12 Dec 2001 02:04:36 GMT Subject: PEP 276 Simple Iterator for ints (fwd) References: <3c169178.96189593@wa.news.verio.net> Message-ID: <3c16a0ca.100111272@wa.news.verio.net> On Tue, 11 Dec 2001 15:29:56 -0800, David Eppstein wrote: >In article <3c169178.96189593 at wa.news.verio.net>, > bokr at accessone.com (Bengt Richter) wrote: > >> How about if a bare [x:y:z] were interepreted as an abbreviation for >> slice(x,y,z) >> and you defined what one might expect as an iterator for the slice type? >> >> Then you could write >> for i in [0:5]: # or [:5] >> ... > >I don't know about the rest of the participants in this discussion, but I >am not interested in a more concise notation for range() that repeats its >drawbacks (limited to half-open intervals, non-Pythonists need to look it >up in the manual in order to understand it). Why is that any better than >what we have now? I didn't mean it to be "a more concise notation for range()" though superficially it looks that way. As to concise notation, I like it, but chacun a son gout ;-) The idea was to substitute an iterator for the slice type in place of the PEP 276 iterator for int, and thereby get control over start, end, and step using a familar (?!) syntax as a concise abbreviation for the *slice* type (unlike PEP 204, which uses the syntax as a range literal resulting in a *list* type, UIAM). Note that I was suggesting a "bare" slice, not "... the slicing literal syntax attached to the int class ..." as mentioned in PEP 276. Of course, a list expression is valid after 'in' so it might be a little messy disambiguating a list expression from a "bare slice" in the grammar (which may be a reason PEP 204 was rejected?). (Prefixing 'int' as rejected in PEP 276 solves the grammar problem, but opens other considerations, as it mentions.) Then again, you could just spell it out, avoiding the grammar problems, and using an iterator more obviously based in the slice type: for i in slice(0,5,2): ... Which could get rid of xrange(). Didn't someone say xrange() was bad? ;-) From black_sheep at cartooney.org Mon Dec 31 12:38:11 2001 From: black_sheep at cartooney.org (Rob Mitchell) Date: 31 Dec 2001 09:38:11 -0800 Subject: Cancel messages References: Message-ID: <6e43133.0112310938.6f93f585@posting.google.com> Gerhard H?ring wrote in message news:... > Le 28/12/01 ? 07:18, Syver Enstad ?crivit: > > [...] > > ========= WAS CANCELLED BY =======: > > Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail > > Message-ID: > > Control: cancel > > Subject: cmsg cancel > > From: Syver Enstad > > Newsgroups: comp.lang.python > > X-No-Archive: yes > > Lines: 2 > > NNTP-Posting-Host: wonenara.ozemail.com.au > > X-Trace: ozemail.com.au 1009643103 203.108.164.177 (Sun, 30 Dec 2001 03:25:03 EST) > > NNTP-Posting-Date: Sun, 30 Dec 2001 03:25:03 EST > > Organization: OzEmail Ltd, Australia > > Distribution: world > > Date: Sat, 29 Dec 2001 13:32:11 GMT > > > > This message was cancelled from within Mozilla. > > Just curious. > > What's going on here? A mailman bug from the mail <-> news gateway, or > somebody coverage-testing their Mozilla?! It's HipCrime, who does this sort of thing all the time. Google has archived thousands of these rogue cancels all originating from 203.108.164.177 on December 13, 14, 15, 16, 17, 18, 20, 21, 29, 30, & 31: http://groups.google.com/groups?q=203.108.164.177&num=100&hl=en&scoring=d I would first try complaining to abuse at ozemail.com.au , & then if the rogue cancels continue after that date, to the newsfeeds propagating the rogue cancel forgery floods to the rest of Usenet, as shown on the Path line. For example, for the header above, one would complain to concentric.net, home.com, look.ca, etc. If the abuse still continues after that, these newsfeeds should be asked to block Ozemail entirely until it demonstrates itself to be a responsible ISP. Rob From ron.l.johnson at home.com Mon Dec 10 12:22:06 2001 From: ron.l.johnson at home.com (Ron) Date: Mon, 10 Dec 2001 17:22:06 GMT Subject: Recursing into directories Message-ID: <2b6R7.169854$SF4.5531343@news1.rdc1.sdca.home.com> Hi, Is there a built-in class (in dircache, os.path????) that recurses thru a directory tree? I've written one using dircache.listdir, but if there is some- thing pre-written, I'd rather use that... Thanks, Ron -- +-----------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson at home.com | | Jefferson, LA USA http://ronandheather.dhs.org:81 | +-----------------------------------------------------------------+ From rdsteph at earthlink.net Fri Dec 28 20:11:51 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sat, 29 Dec 2001 01:11:51 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> <5162AA73D84B5DBA.D2515DB62E721798.F62643D4812CA388@lp.airnews.net> Message-ID: <3$--$$_----_-%$%%$@news.noc.cabal.int> Cameron Laird said in reply to Alex martelli's question: What huge firm[s] might possibly make a >similar decision in the case of Python? And why? An intriguing question, to which we per- haps shall return later. . . . Wow, YYikes ;-)) I, for one, am intrigued, and I bet I'm not alone. I'm dying to know what you might know along these lines, Cameron ;-))) ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2D18D9.D08FA7D0 at earthlink.net> Control: cancel <3C2D18D9.D08FA7D0 at earthlink.net> Date: Mon, 31 Dec 2001 04:17:24 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774927 27193 211.57.49.2 (31 Dec 2001 05:02:07 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:02:07 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From Administrator Thu Dec 27 17:02:21 2001 From: Administrator (Administrator) Date: Thu, 27 Dec 2001 15:02:21 -0700 Subject: ScanMail Message: To Recipient file blocking settings matched and action taken. Message-ID: <025001c18f22$2878ccf0$0e0fbb82@corp.es.com> ScanMail for Microsoft Exchange has blocked an attachment. Sender = Tania Duby Recipient(s) = python-list at python.org Subject = Re: Scanning Time = 12/27/2001 15:02:21 Action on file blocking: The attachment info.DOC.scr matches the file blocking settings. ScanMail has Deleted it. From fgeiger at datec.at Thu Dec 27 07:28:16 2001 From: fgeiger at datec.at (F. GEIGER) Date: Thu, 27 Dec 2001 13:28:16 +0100 Subject: REPOST: Re: [VPython] Why are some objects displayed and some are not? References: <9vpgra$k68$1@newsreaderg1.core.theplanet.net> Message-ID: <9$--$$_----_%-%-$$@news.noc.cabal.int> Thank you, Syver, today I tried those lines on an NT 4.0 English machine and it worked. The platform they do not work on is a Win2k *German* machine. Maybe that's the problem. Thanks and cheers Franz "Syver Enstad" schrieb im Newsbeitrag news:uadwfwso8.fsf at online.no... > "F. GEIGER" writes: > > > I wanted to display a pile of boxes of different sizes. So I tried the > > > > 2-liner of the tutorial: > > > > redbox=box(pos=vector(4,2,3), size=(8.,4.,6.),color=color.red) > > greenball=sphere(pos=vector(4,7,3), radius=2, color=color.green) > > > > Worked: Displayed a red box with a green sphere upon it. > > > > Then I tried > > > > redbox=box(pos=vector(4,2,3), size=(8.,4.,6.),color=color.red) > > #greenball=sphere(pos=vector(4,7,3), radius=2, color=color.green) > > > > Did not work: The screnn stayed black. So I seem to miss something > > when > > > > displaying objects. What does the sphere do, that the box does not? > > > > Any hints? > > I just tried what you did on my machine, it works fine. (python 2.1 win2k) > > -- > > Vennlig hilsen > > Syver Enstad ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "F. GEIGER" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:50:14 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775801 27193 211.57.49.2 (31 Dec 2001 05:16:41 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:16:41 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From foofboy at speakeasy.net Sat Dec 1 11:45:29 2001 From: foofboy at speakeasy.net (Robert Sherwood) Date: Sat, 01 Dec 2001 11:45:29 -0500 Subject: Dictionary of classes Message-ID: Greetings, all. I would like to construct and use a dictionary containing object references. I'm translating a binary file stream to an object structure, and I'd like to use the parts of the binary stream that identify the data as keys in a dictionary which will return an object reference which the main program can then instantiate and populate from the data stream. I know that it's possible to store objects as the value in a dictionary. Has anyone seen this done in the wild. Best of all would be a pointer to some code implementing such a feature. Any help would be appreciated. An example of what I'm trying is attached below. Thanks, Robert Sherwood frameID = self.headerArray[:4].toString() try: frame = objectDict[frameID]() frame.decode(self.popFrame()) self.frames[frame.getFrameID()] = frame except KeyError: frame = unknownFrame() frame.decode(self.popFrame()) self.frames[frame.getFrameID()] = frame where the objectDict looks like this. objectDict = { '0001':object1, '0002':object2, '0003':object3, } From tjreedy at home.com Fri Dec 21 11:22:52 2001 From: tjreedy at home.com (Terry Reedy) Date: Fri, 21 Dec 2001 16:22:52 GMT Subject: Mild bug: pipermail/python-dev Message-ID: This page http://mail.python.org/pipermail/python-dev/ has a link to an archive for a message mis-dated (one hopes) February 2005! Seems like mild bug somewhere but I have no idea where or where to report. Terry J. Reedy From sholden at holdenweb.com Tue Dec 18 15:25:49 2001 From: sholden at holdenweb.com (Steve Holden) Date: Tue, 18 Dec 2001 15:25:49 -0500 Subject: Cygwin socket library status enquiry References: <20011218131502.GA2268@dothill.com> <2JJT7.22497$PA.5674@atlpnn01.usenetserver.com> Message-ID: "Michael Hudson" wrote in message news:uellsjwre.fsf at python.net... > "Steve Holden" writes: > > > "Michael Hudson" wrote in message > > > I'd like to include some more up to date information in the README -- > > > currently all it says is "we don't know the current state of play wrt > > > cygwin on 95/98/Me." > > > > > > This applies to anyone else who has access to the relavent software > > > too, of course. > > > > Haven't downloaded candidate 1 yet, but I'll try to do so in the next few > > hours and give it a try on Windows 98. I presume you won't mind about the > > 2.2-specific feature tests failing ... > > Huh? Of course I'd mind! I think I must have misunderstood you here... > > > I refreshed my Cygwin installation yesterday (if only Python > > packages installed so easily!) so I hope this will be recent enough. > > Yeah, I meant "in the last few weeks", so yesterday is fine! > > Thanks a bunch! > The news isn't good, I'm afraid. At present I can't build Python: the gdbm build gives the following errors (sorry about the wrapping): building 'gdbm' extension gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -DUSE_DL_IMPORT -I. -I/e/Pytho n-2. 2c1/./Include -I/usr/local/include -IInclude/ -c /e/Python-2.2c1/Modules/gdbmmod ule.c -o build/temp.cygwin-1.3.6-i686-2.2/gdbmmodule.o E:\PYTHON-2.2C1\PYTHON.EXE: *** couldn't allocate memory 0x10000(4128768) for 'D :\CYGWIN\BIN\CYGSSL.DLL' alignment, Win32 error 8 0 [main] python 704155 sync_with_child: child -619731(0xA4) died before in itialization with status code 0x1 2443 [main] python 704155 sync_with_child: *** child state child loading dlls error: Resource temporarily unavailable make: *** [sharedmods] Error 1 I don't know whether this is because Cygwin patches haven't been integrated (I know Jason submitted them if the remarks he put in the 2.2.1-2 documentation are anything to go by). This is a fairly esoteric problem, I'm thinking: I wouldn't claim to be a hardened C hacker, and there appears to be a memeory allocation conflict here. It has already been reported (thirteen days ago) as http://sourceforge.net/tracker/?group_id=5470&atid=105470&func=detail&aid=48 9709 and it apparently looks like it won't be fixed in the 2.2 timeframe -- it needs attention from the Cygwin team, who aren't synchronized to Python releases. So I have just added a note that the bug applies to 2.2c1/Win98 as well. We'll see what happens... I'll see what I need to omit to get it to build, and follow up if I make progress. regards Steve -- http://www.holdenweb.com/ From hfoffani at yahoo.com Tue Dec 25 07:35:44 2001 From: hfoffani at yahoo.com (Hernan M. Foffani) Date: Tue, 25 Dec 2001 13:35:44 +0100 Subject: [ANNOUNCE] Microsoft HTML Help of Python 2.2 Docs Message-ID: The latest version of Microsoft HTML Help of Python 2.2 documentation is at http://www.orgmf.com.ar/condor/pytstuff.html#python It's completely free. As you all know, the docs of Python are distributed in a bunch of html files. With MS HTML Help file you get all the docs in 1 file of 2.9 MB that has a table of contents tree and full text search. Best Regards, Hernan.

MS HTML Help of Python 2.2 Docs - Python's 2.2 documentation in MS Help format: 1 file with full text search. (Dec-25-01) -- Hernan M. Foffani hfoffani at yahoo.com www.orgmf.com.ar/condor/ From laz at strakt.com Thu Dec 20 03:05:31 2001 From: laz at strakt.com (Fredrik Juhlin) Date: Thu, 20 Dec 2001 09:05:31 +0100 Subject: Raw sockets In-Reply-To: <7934d084.0112131952.2ae7c239@posting.google.com> References: <2c55c8be.0112130949.761bc120@posting.google.com> <7934d084.0112131952.2ae7c239@posting.google.com> Message-ID: <20011220080531.GA8140@strakt.com> On Thu, Dec 13, 2001 at 07:52:11PM -0800, Andrae Muys wrote: > Might I suggest you first check out Stevens 'TCP/IP Illustrated Vol 1' > as it will explain in excelent detail how traceroute is built using > UDP not ICMP :). He might have meant tracert (or whatever it's called on Win32 systems, maybe they even call it traceroute in the newer versions) which IIRC uses ICMP echo requests rather than random high UDP ports. //FJ From rnd at onego.ru Mon Dec 3 01:50:22 2001 From: rnd at onego.ru (Roman Suzi) Date: Mon, 3 Dec 2001 09:50:22 +0300 (MSK) Subject: Draft PEP: string interpolation with backquotes In-Reply-To: <9uf5qi$p3q$1@peabody.colorado.edu> Message-ID: Hello, if the PEP will be realised, I propose to make it visually compatible with Python formatting operation: " %(expression)s " - everything else will add unnecessary complications. Maybe this form will be also (or exclusively) be in use: " %{expression}s " However, hooks for formatting operation will also be needed, so providing our own eval will be possible. Sincerely yours, Roman A.Suzi -- - Petrozavodsk - Karelia - Russia - mailto:rnd at onego.ru - From mwh at python.net Sat Dec 15 08:33:03 2001 From: mwh at python.net (Michael Hudson) Date: Sat, 15 Dec 2001 13:33:03 GMT Subject: Unsung Python modules References: <3dsnad226b.fsf@ute.mems-exchange.org> <15386.18916.707282.784261@beluga.mojam.com> Message-ID: Justin Sheehy writes: > One reason that a lot of people might not think of this is that it's > not needed if you're using Python's interactive mode in an emacs > inferior shell buffer alongside Python-mode. Can you get completion in python-mode? Or multi-line editing? Cheers, M. -- ... so the notion that it is meaningful to pass pointers to memory objects into which any random function may write random values without having a clue where they point, has _not_ been debunked as the sheer idiocy it really is. -- Erik Naggum, comp.lang.lisp From greg at cosc.canterbury.ac.nz Mon Dec 17 20:06:09 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Tue, 18 Dec 2001 14:06:09 +1300 Subject: Wrap C function which takes variable lengthed parameters? References: <6p5j1u0oag2ofkam8o7fig5dvkfc2392hk@4ax.com> <3C19990E.BE0F3FA@alcyone.com> <3C19AC0B.7ABD04DF@xs4all.nl> <3C1D767D.7BBE45EC@cosc.canterbury.ac.nz> <3C1E0E6B.9F0C2A18@pobox.com> Message-ID: <3C1E9681.CD3DBA0@cosc.canterbury.ac.nz> Jason Harper wrote: > > I have used a compiler (fortunately > long dead), which claimed to be fully ANSI compliant, that absolutely > required that a varargs function consume exactly as many args as were > passed to it or it would crash on return. Hmmm, I suppose it's not guaranteed, then. But it works on all the major platforms around today, as far as I know. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From aleaxit at yahoo.com Sat Dec 8 18:28:15 2001 From: aleaxit at yahoo.com (Alex Martelli) Date: Sun, 9 Dec 2001 00:28:15 +0100 Subject: finance programs References: Message-ID: <9uu7mf018f3@enews3.newsguy.com> Lewis Bergman wrote: ... > Are there any fnance packages being worked on that anyone knows about? > Maybe something that I can at least get ideas from? http://quantlib.org/ has a very good library for quantitative finance -- C++ with a Python wrapper. This should provide great speed and usability... Alex From loewis at informatik.hu-berlin.de Fri Dec 21 12:08:01 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 21 Dec 2001 18:08:01 +0100 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> <7xlmfxvbx7.fsf@ruckus.brouhaha.com> <3dbsgt7f0e.fsf@ute.mems-exchange.org> Message-ID: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) writes: > I think Paul was referring more to changes in modules or syntax that > broke previous scripts. For example, the rand module had a name change > to random. Scripts that used the rand module will break with an > ImportError if they are run under 2.x. Those scripts where already broken with Python 1.5.1, which was the first version that deprecated the rand module. It was *not* renamed to random, the random module was available since 1.0.2. So people had four years to move from rand to random, and you still can import rand if you want to in Python 2.2 - if you add lib-old to sys.path. HTH, Martin From Bruce at EckelObjects.com Sun Dec 30 12:19:08 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Sun, 30 Dec 2001 09:19:08 -0800 Subject: Book Royalties (was: win32all-141 for Python 2.2) In-Reply-To: <3C2E5508.7B5455C0@engcorp.com> References: <3C2D4676.5060700@skippinet.com.au> <3C2D49E6.39FD96BE@earthlink.net> <3C2E5508.7B5455C0@engcorp.com> Message-ID: <200112300919080820.003F1B8F@mail.rdc1.sdca.home.com> You can get a rough estimate with these numbers: A computer book author typically gets between 10-15% royalties. Let's be positive and say it's 15%. But that's 15% of what the publisher gets, which is roughly half of what the bookseller charges (retail, in general, doubles their cost, which sounds like a lot but retail is still a very difficult business). My copy of Mark's book says $35 on the back, although this is often discounted. So let's say the publisher gets $17.50, then Mark gets about $2.00 per book. It looks like the publisher gets an inordinate share here, but less than 10% of books that most publishers put out make back their investment -- that is, break even. About 1% are actually successful. The successful books must pay for all the publisher's mistakes, thus the low royalty rate. I believe that most publishers look at this and say "to be successful, we must pump out lots of books to increase the number that the 1% represents." Maybe they don't say this explicitly, but there is pressure in that direction. I think O'Reilly has been successful because it has said "instead of always hunting for the blockbusters, let's try to make every book something that people will want." An excellent business model, it would seem, but one that I suspect will only work in a privately-held company, as the constant-growth imperative of the publicly-held corporation pressures everyone to abandon quality for percentages. Just my 2%. Bruce *********** REPLY SEPARATOR *********** On 12/29/01 at 6:43 PM Peter Hansen wrote: >Ron Stephens wrote: >> >> Thanks, Mark. I really appreciate your efforts. I also suggest that >> *anyone* and everyone* using Python and Windows rush out and buy your >> book, Python Programming on Win32. Do you have any other book projects in >> mind? > >From what I understand of how book publishing works, >Mark probably makes about 10 cents on each sale. ;-) >It would be better to just send him a cheque! > >-- >---------------------- >Peter Hansen, P.Eng. >peter at engcorp.com >-- >http://mail.python.org/mailman/listinfo/python-list Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From aleax at aleax.it Fri Dec 28 11:42:47 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 17:42:47 +0100 Subject: base64.decodestring gives binascii.error References: <3C2C03CB.7030000@pacific-shores.com> <3C2C9D79.9050501@pacific-shores.com> Message-ID: "Erik Myllymaki" wrote in message news:3C2C9D79.9050501 at pacific-shores.com... > The '_' and '!' were in the original string that was then encoded, not > in the resulting encoded string. Then, it's clearly a bug in the base64 module you're using. I don't see it here: >>> x=base64.encodestring('oh_my!') >>> x 'b2hfbXkh\n' >>> base64.decodestring(x) 'oh_my!' >>> [original context was -- oh those hateful add-in-front habits!: > >>should base64.decodestring give a binascii.error if it encounters > >>special chars like '_' and '!' ? > > > > Makes sense to me; after all, such characters should never be > > in a string produced by base64, so the data must have been > > damaged in transit -- raising an exceptions seems appropriate. ] Alex From jeff at ccvcorp.com Thu Dec 20 16:27:10 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Thu, 20 Dec 2001 13:27:10 -0800 Subject: Bug in % string formatting? References: <9vtiev$no8$1@peabody.colorado.edu> Message-ID: <3C2257AE.E4C15D16@ccvcorp.com> Fernando P?rez wrote: > If this is not a bug in % string formatting, I'd love to understand what is > going on..... It's not a bug, it's just mistaken assumptions. ;) > # This works ok > print 'With prebuilt list:' > print format_string % format_list > > # but this fails. The format string is copied verbatim from above > print 'Explicit list construction:' > print format_string % names['John'][:] + names['Jane'][:] >>> # Your first example >>> format_list = names['john'][:] + names['jane'][:] >>> format_string % format_list 'johnnie \njane doe ' >>> # This breaks... >>> format_string % names['john'][:] + names['jane'][:] Traceback (most recent call last): File "", line 1, in ? TypeError: not enough arguments for format string >>> # But with parentheses.... >>> format_string % (names['john'][:] + names['jane'][:]) 'johnnie \njane doe ' >>> The problem is that the % operator is processing before the + operator, so you're trying to format your string with only john's info, and then adding the tuple of jane's info to that string.... By putting parenthesis around the tuple-addition, I'm forcing that to happen first. Then the resulting tuple has enough values to satisfy the format string. Jeff Shannon Technician/Programmer Credit International From beyer at incent.com Fri Dec 28 16:35:32 2001 From: beyer at incent.com (hugh) Date: 28 Dec 2001 13:35:32 -0800 Subject: REPOST: Running MySQLdb under solaris and python 2.1 Message-ID: <9$--$$_----_-%_-%$@news.noc.cabal.int> I'm trying to write a cgi script in python that accesses the mySQL database. This is made more complicated by the way my ISP forces everything run from a cgi to be under the user's home directory. I have python installed, and I have mySQLdb installed. But when I try to use it I get the following error: >>> import MySQLdb Traceback (most recent call last): File "", line 1, in ? File "/export/home/incent01/usr/local/lib/python2.1/MySQLdb/__init__.py", line 27, in ? import _mysql ImportError: ld.so.1: python: fatal: libmysqlclient.so.10: open failed: No such file or directory >>> So it's finding the MySQLdb package; it's loading the _mysql.so module; and then it's failing to link in the libmysqlclient. (right?) I've found libmysqlclient but I can't get it into the right directory so the system can link it in--usr/local/bin (where the python program is), usr/local/lib and usr/local/lib/python2.1 all don't work. Is there some magic place for it? Is there some environment variable I can set so it can be found? ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: beyer at incent.com (hugh) Newsgroups: comp.lang.python Subject: cmsg cancel <3d504fd.0112281335.45ca330 at posting.google.com> Control: cancel <3d504fd.0112281335.45ca330 at posting.google.com> Date: Mon, 31 Dec 2001 04:23:28 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775044 27193 211.57.49.2 (31 Dec 2001 05:04:04 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:04:04 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jesper at strindberg.maisel.enst-bretagne.fr Sun Dec 9 06:00:17 2001 From: jesper at strindberg.maisel.enst-bretagne.fr (Jesper Holmberg) Date: 09 Dec 2001 12:00:17 +0100 Subject: DOM Message-ID: <87lmgcejzy.fsf@strindberg.maisel.enst-bretagne.fr> This code works fine in the python (2.1.1) interpreter: from xml.dom import minidom myDoc = minidom.Document() myEl = myDoc.createElement('jeppe') myEl2 = myDoc.createElement('henning') myDoc.appendChild(myEl) myDoc.insertBefore(myEl2, myEl) print myEl2.parentNode print myEl2.nextSibling However, when I put this code in a Zope (2.4.2) product, and run it, I get an error on the last line: Error Type: AttributeError Error Value: nextSibling with trace ending in: File /usr/lib/zope/lib/python/xml/dom/minidom.py, line 74, in __getattr__ AttributeError: (see above) So for some reason, the node myEl2 is not correctly inserted in the DOM. It knows its parent, but not who is it's sibling. In fact, if nextSibling were None, there wouldn't be an error, but now it doesn't even know it has an attribute with this name. Does anyone have an idea what could be the problem? TIA, Jesper From michael at stroeder.com Thu Dec 27 17:43:03 2001 From: michael at stroeder.com (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Thu, 27 Dec 2001 23:43:03 +0100 Subject: A new message board is up References: <40dbad98.0112262232.1868734e@posting.google.com> <3C2B724D.E4D31E24@ccvcorp.com> <3C2B74B8.D2FE36F5@stroeder.com> <3C2B829A.DD0AED79@ccvcorp.com> Message-ID: <3C2BA3F7.2D569598@stroeder.com> Jeff Shannon wrote: > > Michael Str?der wrote: > > > I always wonder why people put "web forums" in place. I can't read > > them while being off-line (e.g. on the train) and they are damn > > slow. Newsgroups and mailing lists are the right medium for this > > kind of communication. > > Eh, they have their purpose. They're easier to set up than a > newsgroup, and more widely accessible (decent browsers are more widely > distributed than decent newsreaders). I prefer mailing lists if a news group does not exist. And if the participants are too stupid to use a decent MUA it's not the right forum. I dislike having to load banners and I very much dislike having to stay online to read postings. Period. > And once a certain volume is > reached, they're easier to organize and maintain than a mailing list Sorry, I can't see the advantage. > It's also easier to > include images and such in posts Umh, yeah. The multi-media thingy... ;-) BTW: Did you check the web message board's software how it prevents cross-site scripting attacks, if the session ID leaks through referer URLs and such...? No, thanks. Web discussion boards simply suck. Ciao, Michael. From michael at rcp.co.uk Fri Dec 7 06:49:23 2001 From: michael at rcp.co.uk (Michael Abbott) Date: Fri, 7 Dec 2001 11:49:23 +0000 (UTC) Subject: SSL Sockets in Windows Message-ID: I'm running Python 2.1 on Windows NT, and I'd like to use socket SSL. I see that socket.py and socketmodule.c both contain support for SSL sockets, but this does not appear to be compiled into my distribution. Is this a problem with my distribution of Python, or is there some fundamental reason why SSL support isn't actually enabled? To be precise, here's the startup banner for my copy of Python: Python 2.1 (#15, Apr 16 2001, 18:25:49) [MSC 32 bit (Intel)] on win32 From sholden at holdenweb.com Wed Dec 5 22:29:45 2001 From: sholden at holdenweb.com (Steve Holden) Date: Wed, 5 Dec 2001 22:29:45 -0500 Subject: Strip HTML tags from downloaded files References: Message-ID: "Thomas Pham" wrote ... > > When I use urlretrieve to download a file from the web, the raw text file have HTML tags embedded at the beginning and the end of the file. > > > > > > > > > > > Is there anyway to strip all the HTML tags from the file? > The easiest way is to use the DumbWriter class from the library. Here's an example: """Uses HTMLParser and DumbWriter to remove HTML tags.""" import htmllib import sys, formatter, urllib try: f = urllib.urlopen(sys.argv[1]) data = f.read() if f is not sys.stdin: f.close() p = htmllib.HTMLParser(formatter.AbstractFormatter(formatter.DumbWriter())) p.feed(data) p.close() except IOError, msg: print URL, ":", msg regards Steve -- http://www.holdenweb.com/ From huaiyu at gauss.almadan.ibm.com Thu Dec 6 20:52:41 2001 From: huaiyu at gauss.almadan.ibm.com (Huaiyu Zhu) Date: Fri, 7 Dec 2001 01:52:41 +0000 (UTC) Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BD39F.D43D4FF7@mega-nerd.com> <3c0be454$1@207.229.64.20> <3C0BE5D5.4386B359@mega-nerd.com> <9umeoa$bmu$1@animus.fel.iae.nl> <6qr8q8fxpg.fsf@abnoba.intevation.de> Message-ID: On 06 Dec 2001 11:29:47 +0100, Bernhard Herzog wrote: >Carel Fellinger writes: > >> alas, cut&past on an X display will not see those tabs, but only the >> spaces used to represent them at the moment:( > >That's got nothing to do with X and everything with how your editor or >your terminal emulator as the case may be handles it. I can copy&paste >between e.g. different Emacs sessions just fine including tab >characters. Emacs in their own windows work just fine. Emacs in xterm sometimes have problems with tabs. Cat and more are fine. But less seems to always change tab into spaces. The practical impact is that if I'm viewing a file in less and want to copy a part of it, I hit v to spawns an editor (emacs) centered at the current location of the file, copy from it, and close emacs. Does someone know how to let less preserve tab? Huaiyu From nas at python.ca Fri Dec 7 11:06:56 2001 From: nas at python.ca (Neil Schemenauer) Date: Fri, 7 Dec 2001 08:06:56 -0800 Subject: staticmethod and __call__ In-Reply-To: <200112061403560030.019D0518@mail.rdc1.sdca.home.com>; from Bruce@EckelObjects.com on Thu, Dec 06, 2001 at 02:03:56PM -0800 References: <200112061403560030.019D0518@mail.rdc1.sdca.home.com> Message-ID: <20011207080655.A26389@glacier.arctrix.com> Bruce Eckel wrote: > I seem to have trouble getting __call__ to behave as a static > method: > > class Item: > def f(): print 'An Item' > > Item.a = 'a' > Item.b = 'b' > Item.c = 'c' > > class ItemGenerator: > import random > rgen = random.Random() > items = [j for j in vars(Item).values() if isinstance(j, Item)] > def __call__(): > return ItemGenerator.rgen.choice(ItemGenerator.items) > __call__ = staticmethod(__call__) > > items = [ItemGenerator() for i in range(5)] > for i in items: > i.f() This is some strange looking code. Perhaps you could explain what you're trying to achieve and a more "Pythonic" solution can be devised. Neil From eric.brunel at pragmadev.com Thu Dec 13 05:31:06 2001 From: eric.brunel at pragmadev.com (Eric Brunel) Date: Thu, 13 Dec 2001 11:31:06 +0100 Subject: Problems with Tkinter and menus References: Message-ID: <9v9vu2$r6g$1@norfair.nerim.net> Hi, Apparently, the code like you wrote it actually works on Windows, but I remember that I had a similar problem on Linux, and it was caused by a problem in the menu hierarchy: have you tried to create menu0 before menu1 and create menu1 as a son of menu0, like in: menu0 = Tkinter.Menu(root, tearoff=0) menu1 = Tkinter.Menu(menu0, tearoff=0) menu1.add_command(label="Foo", command=hello) # ... Just try it: it may solve your problem. And doing it this way still works on Windows. HTH - eric - "Fredrik Juhlin" a ?crit dans le message news: mailman.1008148516.7839.python-list at python.org... > Hello, > > I'm trying to make cascading popup menus work in Tkinter. Unfortunately, I'm > having little success. > The problem is that the commands under the second-level menus won't run when > clicked on. Actually, it seems like they are not responding to the mouse at > all, since hovering on a menu-item doesn't "mark" it. > > I've submitted test code to show the problem. > > Any help on this would be greatly appreciated! > > /FJ > > # Code to show problem with cascading menus > > import Tkinter > > def hello(): > print "hello!" > > root = Tkinter.Tk() > > menu1 = Tkinter.Menu(root, tearoff=0) > menu1.add_command(label="Foo", command=hello) > menu1.add_command(label="Bar", command=hello) > > menu0 = Tkinter.Menu(root, tearoff=0) > menu0.add_command(label="Command 1", command=hello) #This works > menu0.add_cascade(label="Menu 1", menu=menu1) #Commands used in this menu > #won't work > > frame = Tkinter.Frame(root, width=200, height=200) > frame.pack() > > def showMenu(event): > menu0.post(event.x_root, event.y_root) > > frame.bind("", showMenu) > > Tkinter.mainloop() > From mhammond at skippinet.com.au Sun Dec 30 19:24:56 2001 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 31 Dec 2001 00:24:56 GMT Subject: REPOST: Re: Win32all and Mark. time to bring back win32-reg-users? References: <3c2f44b5_7@news.newsgroups.com> Message-ID: <5$--$$_----__$__-$@news.noc.cabal.int> Brad Clements wrote: > Just a thought, worth it to me.. > Maybe :) Let's just see what pans out. If it transpires that I go back to doing what I was before (ie, living from one part-time contract to the next) then I probably will. Thanks for the support though! Mark. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Mark Hammond Newsgroups: comp.lang.python Subject: cmsg cancel <3C2FB076.3000203 at skippinet.com.au> Control: cancel <3C2FB076.3000203 at skippinet.com.au> Date: Mon, 31 Dec 2001 01:54:12 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774003 27193 211.57.49.2 (31 Dec 2001 04:46:43 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:46:43 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From mhammond at skippinet.com.au Wed Dec 19 06:48:05 2001 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 19 Dec 2001 11:48:05 GMT Subject: How to know that a second application has finished? References: <3C1F6F21.C03A3ABC@cicei.ulpgc.es> Message-ID: <3C207E76.1000002@skippinet.com.au> Enrique wrote: > Hi, > Let me put my question again, in a different and more > general form. I have a Python program that launches a GUI > application in a separate window via COM. I am using Python > 2.1.1 with win32 extensions in MS-Windows (win95/98/NT) > > Is it possible to suspend the main Python program until the > COM application has finished? (has been closed). You really need to use COM Events. Look at either the documentation for the app, or the makepy generated file for the app, and you may find the app reports significant events - the MS Office apps do, for example. For info on Python and COM Events, do: >>> import win32com.client >>> print win32com.client.DispatchWithEvents.__doc__ > I want to resume from that point onwards. How the main > program gets information of the state of other applications > launched from it? You will probably need to implement your own loop (or "wait" call) here. It depends on your app, but the most brute-force would be to create a threading.Event object and have the main code wait for the threading.Event, while the COM event handler sets the event. Mark. From aleax at aleax.it Thu Dec 6 09:11:32 2001 From: aleax at aleax.it (Alex Martelli) Date: Thu, 6 Dec 2001 15:11:32 +0100 Subject: ANN: Simple Newsgroup Searchterm Monitor (attached) References: <3c13ba77.19343935@127.0.0.1> <3C0DBB04.5070102@home.com> <3c21bc9f.19896499@127.0.0.1> <3c0fec5e.9446833@127.0.0.1> Message-ID: <9unuah$j1r$1@serv1.iunet.it> "(Five Fresh) Fish" wrote in message news:3c0fec5e.9446833 at 127.0.0.1... ... > You're perfectly, technically correct. So what? It's okay for someone to > post 2000 lines of Python code, but unacceptable to post 10 lines of > UUEncoded binary? That's just bloody stupid. There isn't a soul reading > this group that's using a newsreader that's going to choke on the > UUEncoding. No, but for example a good news-server is set up to block any post with attachments from ever showing up on a newsgroup that is not marked as allowing attachments. I wish the server I use was also set to block any post over a certain maximum length. These days, the right way to share substantial amounts of information is to put the info on some (possibly free) webserver and provide an URL -- IMHO. Alex From logiplexsoftware at earthlink.net Sun Dec 30 19:36:01 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Sun, 30 Dec 2001 16:36:01 -0800 Subject: Is learning Python "extraordinary"? In-Reply-To: References: Message-ID: <20011230163601.2b6827ca.logiplexsoftware@earthlink.net> On Mon, 31 Dec 2001 00:39:54 +0000 philh at comuno.freeserve.co.uk (phil hunt) wrote: > Since (just about) everyone here has learned Python, why would we think > it was extraordinary? Because (just about) everyone here is extraordinary? -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From pythonnet at hotmail.com Thu Dec 27 01:32:40 2001 From: pythonnet at hotmail.com (Andrew Nguyen) Date: 26 Dec 2001 22:32:40 -0800 Subject: REPOST: A new message board is up Message-ID: <9$--$$-$$$$%%-__-$@news.noc.cabal.int> A new message board (that doesn't have the Usenet delay) is up! Xutilla is the admin. it is at http://pub19.ezboard.com/fthepythonmessageboard95602frm1 Hope to see you! ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!enews.sgi.com!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: pythonnet at hotmail.com (Andrew Nguyen) Newsgroups: comp.lang.python Subject: cmsg cancel <40dbad98.0112262232.1868734e at posting.google.com> Control: cancel <40dbad98.0112262232.1868734e at posting.google.com> Date: Mon, 31 Dec 2001 04:21:48 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775893 27193 211.57.49.2 (31 Dec 2001 05:18:13 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:18:13 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From mwh at python.net Sun Dec 30 16:47:25 2001 From: mwh at python.net (Michael Hudson) Date: Sun, 30 Dec 2001 21:47:25 GMT Subject: REPOST: Re: Origin of ly y'rs signature style References: Message-ID: <5$--$$_----___-$-$@news.noc.cabal.int> "Emile van Sebille" writes: > I know I've read a good article or post on the origin and adoption > of the "xx-xx-xx ly y'rs" signoffs brought to the python group by > Tim Peters. After some searching this morning I couldn't relocate > that article/post. Does anyone have a link to it? There's something about it in AMK's python quotes collection: http://www.amk.ca/quotations/python-quotes/index.html and there may be something in the Tim Peters shrine: http://www.python.org/tim_one/ Cheers, M. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp.gblx.net!feeder.qis.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Michael Hudson Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:44:51 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774055 27193 211.57.49.2 (31 Dec 2001 04:47:35 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:47:35 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From thomasNO at SPAM.obscure.dk Sun Dec 2 04:05:56 2001 From: thomasNO at SPAM.obscure.dk (Thomas Jensen) Date: Sun, 02 Dec 2001 09:05:56 GMT Subject: InterScan NT Alert References: Message-ID: Daniel Berlin wrote in news:mailman.1007278265.13755.python-list at python.org: > > Good thing, too. > I was really worried it wouldn't notify *everyone it could find in > a 8 million square mile area*. The next version will include the text: "Please forward this message to everyone in your addressbook". :-) -- Best Regards Thomas Jensen From paul at boddie.net Thu Dec 20 06:29:10 2001 From: paul at boddie.net (Paul Boddie) Date: 20 Dec 2001 03:29:10 -0800 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <7xhequjsgl.fsf@ruckus.brouhaha.com> <9vc581$g0h$1@peabody.colorado.edu> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> Message-ID: <23891c90.0112200329.74a3677c@posting.google.com> Fernando P?rez wrote in message news:<9vr8gp$3af$1 at peabody.colorado.edu>... > > yes, this will work. You can install the python2 rpm alongside with > python1.5. Look into /usr/bin/python*, you'll see both side by side. The > trick is, python1.5 is the default, and *don't change that* (you'll break > everything if you do). But as long as you don't mind changing by hand > references to python2 in everything else you write or use, you'll be fine. This came up on the Webware list, and I subsequently posted an entry onto the Webware Wiki: http://webware.colorstudy.net/twiki/bin/view/Webware/PythonIssues To summarise, I installed Python into /usr/local and changed my environment variables so that my user only ever saw Python 2.0 rather than the Red Hat default. Since I don't see the need to repeatedly upgrade Python, this situation has been appropriate for me until now. When I upgrade to Python 2.2, I think I'll assess the implications on the different pieces of software, make any necessary modifications, and make a complete transition (replacing 2.0). > This is clumsy, and is why yesterday I wrote a detailed post on the issue > hoping to hear from the redhats for a reasonable explanation. As far as I > can tell, their python distribution is simply broken. The problems can be > worked around, but it's an annoyance. In my opinion, it's rarely worth installing repackaged distributions of things like Python on Linux systems. Usually, the packages want to install in some strange place, have things missing, or aren't compiled to use the things you want; so, in the end, you have to compile the thing from source, and that's easier to do using the Python source distribution than invoking whichever bizarre rpm command line switches are required to perform the same work. [RPM querying] > query for the package name only, not the full filename. The rpm querying is > tricky to use, fire up kpackage and just look at the list, much easier. I tend to do something like... rpm --query --all | grep whatever Paul From emile at fenx.com Thu Dec 6 21:22:26 2001 From: emile at fenx.com (Emile van Sebille) Date: Thu, 6 Dec 2001 18:22:26 -0800 Subject: Python - string to hexbytes conversion - HELP! References: <3C0F9EB3.2574208E@snakefarm.org> <3C102153.52B16049@earthlink.net> Message-ID: <9up9ei$a06h4$1@ID-11957.news.dfncis.de> "Hans Nowak" wrote in message news:3C102153.52B16049 at earthlink.net... > Carsten Gaebler wrote: > > > >>> import binascii > > >>> binascii.unhexlify("01234567") > > '\x01#Eg' > > > OK, this one has been puzzling me for a while... why are the > functions in binascii called 'hexlify' and 'unhexlify'? Why > not 'hexify'? Where does the L come from? > > > --Hans Looks like an emacs thing... Blindlifiing-ly y'rs -- Emile van Sebille emile at fenx.com --------- From mwh at python.net Fri Dec 28 11:00:21 2001 From: mwh at python.net (Michael Hudson) Date: Fri, 28 Dec 2001 16:00:21 GMT Subject: REPOST: Re: pth files - can they prepend to sys.path? References: Message-ID: <5$--$$_-----$$%-%$@news.noc.cabal.int> "Skip Montanaro" writes: > Is it possible to force a directory mentioned in a .pth file to be > inserted at the beginning of sys.path instead of appended to the > end? You realise the handling of .pth files is done in site.py? The answer seems to be no, though presumably there's nothing stoppoing you supporting .pthplus files in a sitecustomize.py. Cheers, M. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Michael Hudson Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:16:07 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775311 27193 211.57.49.2 (31 Dec 2001 05:08:31 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:08:31 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From robin at jessikat.fsnet.co.uk Sun Dec 2 08:59:45 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Sun, 2 Dec 2001 13:59:45 +0000 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: In article , Lee Harr writes >> You'll not find tabs in any code that I touch. Literally. I've got my >> editor configured to save spaces, not tabs. >> > >Same here. > >I am just wondering that if letting people actually use tabs >is causing trouble, why not get rid of that "feature". > well I'm +1 on use of tabs. It's much better when the response time is long eg across the Atlantic or a heavily loaded server. -- Robin Becker From jeff at jdkoftinoff.com Fri Dec 21 17:57:25 2001 From: jeff at jdkoftinoff.com (Jeff Koftinoff) Date: 21 Dec 2001 14:57:25 -0800 Subject: Platform-independent GUID creation? References: <9vtn13$aq9$1@panix3.panix.com> Message-ID: <789798cc.0112211457.10505b9c@posting.google.com> "Steve Holden" wrote in message news:... > Whatever. I'll settle for a Unix "create GUID" routine and one for the Mac > (I would assume for these purposes that OSX shold be treated like some > flavor of U*ix?). These could be included along with the win32 CreateGuid() > and a platform choice to give something *reasonably* portable. > > regards > Steve The problem of course with creating a GUID this way is that it REQUIRES the computer to have an ethernet adapter. I got bitten by this one before when some clients only had modems, and my app needed to create a GUID on their computer. --jeff From dsavitsk at e-coli.net Sat Dec 22 13:09:41 2001 From: dsavitsk at e-coli.net (dsavitsk) Date: Sat, 22 Dec 2001 18:09:41 GMT Subject: Fate of win32all? References: <7876a8ea.0112212116.2ebabc23@posting.google.com> <3C242A7F.2060805@skippinet.com.au> Message-ID: another 'me too' reply of thanks. i have switched my entire company to python -- mostly with the help of the win32all package. i don't know what i would do w/o pythonwin ... well, being in law school i'd probably spend more time studying and less time coding. thanks, doug "Mark Hammond" wrote in message news:3C242A7F.2060805 at skippinet.com.au... > stalin wrote: > > > I've used win32all occasionally--always in noncommercial settings--and > > have found it helpful. I'd like to thank Mr. Hammond for developing > > the packages > > > My pleasure. > > > and ActiveState for supporting their recent maintenance > > by employing Hammond. > > > Unfortunately, I am no longer employed by ActiveState :( > > > Mr. Hammond had personally developed the win32 packages to > > considerable maturity before he became involved with ActiveState. His > > employment by ActiveState appears to have come to an untimely end just > > recently ( http://mail.python.org/pipermail/python-dev/2001-December/019038.html > > ). I don't mean to be insensitive--I'm sure Hammond has a lot on his > > mind right now--but I wonder about the fate of win32all. What role > > does ActiveState now play in licensing the package? Has the original > > author lost a degree of his control over it to his former employer? > > > Nope. The win32all license remains unchanged. See the license.txt > files in the distribution. Basically *anyone* is free to do whatever > they choose with the package, including building their own distribution. > ActiveState have no special rights over this at all. > > Specifically, I fully intend releasing new win32all packages. > ActiveState did have me working very hard on Komodo, but no longer ;) I > am leaving for a Christmas break, but intend getting a win32all out by > the new year - if not, just a few days after. > > Mark. > From gh_pythonlist at gmx.de Wed Dec 5 01:48:26 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Wed, 5 Dec 2001 07:48:26 +0100 Subject: license key validation - encryption/decryption In-Reply-To: <20011204222101.GA2795@lilith.hqd-internal> References: <9ujgam$a1e$1@news1.xs4all.nl> <20011204222101.GA2795@lilith.hqd-internal> Message-ID: <20011205064826.GA1649@lilith.hqd-internal> Le 04/12/01 ? 23:21, Gerhard H?ring ?crivit: > On Tue, Dec 04, 2001 at 10:48:05PM +0100, Irmen de Jong wrote: > > > How do i validate it at the customer site that the > > > "key" installed is valid? > > > > You're looking for a secure hash of your license file, to protect the > > contents of the file from tampering. The sha module can do this for > > you. > > The next problem is where to store the hash. > > > Now somehow you need to encode information about that > > unique customer into your license, so that another customer > > cannot also use that license file. > > > > Perhaps some sort of public-private key scheme would work? > > Which doesn't help at all if both keys are available to the potential > cracker. Doh! Of course the user would only have access to the private key. Perhaps also tie the license to the FQDN of the machine. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From James_Althoff at i2.com Mon Dec 3 19:04:12 2001 From: James_Althoff at i2.com (James_Althoff at i2.com) Date: Mon, 3 Dec 2001 16:04:12 -0800 Subject: more fun with PEP 276 Message-ID: It is readily apparent from the PEP 276 thread that while the author has tried his best to do the tedious, dirty work of showing the modest benefits of the modest proposal actually contained in PEP 276 many of those contributing to the thread, OTOH, have been having quite a jolly good time offering suggestions for wholesale changes in the area of for-loops, integer sequences, lists, iterators, etc. Is there any compelling reason why everyone else should be having all the fun? I think not. And so, without further adieu, here comes "yet another proposal for changing the heck out of for-loops". The thinking goes as follows. Let's start with Greg Ewing's recent suggestion of writing for-loops as: for -5 <= i <= 5: print i The nice thing about the above is the apparent clarity of intent. And the fact that all combinations of open and closed intervals are handled nicely. On the down side we observe that this construct requires new syntax, that it doesn't work outside of the context of a for-loop (in fact, it is a relational expression outside the context of a for-loop), and that there is no apparent mechanism for having a step size other than 1 (or -1). Now I, for one, happen to like the "for i in iterator:" construct (with emphasis on the *in*). Also, others have seemed to show fondness for the Haskell-like style of: [0,1 ... 10] (using the suggested existing Python ellipsis notation, i.e., "..."). So what if we turn things around a little and say: for i in -5 <= ... <= 5: print i One little hitch is that Python only supports the ellipsis literal, "...", in slice notation. So this would require syntax changes. We really prefer *not* to ask for such, right? So for now, what if we just used a builtin object, let's call it "span" (spam's more-respected cousin ;-). span represents something that knows how to create an iterator for a "span of numbers" between a given one and another. So we would now write: for i in -5 <= span <= 5: print i We can make span an instance of a class and then note that "<=", ">=", etc. are operators that we can implement using the magic methods __le__, __ge__, etc. Unfortunately, this won't work very well because of a couple of things. The comparison magic methods don't have left and right versions the way arithmetic operators do. So we can't really distinguish increasing sequences from decreasing sequences like we would want. Worse is that -5 <= span <= 5 turns into "(-5 <= span) and (span <= 5)" instead of "(-5 <= span) <= 5)". And we have no control over this. Finally, "-5 <= span <= 5" when used in an "if" statement should do something boolean and not something iterator-ish to be consistent with relational expressions in general. So creating a class that redefines the relational operators doesn't work out quite as well as one would hope in this situation. But, if we were willing to be somewhat flexible and non-perfectionistic, we could try a slight variation on all of this. Given that some have suggested using [xxx], [xxx), (xxx] as ways of indicating various combinations of open and closed intervals (to the dismay of others), the following might not be such a traumatic stretch. Suppose we use "/" to indicate an open interval and "//" to indicate a closed interval as in, for example: -3 // ... // 3 # closed-closed: -3, -2, -1, 0, 1, 2, 3 -3 // ... / 3 # closed-open: -3, -2, -1, 0, 1, 2 -3 / ... // 3 # open-closed: -2, -1, 0, 1, 2, 3 -3 / ... / 3 # open-open: -2, -1, 0, 1, 2 etc. Let's continue using "span", though, instead of "..." so that we don't require syntax changes. Note that "//" and "/" are operators with corresponding magic methods (in Python 2.2). Further note that they each have left and right versions. We now create a class, IteratorBounds that holds the start value, stop value, step value, and "open/closed" status for the left and right sides of an enumeration of numbers. We make a default instance of IteratorBounds named "span" with the following default values: stop == 0 start == 0 step == 1 left == 'closed' right == 'closed' Using the example implementation included at the end of this message, we can write things like: Python 2.2b1 (#25, Oct 19 2001, 11:44:52) [MSC 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> >>> for i in -5 // span // 5: # closed-closed ... print i, ... -5 -4 -3 -2 -1 0 1 2 3 4 5 >>> >>> for i in -5 / span / 5: # open-open ... print i, ... -4 -3 -2 -1 0 1 2 3 4 >>> >>> for i in -5 // span / 5: # closed-open ... print i, ... -5 -4 -3 -2 -1 0 1 2 3 4 >>> >>> for i in -5 / span // 5: # open-closed ... print i, ... -4 -3 -2 -1 0 1 2 3 4 5 >>> We can handle descending intervals as well as ascending (specified by reversing the order) as in: >>> for i in 5 // span // -5: # descending closed-closed ... print i, ... 5 4 3 2 1 0 -1 -2 -3 -4 -5 >>> We can do shortcuts as in: >>> for i in span // 5: ... print i, ... 0 1 2 3 4 5 >>> >>> for i in -5 // span: ... print i, ... -5 -4 -3 -2 -1 0 >>> We can also change the step size (using several techniques) as in: >>> for i in 0 // span(step=2) // 20: ... print i, ... 0 2 4 6 8 10 12 14 16 18 20 >>> >>> for i in 0 // span.by(2) // 20: ... print i, ... 0 2 4 6 8 10 12 14 16 18 20 >>> Returning to the motivating example of PEP 276, we can easily index structures as in: >>> mylist = [0,1,2,3,4,5,6,7,8,9] >>> >>> for i in span / len(mylist): ... print mylist[i], ... 0 1 2 3 4 5 6 7 8 9 >>> or for those that like to be more explicit: >>> for i in 0 // span / len(mylist): ... print mylist[i], ... 0 1 2 3 4 5 6 7 8 9 >>> Other indexing examples: >>> for i in len(mylist) / span // 0: # access in reverse order ... print mylist[i], ... 9 8 7 6 5 4 3 2 1 0 >>> >>> for i in len(mylist) / span: # reverse order short form ... print mylist[i], ... 9 8 7 6 5 4 3 2 1 0 >>> >>> for i in span(step=2) / len(mylist): # access every other item ... print mylist[i], ... 0 2 4 6 8 >>> >>> for i in span(step=3) / len(mylist): # every third item ... print mylist[i], ... 0 3 6 9 >>> But wait, there's more ... This mechanism works outside of for-loops equally well. >>> >>> list(0 // span // 9) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> >>> list(span // 9) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> >>> list(-5 // span // 5) [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5] >>> >>> list(-5 / span / 5) [-4, -3, -2, -1, 0, 1, 2, 3, 4] >>> >>> list(5 // span // -5) [5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5] >>> >>> list(5 / span / -5) [4, 3, 2, 1, 0, -1, -2, -3, -4] >>> >>> list(0 // span(step=2) // 20) [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20] >>> >>> list(20 / span(step=3) / 0) [17, 14, 11, 8, 5, 2] >>> >>> i = 3 >>> i in 0 // span // 5 1 >>> i in -5 // span // 0 0 >>> And, if you order now, we'll throw in: >>> >>> [1,2,3] + 10 // span // 15 + [21,22,23] [1, 2, 3, 10, 11, 12, 13, 14, 15, 21, 22, 23] >>> But wait, there's even *more*. >>> >>> list('a' // span // 'j') ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] >>> >>> list('a' // span(step=2) // 'z') ['a', 'c', 'e', 'g', 'i', 'k', 'm', 'o', 'q', 's', 'u', 'w', 'y'] >>> >>> list('z' // span // 'a') ['z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm', 'l', 'k', 'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a'] >>> The (claimed) advantages with this scheme include: - no syntax changes required (!!!) - handles all combinations of closed/open intervals - handles descending as well as ascending intervals - allows step size to be specified - reuses the "i in iterator" paradigm of existing for-loops - supports shortcuts for the common case of indexing from 0 to len-1 - works outside of for-loops ("in" statement, list & tuple functions) - no confusion with or overloading of list or tuple syntax - no list versus iterator confusion - is reasonably transparent (once you get used to it ;-) - is straightforward to implement On the down side: - not as immediately transparent as "-5 <= i <= 5" Anyway, another nice advantage is that you can take the example implementation below and play with it before finalizing your opinion (which I hope you will do :-). Note, the iterator in the example implementation uses a 2.2 generator, so you need 2.2. (Or you could implement a separate iterator class and try it in 2.1). Now, that *was* fun, wasn't it. Jim ==================================== from __future__ import generators import operator class IteratorBounds: stopOpDict = { (1,0):operator.__lt__, # step positive, rightside open (1,1):operator.__le__, # step positive, rightside closed (0,0):operator.__gt__, # step negative, leftside open (0,1):operator.__ge__ # step negative, leftside closed } def __init__(self,stop=0,start=0,step=1,left='closed',right='closed'): self.stop = stop self.start = start self.step = step self.left = left # 'closed' or 'open' self.right = right # 'closed' or 'open' def __call__(self,stop=0,start=0,step=1,left='closed',right='closed'): return IteratorBounds( stop=stop, start=start, step=step, left=left, right=right) def __iter__(self): start,stop = self.calcStartStop() if start is None: raise StopIteration return step = self.step if ((stop > start and step < 0) or (stop < start and step > 0)): step = -step i = start if self.left == 'open': i = self.calcNext(i,step) if i is None: raise StopIteration return stopOp = self.stopOpDict[(step >= 0),(self.right == 'closed')] while 1: if not stopOp(i,stop): break yield i i = self.calcNext(i,step) if i is None: break raise StopIteration def calcStartStop(self): start = self.start stop = self.stop if isinstance(start,str) and not isinstance(stop,str): try: stop = chr(stop) except: return None,None elif isinstance(stop,str) and not isinstance(start,str): try: start = chr(start) except: return None,None return start,stop def calcNext(self,obj,step): if isinstance(obj,str): try: return chr(ord(obj)+step) except: return return obj + step def __div__(self,other): '''Return an IteratorBounds that is open on the RHS at other''' result = IteratorBounds( stop=other, start=self.start, step=self.step, left=self.left, right='open') return result def __floordiv__(self,other): '''Return an IteratorBounds that is closed on the RHS at other''' result = IteratorBounds( stop=other, start=self.start, step=self.step, left=self.left, right='closed') return result def __rdiv__(self,other): '''Return an IteratorBounds that is open on the LHS at other''' result = IteratorBounds( stop=self.stop, start=other, step=self.step, left='open', right=self.right) return result def __rfloordiv__(self,other): '''Return an IteratorBounds that is closed on the LHS at other''' result = IteratorBounds( stop=self.stop, start=other, step=self.step, left='closed', right=self.right) return result def __pow__(self,other): '''Return an IteratorBounds with step set to other''' if not isinstance(other,int): raise TypeError result = IteratorBounds( stop=self.stop, start=self.start, step=other, left=self.left, right=self.right) return result def by(self,step): '''Return an IteratorBounds with step set to step''' if not isinstance(step,int): raise TypeError result = IteratorBounds( stop=self.stop, start=self.start, step = step, left = self.left, right = self.right) return result def __add__(self,other): '''Create a list on self and add to other''' if isinstance(other,list): return list(self) + other raise TypeError def __radd__(self,other): '''Create a list on self and add to other''' if isinstance(other,list): return other + list(self) raise TypeError span = IteratorBounds() # Default instance #$ Testing def test(testItem): result = list(eval(testItem[0])) == testItem[1] print testItem[0], ' passed:', result def runtests(): testList = [ ('-5 // span // 5', [-5,-4,-3,-2,-1,0,1,2,3,4,5]), ('-5 / span / 5', [-4,-3,-2,-1,0,1,2,3,4]), ('-5 // span / 5', [-5,-4,-3,-2,-1,0,1,2,3,4]), ('-5 / span // 5', [-4,-3,-2,-1,0,1,2,3,4,5]), ('5 // span // -5', [5,4,3,2,1,0,-1,-2,-3,-4,-5]), ('5 / span / -5', [4,3,2,1,0,-1,-2,-3,-4]), ('5 // span / -5', [5,4,3,2,1,0,-1,-2,-3,-4]), ('5 / span // -5', [4,3,2,1,0,-1,-2,-3,-4,-5]), ('-5 // span.by(2) // 5', [-5,-3,-1,1,3,5]), ('-5 // span(step=2) // 5', [-5,-3,-1,1,3,5]), ('-5 // span **2 // 5', [-5,-3,-1,1,3,5]), ('5 // span.by(-2) // -5', [5,3,1,-1,-3,-5]), ('5 // span(step=-2) // -5', [5,3,1,-1,-3,-5]), ('5 // span **-2 // -5', [5,3,1,-1,-3,-5]), ('span // 5', [0,1,2,3,4,5]), ('span / 5', [0,1,2,3,4]), ('-5 // span', [-5,-4,-3,-2,-1,0]), ('-5 / span', [-4,-3,-2,-1,0]), ("'a' // span // 'd'", ['a','b','c','d']), ("'a' / span / 'd'", ['b','c']), ("'z' // span // 'w'", ['z','y','x','w']), ("'z' / span / 'w'", ['y','x']), ("'a' // span.by(2) // 'j'", ['a','c','e','g','i']), ("'z' / span.by(2) / 'p'", ['x','v','t','r']) ] for testItem in testList: test(testItem) From chrishbarker at home.net Mon Dec 3 12:53:30 2001 From: chrishbarker at home.net (Chris Barker) Date: Mon, 03 Dec 2001 09:53:30 -0800 Subject: A modest indentation proposal References: Message-ID: <3C0BBC1A.6E4154F@home.net> I know I said I had posted my last post on this thread, but I can't help myself: I if get this straight, you seem to think that the indentation issue is the ONLY thing getting in the way of NASA adopting Python. The only "show stopper" at any rate. I really, really doubt that. This may be stopping the show at the moment, but if it were resolved, it is very likely that other "nits" would show up. Anyway, you seem to be suggesting that the entire Python community should rise up and support the addition of a feature that very few people in the Python community think is even remotely useful. (granted it would be optional, but it's pretty clear that the Python community does not want a few dozen (or more) dialects of the language around either). The only reason we should support this feature is because it MIGHT be just the thing needed to get NASA to start using the language. While I'm sure most of us on this list would like to see Python gain more users, if we started to add one feature for each substantial organization that wants one, we would get one hell of a mess of a language, that no one would want to use (or two dozen dialects...same result) If NASA is so hung up on block delimiters that it NEEDS them, NASA should create NASAPython, and add them. Problem solved. (or use Ruby, it looks pretty nice, and has block delimiters) By the way, did you suggest to the LISP community that LISP should optionally use something other than all those parentheses? That seems to be the main unimportant stumbling block when people used to C/C++ consider LISP. What we have provided for you here is an exceptionally civil discussion filled with lots of good arguments why indentation based block delimiting is at worst harmless, and at best safer and more robust than C/C++ style brackets. Summarize this discussion, and use it in your arguments. By the way, to an organization that is considering adopting a new language, I would think that the fact that the language is NOT likely to change with every new request would be a good thing! MAybe we are all just being tested? ;-) -Chris -- Christopher Barker, Ph.D. ChrisHBarker at home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From jeff at ccvcorp.com Mon Dec 17 13:46:01 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Mon, 17 Dec 2001 10:46:01 -0800 Subject: More fun with PEP 276 References: Message-ID: <3C1E3D69.9E91DD16@ccvcorp.com> James Althoff wrote: > Are they better than xrange? At least for the case of > a decreasing, open-on-the-left, closed-on-the-right > interval with variable bounds they seem more natural > (I would claim): > > for i in xrange(a-1,b-1,-1): > > versus: > > for i in a > ints() >= b: Note that, for most purposes, this would be almost equivalent to for i in xrange(b, a) which evaluates in the opposite order but provides all the same values. (Yes, there are some cases where order of evaluation will matter, but these are *not* common cases.) I still think that any fancy range/interval notation is a solution in search of a problem--the cases where the current range() behavior is not appropriate, are rare enough that having that much variety of syntax would be more likely to cause confusion than simplify anything. Jeff Shannon Technician/Programmer Credit International From ssthapa at classes.cs.uchicago.edu Mon Dec 10 21:50:34 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Tue, 11 Dec 2001 02:50:34 GMT Subject: lost interest? References: <20011208001123.A5989@casa.parque> <3C14FEBD.AD52B516@attbi.com> Message-ID: Chris Barker wrote: > >By the way, where can I find info about Siphon? The catalog-sig is where the dicussion such as it is occurs. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From virus_catcher at oceanic.com Mon Dec 3 02:19:49 2001 From: virus_catcher at oceanic.com (virus_catcher at oceanic.com) Date: Sun, 02 Dec 2001 21:19:49 -1000 Subject: InterScan NT Alert Message-ID: Receiver, AntiVirus Catcher has detected virus(es) in the e-mail attachment. The Sender has been notified. Date: Sun, 02 Dec 2001 21:19:49 -1000 Method: Mail From: <_be at baunehoej.dk> To: File: docs.DOC.pif Action: clean failed - deleted Virus: WORM_BADTRANS.B From prasent at home.com Sun Dec 9 21:19:39 2001 From: prasent at home.com (Senthil Kumar) Date: Mon, 10 Dec 2001 02:19:39 GMT Subject: smtplib Message-ID: <_YUQ7.24843$ER5.305743@rwcrnsc52> I compiled and installed python 2.1.1 in my linux server, I tried to send an e-mail using python. I wrote a script to import smptlib and send the test message, I get the following error -- import smtplib Traceback (most recent call last): File "", line 1, in ? File "/usr/local/lib/python2.1/smtplib.py", line 42, in ? import socket File "/usr/local/lib/python2.1/socket.py", line 41, in ? from _socket import * ImportError: No module named _socket I am not sure if this is bug or or I missed something during my python compilation. I tried the same script with python 1.6.1 on the same machine it works fine. I appreciate any feedback to this problem. Thanks in advance. Sen Kumar. From robin at jessikat.fsnet.co.uk Tue Dec 18 07:53:58 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Tue, 18 Dec 2001 12:53:58 +0000 Subject: ANNOUNCE: SCons 0.01 now available References: <9vna1e$ghtj3$1@ID-89274.news.dfncis.de> Message-ID: In article <9vna1e$ghtj3$1 at ID-89274.news.dfncis.de>, Bernhard Reiter writes >[Posted and mailed] > >Steven: > >Contratulations to your first release of SCons. >I've been watching the project loosely from a distance and >now I will check it out the next time I need make or similiar. > >I've been wondering: >How is the plan to make the transistion to actually use SCons >to build itself? :) I am not sure that SCon should rely on another >tools... > >The webpages is missing some nice and simple examples. >It is really hard from the documents to have a quick impression on >how a SConstruct file will really look like that replaces one Makefile. > >Thanks, > Bernhard > .... Is there any relationship between scons and the Eric Raymond's linux kernel configuration tool? I hear there is considerable disquiet in the kernel developer universe about abandoning their treasured make tools in favour of something new especially in light of ------------------------------------------------------------------------ Welcome to CML2 Adventure, version 1.6.1. You are in a maze of twisty little Linux kernel options menus, all different. The main room. A sign reads `Linux Kernel Configuration System'. Passages lead off in all directions. :) -- Robin Becker From justin at iago.org Thu Dec 27 14:43:01 2001 From: justin at iago.org (Justin Sheehy) Date: Thu, 27 Dec 2001 14:43:01 -0500 Subject: Python Popularity: Questions and Comments References: Message-ID: "A. Keyton Weissinger" writes: > OK. Here is the question I keep asking myself: If Python is as > cool/easy/powerful/etc as I think it is (and scream from the rooftops at any > opportunity), why do we not see it taking hold in a commercial sense? > > Yes, I know. Many of you will tell me all about either (1) that so-and-so > installer (specifically RedHat) is all about Python; and that (2) XYZ > company uses Python you think, but doesn't want to share their commercial > advantage or some such. I'm going to refer to one specific niche that does not answer this entire question, but is very significant to it nonetheless. A very large portion of software is never sold directly, and thus doesn't ever get promoted in the fashion that I think you are looking for. The software that I am talking about is developed for use internally at a given company, either internally-developed or by contractors. This describes a truly huge amount of software. Companies generally don't even think about advertising this sort of thing, as it serves the internal (though possibly customer-facing) needs of that company. There is no reason for most companies to even mention this type of software externally unless they are contractors that produce such software for other companies. > And I will say, "Um yes. But you're missing my point." Is your point that Python doesn't have a hype engine to match Java's? If so, then I'll just agree quietly. I clearly don't think this is as big a deal as you do. > Have you met the "average professional developer" lately? He/She is a Visual > Basic "guru" of 3-5 (whopping) years experience. He calls open source "share > ware" and states emphatically the following: "Why would I mess with THAT > stuff? None of those open source cowboys code to 'Microsoft' standards." > > Does that make your blood boil? Mine too. But guess what? That guy will be > there in a few more years. He will have been promoted because he got (an > admittedly crappy) product out the door. And then he will spread VB across > the world. > > Oh wait. That's already happened. Sure. There are also plenty of places out there that realize what a disadvantage those companies deeply tied to VB (or whatever) have, and use the technology that is best for the tool at hand. Such places exist, and a number of them thrive. While the MS-driven world may well continue to be the giant for years to come, there will continue to be a large market for those who are able to get the job done as effectively or more so for not being so tied to whatever the current vendor-driven hype or incentive may be. > Do I have the know-how to dive into the Python source code and begin to > address the real serious threading-in-real-world-situations, optimizations, > and memory consumption issues? No. But I am willing to learn... Good. I'm glad to hear it. However, while those items you name might be showstoppers in a few cases, they are not locking Python out of serious commercial development in general. Things are not nearly as bleak as you think. > I will always use Python where it makes sense to use. I just wish it made > sense to use it in so many other places... And I think it can....someday. > P.S. Please limit your flames to either tell me (1) this will never happen > and here's why or (2) how I can help make it happen.... (No flames here.) As an aside, I happen to currently be working (with a small group of colleagues) on such a body of software as I described at the beginning of this message. I'm talking about a large system, involving a lot of the buzzwords one might feel like throwing around: client/server networking, encryption, serious performance/speed constraints, provable (seriously) performance of certain central components, interacting with a huge heterogenous network, components operating on multiple very different operating systems, distrbuted database management, various network protocols, large-volume data transfer, close to real-time reporting and alerting, etc etc etc. Well over 90% of the code being worked on for this project is in Python. When proposing my ideas and design, I was happy to be asked what tools and languages were being used. When I was asked "why Python?" I was able to give a decent answer explaining why I had chosen it for the bulk of the work. That was the last time I heard that question. The only reason that I bring this up is to point out that Python is already in use in very serious comercially-funded development. You might not hear as many advertisements about it, but it is there. -Justin From max at alcyone.com Sun Dec 16 13:36:33 2001 From: max at alcyone.com (Erik Max Francis) Date: Sun, 16 Dec 2001 10:36:33 -0800 Subject: /usr/bin/env: python: No such file or directory References: Message-ID: <3C1CE9B1.87446864@alcyone.com> ddidierd78 wrote: > When trying to run a script, I get the following message: > > /usr/bin/env: python: No such file or directory > > additionally the only thing relating to python in /usr/bin is the file > python2.2 Where did you install Python? /usr/bin/env isn't perfect, it can only search a limited PATH for executables. -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ Laws are silent in time of war. \__/ Cicero Esperanto reference / http://www.alcyone.com/max/lang/esperanto/ An Esperanto reference for English speakers. From Bruce at EckelObjects.com Thu Dec 6 14:56:34 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Thu, 06 Dec 2001 11:56:34 -0800 Subject: Lists of attributes Message-ID: <200112061156340080.01286540@mail.rdc1.sdca.home.com> If I have: class Flower: def accept(self, visitor): visitor.visit(self) def __repr__(self): return self.__class__.__name__ class Gladiolus(Flower): pass Flower.gladiolus = Gladiolus() class Runuculus(Flower): pass Flower.runuculus = Runuculus() class Chrysanthemum(Flower): pass Flower.chrysanthemum = Chrysanthemum() Is there a clever way to get a list containing [Flower.gladiolus, Flower.runuculus, Flower.chrysanthemum] I've got: [j for i,j in Flower.__dict__.items() if Flower in j.__class__.__bases__] But I was hoping for something less awkward... Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From boud at rempt.xs4all.nl Fri Dec 14 12:45:57 2001 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 14 Dec 2001 17:45:57 GMT Subject: Model View Presenter GUI pattern? References: <20011213172833.0bfac3c7.gry@ll.mit.edu> Message-ID: <9vddsl$15t$1@news1.xs4all.nl> george young wrote: > Is anyone using the Model View Presenter GUI framework/pattern in python? > I've been reading bits about it, and it sounds quite attractive. Yes: in http://stage.linuxports.com/projects/pyqt/c4626.htm I discuss it in some detail. I'm now working on an editor in Python that will carry the paradigm to its conclusion. It tends to be difficult to implement the paradigm with a gui toolkit that doesn't use it for every single widget, like Swing attempts. -- Boudewijn Rempt | http://www.valdyas.org From erik at pacific-shores.com Fri Dec 28 00:29:58 2001 From: erik at pacific-shores.com (Erik Myllymaki) Date: Fri, 28 Dec 2001 05:29:58 GMT Subject: REPOST: base64.decodestring gives binascii.error Message-ID: <1$--$$_--_$%%%$%$$@news.noc.cabal.int> should base64.decodestring give a binascii.error if it encounters special chars like '_' and '!' ? -- Erik Myllymaki erik at pacific-shores.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail Message-ID: Control: cancel <3C2C03CB.7030000 at pacific-shores.com> Subject: cmsg cancel <3C2C03CB.7030000 at pacific-shores.com> From: Erik Myllymaki Newsgroups: comp.lang.python X-No-Archive: yes Lines: 2 NNTP-Posting-Host: wonenara.ozemail.com.au X-Trace: ozemail.com.au 1009643060 203.108.164.177 (Sun, 30 Dec 2001 03:24:20 EST) NNTP-Posting-Date: Sun, 30 Dec 2001 03:24:20 EST Organization: OzEmail Ltd, Australia Distribution: world Date: Sat, 29 Dec 2001 13:15:02 GMT This message was cancelled from within Mozilla. From rdsteph at earthlink.net Thu Dec 27 17:15:04 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Thu, 27 Dec 2001 22:15:04 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <3C2B9E04.9957801F@earthlink.net> I just think that it is difficult for for-profit corporations to justify hiring and keeping highly paid developers to work on Python development. Granted Python was originally and primarily developed by open source volunteers, as are most such languages. But it is sure nice having the support of Digital Creations, ActiveState, etc. I am not "knocking" ActiveState, really I can understand their dilemna. How do they generate enough revenues with a Python development team to pay for itself and make a profit? Not easy, I fear; and the economy, which is definitely slowing, sure doesn't help. I hope Digital Creations can make money on Zope, the more the better. I urge us all to support Zope in any way we can (and for that matter, to support any ActiveState Python products we can, and Secret Labs, PythonWare, etc. etc. etc. Python will do better if it has commercial support, in addition to open source volunteers. Of course we need the open source community; without Guido and the rest of the community, there would be no Python. But enthusiastically support any commercial enterprise that supports Python, I say. I especially hope that Zope can be a big money maker for Digital Creations. But I suspect that it is a tough business model they have. I think we should be grateful to them for supporting Python so vigorously and in such important ways. I recently read an interview with a Digital Creations top manager where he said that he hopes someone starts a successful business based solely on providing ISP services using Zope, with full technical support. Is anyone looking into this? Does anyone think this could be a successful business model? I am interested in opinions on this. Ron Stephens http://www.awaretek.com/plf.html Justin Sheehy wrote: > Ron Stephens writes: > > > Furthermore, Ruby is aimed right at the heart of Python's niche. > > What niche is that? > > More importantly, why does this matter? The "aimed right at the heart" > phrasing makes it sounds as though one must defeat and replace another. > > There's no reason why Ruby can't do just fine without this meaning > anything negative about Python. > > > If we view Microsoft's Visual Studio, especially Visual Studio.net's C# > > and VB, as the official 800 lb. gorilla of software development; and if > > we view Java as the 400 lb. gorilla pretender to the throne; and if we > > view Borland's Delphi and Kylix as no more than a smart leader of a > > chimp; then everything else is the pack of open source chimps. > > Oh, you live in a windows-only world. > > Those are definitely all big players, but a lot of large and > significant software happens in environments where VB et al are simply > not viable options due to the fact that they tie you so tightly to one > vendor's platform. > > Python runs in more places than any of the products/languages that you > mention, and this matters a lot to a large number of people. > > > Ruby folks include those who like its more Perl-like syntax > > They can keep it. I love not having line noise mixed in with my programs. > > > They see Python as a compromise between object oriented and > > procedural programming. > > So? Idealists are fun to talk to, but compromises get work done just fine. > > > What so you all think of Ruby, and its impact on Python? > > Ruby - seems decent enough, but I have no reason to use it other than > playing around and because I like seeing how new and different > language implementations work > > Ruby's impact on Python - Not much. For a while the biggest impact > was that a few people would yell about Ruby's superiority at > inappropriate times in various non-Ruby-related forums. That > seems to have died off, and now Ruby seems to be doing just > fine for a young language. This doesn't really mean all that > much to Python, as it is extremely unlikely that either of > these two languages will fully supplant the other. > > > 2. The economy is hurting Python's open source development model. > > It is? From my observations, Python itself has seen far more > aggressive development in the past year or so than in any of the > previous several years. Other than the one comment about Mark > Hammond's situation, what makes you say this? > > -Justin > > From use-net at schabi.de Thu Dec 13 11:22:31 2001 From: use-net at schabi.de (Markus Schaber) Date: Thu, 13 Dec 2001 17:22:31 +0100 Subject: ftpwalf function References: <9vajkq$7kk$1@mail1.wg.waii.com> Message-ID: <20011213172231.0e645357.use-net@schabi.de> Hi, Martin Franklin wrote in comp.lang.python: > Hi, > > Just came up with this function, don't know where else to put it so > ...... Maybe you should submit it to the ftp object maintainer for inclusion. Markus -- "GPL software is not free - the cost is cooperation" From robin at alldunn.com Tue Dec 11 16:21:54 2001 From: robin at alldunn.com (Robin Dunn) Date: Tue, 11 Dec 2001 13:21:54 -0800 Subject: wxPython 2.3.2 Message-ID: <11c301c18289$dcdc7390$0214a8c0@Rogue> > wxPython 2.3.2 has been released as is available for download from > http://wxPython.org/download.org or the wxPython project pages at Sorry, that should be http://wxPython.org/download.php. BTW, there are also Win32 and RPM binaries available for Python 2.2! -- Robin Dunn Software Craftsman robin at AllDunn.com Java give you jitters? http://wxPython.org Relax with wxPython! From max at alcyone.com Fri Dec 7 02:36:18 2001 From: max at alcyone.com (Erik Max Francis) Date: Thu, 06 Dec 2001 23:36:18 -0800 Subject: strict python? References: <3C1060E4.756F33B2@earthlink.net> Message-ID: <3C107172.6866DC18@alcyone.com> Hans Nowak wrote: > Well, 'self.func' is a perfectly valid Python expression, > just like '3'. Not very useful when used like this, but > still, perfectly valid. Seems like now there are warning facilities built into the language it might be useful to have warnings emitted in situations like this (a statement with no side effects) -- things that are truly not error but are genuinely not useful either. Or is the general approach of the core Python team to relegate that to third-party developers (such as PyChecker)? -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ Laws are silent in time of war. \__/ Cicero Esperanto reference / http://www.alcyone.com/max/lang/esperanto/ An Esperanto reference for English speakers. From lull at acm.org Mon Dec 31 14:11:09 2001 From: lull at acm.org (John Lull) Date: 31 Dec 2001 13:11:09 -0600 Subject: Basic threading questions Message-ID: I am writing a module that must be thread-friendly. By that, I mean: 1. All operations must be thread-safe. 2. The module uses a single background thread to perform several long-running operations. If the background thread blocks, it must do so in a way that allows other threads to continue running while it is blocked. I have a couple questions which I have not been able to resolve from the Python documentation. 1. The library reference for the thread module says "Not all built-in functions that may block waiting for I/O allow other threads to run." Is there a list of the built-in blocking operations that either block nicely, or do not block nicely? If not, how would I find out about a particular operation? 2. The Library Reference notes several operations that are not thread-safe, but has few statements that specific things *are* thread-safe. Can I assume that, absent a specific statement to the contrary in the documentation, all built-in operations (and standard library modules?) are thread-safe? If that's too broad a generalization, can I at least assume that the dictionary and list objects are thread-safe, and that adding, deleting, replacing, and accessing attributes of a class are thread-safe? If it matters, I'm using Python 2.2.0 under Win98 and Win2K, but I'd prefer a more general discussion of the issues involved. Is there someplace that addresses Python-specific threading issues like these more thoroughly? Thanks. Regards, John From coca at houston.rr.com Sat Dec 22 02:00:58 2001 From: coca at houston.rr.com (Dan Compton) Date: Sat, 22 Dec 2001 07:00:58 GMT Subject: Python on the desktop References: <94e3fce8.0112210053.2568529d@posting.google.com> <3C238618.9F54E5CA@attbi.com> Message-ID: Read the ISO C++ Standard and tell me where it says anything about that Dan "Courageous" wrote in message news:j7072uspqdi3ion470vjrnfm023b653mck at 4ax.com... > > >Does C++ have a standard GUI?? > > Well, in effect, yes. Since the vast majority of all platforms > are x86 windows platforms, and the vast majority of C++ developers > use Visual C++, it would follow that the standard GUI for C++ is > MFC. :) :) :) > > C// > From dalke at dalkescientific.com Thu Dec 27 05:15:21 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Thu, 27 Dec 2001 03:15:21 -0700 Subject: REPOST: Re: A new message board is up References: <40dbad98.0112262232.1868734e@posting.google.com> Message-ID: <6$--$$-$$$$%_%__-$@news.noc.cabal.int> Andrew Nguyen wrote: >A new message board (that doesn't have the Usenet delay) is up! >Also, usenet SUXXOR (sucks) because itttt issss soooo >cunfuseeeng... Why not switch to an EZBoard? Why have maling >lists that are too confusing? I for one say that we create a > NEW forum! But it does require a login, registration, including address, income(!), and marital status(!!) information, and a 300 line license agreement. Since it's a web based system there's also a lack of good search system, no way to add your own filters, no support for off-line reading, killing a thread, archive messages, or all those other features Usenet readers have accumulated over time. I don't think it can scale up to several hundred messages a day, like c.l.py has. Finally, it's a highly moderated list, and the moderator has the ability to not only kill a thread but can apparently decide who can and cannot particiate. I'll stick with a bit of delay. But then, I started reading usenet on a CDC Cyber machine in '89, so what do I know of these new-fanged gee-haws. :) Andrew dalke at dalkescientific.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed1.earthlink.net!newsfeed.earthlink.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Andrew Dalke" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:15:44 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775845 27193 211.57.49.2 (31 Dec 2001 05:17:25 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:17:25 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From aleax at aleax.it Thu Dec 6 11:15:06 2001 From: aleax at aleax.it (Alex Martelli) Date: Thu, 6 Dec 2001 17:15:06 +0100 Subject: Python evangelists unite! References: Message-ID: <9uo5i7$pr$1@serv1.iunet.it> wrote in message news:mailman.1007590449.2136.python-list at python.org... ... > allow one to add instance-specific attributes. But the Swing designers did > realize that people would need to do this kind of thing so they included a > catchall hashtable in JComponent that clients can use to add > (putClientProperty) and read (getClientProperty) "instance-specific" > attributes. ...while some of the Windows API designers, many years before, given the non-OO framing of that C-language API, had included SetProp, GetProp &c calls in the Windows API... giving exactly the same overall ability. > Generally, when you deal with user interface widgets (in a large GUI > framework) a lot, you tend to see lots of cases where instance-specific > attributes (both fields and methods) come in handy. ...and when you work in some other field, you miss them terriblym if you're used to them from other realms and the framework doesn't provide them... weren't "property lists" for arbitrary symbols supported as far back as LISP 1.5? Alex From ballsacks at xtra.co.enzed Mon Dec 3 01:40:59 2001 From: ballsacks at xtra.co.enzed (^^@++) Date: Mon, 03 Dec 2001 06:40:59 GMT Subject: Newbie: searching an English dictionary for a reg exp References: <3c09f02f.97177874@news.akl.ihug.co.nz> Message-ID: <3c0b1bbe.173865154@news.akl.ihug.co.nz> On Sun, 2 Dec 2001 13:54:24 -0800, "Eugene" wrote: Oops, looks like I spoke too soon with my last post. The matches aren't working properly, in that it seems to be finding too many incorrect matches: def searchfor(regpattern): print "Searching for",regpattern, matchcount = 0 reg = re.compile(regpattern, re.I) m = "" for word in dictionary: m = reg.match(word) if m: outfile.write(m.group()+' ') matchcount += 1 print "Found",matchcount return matchcount Produces: Read 1187 words from the dictionary Read 1 clues from clues.txt Searching for abac. Found 14 Now, in my dictionary there are only 2 words that would match that criteria - abaca and aback, right? It seems to be returning what is I guess (abac)*: dictionary = ... Ababua abac abaca abacate abacay abacinate abacination abaciscus abacist aback abactinal abactinally abaction abactor abaculus abacus Abadite ... I get the feeling I'm barking up the wrong tree by using m.group(). All I want is the word that matches! IMO the doco for MatchObject (match-objects.html) is useless (or maybe I am). Thanks for any help -Matt From virus_catcher at oceanic.com Thu Dec 27 17:05:55 2001 From: virus_catcher at oceanic.com (virus_catcher at oceanic.com) Date: Thu, 27 Dec 2001 12:05:55 -1000 Subject: InterScan NT Alert Message-ID: Receiver, AntiVirus Catcher has detected virus(es) in the e-mail attachment. The Sender has been notified. Date: Thu, 27 Dec 2001 12:05:55 -1000 Method: Mail From: <_tania at duby1.freeserve.co.uk> To: File: info.DOC.scr Action: clean failed - deleted Virus: WORM_BADTRANS.B From Bruce at EckelObjects.com Sun Dec 23 14:40:48 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Sun, 23 Dec 2001 11:40:48 -0800 Subject: vi or emacs for editing Python on Linux? In-Reply-To: References: Message-ID: <200112231140480430.008C85F6@mail.rdc1.sdca.home.com> Long ago, when gnu emacs was first appearing, I was just starting to use Unix and I began to learn emacs instead of VI, the person coaching me (as I was sliding down the one-way chute of custom keybindings) suggested that I *don't* rebind the keys. His scenario was in going to someone else's machine and working with them. It stuck, and I didn't. Alas, after all the stuff I did back then -- including writing an assembler for a 4-bit Harvard Architecture processor in Gnu-Lisp -- I've forgotten virtually everything I knew about the innards of gnu emacs. But I still remember the basic keybindings, and have benefitted greatly from never rebinding them, since I don't need to get my own keybindings installed every time we do some new installation. *********** REPLY SEPARATOR *********** On 12/23/01 at 2:20 PM Roy Smith wrote: >Fernando Perez wrote: >> The only problem I now have is that even though I fly in Xemacs, I can't >> do anything in a 'raw' emacs, I need *my* customizations :) > >This is very true. I work in a mostly vi shop, but one other guy and >myself are die-hard emacs fans. Not only can we not edit in each other's >login sessions (because our emacs key bindings are different), we almost >can't even edit on each other's keyboards, because some of the keys are in >different places! > >Every once in a while one of us will observe the other doing somethink >cool >in emacs and say, "how'd you do that?". As often as not, the answer will >be a slightly puzzled look, followed by pantomiming typing the key >sequence >in mid-air :-) I've been doing it so long, my fingers know how to do >somethings that I have to conciously have to think about to figure out >what >the actual keystrokes are. > >About all the vi I really know is :q!. If I'm someplace where >there's no emacs, I survive on ed until I can get emacs up and running. >-- >http://mail.python.org/mailman/listinfo/python-list Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From res0ne7x at verizon.net Tue Dec 4 14:05:39 2001 From: res0ne7x at verizon.net (Gary Herron) Date: Tue, 4 Dec 2001 11:05:39 -0800 Subject: Making a string raw In-Reply-To: <59333ea6.0112041014.7908e9ab@posting.google.com> References: <59333ea6.0112041014.7908e9ab@posting.google.com> Message-ID: <200112041906.fB4J6BP15366@out003pub.verizon.net> There is no such thing as a raw string! A string is a string is a string (except for unicode strings) and it might, or might not, contain back-slashes or non-ascii characters. The 'raw' part has to do with string literals, which is how create strings in a python program. Other ways of creating strings, such as a Tkinter textbox, may or may not have an easy way to create string values with various special characters. (If memory serves, a '\n' in a tkinter textbox produces a two character string -- backslash followed by "n".) Example: spam = r'hello' eggs = 'hello' produce exactly the same string value. Neither is raw or un-raw, and both are Python strings with five characters. The same hold true for the following two ways of creating strings: spam = r'C:\abc' eggs = 'C:\\abc' Again the two strings have the same value, neither is raw or not raw, and both have a backslash If what you want is to take a string which has various backslash sequences such as "\n" and convert such sequences into newlines, then try: str.replace("\\n", "\n") or str.replace(r"\n", "\n") both of which specify replacing the two character string backslash-"n" with a one character newline. Hope that's all clear, Gary Herron On Tuesday 04 December 2001 10:14 am, Rune Nesheim wrote: > Could any of you lot tell me how to convert a string stored in > avariable to a raw string? > > I know I create a raw string this way: > > spam = R'hello' > > But if I don't know what the string is going to contain, for example > if I fetch from a Tkinter text-box to the variable 'eggs' and want to > convert 'eggs' into a raw string. From richardkessler at matteicos.com Tue Dec 18 15:13:17 2001 From: richardkessler at matteicos.com (Richard Kessler) Date: Tue, 18 Dec 2001 20:13:17 -0000 Subject: Newbie Wondering About Database Support? Message-ID: I have recently discovered Python and am excited about the possibility of developing with the language. Unfortunately, I develop database centric applications, MS SQL Server, etc. and I do not see much talk about Python and access to databases. Am I missing something or is Python not intended for that purpose. I would love to replace programs currently in VB with Python, but they must be able to access databases. Thanks in advance. Richard From jkraska at san.rr.com Sat Dec 15 00:39:41 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 15 Dec 2001 05:39:41 GMT Subject: "Pythonj Fatal error: UNREF invalid object Message-ID: <38ol1uoj0nufo0tu50kvhq112p4llc6hqv@4ax.com> Regarding the subject line, what semantics causes the above fatal error to occur, generally? C// From fperez528 at yahoo.com Sun Dec 2 21:24:59 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Tue, 04 Dec 2001 01:52:59 +2328 Subject: Tuples -> Function Params? References: Message-ID: <9ui30h$62e$1@peabody.colorado.edu> Philip Swartzleonard wrote: > Just a quick question, right now i'm doing this: > > self.color = afloat,bfloat,cfloat > . > . (change functions) > . > a,b,c = self.color > glColor3f(a,b,c) > > [actual function dosen't mater except that it isn't something i > can > just change] > > Ok, the question is, is there a way to do this where i don't > unpack > the tuple and pass sepearte arugments? This would be most > convienent. Function(tuple) doesn't work... and i couldn't seem to > find any other info in the docs... > The *args syntax is probably what you want: In [1]: args = (1,2,3) In [2]: def f(x,y,z): print x+y+z ...: # this won't work: In [3]: f(args) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) ? TypeError: f() takes exactly 3 arguments (1 given) # but this will: In [4]: f(*args) 6 From rdsteph at earthlink.net Thu Dec 27 17:44:09 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Thu, 27 Dec 2001 22:44:09 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <3C2BA4D3.5F0BC994@earthlink.net> Andrew Dalke wrote: (my responses are interspersed without leading blue lines ;-)) > Ron Stephens: > >How is Python doing popularity wise? > > I can tell you that it's doing well in computational chemistry. > I know several places that have switched to doing development > in Python over Perl or other VHLLs. I think it's because of > Python's readability and its easy ability to add new data types > which act like native objects. > > In structural biology it also seems to be popular. I know > of several Python projects (PyMol, VMD, MMTK, MSMS, Chimera), a > couple old ones in Tcl, none in Perl, none in Ruby. Although > I'm biased by prefering Python, so I'm sensitized to Python > projects. > > In bioinformatics, Perl is still the most popular, although > we (the Biopython project) are trying. :) > I am considerably heartened to hear of such prominent success for Python in the biological sciences. Thanks for sharing this info! > >Python, while fabulously successful, is at an interesting point in its > >growth curve. It will be difficult to maintain the extremely high rate > >of growth exhibited so far; new contenders are possible problems; and > >the recessionary economy could also negatively impact Python's growth. > > It's impossible to undergo a meteoric growth forever. Exponential > growths must turn into S-curves. So why should there be a need for > an extremely high growth rate? > > >1. Ruby is an especially interesting competitor to Python. I have been > >monitoring the Ruby newsgroup, and it shows incredible growth and > >vitality. Furthermore, Ruby is aimed right at the heart of Python's > >niche. > > I looked at Ruby last summer. I read the documentation and > followed the newsgroup for a couple months. I was able to follow > what was going on, but didn't want to see myself explaining it to > non-software developers; that is, the chemists, biologists, and > physicists who use the tools I develop. > > I don't see how it's aimed at "the heart of Python's niche" -- what > do you see as Python's niche? I see it as a language which is > usable by beginning programmers and enjoyable by experienced > developers. I don't see Ruby really fitting the first of those. I mean simply that Ruby is so much more similar to Python than any other language, that this causes the two languages to have to share the available "market" of interested developers. In other words, both Ruby and Python are very high level, object oriented, interpreted, modern, scripting languages that are also powerful enough to be used as general purpose programming languages. Neither Python nor Ruby is relegated to any single narrow niche; and both are, in my opinion, well thought-out and implemented languages and both are attractive to intelligent developers looking for ease of use, power, expressiveness, and most importantly, speed of development. I do not think you can say all of the same things about any other two languages. Thus, while I admire Ruby, I suspect that it divides the pool of developers who might otherwise be all in the Python *camp*. > > > (I don't see how '@var' obviously means "instance variable" nor > '$var' for "global variable", while Python's is much easier to > explain, since the 'self.' makes it more apparant. I like that > Python doesn't have an implicit return of the last evaluated > expression, making it easier to find them. I like that I can > say "methods inside of __s are special" as compared to Ruby where > you have to memorize that things like "to_s", "initialize", have > special meaning. I like that empty function calls still need > a () in the declaration. I don't like that Ruby promotes adding > methods to existing classes, since I think that can lead to > conflict. I think 'abs(x)' is better than 'x.abs' or 'x.abs()'. > I'm forgetful, so I don't like special syntax shortcuts, like > a = %w{ ant bee cat dog elk } > for > a = ["ant", "bee", "cat", "dog", "elk"] > (especially since it can be written > a = "ant bee cat dog elk".split() ) > I don't like that regular expressions are treated with special > syntax. I don't like having aliases, as Hash.indexes/indicies, > Array.len/size. Ohh, and Hash has three equivalents in > has_key?(key) / key?(key) / include?(key) . > > At the implementation level, I like that the C Python implementation > uses native threads rather than it's own threading package. That > lets me work with other threaded libraries more easily. I like that > the C garbage collector is built on reference counting, since I > need the guaranteed semantics more than I need lesser implementation > complexity. ) > Your points above are all well taken.. I think Python is *even easier* to learn and to use than Ruby. But Ruby aficionados might disagree with us on this point ;-))) > > >If we view Microsoft's Visual Studio, especially Visual Studio.net's C# > >and VB, as the official 800 lb. gorilla of software development; and if > >we view Java as the 400 lb. gorilla pretender to the throne; and if we > >view Borland's Delphi and Kylix as no more than a smart leader of a > >chimp; then everything else is the pack of open source chimps. > > Luckily, I work in a field where most people use unix for real > development, so solutions based on C# and VB just don't exist, and > there's a huge installed based of C and FORTRAN code. I do know one > company doing some work with Kylix under Linux. > > So I can't really comment on this paragraph. > > >The open source world is still led by PERL, but PERL is truly more of a > >text processing, web CGI, scripting specialist; not so much of a direct > >threat to Python. > > Why can't we all just get along? > We can get along and we do. I am just a curious Python hacker who follows the Ruby language out of interest. > > Seriously, in my usual environment there are half a dozen "real" > programming languages in use (C, C++, FORTRAN, Python, Perl, Tcl), > a couple times more homebrew scripting languages (related to the > different scientific packages in use), and a slew of programs > which are only accessable through the command-line. > > > Python aims to be a powerful general purpose > >programming language, in addition to being a very easy to learn and easy > >to use scripting language. And who can say that Python does not succeed > >very well in all of the above? > > Is this what you see as Python's niche? Someone in the Perl group > would say exactly the same thing, as would someone from Smalltalk, > and from Ruby, and from Tcl, and from .... > > >But Ruby is also a more general purpose, object oriented, relatively > >easy to read, language. > What do you mean by "more general purpose"? I didn't see all that > much in Ruby which was more general purpose than Python, especially > now with the closing of the type/class dichotomy. I guess the > biggest ability is being able to send a block to be evaluated. > I know Smalltalk-ers love it, but to me things like I do not mean to say that "Ruby is more general purpose than Python". I meant to indicate that Ruby is more general purpose than , say, Perl, or Tcl, or PHP, or JavaScript etc., and thus more of a direct competitor to Python , precisely *because both languages are so admirably suited to general purpose programming. ;-))) > > > 3.times do > print "Ho! " > end > > aren't as easy to explain or understand as > > for i in range(3): > print "Ho! " > > (I know, I've been contaminated by years of BASIC, PASCAL, C, > and C++, but so have my clients.) > > > Ruby folks include those who like its more > >Perl-like syntax, but Ruby's core converts believe that its pure, > >absolute object oriented nature exceeds those of Python and make it more > >worthy to long term success. > > I know there's the argument that Ruby is "pure", but I think the > whole "functions are really private members of the Object base > class" idea is a sign of impurity, done because people are used to > writing functions and not having to define a static class method > like one might have to do for Java. But I think impurity is a > good thing. So I think the call for purity to be a wrong argument. > > > They seem to see Ruby as a more modern, up-to-date version > > of Python. > > I thought most people see Ruby as a more modern version of > Perl than Python. I definitely see it as a cross between > Perl and Smalltalk, with some ideas derived from Python. > Good point. Ruby is much more like Perl in syntax than it is like Python, and Matz himself has so commented that he borrowed a lot more from Perl than Python. However, in my opinion, Ruby still *appeals* very much to folks who like Python because of its object orientated nature, as well as its clean design. A lot of folks come to Ruby from Perl for the same reasons that lots of folks come to Python from Perl, I suspect. Thus, Ruby and Python are competitors, like it or not. Heck, Bruce Eckels seemed to say "ah heck, why did someone have to go and do such a close knock-off of Python for, anyway" (Paraphrase only!!!!) Of course, Guido said that Ruby's design philosophy didn't appeal to him at all. And maybe I am beginning to understand a little of "why", Guido might feel that way, as I read through the comments on this thread. By the way, Matz exhibits nothing but respect for Guido and Python. I also like the way Matz says only complimentary things about all languages; you'll never catch him saying anything bad about Python or Perl. He even steps in on comp.lang.ruby often to chastise over-zealous followers who have the temerity to bad mouth Python. You have to admire Ruby's Japanese creator for that attitude. Also, keep in mind, Ruby is very popular in Japan, which I think is great ! > > They see Python as a compromise between object oriented and > > procedural programming. > > And that's bad because ... why? Compromise is often seen as > bad, yet the world works on it. Others replace the term > "compromise" with "synthesis" or "fusion" or "hybrid" or many > other words. The phrase "multiparadigm" is another fun one. > > >Be that as it may, I suspect that much of Ruby's momentum is simply due > >to its newness; all things new are seen as sexy in this world of ours. > >But nonetheless, Ruby has the following going for it. > > I agree with you. I also think people are willing to give Ruby > a try, because they don't want to be seen as a fuddy-duddy. > > >Now, its more like a 4:3 ratio, with Python getting say, 4000 per month, > >and Ruby 3000. At this rate, Ruby could pass Python is afew months, by > >this measure! > > How do they get any work done? I can barely follow the outlines > of most of c.l.py these days. Oh, and much of the development email > is on a pretty high-traffic mailing list, so c.l.py doesn't reflect > all the Python traffic. Then there's the various lists like for > Jython and Zope, which get some Python questions. > > Again, talking about the fields I'm in, I've been presenting > Python at computational chemisty and biology conferences for > the past three years. I keep waiting for someone to ask me > "what aout Ruby?", but as of yet no one has. > > There is one site for Ruby in bioinformatics -- bioruby.org. > That site seems to be down right now, but as I recall, the > packages they had were pretty minimal. They had a presentation > at the last Bioinformatics Open Source Conference, but it > didn't show any real advantages over the equivalent Perl. > We were pushing to get a BioRuby developer at the upcoming > Bioinformatics hackathon (promo: co-sponsored by O'Reilly and > Electric Genetics, with support from the Open Bioinformatics > Foundataion, AstraZeneca, and your's truely, Dalke Scientific > Software :) We couldn't get anyone. > Sounds very exciting. It is just such success stories about Python that I love to hear !!! ;-)) > >b. Ruby is getting alot of favorable press, and new books are coming out > >now. First, Pickaxe , now, Matz' own Ruby in a Nutshell and several > >others soon to be or already here. > > If books are a good metric, then there's also plenty of new Python > books coming out (as you know from your dozen plus reviews :). > And Perl ones. And Java ones. It's just easier to notice when > there are only a few books. > True. Three are now over 20 Python books out there ;-)) And, by one very important measurement, Python blows Ruby away with 1,302 SourceForge projects compared to only 81 for Ruby. We also blow away Lisp and Scheme on this measurement, but predictably perhaps lose to PHP and Perl, Java and of course, C and C++ (C is the number one in this category). > >c. Ruby actually seems to be a nice language to me. Its object oriented > >features seem well thought out and yet its still easy to comprehend. > > I had problems with it. I could comprehend Python's features > from the documentation. I still can't from the Ruby on-line docs. > One thing is that Ruby objects seem so heavy-weight to me. For > example, Hash has support for a built-in default object, and > for "freezing" hash. So if I wanted to make a Hash-like object, > I need to do quite a bit, I think. > > (Again, I got into Python about 6 years ago, when the dictionary > object which much lighter weight than it is now, and I learned > about the changes when the occured instead of all at once. Still, > Python's dictionary seems conceptually easier to understand and > use than Ruby's.) > >d. Ruby has some smart and aggressive coders doing libraries, > >extensions, Java version etc. etc. etc., tehy are agressive and > >motivated; tehy think they will see world domination ;-))) > > They will leanr how to sepll 'tehy'? :) > > Python, Perl, and Java also have "smart and agressive coders" etc. > For example, I've seen nothing in Perl or Ruby to match > Marc-Andre Lemburg's mxTextTools, which I use for my Martel > parser. > > >2. The economy is hurting Python's open source development model. > > It is? I guess I started when Guido worked at Stichting > Mathematisch Centrum, before CNRI, and I don't think then he could > ever work full time on Python. The recent spate of development > progress has actually worried me, since I'm not able to follow > all this new work, like __getattribute__ and __slots__ and > new-style classes. > > >Without Mark Hommond's win32 work, Python would be a mere shell > >of its current self. > > A lot of that work was when he was a contractor, before working > with ActiveState. I know PythonWin 1.5.2 has no ActiveState > copyright notice in it. > > I can't make any real statement about the people you mentioned. > I can say Python developed without a lot of dedicated resources > for it, so I'm not going to worry about it. Besides, why should > it affect Python any less than other projects? > > >3. Third, Python faces the laws of large numbers. It is exceedingly hard > >to continue a growth spurt past a certain point. Maybe were at that > >point, maybe not. But ask yourself this; Two years from now, will you > >see more Python success stories, more growth, or a leveling out? Five > >years from Now? > > So? What's the growth curve in C? Do you see more C success stories? > More growth, or a leveling out? > > I expect to have success stories of my own in the 2-5 year range. > > Frankly, for a while I was learning about better and better ways > to develop software: BASIC -> Pascal -> C -> C++, then C/C++ augmented > with Tcl, then Perl, then Python augmented by C/C++, which is > where I'm at now. I also tried out a dozen other languages, > including Prolog, APL, Lisp, and other classics, and read about > more languages, including Smalltalk and Eiffel. > > As far as I can tell, I think the basics of the Ruby/Smalltalk/ > Perl/Python/C/C++/Java/... class of languages are pretty well > understood. I don't think Ruby or any similar language can > offer anything sufficiently new enough to get many people to > change. The only new topic my limited prognositications can > make for the future is aspect oriented programming, and I don't > know enough of that to make any firm statement. > > BTW, I think what's going to happen in Python's future is > 1) refactoring browsers, like what Smalltalk has, 2) better > performance through some sort of typing, and 3) the development > of more specialized libraries for different domains. (Please > bear in mind that I'm biased by being a library and application > programmer.) > > >Ten years from now, will Python still be Relevant? Oh, I know that > >Python will still be being used, and the community will still exist, but > >will it really be a thing that seems to Matter, like it does now. > > I hope not. I want to have new tools and new ways of thinking > on programming. It's still a lot of hassle to develop new code, > and I'm a slacker in the Gen-X mold, with a short attention span. > (Okay, the length of this response belies that statement :) Still, > I want something better then Python, and I hope that in ten years > we'll at least start using it. I also hope I'll recognize it > early enough, like I did with Python. > > Mind you, Python's data model is still simple enough that it can > be ported to other systems without much effort. > > Andrew > dalke at dalkescientific.com From debl2NonoNospammy at bellatlantic.net Sat Dec 15 17:10:17 2001 From: debl2NonoNospammy at bellatlantic.net (David Lees) Date: Sat, 15 Dec 2001 22:10:17 GMT Subject: How 2 invoke python 2 read from text file under W2k References: <3C1BBECF.E460DBEC@htp-tel.de> Message-ID: <3C1BCA57.C5E59D9B@bellatlantic.net> You might find it easier to use an IDE for writing code, such as PythonWin. I like PythonWin, but that is personal preference. You can obtain the PythonWin distribution from Activestate at: http://www.activestate.com/Products/ActivePython/ Under PythonWin, start it up and then go to the menu, select 'New' and then 'Python Script'. Type your Python code into the editing window. Save it and then run it by using the 'Run' iten on the 'File' menu. There are shortcuts, such as 'ctrl-R' or just pushing the run icon on the PythonWin toolbar. Under IDLE, fire it up and then chose the 'New Window' item on the file menu. Enter your code in the new window, save using the 'save' item on the file menu and run using the 'Run script' item on the 'Edit' menu (or use the shortcut 'ctrl-F5'). Note that the interface on IDLE is a bit different than PythonWin, because each new window has its own menu, while PythonWin has a single menu on the main screen. Hope this helps, David Lees Tom Karas wrote: > > Hello World, > > in the tutorial: "Instant Hacking" theres is this little programm: "# > Area calculation program". Which apparently must be written into a text > file and then somehow the python interpreter as to "compile" this file. > > My problem is, that i do not know how to tell python to read a text.file > and to "compile" it. > > I read the following lines of the "Python Tutorial" from Guido van > Rossum a.o. and tried both solutions under Windows 2000 to use a > text.file as input source - but none of them worked. > > Quotation from the tutorial: > "Note that there is a difference between "python file" and "python > In the latter case, input requests from the program, such as calls to > input() and raw_input(), are satisfied from file. Since this file has > already been read until the end by the parser before the program starts > executing, the program will encounter end-of-file immediately. > In the former case (which is usually what you want) they are satisfied > from whatever file or device is connected to standard input of > the Python interpreter" > > Any help even a link which explains the necessary steps to use text > files as input source for the python interpreter under win2000 would be > really appreciated. > > Best regards > Tom Karas From ws at mystrobl.de Sun Dec 16 04:07:52 2001 From: ws at mystrobl.de (Wolfgang Strobl) Date: Sun, 16 Dec 2001 10:07:52 +0100 Subject: How to get currently active window on Win32? References: Message-ID: On Sat, 15 Dec 2001 17:53:49 -0800 (PST), David Brady wrote : >More win32all questions... is it possible to get the >handle of the window that currently has the focus? >win32gui.GetActiveWindow() fails because I'm looking >for a window outside the process of my Python script. E:\>python ActivePython 2.1.1, build 212 (ActiveState) Python 2.1.1 (#20, Jul 26 2001, 11:38:51) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. >>> import win32gui >>> import time >>> for x in range(10): ... time.sleep(1) ... print x, win32gui.GetWindowText(win32gui.GetForegroundWindow()) ... 0 cmd - python 1 cmd - python 2 (Untitled) * SciTE 3 (Untitled) * SciTE 4 ActivePython Documentation 5 ActivePython Documentation 6 PythonWin 7 PythonWin 8 PythonWin -- Thank you for observing all safety precautions From kmilo0 at hotmail.com Thu Dec 27 07:05:47 2001 From: kmilo0 at hotmail.com (Kmilo) Date: 27 Dec 2001 04:05:47 -0800 Subject: REPOST: Re: Python 2.2 RPMs are here References: Message-ID: <5$--$$_----_%-_$$$@news.noc.cabal.int> Guido van Rossum wrote in message news:... > Sean Reifschneider made RPMs for Python 2.2. Go get 'em at: > > http://www.python.org/2.2/rpms.html > > --Guido van Rossum (home page: http://www.python.org/~guido/) What version of Tcl\tk y need for run tkinter? ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsfeed.berkeley.edu!ucberkeley!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: kmilo0 at hotmail.com (Kmilo) Newsgroups: comp.lang.python Subject: cmsg cancel <19eb8d3d.0112270405.24ab492c at posting.google.com> Control: cancel <19eb8d3d.0112270405.24ab492c at posting.google.com> Date: Mon, 31 Dec 2001 05:09:45 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775810 27193 211.57.49.2 (31 Dec 2001 05:16:50 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:16:50 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From buzzard at urubu.freeserve.co.uk Wed Dec 5 14:04:05 2001 From: buzzard at urubu.freeserve.co.uk (Duncan Smith) Date: Wed, 5 Dec 2001 19:04:05 -0000 Subject: PyInline problem References: <9uljcb$8ap$1@newsg4.svr.pol.co.uk> <9ulksl$f0o$1@endevour.netg.se> Message-ID: <9ulr4i$bb9$1@newsg3.svr.pol.co.uk> Sorry about that. The following does not build. import PyInline m = PyInline.build(code=""" #include #include int my_func(int a) { if(a < 0){ exit(1); } return a * (a+1); } """, language="C") i.e. >>> running build running build_ext building '_PyInline_9b0b542783ccacbbb1a5773185ead759' extension creating build creating build\temp.win32-2.0 creating build\temp.win32-2.0\Release C:\Program Files\Microsoft Visual Studio\VC98\BIN\cl.exe /c /nologo /Ox /MD /W3 /GX -IC:\Python20\Include /Tc_PyInline_9b0b542783ccacbbb1a5773185ead759.c /Fobuild\temp.win32-2.0\Release\_PyInline_9b0b542783ccacbbb1a5773185ead759.o bj Traceback (most recent call last): File "C:\Python20\Pythonwin\pywin\framework\scriptutils.py", line 301, in RunScript exec codeObject in __main__.__dict__ File "C:\Python20\my_module.py", line 14, in ? """, language="C") File "C:\PYTHON20\PyInline\__init__.py", line 38, in build return b.build() File "C:\PYTHON20\PyInline\C.py", line 45, in build self._compile() File "C:\PYTHON20\PyInline\C.py", line 265, in _compile raise BuildError(e) BuildError: error: command '"C:\Program Files\Microsoft Visual Studio\VC98\BIN\cl.exe"' failed with exit status 2 >>> From wurmy at earthlink.net Fri Dec 28 10:12:20 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Fri, 28 Dec 2001 15:12:20 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <5$--$$_----_-$--_$@news.noc.cabal.int> Alex Martelli wrote: > > "Steve Lamb" wrote in message > news:slrna2nhfo.nme.grey at teleute.dmiyu.org... > > On Thu, 27 Dec 2001 17:48:13 +0000, phil hunt > > > wrote: > > > Python runs quickly on my 300 MHz box, which is 3 times slower > > > than the slowest PC you can buy today. It can only get more popular. > > > > Well, if you take the measure of just pure Mhz.... 4 times slower. ;) > > FIVE or more. 1.5 GHz desktop machines are hardly news these days. Hey, you guys, stop dissing my box like that! >=) (900 MHz, bought last month...) --Hans ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.berkeley.edu!ucberkeley!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Hans Nowak Newsgroups: comp.lang.python Subject: cmsg cancel <3C2C8A86.50C74E60 at earthlink.net> Control: cancel <3C2C8A86.50C74E60 at earthlink.net> Date: Mon, 31 Dec 2001 04:51:55 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775350 27193 211.57.49.2 (31 Dec 2001 05:09:10 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:09:10 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From pythonnet at hotmail.com Thu Dec 27 01:38:39 2001 From: pythonnet at hotmail.com (Andrew Nguyen) Date: 26 Dec 2001 22:38:39 -0800 Subject: REPOST: A new forum is up! Message-ID: <0$--$$-$$$$%%-_--$@news.noc.cabal.int> A new forum for Python is up. It has a better feel to it than this forum (in my opinion) it is at ezboard at: http://pub19.ezboard.com/bthepythonmessageboard95602! ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: pythonnet at hotmail.com (Andrew Nguyen) Newsgroups: comp.lang.python Subject: cmsg cancel <40dbad98.0112262238.73fc14f9 at posting.google.com> Control: cancel <40dbad98.0112262238.73fc14f9 at posting.google.com> Date: Mon, 31 Dec 2001 02:47:16 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775888 27193 211.57.49.2 (31 Dec 2001 05:18:08 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:18:08 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From James_Althoff at i2.com Wed Dec 5 15:08:41 2001 From: James_Althoff at i2.com (James_Althoff at i2.com) Date: Wed, 5 Dec 2001 12:08:41 -0800 Subject: more fun with PEP 276 Message-ID: David Eppstein wrote: >But there isn't a huge distinction between "works only in a for loop" and >"produces general-purpose iterators" because of list comprehensions: > L = [i for -5 <= i <= 5] Agreed. Still tuple([i for -5 <= i <= 5]) # actualize list first, then convert. extra syntax, too isn't quite as nice as tuple(-5 <= ... <= 5) Or if I need to pass an interval around I would like to be able to say: myObject.setInterval(left < ... <= right) # I really want an interval not an actualized list instead of having to resort back to: myObject.setInterval(xrange(left+1,right+1) # left < i <= right doesn't help me here Plus, "-5 <= i <= 5" doesn't provide a step value (other than 1 and -1 -- important to some, not important to others). And, to me, the following is reasonably clear pseudo-code: for i in n > ... >= 0: for j in i < ... <= n: if i == j-1: V[i,j] = id else: V[i,j] = min([q(i,k,j) @ V[i,j] @ V[j,k] for k in i < ... < j]) So I think it would be nearly ideal if one could implement -5 <= ... <= 5 instead of -5 // span // 5 but with the same functionality. Jim From fperez528 at yahoo.com Wed Dec 12 13:27:13 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Thu, 13 Dec 2001 17:55:13 +2328 Subject: Python CPAN beta test References: Message-ID: <9vbins$4f3$1@peabody.colorado.edu> Suchandra Thapa wrote: > I've gotten ciphon to the point where I tihnk it's ready for beta > testing and am looking for people willing to help test it. Currently [snip] BRAVO! Once my IPython project is distutils-ready I'll send it in, but in the meantime I'd like to congratulate you. I really hope this makes it through. Despite the non-believers I still think this is great. Parnassus is very nice, but you often hit dead links, the interface isn't the most pleasant, and above all, it's not automated. A system which allows a remote retrieval interface is key. Once that's in place, it's trivial to write either command-line or gui tools to talk to it, install things, etc. I think of the Vaults as a 'pre-filtered google for python', while a Cpan-like tool is a completely different (and altogether far more useful) animal. So congrats, and good luck! cheers, f. From daves_spam_dodging_account at yahoo.com Mon Dec 10 16:15:32 2001 From: daves_spam_dodging_account at yahoo.com (David Brady) Date: Mon, 10 Dec 2001 13:15:32 -0800 (PST) Subject: lost interest? Message-ID: <20011210211532.67032.qmail@web21106.mail.yahoo.com> > -----Original Message----- > From: Chris Barker [mailto:chrishbarker at attbi.com] > > Justin Sheehy wrote: > > > I'd ask a different question from yours. Why is > > it a problem that Python doesn't have an > > equivalent to CPAN? "Perl has it" isn't > > enough. ...because Ruby might get one? ;-) > A big problem I have seen is people not wanting to > use exactly the > module they really nedd because it is "not part of > the standard > distirubion". If it was a whole lot easier to find, > get and install > third-party packages, perhaps this concern would go > away. Here's a story from my perl days. Imagine this existed for Python, and then decide if you're willing to continue suffering without this feature.... :-) In my last job, we added perl to the "required tools" of a 50-developer team spread across 5 U.S. cities and Europe. We found a Very Clever thing that perl could do to make sure our datasets were intact, and to autotest each developer's code as it was written. This amount of autochecking and testing was necessary because it wasn't convenient for me to fly to--or even call, really--Germany and scream at the developer there if she broke the build. Nor her at me when I did (which was far more likely). The problem was, half the developers on the team didn't know perl, and didn't want to learn it. And of the 12 or so "apps" written in perl, 8 required modules not packaged with the ActiveState perl distro. Our manager looked at the first 5 or 6 apps that we were using in our home office, and vetoed them unless we could find a way to resolve the I.T. nightmare of getting all the developers on the same page with a perl distro that could run our apps. Because CPAN existed, we were able to easily write an "autoinstaller" module. Every time you ran one of our scripts, it checked the requirements, and if you were missing a module, it went out, got the module, installed it, and then resumed running. You didn't even have to restart the script. If you didn't have a module, you just had to wait an extra minute or two the first time the script ran. I am on a new team now, and I am evangeling Python far and wide. One of the biggest roadblocks I've encountered is telling people, "Okay, get Python. Now get win32all. Now get wxPython. Now get mx..." Granted, with a "CPyAN", they'd still have to go get them. But it wouldn't be long before autoinstallers began appearing that would make life much easier for all concerned. *shrug* I love Python. I've been programming Python for 2 months now, and I have completely caught up and surpassed the skill I had after 3 years of hacking perl. Absence of a CPyAN won't stop me from using Python. But it would be really, really cool to have one. Just my $0.02. (Quite the bargain, on a strictly per-word basis!) -dB ===== David Brady daves_spam_dodging_account at yahoo.com I'm feeling very surreal today... or *AM* I? __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com From jason at jorendorff.com Tue Dec 11 21:38:35 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Tue, 11 Dec 2001 20:38:35 -0600 Subject: Subclassing builtins or another alternative In-Reply-To: Message-ID: > I have an external C-extension type. Let's call it "Agent". > I would like to allow coders using Agent to use it syntactically > as a normal baseclass. For example, > > import agent > > class Pilot ( agent.Agent ): > i=3 > def f(self): > pass > > Misfortunately, either one can't do this or I simply misunderstand > what to hook up in the extension. Neither the setattr() or setattro() > methods appear to get invoked by either the class-level data > assignment of "i=3" or the definition of the f method on the class. Warning! You are entering a forbidden area! Humankind is not ready for these secrets! If you proceed, your brain will melt. The easy way out: rename agent.Agent as something like agent._agent and writing a simple wrapper for it (class agent.Agent) in Python. Expose and document the wrapper class only. Users can subclass it all day, because it's an ordinary Python class from the ground up. However, if you're committed to making a real C-based extension type that can be subclassed in Python, read on. (To avoid brain meltage, you might want to grab something cold to drink.) > [...] can I do what I'm trying to do? If so, how? Yes. Two ways, in fact. 1. The exact Python code above works fine in 2.2b2 if you substitute "str" for "agent.Agent". Hmm. So for the 2.2-and-later world, maybe Objects/stringobject.c has the solution. (Wild guess: try adding Py_TPFLAGS_BASETYPE to your type's tp_flags.) 2. If you want to go for the Big Kahuna and be backwardly source-compatible to pre-2.2, it's much worse. :) When Python sees the "class Pilot" definition above, what happens is something like this: pilot__bases__ = (agent.Agent,) pilot__dict__ = {} # Run the code to create the members of the new class exec "i=3\ndef f(self): pass\n" in globals(), pilot__dict__ # Now create the class itself from its components. base_class = Py_find_best_base_class(pilot__bases__) class_factory = type(base_class) Pilot = class_factory("Pilot", pilot__bases__, pilot__dict__) As you see, nothing is ever assigned with setattr(). "i" and "f" get plugged directly into the __dict__ dictionary. Also note that type(base_class) must be callable. I imagine you're using PyObject_HEAD_INIT(&PyType_Type). So type(agent.Agent) is PyType_Type. Well, prior to 2.2, PyType_Type was not callable, and there wasn't any 2.2-style magic to "just make it work anyway". So if you wanted a magically subclassable extension type, you had to create your own callable *metaclass*. It was tough. (Jim Fulton's ExtensionClasses provides this, I recall.) Hope this helps! Good luck! -- Jason Orendorff http://www.jorendorff.com/ From loewis at informatik.hu-berlin.de Sun Dec 23 18:38:04 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 24 Dec 2001 00:38:04 +0100 Subject: distutils problem with interdependent modules References: Message-ID: "Daniel Wexler" writes: > I can understand a philosophical argument that you shouldn't > use an extension as a shared library, but the truth is that it is > a shared library, and I don't see why I can't use it as one. It > works just fine. I'm surprised it does. Python loads the extensions with RTLD_LOCAL. Are you sure you are not getting two copies of your module loaded? Regards, Martin From schneiker at jump.net Sat Dec 29 23:07:06 2001 From: schneiker at jump.net (Conrad Schneiker) Date: Sat, 29 Dec 2001 22:07:06 -0600 Subject: Python and Ruby: a comparison References: <3C2B9A61.EE1618DB@earthlink.net> <2WpX7.1145$0s5.714029@news20> <3C2E645C.429536E8@earthlink.net> Message-ID: "Ron Stephens" wrote: > Very interesting idea. Unfortunately, I doubt if it woudl be possible. For one > thing, very few people would be willing to compromise on syntax. Ruby folks > would rightfully be loath to give up their end-begin block delimiters, and > likewise we Python folks would not want o give up our whitespace block > delimiters. If that were the most serious problem, their might be some hope after all. After all, while both language camps admonish newbies to get used to their respective style and point out respective offsetting advantages that may not be evident at first, do _most_ people _really_ care that much? I mildly dislike indendation syntax, but that wouldn't keep me from using a successor language if indendation syntax proved a simpler and cleaner way overall of incorporating all Python3000/Ruby.next features. Hopefully most other people would feel that way, or vice versa. I would expect the biggest practical hurdle to be whether Matz and Guido were interested and could discover/invent something mutually desirable. I would expect (naively perhaps) that most people would follow their lead. > Also, backwards portability would be a big problem. Granted, which was why the anticipated (albeit hypothetical) Python3000/Ruby.next syntactic discontinuties was the point of departure for discussion. > However, for what its worth, the PERL 6 implements, whom I met and conversed > with at the MIT Lightweight Languages conference, are definitely truing, as a > goal, to create a PERL 6 runtime environment that can easily and credibly, > someday later on, run Perl, Ruby, and Python. I'm looking forward to that. And there are plans to develop tools to deal with the backwards portability issues between Perl 5 and Perl 6 too. "Boris Borcic" wrote: > I guess what I mean to say, exactly, is that the weakest form > for an analogue to a "middle ground for a single successor language" > might be not a single successor language, but a pair of parallel > subsets of each language that can be automatically translated > source-to-source while preserving a smack of idiomatical expression. Interesting idea. Conrad From careye at spamcop.net Mon Dec 24 00:58:33 2001 From: careye at spamcop.net (Carey Evans) Date: 24 Dec 2001 18:58:33 +1300 Subject: Embedding TCL in Python? References: Message-ID: <87bsgp9n1y.fsf@psyche.dnsalias.org> Roy Smith writes: [...] > Second, I could start a separate TCL interpreter process, and have my > Python program drive it with some sort of send/expect type interface. > Possible, but ugly, and probably a real mess to code. I don't know if it would be *that* much of a mess. You could write a couple of classes to hide the implementation details and keep the main code fairly straightforward. > Lastly, I could just embed a TCL interpreter right in my Python process. > This seems like it has promise, but I don't have much of a clue how to go > about doing it. Has anybody done anything like that before? This is pretty much what Tkinter does, and you might be able to use it to access your Tcl code without much development work, though I doubt that this is supported: >>> import Tkinter >>> tk = Tkinter.Tk() >>> tk.tk.call('expr', '2 + 2') '4' In any case, you should be able to get some ideas from it. There's also a project called Minotaur, although it doesn't seem to have had anything happen to it recently. See: http://www.equi4.com/minotaur/minotaur.html -- Carey Evans http://home.clear.net.nz/pages/c.evans/ From store_li at sina.com Wed Dec 19 21:49:21 2001 From: store_li at sina.com (Kick) Date: Thu, 20 Dec 2001 10:49:21 +0800 Subject: But I have no idea on how to modify it :-( Message-ID: <9vrjn2$han5h$1@ID-12869.news.dfncis.de> Addition question, to change a constant string to Unicode, we can put a 'u'' before it, but how can I change or point out that a variable contains a Unicode string? Thanks! From nhodgson at bigpond.net.au Thu Dec 27 18:53:27 2001 From: nhodgson at bigpond.net.au (Neil Hodgson) Date: Thu, 27 Dec 2001 23:53:27 GMT Subject: REPOST: Re: Two languages, too similar, competing in the same space. References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> Message-ID: <8$--$$_----_--___$@news.noc.cabal.int> Ron Stephens: > Bruce Eckles said that, if a language can't give dramatic productivity > improvements over a predecessor language, that it does not justify one's > switching. 10% improvements are not nearly enough, he said. Most people are not switching to Ruby from Python but from languages like Perl and C++, and Ruby is more than 10% better than those languages. I'll be quite happy if Ruby does achieve 'world-domination' and am forced to use as it is a much better language than most. Neil ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newsengine.sol.net!uwm.edu!newsfeed.cs.wisc.edu!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Neil Hodgson" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:16:26 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775491 27193 211.57.49.2 (31 Dec 2001 05:11:31 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:11:31 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From loewis at informatik.hu-berlin.de Fri Dec 21 11:52:53 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 21 Dec 2001 17:52:53 +0100 Subject: Strange behavior of weak references (weakref module) References: <6c92a8bc.0112180601.2ac4a6f0@posting.google.com> Message-ID: tiberius at ms28.hinet.net (Tiberius Teng) writes: > I found this behavior (bug?) when I want to create weak reference to a > instance method. It's hard to describe (using my poor English writing > ability), so I just attach the way to reproduce the situation. And > notice that the id() of a instance method reference changes after each > function call! I can't see anything strange here. A.test returns a different object every time evaluated; this has nothing to do with weak references. The object that A.test returns is an unbound method. That method is only created when somebody accesses it; the class itself does not keep a reference to the method object (it only keeps a reference to the function object inside the method object). If the class would keep a reference of the method object, you'd get a circular reference. Regards, Martin From nikander at mindspring.nospamcom Mon Dec 24 15:06:49 2001 From: nikander at mindspring.nospamcom (Robert Nikander) Date: Mon, 24 Dec 2001 15:06:49 -0500 Subject: C++ throw causes abort in extension? References: <20011224.123518.378096161.2956@localhost.localdomain> <2ZKV7.13654$PO5.2163087@newsread1.prod.itd.earthlink.net> Message-ID: <20011224.150648.1067106872.1069@localhost.localdomain> Well it is something that was added to gcc between 2.95.3 and 3.0.2. I just tried compiling my extension with gcc 2.95.3 rather than 3.0.2 and exceptions are caught fine. So it must be something added in gcc 3. Rob From ecastro at cicei.ulpgc.es Mon Dec 17 06:50:13 2001 From: ecastro at cicei.ulpgc.es (Enrique) Date: 17 Dec 2001 11:50:13 GMT Subject: WYSIWYG text Editor in python? Message-ID: <3C1DDCAC.C477A0A6@cicei.ulpgc.es> Hi, I am a biochemist using computer programming mainly for data analysis, and a Python fan. Now I have faced a different task, automating text reports. For this task I need a MS-Word-like text editor able to render on screen text in bold, italics, underline, greek symbols and super/subscripts. I work with MS-Windows. I have a prototype of the application using wxWindows/wxPython and wxHTMLWindow to render the text (text input is done with explicit HTML markup tags, which is not optimal for users). Hoewever I have found that wxHTMLWindow do not render tags, neither sub and superscripts. So I am looking for other solutions. I have two options in mind: a) Looking for an existing Python application/module for a WYSIWYG text Editor or similar. I have searched the Parnassus without success. Are any of you aware of such a beast? b) Using MS-Word as the editor. Currently I am using COM to open MS-Word and automate some tasks on existing or generated documents. However, for this particular task I need to run Word in a MODAL way, (or OLE I don't know, this is quite beyond my usual grounds), to block application flow until the text is edited and getting the edited text back to the main application. Any idea of how to do that? I would appreciate any help or tip on any of the two approaches. Thanks Enrique From peter at engcorp.com Mon Dec 3 00:14:02 2001 From: peter at engcorp.com (Peter Hansen) Date: Mon, 03 Dec 2001 00:14:02 -0500 Subject: Are there any PEPs for typed arguments? References: Message-ID: <3C0B0A1A.55AD7806@engcorp.com> Eugene wrote: > > What checks would you do to determine if a variable could be converted to an > int without changing its value? > > And what checks would you do to safely determine if an object implements all > the methods you want it to? If it does implement all those methods, what > assurance do you have of what the methods' return-types will be? > > Supporting compatible types is a good thing, but so is determining at the > _start_ of a function that something is going to break because a contract > (or an assumption) was not upheld. No, that's what exceptions are for. You assume things will work, you try it, and you clean up when it fails. Since it works more often than it fails, this sounds faster, not to mention simpler, and more maintainable. And it's Python. -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From ylee12 at uiuc.edu Fri Dec 28 14:21:40 2001 From: ylee12 at uiuc.edu (Young-Jin Lee) Date: Fri, 28 Dec 2001 13:21:40 -0600 Subject: [Q] how to use IDLE in linux Message-ID: Hi, I have problem using IDLE in Linux. I installed Python 2.2 and tried to launch IDLE, but it didn't work. I read the on-line document for IDLE and it says that I needed to just type "idle", but it didn't work for me. What am I supposed to do to use IDLE in Linux? TIA. YJ From kkushchov at eur.ko.com Fri Dec 21 02:53:05 2001 From: kkushchov at eur.ko.com (Konstantin Kushchov) Date: Fri, 21 Dec 2001 10:53:05 +0300 Subject: (no subject) Message-ID: From deweese at usc.edu Thu Dec 20 16:06:18 2001 From: deweese at usc.edu (John DeWeese) Date: Thu, 20 Dec 2001 13:06:18 -0800 Subject: stackless python References: <9vpjds$due$1@usc.edu> <9vrsnu$e6n$1@usc.edu> Message-ID: <9vtk23$3lu$1@usc.edu> > > Bill Tate wrote: > > > What do you want to know? As you see development on stackless seems > > > largely to be stalled, but I believe there are plenty of people still > > > using it. > > That wasn't Bill, that was me. Oops! I wrote a response to you but used Bill's message to reply. Thanks for your info. - John From pawelczyk at lucent.com Fri Dec 7 15:49:59 2001 From: pawelczyk at lucent.com (Lukasz Pawelczyk) Date: Fri, 07 Dec 2001 21:49:59 +0100 Subject: cursor option in Tkinter References: <3C0DFBA9.2F640288@lucent.com> Message-ID: <3C112B77.38A392F@lucent.com> Thanks a lot. I will check it. Laura Creighton wrote: > > > Hello, > > > > I have found good documentation for Tkinter: > > "An introduction to Tkinter", > > but there are no available words for cursor option for widgets. > > I know only one dafault for Text widget: "xterm". > > There are the pictures of available cursors, but there are no any > > names for them. > > > > Could anyone tell me where can I find it? > > > > Thanks in advance, > > Lukasz > > Go to: > http://www.nmt.edu/tcc/help/lang/python/tkinter.html > and download the PDF file Tkinter reference: A GUI for Python. > What you want is on page 9. > > Laura Creighton From claird at starbase.neosoft.com Fri Dec 28 09:10:14 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 28 Dec 2001 08:10:14 -0600 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: <5162AA73D84B5DBA.D2515DB62E721798.F62643D4812CA388@lp.airnews.net> In article , Alex Martelli wrote: . . . >in it for them? Can you even FIND OUT what programming >languages are in fact used by the various departments >and fiefs of these large organizations? Sometimes. Let me warn the inexperienced, though: even when you think you know the answer--because, for example, the company president has chosen to assert a technical proposition like, "Java helped us blah-blah"--there's no guarantee that the public information corresponds to the inside reality. I have ABUNDANT evidence on this score. Organizations often "dis- inform", and at least as often, they have poor collective intelligence about their own behavior. . . . >This tells us nothing about marketing _technologies_ >as opposed to products and services. In that field, >Sun's very successful efforts at marketing Java may >be more instructive. But, who has a billion dollars >available to throw at the task? And how to they plan >to recoup the investment? Sun has presumably judged >that opposing Microsoft's dominance has huge strategic >value for them: they don't make money directly out of >Java (not, by far, enough to make the huge marketing >investments profitable), but apparently they think >they're getting value for money through other revenue >channels. What huge firm[s] might possibly make a >similar decision in the case of Python? And why? An intriguing question, to which we per- haps shall return later. . . . -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From plakal at yahoo.com Mon Dec 10 17:06:17 2001 From: plakal at yahoo.com (Manoj Plakal) Date: Mon, 10 Dec 2001 16:06:17 -0600 Subject: pyrepl-0.6 References: <3b091a1c.0112060650.1f185978@posting.google.com> Message-ID: <3C1531D9.1010507@yahoo.com> Michael Hudson wrote: > cmkleffner at gmx.de (cmkl) writes: > >>Really cool, >> >>during development I'm able to put several lines with >> >> pyrepl.python_reader.ReaderConsole(vars(), 0, None).interact() >> >>within the code, even inside functions! >> >>All I need is 'import pyrepl.python_reader' at the beginnig of >>the module. Now I can estimate the state of the programm interactivly >>within the scope of the function - break pyrepl with CTRL - proceed >>with the script and take a break at the next line with pyrepl.... >> >>Some kind of debugging with hardcoded breakpoints or >>'debbuging for dummies'. This is the thing I was looking for! >> > > Heh, that is quite a neat idea. Certainly one that hadn't occurred to > me. > > BTW, pyrepl can integrate itself somewhat into pdb (see pyrepl.py for > details), but it's not that thorough yet. Being able to have an interactive shell inside arbitrary points in a program is cool for debugging. BTW, this functionality is provided by the "Interactive Debug Probe" in Wing IDE (wingide.com). You can stop the program at any point and then launch a shell in the context of the stack frame where you stopped. Manoj From pzw1 at hotmail.com Mon Dec 10 22:06:42 2001 From: pzw1 at hotmail.com (Peter Wang) Date: 10 Dec 2001 19:06:42 -0800 Subject: FW: Strange behaviour of __del__ References: Message-ID: hi tom, the __del__ method is only called when the reference count of an object reaches 0. in your example, "a" is actually still referenced when you reach the interpreter prompt after the exception is thrown, because the traceback object contains the stack frame, which in turn references "a". (check out http://www.python.org/doc/current/ref/customization.html, read the bold "Programmer's Note") so, when you manually execute "del a", that decreases the refcount to 0 and that in turn causes "a" to be deleted. the NameError exception after that is confusing, i don't know why it's doing that. probably the destructor itself throwing an exception. -peter Tom Harris wrote in message news:... > Greetings, > > Playing around with the __del__ method of classes led me to this odd > observation: > > <> > class A: > def __init__(self, a): > if a: > raise RuntimeError > > def __del__(self): > print 'In __del__()...' > > import Script1 > >>> a = Script1.A(1) > Traceback (most recent call last): > File "", line 1, in ? > File "Script1.py", line 4, in __init__ > raise RuntimeError > RuntimeError > >>> del a > In __del__()... > Traceback (most recent call last): > File "", line 1, in ? > NameError: name 'a' is not defined > >>> > > Why is the __del__ method being called? Note that Python raised a NameError. > If 'a' is not defined, how does Python find, let alone call a method on it. > Am I expectiong Python to be like C++ where a class instance is not > constructed until it falls off the last brace of the constructor? From h.jehadalwan at student.kun.nl Sun Dec 23 04:08:49 2001 From: h.jehadalwan at student.kun.nl (husam) Date: Sun, 23 Dec 2001 10:08:49 +0100 Subject: Search the difference: Why this function defenition does'nt work? References: <3C24A967.3070604@student.kun.nl> <3C24B3AE.8060103@student.kun.nl> <3C24C8DD.4090300@home.com> Message-ID: <3C259F21.2070604@student.kun.nl> Luke wrote: > If you use a list index [0] that returns a single element of the type > that that element is (which is what you want in this case). But when > you use the colon for slice notation, you are asking python to return a > tuple of all the elements up to the zeroth element, which is no > elements--an empty tuple. Then you are trying to add a number to a > tuple which is undefined. > But when I adjust the code to this: sum=['c'] it still does not work, despite the fact that sum is not an undefined object, right? From ecastro at cicei.ulpgc.es Mon Dec 17 13:53:11 2001 From: ecastro at cicei.ulpgc.es (Enrique) Date: 17 Dec 2001 18:53:11 GMT Subject: WYSIWYG text Editor in python? References: <3C1DDCAC.C477A0A6@cicei.ulpgc.es> Message-ID: <3C1E3FD2.98A4E56C@cicei.ulpgc.es> "John J. Lee" wrote: > > On 17 Dec 2001, Enrique wrote: > > > I am a biochemist using computer programming mainly for > > data analysis, and a Python fan. Now I have faced a > > different task, automating text reports. For this task I > [...] > > Just another thought: not entirely sure what you want to do exactly, but > you might also consider something like Reportlab (pdf generation). > AFAIK, this tool produces formatted output. But what I need is a way to INPUT formatted text in a user-friendly way. I am using HTML tags in the input string, but users do not like tags. They want to view fomatting while typing, the way they do in MS-word (or any other graphical word processor). I will browse Reportlab, anyway Thanks Enrique From justin at iago.org Fri Dec 21 12:06:01 2001 From: justin at iago.org (Justin Sheehy) Date: Fri, 21 Dec 2001 12:06:01 -0500 Subject: Bug in % string formatting? In-Reply-To: <9vtk6h$ojk$1@peabody.colorado.edu> (Fernando =?iso-8859-1?q?P=E9rez's?= message of "Thu, 20 Dec 2001 14:10:06 +2328") References: <9vtiev$no8$1@peabody.colorado.edu> <871yhp7guv.fsf@ifm.uni-kiel.de> <9vtk6h$ojk$1@peabody.colorado.edu> Message-ID: Fernando P?rez writes: >> Operator precedence :-), change it to >>>>> print format_string % (names['John'][:] + names['Jane'][:] ) >> > > Argggh! As they say in numerical recipes: you should brush your teeth every > night in front of the operator precedence rules for your language of choice. There's a much simpler rule to follow: Parenthesize. Whenever you're not absolutely sure of precedence (and sometimes when you are) parenthesize your expressions for explicit grouping. If you get into this habit, you don't end up being bitten by precedence. -Justin From s.schwarzer at ndh.net Fri Dec 28 12:36:40 2001 From: s.schwarzer at ndh.net (Stefan Schwarzer) Date: Fri, 28 Dec 2001 18:36:40 +0100 Subject: REPOST: (Almost) command line simulation with execfile Message-ID: <9$--$$_----_-$--_$@news.noc.cabal.int> Hello I'm trying to make a wrapper class to execute example scripts. For that, I use class Example: '''Provide demonstration services for Python scripts.''' ... def execute(self): '''Read and execute the example script.''' print 'Executing %s ...' % self.filename print temp_globals = globals().copy() temp_locals = {} try: execfile(self.filename, temp_globals, temp_locals) except: print "Ooops, there seems to be a problem ..." print traceback.print_exc(file=sys.stdout) If it wasn't for catching exceptions in the example scripts caused by invalid user input, I would use os.system. On the other hand, the scripts should be simple, so I would not like to put the exception handling stuff in (every) example script. My problem is that the above execfile call doesn't behave similar to os.system if I have import statements in the executed file. In this case, I get a name error which I do not get with python file.py (i. e. executing the example script directly from the command line). The output of a wrapped script with an import urllib statement is ----- Executing internet.py ... Please ensure you are connected to the internet and press [Return]: The first 150 characters from http://www.python.org/: Ooops, there seems to be a problem ... Traceback (most recent call last): File "wrapper.py", line 80, in execute execfile(self.filename, temp_globals, temp_locals) File "internet.py", line 50, in ? print url_content_part(url, count) File "internet.py", line 12, in url_content_part fetched = urllib.urlopen(url) NameError: global name 'urllib' is not defined ----- Perhaps it's a problem with the globals dictionary? What should I probably use instead? (Note that, in contrast to other postings I have found with Google groups, I do _not_ want to have modified the namespaces of my wrapper module or the class instance.) Can somebody explain what's going on here and what I should do? :-) Many thanks in advance! Stefan ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Stefan Schwarzer Newsgroups: comp.lang.python Subject: cmsg cancel <3C2CADA8.8D6BE4C at ndh.net> Control: cancel <3C2CADA8.8D6BE4C at ndh.net> Date: Mon, 31 Dec 2001 03:21:37 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775196 27193 211.57.49.2 (31 Dec 2001 05:06:36 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:06:36 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From claird at starbase.neosoft.com Fri Dec 28 12:06:44 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 28 Dec 2001 11:06:44 -0600 Subject: REPOST: Re: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> Message-ID: <9$--$$_----_-$%%$$@news.noc.cabal.int> In article , Cameron Laird I approximated: > . > . > . >RFC 765 FILE TRANSFER PROTOCOL June 1980 >RFC 821 SIMPLE MAIL TRANSFER PROTOCOL August 1982 >RFC 854 TELNET PROTOCOL SPECIFICATION May 1983 >RFC 850 Standard for Interchange of USENET Messages June 1983 >RFC 977 Network News Transfer Protocol February 1986 . . . Oops; substitute the earlier RFC 788 SIMPLE MAIL TRANSFER PROTOCOL November 1981 -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.cwix.com!newsfeed.mathworks.com!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: claird at starbase.neosoft.com (Cameron Laird) Newsgroups: comp.lang.python Subject: cmsg cancel <2419401F9FA44C22.520DBCE4218C0223.5487885783B69E22 at lp.airnews.net> Control: cancel <2419401F9FA44C22.520DBCE4218C0223.5487885783B69E22 at lp.airnews.net> Date: Mon, 31 Dec 2001 03:13:16 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775210 27193 211.57.49.2 (31 Dec 2001 05:06:50 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:06:50 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From info at mjais.de Thu Dec 13 15:27:49 2001 From: info at mjais.de (Markus Jais) Date: Thu, 13 Dec 2001 21:27:49 +0100 Subject: which book? References: Message-ID: <9vb2vt$efv63$1@ID-75083.news.dfncis.de> Preben wrote: > I've been recommended to buy a Python book, > but I'm not sure which one I should buy.. > > Somebody told me to buy Python2.1 Bible. > Anybody got an opinion? The Python2.1 Bible is IMHO a very good book. I can also recommend "core python" which has very clear and in depth explanantions of the core concepts of python markus From al_dass at yahoo.com Wed Dec 26 20:41:47 2001 From: al_dass at yahoo.com (Al Dass) Date: 26 Dec 2001 17:41:47 -0800 Subject: [ANN] _socket.pyd with SSL support for Python 2.2 References: Message-ID: For those interested... here is link to _socket.pyd & _socket_d.pyd for Python 2.1.1 on Win32. http://home.attbi.com/~al.dass/dev/python/2.1.1/win32_socket_ssl/python_2_1_1_ssl_socket.zip Cheers, Al Dass From fperez528 at yahoo.com Sun Dec 9 18:27:07 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Mon, 10 Dec 2001 22:55:07 +2328 Subject: strict python? References: <9v43b9$o54$1@peabody.colorado.edu> <3C159CB4.A4D15BC3@alcyone.com> Message-ID: <9v475q$qla$1@peabody.colorado.edu> Erik Max Francis wrote: > I agree. In my opinion, if PyChecker became a part of the standard > distribution (not necessarily as a part of the Python executable > itself), it would be win all the way around. > Well, it doesn't have to be built into the interpreter: a -w switch could trigger its loading as a library, which means the interpreter binary itself doesn't need to get any heavier (which is an important concern). And this way, it would be trivial to compile the interpreter itself without the codepaths that activate the -w option for situations where one wants a super-light interpteter (embedding) and the -w option isn't needed. This would give the user an immediate way to access it (-w) without the interpreter bloating up at all. Cheers, f From henrik at moskau.hmotakef.homeip.net Sat Dec 29 17:48:15 2001 From: henrik at moskau.hmotakef.homeip.net (Henrik Motakef) Date: 29 Dec 2001 22:48:15 +0000 Subject: The Fiery Bush Python One True Universal Web Server... References: <3C2CBACB.FBF3C3C9@mindspring.com> <3C2D47F0.6DF7C8BE@mindspring.com> <3C2DF5FF.E332F4EE@mindspring.com> <3C2E61FD.4CA44C0@earthlink.net> Message-ID: <87g05thccw.fsf@moskau.hmotakef.homeip.net> Ron Stephens writes: > Would it be possible to create a module that could be plugged into a > Python program, that would automatically, when called, go to a > specific web site containing a Python interpreter and run the > original Python program remotely, give the results track over the > web... You mean something like a Web Service? mfg Henrik From loewis at informatik.hu-berlin.de Sat Dec 29 03:36:29 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 29 Dec 2001 09:36:29 +0100 Subject: ETA for Win32all under Python 2.2? References: Message-ID: David Brady writes: > Where do I get the package to build? > > How do I build the package? Others have already referred to the build instructions, at http://starship.python.net/crew/mhammond/win32/BuildingExtensions.html Follow the link "downloads", then "information on getting the sources". If you don't understand the instructions on these pages, don't hesitate to ask. > If your reply has anything to do with CVS, how the > heck do I get at it from Win32? (Lots of people have > told me they've heard of other people doing this, but > I'm starting to think it's an urban legend.) Well, I'm doing it myself, so I know it's not a legend. The instructions on getting a CVS binary, and on getting the Win32all source tree should be pretty clear. If you also want the Python source tree proper using CVS, see http://python.sourceforge.net/sf-faq.html#c2 > > (if it doesn't, please submit a bug report). > > *sigh* Vast, man, vast. How do I submit a bug > report? Go to http://sf.net/projects/python Select "Bugs", then select "Submit New". > P.S. Please note, I may be ignorant, but I'm not > stupid. If there is a good place that explains how to > get and build Python and its packages, I'll happily > wade through the documentation. Please report success or failure on this list. Notice I've never build the extensions myself, so I don't know how easy it is. If you succeed, you may consider packaging them as well. I believe you need the Wise installer for that; you'll find links on Mark's pages as well. If you have the Wise installer, and you've managed to package the extensions, don't hesitate to publish your binaries; contact python-dev at python.org if you don't know how to publish them or post to comp.lang.python.announce when you have published some somewhere. I think this reliance on a single person to build a binary package is unacceptable, especially since Mark has written all this documentation to get others started. It is time that Win32all maintainance is off-loaded to other shoulders. Regards, Martin From chrishbarker at attbi.com Fri Dec 21 13:57:28 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Fri, 21 Dec 2001 10:57:28 -0800 Subject: Python on the desktop References: <94e3fce8.0112210053.2568529d@posting.google.com> Message-ID: <3C238618.9F54E5CA@attbi.com> Sarat Venugopal wrote: > 2. Absence of a standard GUI, which really fits the major platforms. > For a lanuage like Python, this is really a handicap. Does C++ have a standard GUI?? Personally, I'd like to see a stronger GUI framework established as "standard) perhaps wxWindows, but the real strength of Python is its extensibility. This is why there are so many GUI toolkits for Python, because it is relatively easy to do. THis is a major strength. Asside form being able to develop stand-alone applications with Python, it can also be integrated with other apps as a built in scripting language, etc. IF you have a n MFG app and want to integrate Python, you can, same for a GTK app, etc. I think that not having a trully build-in standard GUI makes Python weeker as a quick and easy RAD application, but stronger as a general purpose programming language. > 3. Does the community see Python as a full-fledged programming > language? Yup. I remember Zope being projected as the killer app for > Python. Does that mean Python is going to hide behind web servers, be > yet another general/web scripting language Nope, I've never done anything for the web with Python... Although it's good to know that when I need to do web programming, I can use the same language I use for computational programming, GUI development, and quick text crunching scripts... -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From maxm at mxm.dk Tue Dec 18 12:38:57 2001 From: maxm at mxm.dk (maxm) Date: Tue, 18 Dec 2001 18:38:57 +0100 Subject: lost interest? References: <20011208001123.A5989@casa.parque> <3FFT7.5573$Q3.847787@news010.worldonline.dk> Message-ID: <4bLT7.32$aS.11733@news010.worldonline.dk> From: "Suchandra Thapa" > >But then that's the old problem with core language design vs. library > >enhancements, and who should do what, that we see again. > > Distutils has been incorporated into the standard python distribution > and it holds the same position in relation to the python language as any > CPAN-shell implemenation would. Oh but that wasn't what I meant. It was more about the fact that the core developers who can put some weight behind a package system are not involved in it. They are happier doing core language features like object type unifications. (Which I also look forward to ;-) ) regards Max M From cliechti at gmx.net Sun Dec 2 19:21:32 2001 From: cliechti at gmx.net (Chris Liechti) Date: 3 Dec 2001 01:21:32 +0100 Subject: splitting using '\' as a delimiter References: Message-ID: [posted and mailed] "Peoter Veliki" wrote in news:mailman.1007336463.14815.python-list at python.org: > I have strings like this: > string = 'value\key' > that I would like to split. If I try splitting the string like this: > alias = string.split('\\',string) > I get: > alias = ['\'] change the order of arguments: >>> string.split('value\\key','\\') ['value', 'key'] or: >>> 'value\\key'.split("\\") ['value', 'key'] sidenote: don't name your variable "string", that would hide the module with the same name. chris > How can I do this? > > Thanks > -- Chris From MarkH at ActiveState.com Sat Dec 8 00:56:12 2001 From: MarkH at ActiveState.com (Mark Hammond) Date: Sat, 08 Dec 2001 05:56:12 GMT Subject: Problems with PythonService.exe References: <2653ed03.0112071028.7d7585ba@posting.google.com> Message-ID: <3C11AC0E.7030409@ActiveState.com> George Song wrote: > I'm just getting into making Python Windows Services and am having > problems. > > I first started with the pipeTestService from both ActiveState 2.1 and > 2.2 to no avail. Then tried Zope 2.4.3 and got the same result. > > The service installs ok, but when I try to start this is the Microsoft > Management Console message I get: > > Could not start the Zope service on Local Computer. The service did > not return an error. This could be an internal Windows error or an > internal service error. If the problem persists, contact your system > administrator. > > Any help would be greatly appreciated. Try running "pythonservice.exe /register" from a Command prompt, and let me know what is printed. Mark. From dale at riverhall.NOTHANKS.co.uk Sat Dec 22 06:44:39 2001 From: dale at riverhall.NOTHANKS.co.uk (Dale Strickland-Clark) Date: Sat, 22 Dec 2001 11:44:39 +0000 Subject: Python on the desktop References: <94e3fce8.0112210053.2568529d@posting.google.com> Message-ID: sarat_venugopal at yahoo.com (Sarat Venugopal) wrote: >Hi all, > I am fairly new to Python, in the sense that I haven't written >anything substantial in it, although I have gone through all the major >books so far. Coming from a strong, industrial strength C++ >application development background, let me make some quick >observations. Needless to say, I am quite fascinated with the language >primarily beacause of the strong emphasis on readability and >maintainability of the code(Indentation, namespaces and the works). I >guess if speed is the only issue, Python should suffice for a number >of applications. > > 1. If python is to permeate the realm of commercial desktop (in >whatever scope), we need the ability to convert it into a native >executable(I have taken a look at some of the limited solutions >available from individuals). I read somewhere, it may never be >possible in Python. Can anyone throw light on this? > Most commercial applications wouldn't want to expose the source code >or even leave it as byte-code(Note: ActiveState has announced a >compiler for Perl) Actually, this is a non-issue. So long as people get a slick installation routine that puts everything in the right place and creates the appropriate menu entries or shortcuts to start it, most people don't care if it's an exe or not. We develop comercial apps in Python and not a single client has even noticed, as far as I know. > > 2. Absence of a standard GUI, which really fits the major platforms. >For a lanuage like Python, this is really a handicap. Would I do it in >Tkinter on Windows? No way. I guess that's why there are so many other >independent implementations out there. There is so much fragmentation >of effort here(Analogous to KDE, GNOME,...on Linux). Why do you need a 'standard GUI'? There's no standard GUI anywhere else for anything. Most development environments these days have added HTML to whatever they had before. However, for a really comprehensive GUI tool, take a look at wxPython. > 3. Does the community see Python as a full-fledged programming >language? I remember Zope being projected as the killer app for >Python. Does that mean Python is going to hide behind web servers, be >yet another general/web scripting language and probably a rapid >prototyping tool? I guess the language deserves a better treatment. Yes. We use it heavily. -- Dale Strickland-Clark Riverhall Systems Ltd From katie4 at eisa.net.au Mon Dec 31 17:23:26 2001 From: katie4 at eisa.net.au (john duncan) Date: Tue, 1 Jan 2002 08:23:26 +1000 Subject: Python Script Message-ID: Dear Group, I have found a python script I wish to use instead of urlview. I know nothing of python ( lack of time ) but still wish to use this script. One day I hope to retire and learn. I use OpenBSD 3.0, which of these packages do I need to install to get it to run. The header line is #!/usr/bin/env python2 python-2.1.1-threads.tgz python-2.1.1-tk-threads.tgz python-2.1.1-tk.tgz python-2.1.1.tgz python-tools-2.1.1.tgz Thanks for any help, John Duncan From thomas.heller at ion-tof.com Fri Dec 7 08:45:24 2001 From: thomas.heller at ion-tof.com (Thomas Heller) Date: Fri, 7 Dec 2001 14:45:24 +0100 Subject: Polish the interface of applications References: <9uqdgq$j1a$1@pegasus.csx.cam.ac.uk> Message-ID: <9uqh5k$a7aam$1@ID-59885.news.dfncis.de> "Xiao-Qin Xia" wrote in message news:9uqdgq$j1a$1 at pegasus.csx.cam.ac.uk... > Hi, everybody, > > When I run my applications based on Tkinter, there is always a TK icon at > the left of the title line of the window (northerwest of window), is there > any way to replace it with my own icon (.bmp, jpg or gif)? > The other thing is when the application (main.py) is running under windows > XX, there is always a DOS window opened besides my application window. Is > there any way to avoid displaying the DOS window? > Search for hackicon (on SF, IIRC). Thomas From robin at jessikat.fsnet.co.uk Sun Dec 9 14:12:37 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Sun, 9 Dec 2001 19:12:37 +0000 Subject: join vs instances References: Message-ID: In article , Brad Bollenbach writes .... >Hope that helps, > >Brad it doesn't. When I have to use 'b'.data instead of 'b' it might. -- Robin Becker From peter at engcorp.com Wed Dec 26 21:06:26 2001 From: peter at engcorp.com (Peter Hansen) Date: Wed, 26 Dec 2001 21:06:26 -0500 Subject: REPOST: Re: try-except-finally question References: Message-ID: <4$--$$-$$$$%%-$$-$@news.noc.cabal.int> "Igor V. Rafienko" wrote: > > try: > > > > > > except ExternalFactorError: > > except DBError: > > > I have 2 questions: > > * In the innermost try-except there is a possibility for other > exceptions than ExternalFactorError and DBError. How can I catch > _all_ other exceptions than these two[*]? I'm not so much interested > in error itself, but rather whether it occured. I.e. I'm looking for > C++'s "catch (...)" construct in Python. A simple "except:" will do the trick. Importing sys and using sys.exc_info() would let you find the details, per examples you could find posted in comp.lang.python/ in the mailing list archives. Remember to follow up with a "raise" to re-raise the exception, after you've recorded the fact of its occurrence. > [*] is there a type that _all_ python object inherit from? (I know > about exceptions.Exception, but I do not want to rely on whether third > party modules actually inherit from it) Nope (although 2.2 adds the new "object" class which moves in this direction). But I think it's considered bad form *not* to derive from exceptions.Exception, and I've read that raising strings instead of objects may eventually be deprecated. You could always do "except Exception:" followed by a totally general "except:" with the latter being considered a fatal error if you wanted to double-check a 3rd party lib. -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Peter Hansen Newsgroups: comp.lang.python Subject: cmsg cancel <3C2A8222.88C383A6 at engcorp.com> Control: cancel <3C2A8222.88C383A6 at engcorp.com> Date: Mon, 31 Dec 2001 02:51:25 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775969 27193 211.57.49.2 (31 Dec 2001 05:19:29 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:19:29 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From rayn at infostrade.com.pl Tue Dec 18 12:56:37 2001 From: rayn at infostrade.com.pl (Marek Budyn) Date: Tue, 18 Dec 2001 18:56:37 +0100 Subject: dynamic modules Message-ID: <9vo01n$9j8$1@news.tpi.pl> Hi! I wanted go create dynamically loaded and removed plugins. I mean, id a module a initalizes with 10 MB data structude, i would like to remove it from memory if it is not needed eg. p1 = import plugin1 ... unload(p1) Is it possible in python ? And if so, how can I do this ? Thanks for help! Marek Budyn rayn at infostrade.com.pl From woodsplitter at rocketmail.com Sun Dec 30 01:00:58 2001 From: woodsplitter at rocketmail.com (stalin) Date: 29 Dec 2001 22:00:58 -0800 Subject: values of sys.platform? for a serial port lib References: Message-ID: <7876a8ea.0112292200.593d01e8@posting.google.com> Chris Liechti wrote in message news:... > i've written a portable serial port library. it runs now on linux and win32 Are you aware of Isaac Barona's Universal Serial Port Python Library? http://balder.prohosting.com/ibarona/en/python/uspp/uspp_en.html Isaac says on his web page: """ I started looking for Python modules to access serial port and I found the following projects: * win32comport_demo from the win32 extension module * win32comm module of wheineman at uconect.net * Sio Module of Roger Rurnham (rburnham at cri-inc.com) * pyxal (Python X10 Abstraction Layer) of Les Smithson (lsmithson at open-networks.co.uk) but they were not multi-platform, were just a wrap of propietary libraries or were just simple examples of serial port access. """ How do the design goals of your library differ from USPP? How do you intend to license it? USPP uses the IMHO restrictive GPL. Disclaimer: I've never used USPP. From fredrik at pythonware.com Tue Dec 18 17:26:18 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 18 Dec 2001 22:26:18 GMT Subject: Newbie Wondering About Database Support? References: Message-ID: Richard Kessler wrote: > I have recently discovered Python and am excited about the possibility of > developing with the language. Unfortunately, I develop database centric > applications, MS SQL Server, etc. and I do not see much talk about Python and > access to databases. Am I missing something or is Python not intended for that > purpose. I would love to replace programs currently in VB with Python, but > they must be able to access databases. start here: http://www.python.org/topics/database/ From tim at vegeta.ath.cx Fri Dec 21 15:32:43 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Fri, 21 Dec 2001 20:32:43 GMT Subject: Python on the desktop References: <94e3fce8.0112210053.2568529d@posting.google.com> <3C238618.9F54E5CA@attbi.com> Message-ID: Cliff Wells graced us by uttering: [ snip ] > I suppose it's a bit like saying that N'Sync and Britney Spears > represent the tastes of the vast majority of music listeners - > arguable but unfortunate =) I beg to differ. I happen to actually enjoy listening to (exactly 2 of) Britney's songs... but not as much as I enjoy observing her less vocal attributes. ;) Tim Hammerquist -- On the plus side, it's a lot easier in general to find /usr/include than cpp. -- Larry Wall in <199809041612.JAA05556 at wall.org> From kragen at pobox.com Sat Dec 1 07:16:14 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 01 Dec 2001 07:16:14 -0500 Subject: embedded exe (was Re: Unable to deliver your message) References: Message-ID: <83n113rv8x.fsf@panacea.canonical.org> anurag uniyal writes: > I am creating a python application which > runs embedded in some other software ,this software > has some built-in modules which I am using in my > pyhton application. > Now I wan't to convert my python application to exe. > I have done that using Py2Exe. Is it possible to run > this exe as embedded in other software. What does "embedded in" mean? Linked into? Displaying in the same window as? From ron.l.johnson at home.com Wed Dec 12 20:06:49 2001 From: ron.l.johnson at home.com (Ron) Date: Thu, 13 Dec 2001 01:06:49 GMT Subject: capturing output of os.system() into a list? Message-ID: Is there a built-in method of doing this? I can write a function to do it, but would rather use the standard method. Many thanks, Ron -- +------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson at home.com | | Jefferson, LA USA http://ronandheather.dhs.org | | | ! Thanks to the good people in Microsoft, a great deal of | ! the data that flows is dependent on one company. That is | ! not a healthy ecosystem. The issue is that creativity gets | ! filtered through the business plan of one company. | ! Mitchell Baker, "Chief Lizard Wrangler" at Mozilla | +------------------------------------------------------------+ From mwh at python.net Fri Dec 21 06:49:36 2001 From: mwh at python.net (Michael Hudson) Date: Fri, 21 Dec 2001 11:49:36 GMT Subject: threading.py -> winthreading.c : Some results References: Message-ID: "Jason Orendorff" writes: > Whether this C code would mean a significant performance increase in > a real-life program remains to be proven. Comments? If you don't get any, I suggest waiting a week or two for 2.2 to get out of the door, then submitting it as a patch to sf. In the mean time, you can make sure the code is pretty, easy to maintain, well commented (if it isn't already) and test portability (i.e get someone to test it on as many of 95/08/Me/NT/2000/XP as you can); I'll predict for you now that these will be the major objections. >From a naive point of view, it sounds worth it to me. Cheers, M. From usenet at NOSPAM-irmen.cjb.net Tue Dec 4 16:54:43 2001 From: usenet at NOSPAM-irmen.cjb.net (Irmen de Jong) Date: Tue, 4 Dec 2001 22:54:43 +0100 Subject: ANN: Pyro 2.2 is available References: Message-ID: <9ujgn4$cb7$1@news1.xs4all.nl> "Robin Becker" wrote [...] > and it works :) Do you mean - Pyro 2.2 works (the new version) - Pyro does the job for you in general - Pyro works and other tools you've tried don't? Irmen de Jong From peter.milliken at gtech.com Mon Dec 3 23:37:38 2001 From: peter.milliken at gtech.com (Peter Milliken) Date: Tue, 4 Dec 2001 15:37:38 +1100 Subject: Python evangelists unite! References: Message-ID: <9uhjvr$b347@news1.gtech.com> I am only writing in this thread to gain information myself :-). I have strong opinions (formed over 2 decades of being involved in software production) but am always prepared to learn from others experiences and opinions. So there is no offence taken :-) I would (invariably :-)) choose Ada for a full scale production programs. It is a language that embodies support for many of the software engineering principles, has all of the "mod cons" such as OO etc and was intended for real-time applications - so it is fast! But as I mentioned in other responses, this is not "black and white". Python is my preferred choice of scripting language (I have only ever used awk) and if the job demanded it then I would quite happily integrate Python into the program so that it and Ada where doing appropriate parts of the job. My last 20 years I spent in defence doing embedded systems (simulators, procedural trainers, train control systems, weapons systems). Surprisingly there is very little call for manipulation of information such as strings etc (something that I use Python to good advantage for). Similarly, there is very little need for maintaining information in "lists of things" (another place where Python shines). In fact I have seen people work on defence projects for 10 years and never even learn how to do I/O to a user in the chosen language i.e. string I/O because the problem being programmed contained nothing like that. I have years of experience in C/C++ (not so many in C++, but enough :-)), Ada, some small amount of Java (my second preference if I couldn't use Ada - but it is interpreted, so it is *slow*), assembler, some Fortran and Pascal/Modula-2. Outside of these languages, I can't comment (and don't pretend too :-)). So Ada would be my choice, but as I said, if someone has any experience to offer up then I am more than happy to consider it and learn from it - I have Steve McConnell's Code Complete on my bookshelf - I wished he had written it 20 yrs earlier, it would have saved me some "lumps"! :-) The software industry is (IMO) a very immature industry - it can't be called an engineering discipline because I have rarely seen any examples of true engineering principles applied (I am not talking about writing a program to meet customers needs, but rather the framework of the software organisation i.e. why did the company choose Java for this project - is it because a study was performed on available languages and Java won out due to best features? or was it because the chief architect wanted to learn Java for his resume? :-)). It strikes me that software engineering is still very much a "cottage industry". Good programs are written by good individuals, rarely do you see a software shop put out a good program using average or sub-standard programmers, it always comes down to a few individual "heroes" (hence the drive for CMM - another silver bullet :-)). Look at people's reaction to code review - they learn it in college don't they? It is taught as a "good practice", but as soon as they get that piece of paper and get out in the "real world", amongst "real programmers", then horror of horrors - "You want to review *my* code?" "You want to *criticise* my creative talents?" They approach the entire exercise with fear and trepidation :-) Personally, I like others to review my code - it helps me become a better software engineer! (But only if they put the time in!). Hope this answers your questions..... Peter "Peoter Veliki" wrote in message news:mailman.1007077727.20252.python-list at python.org... > I use Python as a good, quick and dirty hacking language. For real (read > production) stuff that I expect a customer to run or will require more than > a single person working for a couple of hours, I look elsewhere :-). What do you use for production? I'm just curious, not challenging your opinion. Is there an interpreted language that you would use before you would use Python? Perl? Or would you stick to compiled languages for production? -------------- next part -------------- An HTML attachment was scrubbed... URL: From =?iso-8859-5?Q?=DF=D5=DD=D3=E3=D8=DD=D8=E1=E2=D0?= at =?iso-8859-5?Q?=DC=D0=D8=DB?=.=?iso-8859-5?Q?=DD=D5=E2?=.=?iso-8859-5?Q?=DC=DA?= Mon Dec 24 11:02:50 2001 From: =?iso-8859-5?Q?=DF=D5=DD=D3=E3=D8=DD=D8=E1=E2=D0?= at =?iso-8859-5?Q?=DC=D0=D8=DB?=.=?iso-8859-5?Q?=DD=D5=E2?=.=?iso-8859-5?Q?=DC=DA?= (=?iso-8859-5?Q?=B4=D0=DC=F8=D0=DD_=B3=2E?=) Date: Mon, 24 Dec 2001 17:02:50 +0100 Subject: MySQLdb "Illegal instruction" error. References: <97ae44ee.0112222313.1d1c71d6@posting.google.com> Message-ID: <3c2751aa$1@news.mt.net.mk> > Just installed MySQL-python-0.9.1-1py2.i386.rpm on Redhat7.2. > It seemed to install without problem but as soon as I tried to > use it with Python, it crashed bring down the Python interpreter. I would try to recompile MySQL-python from source. It seems like a mismatch of MySQL libraries you have and libraries used to make the RPM. -- ?????? Customer: "I want to download the Internet. Do I need a bigger hard disk?" From hgg9140 at seanet.com Mon Dec 31 15:01:47 2001 From: hgg9140 at seanet.com (Harry George) Date: 31 Dec 2001 12:01:47 -0800 Subject: US taxes: parsing postscript and/or pdf? Message-ID: First, is anyone already doing a python-based US federal tax package? (I see the C/gnome gnutaxes, but it appears to be dead.) If not, my next approach is to download IRS forms in PDF or Postscript, and then manipulate those templates. That requires parsing the pdf or postscript, detecting named fields, putting in new data, and regenrating the printable format. Reportlab might help with pdf output, and postscript can be output with raw write commands. But what is available for parsing the templates? E.g., is there a library out of "gv" or "xpdf" which has python bindings? -- Harry George hgg9140 at seanet.com From sholden at holdenweb.com Tue Dec 18 15:39:03 2001 From: sholden at holdenweb.com (Steve Holden) Date: Tue, 18 Dec 2001 15:39:03 -0500 Subject: Newbie Wondering About Database Support? References: Message-ID: <%RNT7.30220$PA.24036@atlpnn01.usenetserver.com> [posted & mailed] "Richard Kessler" wrote... > I have recently discovered Python and am excited about the possibility of > developing with the language. Unfortunately, I develop database centric > applications, MS SQL Server, etc. and I do not see much talk about Python and > access to databases. Am I missing something or is Python not intended for that > purpose. I would love to replace programs currently in VB with Python, but > they must be able to access databases. > > Thanks in advance. > Richard: You are indeed missing a whole slew of database access modules, broadly conformant with a standard API defined by the Python DB SIG. See http://www.python.org/sigs/db-sig/ as a good starting-point. I have used Python with Oracle, Access, SQL Server, MySQL and Gadfly (a pure-Python SQL implementation). There are modules for PostgreSQL, Informix, DB2, msql, Sybase and many other databases as well. In other words, say goodbye to VB and ... Enjoy! regards Steve -- http://www.holdenweb.com/ From wryder at taz.cs.wcupa.edu Mon Dec 10 19:35:19 2001 From: wryder at taz.cs.wcupa.edu (wryder at taz.cs.wcupa.edu) Date: 11 Dec 2001 00:35:19 GMT Subject: trouble with import odbc References: <9v3aj4$9ke$1@news.netmar.com> Message-ID: <9v3kc7$n9t$1@news.netmar.com> Ahh, got it! Actually this guy got it: http://mail.python.org/pipermail/python-list/1999-November/015613.html Basically I named the source file itself odbc.py which was confusing python. One other note: it still didn't work until I explicitely specified a database, even though it was the default database, in the DSN. In using Access to connect to a remote Postgres, I was able to leave "database" blank and it picked up the default. Not so for python ODBC. -Bill In article <9v3aj4$9ke$1 at news.netmar.com>, writes: > >Anyone ever seen this error given the code after that: > > File "odbc.py", line 1, in ? > import dbi, odbc, sys > File "odbc.py", line 4, in ? > s = odbc('postgresql/postgres/n4pk1n') >TypeError: object of type 'module' is not callable >----------------- >import dbi, odbc > >s = odbc('postgresql/postgres/n4pk1n') >cur = s.cursor() >cur.execute('select * from discounts') >print cur.description >for tup in cur.description: > print tup[0], print >while 1: > rec = cur.fetchmany(10) > if not rec: break > print rec > > >Finding it very hard to chase stuff like this down. What the heck does that >error message mean? Maybe some nutrinos caused two bits on my hardrive to >swap so that the module is corrupt and isn't callable? Whatever. Anyway, >Thanks in advance! wryder at taz.cs.wcupa.edu > > > > ----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web ----- > http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups > NewsOne.Net prohibits users from posting spam. If this or other posts >made through NewsOne.Net violate posting guidelines, email abuse at newsone.net ----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web ----- http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups NewsOne.Net prohibits users from posting spam. If this or other posts made through NewsOne.Net violate posting guidelines, email abuse at newsone.net From bt98 at doc.ic.ac.uk Fri Dec 28 09:02:20 2001 From: bt98 at doc.ic.ac.uk (Benjamin Tai) Date: Fri, 28 Dec 2001 14:02:20 +0000 Subject: scripting on top of structural Message-ID: <3C2C7B6C.DB7EDC32@doc.ic.ac.uk> Hi, Please note that this message is posted on Python and Tcl newsgroup, and VTK mailing list. When an application written in a structural language is extended with a scripting language, there are many improved functionalities. 1) Packages for GUI (in C/C++ case) 2) Wider range of libraries, easier interprocess communication. 3) Expose the application to a wider range of community. 4) Simplified syntax, speed up prototyping. 5) Ready to be embedded into foreign application as scripting language functioned as a glue. Such applications, fabricated by a "composition of languages" include Visualization Toolkit (VTK) and Video Conferencing (VIC). However are there any other reasons for such composition? >From the applications mentioned above, scripts only contain high level descriptions of pipeline and datapath respectively. They have limited access to the inner core of the application, thus the behaviour of the engine. Any comments for the following questions are appreciated: Despite the limitation, have I missed out any other potential benefits provided by "composition of languages" on VTK and VIC? Apart from the difference in performance and syntax, are there any reasons to separate the implementation into two languages? Are there any other examples of applicaitons implemented with "composition of languages"? Most importantly, would there be any applicaitons implemented with "composition of languages" that has overcome the limitation described? Thanks Ben From kalle at gnupung.net Sun Dec 9 11:24:36 2001 From: kalle at gnupung.net (Kalle Svensson) Date: Sun, 9 Dec 2001 17:24:36 +0100 Subject: join vs instances In-Reply-To: References: Message-ID: <20011209172435.A4726@proton.lysator.liu.se> [Brad Bollenbach] > In article , Robin Becker wrote: > > I had expected to be able to use things like UserStrings interchangeably > > with ordinary strings, but > > You can. If you couldn't, UserString wouldn't serve much purpose. No, you can't. There is still a purpose with UserString, before 2.2, but you can't use UserStrings intarchangeably with ordinary strings. At least not if the word "interchangeably" means what I think it means. For example: >>> s = "foo" >>> "".join(["bar", s]) works, but >>> s = UserString("foo") >>> "".join(["bar", s]) doesn't. There is a reason for the type/class unification, after all! Peace, Kalle -- Kalle Svensson (kalle at gnupung.net) - Laziness, impatience, hubris: Pick two! English: http://www.gnupung.net/ Svenska: http://www.lysator.liu.se/~kalle/ Stuff: ["http://www.%s.org/" % x for x in "gnu debian python emacs".split()] From dsavitsk at e-coli.net Fri Dec 21 13:30:47 2001 From: dsavitsk at e-coli.net (dsavitsk) Date: Fri, 21 Dec 2001 18:30:47 GMT Subject: Python on the desktop References: <94e3fce8.0112210053.2568529d@posting.google.com> Message-ID: why does everyone who is new to python, especially those with an "industrial strength C++ application development background" feel the need to (a) make quick observations, and (b) use the collective "we" in these observations? I agree with Tim that the goal of a language is "to _be_ useful where it _can_ be useful." For me, Python is useful almost everywhere -- more useful than C++ at any rate :-) Perhaps, if shipping compiled Python applications in a commercil setting is not Python's strongest suit, it is time to change the paradigm that the user must have the source hidden from them. Charge for your programming time up-front, and factor in support and upgrades. Then the user has the incentive to make small changes, but to leave the major reworking of the application to the author -- it is simply innefecient to rework a large application when the author is maintaining it and is not trying to make billions off of it, and it is easier to tell a client to open up notepad and change the 423rd line from 'x += 2' to x += 3' than to rewrite, recompile, and reship. Most people buying software are doing so to use it, not to rewrite it and resell it. Further, having open Python source adds value to a customer for the ease that they can extend the software if they are so inclined. I, as well as writing COM objects in Python, tend to "write" interfaces in VB. The only reason i would ever compile and install a VB app is that it is too expensive to install the VB IDE on every computer. As a side note, I, for one, would feel silly writing a program using free, open-source tools and then shipping it with the intent of keeping the source closed. This is not to bitch, it is always nice when new people use Python. It is also nice to hear what they have to say -- good or bad. I feel, however, like we have heard the lack-of-compiler, lack-of-gui, and does-it-really-work-for-large-projects? issues before. As I say, Python is useful for both the way I like to write and distribute applications. It seems odd to change the nature of the language, arguably what is good about the language, in order that it behave more like C++. cheers, -d "Sarat Venugopal" wrote in message news:94e3fce8.0112210053.2568529d at posting.google.com... > Hi all, > I am fairly new to Python, in the sense that I haven't written > anything substantial in it, although I have gone through all the major > books so far. Coming from a strong, industrial strength C++ > application development background, let me make some quick > observations. Needless to say, I am quite fascinated with the language > primarily beacause of the strong emphasis on readability and > maintainability of the code(Indentation, namespaces and the works). I > guess if speed is the only issue, Python should suffice for a number > of applications. > > 1. If python is to permeate the realm of commercial desktop (in > whatever scope), we need the ability to convert it into a native > executable(I have taken a look at some of the limited solutions > available from individuals). I read somewhere, it may never be > possible in Python. Can anyone throw light on this? > Most commercial applications wouldn't want to expose the source code > or even leave it as byte-code(Note: ActiveState has announced a > compiler for Perl) > > 2. Absence of a standard GUI, which really fits the major platforms. > For a lanuage like Python, this is really a handicap. Would I do it in > Tkinter on Windows? No way. I guess that's why there are so many other > independent implementations out there. There is so much fragmentation > of effort here(Analogous to KDE, GNOME,...on Linux). > > 3. Does the community see Python as a full-fledged programming > language? I remember Zope being projected as the killer app for > Python. Does that mean Python is going to hide behind web servers, be > yet another general/web scripting language and probably a rapid > prototyping tool? I guess the language deserves a better treatment. > > What do you people think? > > Cheers, > Sarat > > "Merry Christmas!" From philh at comuno.freeserve.co.uk Fri Dec 14 21:30:50 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Sat, 15 Dec 2001 02:30:50 +0000 Subject: Unsung Python modules References: <3dsnad226b.fsf@ute.mems-exchange.org> Message-ID: On 14 Dec 2001 11:31:56 -0500, Andrew Kuchling wrote: >There are some Python modules that deserve to be more widely known >outside of the Python community, because they're such handy >timesavers. My list of modules that don't get enough publicity would >include: > >* The Python Imaging Library, which reads and writes a large number of > different image formats and can perform a number of different > operations on images. I find it indispensible for writing little > utility scripts that resize all the images in a directory or > generate an HTML image gallery. > >* Reportlab, for generating PDF files: I can't believe that people > would wrestle C code for pdflib when they could just write Python > code. > >* PyQt/PyKDE, which doesn't seem to get much respect in the KDE > community. (Maybe my perception is wrong?) > >* Perhaps also the ZODB, as it's just so neat and convenient to use, > but it's also quite Python-specific. > >What's your favorite unsung module? I quite like the SPARK parsing framework. -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From boud at rempt.xs4all.nl Sun Dec 9 08:18:45 2001 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 9 Dec 2001 13:18:45 GMT Subject: 11-15 new Python Books on the way! (fwd) References: Message-ID: <9uvobl$3vt$1@news1.xs4all.nl> Dr. David Mertz wrote: > Ron Stephens wrote: > |Truly a surfeit of books. But, for what it is worth, I have listed all I > |could find out about them all at http://www.awaretek.com/plf.html > Ron seems to have done a more complete job than I have (or than I have > really tried). But Pythonistas might enjoy looking at my reviews of > many Python books for IBM developerWorks (quite a few overlaps with > those Ron looked at): > http://www-106.ibm.com/developerworks/linux/library/l-pbook2.html > http://www-106.ibm.com/developerworks/linux/library/l-cp12.html You both missed mine - GUI programming with Python and Qt is going to be printed next week, but most of the text is already available online (without the screenshots - it appears the publisher has some problems fitting them to his website or something). There'll be a forum where you can download all the sample code real soon now, too. http://www.opendocs.org -- Boudewijn Rempt | http://www.valdyas.org From pinard at iro.umontreal.ca Thu Dec 27 08:29:12 2001 From: pinard at iro.umontreal.ca (=?iso-8859-1?q?Fran=E7ois?= Pinard) Date: 27 Dec 2001 08:29:12 -0500 Subject: age of new pythonistas [was: The Editor Poll results are in!] In-Reply-To: References: <60c49aa9.0112202148.7218555b@posting.google.com> Message-ID: [Ville Vainio] > Tim Hammerquist writes: > Ditto with TCL. When I see 8 backslashes in a row, I look elsewhere > ;-). One may be rebuked by surface aspects, indeed. But seriously, we have to go deeper than that before asserting that a language is badly designed. > > > I think Python is great because it is well designed (unlike Perl), > > > > Wait, didn't you give up on Perl before you knew it well enough to make > > that kind of statement? > One really doesn't have to know all that much about perl to make that > statement - reading "Programming Perl" or some other perl book is enough. Even if I prefer Python to Perl, I would never even think that Perl is not well designed. When I was using Perl, as a user (not as a reader of books about it :-), I found that Perl allowed me to quickly write my code, it was full of good ideas, and I felt the language quite fulfilled its promises. On the other hand, Perl was probably not designed according to my own tastes, and it is true that Python fits my tastes much better; the gained comfort alone is the source of some proficiency. But not sharing my tastes does not make something necessarily bad. And besides, wandering around a bit with an opened mind allows someone to improve its culture and to evolve his tastes. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From bkelley at wi.mit.edu Thu Dec 20 13:44:30 2001 From: bkelley at wi.mit.edu (Brian Kelley) Date: Thu, 20 Dec 2001 13:44:30 -0500 Subject: Huge Dicts and perfomance References: Message-ID: <3C22318E.90904@wi.mit.edu> I don't know if this affects you but: There is a relatively easy way to increase dictionary performance. I use dictionaries to store graph formats with edges and vertices. I have found that using an instance as the dictionary lookup is quite slow. Instead, I use integer handles as the lookup. Attached is a piece of code that hashes on instances and also hashes on a generated integer handle. Each node object has an attribute node.handle which is unique for every node. Note that using __hash__ to return the handle doesn't speed things up! Python has to do a *lot* of machinations to see if two instances are the same thing. For an order of magnitude speed up for using objects as dictionary keys, use handles instead. You just have to make sure that the handles are unique :) In the test code included, I have noticed that using integer handles instead of instances speeds lookup by a factor of 20. See the attached code for a better idea of what I mean. I hope this helps. Brian -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: test_handles.py URL: From jgardn at alumni.washington.edu Sat Dec 8 05:14:51 2001 From: jgardn at alumni.washington.edu (Jonathan Gardner) Date: Sat, 8 Dec 2001 19:14:51 +0900 Subject: GUI builder In-Reply-To: <9urnih$ph6$2@peabody.colorado.edu> References: <9urnih$ph6$2@peabody.colorado.edu> Message-ID: <200112081020.fB8AKGJ17386@my.knctv.co.kr> On Friday 07 December 2001 03:12 am, Fernando P?rez wrote: > > If you want to use QT (the bindings can be found at google(pyqt)), it > comes with a very nice and well documented builder called QT Designer. > I second the motion. Very nice, very well built, very solid. From jeff at ccvcorp.com Thu Dec 6 15:00:59 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Thu, 06 Dec 2001 12:00:59 -0800 Subject: pickle question References: <9unov6$c4on9$1@hades.rz.uni-sb.de> <9uo5v7$c2a5i$1@hades.rz.uni-sb.de> Message-ID: <3C0FCE7B.AB3FA698@ccvcorp.com> Oleg Broytmann wrote: > On Thu, Dec 06, 2001 at 04:21:59PM +0000, Uwe Schmitt wrote: > > | Did you open the pickled file in binary mode? > > > > No. should I ? > > On Windows - yes. Really, you should always do so--pickles are binary data and should be written to binary files. It just so happens that on *nix, there's no practical distinction between binary and text mode. ;) (There is a distinction on Mac, as well as Windows, IIRC, and I have no idea for other platforms...) Jeff Shannon Technician/Programmer Credit International From guido.goldstein at a-nugget.de Mon Dec 24 15:43:37 2001 From: guido.goldstein at a-nugget.de (Guido Goldstein) Date: 24 Dec 2001 21:43:37 +0100 Subject: ? -- how to use shared data? References: Message-ID: Hi! On Tue, 25 Dec 2001 00:55:39 +0700 (TSK) "Gleb Kulikov" wrote: > Hello, all! > > How can i gentle solve the follows problem: > > There is some binary buffer with fixed length, placed into named shared > memory block. Data in that area is frequently changed by external (hardware) > device. I'm afraid, is too uneffective constantly create new memory chunks > and copy data by PyString_FromStringAndSize. Is there any safe method to make > direct binding (reflection) of Python's string (or what can i use) to that > memory buffer? There is an PyIPC module out there. The Vaults say that it is on: http://www.theory.org/~mac4/software It's *nix/Linux only. It works for Python 2.x. HIH Guido G. <- note that! -- Q: Do you know what the death rate around here is? A: One per person. -- Anon From jknapka at earthlink.net Thu Dec 27 17:29:20 2001 From: jknapka at earthlink.net (Joseph A Knapka) Date: Thu, 27 Dec 2001 22:29:20 GMT Subject: REPOST: Re: Finding out that Python is in interactive mode in sitecustomize.py References: <3C2B8F47.4CEACF6E@olen.to> Message-ID: <1$--$$_----_-$-%_$@news.noc.cabal.int> Joonas Paalasmaa wrote: > > How can I find out that Python is started in interactive mode in > sitecustomize.py ? > The need for that information is, that I want that certain > customizations take place only at > interactive mode. I want to know the answer to this as well. My reason is, I want the Anygui curses binding to disable itself if it finds that it's being imported from an interactive shell, since this has, er, unfortunate side effects. FAQ-reading and random flailing about with my Wand of Google have not been productive thus far... Cheers, -- Joe "I should like to close this book by sticking out any part of my neck which is not yet exposed, and making a few predictions about how the problem of quantum gravity will in the end be solved." --- Physicist Lee Smolin, "Three Roads to Quantum Gravity" ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Joseph A Knapka Newsgroups: comp.lang.python Subject: cmsg cancel <3C2B498E.2C53D822 at earthlink.net> Control: cancel <3C2B498E.2C53D822 at earthlink.net> Date: Mon, 31 Dec 2001 03:02:37 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775533 27193 211.57.49.2 (31 Dec 2001 05:12:13 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:12:13 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From ben at wblogan.net Sat Dec 8 16:27:50 2001 From: ben at wblogan.net (Ben Logan) Date: Sat, 8 Dec 2001 16:27:50 -0500 Subject: Need help with regular expression In-Reply-To: ; from shalehperry@attbi.com on Sat, Dec 08, 2001 at 10:43:15AM -0800 References: <20011208133230.A5441@newcreature.org> Message-ID: <20011208162750.B27993@newcreature.org> Ok, thanks. That's one place I didn't think of looking. Regards, Ben P.S. Just out of curiosity: are you left-handed? :D I am, and wondered if that's why you wrote your emoticon backwards. On Sat, Dec 08, 2001 at 10:43:15AM -0800, Sean 'Shaleh' Perry wrote: > Bookstores are just libraries that want dues (-: > > This has been discussed numerous times on this and the -tutor list, so dig > through the archives for a good response. -- Ben Logan: ben at wblogan dot net OpenPGP Key KeyID: A1ADD1F0 From maxm at normik.dk Thu Dec 20 05:32:55 2001 From: maxm at normik.dk (Max M) Date: Thu, 20 Dec 2001 11:32:55 +0100 Subject: Solution: using the FieldStorage in .asp pages under IIS Message-ID: <3c21be45$0$35590$edfadb0f@dspool01.news.tele.dk> Some months back I asked how to use the FieldStorage under the IIS using Python in .asp. But nobody seemed to know. Well I got sidetracked for a while, but got back to it today and found the solution by readin through the cgi source. So here's the solution. regards Max M <% @Language = "Python" %> Test <% def winFieldStorage(Request): from StringIO import StringIO from cgi import FieldStorage # get the relevant enviroment variables from the IIS env = {} keys = ('CONTENT_TYPE','CONTENT_LENGTH', 'QUERY_STRING','REQUEST_METHOD') for key in keys: env[key] = str(Request.ServerVariables(key)) # get the content from the Request as binary binaryContent, size = Request.BinaryRead(int(env['CONTENT_LENGTH'])) # tempfile in memory fp = StringIO(str(binaryContent)) fs = FieldStorage(fp=fp, environ=env) fp.close() return fs fs = winFieldStorage(Request) Response.Write('Keys: ' + str(fs.keys())) %> From dyoo at hkn.eecs.berkeley.edu Fri Dec 28 02:08:42 2001 From: dyoo at hkn.eecs.berkeley.edu (Daniel Yoo) Date: Fri, 28 Dec 2001 07:08:42 +0000 (UTC) Subject: New Array proposal (So that it will actually be read) References: <40dbad98.0112272113.40a21ab7@posting.google.com> Message-ID: Andrew Nguyen wrote: : I think that an array sould have natural dimension support, Have you had a chance to look at Numeric Python yet? http://www.pfdubois.com/numpy/ This module provides good support for multidimensional arrays, and in fact, supports many of the things that you're looking for. For example: ### a = arrayrange(9) a.shape = (3, 3) a[1, 1] = 42 ### should work. The documentation has good example of Numeric Python here: http://www.pfdubois.com/numpy/html2/numpy.html From igor.mozetic at uni-mb.si Sun Dec 23 12:26:02 2001 From: igor.mozetic at uni-mb.si (Igor Mozetic) Date: Sun, 23 Dec 2001 18:26:02 +0100 Subject: [BEGINNER] meta-functions Message-ID: <15398.5034.361050.853873@ravan.camtp.uni-mb.si> A simple question from a newbie, sorry. I have functions defined normally, def fname(arg1,arg2): and also represented as tuples (fname, arg1, arg2), to use them by apply(fname, (arg1,arg2)) - no problem. How do I make a comparison: fname == 'string' ? I found that I could use repr(fname) and parse the resulting string, but I consider this ugly. Is there a standard function to return a function name as a string? I'm restricted to Python 1.5.2. I'm not on the list, please reply to me. -Igor Mozetic From michael at rcp.co.uk Thu Dec 6 03:17:39 2001 From: michael at rcp.co.uk (Michael Abbott) Date: Thu, 6 Dec 2001 08:17:39 +0000 (UTC) Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <01120417475903.01465@logiplex1.logiplex.net> <20011205062232.GA1595@lilith.hqd-internal> Message-ID: Cliff Wells wrote in news:mailman.1007578213.25934.python-list at python.org: >> >> >> >> >> >> >> >> >> >> >> >> >> >> Better? Seperatation of representation and semantics? The obvious >> disadvantage of an XML representation of sourc code would be that we >> would need *really good* editors to make it not painful. > > I don't even know what to think of this, but since you obviously put > some time into writing it I felt compelled to reply. > I suspect he really meant to write: Now no messy spaces or indentation to worry about. From pinard at iro.umontreal.ca Mon Dec 31 11:42:11 2001 From: pinard at iro.umontreal.ca (=?iso-8859-1?q?Fran=E7ois?= Pinard) Date: 31 Dec 2001 11:42:11 -0500 Subject: stackless python In-Reply-To: <7x3d1r1k9j.fsf@ruckus.brouhaha.com> References: <9vpjds$due$1@usc.edu> <1008824522.772261@yabetcha.sttl.drizzle.com> <7x3d1r1k9j.fsf@ruckus.brouhaha.com> Message-ID: [Paul Rubin] > The thing I don't fully understand is that several Scheme implementations > are both smaller and faster than Python. Python is bigger than Scheme, most probably because of all its bundled libraries. Scheme is more bare by comparison. As for speed, Scheme is more simple as well, simple enough for allowing compilation. > I've been wondering for a while whether it's time to graft a Python > parser onto a Scheme compiler/evaluator. There is a cost in the generality given by all the __SPECIAL__ functions in Python, and following the evaluation chain induced by class nesting. I guess that if you reimplement Python in Scheme, with all its features, you will not gain speed over the implementation we currently use. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From jkraska at san.rr.com Tue Dec 11 19:30:04 2001 From: jkraska at san.rr.com (Courageous) Date: Wed, 12 Dec 2001 00:30:04 GMT Subject: Subclassing builtins or another alternative Message-ID: I have an external C-extension type. Let's call it "Agent". I would like to allow coders using Agent to use it syntactically as a normal baseclass. For example, import agent class Pilot ( agent.Agent ): i=3 def f(self): pass Misfortunately, either one can't do this or I simply misunderstand what to hook up in the extension. Neither the setattr() or setattro() methods appear to get invoked by either the class-level data assignment of "i=3" or the definition of the f method on the class. What, by the way, are the difference between setattr() and setattro()? And can I do what I'm trying to do? If so, how? If read some of the xxsubclass code and the like, but I'm still not grokking. C// From keyton at weissinger.org Sun Dec 2 00:03:57 2001 From: keyton at weissinger.org (A. Keyton Weissinger) Date: Sun, 2 Dec 2001 00:03:57 -0500 Subject: How is sys.path initialized without a PYTHONPATH? In-Reply-To: <000701c17aea$020c9700$a9e1fea9@carol> Message-ID: I am using ActiveState's ActivePython 2.1. I do NOT have a PYTHONPATH environment variable set on my machine. When I fire up the interpreter shell, and do the following: >>> import sys >>> print sys.path I get the following: ['', 'C:\\Python21\\Pythonwin', 'C:\\Python21\\win32', 'C:\\Python21\\win32\\Lib', 'C:\\Python21', 'C:\\Python21\\DLLs', 'C:\\Python21\\lib', 'C:\\Python21\\lib\\plat-win', 'C:\\Python21\\lib\\lib-tk', 'C:\\Python21\\Numeric', 'C:\\Python21\\PPM'] Where is the list being generated since I have no PYTHONPATH variable? Can I configure this somehow to include more places (without having to append() to the sys.path in the interpreter shell)? Thank you... Keyton From Bruce at EckelObjects.com Thu Dec 6 16:37:43 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Thu, 06 Dec 2001 13:37:43 -0800 Subject: Calling a generator multiple times In-Reply-To: <3C0FD573.B1EB891E@bioreason.com> References: <3C0FD573.B1EB891E@bioreason.com> Message-ID: <200112061337430460.01850546@mail.rdc1.sdca.home.com> That's exactly what I was looking for! Always seeing list comprehensions described as: [i for i in foo where bar] I didn't realized that the leftmost element in the comprehension was actually evaluated. Thanks! New insights into comprehensions... *********** REPLY SEPARATOR *********** On 12/6/01 at 1:30 PM Mitch Chapman wrote: >Bruce Eckel wrote: >> >> I'm trying to create a clever way to call a generator multiple >> times, but the only thing I've been able to come up with is: >> >> import random >> rgen = random.Random() >> def itemGenerator(dummy): >> return rgen.choice(['one', 'two', 'three', 'four']) >> >> print map(itemGenerator, [None]* 25) >> >> This works, but it requires the 'dummy' argument which seems >> inelegant. I'll bet someone has a better idea... > >If you're using a recent Python release (>= 2.1?) you could >use list comprehensions: > > >def itemGenerator(): > return rgen.choice(['one', 'two', 'three', 'four']) > >print [itemGenerator() for i in range(25)] > >-- >Mitch Chapman >Mitch.Chapman at bioreason.com >-- >http://mail.python.org/mailman/listinfo/python-list Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From pfk at advalvas.be Mon Dec 31 09:52:37 2001 From: pfk at advalvas.be (Peter) Date: 31 Dec 2001 06:52:37 -0800 Subject: mv command Message-ID: <96c7b7dc.0112310652.2e8c1101@posting.google.com> I'm new to Python, and can't find the way to move a file individually from a for loop to another directory. Regards Peter #!/usr/bin/python import os, sys, commands, string lscmd = 'ls ' lsdir = '/home/pk/old' lsmask = '*.txt' mvdir = 'home/pk/new' cmdtxt = lscmd + lsdir + '/' + lsmask print cmdtxt f = commands.getstatusoutput(cmdtxt) print f print '[', f[0],']', f[1] if f[0] == 0: f_split = string.split(f[1],'\n') print f_split for x in f_split: print '-->', x else: print 'no file corresponding to lsmask' From logiplexsoftware at earthlink.net Fri Dec 21 17:34:26 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Fri, 21 Dec 2001 14:34:26 -0800 Subject: vi or emacs for editing Python on Linux? In-Reply-To: References: Message-ID: <20011221143426.4aa81b3f.logiplexsoftware@earthlink.net> On Fri, 21 Dec 2001 23:25:32 +0100 "maxm" wrote: > My understanding is that for emacs I have to use a lisp dialect to > automate/extend it, and in vim I can use Python as an extension language of > sort. Do I understand that correctly? This used to be true, but now there is pymacs which allows you to extend emacs with Python. Personally I use emacs, but it's more out of habit than anything (I don't know what vim is like but I despise vi - I make too many typos to keep switching back and forth between editing and typing modes). I suppose whatever you get used to is what you'll like best. Remember too, that although these two editors are the most common on *nix, there /are/ other options, many of them more "Windows-like". -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From greg at cosc.canterbury.ac.nz Tue Dec 4 00:24:49 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Tue, 04 Dec 2001 18:24:49 +1300 Subject: PEP 276 Simple Iterator for ints (fwd) References: Message-ID: <3C0C5E21.24228E2E@cosc.canterbury.ac.nz> Marcin 'Qrczak' Kowalczyk wrote: > > i = 0 > while i < 10: > print i > i += 1 > > There is another question: should the upper bound be reevaluated each > time? I'd say no. Most of the time I wouldn't want that, and would object to paying for it when I didn't need it. When I wanted it, I'd write a while loop. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From ryan.phillips at csus.edu Fri Dec 28 19:12:27 2001 From: ryan.phillips at csus.edu (Ryan Phillips) Date: 29 Dec 2001 00:12:27 GMT Subject: Allegro interface for Python References: <3c2cfc94$1@news.vogel.pl> Message-ID: I would think so. Perhaps SWIG could be used to create the python bindings. -ryan "Tomasz W?jcik" wrote in message news:3c2cfc94$1 at news.vogel.pl... > Have you found anything interesting? > Is it possible???? > > > From Bruce at EckelObjects.com Sun Dec 30 12:02:04 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Sun, 30 Dec 2001 09:02:04 -0800 Subject: Zope Documentation (was RE: Python Popularity: Questions and Comments) In-Reply-To: References: <3C2E55A6.D873E301@engcorp.com> Message-ID: <200112300902040570.002F7A1A@mail.rdc1.sdca.home.com> This is definitely a problem. Part of it, I think, comes from the fact that application servers in general have been rather difficult to describe -- several years ago I chaired a panel at the Software Development conference on app servers and the first question I asked is "what are they?" I didn't get a good answer, and I didn't really get a grasp until I started using Zope (and I don't know how much is app servers in general, and how much is Zope, since I've only *used* Zope, and Apache with CGIs -- C++, Perl and Python -- before that). I would now describe an app server as "an operating system for building web applications," and I think this is different from what J2EE offers (some libraries to help you build certain types of web apps). I *can* say that after some struggling with the documentation I've gotten enough of a grasp to start creating some (to me, anyway) impressive things; most recently the BackTalk system that is in "Thinking in Python," which was originally created in Java and turned out to be awkward to evolve, much easier to create and evolve in Python/Zope. And someone who works with me has become a Python and Zope fanatic, and has impressed the heck out of people who were building sites using Java, because he could do it so much faster. These aren't the studies that your employer is looking for, I know. I run into the same issues when I try to explain why Python works so well. It's an experience that's difficult or impossible to prove to someone, and yet that doesn't invalidate the experience (sounds like faith, doesn't it?). But the initial learning curve is certainly a struggle, and shouldn't be that way. The Zope corp certainly knows this, but they seem to have their hands full moving the product forward and serving their customers. I changed my entire site to Zope last April, and have been periodically diving in and acquiring more understanding when I get the time. But at this point I know of nothing that would allow me to be as powerful or productive in being able to create web applications and in just creating and managing the site. Yes, it's far from perfect but it seems far more productive than anything else I've looked at. It might be worth assigning a team member to delve into it for a few weeks and prototype something. That way you'd have a local expert to evaluate it rather than relying on marketing hype/unhype. *********** REPLY SEPARATOR *********** On 12/30/01 at 7:55 AM tatebll at aol.com wrote: >Peter Hansen wrote in message >news:<3C2E55A6.D873E301 at engcorp.com>... >> Bill Tate wrote: >> > >> > I understand the "zen" thing, >> >> If you say that, then you don't really understand it. ;-) >> >> > but it's not something that business >> > people are going to care about when they making a decision about >> > whether to use it or not. >> >> As a business person, I take mild exception to that. I'd rather >> have "zen" from Zope than "marketing" from Microsoft. > >I guess I prefer to see things in the concrete and simple terms rather >abstract pieces of marketing bunk like the following from I suspect a >soon to be ex-dot.com (perhaps symptomatic you might say of the >"business" gibberish these past 3 years). Try not to laugh to hard: > > "Xxxxxx is the world's first company dedicated to using the science >of experience strategy, design, and technology to create >extraordinary results for our clients. > > Our entire team is committed to transforming our clients' >businesses through the creation of multi-channel experiences that >inspire and strengthen dynamic connections among people, businesses, >channels, and communities." > >Seems pretty clear to me - sign me up!!! :>) >-- >http://mail.python.org/mailman/listinfo/python-list Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From TomH at optiscan.com Wed Dec 19 20:54:40 2001 From: TomH at optiscan.com (Tom Harris) Date: Thu, 20 Dec 2001 12:54:40 +1100 Subject: Why is Complex number notation the way it is? Message-ID: The story I heard was that one of the early electrical scientists, possibly Volta, he of the Voltaic Piles (ouch!) used the term 'intensity' to describe electrical current, to which he gave the symbol 'i'. Tom Harris, Software Engineer Optiscan Imaging, 15-17 Normanby Rd, Notting Hill, Melbourne, Vic 3168, Australia email tomh at optiscan.com ph +61 3 9538 3333 fax +61 3 9562 7742 This email may contain confidential information. If you have received this email in error, please delete it immediately,and inform us of the mistake by return email. Any form of reproduction, or further dissemination of this email is strictly prohibited. Also, please note that opinions expressed in this email are those of the author, and are not necessarily those of Optiscan Pty Ltd. -----Original Message----- From: grante at visi.com [mailto:grante at visi.com] Sent: Thursday, 20 December 2001 9:58 To: python-list at python.org Subject: Re: Why is Complex number notation the way it is? In article <3C21173A.8E02D0A0 at cosc.canterbury.ac.nz>, Greg Ewing wrote: > Josh Yotty wrote: >> >> I've been coding Python for about a day now, and I can't 'see' why a >> complex number like 2+3i is represented as 2+3j in Python. > > Guido was apparently thinking like an engineer at the > time. Electronic engineers use j instead of i to avoid > confusion with current. And I'm sure it's almost as obvious why "i" is used for current. :) I was told it was because "c" was already taken for capacitance, but I still don't know why "i" was chosen over some other as-yet-unused letter. But, we use notation where current flows from "+" to "-" so don't try to confuse us with facts! -- Grant Edwards grante Yow! I love ROCK 'N at ROLL! I memorized the visi.com all WORDS to "WIPE-OUT" in1965!! From kragen at pobox.com Sat Dec 1 18:30:41 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 01 Dec 2001 18:30:41 -0500 Subject: variable scoping across imports? References: <7b408077.0112010826.47a6a758@posting.google.com> <3C093C3F.10AB6FF0@earthlink.net> Message-ID: <83adx2sela.fsf@panacea.canonical.org> Hans Nowak writes: > Let's see... you start x.py... x imports y... y imports x again... > at that moment x.z0 is None. Now y has a copy of x's namespace with > z0 == None. This is, however, not the same as the global namespace > you're currently in. set() changes z0 to 33, but it does *not* > affect the x module that was imported by y. I don't think things work this way, actually, although I'm at a loss to understand why the original poster's question doesn't work. From logiplexsoftware at earthlink.net Fri Dec 21 17:18:59 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Fri, 21 Dec 2001 14:18:59 -0800 Subject: text file In-Reply-To: References: Message-ID: <20011221141859.087447e0.logiplexsoftware@earthlink.net> On Fri, 21 Dec 2001 21:42:39 -0000 "friend4allin" wrote: > I need some help regarding this one.I am reading contents from a > textfile and then putting the same into data structures say a list. > can any one you help me with this... readlines() or xreadlines() -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From MarkH at ActiveState.com Sun Dec 2 19:30:03 2001 From: MarkH at ActiveState.com (Mark Hammond) Date: Mon, 03 Dec 2001 00:30:03 GMT Subject: COM "out" Variant Array params and such References: Message-ID: <3C0AC811.4000406@ActiveState.com> Michael Kelly wrote: ... > strange errors and also a quandry. The > quandry is I can't figure how to make a > call that has an "out" parameter that > is not a retval and is a Variant Array. > > When I make the call in Python as in > MyIniFile.ReadSections("Section name", VariantArrayofStrings) > whatever I put for VariantArrayofStrings never get assigned anything. VariantArrayofStrings is an "out" param - it should not be assigned anywhere. The correct way to call this should be: VariantArrayOfStrings = MyIniFile.ReadSections("Section name") You probably need to generate "makepy" support for this to work - but it seems you have already done that. > I read some stuff in the docs about coercing PyObject and Variants > but with no real pointers where to see how this is done. Some pretty deep magic. The type libraries are processed, and code that calls PyIDispatch::InvokeTypes() is called. The "type tuple" passed to InvokeTypes directs InvokeTypes on how to transform the Python args. > The weird behavior is if I use the method WriteDate to write > a date and then ReadDate to read it back I get an exception: > > type: exceptions.SystemError > value: error return without exception set This is a bug. Something like that has been fixed recently, but without more details I can not be sure if it is exactly the same thing. Mark. From sab at NOSPAM.freeuk.com Wed Dec 26 20:24:16 2001 From: sab at NOSPAM.freeuk.com (G. Willoughby) Date: Thu, 27 Dec 2001 01:24:16 -0000 Subject: REPOST: Re: Newbie question References: Message-ID: <1$--$$-$$$$%_%__-$@news.noc.cabal.int> Hi Peak Allan, I learned the basics by reading 'Learning Python' from O'reilly's, i found it very helpful. :) I think perhaps it would help to have a little experience in another language too. I am looking forward to reading 'Python on win32' from the same publishers! :) G. Willoughby. "Peak Allan" wrote in message news:mailman.1009150409.8361.python-list at python.org... > I copied this code from one of the tutorials on the > python.org website, but when I tried to run it, I got > an error. > > # Program FileTest > > out_file = open("test.txt", "w") > out_file.write("This crap is going to out file\n") > out_file.close() > > in_file = open("test.txt", "r") > text = in_file.read() > in_file.close() > print text > > bash-2.05$ ./fileTest.py > ./fileTest.py: line 3: syntax error near unexpected > token `open("' > ./fileTest.py: line 3: `out_file = open("test.txt", > "w")' > > Can someone please tell me what I did wrong? > > Also, are the tutorials at python.org a good way to > learn Python? If not, are there any other good online resources? > > __________________________________________________ > Do You Yahoo!? > Send your FREE holiday greetings online! > http://greetings.yahoo.com > ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "G. Willoughby" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:35:25 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775996 27193 211.57.49.2 (31 Dec 2001 05:19:56 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:19:56 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From rdsteph at earthlink.net Thu Dec 27 16:53:41 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Thu, 27 Dec 2001 21:53:41 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <1$--$$_----_-$-_%$@news.noc.cabal.int> > Phil Hunt wrote: > > Just as Python can compile to the JVM, I'm sure it will compile to > Microsoft's .net platform. Hmm, I'm not so sure about this. Mark Hammond has stated, I believe, that the work done so far at ActiveState was preliminary and not complete; and now we hear that ActiveState has ceased work on Python related projects??? It sounds like a Python.Net is a daunting task; as woudl be a Perl.net or a Ruby.NET don't want programming to be forcibly OO. In Ruby, can you write > > What can I do in Ruby that I cannot just as easily do in python? Until > that\ question is answered, Ruby will stay behind python in popularity. I know of absolutely nothing that you can do in Ruby but not in Python. I know that both Ruby and Python will survive, no question. I also suspect that Python will always be more popular than Ruby. My only concern was that Ruby, which I perceive as very similar to Python in many ways, will divert *some* folks form Python to Ruby; many more than will divert from, say, Python to Perl, or from Python to Tcl. > > > I expect Python to keep growing. As computers get faster, programming in > C++ makes less and less sense. People will move over to more high level > langauges, such as Java, C#, Perl and Python. Java and C# are roughly > on the same level, faster than Perl/Python but slower to code in. Python > offers the fastest coding time, as it is "executable pseudocode", so > I expect more and more stuff to be done in it. > > I totally agree with you on this. I am feeling better about Python vs. Ruby, partly based on what I am hearing from folks in this thread, and partly from what I hear on the Ruby newsgroup about problems running under windows with threading and slowness etc. I have no gripe against Ruby folks either , none whatsoever. not only is it a fee world, but people are trying Ruby out just like we tried Python out ;-))) Both communities are friendly, to. I just am more hoping that Python grows in popularity vs. Ruby. Now, my perception is that most Ruby developers run under Linux or some other Unix. I wonder what percentage of Python developers run Windows, and what percentage run Linux? I have no idea, does anyone have a guess? If you put my back to the wall to make a prediction, I'd guess that more than half of us on this newsgroup use windows. Anyone? Also, one more thing: Guido was interviewed recently in a magazine and he conjectured that programming for handholds and PDA's might be a huge niche for Python in the future. Does anyone have any thoughts on this? What are Python's strengths and weaknesses vs other languages, including Ruby, in this arena? How is Pippy doing ???? Ron Stephens http://www.awaretek.com/plf.html ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2B9901.998345FB at earthlink.net> Control: cancel <3C2B9901.998345FB at earthlink.net> Date: Mon, 31 Dec 2001 04:25:33 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775575 27193 211.57.49.2 (31 Dec 2001 05:12:55 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:12:55 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From david.abrahams at rcn.com Thu Dec 6 10:24:32 2001 From: david.abrahams at rcn.com (David Abrahams) Date: Thu, 6 Dec 2001 10:24:32 -0500 Subject: MINGW Message-ID: <9uo25q$ilp$1@bob.news.rcn.net> Is anyone out there successfully using MINGW for development of extensions with recent versions of Python (e.g. 2.1, 2.2b2)? The procedures I've found on the web for making it work don't inspire confidence. I would appreciate a pointer to a known working procedure if anyone can come up with it. TIA, Dave -- =================================================== David Abrahams, C++ library designer for hire resume: http://users.rcn.com/abrahams/resume.html C++ Booster (http://www.boost.org) email: david.abrahams at rcn.com =================================================== From wware at alum.mit.edu Thu Dec 6 07:26:24 2001 From: wware at alum.mit.edu (Will Ware) Date: Thu, 06 Dec 2001 07:26:24 -0500 Subject: Python classes for reading/writing/parsing MIDI files Message-ID: <3C0F63F0.20D2B25@alum.mit.edu> Nearly a year ago I wrote some Python classes for MIDI events and objects. These made it possible to parse an existing MIDI file to produce a meaningful Python data structure, and I used that to do some music synthesis in software. The classes are now also capable of writing a MIDI file. Thusfar the only test I've done has been to read in one MIDI file, parse it to Python data structures, and write out another, and make sure they sound identical; I haven't yet done anything like a composer's user interface to create Python data structures from scratch. Hopefully something like that will come soon. http://groups.google.com/groups?selm=3C0F0BD2.25B6F825%40alum.mit.edu&output=gplain Due to a bit of stupidiy on my part about setting up the formatting on my newsreader, there are a few formatting errors where lines wrapped in the wrong places. This happens once in the Enumerations class, once in the MidiEvent class, two harmless occurrences in the docstring of the MidiChannel class, and once in the MidiTrack class. The extra line breaks in MidiEvent and MidiTrack were lucky enough to fall inside parentheses and should have no effect. From john.thingstad at chello.no Mon Dec 17 07:19:22 2001 From: john.thingstad at chello.no (John Thingstad) Date: Mon, 17 Dec 2001 13:19:22 +0100 Subject: python and SOAP?? Message-ID: There is a SOAP implementation for Python. I feel the need to spesify that SOAP is a protocol created to send Object transcripts over the HTTP protocol. CORBA however existes for objects to communicate over the lLAN. CORBA (or for that matter DCOM) must be fast as it is created to allow a cluster of objects distributed over multiple machines to exchange date. SOAP works as a much higher level of abstartion. Say communication with a bank. Further CORBA will usually be blocked from internet accesss. SOAP using HTTP protocol will not. So... SOAP isn't designed to replace CORBA. Note that Microsoft is one of the strongest promoters of SOAP and that it dosen't really compete with teir COM+ comittment. From uche.ogbuji at fourthought.com Mon Dec 17 19:53:36 2001 From: uche.ogbuji at fourthought.com (Uche Ogbuji) Date: Mon, 17 Dec 2001 17:53:36 -0700 Subject: [XML-SIG] Pyana 0.2.0 released In-Reply-To: Message from "Brian Quinlan" of "Wed, 12 Dec 2001 22:43:10 PST." <006101c183a1$71bd9df0$445d4540@Dell2> Message-ID: <200112180053.fBI0raf31725@localhost.localdomain> > PIRXX is focused on providing Xerces XML services to Python. The current > release of PIRXX provides SAX2 interfaces but I believe that J?rgen is > working on DOM support. > > So, right now, Pyana is probably your best bet for high-performance XSLT > processing in Python while PIRXX offers Xerces SAX2 interfaces. Are you basing this on actual benchmarks? In particular, I'd be surprised if Pyana was faster overall than current CVS of 4XSLT, Since Xalan isn't, as I measure it. -- Uche Ogbuji Principal Consultant uche.ogbuji at fourthought.com +1 303 583 9900 x 101 Fourthought, Inc. http://Fourthought.com 4735 East Walnut St, Boulder, CO 80301-2537, USA XML strategy, XML tools (http://4Suite.org), knowledge management From barry at zope.com Thu Dec 27 22:35:16 2001 From: barry at zope.com (Barry A. Warsaw) Date: 27 Dec 2001 22:35:16 -0500 Subject: REPOST: Re: Mild bug: pipermail/python-dev References: Message-ID: <9$--$$_----_-----$@news.noc.cabal.int> >>>>> "SM" == Skip Montanaro writes: SM> This is a known problem. I believe Pipermail uses the SM> timestamp in the Date: header, which is generated by the SM> sender. If their clock is off (as /F's apparently was when he SM> sent the message in question), you get a bogus entry in the SM> archive. I believe the solution would be to use the timestamp SM> in the Date: field unless it appears to be too far in the SM> future or the past (probably using different thresholds for SM> future and past), in which case it should either use the the SM> timestamp in the From_ field or the current time. Exactly. I have some experimental code in Mailman 2.1 which should be able to retroactively fix such problems in an mbox archive file, along with problems with unquoted From_ lines. The downside: it requires regenerating the entire archive, and it messes up existing urls to articles. Upside: it should assign more permanent urls to articles, based on Message-IDs. -Barry ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: barry at zope.com (Barry A. Warsaw) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:27:55 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775437 27193 211.57.49.2 (31 Dec 2001 05:10:37 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:10:37 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jkraska at san.rr.com Thu Dec 13 17:52:30 2001 From: jkraska at san.rr.com (Courageous) Date: Thu, 13 Dec 2001 22:52:30 GMT Subject: which book? References: Message-ID: On Thu, 13 Dec 2001 20:23:04 GMT, "Preben" wrote: >I've been recommended to buy a Python book, >but I'm not sure which one I should buy.. While I have no recommendations on any book involving the learning of Python or programming itself, I can say that no Python library is complete without _Essential Python Reference_. After you know the basics, but just need to look something up, this is the one you want. Its section on Extending and Embedding is worth the price of the book alone. C// From erik at pacific-shores.com Fri Dec 28 00:29:58 2001 From: erik at pacific-shores.com (Erik Myllymaki) Date: Fri, 28 Dec 2001 05:29:58 GMT Subject: base64.decodestring gives binascii.error Message-ID: <3C2C03CB.7030000@pacific-shores.com> should base64.decodestring give a binascii.error if it encounters special chars like '_' and '!' ? -- Erik Myllymaki erik at pacific-shores.com From eppstein at ics.uci.edu Thu Dec 6 16:31:29 2001 From: eppstein at ics.uci.edu (David Eppstein) Date: Thu, 06 Dec 2001 13:31:29 -0800 Subject: PEP 276 Simple Iterator for ints (fwd) References: <9uomtp$e1cbj$1@fido.engr.sgi.com> Message-ID: In article <9uomtp$e1cbj$1 at fido.engr.sgi.com>, pj at sgi.com (Paul Jackson) wrote: > Ah - you may have exposed my primary concern with this - thanks. > > It isn't obvious to me which variables are free and which bound. Why do you think it's obvious which is bound and which unbound with the "for i in L" syntax, in situations where both i and L are variables? I think it's a matter of what you're used to. In expressions like "element in member" the bound variable is always the first one, in expressions like "lb < i <= ub" the bound variable is always the middle one. But anyway, it would also be acceptable to me to use a syntax like "for i in lb < ... <= ub". This would also answer the other common objection that all for-loops must use "for var in iterator" syntax. I prefer the other syntax, because I think this one is verbose in a way that doesn't actually improve readability (verbosity that improves readability is better than conciseness, though). > All the examples I happened to read earlier in this thread had > only one variable, and used explicit integer constants for the > bounds, as in: > > for 0 <= x < 5: > > In that case, it's pretty obvious that 'x' is the free variable. > > But in your notes, you have things such as: > > for n > i >= 0: > for i < j <= n: I believe this matches the standard mathematics conventions e.g. for subscripts of summation signs. > Here it seems to rely on some assumption that the middle > term, i or j, is the free variable. So at least the > following two variants: > > for 0 <= x**2 < 16: # integers x whose square is in range(16) > for 0 <= x: # non-negative integers x > > should not be allowed, because they violate the assumption I > just surmised. Or then the assumption gets more subtle. They should not be allowed unless "for x**2 in L" is also allowed. > Pseudo code, such as in David's lecture notes, has the advantage > that it can rely on contectual comments, suggestive variable > names, and the authors descretion to avoid non-trivial cases. > But programming language syntax needs to be parsable by clear > rules, even absent (1) comments, (2) suggestive variable names, > or (3) discrete authors. The clear rule is, the middle term of a three-way comparison is always a variable, just like the way (in current Python) the left term of an "in" expression is always a variable. -- David Eppstein UC Irvine Dept. of Information & Computer Science eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/ From vincent_a_primavera at netzero.net Fri Dec 28 10:18:34 2001 From: vincent_a_primavera at netzero.net (Vincent A. Primavera) Date: 28 Dec 2001 15:18:34 +0000 Subject: Authentication, urllib, and httplib... Message-ID: <1009552714.4802.15.camel@del-vap-bos.ralphpill.com> Hello, Trying to write a program to pull several Excel format reports off of a website which we at my company are spending alot of time on doing manually once a week. The page has a form with several fields to be filled in before submitting. Here's the problem, I can access the page with urllib's urlopen() but not with httplib's HTTPConnection.request() as I am getting a 401 Authorization Required error. How can I be prompted for the user and password info as I am with urlopen()? Or better yet pass these parameters? Thanks in advance, Vincent A. Primavera P.S. I have all of the necessary field names with exception to the username and password... From MAILBOX-SA at nameconnector.com Sun Dec 2 07:48:22 2001 From: MAILBOX-SA at nameconnector.com (System Attendant) Date: Sun, 2 Dec 2001 07:48:22 -0500 Subject: ScanMail Message: To Recipient virus found and action taken. Message-ID: ScanMail for Microsoft Exchange has detected virus-infected attachment(s). Sender = Lara Kalliri Recipient(s) = python-list at python.org Subject = Scanning Time = 12/02/2001 07:48:22 Action on virus found: The attachment info.DOC.scr exists WORM_BADTRANS.B virus. ScanMail has Moved it. The attachment was moved to C:\Program Files\Trend\Smex\Virus\info.DOC3c0a23162.scr_. Warning to recipient. ScanMail has detected a virus. From rdsteph at earthlink.net Sat Dec 29 19:56:26 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sun, 30 Dec 2001 00:56:26 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: <1$--$$_----__$%--$@news.noc.cabal.int> Paul, I'm just wondering if you could possibly add any of the "ideas", (such as they are ;_))) from the two posts that I copy below from a thread above here??? My comments come from a clueless brain dead newbie (*me*) about a Fiery Bush Python Server, could Zope maintain such a Master Python (Zope) server as a public utility in addition to Zope's other capabilities? Dr. Ritchie's comments are probably more sane, but even he wondered if he was on "shakey ground" ;-))) Anyway, keep up the great work. I am interested someday in learning and using Zope, but I admit I am a little intimidated by stories on the list of its difficulty. Still,, someday ;-)) I imagine the blood , sweat, and tears already incorporated into Zope make it a work of great beauty. Good luck on Zope3, maybe I'll get around to running my Great Zope-based web site about the time you launch Zope 3, I hope, if not before ;-))) Ron Stephens http://www.awaretek.com/plf.html Paul Everitt wrote: > I think there's a lot of merit to what you (Bill) say below. Zope is a > big project in scope, and though there is a lot of documentation, it is > scattered and not organized as it should be. > > The current Zope (2.x) also suffers from more of a "one size fits all" > approach, where content authors, web designers, and site developers are > all wedged into the same basic box. Thus, documentation and GUI suffer > from having different audiences. All in all, Zope has a higher learning > curve than it should. > > Tackling this basic issue is the goal of Zope3: > > http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/ > > In particular, read "VisionStatement" on that page for a pretty blunt > statement showing we're in tune with your points. Zope3 actually has > documentation, interface files, and unit tests being written *before* > code. All in all, Zope3 is proving to be much more Pythonic, more > modular, more explicit than implicit, etc. > > This doesn't preclude the need to do this for Zope2. I'm interested in > hearing more about the Pet Shop example you mentioned. Is it a > canonical example that is written up somewhere else for a different system? > > All in all, Zope is doing quite well. I'd say, with all the books out > and coming out, we're ahead of where PHP was at a similar age. Also, > it's important to note that around half of the people using Zope had > never used Python before. It's a significant achievement. Like Python, > Zope has a large and active community with bright and pleasant people > all around the world. > > I'd also like to point out that Zope isn't a straight-up competitor to > J2EE. In many ways, Zope competes more with Vignette, Interwoven, and > other content management systems as much as it competes with application > servers. This explains why appealing to content authors and site > designers has been on our radar. > > It also explains why I think WebWare, Quixote, and other Python web > systems are complementary to Zope. It's a big market with lots of > audiences. And we all need Python to succeed. > > In fact, with Zope3 I'd like to see more ways for us to collaborate with > other Python web systems, as there is a lot of good work going on. With > Zope3 being more Pythonic and more modular, there's a better basis for > two-way sharing. But only if other projects are also interested. > > 2002 is going to be a critical year for Zope. On the one hand, we have > the validation from multiple books and some nice customer success > stories (hooray, we can finally talk about CBS!). Also, Zope3 combined > with Python 2.2 will make Zope more friendly to Python developers. On > the other hand, we either win back people like you this year, or we face > the thought that we've peaked. > > Bill, can you send me an offline note and explain the Pet Shop example? > > --Paul > > Bill Tate wrote: > > > Ron Stephens wrote in message news:<3C2B9E04.9957801F at earthlink.net>... > > > >>I recently read an interview with a Digital Creations top manager where he said > >>that he hopes someone starts a successful business based solely on providing > >>ISP services using Zope, with full technical support. Is anyone looking into > >>this? Does anyone think this could be a successful business model? I am > >>interested in opinions on this. > >> > > > > This past spring, I spent a full month pouring over Zope in detail. I > > pulled every example product I could find that I thought would be > > relative to the purpose of setting up a commercial-based application. > > I downloaded the tutorial and the draft zope book. I pulled down > > every bit of documentation I could find for developers. In so many > > cases, I found whatever documentation was available that key aspects > > of the implementation took the "assumed facts-already-in-evidence" > > approach; omitting key details that would were critical to improving > > my understanding of using Zope. I consider myself a masochist in the > > sense that I'm willing to go through various contortions to figure > > something out, but like many others, I reached a point of saying that > > I still don't get it. I won't even touch the issue of ZOPE's CMF or > > Zope Templates - the documentation on that couldn't be more confusing > > if it tried. > > > > My point is, the product may be perfect for my needs, but please do > > away with tutorial examples referring to using zoo animals to > > illustrate object navigation or elvis sightings to solidfy > > understanding of the product. There were simply too many disjointed > > pieces in the documentation to allow me to pull all the pieces > > together and believe me when I say I'm a person who will go to great > > lengths to try to "get something." If I'm having trouble, than I > > suspect more than a few others are as well. > > > > Any commercial enterprise is likely to be supported by either some > > data model or object-class model that almost invariably has a RDBMS on > > the back-end for persistent storage (I've also worked with ODBMS so > > ZODB isn't an issue for me). If you want to gain converts to zope, > > build a tutorial that follows some resemblance of a what a normal web > > site has to provide by way of example - perhaps something akin to the > > Pet Store example in Zope would be useful??? How about building an > > example auction site from scratch? I would be more than happy to > > devote time and energy contributing to Zope but I can't until I figure > > out how Zope works. To some degree, I think my confusion with Zope > > increased AFTER I went through the documentation. Truthfully, I don't > > even know whether Zope would be even a reasonable candidate for doing > > something akin to the Pet Store example or even an auction site for > > that matter. > > > > PHP has virtually exploded on the scene by providing a everything > > including the kitchen sink - it appears to have taken little > > convincing to gain converts to PHP and accordingly to the latest web > > surveys, its implementation is huge. I much rather see tools like > > Zope achieve that kind of status. But I don't imagine that too many > > folks are going to be willing to work that hard to achieve Zope Zen > > when other alternatives exists and that's a damn shame because I > > suspect Zope is an excellent product. > > > > I truly do commend and appreciate DC's contribution's to Python, but I > > hope somebody can point to something (either examples or > > documentation) that gives me a reason to try again. > > > > Truthfully, I just don't think its me. > > > > Bill Tate > > ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E6756.79817679 at earthlink.net> Control: cancel <3C2E6756.79817679 at earthlink.net> Date: Mon, 31 Dec 2001 02:38:47 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774442 27193 211.57.49.2 (31 Dec 2001 04:54:02 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:54:02 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From daves_spam_dodging_account at yahoo.com Fri Dec 28 17:42:16 2001 From: daves_spam_dodging_account at yahoo.com (David Brady) Date: Fri, 28 Dec 2001 14:42:16 -0800 (PST) Subject: import path, script path (was Re: module path) In-Reply-To: Message-ID: <20011228224216.58950.qmail@web21103.mail.yahoo.com> > From: John Machin [mailto:sjmachin at lexicon.net] > > 2. Can somebody please help with the OP's implicit > but not quite asked > 2nd part of question: How to set up the path to > follow when > > prompt> python myscript.py I am running Win9x, Win2k, and WinXP, and have JPSoft's excellent 4Dos and 4NT products for them. In them, if you can make python scripts executable by typing set .py=c:\Python21\Python.exe set .pyw=c:\Python21\Python.exe Or whatever your Python path is, or by adding them to the environment variables. Then, if your script file is anywhere in the executable path (set PATH=%PATH%;c:\Python21\scripts\), 4Dos or 4NT will go find Python and run it for you. I have been told that the standard Windows cmd shell will do it for you as well, but I don't know how or where. Perl has a handy command-line option, -S, which tells perl to search the PATH for the script if it cannot find it in the local folder. I suppose it would be possible to write a batch file that would run a Python script to search the cwd and the search path for a script file, and upon finding it, run Python on that script there. Phew... convoluted, but it could probably be made to work. Good luck, -dB ===== David Brady daves_spam_dodging_account at yahoo.com I'm feeling very surreal today... or *AM* I? __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com From phr-n2001d at nightsong.com Fri Dec 7 23:12:32 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 07 Dec 2001 20:12:32 -0800 Subject: Hiding stuff like passwords in source? References: Message-ID: <7xlmgee4en.fsf@ruckus.brouhaha.com> Yes, I have a module that can do what you're asking though it might overkill. Basically it's an encryption routine where the encryption key is kept in a separate process from the application and the processes communicate through a remote object protocol. You would start up the key-holding process when you log in and type your password once. Your application could then access it as needed. The module is not yet released but the preliminary docs are at: http://www.nightsong.com/phr/python/crypto.txt. Let me know if that's what you're looking for. From tim at vegeta.ath.cx Thu Dec 27 14:07:17 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Thu, 27 Dec 2001 19:07:17 GMT Subject: REPOST: Re: age of new pythonistas [was: The Editor Poll results are in!] References: <60c49aa9.0112202148.7218555b@posting.google.com> Message-ID: <0$--$$_----_%__$%$@news.noc.cabal.int> Fran?ois Pinard graced us by uttering: > Even if I prefer Python to Perl, I would never even think that Perl > is not well designed. When I was using Perl, as a user (not as > a reader of books about it :-), I found that Perl allowed me to > quickly write my code, it was full of good ideas, and I felt the > language quite fulfilled its promises. > > On the other hand, Perl was probably not designed according to my > own tastes, and it is true that Python fits my tastes much better; > the gained comfort alone is the source of some proficiency. But > not sharing my tastes does not make something necessarily bad. And > besides, wandering around a bit with an opened mind allows someone > to improve its culture and to evolve his tastes. Thank you. I could not have said this better (or more diplomatically) myself, as I'm also an avid Perl hacker and tend to get defensive. Nor can I help my bias. Perl and Python both have very different personalities, but it's these differences that make them both equally valuable. Tim Hammerquist -- NOBODY EXPECTS THE SPANISH INQUISITION! ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!newsfeed.mathworks.com!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Tim Hammerquist Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:55:26 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775643 27193 211.57.49.2 (31 Dec 2001 05:14:03 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:14:03 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From Gareth.McCaughan at pobox.com Mon Dec 10 16:30:18 2001 From: Gareth.McCaughan at pobox.com (Gareth McCaughan) Date: Mon, 10 Dec 2001 21:30:18 +0000 Subject: reference counting for garbage collection References: <1008011593.29363.0.nnrp-10.c1c3e1d9@news.demon.co.uk> Message-ID: Paul Brian wrote: > If I create a function : > > def foo(server): > ''' creates a connection to server and returns it''' > conn = mycleverconnection(server) > return conn > > and then I do > > x = foo('10.x.x.x.') > > will the function foo still keep some reference to conn such that > > del(x) > > will *not* destroy conn but conn will still stay alive? No, it won't. > if not > > 1) is there some tool that shows me what exactly is alive in the python > environment No. > 2) is there some notes on references, keep alives and other mysterious > things in the docs The "Extending and embedding Python" docs describe the mysterious things you need to understand if you're, erm, embedding or extending Python. If you aren't doing that, then there isn't really anything very complicated. Objects go away when nothing refers to them any more. When an object is referenced, but only "circularly" (i.e., there's no way of getting at it from any live scope) it may go away, but not necessarily immediately. It's arguably bad style to rely on objects going away as soon as they're no longer referenced, because if Python switches over completely to a "real" GC some time in the future then it will stop being true. > 3) what have I done wrong in the stuff I just wrote (no not the above:-)? > > (Ok so 3 is my problem :-) That's a pity, since you haven't told us anything about the stuff you just wrote except that it isn't what you put in the article :-). That makes it hard to work out what might be wrong. Are you getting things disappearing when you don't expect them to, or things not disappearing when you do expect them to, or something else? If something isn't disappearing when you expect, that might be because it's part of a circular chain of references. def make_cycle(): a = [0] b = [a] a[0] = b If you call make_cycle() then the list named "a" doesn't disappear when a goes out of scope (because the list named "b" refers to it), and the list named "b" doesn't disappear when b goes out of scope (because the list named "a" refers to it). Recent versions of Python are equipped with a garbage collector that will pick those up, but it won't necessarily do so as soon as make_cycle() returns. It's possible to compile Python without the GC, too. If something is disappearing when you don't expect it to, that's odder. You probably have a bug either in your code or in Python or in your brain. You haven't given enough information to tell which. :-) -- Gareth McCaughan Gareth.McCaughan at pobox.com .sig under construc From rob at pythonemproject.com Sat Dec 29 13:11:24 2001 From: rob at pythonemproject.com (Rob) Date: Sat, 29 Dec 2001 18:11:24 GMT Subject: REPOST: Re: need help with class of arrays which have attibutes References: <3C2D3C2C.C9EF5AFE@pythonemproject.com> Message-ID: <7$--$$_----__$%$_$@news.noc.cabal.int> Thanks Emile! Paul Dubois helped me out with this originally and I thought that his code was broken, since a test case didn't work right. Now I'm perplexed since I can no longer get his code to break :) But there is one part of my program that definitely is hosed which uses this class, and today I'll try to get it to work. Here is what Paul send me: -------------------------------- from Numeric import * class Cond: x1=0 y1=0 lz1=0 x2=0 y2=0 lz2=0 DelX=0.0 DelY=0.0 DelZ=0.0 wire=map(lambda dummy: Cond(), zeros((20))) -------------------------------------------------- In case you are wondering why I'm doing such insanity, I'm porting a C program with chained structures. If I don't set up some Python classes that work the same, I'll have to change 100's of lines of code. I will print out your code, study it, and keep it for further reference. Thanks a lot! Rob. Emile van Sebille wrote: > > "Rob" wrote in message > news:3C2D3C2C.C9EF5AFE at pythonemproject.com... > > > > Hi Emile, I've been reading the books and experimenting with different > > kinds of classes, but it just doesn't seem possible to use an array as a > > basis for a number of class attributes. For example, > > wire=conductor (i.e. class) wire[1].x1=30 wire[2].x2=40 etc. Rob. > > import Numeric > > class Test: > def __init__(self): > self.attrs = Numeric.zeros(10) > > def __repr__(self): > return repr(self.attrs) > > t1 = Test() > t1.attrs[2] = 1 > > t2 = Test() > t2.attrs[2] = 2 > > print t1 > print t2 > > HTH, > > -- > > Emile van Sebille > emile at fenx.com > > --------- -- The Numeric Python EM Project www.pythonemproject.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Rob Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E06C9.E2AE1F40 at pythonemproject.com> Control: cancel <3C2E06C9.E2AE1F40 at pythonemproject.com> Date: Mon, 31 Dec 2001 04:52:31 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774643 27193 211.57.49.2 (31 Dec 2001 04:57:23 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:57:23 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jdf at pobox.com Fri Dec 28 00:43:04 2001 From: jdf at pobox.com (Jonathan Feinberg) Date: Fri, 28 Dec 2001 05:43:04 GMT Subject: Python Popularity: Questions and Comments References: Message-ID: "A. Keyton Weissinger" writes: > If it is as "X" as we all say/know/feel-in-our-hearts that it is, why is > there so very little real commercial appeal? [snip] > OK. At this point, I will get probably 3-10 messages public or private > saying that Python does not attempt to answer the same niche. It has nothing whatsoever to do with the merits. It's entirely about marketing. It's about pointy-headed Chief Technical Officers who have heard that Java is a good "enterprise" language, etc. -- Jonathan Feinberg jdf at pobox.com New York, NY http://pobox.com/~jdf From claird at starbase.neosoft.com Fri Dec 28 11:21:36 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 28 Dec 2001 10:21:36 -0600 Subject: REPOST: Re: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> Message-ID: <8$--$$_----_--$%_$@news.noc.cabal.int> In article , Alex Martelli wrote: >"Aahz Maruch" wrote in message >news:a0i027$dl2$1 at panix3.panix.com... >> In article , >> DeepBleu wrote: >> > >> >NNTP is an internet protocol like SMTP, POP3 and HTTP for >> >communication. Also, it is the oldest one and it used to be the most >> >instructive before AOL hit the scene along with the 'gold rush' :) . . . >SMTP must be older, by a few years (say '82 vs '86?). FTP must be >older still -- before SMTP, mail was distributed with an FTP tweak. > >Of course, netnews used other transport-level protocols (mostly >based on UUCP, as I recall) well before the Internet was officially >inaugurated (1983, wasn't it?). . . . RFC 765 FILE TRANSFER PROTOCOL June 1980 RFC 821 SIMPLE MAIL TRANSFER PROTOCOL August 1982 RFC 854 TELNET PROTOCOL SPECIFICATION May 1983 RFC 850 Standard for Interchange of USENET Messages June 1983 RFC 977 Network News Transfer Protocol February 1986 Telnet had already been around for a while by this time. I don't know what you mean by the "official inauguration" of the 'Net. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: claird at starbase.neosoft.com (Cameron Laird) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:13:23 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775307 27193 211.57.49.2 (31 Dec 2001 05:08:27 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:08:27 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From alan.gauld at bt.com Mon Dec 24 05:51:00 2001 From: alan.gauld at bt.com (alan.gauld at bt.com) Date: Mon, 24 Dec 2001 10:51:00 -0000 Subject: [Tutor] An hour's talk on python...Suggestions required (fro m a newbie) Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB20E66C1F9@mbtlipnt02.btlabs.bt.co.uk> > Ours is mainly a java shop. So definitely include Jython and how you can use all those familiar Java class libraries while writing the code in the much higher level Python... Some examples should quite easily show a 30-50% code reduction in Jython vv Java... Thus a perfect prototyping language for Java heads. > I was planning to take an introductory session on python. There are several slide presentations on the python web site that you could 'learn from' - ie plagiarise... > w'd want to try it out unless and otherwise they can see lots of > supporting tools and libraries. How about all the Java stuff plus the 100+ standard modules plus another 100 or so on the web? > 1. functional programming in python Good article on the IBM site > 2. about new features that have been included in 2.2? Read the 'whats new papers' > 3. threading as for as tools/libraries are concerned, Not quite sure what you mean here... > 4. GUI : Tkinter Yes, Or AWT if they want to keep with Java Or pyQt/PyGTK if they are Linux fans. Or even all three to show how easy core functionality can be ported over different GUIs. - a bit more work there tho' > 5. xml?? : the one which ships with standard module or something else? > 6. cgi: If you must, but web stuff is a bit passe now. Might be better looking at SOAP or XML/RPC. Python is blindingly good at the latter compared to Java! > But i want to develop some interest here @ my place. > Any suggestion w'd be of great help to me. IMHO The real advantages of Python are that it is a scripting tool that can handle large projects so you get all the advantages of scripting languages like Perl but with the control and organisation of compiled languages like C++/Java/Delphi etc. Its brilliant for prototyping and for tool building. And as your list of topics proves, extremely versatile. Alan G. From tim.one at home.com Mon Dec 17 22:30:00 2001 From: tim.one at home.com (Tim Peters) Date: Mon, 17 Dec 2001 22:30:00 -0500 Subject: Generator function performance In-Reply-To: <20011217090234.A84347@hishome.net> Message-ID: [Oren Tirosh] > At first, I thought of generator function mostly in terms of convenience: > the resulting source is shorter and more readable compared to other > implementations. Then I found an unexpected benefit: generators are > also very efficient. Yes, this was noted (and measured) on c.l.py when generators were still a novelty . For example, recursive generators yielding combinatorial objects one at a time generally run significantly faster than recursive functions building up all the results into a list. Plus the memory savings can be unbounded . > A function call in Python is quite expensive. Suspending and restoring > the state of a generator is relatively cheap in comparison. It may help to explain that a bit: calls cost for two main reasons. First is sorting out the large number of arglist gimmicks at runtime each time: positional arguments, default arguments, and keyword arguments don't come for free, and so far we haven't invented specialized opcodes to try to take advantage of that *most* calls don't use keyword arguments at all. Second is initializing a frame object, which spans over 100 lines of dense, dull C code, like this (just the tail end of it): ... f->f_locals = locals; f->f_trace = NULL; f->f_exc_type = f->f_exc_value = f->f_exc_traceback = NULL; f->f_tstate = tstate; f->f_lasti = 0; f->f_lineno = code->co_firstlineno; f->f_restricted = (builtins != tstate->interp->builtins); f->f_iblock = 0; f->f_nlocals = code->co_nlocals; f->f_stacksize = code->co_stacksize; f->f_ncells = ncells; f->f_nfreevars = nfrees; while (--extras >= 0) f->f_localsplus[extras] = NULL; f->f_valuestack = f->f_localsplus + (f->f_nlocals + ncells + nfrees); f->f_stacktop = f->f_valuestack; _PyObject_GC_TRACK(f); return f; In contrast, the arglist is parsed only once over the lifetime of a generator, and the frame object is reused almost entirely as-is across resumptions. The full code needed to resume a generator is less than the block above from the tail end of PyFrame_New() (see gen_iternext() in ceval.c for the non-gory details). tastes-great-and-less-filling-ly y'rs - tim From robin at jessikat.fsnet.co.uk Sat Dec 15 04:32:11 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Sat, 15 Dec 2001 09:32:11 +0000 Subject: Model View Presenter GUI pattern? References: <20011213172833.0bfac3c7.gry@ll.mit.edu> Message-ID: In article <20011213172833.0bfac3c7.gry at ll.mit.edu>, george young writes >Is anyone using the Model View Presenter GUI framework/pattern in python? >I've been reading bits about it, and it sounds quite attractive. Sam Rushing's dynwin at http://www.nightmaer.com was doing it at one time although I don't know how far it got or even if it's active. -- Robin Becker From qrczak at knm.org.pl Mon Dec 3 04:31:38 2001 From: qrczak at knm.org.pl (Marcin 'Qrczak' Kowalczyk) Date: Mon, 3 Dec 2001 09:31:38 +0000 (UTC) Subject: PEP 276 Simple Iterator for ints (fwd) References: Message-ID: Mon, 3 Dec 2001 19:27:46 +1100, Delaney, Timothy pisze: >> I.e. it's translated to 'while' rather than to 'for i in range'. > > Definitely not. The name receiving the value from the iterator There is no requirement to implement this as using an iterator. > In fact, it would be impossible to do what you are suggesting unless > you were going to have some way to inform the iterator that the > name which received its value had been rebound. I meant translating for 0 <= i < 10: print i into i = 0 while i < 10: print i i += 1 There is no iterator here. There is another question: should the upper bound be reevaluated each time? Again it's a silly idea to depend on that, but it should have some semantics. -- __("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ QRCZAK From wzdd at lardcave.net Mon Dec 3 22:43:39 2001 From: wzdd at lardcave.net (Nicholas FitzRoy-Dale) Date: Tue, 4 Dec 2001 14:43:39 +1100 (EST) Subject: the purpose of this list??? In-Reply-To: <168B2A5F6A99D4119E200008C7C9CA8001CCA5E4@gibraltar.captura.com> Message-ID: On 3 Dec, Gabe Newcomb wrote: > So I just joined the list an hour ago. I've read 4 of the messages and half > of them involve some form of flaming. If we're going to argue about how to > do something, that's one thing, but please, people, if you're trying to make > points just to preserve your image, give it a rest. It's a waste of all our > time. This is the most flame-free list I've ever been on, and once the weirdos in the corner stop muttering about indentation it'll be even better ;-) -- - Nicholas FitzRoy-Dale http://www.lardcave.net Feel my three-toed wrath! - Catie From adam at localhost.localdomain Thu Dec 20 22:10:45 2001 From: adam at localhost.localdomain (bougle gluce) Date: Fri, 21 Dec 2001 03:10:45 GMT Subject: calling external programs Message-ID: I was wanting to write a python program for linux that can call upon external programs. for instance the newsreader that I use is able to call my favorite text editor to edit this post, when I quit and save the text it saves it to a specific file then posts the text. I think I understand how I might use system() to call upon another program. what I don't understand is how is it possible to take the user back to the calling program. for instance how do I end up back in my newsreader after I'm finished editing this post? and how did the editor know where to save the file? From tuttledon at mailandnews.com Fri Dec 7 23:34:22 2001 From: tuttledon at mailandnews.com (Don Tuttle) Date: Sat, 08 Dec 2001 04:34:22 GMT Subject: GUI builder References: Message-ID: "Timothy Collins" wrote in message news:yZbQ7.37959$WC1.3719825 at newsread2.prod.itd.earthlink.net... > Just wondering if anyone knows where I could get my hands on a gui builder > that would work with python. I have tried "Boa Constructor" and it works, > but only to a point - if I try to open the frame build it coughs up errors > until it just stops. Any other free or nearly free visual IDE's out there? Take a look at wxDesigner http://www.roebling.de/ It's a front end for wxPython. Don From thisis at bogus.com Wed Dec 5 13:34:06 2001 From: thisis at bogus.com (Duke) Date: Wed, 5 Dec 2001 13:34:06 -0500 Subject: Learning resources needed References: <9ukp40$90u84$1@ID-106629.news.dfncis.de> Message-ID: <9ulp6h$9ee32$1@ID-106629.news.dfncis.de> "Jonathan Gardner" wrote in message news:mailman.1007567348.24232.python-list at python.org... > If you are looking to develop GUI apps, look towards PyQt. Qt runs on X, > Windows, and now Mac as well. I tried to learn Tcl/Tk, but I ended up using > PyQt because it is a lot simpler and a lot easier to work with and customize. Problem with the Windblows version of Qt (at least full-blown Qt, don't know anything about the licensing of PyQt) is that it is a 30-day limited demo and it's a 10MB+ download (thinking of the users of my programs). But just for the X side I will give it a try since I've programmed Qt and, although not a huge fan, I like it. From nas at python.ca Fri Dec 7 09:56:09 2001 From: nas at python.ca (Neil Schemenauer) Date: Fri, 7 Dec 2001 06:56:09 -0800 Subject: Calling a generator multiple times In-Reply-To: ; from jkraska@san.rr.com on Thu, Dec 06, 2001 at 10:09:16PM +0000 References: <200112061113290670.0100F457@mail.rdc1.sdca.home.com> Message-ID: <20011207065609.B26213@glacier.arctrix.com> Courageous wrote: > The first call to some generator g() should behave like: > > f=g() > f.next() That would reduce the power of generators in Python. There would be no way to create a generator without starting it. Neil From gh_pythonlist at gmx.de Sat Dec 15 00:09:30 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Sat, 15 Dec 2001 06:09:30 +0100 Subject: Is there any method to run Tk program without dos window? In-Reply-To: <9vejd3$euvji$1@ID-12869.news.dfncis.de> References: <9vejd3$euvji$1@ID-12869.news.dfncis.de> Message-ID: <20011215050928.GA1451@lilith.hqd-internal> Le 15/12/01 ? 12:24, Kick ?crivit: > I use Active Python in windows, every time I double click to run a tk > program, it will bring a dos window. How can I make this hidden? Just rename the Python script to .pyw instead of .py. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From dgoodger5511 at rogers.com Mon Dec 10 01:05:13 2001 From: dgoodger5511 at rogers.com (David Goodger) Date: Mon, 10 Dec 2001 06:05:13 GMT Subject: Calling a generator multiple times References: Message-ID: Not intending to fan flames, but... Tim Peters wrote: > The obviousness of that is *why* there's a BDFL Pronouncement: you're not > going to convince anyone, and nobody else is going to convince you. Some > people have convinced *themselves* to switch positions, though, based on > experience with the new feature. I've only seen that switch go in one > direction, though, tending to confirm that Guido's intuition was correct. That last seems almost a truism. Which person seems more likely? 1. Someone who, having adopted a position, finds their position vindicated by a BDFL Pronouncement, resulting in the implementation of a feature in their favorite flavor, then turns around and says "no, sorry, was wrong, the other way was better". 2. Someone who, having adopted a position, finds their position rejected by the same BDFL Pronouncement, but swallows their pride and stops tilting at windmills, gets used to the way things are, and finds that it's not so bad after all. I'd say just the fact that the feature is implemented and available for all to use, in itself, virtually *guarantees* that there will be a preponderance of converts to that feature. In the rare case that I don't agree with a Pronouncement, I'm definitely in the same, pragmatic camp as person 2. Guido designed a wonderful language: tastes great, *and* less filling. -- David Goodger goodger at users.sourceforge.net Open-source projects: - Python Docstring Processing System: http://docstring.sourceforge.net - reStructuredText: http://structuredtext.sourceforge.net - The Go Tools Project: http://gotools.sourceforge.net From morten at thingamy.net Wed Dec 5 00:50:34 2001 From: morten at thingamy.net (Morten W. Petersen) Date: 4 Dec 2001 21:50:34 -0800 Subject: Benefits of moving from Python to Common Lisp? References: Message-ID: <88ad4fa1.0112042150.a89992d@posting.google.com> "Morten W. Petersen" wrote in message news:> > First off, to save everyone some time, I'm wondering if there are more > papers documenting the difference between the two; if there aren't any, > I'd like to continue the discussion and summarize the findings in a paper > accessible on the net. Ok, there's been lots of good feedback. I don't have time to make a document documenting the differences right now, but plan to do so, probably at the start of next year. Thanks everyone for constructive feedback! :-) Regards, Morten From dmallwitz at cox.rr.com Sat Dec 22 00:41:17 2001 From: dmallwitz at cox.rr.com (David Mallwitz) Date: Sat, 22 Dec 2001 00:41:17 -0500 Subject: Comunicating through COM ports References: Message-ID: <3c241b4f$1_2@goliath.newsgroups.com> FW: Comunicating through COM ports Ah, ok. Two possibilities here - 1) download a Python distro that has the Serial package already incorporated (I know Activestate comes with it, not sure about PythonWare) or 2) figure out how to make the Serial module work with the plain vanilla Python install from python.org. Since 2.2 was just released I downloaded it from python.org and installed, then copied the Serial package over to libs/site-packages. This imports the Serial module just fine, but fails on the 'Serial.Serial' function apparently because 'elapsedTimer' can't be found. I'm guessing that it's just a PYTHONPATH issue, but I don't have time to work through it right now. I'll post the Serial module if you want to try the second option, but the fastest/easiest choice would be to download the Activestate distro (www.activestate.com). On the other hand, I'm kind of down on Activestate right now since the lastest release of their IDE 'Komodo' won't honor my home-user license so maybe it's time to give PythonWare a try (www.pythonware.com). Best, Dave "Alves, Carlos Alberto - Coelce" wrote in message news:mailman.1008962966.22789.python-list at python.org... I'm using Python 2.1 and I installed it through .exe installer from www.python.org -----Original Message----- From: David Mallwitz [mailto:dmallwitz at cox.rr.com] Sent: Friday, December 21, 2001 4:12 PM To: python-list at python.org Subject: Re: Comunicating through COM ports FW: Comunicating through COM portsWhich Python distribution are you using? Or did you compile from source? Dave "Alves, Carlos Alberto - Coelce" wrote in message news:mailman.1008955468.30561.python-list at python.org... Sorry, but as I said before, I'm under windows98 and I haven't such directory. Do I need to download that module from anywhere?!If so, give me an URL. -----Original Message----- From: David Lees [mailto:deblnonospammyno at raqia.com] Sent: Friday, December 21, 2001 1:46 PM To: python-list at python.org Subject: Re: FW: Comunicating through COM ports Python21/scripts/PythonSerial david lees > "Alves, Carlos Alberto - Coelce" wrote: > > Thanks for the example. But, where can I find such module Serial?! > > -----Original Message----- > From: David Mallwitz [mailto:dmallwitz at cox.rr.com] > Sent: Thursday, December 20, 2001 10:26 PM > To: python-list at python.org > Subject: Re: Comunicating through COM ports > > Comunicating through COM portsChapter 19 of Mark Hammond and Andy > Robinson's > 'Python Programmingon on Win32' covers this quit well, and with the > Activestate Python distro there is a multithreaded demo called > 'win32comport_demo.py'. But here's what I do - example is from a > console > connection to an old Cisco router. > > >>> from Serial import Serial > >>> ### open the COM1 port > >>> serialconfig = Serial.PortDict() > >>> serialconfig['port'] = Serial.COM1 > >>> serialconfig['rxBufSize'] = 4096 > >>> port = Serial.Port(serialconfig) > >>> port.open() > >>> port.write('show conf \r') > >>> x = port.read() > >>> x > 'show conf \r\nUsing 768 out of 32762 bytes\r\n!\r\nversion 11.1\r\nno > > service u > dp-small-servers\r\nno service tcp-small-servers\r\n!\r\nhostname > Router\r\n!\r\ > n!\r\nip subnet-zero\r\nno ip domain-lookup\r\n!\r\nhub ether 0 1\r\n > link-test\ > r\n auto-polarity\r\n!\r\nhub ether 0 2\r\n link-test\r\n > auto-polarity\r\n!\r\n > hub ether 0 3\r\n link-test\r\n auto-polarity\r\n --More-- ' > > Best, > Dave > > "Alves, Carlos Alberto - Coelce" wrote in > message > news:mailman.1008852145.28654.python-list at python.org... > Anybody could give me an example code of how connect/comunicate > through COM > ports (i.e. COM1, COM2). I'm under windows 98. > Thanks!!! > Carlos Alberto > COELCE/DPRON-Departamento de Projetos e Obras Norte > Fone: 677- 2228 > e-mail: calves at coelce.com.br > \|||/ > (o o) > --ooo0-(_)-0ooo-- > > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- > http://www.newsfeeds.com - The #1 Newsgroup Service in the World! > Check out our new Unlimited Server. No Download or Time Limits! > -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- > -- > http://mail.python.org/mailman/listinfo/python-list -- debl -- http://mail.python.org/mailman/listinfo/python-list -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- -- http://mail.python.org/mailman/listinfo/python-list -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- From mac at dgp.toronto.edu Sun Dec 2 16:06:25 2001 From: mac at dgp.toronto.edu (Maciej Kalisiak) Date: Sun, 02 Dec 2001 21:06:25 GMT Subject: inline functions or macros? Message-ID: <87667pz60e.fsf@dgp.toronto.edu> I seem to recall reading that function calls in Python are somewhat expensive. I come from a C++ background, and there this is usually dealt with by defining frequently used small functions as 'inline'. Is there something similar in Python? -- Maciej Kalisiak|mac@] Shaw's Principle: Build a system that even a fool can dgp.toronto.edu|www.] use, and only a fool will want to use it. dgp.toronto.edu/~mac] From greg at cosc.canterbury.ac.nz Sun Dec 16 23:37:17 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Mon, 17 Dec 2001 17:37:17 +1300 Subject: Wrap C function which takes variable lengthed parameters? References: <6p5j1u0oag2ofkam8o7fig5dvkfc2392hk@4ax.com> <3C19990E.BE0F3FA@alcyone.com> <3C19AC0B.7ABD04DF@xs4all.nl> Message-ID: <3C1D767D.7BBE45EC@cosc.canterbury.ac.nz> Just van Rossum wrote: > > But you can't contstruct a va_list and pass it to a _vararg_ function; You can construct a wrapper that will handle up to some maximum number of parameters, by exploiting the fact that a varargs function doesn't care if you pass it more parameters than it's expecting -- it will just ignore the rest. So, you can do e.g. whatever_argtype *a[10]; /* unpack the Python args into a and NULL terminate if needed */ whatever_function(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9]); -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From jason at jorendorff.com Sat Dec 15 00:35:19 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Fri, 14 Dec 2001 23:35:19 -0600 Subject: perl style formating In-Reply-To: Message-ID: > format OUT = > @<<<<<<<<<< >@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >@* > $name, $comment, $line; > . print "%-10s %-30s %s" % (name, comment, line) -- Jason Orendorff http://www.jorendorff.com/ From mwh at python.net Tue Dec 18 13:56:40 2001 From: mwh at python.net (Michael Hudson) Date: Tue, 18 Dec 2001 18:56:40 GMT Subject: dynamic modules References: <9vo01n$9j8$1@news.tpi.pl> <9vo2s4$noo$1@peabody.colorado.edu> Message-ID: Fernando P?rez writes: > Marek Budyn wrote: > > > Hi! > > > > I wanted go create dynamically loaded and removed plugins. I mean, id a > > module a initalizes with 10 MB data structude, i would like to remove it > > from memory if it is not needed eg. > > > > p1 = import plugin1 > > > > ... > > > > unload(p1) > > > > Is it possible in python ? And if so, how can I do this ? > > Thanks for help! > > import plugin1 as p1 > > ... > > del p1 > > > In the next gc pass it should get picked up. This won't work; consider sys.modules. unloading has been a topic of discussion on python-dev in the last few days, but no conclusions have been reached. It's a hard problem. CHeers, M. -- "An infinite number of monkeys at an infinite number of keyboards could produce something like Usenet." "They could do a better job of it." -- the corollaries to Gene Spafford's Axiom #2 of Usenet From store_li at sina.com Sun Dec 2 10:38:48 2001 From: store_li at sina.com (Kick) Date: Sun, 2 Dec 2001 23:38:48 +0800 Subject: Does Tk in Python support drog and drop? References: <9u42cv$649h5$1@ID-12869.news.dfncis.de> <7u55u9.4n4.ln@servant.geotek.co.uk> Message-ID: <9udhvk$7m87r$1@ID-12869.news.dfncis.de> Thank you! "Richard Chamberlain" wrote in message news:7u55u9.4n4.ln at servant.geotek.co.uk... > Look for a file called Tkdnd.py in your distribution. It has a fairly basic > example of how to implement drag and drop. > > Richard > > "Kick" wrote in message > news:9u42cv$649h5$1 at ID-12869.news.dfncis.de... > > Can anyone give some advice? > > > > Thank you! > > > > > > From DeepBleu at DeepBleu.org Thu Dec 27 13:14:19 2001 From: DeepBleu at DeepBleu.org (DeepBleu) Date: Thu, 27 Dec 2001 12:14:19 -0600 Subject: REPOST: Re: A new forum is up! References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B5E9F.FF1C2CC@bellatlantic.net> Message-ID: <9$--$$_----_%_-$_$@news.noc.cabal.int> > Andrew Nguyen wrote: > > > > A new forum for Python is up. It has a better feel to it than this > > forum (in my opinion) It depends on how you view this 'forum.' As far as I am concerned, **nothing** beats NNTP newsgroups viewed in a dedicated NNTP viewer. DeepBleu ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp.gblx.net!news-peer.gip.net!news.gsl.net!gip.net!nntp.kreonet.re.kr!news.kigam.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "DeepBleu" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:02:40 GMT Organization: The World's Usenet -- http://www.Supernews.com Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775682 27193 211.57.49.2 (31 Dec 2001 05:14:42 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:14:42 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From phr-n2001d at nightsong.com Thu Dec 20 01:20:35 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 19 Dec 2001 22:20:35 -0800 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> Message-ID: <7x1yhqbefg.fsf@ruckus.brouhaha.com> Fernando P?rez writes: > All the scripts for which this is an issue are distributed by them, as part > of their own system setup. So they can point every script which explicitly > needs 1.5 to use it. > > They cause their users a fair amount of annoyance and I have yet to > see a solid technical reason to justify it. IMO the annoyance was caused by the needless incompatibility between Python 1.5.x and 2.x.x. The redhat people had a product to ship on a deadline; yes they could have updated all those scripts and QA'd them again, but at the expense of either a schedule slip or resources being directed away from something else. Instead, they stuck with what worked. Maybe they'll update the scripts in a future Redhat release. From ljohnson at resgen.com Tue Dec 11 13:08:11 2001 From: ljohnson at resgen.com (Lyle Johnson) Date: Tue, 11 Dec 2001 12:08:11 -0600 Subject: Hi All References: <3C162B65.27E6B107@hongkong.com> <3C16369B.2010902@home.com> Message-ID: > that's GREAT. You are on the way to destruction. You have no chance to survive make your time. From shalehperry at attbi.com Mon Dec 24 22:54:15 2001 From: shalehperry at attbi.com (Sean 'Shaleh' Perry) Date: Mon, 24 Dec 2001 19:54:15 -0800 (PST) Subject: string compare question.Please Help!!! In-Reply-To: <001f01c18ceb$fdb53900$4301010a@sky> Message-ID: On 25-Dec-2001 ?????? wrote: > I have question about cmp function,follows: > $python > Python 2.2b1 (#1, Nov 21 2001, 10:24:36) > [GCC 2.96 20000731 (Red Hat Linux 7.0)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>cmp('10.66.73.78','10.0.0.0') > 1 >#the result 1 is my desire > > >>>>cmp('10.66.73.78','10.255.255.255') > 1 >#the result isn't my desire,I want to >#make '10.66.73.78' is less than '10.255.255.255', >#I want to get 0,but it return 1 > > Where is my wrong? How to correct it? Thanks. > Edward This is a string compare, so each char is compared to the char in the other string. 10 == 10, so then 66 > 0, 73 > 0, etc. In the second test the opposite is true. What you want to happen will require a special function. One which knows about the rules of IP addresses (which those look like). A simple guess would be split the value on '.', then compare the items as numbers while catching the 255 case. From dcarr1 at hotmail.com Thu Dec 27 07:21:57 2001 From: dcarr1 at hotmail.com (Dudley Carr) Date: 27 Dec 2001 04:21:57 -0800 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <2$--$$_----_%-_$$$@news.noc.cabal.int> First and foremost, the rate at which a language is growing, especially in terms of industry acceptance, is always difficult to tell since rarely is a survey done to find out how many people are using a particular language across all industries. Personally, I use the following metric to see how a language is progressing: 1. Look at the number of Oreilly books (possibly books by other publishers) that have been or are going to be released in relation to the language. 2. Number of articles on programming websites using / explaining the language. 2. Look the support for new technologies in the language and its libraries. 3. Activity in the newsgroup is also very indicative esp. with the number of newbie questions flowing-in (mention in an earlier post). With that said, super-spectacular growth is not always the greatest thing. If we learned anything from the dot-com bust is that growing too fast has its consequences. Python, I believe, prides itself on its evolutionary rather than revolutionary approach to getting things done; and that's exactly how it ought to be (my Darwinian opinion of course). Another issue to address is this business of corporations adopting Python and/or producing Python products. Aside from ActiveState's Visual Python, Zope, Blender, and a handful of other products, people generally have a tough time regurgitating the list of Python products. This is probably due to the fact that Python manages to do so much out of the box, and if it doesn't its not that difficult to get Python to do what you want it to do. Regardless of all of this, it actually doesn't matter that a new Python product isn't introduced on a daily basis. Take C-shell or the Bash shell for example, how many companies are producing products with those languages featuring on the front of the box? Does that mean that C-shell and Bash are not widely used? So where does Python stand in relation to Perl, PHP, Ruby or Javascript in terms of popularity? Who cares?! Python, although not the fastest beast on the block, scratches the itch that none of the other scripting languages seem to be able to do. Oh yeah, and Python is also fun. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: dcarr1 at hotmail.com (Dudley Carr) Newsgroups: comp.lang.python Subject: cmsg cancel <35fda446.0112270421.7082ff87 at posting.google.com> Control: cancel <35fda446.0112270421.7082ff87 at posting.google.com> Date: Mon, 31 Dec 2001 05:10:42 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775807 27193 211.57.49.2 (31 Dec 2001 05:16:47 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:16:47 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From phd at phd.pp.ru Fri Dec 21 05:54:50 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Fri, 21 Dec 2001 13:54:50 +0300 Subject: Tar-like module? In-Reply-To: <20011220212856.A5080@tummy.com>; from jafo@tummy.com on Thu, Dec 20, 2001 at 09:28:56PM -0700 References: <20011221022407.GA22502@home.com> <20011220212856.A5080@tummy.com> Message-ID: <20011221135450.N5332@phd.pp.ru> On Thu, Dec 20, 2001 at 09:28:56PM -0700, Sean Reifschneider wrote: > On Thu, Dec 20, 2001 at 09:24:07PM -0500, Scott Fenton wrote: > >This may be an idiotic question, but is there a module > >to read tar files in python? I googled around and > >couldn't find anything, and the Python Std Library docs > >didn't have anything. Any help would be nice. > > Actually, I think there are a few of them. I can't remember what packages > they're a part of though... Distutils, maybe? I think Zope has such module. > Anyway, pyntar at ftp.tummy.com:/pub/tummy/pyntar/ has the ability to read > tar data including processing the headers. It's not really a complete > setup though. There is also standalone http://www.demonseed.net/~jp/code/tarfile.py. Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From peter at engcorp.com Sat Dec 29 21:57:41 2001 From: peter at engcorp.com (Peter Hansen) Date: Sat, 29 Dec 2001 21:57:41 -0500 Subject: values of sys.platform? for a serial port lib References: <3C2E543D.4BFB07D@engcorp.com> Message-ID: <3C2E82A5.D4E1EEB3@engcorp.com> Chris Liechti wrote: > > Peter Hansen wrote: > > I'd strongly recommend you *not* try to use an > > index origin of 0 but instead pass the open() routine (or > > whatever you have) a *string* naming the serial port. > > i want it to run mainly on win32 and linux. the user of the lib should not > need to care about device names. Very good point. Let me change my recommendation and say don't *prevent* someone from specifying a special-case name for the device. The fact that this matches what you actually did in no way indicates my original comment was wrong or simplistic or any other bad thing. > i also have an optional argument to specify the port string, but when this > is used it isn't portable anymore. Just a thought, but could you make this the same argument as the port number, allowing either an integer or a string? I could also see a benefit, in a cross-platform serial-port app, in having a method to return the actual device name in use, for display/troubleshooting purposes, even if specified as a number. > > By the way, does your win32 implementation work well with > > threads, if one thread is trying to read from the port while > > the other is trying to write to it? > > i haven't tested it that way. i use it in a multi-threaded environment, but > the class that accesses the serial port (and generates binary communication > frames) uses means from the module threading. You may know this already, but in Windows you need to use "overlapped" I/O operations if you want to be able to have a read thread and a write thread waiting independently on operations on the same serial port. Without this, any time one thread is blocked waiting for results for its operation, the other thread will also block when it tries to access the device even if its operation would not otherwise block. (Or something like that... I don't know the full details behind it, only what I learned trying to implement a win32file- based serial port class which didn't have this limitation.) -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From cfelling at iae.nl Wed Dec 5 19:39:38 2001 From: cfelling at iae.nl (Carel Fellinger) Date: 6 Dec 2001 01:39:38 +0100 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BD39F.D43D4FF7@mega-nerd.com> <3c0be454$1@207.229.64.20> <3C0BE5D5.4386B359@mega-nerd.com> Message-ID: <9umeoa$bmu$1@animus.fel.iae.nl> Huaiyu Zhu wrote: > It appears that both sides have already spoken enough and the issue is quite > clear. So I have been wondering why it continues like a religious war. Nice someone still tries to get this discussion to halt:) > It occurred to me that the reason might be that there are two different kinds > of editor behaviors concerning tab, and that users of one kind of editor do > not really understand what the other side is talking about. I'll call these > editor styles the tab-character editor and the tab-display editor. And a nice try, but... ...in the tab-character editor argument > in the particular editor session. The display usually takes the size of a > given number of spaces, but it really behaves like a single character to the > arrow keys, delete and backspace keys and to cut and paste. alas, cut&past on an X display will not see those tabs, but only the spaces used to represent them at the moment:( ...and in the tab-display editor argument > session. For example, the arrow keys will not move over tab as a single > character, and the delete key need to be hit more than once to delete it. fortunately some editors are smart enough to recognize an indentation and allow single delete's to delete one indentation level worth of spaces. And using the cursor keys is frowned upon by those using word or sentence jumping keys:) ... > So I'd suggest the tab advocates to consider the other side's view. What if > their editors never allow this to be a _personal_ preference? What if any it's not only the editor, but actually the whole environment they work in. ...nice scheme's snipped > So my question is this: Is it true that for some people there is never a > choice between all-tab and all-space, only a choice between mix-tab-space > and all-space? yep, for all of us that use X's crippled cut&paste > If this so, whatever the merits of all-tab, the final result of the debate > might just be dictated by the simple fact "scheme A is not available as a > practical choice for some users because of the editors they use". So because of X's limited cut and paste capabilities the whole discussion is over, and we finally agree that tabs are out:) > PS. Space is better for visual formating, such as lining up multiline (), [] > and {}, but these are not syntactical indentation concerning Python. I did > not use tab for the above diagrams as it is visual formating. PS. I once worked on a system where all leading spaces and tabs were replaced by a single byte denoting the total number of leading spaces by the file system it self. Okee, make didn't work there, but apart from that the system was a nice and refreshing experience back then. -- groetjes, carel From pearu at cens.ioc.ee Tue Dec 4 09:16:10 2001 From: pearu at cens.ioc.ee (Pearu Peterson) Date: Tue, 4 Dec 2001 16:16:10 +0200 (EET) Subject: ANN: F2PY - Fortran to Python Interface Generator Message-ID: F2PY - Fortran to Python Interface Generator I am pleased to announce the third public release of f2py (2nd Edition) (version 2.3.328): http://cens.ioc.ee/projects/f2py2e/ f2py is a command line tool for binding Python and Fortran codes. It scans Fortran 77/90/95 codes and generates a Python C/API module that makes it possible to call Fortran subroutines from Python. No Fortran or C expertise is required for using this tool. Features include: *** All basic Fortran types are supported: integer[ | *1 | *2 | *4 | *8 ], logical[ | *1 | *2 | *4 | *8 ], character[ | *(*) | *1 | *2 | *3 | ... ] real[ | *4 | *8 | *16 ], double precision, complex[ | *8 | *16 | *32 ] *** Multi-dimensional arrays of (almost) all basic types. Dimension specifications: | : | * | : *** Supported attributes and statements: intent([ in | inout | out | hide | in,out | inout,out ]) dimension() depend([]) check([]) note() optional, required, external NEW: intent(c), threadsafe, fortranname *** Calling Fortran 77/90/95 subroutines and functions. Also Fortran 90/95 module subroutines are supported. Internal initialization of optional arguments. *** Accessing COMMON blocks from Python. NEW: Accessing Fortran 90/95 module data. *** Call-back functions: calling Python functions from Fortran with very flexible hooks. *** In Python, arguments of the interfaced functions may be of different type - necessary type conversations are done internally in C level. *** Automatically generates documentation (__doc__,LaTeX) for interfaced functions. *** Automatically generates signature files --- user has full control over the interface constructions. Automatically detects the signatures of call-back functions, solves argument dependencies, etc. NEW: * Automatically generates setup_.py for building extension modules using tools from distutils and fortran_support module (from SciPy). *** Automatically generates Makefile for compiling Fortran and C codes and linking them to a shared module. Many compilers are supported: gcc, Compaq Fortran, VAST/f90 Fortran, Absoft F77/F90, MIPSpro 7 Compilers, etc. Platforms: Intel/Alpha Linux, HP-UX, IRIX64. *** Complete User's Guide in various formats (html,ps,pdf,dvi). *** f2py users list is available for support, feedback, etc. NEW: * Installation with distutils. *** And finally, many bugs were fixed. More information about f2py, see http://cens.ioc.ee/projects/f2py2e/ LICENSE: f2py is released under the LGPL. Sincerely, Pearu Peterson December 4, 2001

f2py 2.3.328 - The Fortran to Python Interface Generator (04-Dec-01) From marklists at mceahern.com Thu Dec 20 01:55:08 2001 From: marklists at mceahern.com (Mark McEahern) Date: Wed, 19 Dec 2001 22:55:08 -0800 Subject: But I have no idea on how to modify it :-( In-Reply-To: <9vrjn2$han5h$1@ID-12869.news.dfncis.de> Message-ID: >>> myUnicodeString = u'Foo' >>> type(myUnicodeString) > -----Original Message----- > From: python-list-admin at python.org > [mailto:python-list-admin at python.org]On Behalf Of Kick > Sent: Wednesday, December 19, 2001 6:49 PM > To: python-list at python.org > Subject: But I have no idea on how to modify it :-( > > > Addition question, to change a constant string to Unicode, we can > put a 'u'' > before it, but how can I change or point out that a variable contains a > Unicode string? > > Thanks! > > > -- > http://mail.python.org/mailman/listinfo/python-list > > From peter at engcorp.com Fri Dec 28 11:52:15 2001 From: peter at engcorp.com (Peter Hansen) Date: Fri, 28 Dec 2001 11:52:15 -0500 Subject: REPOST: Re: pth files - can they prepend to sys.path? References: Message-ID: <8$--$$_----_-$--_$@news.noc.cabal.int> Skip Montanaro wrote: > > Is it possible to force a directory mentioned in a .pth file to be inserted > at the beginning of sys.path instead of appended to the end? I guess you could change site.py, but the standard on one my Windows Python 2.2 installation does appends only. -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!zeus.visi.com!news-out.visi.com!hermes.visi.com!newsfeed.berkeley.edu!ucberkeley!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Peter Hansen Newsgroups: comp.lang.python Subject: cmsg cancel <3C2CA33F.20274814 at engcorp.com> Control: cancel <3C2CA33F.20274814 at engcorp.com> Date: Mon, 31 Dec 2001 04:17:36 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775240 27193 211.57.49.2 (31 Dec 2001 05:07:20 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:07:20 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From bill-bell at bill-bell.hamilton.on.ca Fri Dec 14 15:37:43 2001 From: bill-bell at bill-bell.hamilton.on.ca (Bill Bell) Date: 14 Dec 2001 12:37:43 -0800 Subject: COM Registration Attributes References: <3C105C56.7080909@ActiveState.com> Message-ID: <5edaf477.0112141237.3f1471b2@posting.google.com> Mark Hammond wrote, in part: > > Thanks, Gordon. I just prototyped a simple COM that needs to > > declare itself safe for Internet Explorer. Looks like I need to continue > > to do that in the good old-fashioned way, with 'RegOpenKey', etc. > > Would seem more elegant to be able to use '_reg_options_'. > A patch to allow _reg_options_ to do this sort of thing (assuming it did > not break what it does now) would be welcome :) I haven't extended _reg_options_. However, since ATL.Registrar lacks an automation interface I have whipped up a wrapper that provides access to two of Registrar's methods. The following fragment is a typical usage: UseCommandLine ( WebPASSCOMServer ) from win32com.client import Dispatch from sys import argv registrar = Dispatch ( 'RegistrarCOMWrapper.Register' ) regString = \ ''' HKCR { NoRemove 'CLSID' { ForceRemove '{D471BE26-C3C8-4773-B438-041BA612C563}' { 'Implemented Categories' { '{7DD95801-9882-11CF-9FA9-00AA006C42C4}' '{7DD95802-9882-11CF-9FA9-00AA006C42C4}' } } } NoRemove 'Component Categories' { NoRemove '{7DD95801-9882-11CF-9FA9-00AA006C42C4}' NoRemove '{7DD95802-9882-11CF-9FA9-00AA006C42C4}' } } ''' // following lines parallel the way 'UseCommandLine' works if '--unregister' in argv: registrar . StringUnregister ( regString ) else: registrar . StringRegister ( regString ) To me, the nice thing about this approach is that it involves the use of the '.rgs' scripts that are familiar to people who work with MSVC. I have done only very limited trials, on Win2K at that. Would welcome comment, including a suggestion of where I might put this ugly thing in case someone else might consider using it. BIll From DeepBlue at DeepBlue.org Fri Dec 14 11:11:25 2001 From: DeepBlue at DeepBlue.org (DeepBlue) Date: Fri, 14 Dec 2001 10:11:25 -0600 Subject: which book? References: <9vd6n0$ha8$1@mozo.cc.purdue.edu> Message-ID: There are two books to be published on Python and the web, and one to be published on Python and XML in addition to one that is already published. DeepBlue "Oleksandr Moskalenko" wrote in message news:9vd6n0$ha8$1 at mozo.cc.purdue.edu... > On Fri, 14 Dec 2001, DeepBlue unleashed unto the World: > > Learning Python by Lutz and Ascher and > > Python Essential Reference 2nd Ed by Beazley > > > > At a more later stage: > > Programming Python 2nd Edition by Lutz > > > > For web application and Python, check amazon.com or bn.com and search for > > Python. > > DeepBlue > > And such a search would come up with the following PUBLISHED books: > 1) An impossible to find book by Guido van Rossum and > 2) "Web Programming in Python: Techniques for Integrating Linux, Apache and > MySQL", which doesn't have a single review and a bunch of them are > already sold used. I would be very cautious with a book like that. > > I couldn't find any other published book on the web programming with Python > subject unfortunately. > > Alex. > From Ax10 at gmx.de Wed Dec 19 16:05:32 2001 From: Ax10 at gmx.de (Mike Abel) Date: Wed, 19 Dec 2001 16:05:32 -0500 Subject: implementing a timer? References: <9vn0gv$ll6$1@colo.mobo-it.nl> Message-ID: Marco Stagno wrote: >>I'm trying to make a script that will check if i have mail every let's say >>10 minutes.So i tought let's use something like a timer. But i can't find >>any documentation on how to implement something like this. > > if you are looking for something else than time.sleep (that block your > program) you can build a class and use a "timer object". > I did it, if you are interested in, I can send you the code. > > bye bye > > MAS! > I'm interested to see your code. Bye Mike -- http://www.mabelsoft.de From phd at phd.pp.ru Fri Dec 21 08:00:51 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Fri, 21 Dec 2001 16:00:51 +0300 Subject: python threads In-Reply-To: <96c7f32.0112210450.174f6914@posting.google.com>; from curt@journyx.com on Fri, Dec 21, 2001 at 04:50:58AM -0800 References: <96c7f32.0112210450.174f6914@posting.google.com> Message-ID: <20011221160051.X5332@phd.pp.ru> On Fri, Dec 21, 2001 at 04:50:58AM -0800, curt finch wrote: > My understanding is that python's current threads implementation > does not really allow for this in the sense that only one thread > can be running at a time, regardless of the number of chips on > the machine, and additionally that the threads cannot really > interrupt each other and still maintain correct state. > > Is that all correct? Yes. Global Interpreter Lock. > If it is correct, it would help the scalability with regards to thruput > of our app to get this fixed and we'd be willing to help with both > the coding, the testing, and the cost of getting this accomplished. > > Who would be the right people to talk to about this? Core developers, of course. Python-Dev mailing list - closed list where developers discuss things: http://mail.python.org/mailman/listinfo/python-dev Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From jyrinxatmindspringdotcom Mon Dec 3 03:40:36 2001 From: jyrinxatmindspringdotcom (Jyrinx) Date: Mon, 3 Dec 2001 00:40:36 -0800 Subject: Python evangelists unite! References: <9u77i8$a5j$1@slb0.atl.mindspring.net> <91acf731.0111301017.31cd71a5@posting.google.com> Message-ID: <9ufdth$155$1@slb5.atl.mindspring.net> > For example, I'm writing a Ruby binding to the Object-Oriented > database GOODS. Some objects are persistent, some are transient. You > don't know at "compile time" which are which, so it's very nice for my > binding to be able to add persistence support methods at run-time only > to those objects that will be stored in the database. Without Ruby's > support for adding these methods to individual objects, I'd have to > modify the class, which would mean adding all this persistence-related > stuff to transient objects. Ruby allows a much cleaner solution: add > the persistence support methods only to those objects that need them. Under the basic premises of OO, shouldn't you just have a base class with derived classes "persistent" and "transient," or some such? I'd think this would make clearer your intent for the uses of the objects. Jyrinx jyrinx at mindspring dot com From gh_pythonlist at gmx.de Tue Dec 4 00:52:14 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Tue, 4 Dec 2001 06:52:14 +0100 Subject: Download file from web site In-Reply-To: <20011204050314.21892.qmail@email.com> References: <20011204050314.21892.qmail@email.com> Message-ID: <20011204055213.GA9936@lilith.hqd-internal> On Mon, Dec 03, 2001 at 10:03:13PM -0700, Thomas Pham wrote: > Hi group, > > I am trying to download a file from a website. My source code is > listed below. But I can only get to its first page. I could not > go further to its second page. The second page "idm_download" > however, does require an user ID & password to open it. I'd try my luck with urllib2. The module documentation contains an example for using HTTP digest authentication. Oups. That's obviously one of those horrible underdocumented modules in the Python standard library. And looks a little bit overdesigned, too. Argh! Let's try good 'ole urllib instead. Here's an example that works for a page needing authentication: import urllib class MyOpener(urllib.FancyURLopener): def prompt_user_passwd(self, host, realm): # unconditionally return the correct username, password tuple return ("ghaering", "mysuperduperpassword") opener = MyOpener() print opener.open("http://www.dmoz.org/editors").read() Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From aahz at panix.com Thu Dec 27 13:53:53 2001 From: aahz at panix.com (Aahz Maruch) Date: 27 Dec 2001 10:53:53 -0800 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: In article , phil hunt wrote: > >Python runs quickly on my 300 MHz box, which is 3 times slower >than the slowest PC you can buy today. It can only get more popular. MHz != speed -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 4 days and counting From syver-en+usenet at online.no Sat Dec 8 20:59:17 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 09 Dec 2001 02:59:17 +0100 Subject: py2exe question Message-ID: At first py2exe seems to work very nicely on a couple of test projects I've run it on. Thanks, and I particularely like that it integrates with the distutils which also are cool. Now all we lack is a kind of cpan that have ALL the modules and the newest ones at that. ActiveStates PPM is nice but the modules there are too few and many are old. My question on py2exe is: Is it possible to make an exe that searches the normal sys.path for modules that doesn't exist in the exefile itself? When I create a barebones py2exe exe by --excluding all modules I get import error because py2exe overrides the import mechanism in python to only search in the py2exe file itself, at least that's how I have understood it. Does anybody have any tips for accomlishing this? -- Vennlig hilsen Syver Enstad From db3l at fitlinxx.com Fri Dec 7 22:31:24 2001 From: db3l at fitlinxx.com (David Bolen) Date: 07 Dec 2001 22:31:24 -0500 Subject: Win32all documentation? References: Message-ID: David Brady writes: > Phew. I know it's a long list, but I'm hoping that > there's a bunch of documentation out there that I just > don't know how to find. All I really need is maybe > some pointers to urls or MSDN locations... (...) > For the Windows-specific portions of my > query, I have scoured MSDN as well. Connecting to > WSH, for example, is explained, but no documentation > seems extant for *USING* it once you've connected. > Any help would be greatly appreciated. (Can there be anything but "Windows-specific" portions of this query given that we're talking about win32all? :-)) MSDN is really the right place. The win32all modules are just thin wrappers over the Win32 API functions, and while the documentation included with the package covers some of the Python-specific quirks, the actual API documentation would definitely be MSDN. MSDN has the raw API documentation, but also provides an archive of articles, guides and other usage documentation, often including examples and what not. You say you've "scoured" MSDN, but MSDN is *huge* - have you been searching for stuff, perusing topics by following a hierarchy or what? http://msdn.microsoft.com is the main entry point, but I expect that much of the information you want is in the library under http://msdn.microsoft.com/library. I'm not a huge WSH user, but searching for "WSH" in the library brings up pointers to several articles, including one on "basics" and the general WSH section of the library (also available at http://msdn.microsoft.com/scripting). It's hard to answer a "using it" question with respect to WSH without knowing what you are trying to use it for. Windows Scripting is a general framework supporting any number of scripting languages. The Windows Scripting Host (WSH) is a specific environment hosting a language (e.g., "wscript" or "cscript" from the command line, or IIS for ASP pages). Using it means executing scripts within a hosting environment using a particular back-end language engine, and can bring in other topics (depending on what the script needs to do) such as COM and COM object models provided by the scripting host. But using it can also be as simple as writing a script and executing it with "wscript". Perhaps if you suggested some specific questions you may have in terms of trying to interact with the API (or WSH, or whatever), we'd be able to be more specific with pointers to information. -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l at fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/ From shalehperry at attbi.com Thu Dec 13 11:58:06 2001 From: shalehperry at attbi.com (Sean 'Shaleh' Perry) Date: Thu, 13 Dec 2001 08:58:06 -0800 (PST) Subject: Sorting things into bins In-Reply-To: <20011213164823822.AAA294@mail.climatedata.com@SUEW2000> Message-ID: On 13-Dec-2001 Sue Giller wrote: > Jason, > > While I was hoping to not have to iterate thru the list, this recipe is > fine for my needs. I also learned about the .setdefault method - > thanks! > def sorter(bins, item): bin = item[-2:] bins.setdefault(bin, []).append(item) mylist = ['0102', '0302', '1242'] mybins = {} map(lambda x: sorter(mybins, x), mylist) print mybins From walterm at cmat.edu.uy Fri Dec 14 09:53:18 2001 From: walterm at cmat.edu.uy (Walter Moreira) Date: 14 Dec 2001 06:53:18 -0800 Subject: Python CPAN beta test References: Message-ID: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) wrote in message news:... > Basically, if you would like to beta test ciphon you can get the > latest release by anonymous ftp from ftp.community.tummy.com (thanks > to Sean Reifschneider) in /pub/python-packages. If there are any modules > you would like to get into the repository then email me a link to the > module's homepage and I'll try to add it to the repository. Great! Thanks a lot, Suchandra. I downloaded ciphon 0.3.1 and when executed with ./ciphon.py I get the exception: hedwig:/usr/local/src/ciphon-0.3.1$ ./ciphon.py Use rpms for installation [N/y]? Update package and server list on startup [Y/n]? Force updates[N/y]? Traceback (most recent call last): File "./ciphon.py", line 118, in ? if config.getConfig().getParameter('autoupdate') == 'true': File "./config.py", line 266, in getConfig config = Configuration() File "./config.py", line 85, in __init__ serverParser) File "/usr/local/lib/python2.1/xml/sax/__init__.py", line 30, in parse parser = make_parser() File "/usr/local/lib/python2.1/xml/sax/__init__.py", line 88, in make_parser raise SAXReaderNotAvailable("No parsers found", None) xml.sax._exceptions.SAXReaderNotAvailable: No parsers found When I call the function xml.sax.make_parser() the same exception is raised. Is there something missing in my installation? Thanks again and keep the good work: Walter From martin.franklin at westgeo.com Thu Dec 13 11:06:17 2001 From: martin.franklin at westgeo.com (Martin Franklin) Date: Thu, 13 Dec 2001 16:06:17 +0000 Subject: ftpwalf function Message-ID: <9vajkq$7kk$1@mail1.wg.waii.com> Hi, Just came up with this function, don't know where else to put it so ...... def ftpwalk(ftp, top, func, arg): ''' ftpwalk just like os.path.walk functions... first argumant is the ftp object, second and subsequent are same as os.path.walk ''' try: ftp.cwd(top) except: return # not a directory?? this must be the end..... names=ftp.nlst(top) func(arg, top, names) for name in names: name = os.path.join(top, name) try: ftp.cwd(name) except: continue ftpwalk(ftp, name, func, arg) Martin From info at newyears.com Fri Dec 7 11:17:22 2001 From: info at newyears.com (NewYears.com) Date: Fri, 07 Dec 2001 11:17:22 -0500 Subject: Newyears.com Newsletter Message-ID: This is a HTML mail -------------- next part -------------- An HTML attachment was scrubbed... URL: From joshyotty at hotmail.com Sat Dec 15 01:45:39 2001 From: joshyotty at hotmail.com (Josh Yotty) Date: 14 Dec 2001 22:45:39 -0800 Subject: Why is Complex number notation the way it is? Message-ID: <23302360.0112142245.59089e4f@posting.google.com> I've been coding Python for about a day now, and I can't 'see' why a complex number like 2+3i is represented as 2+3j in Python. Well, um, why? From jason at jorendorff.com Mon Dec 31 17:15:12 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Mon, 31 Dec 2001 16:15:12 -0600 Subject: Basic threading questions In-Reply-To: Message-ID: John Lull wrote: > I would assume that all built-in functions, and all methods of > all built-in types, are implemented as C functions rather than > compiling to sequences of interpreter byte-codes. Pretty much, yes. > They should therefore be effectively atomic if they don't use > blocking system services. Is that a good assumption? Yes, mostly. One exception: Quite apart "blocking system services", a function that performs long-running number-crunching might render itself non-atomic, to give other threads a chance to run. (I don't think there are any examples of this in the standard library.) > Which built-in operations are blocking should be pretty obvious > from either the documentation or the basic nature of the operation. Correct. > Are there any non-obvious blocking built-in operations? None that I can think of. ## Jason Orendorff http://www.jorendorff.com/ From zhangsc at neusoft.com Mon Dec 24 21:29:30 2001 From: zhangsc at neusoft.com (=?gb2312?B?1cXJ2bPb?=) Date: Tue, 25 Dec 2001 10:29:30 +0800 Subject: string compare question.Please Help!!! Message-ID: <001f01c18ceb$fdb53900$4301010a@sky> I have question about cmp function,follows: $python Python 2.2b1 (#1, Nov 21 2001, 10:24:36) [GCC 2.96 20000731 (Red Hat Linux 7.0)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>cmp('10.66.73.78','10.0.0.0') 1 #the result 1 is my desire >>>cmp('10.66.73.78','10.255.255.255') 1 #the result isn't my desire,I want to #make '10.66.73.78' is less than '10.255.255.255', #I want to get 0,but it return 1 Where is my wrong? How to correct it? Thanks. Edward -------------- next part -------------- An HTML attachment was scrubbed... URL: From laz at strakt.com Wed Dec 12 04:14:04 2001 From: laz at strakt.com (Fredrik Juhlin) Date: Wed, 12 Dec 2001 10:14:04 +0100 Subject: Problems with Tkinter and menus Message-ID: <01121210140401.19631@Raven> Hello, I'm trying to make cascading popup menus work in Tkinter. Unfortunately, I'm having little success. The problem is that the commands under the second-level menus won't run when clicked on. Actually, it seems like they are not responding to the mouse at all, since hovering on a menu-item doesn't "mark" it. I've submitted test code to show the problem. Any help on this would be greatly appreciated! /FJ # Code to show problem with cascading menus import Tkinter def hello(): print "hello!" root = Tkinter.Tk() menu1 = Tkinter.Menu(root, tearoff=0) menu1.add_command(label="Foo", command=hello) menu1.add_command(label="Bar", command=hello) menu0 = Tkinter.Menu(root, tearoff=0) menu0.add_command(label="Command 1", command=hello) #This works menu0.add_cascade(label="Menu 1", menu=menu1) #Commands used in this menu #won't work frame = Tkinter.Frame(root, width=200, height=200) frame.pack() def showMenu(event): menu0.post(event.x_root, event.y_root) frame.bind("", showMenu) Tkinter.mainloop() From kwg at renre-europe.com Fri Dec 7 12:11:07 2001 From: kwg at renre-europe.com (Ken Guest) Date: 07 Dec 2001 17:11:07 +0000 Subject: COM with Python. In-Reply-To: <1007741936.1170.17.camel@lewis> References: <1007741936.1170.17.camel@lewis> Message-ID: <1007745072.1170.20.camel@lewis> On Fri, 2001-12-07 at 16:18, Ken Guest wrote: > I'm new to coding com objects in Python and am trying to figure out why > I keep getting a Run Time error 429 (ActiveX component can't create > Object) raised by VB's CreateObject function. > Everything seems to register ok (as far as registering as a COM server > anyways). But I keep getting either that error, or python import related > errors. > > I've tried using SimpleCOMServer.py from chapter 5 of the "Programming > on Win32" book and attempting to create a PythonUtilities object and > that worked fine. > > could somebody please help me on this one? thanks. stupid PYTHONPATH wasn't being set in the right place. k. From andreas at mtg.co.at Mon Dec 3 06:02:07 2001 From: andreas at mtg.co.at (Andreas Kostyrka) Date: Mon, 3 Dec 2001 12:02:07 +0100 Subject: Copy operator (was list.remove for Noivces) In-Reply-To: <001001c17a0b$8a1d75e0$a9e1fea9@carol> References: <001001c17a0b$8a1d75e0$a9e1fea9@carol> Message-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am Samstag, 1. Dezember 2001 02:57 schrieb Arthur Siegel: > How far over my head am I getting by arguing with you here. I see *no* > similarity between the kind of functionality sys brings in to that of Well, the comparision is quite valid, as sys provides rather trivial things like script arguments, stdin, stdout, stderr, (well we Unixheads consider that stuff important), and exit() which one needs quite often. > copy. Copy just operates - and only on objects that are. Sys provides > functionality and information, that among other things, is platform > and version specific. I feel better when someone clearly needs to > stretch to this extent to defeat a point I am trying to make. > I take it as a no, I am not totally off-base. In a theoretic way perhaps. On a pragmatic level you are totally off-base ;) > And perhaps also in the process you have gotten far out of touch with the > process of learning one's *first* language. Might be. Python is pragmatic language. I'm not yet in the teaching business, so I haven't considered if Python is a good first language. > >Think again: You are talking about the copy module that in the current > > code base is rather seldom used. Why should a function that is that > > seldom used be > >moved to __builtin__? > > > > > > What is the downside of copy and deepcopy as built_ins. Unnecessary > > performance hits in the majority of mods which don't need it, I expect. > > > >>Nope. Namespace pollution. Actually, there is already more than enough > > baggage > >in __builtin__ that nowadays wouldn't be needed there. > >>And the need to be backwards compatible for the next decades. > > Namespace pollution? I assume you mean you might want to use "copy", > and its been taken. Not sure that in itself is a big thing. I do assume > that back compatible issues - there could be a lot of custom defined > copy def and classes out there - could be a *big* issue. Nope. I mean namespace polution. Your above problem is not relevant in Python as one can rename all builtin names. Python 2.2b1 (#4, Nov 13 2001, 19:26:16) [GCC 2.95.3 20010315 (SuSE)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> None=3 >>> print None 3 Actually, if you like it your way, you can add this to lines to your site.py: import copy,__builtin__ __builtin__.copy=copy.copy Afterwards your python will have a copy function without needing import copy. Andreas - -- Andreas Kostyrka; Raiffeisenstr. 16/9; 2320 Zw?lfaxing Tel: +43/676/4091256; Fax: +43/1/7065299 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8C1uyHJdudm4KnO0RAr9bAJ9qTiVwopfWVwpiwuaVfk2yyqIerACgmdz9 eGtxz5jluYAC6eg273gVRdE= =kZpZ -----END PGP SIGNATURE----- From tim at vegeta.ath.cx Sun Dec 16 10:49:37 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Sun, 16 Dec 2001 15:49:37 GMT Subject: Idiomatic portable way to strip line endings? References: <9viekc$fkp74$1@ID-11957.news.dfncis.de> Message-ID: Emile van Sebille graced us by uttering: > > "Tim Hammerquist" wrote in message > news:slrna1pbik.6jf.tim at vegeta.ath.cx... >> I've been trying to figure out the canonical way to strip the line >> endings from a text file. >> >> In general, I can use: >> >> line = line[:-1] >> or >> del line[-1:] >> >> to strip the last character off the line, but this only works on >> operating systems that have a one-byte line separator like Unix/Linux >> ('\n'). The Win32 line separator is 2-bytes ('\r\n'), so this >> solution is not portable. > > How about: > > line.endswith(os.linesep) What about it? I used it in code in the original post. I know it exists and is my preferred method of _detecting_if_ a line ends in the designated linesep for the host OS. However, the rest of my original post raises questions regarding actually _stripping_ the linesep. Tim Hammerquist -- "This is your life ... and it's ending on minute at a time." -- Jack, "Fight Club" From joonas at olen.to Fri Dec 28 17:43:16 2001 From: joonas at olen.to (Joonas Paalasmaa) Date: 28 Dec 2001 14:43:16 -0800 Subject: REPOST: Re: Finding out that Python is in interactive mode in sitecustomize.py References: <3C2B8F47.4CEACF6E@olen.to> <87g05wgq84.fsf@psyche.dnsalias.org> Message-ID: <3$--$$_----__-_-%$@news.noc.cabal.int> Carey Evans wrote in message news:<87g05wgq84.fsf at psyche.dnsalias.org>... > Joonas Paalasmaa writes: > > > How can I find out that Python is started in interactive mode in > > sitecustomize.py ? > > A search on http://groups.google.com/ for "python test interactive" > comes up with this as the second result: > > import sys > if hasattr(sys, "ps1"): > # probably interactive > else: > # probably not interactive For some reason it doesn't work in sitecustomize.py . When these lines are to sitecustomize.py and Python is started in interactive mode, Python prints "In non-interactive mode". # the lines import sys if hasattr(sys, "ps1"): print "In interactive mode" else: print "In non-interactive mode" ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: joonas at olen.to (Joonas Paalasmaa) Newsgroups: comp.lang.python Subject: cmsg cancel <11aed8f9.0112281443.afbc668 at posting.google.com> Control: cancel <11aed8f9.0112281443.afbc668 at posting.google.com> Date: Mon, 31 Dec 2001 03:18:31 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775001 27193 211.57.49.2 (31 Dec 2001 05:03:21 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:03:21 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From dlrubinUN-SPAM at yahoo.com Wed Dec 19 11:57:22 2001 From: dlrubinUN-SPAM at yahoo.com (Daniel) Date: Wed, 19 Dec 2001 08:57:22 -0800 Subject: How to import modules in cgi applications? Message-ID: <3C20C6F2.7CE2A7B3@yahoo.com> Hi, I'm writing a cgi script that uses a package I installed into Python called DCOralce2. My cgi script (test.py) causes an internal server error if it's run from a web browser, but not if I run it from the command line--the problem must be finding the module when the python script is run from the web client. I tried writing a shell script to set PYTHONPATH and then calling my cgi: #!/bin/sh PYTHONPATH="/home/rb/lib/pylib" export PYTHONPATH ./test.py where the PYTHONPATH is the path to where DCOralce2 lives, and it's the same as the one used in my environment. But this still doesn't work. Any suggestions? Thanks, Daniel -- To reply to me directly, please remove "UNSPAM" from my email address From henrik at moskau.hmotakef.homeip.net Wed Dec 19 16:21:51 2001 From: henrik at moskau.hmotakef.homeip.net (Henrik Motakef) Date: 19 Dec 2001 21:21:51 +0000 Subject: if __name__ == "__main__" References: <5a4226f0.0112171509.30e46e05@posting.google.com> <3C2118B7.AB0D3F9B@cosc.canterbury.ac.nz> Message-ID: <87lmfyucr4.fsf@moskau.hmotakef.homeip.net> Greg Ewing writes: > > (hmmm... what will it be, never thought about it?). > The name of the module! BTW: Python 2.1.1 (#1, Dec 3 2001, 18:53:22) [GCC 2.95.3 20010125 (prerelease)] on openbsd3 Type "copyright", "credits" or "license" for more information. >>> import sys >>> sys.__name__ 'sys' >>> import sys as foo >>> foo.__name__ 'sys' Why isn't foo.__name__ not 'foo', exactly? Regards, Henrik Motakef From mwh at python.net Sat Dec 29 17:12:13 2001 From: mwh at python.net (Michael Hudson) Date: Sat, 29 Dec 2001 22:12:13 GMT Subject: Is learning Python "extraordinary"? References: Message-ID: "Jesse F. W" writes: > I am a high school senior, and like many others, I am applying > to college. I am applying to MIT (as well as many other schools). > MIT describes what they are looking for as students who do or have > done "extraordinary things". My question is this, Is teaching > myself Python (with the aid of the Python tutorials and some help > from the various lists) an "extraordinary thing"? How many > python-list'ers are high school students? Dunno about Python specifically, but I'd hope that a willingness to learn new languages would help your cause. I bet most CS admission tutors fall off their chairs when an applicant has heard of a language that isn't C++, Java or VB. I'm not an admission tutor, though, so I may be unnecessarily pessimistic. Also I'd imagine that learning a little lisp is unlikely to hurt an application to MIT... Cheers, M. From jdhunter at nitace.bsd.uchicago.edu Tue Dec 4 10:39:44 2001 From: jdhunter at nitace.bsd.uchicago.edu (John Hunter) Date: Tue, 04 Dec 2001 09:39:44 -0600 Subject: httplib slow read Message-ID: I am using httplib to make GET requests. I save the results in a file with of = open(fname, 'w') f = h.getfile() data = f.read() print 'Writing %s' % fname of.write( data ) where h is the httplib object. The problem is that the read command is slow; much slower than if I make the same request via my browser. Is there a faster way to transfer the data into a file? Thanks, John Hunter From mjais at web.de Thu Dec 13 10:38:05 2001 From: mjais at web.de (Markus Jais) Date: Thu, 13 Dec 2001 16:38:05 +0100 Subject: python and SOAP?? References: Message-ID: On Thu, 13 Dec 2001 16:31:34 +0100, Cameron Laird wrote: > http://www.onlamp.com/pub/a/python/2001/06/14/pysoap.html thanks for the URL. was very helpful. markus From rpm1deletethis at frontiernet.net Fri Dec 28 07:11:06 2001 From: rpm1deletethis at frontiernet.net (Patrick) Date: Fri, 28 Dec 2001 07:11:06 -0500 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: Alex Martelli wrote in message news:a0hi10$o40$1 at serv1.iunet.it... > "RPM1" wrote in message > news:u2nk47nvtu000c at corp.supernews.com... > ... > > "full technical support" > Firms like ActiveState (www.activestate.com) will typically be > overjoyed to sell you "full technical support" for Python on > the platforms they support. See, for example: > http://www.activestate.com/Products/Enterprise_Solutions/Python.plex > for quite a few commercial offerings by ActiveState of Python > *Support* products/services, specifically. I'm sure many other > purveyors of such products and services exist, and I hope relevant > URL's will be posted on this thread. > > When you can get somebody to put this sort of thing in writing, > or say it in front of enough witnesses that they can't later > easily backtrack -- so that they've basically admitted that > if "there's support" then they HAVE to look at Python in depth -- > you may then follow up by contacting the *SALES* organizations > of such suppliers as ActiveState. Forget marketing: you need > hungry, aggressive *SALESPEOPLE* to ram change down the throat > of some organization that's clutching at straws to resist change. > I'll keep this in mind. > > > "customers won't pay for something made with freeware." > > I wear Mephisto shoes, but I'm not going to claim that "customers > won't pay for software developed by somebody wearing Nike shoes". > > As a non-sequitur, though, it's roughly on a par with this quote. > > How will the customers know, and why should they care, what > brand of shoes (if any) the developers choose to wear? > > How will the customers know, and why should they care, if (e.g) > your C++ sources were finally compiled/linked with free products > such as gcc, or for-pay ones such as commercial compilers? The > same, obviously, goes for Python -- how will the customers know, > and why should they care, what kind of support contract YOU have > with ActiveState or other suppliers, if any? > They DO ask what compilers and linkers we use! They even make suggestions! We make very customized software. Some customers write parts of their own code through 'user exits'. From philh at comuno.freeserve.co.uk Mon Dec 3 13:20:18 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Mon, 3 Dec 2001 18:20:18 +0000 Subject: a comment about PEPs References: <9uetv2$vtn$1@slb6.atl.mindspring.net> Message-ID: On Sun, 2 Dec 2001 21:01:50 -0700, Andrew Dalke wrote: >phil hunt: >>Whenever I have a peek at c.l.p, there are usually several threads going >>suggesting improvements to the langauge. >> >>Why is this? > >Here's a few I've seen. > > - Python isn't perfect True, butr it's better than most >(type/class dichotomy, rich comparisons) > > - There are bugs in the C implementation (xrange, list.append) Bugs need to be fixed. PEPs aren't necessary to do this. > - Some other languages have neat features which people miss when > they switch to Python (nested static scopes, lazy iterators) What's the benefit of nested static scopes? As to lazy iterators, can't python do this already? Or does "lazy iterator" mean something I don't know of. > - People don't know the history of a thread, and keep reviving it > OVER AND OVER AND OVER AND OVER (eg, using something other than > indentation for scope) True. > - Some think that needs of a small domain are needs of a general > programming language (switch statements are useful for state > machines, but are they useful for Python?; if cgi.py is imported > then the traceback display hook should display output to HTML) My understandin is that ouytput goes to stdout or stderr, both of which can be redirected by the programmer. It therefore doesn't need a change to the langauge to make cgi.py output error messages to the HTML page being rendered. > - Others don't realize a specific need can be done in other ways > (Java-style interfaces) Just use classes. > - With extra hints provided by the language, different > implementations could work better (explicit type declarations > can help a hypothetical Python compiler produce machine code) True, but a better solution might be to have an interpreter that remembers what actual classes are used when a function is called, and passes that information to a Self-like compiler which uses it for optimisation. -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From igorr at ifi.uio.no Fri Dec 28 00:52:16 2001 From: igorr at ifi.uio.no (Igor V. Rafienko) Date: 28 Dec 2001 06:52:16 +0100 Subject: REPOST: Re: try-except-finally question References: Message-ID: <4$--$$_---$$%$%%%$@news.noc.cabal.int> [ Aahz Maruch ] [ Thanks to everyone who answered ] [ snip ] > > except DBError: > > > except: > > raise Jupp, that is what I was looking for. [ snip ] > Note the addition of "except:" above. You need the "raise" to make > sure the error gets re-raised (you *want* to abort if the user hits > ^C). Hmm... that didn't occur me. Thank you for the tip. ivr -- Partial Nudity is allowed by female users. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail Message-ID: Control: cancel Subject: cmsg cancel From: igorr at ifi.uio.no (Igor V. Rafienko) Newsgroups: comp.lang.python X-No-Archive: yes Lines: 2 NNTP-Posting-Host: wonenara.ozemail.com.au X-Trace: ozemail.com.au 1009643108 203.108.164.177 (Sun, 30 Dec 2001 03:25:08 EST) NNTP-Posting-Date: Sun, 30 Dec 2001 03:25:08 EST Organization: OzEmail Ltd, Australia Distribution: world Date: Sat, 29 Dec 2001 15:48:36 GMT This message was cancelled from within Mozilla. From rdsteph at earthlink.net Sat Dec 29 01:24:44 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sat, 29 Dec 2001 06:24:44 GMT Subject: REPOST: PythonCard, ease of use, and the GUI problem/opportunity/niche References: <3C2A9D33.67FEC261@earthlink.net> <458b194a.0112282052.1123341@posting.google.com> Message-ID: <3$--$$_----_-%$_$$@news.noc.cabal.int> Bingo! Boy, oh, boy, do I agree with you on this. I think you hit the nail right on the head. Building a gui now using Python, compared to using VB, really sucks. Yes, it's that bad. Whichever reasonably easy to use language (right now I'm thinking either Python, Ruby, or a yet-to-be created language) first gets an open source gui builder built on top of it that is as easy to learn and use as VB will dominate the world. It must, in my opinion, be as easy to use as VB for building simple input and output forms. That's the key. It doesn't have to be any more powerful or anything else. Just easy. This is a crying out loud need that anyone can see; someone will solve it, I am sure. It's too big an opportunityto be forever ignored. Unfortunately, I am beginning to hae my doubts that it will be a Python-based solution. I sure hope I'm wrong. The only hope that I know of right now is PythonCard, only a six month old project led by Kevin Altis. I really admire Kevin and his team and I admire this project. I think they are ace coders (especially Kevin ) who are capable of doing what needs getting done. But I am afraid they will miss the mark, partly for the same reason as Zope has its detractors, namely, lack of good, easy to use documentation for learning and using the language. Now, I know it's not fair to compare Pythoncard to Zope, as PythonCard is only six months old and pre-alpha, for heavens sake ;-))) But when you love something, .. I am really like a cranky old uncle that only dotes from afar on a precocious child. I have nothing to do with PythonCard, have contributed nothing, etc. But I admire it from afar like a doting uncle. But I haven't tried to use PythonCard in many weeks, a fact I hope to remedy this weekend. But I stopped trying because, while I could see the brilliance of design and implementation, and potential for ease of use, I couldn't get much farther due to lack of documentation. What's a resource file anyway? What's an application framework? Yes I'm a clueless newbie, but that's what the winner in this battle must do, create something as easy to learn and use as VB is for a clueless newbie. For now, unfortunately, I find it easier to use Tkinter because I have tutorials, online documentation, and even books. PythonCard actuall seems harder to me as it stands. Maybe some of us could actually *help* create some documentation for PythonCard???? It's home page is at SourceForge at http://pythoncard.sourceforge.net/ So go check it out. I really believe this is important. I'm going to try to use it this weekend. Lets discuss it, then, OK????? Ron Stephens http://www.awaretek.com/plf.html Rest Cent wrote: > The real source of growth for both Python and Ruby are the 3M VB > developers worldwide. Whichever can provide what it is that VB > developers like about VB on top of what Python and Ruby natively offer > will hit the jackpot. To me these are: (a) Visual drag-and-drop > application builder with data aware controls, and (b) good support for > the big databases (Oracle, Sybase, Informix). I'm going through the > gui chapters of Mark Lutz' PP2E, and while I can see that handcrafting > gui this way gives me a lot of control, I'm thinking I don't want to > do this -- I'm a database application developer. I want to write a > dynamic work order system and I have no ambition to become a system > tool maker. And so do the 3M VB developers. > > VB used to be a toy language. Not too long ago no respectable company > would use VB for their corporate systems. It did not start to become > an enterprise solution until VB3. What happened there? > > VB 6 will be retired in favor of VB.NET. Personally I think that the > direction VB has taken, towards a verbose C#, is misguided. VB should > have evolved into something like Python or Ruby. With VB.NET, VB > programmers will ask, "What's the point?" Might as well dive into C#. > Or look around for something else. > > Hopefully by that time -- 18 months from now? -- Python and/or Ruby > will have what it is VB programmers cannot live without. > > Folks, come up with (a) and (b) above, then start posting at c.l.vb. > > > Paul Prescod wrote in message news:... > > Dave Thomas wrote: > > > > > > ... Instead, Ruby will attract folks from outside the > > > Python world. Ruby and Python differ in philosophy and _feel_. Some > > > folks like one, some the other. I don't see it as competition. I see > > > it as choice. > > > > Is there really a difference? Pepsi and Coke are choices. They are also > > in competition. They have a somewhat different taste but are more > > similar than different. In the long run, there will come a day when > > they've taken as much of the market share of other drinks away as they > > will, and the primary competition will be between the two of them. > > > > Paul Prescod ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2D620C.2E67414D at earthlink.net> Control: cancel <3C2D620C.2E67414D at earthlink.net> Date: Mon, 31 Dec 2001 03:49:13 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774839 27193 211.57.49.2 (31 Dec 2001 05:00:39 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:00:39 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From just at xs4all.nl Sat Dec 8 16:36:30 2001 From: just at xs4all.nl (Just van Rossum) Date: Sat, 08 Dec 2001 22:36:30 +0100 Subject: Calling a generator multiple times References: <0gn21usqeasqa1bp4sveh0vjagtmbmfpof@4ax.com> <3C11FE92.1218662@letterror.com> <3C127F1D.DD609D4D@xs4all.nl> <46051ugbk2aeaqeq4sb2aslurf4t22o70b@4ax.com> Message-ID: <3C1289D5.98BE76B4@xs4all.nl> Courageous wrote: > Explain to me, very carefully now, why I should have to read > a language designer's doc in order to consider for a moment how > your average user will encounter a language construct? Fair enough. Still, sometimes you need a little background before new concepts sink in. Look at the problems people coming from languages like C are having with the concept of name binding. Sometimes you need to reset your brain. > For the record, yes, I have read this PEP. It's the very first > thing that I did before mucking around with generators and > before posting even my first message regarding generators here. Great, that's good to know. > Pronouncements like the following: "so I have consulted my > language designer's intuition. It tells me that the syntax > proposed in the PEP is exactly right" aren't exactly persuasive, > especially when you consider the paragraph that immediately > preceeds this decree. I have no idea what you mean with that last sentence. I think all that Guido tried to say is something like "We could do A or we could do B. Arguments either way aren't completely convincing, so I'll just do whatever I think is best." What's so bad about that? Your attitude of "this is so obviously wrong, what have they been thinking" however, is pretty insulting, especially since you don't say anything that hasn't been discussed 1000 times in the iterators mailing list. Just From justin at iago.org Fri Dec 28 15:02:28 2001 From: justin at iago.org (Justin Sheehy) Date: Fri, 28 Dec 2001 15:02:28 -0500 Subject: Python Popularity: Questions and Comments In-Reply-To: <3C2CBACB.FBF3C3C9@mindspring.com> ("Dr. David J. Ritchie, Sr."'s message of "Fri, 28 Dec 2001 12:32:49 -0600") References: <3C2CBACB.FBF3C3C9@mindspring.com> Message-ID: "Dr. David J. Ritchie, Sr." writes: > there are features of Java (like strong typing) that at least > mandate a certain level of consistency between all execution paths. Python has strong typing. It does not, however, have static typing or explicit type declarations, which are probably what you are thinking about. > I can argue to myself to dismiss that one by saying that of course > interpretative languages should not be expected to hold to that > level of validation. Could you please explain what an "interpretative language" is and how Java and Python are different with regard to that definition? Before you answer, realize that both are generally translated into an intermediate language and then that language is executed by a virtual machine at runtime. -Justin From maxm at mxm.dk Sun Dec 16 05:42:43 2001 From: maxm at mxm.dk (maxm) Date: Sun, 16 Dec 2001 11:42:43 +0100 Subject: Recursive update of arbitrarily nested dicts References: Message-ID: "Jason Orendorff" wrote in message news:mailman.1008452899.18809.python-list at python.org... > > I am writing a module where I am updating nested dicts, and it has this > > method: > > > > def addDayToTrack(self, trackId, year, theDay, day): > > if not self.tracks.has_key(trackId): > > self.tracks.update({trackId:{year:{theDay:day}}}) > > elif not self.tracks[trackId].has_key(year): > > self.tracks[trackId].update({year:{theDay:day}}) > > elif not self.tracks[trackId][year].has_key(theDay): > > self.tracks[trackId][year][theDay] = day > > def addDayToTrack(self, trackId, year, theDay, day): > """ Not the recursive solution you're seeking, but better anyway """ > trackDict = self.tracks.setdefault(trackId, {}) > yearDict = trackDict.setdefault(year, {}) > yearDict[theDay] = day That was a _much_ nicer solution than my own, and pretty clever too. I did know the setdefault() method, but it would never have occured to me to use it like that. All in all it gave me a good push in the right direction to a recursive version:: def rUpdate(self, targetDict, itemDict): "Recursively updates nested dicts" for key, val in itemDict.items(): if type(val) == type({}): newTarget = targetDict.setdefault(key,{}) self.rUpdate(newTarget, val) else: targetDict[key] = val And event though your version is in fact simpler than the recursive one, I think I will keep the recursive one in my toolbox as it's more general. Thanks! regards Max M From dyoo at hkn.eecs.berkeley.edu Thu Dec 27 01:32:39 2001 From: dyoo at hkn.eecs.berkeley.edu (Daniel Yoo) Date: Thu, 27 Dec 2001 06:32:39 +0000 (UTC) Subject: How to include text and images both in a single PS file References: Message-ID: vbman8 wrote: : How to create a PS file that will first have some text then some : picture and then again text in it. Please give full example and/or : the links. Thanks. Have you had a chance to look at ReportLab yet? http://www.reportlab.com/download.html It appears that ReportLab can output Postscript as well as PDF files, so it's worth a look. Good luck to you. From rdsteph at earthlink.net Sat Dec 29 19:43:44 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sun, 30 Dec 2001 00:43:44 GMT Subject: Python and Ruby: a comparison References: <3C2B9A61.EE1618DB@earthlink.net> <2WpX7.1145$0s5.714029@news20> Message-ID: <3C2E645C.429536E8@earthlink.net> Very interesting idea. Unfortunately, I doubt if it woudl be possible. For one thing, very few people would be willing to compromise on syntax. Ruby folks would rightfully be loath to give up their end-begin block delimiters, and likewise we Python folks would not want o give up our whitespace block delimiters. Also, backwards portability would be a big problem. However, for what its worth, the PERL 6 implements, whom I met and conversed with at the MIT Lightweight Languages conference, are definitely truing, as a goal, to create a PERL 6 runtime environment that can easily and credibly, someday later on, run Perl, Ruby, and Python. I suppose that could be additional runtime environments for these languages, just like Jython is an additional runtime environment for Python. Maybe that could work, and give some of the advantages of "bringing the tow (or , in this case, three) streams if development back togethers into one mighty river. I am a doubter about this, btu who knows? By the way, their is a very interesting email list spawned form that conference that you and others might be interested in, Conrad, it has had quite a bit of discussion about Ruby and python both, among many many other languages, and is inhabited by creators of many language and other worthy and redoubtable academic computer scientists (mostly LIsp-Scheme gurus ;-)).. The list is at ll1-discuss at ai.mit.edu and i believe that there is at least a partial archive of old messages at http://www.ai.mit.edu/~gregs/ll1-discuss-archive-html/threads.html which again, contains many Ruby threads, or at least threads comparing Ruby to other languages (and Python also ;-)))) Conrad Schneiker wrote: > "Ron Stephens" wrote: > > > I initiated a thread over on comp.lang.python which has turned into > > somewhat of a comparison between Ruby and Python, their relative > > strengths and weaknesses. The thread is titled Python Popularity: > > Questions and Comments. > [...] > > By teh way, I admire Ruby. Although I am a Python hacker at heart, I > > enjoy this newsgroup, the Ruby community, and I think Matz is doing an > > outstanding job. I do believe though, that Python and Ruby are aimed at > > a very similar problem domains with similar philosophies; and that is > > what I began to talk about on comp.lang.python and that got the thread > > going. > > [In this and other somewhat related threads] Some people have (in different > words) lamented the "language fork" (as it were) with respect to providing > the major dynamic OO alternative to Perl (and Java and C++). Others have > pointed out that Python and Ruby appeal to somewhat different tastes and > that they draw newcomers from only partially overlapping pools of people. > Nevertheless, there is some inevitable division of potential resources and > mind share. > > Othes have pointed out various relatively moderate but nagging problems in > Ruby and Python which persist due to backwards compatibility, which won't be > fixed until the (highly speculative) advent of major overhalls where full > backwards compatibility is not completely manditory--i.e. Ruby.next and > Python 3000. > > So my question is: at such a presently entirely hypothetical future > juncture, is there any practical and desirable middle ground for a common > single successor language to the current generations of Python and Ruby? > > Conrad From daves_spam_dodging_account at yahoo.com Mon Dec 10 11:59:40 2001 From: daves_spam_dodging_account at yahoo.com (David Brady) Date: Mon, 10 Dec 2001 08:59:40 -0800 (PST) Subject: FW: Win32all documentation? In-Reply-To: Message-ID: <20011210165940.53875.qmail@web21110.mail.yahoo.com> > -----Original Message----- > From: David Bolen [mailto:db3l at fitlinxx.com] > Sent: Friday, December 07, 2001 8:31 PM > To: python-list at python.org > > (Can there be anything but "Windows-specific" > portions of this query > given that we're talking about win32all? :-)) Um... yes, though I may be splitting hairs. I've got a pretty solid grasp of Python in general, and I've been programming Windows in C/C++ for nearly 10 years. The part I don't understand clearly is win32all *itself*. I know *how* to enumerate windows in C; I just don't know how to get there from Python. Over the weekend I walked through the entire win32all installation and found a lot of demos, many of which appear to be most illuminating. But they still only shine points of light in a dark corner, and I want to turn on the Big Light Overhead. If there were win32all documentation somewhere, something at least as complete as the documentation like the Python module dox (http://www.python.org/doc/current/modindex.html), I would be in fat city. I own Mark's book, and I've read most of it. While it is excellent, it doesn't provide a reference so much as a lot more in-depth examples. For example, filling out and printing a Microsoft Word template document using win32com is demonstrated, but no further data is forthcoming on what *else* you can do with MS Word from win32com. Like, for example, how to open Word to a blank document and create and format a documnt from scratch. If I could just see all the methods, objects and classes of win32all, I could probably figure out how to hook up the rest of the stuff I need. Forgive me if I'm sounding whiny. I'm beating my head against a brick wall here, and I'm willing to admit it's my head's fault... if someone will just show me the door in the wall to walk through. In defense of my head, however, the wallbuilder and doormaker might consider marking the door more clearly. (Unless they're sickos who enjoy this sort of thing. :-) > MSDN is really the right place. This was the second portion of my query; in specific I was looking for WSH documentation. After the comment here that "Python can do everything better than WSH, SendKeys is about the only useful part of WSH", I'm willing to try and find other solutions. I know from MSDN, for example, how to enumerate all the windows in the system and how to get and change the caption of a window. For this portion of our program, I am asking how to do it from Python. If there isn't a "win32.enumeratewindows" method, then how can I call the windows API functions FindWindow() and EnumWindows()? I do not see them listed when I do a dir(win32api): >>> for f in dir(win32api): ... if f.upper().find('FIND') != -1: ... print f ... FindCloseChangeNotification FindExecutable FindFiles FindFirstChangeNotification FindNextChangeNotification >>> for f in dir(win32api): ... if f.upper().find('ENUM') != -1: ... print f ... EnumResourceNames RegEnumKey RegEnumValue ...I infer from my reading that the win32api functions of Python are considered fairly complete, so I'm willing to assume that these functions are missing because I'm looking in the wrong place, or that they're implemented in a more Python-friendly way altogether and using the api in this case is a poor choice. If someone would please show me how these ruby slippers worked, I'm sure I could go home.... > Perhaps if you suggested some specific questions you > may have in terms > of trying to interact with the API (or WSH, or > whatever), we'd be able > to be more specific with pointers to information. Certainly. And THANK YOU ALL for getting this far through my incredibly long rant. Here are the specificy problems I'm trying to solve at the moment, and the Python hurdles I have yet to clear with them. I have two main applications I'm trying to create at the moment: 1. Testing GUI code written in C++. It VERY nice to be able to SendKeys() a few hundred bytes of text every time I want to test the text handling portion of my GUI. I'd also like to be able to send mouse clicks to the application; in this way I could simulate actually having a human at my program typing and clicking away, and I can verify that my code changes have broken nothing. I'd also like to be able to grab a screenshot of just that window; much later in testing I can use this to verify that the program's output is correct. So, 3 things: - How to find an application running in the system, preferrably by window class, and activate one of its child windows, which may be positioned randomly on the screen. There may be multiple instances of the window class running, I'd like to be able to inspect them to be able to pick the correct one. - How to send mouse actions to a window. - How to capture a screenshot of a window. 2. Whenever I install or reinstall an operating system, I have about 20 different applications that have to be installed and have their registration codes entered. The process AFTER the OS is installed takes about four hours. I'd like a script that launches their installers, clicks through their install interfaces, and types in my user and registration info automatically. In this way, I could fire up a new machine, launch the script, and let it install and register my software, rebooting as necessary. Once that's done, I usually reorganize the Programs folder inside the Start Menu so that I can more easily navigate it by keyboard (for example, renaming the 4,219,376 applications whose names start with "Microsoft" so that hitting "O" launches Office and "W" launches Word. Three things, again: 1 - Finding the start menu folder so the script can put itself there to continue running after each reboot. 2 - Launching an app and then monitoring it, waiting for it to die. 3 - Walking through the start menu shortcuts and renaming them. Phew. I'm sorry this is such a long list. That's why I tried to abstractify my question. :-) Unfortunately, I described the abstraction poorly, or chose the wrong abstraction altogether. Specific help for any of these questions is certainly welcome, though if anyone sees now the "correct" way to think about these problems--in such a way that I can get the information I need to get them working--I would also be grateful. Thank you very much, -dB P.S. Bonus question. How can I change the desktop background image in Win32 from Python? Thanks again! P.P.S. No disrespect is intended towards Hammond & Robinson, their book, or their documentation as presented on the ActiveState site. I'm having difficulty, yes, but I'm grateful I've got as much information as I do. ===== David Brady daves_spam_dodging_account at yahoo.com I'm feeling very surreal today... or *AM* I? __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com From aahz at panix.com Sat Dec 22 13:45:56 2001 From: aahz at panix.com (Aahz Maruch) Date: 22 Dec 2001 10:45:56 -0800 Subject: Platform-independent GUID creation? References: Message-ID: In article , Irmen de Jong wrote: >"Aahz Maruch" wrote in message >news:a029l8$ctn$1 at panix3.panix.com... >> >> Nice try. (That's partly serious, partly sarcasm.) It probably works >> for limited applications, but it's definitely not a guaranteed GUID. >> One of the big problems with your method is that the widespread adoption >> of NAT combined with excessive use of "private" IP addresses means that >> there's a lot of IP address duplication out there. > >Yes, I realised that. But it had to be portable. So I took the IP address, >the process ID and a random number. >There's no guarantee here (certainly not!) that the number is unique, but >the chances are pretty slim that you get an identical number. > >I don't have a better solution. If anybody has a better (Pythonic) GUID >generator, I'd be very interested. As I said earlier, the only truly safe ID creation mechanism is to create GUIDs on a server and send them (possibly in batch) to the client. Granted, that's more overhead, but it *is* portable. The other option for limited applications is to use a known guaranteed unique ID (social security numbers in the US are *not*; I think ISBN might be guaranteed unique). -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 9 days and counting From emile at fenx.com Sat Dec 29 11:06:47 2001 From: emile at fenx.com (Emile van Sebille) Date: Sat, 29 Dec 2001 08:06:47 -0800 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> <7xlmfxvbx7.fsf@ruckus.brouhaha.com> <3dbsgt7f0e.fsf@ute.mems-exchange.org> <7xheqkr05q.fsf@ruckus.brouhaha.com> Message-ID: "James T. Dennis" wrote in message news:a0kor6$2o7u$2 at news.idiom.com... > Paul Rubin wrote: > > "Fredrik Lundh" writes: > >>> Not bugs per se unless perfect backward compatibility was > >>> an overriding concern. > > >> it isn't. > > > It's a bug if something is gratuitously, unnecessarily incompatible, > > like "rand" disappearing. What was the reason for that? > > While that topic has come up: I find whrandom to be an unsightly > name for accessing a set of functions which is so commonly accessed > by novice students. What was wrong with must calling it rand or > random? Is it pure pedantry? whrandom now exists for backwards compatibility purposes and is scheduled for deprecation (is this a word? ;-) Use random. -- Emile van Sebille emile at fenx.com --------- From tim at vegeta.ath.cx Sun Dec 16 11:17:49 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Sun, 16 Dec 2001 16:17:49 GMT Subject: Idiomatic portable way to strip line endings? References: Message-ID: John Roth graced us by uttering: > > "Tim Hammerquist" wrote in message > news:slrna1pbik.6jf.tim at vegeta.ath.cx... >> I've been trying to figure out the canonical way to strip the line >> endings from a text file. >> >> In general, I can use: >> >> line = line[:-1] >> or >> del line[-1:] >> >> to strip the last character off the line, but this only works on >> operating systems that have a one-byte line separator like Unix/Linux >> ('\n'). The Win32 line separator is 2-bytes ('\r\n'), so this >> solution is not portable. > > Huh? This works fine on Windows. The C library (which is > what Python is based on, after all) is defined to convert the > operating system dependent line end sequence to '\n' > on input, and back on output. Ah. So I was doing my normal over-thinking again. =) Thanks! Tim Hammerquist -- How do I type "for i in *.dvi do xdvi i done" in a GUI? -- discussion in comp.os.linux.misc From tim.one at home.com Mon Dec 3 14:32:37 2001 From: tim.one at home.com (Tim Peters) Date: Mon, 3 Dec 2001 14:32:37 -0500 Subject: Do 2.2 and 2.1.1coexist well? In-Reply-To: <3c0bbd3c.252211976@news> Message-ID: [David C. Ullrich, about Python on Windows] > I've been meaning to ask about this, didn't want to sound stupid: I've meaning to answer this, but likewise didn't want to sound stupid. > ... > File associations is no problem - people who enjoy such things can > have great fun arranging trick ways to send a .py file to various > different python.exe's (adding various shell commands, and/or > associating .py with something that reads the first line of the > file for the name of the executable as in UNIX...) > ... > But Python itself seems to use the registry, for example it appears > that that's where it reads PYTHONPATH from. It's complicated. You can read the comments at the start of PC\getpathp.c, and I know of know way to summarize that usefully. In fact, Python on Windows normally never reads the registry for anything, not even for PYTHONPATH. You can verify that by changing the PYTHONPATH in your registry, and then noting that sys.path doesn't change as a result. The PYTHONPATH in the registry is a backup in case all other attempts to locate Python's home directory fail (which can happen if, e.g., Python components are invoked via COM by some other app). (OTOH, it could be the rules have changed since the ancient version of Python you're still torturing yourself with .) > So sissys like me get nervous installing a new version if we hope to > keep the old one... Right now it looks like all the Python stuff is > under HKEY_LOCAL_MACHINE/Software/Python/PythonCore/1.5. Presumably > if a person installed 2.x that would appear under PythonCore/2.x > without making any changes to PythonCore/1.5? Yes, although, as above, these registry entries normally aren't used. From jbyars at iupui.edu Tue Dec 4 09:38:23 2001 From: jbyars at iupui.edu (Jason Byars) Date: Tue, 4 Dec 2001 09:38:23 -0500 Subject: Reading any NT System log entries Message-ID: <9uin27$s5g$1@hercules.iupui.edu> Hi, I'm in a bit of a bind reading System log print events. 99% of the events read fine with win32evtlogutil.SafeFormatMessage(ev_obj, logtype). But, every now and then I get and entry with an ascii character above 128 and SafeFormatMessage throws an error. Is there some way to clean up those entry objects so they can be read? Thanks! Jason From hrvoje.tercek at caatoosee.hr Tue Dec 18 04:56:35 2001 From: hrvoje.tercek at caatoosee.hr (=?iso-8859-2?Q?Hrvoje_Ter=E8ek?=) Date: Tue, 18 Dec 2001 10:56:35 +0100 Subject: Printing ASCII >128 for different local settings Message-ID: <001f01c187aa$479d0f30$6f00000a@activmedia.hr> There is the problem: You have two attachments. Box.gif, box.txt. As you suppose the image is capture screen how file should appear and how it should look like on my dot-matrix printer, send from python !!! Box.txt is written in Notepad because there is only editor which accept my ALT+ commands exactly as I need. So task would be: If box.txt appeared exactly as box.gif look like, try load box.txt and push to printer all from python. Doesn't work at my place :((( Rephrase the problem ... in Python21\lib\encode there is the file cp437.py. Obviously used at installation and locale settings. Q: How to print (standard output or dot matrix printer) e.g. 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE regardless locale settings??? I have Win2000, Python 2.1 and locale setting set to cp1250... Thanks at front Hrvoje Tercek -------------- next part -------------- An HTML attachment was scrubbed... URL: From neuromorphus at yahoo.com Mon Dec 10 16:19:53 2001 From: neuromorphus at yahoo.com (neuromorphus) Date: Mon, 10 Dec 2001 21:19:53 -0000 Subject: Client/server chat program Message-ID: <9v38tp+b3d9@eGroups.com> Statement I'm creating a client/server chat program on my Linux system. It's a group chat like ICQ, so all messages go through the server and then broadcasted to online users. Note: for the time being, this program will operate in a terminal/console, so no gui. Problem The client program continuously asks for 'raw_input' from the user,and then sends the msg to the server to be broadcasted. However, I can't output messages to the terminal/console, if the client program is waiting for input. What happens is that after the client types a message. All previous output(of other users) are then flush to that client's screen. In other words, how do i get client input and display current messages to the client's screen without having to wait for the clients input. NOte: this is a terminal. Telnet does it some kinda way(it works perfect), but i'm trying to get my client to work the same way. "Journies Lead to Knowledge and Passon Lights the Way" ~=NeuroMorphus=~ From peter.milliken at gtech.com Wed Dec 26 14:58:50 2001 From: peter.milliken at gtech.com (Peter Milliken) Date: Thu, 27 Dec 2001 06:58:50 +1100 Subject: REPOST: Re: Book "python programming patterns". anybody read this?? References: Message-ID: <7$--$$-$$$$%_%__%$@news.noc.cabal.int> No Gordon, that's a ridiculous assumption! Who said the code was bad? Not I! Your original email implied that you had to put some amount of study into understanding the examples - there was an implication that the examples where not straight forward and therefore required some considerable time and effort on your part to understand what was going on. Nobody has tried to equate this with "bad code", just bad coding practice (in our opinion - well, Roy's and mine :-)) - a very different thing. Perhaps if you take objection to our comments you should perhaps clarify and quantify your comments on just how much effort was required to understand the examples? and why? i.e. if the book is more "algorithmic" in nature then perhaps you cannot get away from examples that do take some considerable study effort - if this is the case then perhaps you should provide that clarification/caveat on your comment. Otherwise I'll have to stick with my decision (unless I stood in the book store and read the book! :-)). Peter "Gordon McMillan" wrote in message news:Xns9180CE1BAC652gmcmhypernetcom at 199.171.54.214... > Peter Milliken wrote: > > > Actually, I doubt there is any intersection - or perhaps I should > > qualify that by an intersection in the realms of code that you and only > > you will ever have to look at or maintain. > > > > I side with Roy's opinions purely because it is almost never the code > > author that has to maintain the code (at least on systems I have worked > > on over the last 20 years :-)). > > This is ridiculous. I said I had to study some things to understand what was > going on, and that has become "ewww, it must be bad code". > > Every API has two sides. One side is supposed to be easy to use and > understand. The other side almost certainly isn't. If the internals of > Python dictionaries were easy to understand, their performance would suck. > > If you're only interested in using APIs, this book probably isn't for you. > But it's presumptuous to equate "challenging" with "bad". > > -- Gordon > http://www.mcmillan-inc.com/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Peter Milliken" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:12:36 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009776208 27193 211.57.49.2 (31 Dec 2001 05:23:28 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:23:28 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From aleax at aleax.it Thu Dec 6 08:55:11 2001 From: aleax at aleax.it (Alex Martelli) Date: Thu, 6 Dec 2001 14:55:11 +0100 Subject: PyInline problem References: <9uljcb$8ap$1@newsg4.svr.pol.co.uk> <9ulksl$f0o$1@endevour.netg.se> <9ulr4i$bb9$1@newsg3.svr.pol.co.uk> <9um2m4$3pb$1@nntp9.atl.mindspring.net> <9um97d$kvs$1@newsg3.svr.pol.co.uk> Message-ID: <9untbt$ebi$1@serv1.iunet.it> "Duncan Smith" wrote in message news:9um97d$kvs$1 at newsg3.svr.pol.co.uk... ... > have built it with #include , but have always failed when I also > have #include . I'll get there in the end, I just hate the trial Unsurprising, since is a non-existent indicator for an include file (doesn't exist in either standard C or Microsoft Visual C++). What DO you actually want to include? Alex From jdhunter at nitace.bsd.uchicago.edu Fri Dec 7 14:25:16 2001 From: jdhunter at nitace.bsd.uchicago.edu (John Hunter) Date: Fri, 07 Dec 2001 13:25:16 -0600 Subject: string conversion and formatters References: Message-ID: >>>>> "Spiffy" == Spiffy writes: Spiffy> does anyone know where the list of output formatters ( Spiffy> such as %d, %s, etc.) is in the reference material? I Spiffy> know I have seen this list, but I cannot find it. Since this is basically derived from the C function sprintf formatting specifications, your best bet is the man pages for sprintf. Since you are on Windows and presumably can't type 'man sprintf', follow the link below to a web based man page http://www.cgi101.com/class/ch16/envman.cgi?sprintf Not light reading, but comprehensive. JDH From Tom.Karas at htp-tel.de Sat Dec 29 16:32:30 2001 From: Tom.Karas at htp-tel.de (Tom Karas) Date: Sat, 29 Dec 2001 22:32:30 +0100 Subject: REPOST: Re: Was that to inpolite? Re: Call for a small program References: <3C2BAEF3.CC34B8DD@htp-tel.de> <3C2E0D55.9EC9B67F@htp-tel.de> Message-ID: <1$--$$_----__$%_-$@news.noc.cabal.int> Terry Reedy wrote: > > Was my "Call" to inpolite? > > Sorry, don't remember rest of title or what it was about. The title was: Call for a small program X-posting followup-to comp.lang.python from friday > > This may sound odd, but i would be even willing to pay for a > > solution that would > > fit the basic needs (running on windows and linux and some features) > Willingness to pay is 'odd' only in that it tends to be unusual. Did > you mention this originally? No, i did not. But i am mentioning it now to show that i am serious with that. I have no idea how long someone already skilled in python has to hack to get a solution done, so i have no idea how the price supposed to be. Thanks for your answer. At least now i am sure that at least this posting went right (had some problems with the first one) -- The early bird catches the worm. If you want something else for breakfast, get up later. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Tom Karas Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E366E.7D417B41 at htp-tel.de> Control: cancel <3C2E366E.7D417B41 at htp-tel.de> Date: Mon, 31 Dec 2001 01:41:41 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774549 27193 211.57.49.2 (31 Dec 2001 04:55:49 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:55:49 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From roy at panix.com Sun Dec 30 09:32:50 2001 From: roy at panix.com (Roy Smith) Date: Sun, 30 Dec 2001 09:32:50 -0500 Subject: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> <3C2E498B.6DC757E0@stroeder.com> Message-ID: Cliff Wells wrote: > My sentiments exactly: C is excellent as the equivalent of a modern > assembly language. Back when I was doing M-6800 (6800, not 68000) machine code, I used to write my stuff in a stylized subset of C, then hand-compile it. As long as you stayed away from complex expressions, assignment side effects, and some of the fancier flow control constructs, there was an almost one to one mapping between C statements and blocks of assembler code, so the compilation stage was easy. But, what it let me do is write the structure of the program without having to worry about details like adding two integers by doing a series of byte-wise loads, adds, and carries. From claird at starbase.neosoft.com Thu Dec 6 11:02:50 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 6 Dec 2001 10:02:50 -0600 Subject: Newbie - Exporting Excel Spreadsheet References: <673dc1dc.0112051334.370c75f2@posting.google.com> <3C0F7CFC.B7E73192@computer.org> <9uo28c$9r7q2$1@ID-34238.news.dfncis.de> Message-ID: In article <9uo28c$9r7q2$1 at ID-34238.news.dfncis.de>, M.Kollenaar wrote: >Hi, > >Is it also possible to fetch text from a Word2000 document with Python and a >bunch of modules? . . . With difficulty. What most practitioners do is use COM--only a module or two. Mark's book is handy for this sort of thing. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From fperez528 at yahoo.com Fri Dec 7 11:38:17 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Sat, 08 Dec 2001 16:06:17 +2328 Subject: Class equivalence? References: Message-ID: <9uu6el$i8k$1@peabody.colorado.edu> Bruce Eckel wrote: >>>> class Flower: pass >>>> class Daisy(Flower): pass >>>> Daisy is Flower > 0 > > What am I missing here? A Daisy is *A* Flower, not *THE* Flower. Or in python, an instance of Flower, not the class Flower. Identity relationships from the real world of objects carry quite well to the world of python objects. cheers, f From jfugard at traq.com Wed Dec 5 16:34:04 2001 From: jfugard at traq.com (James Fugard) Date: 5 Dec 2001 13:34:04 -0800 Subject: Newbie - Exporting Excel Spreadsheet Message-ID: <673dc1dc.0112051334.370c75f2@posting.google.com> TIA for any help that I may get. I have a small project that I'm trying to do in Python...and I'm a hack at best! Here is what I'm trying to do. Call and capture a row in an Excel spreadsheet and then use manipulate the data in the cell of the various columns. Here is what I've been able to get some far: # Call all used modules import os,win32api,glob,odbc,dbi,time # Make the database connection using the system DNS MyConnection = odbc.odbc('Client_Data_Log') MyCursor = MyConnection.cursor() MyCursor.execute('SELECT * FROM "Client Data Log$"') # the sheet name print MyCursor.fetchall() This will give me everything + a bunch of dbi time stuff. If someone could tell me where to find info on calling a particular cell or a piece of sample code to follow(like G12 for example) that would be great. Thanks again. James From jkraska at san.rr.com Sat Dec 1 02:02:04 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 01 Dec 2001 07:02:04 GMT Subject: Just started, need help! References: Message-ID: > When I do an input command, I hit enter so I may then do the if and else >command but when I hit enter it Python 2.1 (#15, Apr 16 2001, 18:25:49) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. IDLE 0.8 -- press F1 for help >>> if 1: print "hello" hello >>> Returns don't matter. The colon does, however. C// From andy47 at halfcooked.com Wed Dec 5 21:30:08 2001 From: andy47 at halfcooked.com (Andy Todd) Date: 6 Dec 2001 02:30:08 GMT Subject: Large Yahoo ads plonk in middle of posts! References: Message-ID: Kirby Urner wrote in : > >I doesn't seem to have spread to mirror of comp.lang.python , >archived at Yahoo, but another Yahoo group to which I subscribe >now features very large rectangular (not banner) ads right >in the text of the post. > >[snip] > >Kirby > > FWIW Active State maintain on-line archives of lots of mailing lists, they have c.l.p - http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/python- list Its not quite as complete as the Yahoo archive but its certainly not chock full of adverts as I suspect all of their lists will be sooner or later. I for one would like to say good job Active State and thanks very much. Regards, Andy -- Content free posts a speciality From beej at piratehaven.org Mon Dec 24 11:27:25 2001 From: beej at piratehaven.org (beej at piratehaven.org) Date: 24 Dec 2001 16:27:25 GMT Subject: Looping constructs References: <3c25d37e_9@news.newsgroups.com> <3C2602B3.47EA5685@engcorp.com> Message-ID: In article <3C2602B3.47EA5685 at engcorp.com>, Peter Hansen wrote: >I, for one, find it much easier to start my loop >with "while 1:" and then stick the logic where it needs >to be with "if xxxx: break" Do you ever have a "while 0:" loop? Of course not. So why is there even a conditional in there at all? Shouldn't Python just have a: foreverloop: # do-while, repeat-until do_stuff() if condition: break foreverloop: # while if condition: break do_stuff() No, because that's ugly. (Or maybe yes because it's minimalistic?) I'm one of those Python newcomers who thinks the set of looping statements is a little too rarified. :) But whatever, I'll keep using it. -Beej, sure I'm covering old ground From cuiod-tec at web.de Tue Dec 11 03:29:32 2001 From: cuiod-tec at web.de (Jens Gelhaar) Date: 11 Dec 2001 00:29:32 -0800 Subject: COMServer graphical output References: <_6tP7.5693$Rw2.4095674@newssrv26.news.prodigy.com> <41cQ7.5860$Rw2.4209089@newssrv26.news.prodigy.com> Message-ID: "dsavitsk" wrote in message news:<41cQ7.5860$Rw2.4209089 at newssrv26.news.prodigy.com>... > The best way to do this is to do the processing on the client side. return > the data that will make the chart and use a VB charting ocx to generate it. > also, see python programming on win32 (pg 166) on how to use excel to do > this. > That is excactly my problem: VB charting ocx does not give me what I need and even the other charting tools on the market are not usable. I need an COM server on the CLIENT side which produce a graphic in a certain way. Jens From tomas.leko at inet.hr Fri Dec 21 02:20:30 2001 From: tomas.leko at inet.hr (Tomas Leko) Date: Fri, 21 Dec 2001 08:20:30 +0100 Subject: Cannot start Python 2.2c1 IDLE ? Message-ID: <9vunru$uo2$1@sunce.iskon.hr> I have Windows 2000 and didn't had any problems with Python 2.1.1. Yesterday I installed Python 2.2c1 and now I cannot start IDLE. I looked in the task manager and I see shortly SysFader and than nothing happens. The command line version works fine. Am I missing something and if not where should I report this error. Tomas From Bartosz.Zembrzuski at softax.com.pl Mon Dec 3 11:58:40 2001 From: Bartosz.Zembrzuski at softax.com.pl (Bartosz Zembrzuski) Date: Mon, 03 Dec 2001 17:58:40 +0100 Subject: How many threads can I create ??? Message-ID: <3C0BAF40.EBC30CFC@softax.com.pl> Hi I've got problem with creating large number of threads on Linux. My configuration is: Redhat 7.1 on x86 Kernel 2.4.2-2 Python 2.1 Program is very simple: import threading from time import sleep def fun(): sleep(10) def main(): threads = [] iter = 100 for i in range(iter): t = threading.Thread(target = fun) threads.append(t) for i in range(iter): print i threads[i].start() for i in range(iter): threads[i].join() print 'finished' main() 86th thread gives me an error: Traceback (most recent call last): File "test.py", line 24, in ? main() File "test.py", line 17, in main threads[i].start() File "/home/guest/Python-2.1/Lib/threading.py", line 360, in start _start_new_thread(self.__bootstrap, ()) thread.error: can't start new thread I've no idea what's going on. Under Windows I've created over 2000 python threads until error occures. Similar program written in C (using pthreads) lets me create over 300 threads (on the same linux machine) Any suggestions are welcome :))) Regards From maxm at mxm.dk Fri Dec 28 11:47:11 2001 From: maxm at mxm.dk (maxm) Date: Fri, 28 Dec 2001 17:47:11 +0100 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: "Bill Tate" wrote in message news:cb4ba455.0112280631.731a5d72 at posting.google.com... > Ron Stephens wrote in message news:<3C2B9E04.9957801F at earthlink.net>... > I truly do commend and appreciate DC's contribution's to Python, but I > hope somebody can point to something (either examples or > documentation) that gives me a reason to try again. The funny thing is that it really isn't to complicated, but a few places it stops short of supplying the tools that is needed to make it simple and intuitive to learn. The problem is that it does it tricks by mixin-classes, or multiple inheritance if you will. And to get persistence you just mix in Persistance. To get folder like behaviour you just mix in Objectmanager. To get PropertyManager behaviour you mix in PropertyManager. The most common mixin class though is SimpleItem, and it gives you a lot of basic behaviour. So a class using all of the above would be defined like: class kicthenSink(ObjectManager, PropertyManager, SimpleItem): code ... Each of the mix-in classes has a rather well defined/documented Api and the source is available for browsing, so at some time when you get the "Zope Zen" it all clicks into place and becomes rather simple. The problem though is that it can be rather difficult until you got that zen. And the only way to get there is to actually go ahead and try build something in it. As far as I am concerned it's all just a documentation problem. regards Max M From phd at phd.pp.ru Mon Dec 3 04:32:47 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Mon, 3 Dec 2001 12:32:47 +0300 Subject: =?koi8-r?B?+sHQ1dPLIHd4UHl0aG9uINDPxCBMaW51eA==?= In-Reply-To: ; from rnd@onego.ru on Mon, Dec 03, 2001 at 09:16:30AM +0300 References: <200112030242.EAA90559@service.megastyle.com> Message-ID: <20011203123247.D2490@phd.pp.ru> On Mon, Dec 03, 2001 at 09:16:30AM +0300, Roman Suzi wrote: > On Mon, 3 Dec 2001, Oleg Ponomarev wrote: Roman! Wrong list!!! :) Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From LLoeffler at home.com Sun Dec 2 23:26:47 2001 From: LLoeffler at home.com (Luke) Date: Sun, 02 Dec 2001 22:26:47 -0600 Subject: Very new to this References: <#k0oOh4eBHA.1192@cpimsnntpa03> <#EQGkj4eBHA.1188@cpimsnntpa03> <3C0AB92D.2010407@home.com> <#3jVur4eBHA.1404@cpimsnntpa03> <3C0AEF74.3080005@home.com> <3C0AF54B.8070301@home.com> Message-ID: <3C0AFF07.5050200@home.com> amberdelton wrote: > Are there any good books or web sites that you could suggest for a beginner? > I have never programmed before, this is my first try at it. Thanks for all > the help. See the book "Learn to program using python" if you want something on tree. http://www.python.org/doc/Newbies.html this has a lot of good links. Hetland's tutorials are good. http://www.ibiblio.org/obp/thinkCSpy/ this is another good book online for beginners and teaches general computer science basics. Good luck From jgardn at alumni.washington.edu Sun Dec 9 08:57:03 2001 From: jgardn at alumni.washington.edu (Jonathan Gardner) Date: Sun, 9 Dec 2001 22:57:03 +0900 Subject: lost interest? In-Reply-To: <20011208225631.GA6172@blackscarab> References: <200112081559.fB8FxOJ22691@my.knctv.co.kr> <20011208225631.GA6172@blackscarab> Message-ID: <200112091402.fB9E22J08020@my.knctv.co.kr> On Sunday 09 December 2001 07:56 am, cruciatuz wrote: > THIS is cpan? > If i understand you right, you can deal with perl modules like you can > with debian's apt-get tool? (i just tried the command "perl -MCPAN -e > shell") > > I'd really like something like that for python, based on "setup.py", but > with the option to download the package directly. > > something like: $> py-get module install > > this would cool :) > > ... or did i understand everything wrong? Nope, you are right. THAT is what everyone talks about when they say "CPAN". The website is not what they mean. It is extremely easy to use, and you only have a few problems with one or two modules, but overall, it makes it easy to get the most recent stuff. Jonathan From Benjamin.Schollnick at usa.xerox.com Wed Dec 26 13:16:42 2001 From: Benjamin.Schollnick at usa.xerox.com (Schollnick, Benjamin) Date: Wed, 26 Dec 2001 13:16:42 -0500 Subject: How to solve a problem? Message-ID: There's several problems embeded here: 1) How do you tell that the files are the same? a) Filename? - What if you changed the contents but not the name? b) Filesize? - Which one is newer? c) Date/Time Stamp - Some transfer methods do not update the date/time stamp. 2) How do you plan on transfering the files? a) Http? b) FTP? c) Snailmail? d) SMB Mount? e) NFS Mount? 3) Are these out of a single directory? Or a directory tree? To point you part of the way, check the python demos for FTPMIRROR. If you are going to be doing this via FTP then FTP mirror does take date/time stamp into account. (That's assuming I'm remembering correctly.) - Benjamin -----Original Message----- From: A [mailto:printers at sendme.cz] Sent: Wednesday, December 26, 2001 12:41 PM To: python-list at python.org; tutor at python.org; activepython at listserv.ActiveState.com Subject: How to solve a problem? Hi, My program downloads regularly some files and it takes some time so I need to shorten this downloading time. As most of these files are the same, many times when the program downloads these files, I would like to download only those that are not the same or are newer. What is the best solution? Many thanks for help. Ladislav _______________________________________________ ActivePython mailing list ActivePython at listserv.ActiveState.com http://listserv.ActiveState.com/mailman/listinfo/activepython From skip at pobox.com Thu Dec 20 14:40:27 2001 From: skip at pobox.com (Skip Montanaro) Date: Thu, 20 Dec 2001 13:40:27 -0600 Subject: argument type checking before parsing In-Reply-To: <3C222E41.7BC90F78@doc.ic.ac.uk> References: <3C222E41.7BC90F78@doc.ic.ac.uk> Message-ID: <15394.16043.177680.231256@beluga.mojam.com> Benjamin> Based on the stacktype extension from "Programming Python", I Benjamin> am trying overload the constructor to either accept nothing, Benjamin> or a string (and integer in the future). You probably need a code structure that looks something like this (untested) code: PyObject *arg = NULL; if (!PyArg_ParseTuple(args, "|O", &arg)) return NULL; if (arg == NULL) { return (PyObject *)newstackobject(); } if (PyString_Check(arg) { return (PyObject *)newstackobject_s(PyString_AsString(arg)); } if (PyInt_Check(arg) { return (PyObject *)newstackobject_i(PyInt_ASLONG(arg)); } PyErr_SetString(PyExc_TypeError, "unrecognized argument type for stack initializer"); return NULL; -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From Tom.Karas at htp-tel.de Sat Dec 29 16:26:01 2001 From: Tom.Karas at htp-tel.de (Tom Karas) Date: Sat, 29 Dec 2001 22:26:01 +0100 Subject: REPOST: Re: Was that to inpolite? Re: Call for a small program References: <3C2BAEF3.CC34B8DD@htp-tel.de> <3C2E0D55.9EC9B67F@htp-tel.de> <3C2E2D00.A8E511EB@earthlink.net> Message-ID: <0$--$$_----__$%_-$@news.noc.cabal.int> Hello Hans, > I don't see the message you're referring to. When did you post it? the name of the subject / thread is: Call for a small programm X-posting followup-to comp.lang.python from Friday Tom Karas -- Trust the computer industry to shorten the term "Year 2000" to Y2K. It was this kind of thinking that got us in trouble in the first place. Adrian Tyvand ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp.gblx.net!news-peer.gip.net!news.gsl.net!gip.net!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Tom Karas Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E34E9.E748DB4F at htp-tel.de> Control: cancel <3C2E34E9.E748DB4F at htp-tel.de> Date: Mon, 31 Dec 2001 01:20:34 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774552 27193 211.57.49.2 (31 Dec 2001 04:55:52 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:55:52 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From troyweb at infopackaging.com Mon Dec 31 10:14:17 2001 From: troyweb at infopackaging.com (Troy Sorzano) Date: 31 Dec 2001 07:14:17 -0800 Subject: A new forum is up! References: <40dbad98.0112262238.73fc14f9@posting.google.com> Message-ID: <1c1340d4.0112310714.14f47e81@posting.google.com> NNTP is the way to go. But if you want web access why don't you use http://groups.google.com/groups?hl=en&group=comp.lang.python it has over 100K messages Later, Troy Sorzano pythonnet at hotmail.com (Andrew Nguyen) wrote in message news:<40dbad98.0112262238.73fc14f9 at posting.google.com>... > A new forum for Python is up. It has a better feel to it than this > forum (in my opinion) > it is at ezboard at: > http://pub19.ezboard.com/bthepythonmessageboard95602! From sholden at holdenweb.com Wed Dec 19 09:17:04 2001 From: sholden at holdenweb.com (Steve Holden) Date: Wed, 19 Dec 2001 09:17:04 -0500 Subject: Cygwin socket library status enquiry References: <20011218131502.GA2268@dothill.com> <2JJT7.22497$PA.5674@atlpnn01.usenetserver.com> Message-ID: [posted & mailed] "Jason Tishler" wrote ... > On Tue, Dec 18, 2001 at 08:52:20PM +0000, Michael Hudson wrote: > > "Steve Holden" writes: > > > I'll see what I need to omit to get it to build, and follow up if I > > > make progress. > > > > You need to build _socket statically. > > Please try the following instead: > > http://cygwin.com/ml/cygwin/2001-12/msg00894.html > > and report back to the list. > [Jason's URL specifies rebasing a number of Cygwin and Python DLLs to overcome some known bugs in the Cygwin build] OK, I got the build to work. Win98 didn't have all the same libraries, so I'd recommend that the rebase tool silently, or with a simple comment, ignores file arguments it can't find. But it did rebase everything it found. I'm getting conflicting results on the tests. I omitted test_hotshot, which seems to hang, and test_select (because it's a known troublemaker). I actually got through to the end of the test cycle and restarted on the compiled code, and was in the middle of a post to explain about the five tests which failed, when test_popen2 hung my machine. Solid, not even the three-fingered salute would break in. I had hoped to provide a test output with the summary I saw from phase 1, but unfortunately it looked like "tee" hadn't debuffered the critical part, so I'm going to have to try again. Sorry this is so inconclusive, but the build did pass test_socket. This was with configure --without-thread, by the way. Let me know if you'd like me to repeat it --with-thread. Let me know what else you need - I'm afraid work is interfering with all this testing, so things are going a little more slowly than I'd like. With 2.2 so close maybe this will have to (and should?) wait for 2.3... regards Steve -- http://www.holdenweb.com/ From chrishbarker at attbi.com Wed Dec 19 15:05:53 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Wed, 19 Dec 2001 12:05:53 -0800 Subject: Reading files References: Message-ID: <3C20F321.BA649B30@attbi.com> Preben wrote: > I've noticed when I read/make a file on linux-based systems, they get messed > up on win-systems. > > Sombody told me that it's the 'end-string' char thats different... Is this > true? This is either: A) Nothing to do with Python. The text file line ending convention is different on *nix and Windows, and you will have to deal with that in some way whenever you transfer a file between them. or B) A Python issue, in which case it might have to do with binary vs. text files in Python. If a file is opened as a text file in Python (the default) the line endings are converted on read and write to/from whatever is native to the system running Python to/from a single "\n" internally to Python. On *nix the line ending converntion is allready "\n" so nothing is done. This means that on *nix, there is no difference between binary and text files, so folks sometimes open binary files as text, and don't have a problem. If that same script is run on Windows (or Mac, or...) it will fail, because of the text file line feed translation. To open a file as binary, you use the 'b' flag: open(filename,'b') or open(filename,'wb') -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From fdrake at acm.org Thu Dec 13 14:08:41 2001 From: fdrake at acm.org (Fred L. Drake) Date: Thu, 13 Dec 2001 14:08:41 -0500 (EST) Subject: [development doc updates] Message-ID: <20011213190841.2EF95286BC@cj42289-a.reston1.va.home.com> The development version of the documentation has been updated: http://python.sourceforge.net/devel-docs/ Updated the build instructions for extensions on Windows. From sholden at holdenweb.com Mon Dec 17 08:11:47 2001 From: sholden at holdenweb.com (Steve Holden) Date: Mon, 17 Dec 2001 08:11:47 -0500 Subject: Preserving program structure References: <3C1A5960.4A27136D@attbi.com> <1008454218.762752@rexx.com> Message-ID: "Dave Kuhlman" wrote ... [ ... ] > > By the way, when I do my untabifying, I use the UNIX expand and > unexpand commands. Are there better tools for this? Is > untabify.py any safer? > reindent.py from the Tools distribution subdirectory is pretty good for this. regards Steve -- http://www.holdenweb.com/ From claird at starbase.neosoft.com Fri Dec 28 11:21:36 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 28 Dec 2001 10:21:36 -0600 Subject: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> Message-ID: In article , Alex Martelli wrote: >"Aahz Maruch" wrote in message >news:a0i027$dl2$1 at panix3.panix.com... >> In article , >> DeepBleu wrote: >> > >> >NNTP is an internet protocol like SMTP, POP3 and HTTP for >> >communication. Also, it is the oldest one and it used to be the most >> >instructive before AOL hit the scene along with the 'gold rush' :) . . . >SMTP must be older, by a few years (say '82 vs '86?). FTP must be >older still -- before SMTP, mail was distributed with an FTP tweak. > >Of course, netnews used other transport-level protocols (mostly >based on UUCP, as I recall) well before the Internet was officially >inaugurated (1983, wasn't it?). . . . RFC 765 FILE TRANSFER PROTOCOL June 1980 RFC 821 SIMPLE MAIL TRANSFER PROTOCOL August 1982 RFC 854 TELNET PROTOCOL SPECIFICATION May 1983 RFC 850 Standard for Interchange of USENET Messages June 1983 RFC 977 Network News Transfer Protocol February 1986 Telnet had already been around for a while by this time. I don't know what you mean by the "official inauguration" of the 'Net. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From bh at intevation.de Wed Dec 5 15:16:31 2001 From: bh at intevation.de (Bernhard Herzog) Date: 05 Dec 2001 21:16:31 +0100 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> Message-ID: <6qsnaps9r4.fsf@abnoba.intevation.de> slinkp23 at yahoo.com (Paul Winkler) writes: > On Mon, 3 Dec 2001 12:07:20 +0100, Andreas Kostyrka wrote: > >Were does it say so? I've been programming Python with mixed spaces/tabs > >since 1.3. Works like a charm. Just never forget to install python-mode.el ;) > > Which means the editor is replacing each tab level with 4 spaces, > so there are no tabs in your code. Not necessarily. For one, this is of course configurable, but even more important because Adreas started with Python 1.3, it wasn't always the default setting. When I started to use python-mode (around Python 1.4) mixed tab/space indentation was default. Bernhard -- Intevation GmbH http://intevation.de/ Sketch http://sketch.sourceforge.net/ MapIt! http://mapit.de/ From wurmy at earthlink.net Fri Dec 28 10:04:12 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Fri, 28 Dec 2001 15:04:12 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <32c382ad.0112272324.4c78689b@posting.google.com> Message-ID: <3C2C88A6.9D13A3D6@earthlink.net> mlorfeld wrote: > In its 1.5.2 iteration, Python was intriguing, > yet it lacked some essential things (such as a Perlesque chomp), then > I took a look at 2.x and the strip function was implemented - saving > me a great deal of repetition in programming. I'm pretty sure 1.5.2 had strip already... --Hans From sholden at holdenweb.com Wed Dec 19 10:44:58 2001 From: sholden at holdenweb.com (Steve Holden) Date: Wed, 19 Dec 2001 10:44:58 -0500 Subject: Dictionaries as records References: <7_XT7.28652$t07.4042756@twister.midsouth.rr.com> Message-ID: "Bill Wilkinson" wrote in message news:F82U7.28866$t07.4111647 at twister.midsouth.rr.com... > > "John Roth" > > In this case, you have one copy of each of your input > > strings, not 15000 copies! The memory usage should be > > pretty close to pure dictionary overhead. > > I don't see how that can be. If they were all copies of the same reference, > wouldn't a change in one record be reflected in all? Below I make a change > to one record and the others remain the same: > > >>>tbl[1]["g11"] #original value > 'ldjfljdfkjdf' > >>> tbl[1]["g11"] = "f" #change rec one to 'f'/ > >>> tbl[1]["g11"] #it's value is different now. > 'f' > >>> tbl[2]["g11"] #rec 2 remains the same. > 'ldjfljdfkjdf' > > > Now the question. Am I misunderstanding what is happening above? > Indeed you are. Observe: >>> a = "1234" >>> b = a >>> a = "1235" >>> b '1234' Here the name a is rebound to a new value, and the name b remains bound to its original value. But: >>> a = ["a", "b", "c"] >>> b = a >>> a[1] = "SECOND" >>> b ['a', 'SECOND', 'c'] >>> Here the name a is bound to a MUTABLE value, as is b. The assignment to a[1] changes the mutable value which both names are bound to. Finally ... >>> a = "banana" >>> b ['a', 'SECOND', 'c'] >>> Here again a is rebound rather than remaining bound to the same value. Again b remains bound to the origial value. Does this make it any clearer? Variables don't hold values, they hold *references* to values. That's why pythonistas frequently refer to name binding rather than assignment. Hope this helps. regards Steve -- http://www.holdenweb.com/ From r.b.rigilink at chello.nl Sun Dec 30 20:07:02 2001 From: r.b.rigilink at chello.nl (Roeland Rengelink) Date: Mon, 31 Dec 2001 01:07:02 GMT Subject: REPOST: Re: Python Popularity, python at sourceforge References: Message-ID: <6$--$$_----__$__-$@news.noc.cabal.int> Bill Tate wrote: > > Roeland Rengelink wrote in message news:... > > Hi, > > [snip] > > > > Alas, the numbers are far more ambigious than I'd hoped. To summarize: > > > > 1. Python is the smallest of the 6 languages discussed here. > > 2. Python is currently growing slower than PHP and Java, but faster > > than C and Perl. > > - Python has only been gaining on Perl for the last 6 months > > - the difference in growth w.r.t PHP and Java may be getting smaller > > 3. Java is more cross-platform than Python. Perl, C, C++ are less. > > 4. There is no clear evidence for Python's ease of development. > > > > You raise some interesting numbers, but I'm not sure I share some of > your conclusions. The basis for your conclusions appear to be derived > in large part from projects on sourceforge. While I don't disagree > that the numbers could suggest something consistent with your > conclusions, there's a couple of things worth noting. > Well, _only_ from sourceforge projects actually ;) What I tried to do was to take a theory (Python is growing rapidly, is cross-platform, is easy-to-use) and test the prediction that these properties would be reflected in sourceforge statistics. So I tried to look for evidence in the sourceforge statistics for Python's rising popularity, cross-platform usability and ease of usage. What I found was some evidence for the rising popularity and cross-platform usability. As far as ease-of-use is concerned, I see that I was a little careless in my wording. My reasoning went as follows: Given that Python's obvious qualities as a RAD language, do we see those qualities reflected in sourceforge statistics. I could think of two possible predictions. 1) Python's qualities lead to a higher percentage of finished projects. Or 2) Python's qualities lead to more rapid (active) development. I don't think I found clear evidence to support either of these two predictions. However, these predictions were very naive. Hence, my failure to confirm them does not imply that Python is not easy to use. (But wouldn't it have been fun, if I'd found that Python projects are more likely to reach a mature status) > First, maturity of the language. Are the number of projects on > sourceforge more indicative of the maturity (or lack thereof) of a > language as opposed to inferring popularity or growth of the language. > C is still hugely popular on Unix and Linux, but I wouldn't > necessarily infer that the number of projects on sourceforge for C as > being indicative of either its usage or popularity. For python, there > is a huge, pre-existing standard library, much of which perhaps > doesn't require a dedicated sourceforge project. > That's why I tried to focus in the relative rate of growth of the languages. It is a fact that the number of PHP projects at sourceforge is growing more rapidly than the number of Python projects. One could of course argue that Python is more mature and therefore doesn't need as many projects as PHP. But I think it is more likely that, currently, the number of PHP users/developers is growing more rapidly than the number of Python users. > Second, python developers routinely make use of extensions to existing > C and C++ libraries. Many of these extensions do not require a > specific project on sourceforge. They are distributed through various > means and not necessarily through sourceforge. > If one assumes that a fixed percentage of development in a given language takes place on sourceforge (not necessarily the same percentages for each language), then sourceforge statistics provide a measure of the rate of growth of language usage. If one furthermore assumes that these percentages are roughly the same for all languages then sourceforge satistics also provide a measure of relative popularity of these languages. If you mean to say that these percentages are probably not the same I would agree with you. > Third, project numbers do not necessarily equate to developer usage or > preference of a particular language. Perhaps in concert with other > measures (newsgroup/discussion group activity), something can be > inferred about these numbers. > Well, I'm assuming that, in their free time, developers will choose what, to them, is the most appropriate tool for their project. Most appropriate may of course mean 'most fun' or 'best' or 'known' or whatever. However, I would think that if developer preference was reflected in anything, then it would it would be in the choice they make on how to spend their free time. > Fourth - does the number of actual projects convey the degree of > cross-platform support that already exists? > These are project that claim to be cross-platform, which doesn't mean that they are projects to support cross-platformness. So the percentage of projects that claim to be cross-platform may in fact be indicative of the cross-platform support that does exist. I find that that percentage is higher for Java projects than for Python, and higher for Python than for Perl. This confirms the generally held believe that Java is more cross-platform than Python, which in turn is more cross-platform than Perl. > Lastly, your numbers I believe omitted RUBY. Ruby appears to be > gaining in popularity and the number of projects is increasing. Would > your conclusions be the same (in terms of rate of growth rather than > totals) had they incorporated into your numbers? > There are currently only 81 Ruby projects at sourceforge. I think that that's too small a number to make reasonable comparisons to other languages. > WRT Exploding popularity - Regardless of what may or may not be > happening, I'll take moderate and un-hyped growth anyday. > I agree very much. What I found interesting about the thread though, was that it was taken for granted that Python is growing rapidly in popularity, raising the question of why Python is not used more in commercial enterprise. Some suggested that this might be the result of some conservatism in business that is the result of interference from clueless managers. My suggestion would be that Python is not growing nearly as rapidly as some might think and/or that commercial enterprises may not necessarily be more conservative than open source developers. > Ease of Usage - Personally, I don't think we need numbers from > Sourceforge to reach a conclusion here. I don't think there is an > question on Python's ease of use. Its almost pro forma language that > appears at the beginning of any sentence that starts with "What's > Python?" I agree, see the beginning of this post. Thanks for your comments, Roeland -- r.b.rigilink at chello.nl "Half of what I say is nonsense. Unfortunately I don't know which half" ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Roeland Rengelink Newsgroups: comp.lang.python Subject: cmsg cancel <3C2FBA84.490E5D7E at chello.nl> Control: cancel <3C2FBA84.490E5D7E at chello.nl> Date: Mon, 31 Dec 2001 03:38:58 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009773975 27193 211.57.49.2 (31 Dec 2001 04:46:15 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:46:15 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jtlispl at poczta.NOSPAM.onet.pl Sat Dec 1 02:01:43 2001 From: jtlispl at poczta.NOSPAM.onet.pl (Tomasz Lisowski) Date: Sat, 1 Dec 2001 08:01:43 +0100 Subject: Strange Tkinter behaviour - new facts! References: <9u4kf5$ran$1@news.onet.pl> <9u5l8i$dh9$1@news.onet.pl> Message-ID: <9u9v67$c1f$1@news.onet.pl> U?ytkownik "Tomasz Lisowski" napisa? w wiadomo?ci news:9u5l8i$dh9$1 at news.onet.pl... > Uzytkownik "Laura Creighton" napisal w wiadomosci > news:mailman.1007040459.25437.python-list at python.org... > > Try calling update_idletasks(). On occasion I have had that work > > when update() didn't. > > > > Laura Creighton > > Unfortunately, it did not help in my case. The text is displayed in the > drawing only after the button is clicked again, even if update_idletasks() > is called. > > I wonder, whether there is a mechanism suspending the Tkinter event loop, so > that other event-based applications (not using Tkinter) could get access, > and perform their duties. > > Tomasz Lisowski I suspected a problem with interaction between Tkinter and native module provided by the CAD system producer for access to the drawing being created. I have observed two typical behaviours: Sequence A ------------ 1. Tkinter window appears on the screen, and the event loop is running 2. A button is clicked, which invokes a method adding a text to the drawing 2a. The Tkinter window is withdrawn 2b. The insertion point is indicated (native module used!) 2c. The first text is placed in the drawing (native module used!), but does not appear immediately 2d. The Tkinter window is deiconified 3. A button adding a text to the drawing is clicked AGAIN. 3a. The Tkinter window is withdrawn 3b. While asking for the insertion point I see the text added in step 2 appear on the screen. Then I can click on the screen and indicate the place for the second text (native module used!) 3c. The second text is placed in the drawing (native module used!), but does not appear immediately 3d. The Tkinter window is deiconified 4. etc. Sequence B ------------ 1. Tkinter window appears on the screen, and the event loop is running 2. A button is clicked, which invokes a method adding a text to the drawing 2a. The Tkinter window is withdrawn 2b. The insertion point is indicated (native module used!) 2c. The first text is placed in the drawing (native module used!) 2d. I use ANY function from the native module, that displays a window on the screen (e.g. a function displaying a message). This makes the text inserted in step 2c appear on the drawing. Since this occurrs very quickly after the ste[ 2c, the user notices no delay in placing of the text, but he is forced to dismiss the additional message window in order to continue working 2e. The Tkinter window is deiconified 3. etc. As you can see, using a function from the native module, that displays any window (e.g. a message window), or asks for a point in the drawing (this works too!) refreshes somehow the drawing. Without this additional step, the text added to the drawing appears only, when a new text is added (while indicating an insertion point), or when the window is closed. Any comments, hints? Tomasz Lisowski From pythonnet at hotmail.com Fri Dec 28 00:13:57 2001 From: pythonnet at hotmail.com (Andrew Nguyen) Date: 27 Dec 2001 21:13:57 -0800 Subject: REPOST: New Array proposal (So that it will actually be read) Message-ID: <9$--$$_--_%%$_%$$$@news.noc.cabal.int> I think that an array sould have natural dimension support, instead of : List = [[4,4,4], [3,3,3]] Just to define it, we should do this: List|A,B,C| to make a 3 dimensional array, so if I did this: List|4,2| it would call up the variable from 4:2. to put variables in, we would do this: List = | | |1,1|,|1,1| | , |1,1|, | and so on, so that they have 3 parts, but... to get to them blah blah blah blah blah.... But, with natural dimension support, List(1,1,1) = 1 List(2,3,1) = 1 and so on... List(2,4,1,5,8,4) = 6 ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!netnews.com!xfer02.netnews.com!dc1.nntp.concentric.net!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail Message-ID: Control: cancel <40dbad98.0112272113.40a21ab7 at posting.google.com> Subject: cmsg cancel <40dbad98.0112272113.40a21ab7 at posting.google.com> From: pythonnet at hotmail.com (Andrew Nguyen) Newsgroups: comp.lang.python X-No-Archive: yes Lines: 2 NNTP-Posting-Host: wonenara.ozemail.com.au X-Trace: ozemail.com.au 1009643120 203.108.164.177 (Sun, 30 Dec 2001 03:25:20 EST) NNTP-Posting-Date: Sun, 30 Dec 2001 03:25:20 EST Organization: OzEmail Ltd, Australia Distribution: world Date: Sat, 29 Dec 2001 12:50:17 GMT This message was cancelled from within Mozilla. From LLoeffler at home.com Fri Dec 28 17:40:26 2001 From: LLoeffler at home.com (Luke) Date: Fri, 28 Dec 2001 22:40:26 GMT Subject: REPOST: Re: is this a bug or what? References: Message-ID: <8$--$$_----_-%$$%$@news.noc.cabal.int> > Is this new age math? *chuckle* ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Luke Newsgroups: comp.lang.python Subject: cmsg cancel <3C2CF499.9070607 at home.com> Control: cancel <3C2CF499.9070607 at home.com> Date: Mon, 31 Dec 2001 05:06:45 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775005 27193 211.57.49.2 (31 Dec 2001 05:03:25 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:03:25 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From eppstein at ics.uci.edu Thu Dec 6 20:50:55 2001 From: eppstein at ics.uci.edu (David Eppstein) Date: Thu, 06 Dec 2001 17:50:55 -0800 Subject: PEP 276 Simple Iterator for ints (fwd) References: Message-ID: In article , James_Althoff at i2.com wrote: > I agree with David. I think there should be an iterator, lightweight > though it might be. > > for x <= i < y: # alt. spelling of: for i in xrange(x,y) > for x <= i <= y: # alt. spelling of: for i in xrange(x,y+1) > for x < i < y: # alt. spelling of: for i in xrange(x+1,y) > for x < i <= y: # alt. spelling of: for i in xrange(x+1,y+1) > > (not counting the sys.maxint boundary case). Also not counting the possibility that x or y are noninteger. > In any case, it would be nice for the syntax to support the creation of an > interval-like object that I could pass around, save, and use later (in a > for-loop, list function, "in" statement, or any other iterator-based > context). It seems like the choices are (1) concise for-loop, verbose interval-like object for x <= i < y L = [i for x <= i < y] (2) verbose for-loop, concise interval-like object for i in x <= ... < y L = (x <= ... < y) These are not quite the same because of the list/iterator distinction but the problem that list comprehensions can't be made to return iterators instead of lists seems to be a more general one than this. -- David Eppstein UC Irvine Dept. of Information & Computer Science eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/ From infobot at skinnyhippo.com Thu Dec 13 23:56:20 2001 From: infobot at skinnyhippo.com (chas) Date: 13 Dec 2001 20:56:20 -0800 Subject: SMPP module in Python ? Message-ID: Greetings all, Just doing the customary "not wishing to reinvent the wheel" check, before writing a module : Has anybody's done any work with SMPP with Python, and perhaps even created the beginnings of an SMPP module ? If none currently exists, I guess it would be easier to use Jython with the Java SMPP Library from Logica (http://opensmpp.logica.com/) but Java support is still flaky on some OS's (namely FreeBSD, which is my server OS), so I tend to prefer the pure Python solutions (less points of failure). one-day-I'll-have-to-move-my-servers-to-linux'edly-yours, chas From wurmy at earthlink.net Sat Dec 29 18:12:39 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Sat, 29 Dec 2001 23:12:39 GMT Subject: Was that to inpolite? Re: Call for a small program References: <3C2BAEF3.CC34B8DD@htp-tel.de> <3C2E0D55.9EC9B67F@htp-tel.de> <3C2E2D00.A8E511EB@earthlink.net> <3C2E34E9.E748DB4F@htp-tel.de> Message-ID: <3C2E4CA4.1A230381@earthlink.net> Tom Karas wrote: > > Hello Hans, > > > I don't see the message you're referring to. When did you post it? > > the name of the subject / thread is: Call for a small programm X-posting > followup-to comp.lang.python from Friday It doesn't show up in my newsreader. Since others apparently didn't see the message either, I guess something went wrong with posting it, or it got lost in the Usenet vacuum. Now that you have our attention, it's probably a good idea to post the original message again. :-) --Hans From dsavitsk at e-coli.net Mon Dec 10 18:24:26 2001 From: dsavitsk at e-coli.net (dsavitsk) Date: Mon, 10 Dec 2001 23:24:26 GMT Subject: run Tkinter app with no console window? References: <9v3bhv$m4e$1@news.harvard.net> Message-ID: use .pyw in stead of .py as your file extension. -d "Carty Castaldi" wrote in message news:9v3bhv$m4e$1 at news.harvard.net... > Hi. I am just learning python and like it quite a bit. I have written some > small/useful apps with Tkinter UIs and would like to be able to run them on > Windows with no console window or the console window completely hidden. Any > help appreciated. > > -Carty > > From loewis at informatik.hu-berlin.de Fri Dec 21 11:35:29 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 21 Dec 2001 17:35:29 +0100 Subject: problems building 2.1.1 on HP-UX 10.20 References: Message-ID: msoulier at nortelnetworks.com (Michael P. Soulier) writes: > Yes, I built it with gcc and g++, version 2.8.1. It's the same version > that I used to build versions 1.5.2 and 2.0. I'd still recommend to use the system compiler on HP-UX. Regards, Martin From donn at u.washington.edu Fri Dec 28 14:31:08 2001 From: donn at u.washington.edu (Donn Cave) Date: 28 Dec 2001 19:31:08 GMT Subject: imaplib : password with accented chars in login commands References: Message-ID: Quoth Samuel Krempp : | when I try using "?" as a password in the login command, the imaplib | command raises exceptions. | | import imaplib | M=imaplib.IMAP4('imap.free.fr') | M.login("toto", "bla?bla") | | imaplib.error: LOGIN command error: BAD ['Missing required argument to | LOGIN'] | | It's quite a problem, since I wished I could use any french character | in my passwords, | But I am not sure whether this is a bug in imaplib or a 'feature' of | the IMAP protocol, because the documentation | http://www.python.org/doc/current/lib/imap4-objects.html | says something I don't fully understand, | about always quoting string used as password in the login command. | | Is this a bug, or am I doing something wrong ? Some individual IMAP4 commands support an optional CHARSET modifier, but in general the character set is assumed to be ASCII, which doesn't include that character. It's a feature of the protocol. That's how it looks to me, anyway. Donn Cave, donn at u.washington.edu From andreas at mtg.co.at Sat Dec 1 03:31:45 2001 From: andreas at mtg.co.at (Andreas Kostyrka) Date: Sat, 1 Dec 2001 09:31:45 +0100 Subject: CryptKit 0.9: cryptsock In-Reply-To: References: <200111301121.fAUBLwY28204@lap1.mtg.at> Message-ID: <200112010832.fB18W3n01168@lap1.mtg.at> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am Freitag, 30. November 2001 14:40 schrieb Bryan: > Good question. This version doesn't. The next version will implement ECPAK. ECPAK? What's this? > I am trying to stay away from CA's for now. Any suggestions? Well, before doing this, a "fingerprinting" solution like ssh uses would be some solution. Andreas - -- Andreas Kostyrka; Raiffeisenstr. 16/9; 2320 Zw?lfaxing Tel: +43/676/4091256; Fax: +43/1/7065299 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8CJV8HJdudm4KnO0RAipUAKDAETOQ0fVvESl/TF/Z8GemBUxqeACfXZSs 74NcxRQcoOD450CPLG4+myg= =l3Rd -----END PGP SIGNATURE----- From andrew.henshaw at mail.com Wed Dec 19 21:41:48 2001 From: andrew.henshaw at mail.com (Andrew Henshaw) Date: Wed, 19 Dec 2001 21:41:48 -0500 Subject: Python Hosting Questions References: Message-ID: Geometric Engineer wrote: > BUMBLEBEE BUZZ: > > Might be worth your while to check out [http://www.your-site.com/]. > They've > got a good repuation, a good price ($60 a year), and full language support > (I like PHP myself, but wanted to be able to use Python when time > permits). > > - Grouchy Engineer > > "Dave Butler" wrote in message > news:... >> I have found a potential hosting company, http://www.hostignition.com , >> that offers Python, Perl, PHP4, and JSP/Servlets for $5/month. This seems >> almost too good to be true. Any thoughts? Also, check out http://www.featureprice.com at $4.95 per month. They include this nice quote on their site: "Your account will be enabled to run Python 2.0 programs and scripts. Being as powerful - some say even more powerful than PHP4 - Python is an extremely versatile programming environment. This increasinly popular language should be considered as a basis for any serious projects." From jdhunter at nitace.bsd.uchicago.edu Sun Dec 30 21:43:51 2001 From: jdhunter at nitace.bsd.uchicago.edu (John Hunter) Date: Sun, 30 Dec 2001 20:43:51 -0600 Subject: REPOST: Re: Python and Ruby: a comparison References: <3C2B9A61.EE1618DB@earthlink.net> <2WpX7.1145$0s5.714029@news20> <3C2E6876.4CBF45D4@geneva-link.ch> <465v2u4lv3illoviq19nhdf1r2vcknbakn@4ax.com> Message-ID: <3$--$$_----___-_$$@news.noc.cabal.int> >>>>> "Tim" == Tim Roberts writes: Tim> Oddly enough, I believe that is almost exactly what Bill Tim> Gates believes he has created with .NET and the common Tim> language runtime. And which Ximian and GNOME are bringing to the open source world with Mono: http://www.go-mono.org See also the article in this months Dr Dobbs by GNOME founder Miguel de Icaza and Brian Jepson: http://www.ddj.com/documents/s=1818/ddj0201a/0201a.htm They say that one of the reasons they decided to go with .NET is because it would reduce the cost of having to provide language bindings (python, tcl, perl, java etc) to the GNOME API. John Hunter ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: John Hunter Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:45:07 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009773949 27193 211.57.49.2 (31 Dec 2001 04:45:49 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:45:49 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From syver-en+usenet at online.no Tue Dec 25 08:01:09 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 25 Dec 2001 14:01:09 +0100 Subject: Three misc questions References: <3C282187.1090002@hotmail.com> Message-ID: Stefan Werner writes: > 2. Is there a way for IPC between two Python environments? > E.g. Blender and Poser have both a Python scripting engine, and I'd > like to experiment and link them both together. Is there a way I can > send messages or other data packages between both environments besides > > using shared files? Try Pyro, I've just begun checking out, but it is easy to setup and use and provide remote python objects so you don't have to make your own protocol. -- Vennlig hilsen Syver Enstad From timr at probo.com Sun Dec 30 17:25:27 2001 From: timr at probo.com (Tim Roberts) Date: Sun, 30 Dec 2001 14:25:27 -0800 Subject: odd problem, most likely stupid one too :-) References: Message-ID: Dave Harrison wrote: >Ive written a class named packet, and I have a list on >values that I am using to create my packets by passing >the values in as I instantiate the classes I am creating. > >I do the creation in a for loop, > >for item in itemlist: > PACKET = Packet(item) > paclist.append(PACKET) > >except that when I try to go back through and see the >packets in my paclist they are all exactly the same as >the final one that I store in the list. As in I do, > >for pac in paclist: > print pac.getVal() > >and I get exactly the same value, despite the fact that >I know for sure they are different. This might happen if, for example, you were storing the packets in a class variable or a global variable instead of an instance variable. This class, for example, would behave exactly as you describe: class Packet: value = Null def __init__(self,pkt): value = pkt def getVal(self): return self.value The solution is to skip the class global: class Packet: def __init__(self,pkt): self.value = pkt def getVal(self): return self.value -- - Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From mwh at python.net Mon Dec 3 06:59:20 2001 From: mwh at python.net (Michael Hudson) Date: Mon, 3 Dec 2001 11:59:20 GMT Subject: request, info from pydoc References: Message-ID: Syver Enstad writes: > Is there any tools that allows pydoc to be read in info. I already > have the python info documentation installed, it works great. It would > be helpful to have pydoc integration with emacs too, to browse modules > not from the python library. Haven't heard of any. Would be cool, though (hint, hint :). Cheers, M. -- Unfortunately, nigh the whole world is now duped into thinking that silly fill-in forms on web pages is the way to do user interfaces. -- Erik Naggum, comp.lang.lisp From Cashad at naturallife.ca Fri Dec 7 21:30:25 2001 From: Cashad at naturallife.ca (Cashad at naturallife.ca) Date: Fri, 7 Dec 2001 19:30:25 -0700 Subject: $71000 - 15 yr old made "AS SEEN ON ABC 20/20" Message-ID: <753624-22001126823025732@naturallife.ca> AS SEEN ON ABC's 20/20: The amazing story of a 15 yr. old boy who made over $70,000 on the internet in a matter of weeks. He designed the EASIEST HOME BUSINESS EVER. It's honest, it's not multi-level and best of all, IT'S SIMPLE. You won't be bugging your friends and family. A little time spent each day and only $25 invested and the program begins to work for itself. I figured if a 15 year old boy can do it so can I (a 34 year old IT Manager). For more information email me at cashad at naturallife.ca I had gotten a few of emails about this program, but just deleted them. My curiosity was killing me. So, I finally decided not to delete it. I figured, "hey, it can't hurt to check it out". That decision has changed my life. Here you have the very same opportunity in front of you. If you take just five minutes to read through a program that could make a huge difference in your financial status. This is the type of opportunity we all pray will come along. Since this program aired on National TV, thousands are joining every Hour. You'll earn cash in a matter of a couple of weeks! I did. More information by emailing me at cashad at naturallife.ca THIS IS NOT A SCAM ABC 20/20 PROVED THAT AND ITS JUST TOO....SIMPLE!!!! WE DO NOT SPAM. You are receiving this information via opt-in only. And you may opt-out at any time. If you are not interested and want confirmation of removal, and in compliance with proposed federal legislation (H.R. 3113 and S. 2542) and ll enacted state legislation, reply to this email with 'remove' in the Subject line. From claird at starbase.neosoft.com Fri Dec 28 08:59:26 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 28 Dec 2001 07:59:26 -0600 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <889C110F5BBBFAFD.A03B35C232EA2760.70B0892CB9479323@lp.airnews.net> In article , Patrick wrote: . . . >They DO ask what compilers and linkers we use! They even >make suggestions! We make very customized software. >Some customers write parts of their own code through >'user exits'. > > > > There are times when this is an advantage for Python, for it is a FAR superior "extension language" to Java and C. While many aspects of software engineering are best seen at this point as matters of taste, Python's superiority in this regard is, I argue, a matter of objective record. That's no guarantee of customer acceptance, of course. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From sholden at holdenweb.com Fri Dec 21 12:20:37 2001 From: sholden at holdenweb.com (Steve Holden) Date: Fri, 21 Dec 2001 12:20:37 -0500 Subject: Platform-independent GUID creation? References: <9vtn13$aq9$1@panix3.panix.com> Message-ID: "Fredrik Lundh" wrote in message news:EqJU7.4931$l93.1282358 at newsb.telia.net... > Aahz Maruch wrote: > > The problem is that the DCE/OSF GUID standard specifies using the MAC > > address of the network card as part of a GUID. There isn't a portable > > way to get that, unfortunately. > > or luckily, if you look at it from a security/privacy perspective. > Whatever. I'll settle for a Unix "create GUID" routine and one for the Mac (I would assume for these purposes that OSX shold be treated like some flavor of U*ix?). These could be included along with the win32 CreateGuid() and a platform choice to give something *reasonably* portable. regards Steve -- http://www.holdenweb.com/ From barry at wooz.org Wed Dec 12 07:56:42 2001 From: barry at wooz.org (Barry A. Warsaw) Date: Wed, 12 Dec 2001 07:56:42 -0500 Subject: Jam BOF at IPC10 ? Message-ID: <15383.21514.698548.318601@anthem.wooz.org> There are a bunch of musicians in the Python world, and many of them are going to be at IPC10 in February. There have been some rumblings about trying to put together an informal (mostly acoustic) jam, and I've requested a BOF session for it. :) In order to see if there's any wider interest, and to coordinate things if so, I've put together a temporary mailing list to discuss jamming at IPC10: http://mail.python.org/mailman/listinfo/ipc10jam and mail to ipc10jam at python.org Feel free to join up. If we can get an idea of the size of the event we can ask the hotel in advance for a suitable room. leave-the-marshal-stack-at-home-though-ly y'rs, -Barry From pete at shinners.org Mon Dec 31 00:07:58 2001 From: pete at shinners.org (Pete Shinners) Date: Mon, 31 Dec 2001 05:07:58 GMT Subject: REPOST: how to get traceback from segfault signal handler? Message-ID: <6$--$$-$$$$_$-$__$@news.noc.cabal.int> i'd really-really like to get the python traceback from inside my own installed signal handler. i have a semi-big set of c extension modules, and it's sadly not too shocking for things to crash. (nothing of python's fault, for sure). but it would really aid everyone involved if a stacktrace could be printed, similar to a normal exception. the main problem it seems to come down to, i can't get ahold of the interpreter lock, because the thread execution is stopped. something like "PyThreadState_Get_VoidWarranty()" would really help me out? ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Pete Shinners Newsgroups: comp.lang.python Subject: cmsg cancel <3C2FF490.9080307 at shinners.org> Control: cancel <3C2FF490.9080307 at shinners.org> Date: Mon, 31 Dec 2001 03:21:12 GMT Organization: Korea Telecom Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news1.kornet.net 1009779265 8801 211.57.49.2 (31 Dec 2001 06:14:25 GMT) X-Complaints-To: usenet at feeder.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 06:14:25 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From oren-py-l at hishome.net Sat Dec 8 07:42:18 2001 From: oren-py-l at hishome.net (Oren Tirosh) Date: Sat, 8 Dec 2001 07:42:18 -0500 Subject: Calling a generator multiple times In-Reply-To: <3C11FE92.1218662@letterror.com>; from just@letterror.com on Sat, Dec 08, 2001 at 12:50:42PM +0100 References: <0gn21usqeasqa1bp4sveh0vjagtmbmfpof@4ax.com> <3C11FE92.1218662@letterror.com> Message-ID: <20011208074218.D77659@hishome.net> On Sat, Dec 08, 2001 at 12:50:42PM +0100, Just van Rossum wrote: > Oren Tirosh wrote: > > > > On Sat, Dec 08, 2001 at 12:30:25AM +0000, Courageous wrote: > > > > > > >A generator is a function or method that -- by virtue of using the yield > > > >statement -- > > > > > > I understand how it works, intuitively. My objection is not that > > > I don't understand it, but rather that a lone keyword appearing > > > in the content of the method definition actually changes what is > > > being defined. That's just plain wrong. > > > > I agree. It should be immediately apparent that a generator function is > > not a regular instance of the 'function' type. [ ... ] > > "That's just plain wrong" > "It should be immediately apparent that..." > > If it _was_ "plain wrong" it wouldn't be the way it is. I mentioned the > archives of python-iterators list before, but I think the PEP is a better > reference: > http://python.sourceforge.net/peps/pep-0255.html Ok. it's not 'plain wrong'. It's merely 'slightly confusing'. I fully agree with this particular BDFL pronouncement. Based on the alternatives presented in PEP 255 the best one has been chosen. I think that the alternative I have presented might have been preferred, though, if it were included in the proposals at that time. Oren From pinard at iro.umontreal.ca Fri Dec 21 16:15:55 2001 From: pinard at iro.umontreal.ca (=?iso-8859-1?q?Fran=E7ois?= Pinard) Date: 21 Dec 2001 16:15:55 -0500 Subject: struct.pack('h', ...) difference between 1.5.2 and 2.0 Message-ID: Hello, my fellow python lovers. One of my co-worker's script, written for 1.5.2, used the expression: struct.pack('h', socket.htons(VALUE)) which worked for any VALUE fitting in 16 bits. One could argue that this could be better written as: struct.pack('H', socket.htons(VALUE)) or even as: struct.pack('!h', VALUE) but this is not the subject of this message. The initial writing fails with Python 2.0 whenever (VALUE & 1 << 7) is not zero. Python 2.2c1 also fails with this diagnostic: struct.error: short format requires SHRT_MIN<=number<=SHRT_MAX The error could find its justification by saying that `struct.pack' became more strict about the signed versus unsigned quantities. However, if we replace `h' et `H' by `i' and `I' above, and `htons' by `htonl', one might expect a similar failure in similar circumstances, but there is none. The `Python Library' documentation I have here is silent on the signed or unsigned qualities of the result of `socket.htons' and `socket.htonl'. Quick experimentation shows that the former returns unsigned 16-bit integer values, while the latter returns signed 32-bit integer values. If `struct.pack' was and is lenient about checking ranges for `i' and `I', may I humbly suggest that it could also stay lenient as it once was about `h' and `H', as one may question that the stricter checking introduced by Python 2.0 is fruitful. Or else, I would be tempted to consider as a bug against 2.2c1 that `struct.pack' is strict for the `h' case and lenient for the `I' case. It should then be either lenient for both, as it was for 1.5.2, or become strict for both. Is it your feeling as well? -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From warren-postma at NOSPAM.rogers.com Fri Dec 21 22:11:23 2001 From: warren-postma at NOSPAM.rogers.com (Warren Postma) Date: Sat, 22 Dec 2001 03:11:23 GMT Subject: wxPython w/ IDLE under WinXP Pro References: <3c23dcd2$1_2@nopics.sjc> Message-ID: "Adonis Vargas" wrote in message news:3c23dcd2$1_2 at nopics.sjc... > i am unable to use wxPython under WinXP Pro??? although the demo works just > fine??? Go back to Python 2.1 for a little bit, because unless you've recompiled it yourself, the wxPython you downloaded is probably for Python 2.1, and not for Python 2.2. Binary extensions (.pyd on windows) are not compatible between releases, due to internal changes in the interpreter and data structures, between versions. Either that, or recompile wxPython for yourself, under 2.2. Warren From uche.ogbuji at fourthought.com Tue Dec 18 16:26:08 2001 From: uche.ogbuji at fourthought.com (Uche Ogbuji) Date: Tue, 18 Dec 2001 14:26:08 -0700 Subject: [XML-SIG] Pyana 0.2.0 released In-Reply-To: Message from "Brian Quinlan" of "Tue, 18 Dec 2001 13:04:16 PST." <005901c18807$8e67f210$445d4540@Dell2> Message-ID: <200112182126.fBILQ8A03097@localhost.localdomain> > > > I don't want to get 4suite from CVS so why don't you get Pyana: > > > > No. I'm no more interested in running a benchmark between the two > than > > you are. I have much better things to do, like actually working to > > improve 4suite. Therefore, I know better than to make such > > unsubstantiated comments as "foo is your best bet for high-performance > > XSLT processing". > > My substantiation was my personal experience a few months ago. I also > have several user testimonials stating that they are using Pyana instead > of 4suite for performance reasons. One actually sent me their timings, > which [at that time] demonstrated a 41x performance edge for Pyana. > > But, since you are being so picky, I tested the latest Pyana release > (0.2.0) against the latest 4suite release (0.11.1), using the test > script that I attached in the previous e-mail*: Hey, reading is not such a black art, you know. I specifically said 4Suite in current CVS. We got 4XSLT to the point when it was about as fast as Saxon and Xalan before, back in the 0.10.x series, but subsequent features and changes added up significant performance hits, cuminating in the 0.11.1 release. We went back to optimizing for the next release, and have restored it to its prior snappiness. The CVS version of 4Suite is even easier to install than 0.11.1, so you must just not want to follow my challenge... -- Uche Ogbuji Principal Consultant uche.ogbuji at fourthought.com +1 303 583 9900 x 101 Fourthought, Inc. http://Fourthought.com 4735 East Walnut St, Boulder, CO 80301-2537, USA XML strategy, XML tools (http://4Suite.org), knowledge management From tim at vegeta.ath.cx Thu Dec 27 02:57:20 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Thu, 27 Dec 2001 07:57:20 GMT Subject: REPOST: Re: Python2.2 in Linux RH7.2 - Newbie References: Message-ID: <0$--$$-$$$$%_-$_$$@news.noc.cabal.int> Ahimsa Consulting graced us by uttering: > I am dealing with a double whammy here: I am new to both Python and > Linux. I have been able to call Python up in the Linux console > in interactive mode i.e. '>>>'. I don't seem able to call up > tkinter. Now I am probably doing something incorrectly. If someone > could be kind enough to walk me through this process in baby steps > bearing in mind my newbie status. Without knowing what you're _actually_ doing, since you didn't tell us, but here goes: First, you don't mention which OS you used _before_ linux, so I'm going to make a wild guess and say Windows. Windows is notable in many things, one of which being that it is less case-sensitive than some other operating systems. Linux _is_ case-sensitive and will be less forgiving (or not at all) if you type, say, 'import tkinter' at the '>>>' prompt, instead of 'Tkinter', which should load the Tkinter module if available. In any case, here is a sample Tkinter session from my local installation. If it works, your Tkinter works. [tim at vegeta ~/vault/box]$ python Python 2.2 (#1, Dec 22 2001, 22:09:44) [GCC 2.95.3 19991030 (prerelease)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from Tkinter import * >>> root = Tk() >>> Label(root, text="Tkinter is working").pack() >>> Button(root, text="Close", command=root.quit).pack() >>> root.mainloop() >>> (After you click the "Close" button, you should be returned to the '>>>' prompt.) HTH Tim Hammerquist -- M-x induce-carpal-tunnel-syndrome -- Greg Bacon ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Tim Hammerquist Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:36:36 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775883 27193 211.57.49.2 (31 Dec 2001 05:18:03 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:18:03 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From stephen at stephencox.org Thu Dec 27 01:06:40 2001 From: stephen at stephencox.org (stephen cox) Date: Thu, 27 Dec 2001 06:06:40 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: Being new to the Python world I look at it a bit differently. Python is HOT. With Active State's Python for Visual Studio coming up I think Python will be even bigger. Whenever I mention Python or that I plan to attend the Python conference in Feb my friends and follow programmers eyes roll and they wish they had the time. Or a project that they could use to learn and use Python. -- Stephen Cox web.net geek for non-profits, political campaigns, and a few socially conscious businesses. stephen at stephencox.org From bwaskiew at indiana.edu Tue Dec 18 13:09:35 2001 From: bwaskiew at indiana.edu (Brian Waskiewicz) Date: 18 Dec 2001 10:09:35 -0800 Subject: Python CGI & File Permissions Message-ID: <6456b489.0112181009.3407d52b@posting.google.com> I'm trying to use a Python CGI script to write a text file on a Unix/Apache webserver. The problem is that the file created is owned by 'nobody' and has permissions '-rw-r--r--'. I need to read and append to the file in other scripts, so I need some way of changing the file permissions. I tried os.chmod() and that didn't work. Thanks. From soppers3 at cti.ecp.fr Fri Dec 28 22:46:53 2001 From: soppers3 at cti.ecp.fr (Stephane SOPPERA) Date: Sat, 29 Dec 2001 04:46:53 +0100 Subject: REPOST: Re: [Q] how to use IDLE in linux References: Message-ID: <9$--$$_----_-%$%%$@news.noc.cabal.int> Young-Jin Lee wrote: > Hi, I have problem using IDLE in Linux. I installed Python 2.2 and tried to > launch IDLE, but it didn't work. What's your linux distribution? If you have a Debian Woody, you should installed also the pack idle-Python2.2 and idle. That's not a part of the standard python package. Anyway, to run idle, you should use 'idle-python2.2' command or something like this instead of just 'idle'. -- Stephane SOPPERA http://stephane.soppera.free.fr ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Stephane SOPPERA Newsgroups: comp.lang.python Subject: cmsg cancel <3C2D3CAD.ABBE79F8 at cti.ecp.fr> Control: cancel <3C2D3CAD.ABBE79F8 at cti.ecp.fr> Date: Mon, 31 Dec 2001 04:19:19 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774889 27193 211.57.49.2 (31 Dec 2001 05:01:29 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:01:29 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From tatebll at aol.com Sat Dec 29 09:07:33 2001 From: tatebll at aol.com (Bill Tate) Date: 29 Dec 2001 06:07:33 -0800 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> <3C2D1833.1D481943@earthlink.net> Message-ID: <1$--$$_-----$$$-$$@news.noc.cabal.int> Paul Prescod wrote in message news:... > PHP is a language absolutely optimized to solve a particular problem. > PHP's inventor does not try to claim that it is the best programming > language. Rather he claims that it is the programming language that is > completely optimized for solving one and only one problem: dynamic web > pages. > I do agree with what you saying re: PHP and dynamic web pages. But isn't Zope supposed to be able to do that as well? Yet, Zope doesn't appear (perhaps only to myself) to enjoy the same kind of enthusiasm even amongst Python devotees. You have Python programmers that have probably tried - even more than once I suspect - to "get" Zope but haven't as yet succeeded. My background is mechanical engineering and civil engineering, so my tendency is to tackle problems by going back to first principles or by stepping back and looking at the fundamentals. In the case of zope, the problem isn't that the product lacks this or that feature, its popularity suffers from the fact that people can't figure out how to get it to work for them - that's like starting with 2 strikes against you at bat in today's market. Zope by no means defines the universe of what Python can do, however, if it doesn't get the kind of traction ultimately hoped for, I can imagine that it COULD be PERCEIVED as a "setback" of sorts for Python amongst those who represent the "skeptical" and/or "non-converted" Zope represents one of the most visible products using python out there; if it is ultimately marginalized, I don't think you can simply dismiss the negative consequences of such a result as being isolated only to Zope. Regrettably, false perceptions often carry a greater weight than fact. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: tatebll at aol.com (Bill Tate) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:30:35 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774768 27193 211.57.49.2 (31 Dec 2001 04:59:28 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:59:28 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From nhodgson at bigpond.net.au Mon Dec 10 16:31:37 2001 From: nhodgson at bigpond.net.au (Neil Hodgson) Date: Mon, 10 Dec 2001 21:31:37 GMT Subject: FW: Win32all documentation? References: Message-ID: David Brady: > I own Mark's book, and I've read most of it. While it > is excellent, it doesn't provide a reference so much > as a lot more in-depth examples. For example, filling > out and printing a Microsoft Word template document > using win32com is demonstrated, but no further data is > forthcoming on what *else* you can do with MS Word > from win32com. Like, for example, how to open Word to > a blank document and create and format a documnt from > scratch. If I could just see all the methods, objects > and classes of win32all, I could probably figure out > how to hook up the rest of the stuff I need. The problem here is that the Win32 API is *huge*, the Word object model is quite large, and there are a lot of other COM servers that can be used with win32com. Even if someone were to put in the effort for the current version of these interfaces, there will be new versions every year or two requiring ever increasing work. Even Microsoft doesn't provide Win32 API documentation for VB - instead you get to use the C-oriented documentation which has to be interpreted into VB terms. The opposite applies to Word with documentation for VB but not for C/C++. > I know from MSDN, for example, how to enumerate all > the windows in the system and how to get and change > the caption of a window. For this portion of our > program, I am asking how to do it from Python. If > there isn't a "win32.enumeratewindows" method, then > how can I call the windows API functions FindWindow() > and EnumWindows()? I do not see them listed when I do > a dir(win32api): With the "ActivePython Documentation" downloaded with ActivePython 2.1.212 entering FindWindow in the search box yields several entries showing that the win32ui and win32gui modules host this function. > 1. Testing GUI code written in C++. It VERY nice to > be able to SendKeys() a few hundred bytes of text > every time I want to test the text handling portion of > my GUI. I'd also like to be able to send mouse clicks > to the application; in this way I could simulate > actually having a human at my program typing and > clicking away, and I can verify that my code changes > have broken nothing. I'd also like to be able to grab > a screenshot of just that window; much later in > testing I can use this to verify that the program's > output is correct. SendInput may be the right level to work at but this is not wrapped by win32all. calldll is the generic low level escape that can be used when there is no nicely wrapped high level function. SendKeys is really a quite fragile mechanism to use for running other applications and higher level calls should be used where possible. PostMessage(WM_KEYDOWN | WM_LBUTTONUP | ...) may be a reasonable level to use when dealing with an application you have written where you can fix problems with input code rather than having to work around them. Neil From tbryan at python.net Sun Dec 2 20:33:11 2001 From: tbryan at python.net (Tom Bryan) Date: Mon, 03 Dec 2001 01:33:11 GMT Subject: Newbie : Installing Python locally in acct on shared server References: <3C0A3F04.3090206@lophty.com> Message-ID: brian donovan wrote: > Quick background : I am a Python newbie and I think that I fit into a > large demographic of potential Python users - the users who can't/don't > learn to use Python because they don't have access to up-to-date > installations (other than the one that they can set up on the machine in > their apartment). I am comfortable programming in Perl and PHP because > they have been installed on the systems that I've worked with as well as > on the servers where I host. > I would like to begin to pick up Python, but my hosts' admins are > unwilling/unable to get a newer version installed. They have, however, > told me that I'm more than welcome to install whatever version of Python > that I like on my own account. That's why Marc created the following page. Perhaps it's time for us all to contribute packages for Python-2.0 or 2.1b2. http://www.lemburg.com/files/python/mxCGIPython.html ---Tom From nospam at bigfoot.com Fri Dec 28 16:47:52 2001 From: nospam at bigfoot.com (Gillou) Date: Fri, 28 Dec 2001 22:47:52 +0100 Subject: REPOST: Re: using codecs for encryption? References: <3c2bf123_2@corp.newsgroups.com> Message-ID: <4$--$$_----_---_$$@news.noc.cabal.int> Yes, Have a look to M2CRYPTO, http://www.post1.com/home/ngps/m2/ "Joshua Muskovitz" a ?crit dans le message news: 3c2bf123_2 at corp.newsgroups.com... > This just in, from the top of my head... > > Has anyone thought about implementing encryption libraries (des, pgp, &c) as > codecs in 2.2? Would there be a way to pass a key (or keypair) to the > codec? The codec would also have to maintain some sort of state somehow. > > I just think it would be really cool to be able to say something like: > > c = DESCodec(key) > plaintext = 'shh, here's the secret formula...' > ciphertext = plaintext.encode(c) > ... > c.resetState() > plaintext = ciphertext.decode(c) > > -- josh > > > > > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- > http://www.newsfeeds.com - The #1 Newsgroup Service in the World! > -----== Over 80,000 Newsgroups - 16 Different Servers! =----- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Gillou" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:04:14 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775037 27193 211.57.49.2 (31 Dec 2001 05:03:57 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:03:57 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From bwilk_97 at yahoo.com Tue Dec 18 18:58:40 2001 From: bwilk_97 at yahoo.com (Bill Wilkinson) Date: Tue, 18 Dec 2001 23:58:40 GMT Subject: Dictionaries as records Message-ID: I have been happily using a list of dictionaries to hold table data for years. For the first time, this method is proving less than efficient because of the amount of memory overhead the dictionaries produce. I have a file with 200K records and 16 fields. This file is parsed and each row is put into a dictionary and the dictionary is added to a list. The raw file is only about 50mb. I was shocked to see that my memory use jumped to 500MB! When I delete the list the memory is returned to the system, so I know that the memory is being used in the dictionaries. What strikes me as odd is that I can create a list of 200K dictionaries with test data (a copy of the same record over and over) and the amount of memory used is only half. Having read many of the articles on this newsgroup about how dictionaries are sized, I am aware of some of the memory issues involved with using a great number of dictionaries as I am. Can someone who has faced this issue and found a workaround please fill me in. I know one can use a list of lists or a list of tuples, but had rather stick to the dictionaries because of some library issues. Thanks in advance, Bill From danielk at aracnet.com Sat Dec 29 13:11:00 2001 From: danielk at aracnet.com (Daniel Klein) Date: Sat, 29 Dec 2001 10:11:00 -0800 Subject: [Q] Deepcopy with Python 2.2 ? References: <440c5c6a.0112280847.55c92de7@posting.google.com> Message-ID: <0m1s2uoptu84bpjvrjpeic6te3qf05s7q0@4ax.com> On 28 Dec 2001 08:47:05 -0800, setar at gmx.de (Oliver Hofmann) wrote: >'lo everyone! > >I've had a few problems with copying objects lately when they >reference each other. My understanding is that deepcopy should >take care of that due to the memo - dictionary; this does not >seem to be the case. > >The following code works fine if Base does _not_ inherit >from object. If it does the result is: > >RuntimeError: maximum recursion depth exceeded You can increase the recursion limit using sys.setrecursionlimit() Daniel Klein From amberdelton at email.msn.com Sun Dec 2 22:27:54 2001 From: amberdelton at email.msn.com (amberdelton) Date: Sun, 2 Dec 2001 20:27:54 -0700 Subject: Very new to this References: <#k0oOh4eBHA.1192@cpimsnntpa03> <#EQGkj4eBHA.1188@cpimsnntpa03> <3C0AB92D.2010407@home.com> <#3jVur4eBHA.1404@cpimsnntpa03> <3C0AEF74.3080005@home.com> Message-ID: Well i am learning a lot then. One more question how do i get the script to close when it is finished? From mcherm at destiny.com Fri Dec 7 17:33:43 2001 From: mcherm at destiny.com (Michael Chermside) Date: Fri, 07 Dec 2001 17:33:43 -0500 Subject: Hiding stuff like passwords in source? Message-ID: <3C1143C7.10503@destiny.com> Well, I'm going to come out with an argument "proving" why what you want to do can't be done. Then I'm going to sit back and wait for one of the brilliant minds here on c.l.p to send in a script proving me wrong. You want your scripts to be able to enter passwords, but you DON'T want anyone to be able to get the passwords from the scripts. I could easily run your script in my environment where "/usr/bin/ssh" runs a program which captures passwords. So if your program EVER gives out a password, then it can't be secure. There are, however, a few ways around this. If all you want to do is to protect against people casually reading the passwords in the sourcecode of your script then your own solution works excellently. To do somewhat better, you could somehow program the scripts to only give out the password (ie, only run) if it's YOU sitting there. Now unless you've got a fingerprint reader attached to your machine, the only likely way of proving that it's "you" is for you to supply a password. Stupid though this sounds, it might actually solve your problem. You could write all the scripts so that they accept a 1st parameter of a "master_password". You'll have to type in this master_password every time you run every one of the scripts (yes, that's a pain!), but then you can code ftpid so that it accepts a master_password and only gives out the password if the master_password is given to IT by the script. Now you'd still have to type in ONE password every time you run anything, but at least it'd only be ONE password to remember. If you DO try this though, please keep in mind that .pyc files can be reverse compiled fairly easily (or just inspected byte-by-byte for strings), so you probably want to rewrite ftpid so it contains only an encoded version of your real password and uses master_password to decrypt it. Okay... how long before a c.l.p guru worms his/her way around my "proof"? -- Michael Chermside > Hello, > ... > > What I'm wondering is if there's a way to encrypt, > hide or otherwise modify the way I'm using my user > info so that unless I am logged in at my machine, the > user info is unusable and unreadable. > ... > > I'd really like to preserve the ability to just click > a script and have it run as "me", with my info and > password. I just don't want to let anyone else get at > that information or be able to use it... but I *do* > want to be able to easily give them the script so they > can type in their own information and have it work for > them on their server, etc. > > Any ideas? > > Thanks, > > -dB > > ===== > David Brady > daves_spam_dodging_account at yahoo.com > I'm feeling very surreal today... or *AM* I? > > From phr-n2001d at nightsong.com Mon Dec 10 23:40:53 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 10 Dec 2001 20:40:53 -0800 Subject: Client/server chat program References: <7xpu5m3ei9.fsf@ruckus.brouhaha.com> Message-ID: <7x667e9xnu.fsf@ruckus.brouhaha.com> Jonathan Gardner writes: > > The usual way to do this is use separate threads for reading input and > > displaying messages. > > Errr... not necessarily. Note that this is a chat program - you'll > want the seperate threads to work with each other. I find it easier > to program this sort of thing with only one thread and one process > that sees what can be done and does it without blocking. You can do it either way. The Unix telnet client uses separate processes, if I remember correctly. Yes, if you use threads, you do have to synchronize some of their operations, but the threading package provides ample mechanisms for that. From markj+0111 at cloaked.freeserve.co.uk Sun Dec 23 04:27:33 2001 From: markj+0111 at cloaked.freeserve.co.uk (MJ Ray) Date: Sun, 23 Dec 2001 09:27:33 GMT Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic References: <3218013921984060@naggum.net> Message-ID: New Scheme wrote: >Say what?? Let me just repeat Mr Rush's "warm and welcoming" post: [...] >hahaha the "friendly spirit" lives on does it?? hahaha How many places do you know that are warm and welcoming to anonymous idiots? Followups set. From mwh at python.net Thu Dec 6 10:45:13 2001 From: mwh at python.net (Michael Hudson) Date: Thu, 6 Dec 2001 15:45:13 GMT Subject: Suggestion for a change to a standard module - where? References: <9um7m0$ie9$1@peabody.colorado.edu> Message-ID: Fernando P?rez writes: > So, who should I talk to? http://www.python.org/patches/ Cheers, M. -- M-x psych[TAB][RETURN] -- try it From just at letterror.com Fri Dec 7 13:04:30 2001 From: just at letterror.com (Just van Rossum) Date: Fri, 07 Dec 2001 19:04:30 +0100 Subject: Calling a generator multiple times References: <200112061113290670.0100F457@mail.rdc1.sdca.home.com> <3C110807.5B739EAA@letterror.com> <63221us0j1tl0jbjkmeoocj09gmomvjj16@4ax.com> Message-ID: <3C110DEC.6537D21A@letterror.com> Courageous wrote: > > >You really need to dig into the python-iterators list archives. > >This has been discussed over and over and over. It's really > >not as bad as you think. You need to reset your brain, play > >with generators a bit more. It becomes really natural after > >a while. > > I don't have any personal problem with understanding them; > I've worked extensively with stackless prior to this. There's > no problem. I didn't mean generators _in general_, but the "simple generators" as they are implemented in Python 2.2 _specifically_. > What I have a problem with is the inconsistency between the > apparent definition and the result. Not even continuations > behave this way. Read the arguments for and against the current implementation in the python-iterators list archives. It's really not as bad as you say. A brain-reset might help... Just From max at alcyone.com Tue Dec 11 14:09:22 2001 From: max at alcyone.com (Erik Max Francis) Date: Tue, 11 Dec 2001 11:09:22 -0800 Subject: a class's coupling to its bases (was Re: __init__ concerns) References: <3C158FAA.DA4A4BF4@alcyone.com> <9v4ndu01sli@enews4.newsguy.com> Message-ID: <3C1659E2.6455141B@alcyone.com> Alex Martelli wrote: > Case [1]: when using a framework by subclassing framework-supplied > classes > > You would not WANT to know, if at all feasible, because it loosens the > coupling between your code and some application framework that you're > using, when you have to inherit from some class in the application > framework. Coupling should be held as loose as feasible (but no > looser than that...). I would think that in these kinds of situations, part of the contract would be that the base class would have some well-defined constructor argument list, or some set of well-defined lists to choose from. -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ Laws are silent in time of war. \__/ Cicero Esperanto reference / http://www.alcyone.com/max/lang/esperanto/ An Esperanto reference for English speakers. From andy at reportlab.com Wed Dec 12 09:35:54 2001 From: andy at reportlab.com (Andy Robinson) Date: Wed, 12 Dec 2001 14:35:54 -0000 Subject: UK Python event, April 3-6 2002 - speakers wanted! Message-ID: The Association of C and C++ Users is holding their conference on the above dates. There's lots of general stuff on XML, C, C++ and Java, with good speakers including Stroustrup himself. Location is still uncertain but somewhere between Oxford and Stratford-on-Avon (endpoints included). They have offered to host a Python track and I've got 2 days to find some speakers. Duncan Booth will give a Python tutorial, and I will do something on ReportLab. Can anyone else give talks? could be on anything from a case study to an app or library you would like to showcase. Please reply direct to me with a brief synopsis, speaker bio and desired time slot. Some Zope stuff would be welcome as well. Speakers can expect free admission and possibly expenses; for others the cost is likely to be under ?100 per day. This is the perfect opportunity for a 'first UK python conference' so let's go for it! Andy Robinson CEO and Chief Architect, ReportLab Inc. From maxm at mxm.dk Fri Dec 28 11:47:11 2001 From: maxm at mxm.dk (maxm) Date: Fri, 28 Dec 2001 17:47:11 +0100 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: <7$--$$_-----$%%$-$@news.noc.cabal.int> "Bill Tate" wrote in message news:cb4ba455.0112280631.731a5d72 at posting.google.com... > Ron Stephens wrote in message news:<3C2B9E04.9957801F at earthlink.net>... > I truly do commend and appreciate DC's contribution's to Python, but I > hope somebody can point to something (either examples or > documentation) that gives me a reason to try again. The funny thing is that it really isn't to complicated, but a few places it stops short of supplying the tools that is needed to make it simple and intuitive to learn. The problem is that it does it tricks by mixin-classes, or multiple inheritance if you will. And to get persistence you just mix in Persistance. To get folder like behaviour you just mix in Objectmanager. To get PropertyManager behaviour you mix in PropertyManager. The most common mixin class though is SimpleItem, and it gives you a lot of basic behaviour. So a class using all of the above would be defined like: class kicthenSink(ObjectManager, PropertyManager, SimpleItem): code ... Each of the mix-in classes has a rather well defined/documented Api and the source is available for browsing, so at some time when you get the "Zope Zen" it all clicks into place and becomes rather simple. The problem though is that it can be rather difficult until you got that zen. And the only way to get there is to actually go ahead and try build something in it. As far as I am concerned it's all just a documentation problem. regards Max M ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.berkeley.edu!ucberkeley!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "maxm" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:02:52 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775219 27193 211.57.49.2 (31 Dec 2001 05:06:59 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:06:59 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From joya at foretec.com Mon Dec 10 13:54:20 2001 From: joya at foretec.com (Joya Subudhi) Date: Mon, 10 Dec 2001 13:54:20 -0500 Subject: Python Conference News Message-ID: <3C1504DB.B58D68D8@foretec.com> Python 10 Conference News Tim Berners-Lee, Director of the World Wide Web Consortium, and Andrew Koenig, Principal Research Staff Member at AT&T Shannon Laboratory, will give the keynote addresses. Tim Berners-Lee will speak on "Webizing Python" and Andrew Koenig will discuss "Notes from a Polygot Outsider." The entire program of the Refereed Paper Track is complete. You can view the titles and authors of all the presentations within each session and check out nominations for the Best Paper Award on the Python 10 Web site. The Tutorials Day program is also complete. Silver Sponsors of Python 10 are: Hostway Corporation: http://www.hostway.com and New Riders Publishing: http://www.newriders.com Registration for Python 10 is open. Save with early bird registration rates when you register online before January 7, 2002. To register and for conference details, visit: http://www.python10.org The Tenth International Python Conference February 4th through February 7th The Hilton Alexandria Mark Center Alexandria, Virginia From keyton at weissinger.org Fri Dec 28 14:33:53 2001 From: keyton at weissinger.org (A. Keyton Weissinger) Date: Fri, 28 Dec 2001 14:33:53 -0500 Subject: O'Reilly book production (was Re: Wine applicability) In-Reply-To: Message-ID: I've written two books for O'Reilly, one of which has two editions out. The Word template works very well for me. Now FrameMaker, their production application sucks, but fortunately you rarely have to deal with that. Keyton > -----Original Message----- > From: python-list-admin at python.org > [mailto:python-list-admin at python.org]On Behalf Of Aahz Maruch > Sent: Friday, December 28, 2001 12:42 PM > To: python-list at python.org > Subject: O'Reilly book production (was Re: Wine applicability) > > > In article , > Alex Martelli wrote: > >"Cameron Laird" wrote in message > >news:200112281642.KAA24897 at starbase.neosoft.com... > >>Alex: > >>> > >>>that's my primary need -- Word with O'Reilly customized macros &c, > >>>as that's what I'm required to use for one of the books. So, I > >> > >> O'REILLY MAKES YOU USE WORD MACROS?!??!!? > >> I've got to talk with those boys. That strikes me as an atrocity. > > > >"makes" is probably an overbid. The Cookbook I'm doing in XML with a > >custom DTD, and that's just fine - I get to use VIM:-). But for the > >Nutshell, that wasn't an option. > > Really? May you explain why? (I'm still hoping to do a book with > O'Reilly and I *really* don't want to use Word.) > -- > --- Aahz <*> (Copyright 2001 by aahz at pobox.com) > > Hugs and backrubs -- I break Rule 6 > http://www.rahul.net/aahz/ > Androgynous poly kinky vanilla queer het Pythonista > > Tenth Virtual Anniversary: 3 days and counting > -- > http://mail.python.org/mailman/listinfo/python-list > > From jkraska at san.rr.com Sun Dec 23 13:35:01 2001 From: jkraska at san.rr.com (Courageous) Date: Sun, 23 Dec 2001 18:35:01 GMT Subject: Looping constructs References: <3c25d37e_9@news.newsgroups.com> Message-ID: On Sun, 23 Dec 2001 13:53:02 +0100, "Janos Blazi" wrote: >There is one thing I envy Perl programmers: they have several nice looping >constructs and Python has almost none. For exmaple redo unless can be nice >sometimes and they have several others. What do you think about adding such >contructs to Python? The fewer loop forms to choose from, the more comprensible the code is to a stranger who has never seen it. Such is a mantra of the zen of python. Comparing Python to Perl. For shame. Perl is a write only language. C// From jegnet at cadvision.com Thu Dec 20 18:39:56 2001 From: jegnet at cadvision.com (jegnet) Date: Thu, 20 Dec 2001 23:39:56 GMT Subject: Raw sockets References: <2c55c8be.0112201244.2e4e1027@posting.google.com> Message-ID: By raw sockets I presume you mean being able to manipulate Mac Headers Etc for making packets there is http://pylibnet.sourceforge.net/ for sniffing packets there is http://sourceforge.net/projects/pylibpcap/ I was able to get pylibpcap to compile under windows but not pylib net Grant Edwards wrote: > In article , Cliff Wells wrote: > > On Thu, 20 Dec 2001 21:29:23 GMT > > grante at visi.com (Grant Edwards) wrote: > > > >> > I've got the impression that you need the tighter control over > >> > TCP that raw sockets allows, > >> > >> Tighter control than raw sockets? Raw sockets is as low-level > >> as it gets. You even have to put the Ethernet addresses in > >> yourself. > > > > He said "that" not "than". Changes the meaning entirely =) > > Duh. I read it several times and it was different on _my_ > screen. Honest. > > -- > Grant Edwards grante Yow! Hello. I know > at the divorce rate among > visi.com unmarried Catholic Alaskan > females!! From phr-n2001d at nightsong.com Fri Dec 21 07:59:59 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 21 Dec 2001 04:59:59 -0800 Subject: marshalling data structures between perl <-> php <-> python References: Message-ID: <7x1yho20fk.fsf@ruckus.brouhaha.com> Tripp Scott writes: > aside from using XML-RPC, what python module can i use to marshall > data structures (possibly a combination of lists, dictionaries, and > scalars of ints, floats, ascii strings, and null values) between these > three languages? i prefer a compact, common binary format rather than > XML. XDR, maybe. From teg at redhat.com Mon Dec 31 13:41:15 2001 From: teg at redhat.com (Trond Eivind =?iso-8859-1?q?Glomsr=F8d?=) Date: 31 Dec 2001 13:41:15 -0500 Subject: /usr/bin/env: python: No such file or directory References: <9vivft$593$1@peabody.colorado.edu> <171220010818339518%jwbaxter@spamcop.net> <9vnvue$m5d$1@peabody.colorado.edu> <9vo6ng$mhs$1@nntp6.u.washington.edu> Message-ID: nbecker at fred.net writes: > >>>>> "Aloysius" == Aloysius Toh writes: > > Aloysius> Redhat 7.2 has both 1.5 and 2.1 > > Yes. Since RedHat scripts require 1.5, they should say so > explicitly. It doesn't. If you have python 2.2 and newt installed, some scripts will work. If you add the libglade, pygtk etc for it, even more will. I doubt there is much version-specific python code. -- Trond Eivind Glomsr?d Red Hat, Inc. From robin at jessikat.fsnet.co.uk Sun Dec 9 16:56:26 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Sun, 9 Dec 2001 21:56:26 +0000 Subject: join vs instances References: Message-ID: In article , Brad Bollenbach writes ..... >Of course it's expected that you can't get away with simply referring to >the instance directly and expecting a string to pop out, but can you >give an example of a gotcha with a UserString vs. builtin (that is to say, >a scenario where you the difference between the two will make it >impossible for you to write code that won't break)? > > >Brad well since UserStrings can be added to strings eg >>> from UserString import UserString >>> u = UserString('U') >>> u+'a' 'Ua' >>> 'a'+u 'aU' >>> I had expected that the join operation would also apply to UserStrings somehow or that there would be some magic method that would allow join to be applied to user strings, but I can't find out how. What is the primitive implementation of join? -- Robin Becker From johnroth at ameritech.net Mon Dec 3 14:40:12 2001 From: johnroth at ameritech.net (John Roth) Date: Mon, 3 Dec 2001 11:40:12 -0800 Subject: Draft PEP: string interpolation with backquotes References: <9ueh23$9e8$1@peabody.colorado.edu> Message-ID: "Fernando P?rez" wrote in message news:9ueh23$9e8$1 at peabody.colorado.edu... > John Roth wrote: > > > > > "Oren Tirosh" wrote in message > > news:mailman.1007298422.20078.python-list at python.org... > > > > I don't see what I could do with this that I couldn't do with the > > '%' operator. > > Someone help me out on this? > > > > John Roth > > Here's a copy of an older post of mine. It concerned another pep > implementing the same idea with $ instead of ``. But the discussion > is the same: > > > --------------# begin paste > > My important point is that Ping's PEP allows a clear way of saying > > "x is $x, f(x) is $f(x)" > > This to me is readable, unambiguous and very useful. Currently we > have a few options. Please keep in mind that this is really important > only when the string and evaluations to handle grows dramatically in > size and complexity. Think of 50 line strings with 100 complex > expression evaluations embedded (and yes, things like that can happen > fairly easily): I do tend to do things like that frequently when I'm doing a debug print statement. Otherwise, it's not something I write a lot. John Roth From rayvd at pacbell.net Mon Dec 3 21:07:11 2001 From: rayvd at pacbell.net (Ray Van Dolson) Date: Tue, 04 Dec 2001 02:07:11 GMT Subject: Baffled by httplib and SSL! Message-ID: I'm having some real frustrating problems making an HTTPS client using httplib. Here's the code I've got and the errors I'm getting: def post_url2(url, params, cookies = None): """Another feeble attempt""" global DEBUG h = httplib.HTTPSConnection('www.dotster.com') h.set_debuglevel(DEBUG) params = urllib.urlencode(params) headers = {'Content-Type': 'application/x-www-form-urlencoded'} if cookies != None: cookieString = cookies.pop(0) for cookie in cookies: cookieString = cookieString + "; " + cookie headers['Cookie'] = cookieString h.request('POST', url, params, headers) while 1: response = h.getresponse() if response.status != 100: break h._HTTPConnection__state = httplib._CS_REQ_SENT h._HTTPConnection__response = None return response post_url2("https://blahblah", {"fdsafa": "dfjadja"}, \ ["SessionTest=enabled"]) Here's the debug output: send: 'POST https://www.dotster.com/account/login/login.asp HTTP/1.1\r\n' send: 'Host: www.dotster.com:443\r\n' send: 'Accept-Encoding: identity\r\n' send: 'Content-Length: 33\r\n' send: 'Cookie: SessionTest=enabled\r\n' send: 'Content-Type: application/x-www-form-urlencoded\r\n' send: '\r\n' send: 'Acct_Name=private&Password=private' And now it just hangs. Just sits there doing nothing until I hit ctrl-c-- here's the traceback: Traceback (most recent call last): File "./test.py", line 10, in ? main() File "./test.py", line 7, in main return common.post_url2 ("https://www.dotster.com/account/login/login.asp", {'Acct_Name': 'private', 'Password': 'private'}, ["SessionTest=enabled"]) File "./common.py", line 72, in post_url2 response = h.getresponse() File "/usr/lib/python2.2/httplib.py", line 570, in getresponse response = self.response_class(self.sock, self.debuglevel) File "/usr/lib/python2.2/httplib.py", line 98, in __init__ self.fp = sock.makefile('rb', 0) File "/usr/lib/python2.2/httplib.py", line 607, in makefile buf = self.__ssl.read() KeyboardInterrupt As you can see it's hanging at the sock.makefile() line in httplib (within the HTTPResponse class). This appears to be some sort of SSL glitch, but I have found almost NO documentation on SSL in Python and really don't know where to start. The posts on Google were far and few between and didn't really offer much help. Has anyone out there worked much with httplib and SSL sites? Your expertise would be greatly appreciated! Thanks, Ray Van Dolson From shalehperry at attbi.com Mon Dec 24 00:00:50 2001 From: shalehperry at attbi.com (Sean 'Shaleh' Perry) Date: Sun, 23 Dec 2001 21:00:50 -0800 (PST) Subject: f(n=4) works; bug or feature? In-Reply-To: <3C26B3DA.4000102@erols.com> Message-ID: On 24-Dec-2001 Edward C. Jones wrote: > In Python 2.2, the following code prints a "4". > > def fun(n): > print n > > fun(n=4) > > Bug or feature? > feature. It is called a keyword argument. def func(a, b, c): print a print b print c func(b = 1, a = 8, c = 'hello') The idea here is you can call the function with the arguments in any order as long as you know their names. Hnady for long function calls like gui toolkits or network code. From jkraska at san.rr.com Sat Dec 29 17:23:03 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 29 Dec 2001 22:23:03 GMT Subject: REPOST: Re: Is learning Python "extraordinary"? References: Message-ID: <9$--$$_----____$$$@news.noc.cabal.int> >I am a high school senior, and like many others, I am applying >to college. I am applying to MIT (as well as many other schools). >MIT describes what they are looking for as students who do or have >done "extraordinary things". *shrug* Given the apathy of the vast majority of high school students, any amount of self-initiative is in itself an extraordinary thing. As a high school student, if you were authoring Python extensions, now that would be genuinely extraordinary. For that matter, contributing to the IT community in any way as a high school student is remarkable. Don't be afraid to stroke your own rhubarb, as it were, on a college admissions test. You don't get points for modesty and a self-deprecating nature on that type of thing. Trust me on this. Brag. C// ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Courageous Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:00:58 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774523 27193 211.57.49.2 (31 Dec 2001 04:55:23 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:55:23 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From peter at engcorp.com Thu Dec 6 22:11:19 2001 From: peter at engcorp.com (Peter Hansen) Date: Thu, 06 Dec 2001 22:11:19 -0500 Subject: list comprehensions to effect visitors References: <3C0FD573.B1EB891E@bioreason.com> <200112061337430460.01850546@mail.rdc1.sdca.home.com> <3C0FF014.CE683AA4@bioreason.com> Message-ID: <3C103357.2B4E4C1D@engcorp.com> Bruce Eckel wrote: > > I am in fact feverishly translating "Thinking in Patterns" into > "Thinking in Python" to prepare for my tutorial at the Python > conference, which is due monday. I was certain it would be an > enormous job as it was with C++ and Java to write these examples, > but as usual Python changes everything, and I might even hit the > deadline. Why not post some of the samples here as a translation exercise? I'm sure there would be a few people interested in helping translate some of them over the weekend. People with no lives. (No, not people like me. I meant *other* people... ;-) the-c.l.p-community-is-a-large-part-of-python's-advantages-ly yr's, ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From keyton at weissinger.org Fri Dec 7 19:59:05 2001 From: keyton at weissinger.org (A. Keyton Weissinger) Date: Fri, 7 Dec 2001 19:59:05 -0500 Subject: Good book for Learning Python?? In-Reply-To: <9urnki+qeq5@eGroups.com> Message-ID: diveintopython.org if you have some programming experience. Mark Pilgrim has done an excellent job. Keyton -----Original Message----- From: python-list-admin at python.org [mailto:python-list-admin at python.org]On Behalf Of gsmickle Sent: Friday, December 07, 2001 7:42 PM To: python-list at cwi.nl Subject: Good book for Learning Python?? Hello All, I am new to the list and would like to get some input on some good books for learning Python? Thanks, Greg -- http://mail.python.org/mailman/listinfo/python-list From woodsplitter at rocketmail.com Sun Dec 30 22:54:08 2001 From: woodsplitter at rocketmail.com (stalin) Date: 30 Dec 2001 19:54:08 -0800 Subject: wxBitmapFromImage function in wxPython? References: <3C2F7BB3.577D3712@cti.ecp.fr> Message-ID: <7876a8ea.0112301954.2dc7d8b8@posting.google.com> Stephane SOPPERA wrote: > I read in the documentation of wxPython that this function exists: > wxBitmapFromImage(image, depth=-1) > ... > It's not in dir(wxPython.wx). > I'm using python 2.1. You don't mention what version of wxPython you're using, but I know that wxBitmapFromImage is supported by wxPython 2.3.2.1, the version I'm using. c:\>python -c "from wxPython.wx import *; print wxBitmapFromImage" From syver-en+usenet at online.no Fri Dec 7 22:28:51 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 08 Dec 2001 04:28:51 +0100 Subject: request: more samples for Pymacs, please Message-ID: I am using win2k and python2.1, GNU Emacs and pymacs works great. It would be nice with some more samples on how to do things though. I had to do some tweaks to the installation of pymacs to get it to run on a win2k box, but nothing intrusive. -- Vennlig hilsen Syver Enstad From bsturk at news.rcn.com Thu Dec 13 02:59:35 2001 From: bsturk at news.rcn.com (Brian Sturk) Date: 13 Dec 2001 07:59:35 GMT Subject: popen3 on windows and interactive subprocesses Message-ID: I have a script that is run from within the editor vim. It uses popen2.popen3 to run cmd.exe. I then grab stdout and submit commands to it via stdin. It works pretty well right now except for one thing. When I spawn an *interactive* process, like ftp or cleartool I no longer see anything on stdout after it's launched. Is this possibly because the app is writing directly to the win32 console? Any help/ideas greatly appreciated. The script, for those curious vim users, is located here: http://www.nh.ultranet.com/~bsturk/vim.html -- .-----------------------------------------------------,-------. | Brian M. Sturk - http://www.nh.ultranet.com/~bsturk \ C/C++ | .> )\,^a__ |--------------------------| bsturk at nh.ultranet.com | Java | ( _ _)/ /-." ~ | http://www.telengard.com `---------------------------`------| `( )_ )/ | Telengard Technologies Inc. - NT/*nix UI & device drivers | _<_s_<_s '-------------------------------------------------------------' From DaveP at dpawson.freeserve.co.uk Mon Dec 3 16:41:52 2001 From: DaveP at dpawson.freeserve.co.uk (Dave Pawson) Date: 3 Dec 2001 21:41:52 GMT Subject: 2.1.1 and regexp Message-ID: Can anyone straighten me out on the history / future of regexp in python please. Present (2.1.1) documentation implies that re will be replaced by sre. http://www.python.org/doc/current/lib/module-re.html Is that the plan please? regards DaveP From joonas at olen.to Sat Dec 8 16:18:06 2001 From: joonas at olen.to (Joonas Paalasmaa) Date: Sat, 08 Dec 2001 23:18:06 +0200 Subject: Parsing vrml into a tree Message-ID: <3C12838E.282BB653@olen.to> How can I parse vrml into a plain tree (dictionary or list) with mcf.vrml? From robin at jessikat.fsnet.co.uk Mon Dec 10 12:17:40 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Mon, 10 Dec 2001 17:17:40 +0000 Subject: "import" analysis References: Message-ID: In article , Sylvain Thenault writes >I didn't found anything interesting about this on google: > >does anyone know a tool which parse a project's files and tell you which >modules are imported but not present in the parsed project nor in the >standard python library ? > >TIA > search for python installer, Gordon's stuff does a good job at this. -- Robin Becker From markj+0111 at cloaked.freeserve.co.uk Sat Dec 22 20:20:37 2001 From: markj+0111 at cloaked.freeserve.co.uk (MJ Ray) Date: Sun, 23 Dec 2001 01:20:37 GMT Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic References: <3218013921984060@naggum.net> Message-ID: Erik Naggum wrote: > No, it is not. It is time to leave Scheme behind. [...] Oh joy. I thought I saw the last Naggum post when I unsubbed from comp.lang.lisp. Are you still sore that Scheme is installed on far more computers than oxymoronically-named "Common" Lisp? > If you are not welcome in the Scheme community, take a hint: Leave. [...] The Scheme community is a warm and welcoming place compared to the Common Lisp one, I think. The the open, academic-yet-practical, friendly spirit of Lisp lives on in comp.lang.scheme and numerous general lisp mailing lists. We just don't like anonymous posters saying that we got it all wrong. From stuck at work.com Wed Dec 19 18:34:52 2001 From: stuck at work.com (Mick) Date: Thu, 20 Dec 2001 10:34:52 +1100 Subject: Compiling for DOS Message-ID: <3C21241C.5192B283@work.com> Hi all Forgive me for I am new What steps do I need to take to create an exe or com file use of a python script in dos or windows command prompt. Thanks Mick From kragen at pobox.com Sun Dec 16 16:41:30 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 16 Dec 2001 16:41:30 -0500 Subject: Compiling Python with Tkinter References: Message-ID: <837krmalmd.fsf@panacea.canonical.org> Ben Ocean writes: > After correcting a few mistakes to which you brought my attention, I now > get this output upon attempting make: > /opt/tcltk/include/tk.h:83:29: X11/Xlib.h: No such file or directory > This file does *not* exist, anywhere... > I never use XWindows, so I'm wondering if it's even installed properly, or > if I really need it for Tkinter. Your advice? What do you want Tkinter for if you don't use X Windows? What platform are you trying to build this stuff on? Tk has front-ends for X, Microsoft Windows, and the Mac; it needs one of these around in order to compile at all. From idoerg at cc.huji.ac.il Thu Dec 27 05:03:14 2001 From: idoerg at cc.huji.ac.il (Iddo) Date: 27 Dec 2001 02:03:14 -0800 Subject: REPOST: long lines in HTML attachments Message-ID: <0$--$$-$$$$%%---_$@news.noc.cabal.int> Hi, I am trying to use smtplib and mimecntl to email an attached html document. The trouble is that the html document contains some very long physical lines (500 chars). It is important that those lines be preserved as such, since I use

 formatting in the htdoc. Some
mail clients (e.g. Pine 4.40) truncate or insert a linefeed in those
lines, creating a mess. Any way of attaching my long-lined files and
getting them through intact? Following is a code snippet of what I do.
Any help would be appreciated.

Thanks,

Iddo
---------------------------------- CUT HERE --------------------------


def email_with_attachments(to_addr, subject, msg_string, attachment):
    f = mimecntl.MIME_document("",type='text/plain')
    f.write(msg_string)
    # Create the message + attachment
    attach = mimecntl.MIME_recoder()
    att_file = open(attachment[1],"r")
    att_stream = att_file.read()
    attach.write(att_stream)
    attach['content-type']=mimecntl.MIMEField('content-type',attachment[0],
                                                   
name=attachment[1])
    attach['content-length']=mimecntl.MIMEField(
                                   'content-length',
                                   len(att_stream))
    attach['content-disposition']=mimecntl.MIMEField(
                                   'content-disposition',
                                   'attachment', 
                                    filename=attachment[1])
    msg = mimecntl.MIME_document((f,attach), 
                                  From='myself at myserver.org',
                                  To=to_addr,Subject=subject)
    # send msg using smtp
    smtp = smtplib.SMTP('localhost')
    smtp.sendmail('myself at myserver.org',to_addr,msg.dump())
    smtp.quit()
if __name__ == '__main__':
    attach_info = ('text/html','/my/html_file.html')
    email_with_attachments('you at youraddress','hi there',attach_info)

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: idoerg at cc.huji.ac.il (Iddo)
Newsgroups: comp.lang.python
Subject: cmsg cancel <7a256ac1.0112270203.77efb6f2 at posting.google.com>
Control: cancel <7a256ac1.0112270203.77efb6f2 at posting.google.com>
Date: Mon, 31 Dec 2001 03:28:01 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775850 27193 211.57.49.2 (31 Dec 2001 05:17:30 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:17:30 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From ben at wblogan.net  Sat Dec  8 11:30:02 2001
From: ben at wblogan.net (Ben Logan)
Date: Sat, 8 Dec 2001 11:30:02 -0500
Subject: Need help with regular expression
Message-ID: <20011208113002.A21206@newcreature.org>

Hello,

I am writing a program in which I need to search an arbitrary string
and return the part between a certain opening sequence, and a closing
sequence.  This is a relatively common thing for me, and I have yet to
figure out a good way to do it.

Here's a first shot:

regXstr = r"""<<\s+(.+?\s+)>>"""

Here, the beginning delimiter is '<<' and the ending is '>>'.  The
grouping parens are because I want to capture whatever is between the
starting and ending sequences, exclusive of any leading whitespace.
 
The above RE works just fine except that I can't have the ending
sequence in the string.  I want to be able to "escape" the ending
sequence with either double quotes (">>") or single quotes ('>>').

I can't seem to figure out how to do this, though.  Can anyone give me
any ideas?

Thanks,
Ben

-- 
Ben Logan: ben at wblogan dot net
OpenPGP Key KeyID: A1ADD1F0



From rumjuggler at cryptarchy.org  Sun Dec  9 02:34:41 2001
From: rumjuggler at cryptarchy.org (Ben Wolfson)
Date: Sun, 09 Dec 2001 07:34:41 GMT
Subject: Does 'super' exist?
References: 
Message-ID: 

On Sat, 08 Dec 2001 19:03:12 -0800, "Bruce Eckel" 
wrote:

>It's a little hard to tell, does 'super' exist in 2.2? If so, where
>might I find the syntax? Thanks.

Probably the best place to look is www.python.org/2.2/descrintro.html .
super is in 2.2.

-- 
Barnabas T. Rumjuggler
You're going to set me up as a kind of slovenly attached pig that
Jack Kornfeld can slice down in his violent zen compassion?
 -- Larry Block


From jkraska at san.rr.com  Fri Dec 14 01:12:39 2001
From: jkraska at san.rr.com (Courageous)
Date: Fri, 14 Dec 2001 06:12:39 GMT
Subject: Wrap C function which takes variable lengthed parameters?
References: 
Message-ID: <6p5j1u0oag2ofkam8o7fig5dvkfc2392hk@4ax.com>

On 14 Dec 2001 06:07:31 GMT, "{-- Rot13 - Hateme"  wrote:

>How to wrap a C function which takes variable lengthed
>parameter? Any one has such experience?

Ouch! There's a way to do this, if I recall. Something to do
with generating the varargs and prepping it correctly. Whether
or not you can do this _portably_ is not something that I recall.

C//



From rcena at epcor.ca  Fri Dec 28 23:52:51 2001
From: rcena at epcor.ca (Resty Cena)
Date: 28 Dec 2001 20:52:51 -0800
Subject: REPOST: Re: Python Popularity: Questions and Comments
References: <3C2A9D33.67FEC261@earthlink.net>  
Message-ID: <3$--$$_----_-%-$%$@news.noc.cabal.int>

The real source of growth for both Python and Ruby are the 3M VB
developers worldwide. Whichever can provide what it is that VB
developers like about VB on top of what Python and Ruby natively offer
will hit the jackpot. To me these are: (a) Visual drag-and-drop
application builder with data aware controls, and (b) good support for
the big databases (Oracle, Sybase, Informix). I'm going through the
gui chapters of Mark Lutz' PP2E, and while I can see that handcrafting
gui this way gives me a lot of control, I'm thinking I don't want to
do this -- I'm a database application developer. I want to write a
dynamic work order system and I have no ambition to become a system
tool maker. And so do the 3M VB developers.

VB used to be a toy language. Not too long ago no respectable company
would use VB for their corporate systems. It did not start to become
an enterprise solution until VB3. What happened there?

VB 6 will be retired in favor of VB.NET. Personally I think that the
direction VB has taken, towards a verbose C#, is misguided. VB should
have evolved into something like Python or Ruby. With VB.NET, VB
programmers will ask, "What's the point?" Might as well dive into C#.
Or look around for something else.

Hopefully by that time -- 18 months from now? -- Python and/or Ruby
will have what it is VB programmers cannot live without.

Folks, come up with (a) and (b) above, then start posting at c.l.vb. 
 

Paul Prescod  wrote in message news:...
> Dave Thomas wrote:
> > 
> > ... Instead, Ruby will attract folks from outside the
> > Python world. Ruby and Python differ in philosophy and _feel_. Some
> > folks like one, some the other. I don't see it as competition. I see
> > it as choice.
> 
> Is there really a difference? Pepsi and Coke are choices. They are also
> in competition. They have a somewhat different taste but are more
> similar than different. In the long run, there will come a day when
> they've taken as much of the market share of other drinks away as they
> will, and the primary competition will be between the two of them.
> 
>  Paul Prescod

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: rcena at epcor.ca (Resty Cena)
Newsgroups: comp.lang.python
Subject: cmsg cancel <458b194a.0112282052.1123341 at posting.google.com>
Control: cancel <458b194a.0112282052.1123341 at posting.google.com>
Date: Mon, 31 Dec 2001 01:32:59 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775419 27193 211.57.49.2 (31 Dec 2001 05:10:19 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:10:19 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From erik at pythonware.com  Fri Dec 14 15:00:40 2001
From: erik at pythonware.com (Erik Heneryd)
Date: Fri, 14 Dec 2001 21:00:40 +0100 (CET)
Subject: PythonWare: Anyone using for real projects?
In-Reply-To: 
Message-ID: 

On Fri, 14 Dec 2001, A. Keyton Weissinger wrote:

> I read this review:
> http://www.webreview.com/2001/07_20/developers/index02.shtml
>
> and have stayed away.

As a PythonWorks developer I can't say I agree much with Mertz review. One
gets the impression it's written in a hurry, without giving Works the time
to do it justice. Unfortunatly, Mertz review is one of the only Python IDE
reviews online (the only one?).

Why not try PythonWorks out yourself? The evaluation version of 1.3 will
be available shortly with more than 450 improvements/fixes over 1.2.

http://www.pythonworks.com (for those of you who can't wait, theres 1.2)


/Erik Heneryd, Secret Labs (yes, I'm totally unbiased)





From jason at jorendorff.com  Wed Dec  5 18:51:58 2001
From: jason at jorendorff.com (Jason Orendorff)
Date: Wed, 5 Dec 2001 17:51:58 -0600
Subject: Baffled by httplib and SSL!
In-Reply-To: 
Message-ID: 

Dieter Maurer  wrote:
> As of HTTP 1.1, the request locator should contain the full
> URI, including the host part and (I think) the protocol part.

Not exactly.  A careful reading of section 5.1.2 of RFC 2616
(http://rfc.net/rfc2616.html) reveals that an HTTP/1.1 client MUST
send only the path, and not the whole URI, on the Request-Line,
unless the request is being made of a proxy.  Therefore this
request is in error:
  POST https://www.dotster.com/account/login/login.asp HTTP/1.1

However, the spec also says that HTTP/1.1 servers MUST correctly
handle both cases!  So it seems likely that this isn't the
problem after all.

-- 
Still-baffled-ly y'rs,
Jason Orendorff
http://www.jorendorff.com/




From dalke at dalkescientific.com  Wed Dec 19 22:47:24 2001
From: dalke at dalkescientific.com (Andrew Dalke)
Date: Wed, 19 Dec 2001 20:47:24 -0700
Subject: Improve performance for writing files with format modification
References: 
Message-ID: <9vrmpb$r64$1@slb6.atl.mindspring.net>

christine.bartels at teleatlas.com:
>I need some help to improve a function that formats a string and
>writes the result to a file.
>...
>file = open(filein,"r")
>nfile = open(fileout,"w")
>while 1:
>    fblock = file.readlines(0x2000)
>    if not fblock:
>        break
>    for i in fblock:
>        nfile.write("%20s%10s" % tuple(split(';')))
>nfile.close()
>...

It appears this takes a bunch of lines of the form
value1;value2

and formats them as 20 columns for value1 and 10 for value2.

I assume somewhere you did a 'from string import *', so
that split is in the local namespace?  And that the
split(';') is really split(i, ';')?  And that there's a
missing "\n"?

In other words, that the inner loop is written

    for i in fblock:
        nfile.write("%20s%10s\n" % tuple(string.split(i, ';')))

(btw, 'i' is usually used to store an integer - it throws me
off to see it holding a string.)

There's only a few ways to make that go faster

 - make sure the code is inside of a function.  Local variable
lookups (as inside a function) are faster than module-level
functions.  This is probably the biggest performance impact
in the code you presented.

 - you can manually cache the lookup for nfile.write, tuple, and
split.

Try this

def convert(file, nfile):
    write = nfile.write  # cache the attribute lookup to a local variable
    tupl = tuple  # cache the __builtin__ lookup to a local variable
    splt = split  # cache the module lookup to a local variable
    while 1:
        fblock = file.readlines(0x2000)
        if not fblock:
            break
        for i in fblock:
            write("%20s%10\n" % tupl(splt(i, ';')))

file = open(filein,"r")
nfile = open(fileout,"w")
convert(file, nfile)
file.close()
nfile.close()

                    Andrew
                    dalke at dalkescientific.com





From calves at coelce.com.br  Fri Dec 21 13:25:25 2001
From: calves at coelce.com.br (Alves, Carlos Alberto - Coelce)
Date: Fri, 21 Dec 2001 15:25:25 -0300
Subject: FW: Comunicating through COM ports
Message-ID: <29A97D00F387D411AC7900902770E148032F419E@LCOEEXC01>

Sorry, but as I said before, I'm under windows98 and I haven't such
directory.
Do I need to download that module from anywhere?!If so, give me an URL.


-----Original Message-----
From: David Lees [mailto:deblnonospammyno at raqia.com] 
Sent: Friday, December 21, 2001 1:46 PM
To: python-list at python.org
Subject: Re: FW: Comunicating through COM ports


Python21/scripts/PythonSerial

david lees


> "Alves, Carlos Alberto - Coelce" wrote:
> 
> Thanks for the example. But, where can I find such module Serial?!
> 
> -----Original Message-----
> From: David Mallwitz [mailto:dmallwitz at cox.rr.com]
> Sent: Thursday, December 20, 2001 10:26 PM
> To: python-list at python.org
> Subject: Re: Comunicating through COM ports
> 
> Comunicating through COM portsChapter 19 of Mark Hammond and Andy
> Robinson's
> 'Python Programmingon on Win32' covers this quit well, and with the
> Activestate Python distro there is a multithreaded demo called
> 'win32comport_demo.py'. But here's what I do - example is from a
> console
> connection to an old Cisco router.
> 
> >>> from Serial import Serial
> >>> ### open the COM1 port
> >>> serialconfig = Serial.PortDict()
> >>> serialconfig['port'] = Serial.COM1
> >>> serialconfig['rxBufSize'] = 4096
> >>> port = Serial.Port(serialconfig)
> >>> port.open()
> >>> port.write('show conf \r')
> >>> x = port.read()
> >>> x
> 'show conf \r\nUsing 768 out of 32762 bytes\r\n!\r\nversion 11.1\r\nno
> 
> service u
> dp-small-servers\r\nno service tcp-small-servers\r\n!\r\nhostname
> Router\r\n!\r\
> n!\r\nip subnet-zero\r\nno ip domain-lookup\r\n!\r\nhub ether 0 1\r\n
> link-test\
> r\n auto-polarity\r\n!\r\nhub ether 0 2\r\n link-test\r\n
> auto-polarity\r\n!\r\n
> hub ether 0 3\r\n link-test\r\n auto-polarity\r\n --More-- '
> 
> Best,
> Dave
> 
> "Alves, Carlos Alberto - Coelce"  wrote in
> message
> news:mailman.1008852145.28654.python-list at python.org...
> Anybody could give me an example code of how connect/comunicate
> through COM
> ports (i.e. COM1, COM2). I'm under windows 98.
> Thanks!!!
> Carlos Alberto
> COELCE/DPRON-Departamento de Projetos e Obras Norte
> Fone: 677- 2228
> e-mail: calves at coelce.com.br
> \|||/
> (o o)
> --ooo0-(_)-0ooo--
> 
> -----=  Posted via Newsfeeds.Com, Uncensored Usenet News  =-----
> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
>  Check out our new Unlimited Server. No Download or Time Limits!
> -----==  Over 80,000 Newsgroups - 19 Different Servers!  ==-----
> --
> http://mail.python.org/mailman/listinfo/python-list

-- 
debl
-- 
http://mail.python.org/mailman/listinfo/python-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 

From loewis at informatik.hu-berlin.de  Fri Dec 21 12:16:34 2001
From: loewis at informatik.hu-berlin.de (Martin von Loewis)
Date: 21 Dec 2001 18:16:34 +0100
Subject: How can I display unicode in Tk widget
References: <9vkqm7$fqo83$1@ID-12869.news.dfncis.de>  <9vnou6$gpvgr$1@ID-12869.news.dfncis.de>  <9vunds$hiile$1@ID-12869.news.dfncis.de>
Message-ID: 

"Kick"  writes:

> Would You like tell me what could I do?

No. Not at all. Not with the kind of information that you are providing.

Please post a small snippet of source code you are trying to run, and
report what software version you are using, and what the snippet does
when run on your system. Perhaps *then* somebody has grounds to make
valuable suggestions.

Regards,
Martin



From lynn at garlic.com  Fri Dec 28 14:21:58 2001
From: lynn at garlic.com (Anne & Lynn Wheeler)
Date: Fri, 28 Dec 2001 19:21:58 GMT
Subject: A new forum is up! Q: what means nntp
References: <40dbad98.0112262238.73fc14f9@posting.google.com>    
Message-ID: 

claird at starbase.neosoft.com (Cameron Laird) writes:
> RFC 765  FILE TRANSFER PROTOCOL                        June     1980
> RFC 821  SIMPLE MAIL TRANSFER PROTOCOL                 August   1982
> RFC 854  TELNET PROTOCOL SPECIFICATION                 May      1983
> RFC 850  Standard for Interchange of USENET Messages   June     1983
> RFC 977  Network News Transfer Protocol                February 1986

765 is the latest standard .... there is a trail of previous RFCs that
were replaced by the latest ... going back to 

354 -
File Transfer Protocol, Bhushan A., 1972/07/08 (29pp) (.txt=58074)
(Obsoleted by 542) (Updated by 385, 454, 683) (Obsoletes 264, 265)

precursor to 821

788 -
Simple Mail Transfer Protocol, Postel J., 1981/11/01 (62pp)
(.txt=109001) (Obsoleted by 821) (Obsoletes 780)

precursor to 854

764 -
Telnet Protocol specification, Postel J., 1980/06/01 (15pp)
(.txt=40005) (Obsoleted by 854)

no precursor listed to 850

not precursor listed to 977

random ref:
http://www.garlic.com/~lynn/rfcietff.htm

jan 1, 1983 was the "cut-over" from IMPs and NCP to IP. There were
about 250 nodes that were part of the 1/1/83 cutover. Note however,
there were interconnects of ARPANET (IMPs and NCP) by locations with
TeleNET (GTE) and "PhoneNet" (dial-in) for things like SMTP mail (aka
"offline" processing ... dial-up, download, hang-up ... somewhat akin
to uucp strategy using "phonenet").

random ref:
http://www.garlic.com/~lynn/internet.htm#0

misc. RFC referens:

rfc60 ... A simplified NCP Protocol 
rfc215 .. NCP, ICP, and TELNET: 
rfc381 .. TWO PROPOSED CHANGES TO THE IMP-HOST PROTOCOL 
rfc394 .. TWO PROPOSED CHANGES TO THE IMP-HOST PROTOCOL 
rfc550 .. NIC NCP Experiment 
rfc618 .. A Few Observations on NCP Statistics 
rfc660 .. SOME CHANGES TO THE IMP AND THE IMP/HOST INTERFACE 
rfc687 .. IMP/Host and Host/IMP Protocol Change 
rfc704 .. IMP/Host and Host/IMP Protocol Change 
rfc773 .. COMMENTS ON NCP/TCP MAIL SERVICE TRANSITION STRATEGY 
rfc801 .. NCP/TCP TRANSITION PLAN

-- 
Anne & Lynn Wheeler   | lynn at garlic.com -  http://www.garlic.com/~lynn/ 


From pedro_rodriguez at club-internet.fr  Thu Dec  6 06:45:41 2001
From: pedro_rodriguez at club-internet.fr (Pedro)
Date: Thu, 06 Dec 2001 12:45:41 +0100
Subject: affects on extended modules
References: <3C051775.A8D4FD66@bioeng.ucsd.edu> <83pu5zrvbl.fsf@panacea.canonical.org> <3C0E7138.FD485D1D@bioeng.ucsd.edu>
Message-ID: 

"Curtis Jensen"  wrote:

> Kragen Sitaker wrote:
>> 
>> Curtis Jensen  writes:
>> > We have created a python interface to some core libraries of our own
>> > making.  We also have a C interface to these same libraries. However,
>> > the the python interface seems to affect the speed of the extended
>> > libraries.  ie.  some library routines have their own benchmark code,
>> > and the time of exection from the start of the library routine to the
>> > end of the library routine (not including any python code execution),
>> > takes longer than it's C counterpart.
>> 
>> In the Python version, the code is in a Python extension module, right?
>>  A .so or .dll file?  Is it also in the C counterpart?  (If that's not
>> it, can you provide more details on how you compiled and linked the
>> two?)
>> 
>> In general, referring to dynamically loaded things through symbols ---
>> even from within the same file --- tends to be slower than referring to
>> things that aren't dynamically loaded.
>> 
>> What architecture are you on?  If you're on the x86, maybe Numeric is
>> being stupid and allocating things that aren't maximally aligned.  But
>> you'd probably notice a pretty drastic difference in that case.
>> 
>> ... or maybe Numeric is being stupid and allocating things in a way
>> that causes cache-line contention.
>> 
>> Hope this helps.
> 
> Thanks for the responce.  The C counterpart is directly linked together
> into one large binary (yes, the python is using a dynamicaly linked
> object file, a .so).  So, That might be the source of the problem.  I
> can try and make a dynamicaly linked version of the C counterpart and
> see how that affects the speed.  We are running on IRIX 6.5 machines
> (mips).
> Thanks.
> 

Don't know if this helps but I had a similar problem on Linux.

The context was : a python script was calling an external program and
parsing output (with popen) many times. I decided to optimize this
by turning the external program into a dynamicaly linked library with
python bindings. I expected to gain the extra system calls to fork and
start a new process, but it turned out that this solution was slower.

The problem was caused by multithreading stuff. When using the library
straight from a C program, I didn't link with multithreaded libraries
and so all system calls weren't protected (they don't need to lock and
unlock their resources).

Unfortunately, the library was reading files with fgetc (character by
character :( ). Since the Python version I used was compiled with
multi-threading enabled, it turned out that the fgetc function used in
this case lock/unlock features, which cause the extra waste of time.

To find this, I compiled my library with profiling (I think I needed to
use some system call to activate profiling from the library, since I
couldn't rebuild Python).

OT : at the end I fixed the library (fgetc replaced by fgets), and didn't
gain anything by turning the external program into a python extension. 
Since it seemed that Linux disk cache was good, I removed the python 
extension thus keeping a pure Python program, and implemented a cache
for the results of the external program. This was much simpler and more
efficient in this case.

-- 

Pedro


From skip at pobox.com  Tue Dec 25 16:37:19 2001
From: skip at pobox.com (Skip Montanaro)
Date: Tue, 25 Dec 2001 15:37:19 -0600
Subject: State of the SysAd art (was: vi or emacs for editing Python on Linux?)
In-Reply-To: <2E48C714A6E1FBA1.19DE5ADEBF7F088A.DF90F2C1E6CC9E7C@lp.airnews.net>
References: 
        
        <1009127729.9271.0.nnrp-12.c2de51d8@news.demon.co.uk>
        
        <2E48C714A6E1FBA1.19DE5ADEBF7F088A.DF90F2C1E6CC9E7C@lp.airnews.net>
Message-ID: <15400.61839.514703.767343@12-248-41-177.client.attbi.com>

    >> Furthermore, when it comes to programming, I would hope that a
    >> company that has machines all over the world would have learned the
    >> joys of a CVS server which would also fill in on the above.  Edit on
    >> one machine, commit, ssh to the machine that needs it, cvs update.

    Cameron> Does this match others' experience?  I continue to run into
    Cameron> plenty of production hosts which have barely been maintained
    Cameron> for up to four years, let alone outfitted with such new-fangled
    Cameron> decorations as a properly-installed ssh.

I would hope that if you are allowing access over the net to such machines
that you are using ssh s/key or some other tools that let you avoid raw
telnet or rsh protocols.  We've been broken in often enough even running ssh
and trying to keep things buttoned down.

-- 
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)



From thomasNO at SPAM.obscure.dk  Wed Dec 19 10:58:12 2001
From: thomasNO at SPAM.obscure.dk (Thomas Jensen)
Date: Wed, 19 Dec 2001 15:58:12 GMT
Subject: Dictionaries as records
References:   <7_XT7.28652$t07.4042756@twister.midsouth.rr.com>  
Message-ID: 

"Bill Wilkinson"  wrote in
news:F82U7.28866$t07.4111647 at twister.midsouth.rr.com: 

> "John Roth"
>> In this case, you have one copy of each of your input
>> strings, not 15000 copies! The memory usage should be pretty close
>> to pure dictionary overhead. 
> 
> I don't see how that can be. If they were all copies of the same
> reference, wouldn't a change in one record be reflected in all? 
> Below I make a change to one record and the others remain the same:

Strings are immutable - it is not possible to change a string.
Consider the following:

First create a list of 3 items. Actually the list contains 3 references 
to the same string object! (I'll be using a list instead of a dict, but 
there should be no difference).
   >>> list = ['abc'] * 3
Lets see the memory address of this string object.
   >>> [id(item) for item in list]
   [135450912, 135450912, 135450912]
The same as expected.

Now lets change the reference of the second item in list.  Note that we 
are not changing the string object with id 135450912 - we are changing 
a property of the list, i.e. the reference at position 1.
   >>> list[1] = 'def'

Let's see the addresses again:
   >>> [id(item) for item in list]
   [135450912, 135452512, 135450912]
Notice that the second element now refers to another memory address.

>>>>tbl[1]["g11"]  #original value 'ldjfljdfkjdf'
>>>> tbl[1]["g11"] = "f"  #change rec one to 'f'/ tbl[1]["g11"]   
>>>> #it's value is different now. 'f' tbl[2]["g11"]    #rec 2
>>>> remains the same. 
> 'ldjfljdfkjdf'
> 
> Now the question. Am I misunderstanding what is happening above?

I think you are mistaken changing a string with changing a reference in 
a list, dict, etc.

-- 
Thomas Jensen


From phd at phd.pp.ru  Sat Dec 29 15:46:35 2001
From: phd at phd.pp.ru (Oleg Broytmann)
Date: Sat, 29 Dec 2001 23:46:35 +0300
Subject: Who needs exceptions
In-Reply-To: <3c2deb81.11823921@news.t-online.de>; from gerson.kurz@t-online.de on Sat, Dec 29, 2001 at 04:16:03PM +0000
References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de>  <3c2deb81.11823921@news.t-online.de>
Message-ID: <20011229234635.A2713@phd.pp.ru>

On Sat, Dec 29, 2001 at 04:16:03PM +0000, Gerson Kurz wrote:
> def lower():
>     file = open(...)
>     if file:
>         return file.read()
>     report_error("lower failed()")

   That's wrong solution. Imagine I am writing a library (that includes the
"lower" function). This is  librry, so I cannot define "report_error"
function.
   Later you write few different interfaces to the library - web interface,
text interface (command line), curses, GUI... How can I call different
report_errors()?
   Exception handling solves this easily.

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.



From wurmy at earthlink.net  Mon Dec  3 17:01:05 2001
From: wurmy at earthlink.net (Hans Nowak)
Date: Mon, 03 Dec 2001 22:01:05 GMT
Subject: Displaying multiple results in a list
References: <741f261e.0112031331.75c2e1c6@posting.google.com>
Message-ID: <3C0BF622.349DDB02@earthlink.net>

Russell Briggs wrote:
> 
> Wanted to know if there was a way to specify ranges in a list such as:
> 
> newlist = ["1", "2", "3", "4", "5", "6"]
> 
> print newlist[1..3]  #ie:  print newlist[1], newlist[2], newlist[3]
> 
> Can something like this be done?
> 
> /russ

Well, you can use a slice, but this returns a new list object,
so it might not do exactly what you had in mind:

>>> z = range(10)
>>> z
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> z[1:4]
[1, 2, 3]
>>> 

--Hans


From hungjunglu at yahoo.com  Fri Dec  7 01:25:51 2001
From: hungjunglu at yahoo.com (Hung Jung Lu)
Date: 6 Dec 2001 22:25:51 -0800
Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)
References: 
Message-ID: <8ef9bea6.0112062225.24d11516@posting.google.com>

"Bjorn Pettersen"  wrote in message news:...
> Ps: Isn't it time for someone to call someone a space-nazi/tab-nazi so
> this thread can die?

Calling names? Issuing death threats? How about:

Tabiban: those that want to ban the usage of tabs.

Tabifan: those that are fans of using tabs, a.k.a. Tabican or Tabiman.
Or Tabisan, if from Japan.

Hung Jung :)


From jkraska at san.rr.com  Wed Dec 19 17:51:06 2001
From: jkraska at san.rr.com (Courageous)
Date: Wed, 19 Dec 2001 22:51:06 GMT
Subject: stackless python
References: <9vpjds$due$1@usc.edu> 
Message-ID: 

>OTOH, the chances of seeing stackless python or something like it in
>the core are currently in the vanishing-to-nil range.  We went round
>with this one on the newsgroup a few weeks back -- google is your
>friend here -- and the conclusion was there was noone willing and able
>to do the enormous amount of work required.

A big rub is that it might very well be impossible to get stackless
to work properly in Jython, and even if it weren't, it's a tough
mark over there as well.

>CT has done the first 90%
>of the work, but there's still the other 90% to go, and even if the
>work was done, it's far from certain that Guido would accept the
>changes anyway.

Makes the kernel tougher to understand. Programmers with an under-
standing of stack maniuplation tricks, implementation of cooperative
multithreading frameworks, and forth will have no problems. But this
group is a rare breed.

If you really want to have a bad day, try implementation something
like continuations in C++. Then, when something goes wrong, try to
debug it. Har, har, har. *cringe*

C//



From bsturk at news.rcn.com  Mon Dec 10 22:24:51 2001
From: bsturk at news.rcn.com (Brian Sturk)
Date: 11 Dec 2001 03:24:51 GMT
Subject: strict python?
References:  <3C1060E4.756F33B2@earthlink.net> 
Message-ID: 

On Sun, 9 Dec 2001 21:59:26 +0000 (UTC), Marcin 'Qrczak' Kowalczyk
> wrote:
> Fri, 07 Dec 2001 06:34:20 GMT, Hans Nowak  pisze:
> 
>> Well, 'self.func' is a perfectly valid Python expression,
>> just like '3'. Not very useful when used like this, but
>> still, perfectly valid.
> 
> It would be easy to define Python's syntax differently, such that
> only some forms of expressions are valid as statements. Of course it
> would break compatibility.
> 
> A small problem is that you can't know whether x.func has side effects:
> it can throw an exception if the attribute doesn't exist, and it can
> call a side-effecting __getattr__. But I believe that disallowing this
> would not be a problem if the language was designed today (you can
> always work around this by assigning the result to a dummy variable).
> 

I've been following this thread since I started it and now I understand
why it is legal etc, but I still wish that it could, even if optionally,
be flagged as a warning.  I imagine that 8 times out of 10 it was
unintentional.  However, I am new to python so maybe this is more
common than I think

I've downloaded PyChecker and hope to try it soon.

--
.-----------------------------------------------------,-------.  
| Brian M. Sturk - http://www.nh.ultranet.com/~bsturk \ C/C++ |  .>   )\,^a__
|--------------------------|  bsturk at nh.ultranet.com   | Java | (  _ _)/ /-." ~
| http://www.telengard.com `---------------------------`------|  `( )_ )/
| Telengard Technologies Inc. -  NT/*nix UI & device drivers  | _<_s_<_s
'-------------------------------------------------------------'


From dhhnews0 at hotmail.com  Wed Dec  5 15:48:39 2001
From: dhhnews0 at hotmail.com (me)
Date: Wed, 05 Dec 2001 20:48:39 GMT
Subject: Python - string to hexbytes conversion - HELP!
Message-ID: 

I'm a newbie to Python and I am trying
to convert a string of decimal numbers - read from raw_input
to a series of hexbytes
eg
if I do a read and get a='1234567'
I need  an equivalent string to be
b=Chr(0x01)+chr(0x23)+chr(x045)+chr(0x67)

all this is to control a device from the serial port
but I cannot seem to recall how to conver the input to my required output
An hints or suggestion most appreciated! I've spend hours trying various
built in's
which I would prefer to use

HELP!




From phd at phd.pp.ru  Wed Dec  5 03:53:04 2001
From: phd at phd.pp.ru (Oleg Broytmann)
Date: Wed, 5 Dec 2001 11:53:04 +0300
Subject: ANN:  PyGeo V.6
In-Reply-To: <000001c17d31$ba0b5960$c747f6d1@ArtSiegel>; from ajs@ix.netcom.com on Tue, Dec 04, 2001 at 09:05:32PM -0500
References: <000001c17d31$ba0b5960$c747f6d1@ArtSiegel>
Message-ID: <20011205115304.B19636@phd.pp.ru>

Hi!

On Tue, Dec 04, 2001 at 09:05:32PM -0500, Arthur Siegel wrote:
> http://home.netcom.com/~ajs

   I didn't find any mentions of a license. Is it public domain?

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.



From donn at u.washington.edu  Tue Dec 11 12:47:34 2001
From: donn at u.washington.edu (Donn Cave)
Date: 11 Dec 2001 17:47:34 GMT
Subject: client/server chat program
References: 
Message-ID: <9v5grm$boq$1@nntp6.u.washington.edu>

Quoth "Jason Orendorff" :
| "neuromorphus"  wrote:
|> The client program continuously asks for 'raw_input' from the user,and
|> then sends the msg to the server to be broadcasted. However, I can't
|> output messages to the terminal/console, if the client program is
|> waiting for input.

| The best way to proceed is to read a few chapters of Stevens'
| excellent book, "Advanced Programming in the UNIX Environment".
| Many deep Unix secrets and aha! moments await.
|   http://www.kohala.com/start/apue.html
|
| The answer, in summary:
|  * Use select.select() to wait for input.  Provide the list
|    [sys.stdin, mysocket] to select.  This is Unix-specific.
|  * When select tells you that there's input waiting on stdin,
|    use os.read(sys.stdin.fileno(), 1000) to get it.

For a little more UNIX trivia:  sys.stdin.fileno() is always 0,
by definition.  Likewise, sys.stdout.fileno() is 1, and stderr 2.
The file object is only a superfluous inconvenience.

	Donn Cave, donn at u.washington.edu


From mwh at python.net  Fri Dec 21 06:34:06 2001
From: mwh at python.net (Michael Hudson)
Date: Fri, 21 Dec 2001 11:34:06 GMT
Subject: Bug in % string formatting?
References: <9vtiev$no8$1@peabody.colorado.edu> <871yhp7guv.fsf@ifm.uni-kiel.de> <9vtk6h$ojk$1@peabody.colorado.edu> <3C225BBC.2D06CB8@alcyone.com>
Message-ID: 

Erik Max Francis  writes:

> Fernando P?rez wrote:
> 
> > It does surprise me though that % binds harder than +. I would naively
> > think
> > that by its nature, % would have fairly low precedence. Oh well, I'm
> > sure
> > there's a good reason for it being the way it is.
> 
> The reason is because % is also the modulo division operator.

Which is in turn a reason for not overloading operators too much.
Anyone ever done this:

cout << var ? "true" : "false";

in C++?  It was *years* before I realised why that didn't work...

Cheers,
M.


From michael at stroeder.com  Sun Dec 30 09:48:00 2001
From: michael at stroeder.com (Michael =?iso-8859-1?Q?Str=F6der?=)
Date: Sun, 30 Dec 2001 15:48:00 +0100
Subject: Who needs exceptions (was Re: Two languages, too similar, competing 
 in the same space.)
References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de>  <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> <3C2E498B.6DC757E0@stroeder.com> <3C2E6A51.589E7F1D@earthlink.net>
Message-ID: <3C2F2920.89841C81@stroeder.com>

Ron Stephens wrote:
> 
> Several folks seem to agree that
> +++C and programmers who like C should die a slow and painful death for
> > holding back the computer industry for two decades.+++
> 
> I am hoping that the above does not apply to fellow I've heard of named Guido
> van Rossum, who, it is commonly rumored, has written some useful progrms in
> "C" from time to time ;-))))

Well, he could have used Modula instead... ;-)

Seriously, I'm sick of all the security announcements regarding
buffer overflows and such. Not to speak of memory leaks. That's
stone age.

Furthermore exceptions are a very nice possibility to make proper
error handling feasible in complex projects hopefully resulting in
more secure code.

Ciao, Michael.


From phd at phd.pp.ru  Thu Dec 20 06:38:12 2001
From: phd at phd.pp.ru (Oleg Broytmann)
Date: Thu, 20 Dec 2001 14:38:12 +0300
Subject: launching netscape from python
In-Reply-To: <3C21CA6C.4A2DB44@c-s.fr>; from anthony.harel@c-s.fr on Thu, Dec 20, 2001 at 12:24:28PM +0100
References: <3C21B743.AB4DBAB6@c-s.fr>  <3C21CA6C.4A2DB44@c-s.fr>
Message-ID: <20011220143812.E24403@phd.pp.ru>

On Thu, Dec 20, 2001 at 12:24:28PM +0100, anthony harel wrote:
> I have to work with python 1.5.2 and the module webbrowser don't seams to
> exist in this version of python.

   Then backport it to your local installation.

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.



From wurmy at earthlink.net  Sun Dec 30 00:36:20 2001
From: wurmy at earthlink.net (Hans Nowak)
Date: Sun, 30 Dec 2001 05:36:20 GMT
Subject: Help - command line arguments
References: 
Message-ID: <3C2EA674.F6C69FB2@earthlink.net>

Steve Zatz wrote:
> 
> I am new to Python and although I am sure that the following is obvious I
> can't figure the following out or find an answer in any of the texts that I
> have access to.
> 
> My question is:  Can you run a script that takes command line arguments from
> within the Python shell or from the Python command line?
> 
> For example, something like:
> 
> test.py -a -b
> 
> runs fine from the *Windows XP* command prompt.
> 
> From the Python command line, I can do the following:
> 
> import test
> test.main()
> 
> which doesn't produce an exception but I can't figure out how to input the
> command line arguments.

You can mess around with sys.argv, but I'm not sure if that
is kosher...

>>> import sys
>>> sys.argv[0] = 'myself.py'
>>> sys.argv[1:] = '-x foo -y bla filename'.split()
>>> sys.argv
['myself.py', '-x', 'foo', '-y', 'bla', 'filename']
>>> 

If the program defines a "if __name__ == "__main__"
block, you're out of luck, though. import will not execute
the code in the block.

--Hans


From kwg at renre-europe.com  Thu Dec 13 12:05:47 2001
From: kwg at renre-europe.com (Ken Guest)
Date: 13 Dec 2001 17:05:47 +0000
Subject: Where can you find the Python ODBC modual
In-Reply-To: 
References: 
Message-ID: <1008263152.4284.29.camel@lewis>

On D?ar, 2001-12-13 at 15:56, John Yeager wrote:
> This thing is driveing me nuts I am trying to connect to an Access
> Database,( boss will not let me use Mysql ), so I am in need of figureing
> out how to connect to Microsoft access..

You need to either use mxODBC or check out chapter 13 of the O'Reilly
"Programming Python on win32" book.

k.

-- 
The duck quacks.




From peter at engcorp.com  Fri Dec  7 22:12:42 2001
From: peter at engcorp.com (Peter Hansen)
Date: Fri, 07 Dec 2001 22:12:42 -0500
Subject: list comprehensions to effect visitors
References:  <3C1162D5.570DCEC6@engcorp.com> <9uro8u$ec0q0$1@fido.engr.sgi.com>
Message-ID: <3C11852A.AD2709BE@engcorp.com>

Paul Jackson wrote:
> 
> Peter Hansen writes:
> > I'm not sure whether there is sarcasm in your posting, or not,
> > without a smiley, so I have to assume there was some objection.
> 
> My definite sense in reading Jeremy's post was that
> it was tongue in cheek, meant in good humour.

I'm quite possibly overly sensitive, but go back and try reading
it from my point of view, as the "you" to whom he referred...

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com


From knight at baldmt.com  Sun Dec 23 22:34:52 2001
From: knight at baldmt.com (Steven Knight)
Date: Sun, 23 Dec 2001 21:34:52 -0600 (CST)
Subject: ANNOUNCE:  SCons 0.02 now available
Message-ID: 

I'm pleased to announce that version 0.02 of SCons has been released and
is available for download from the SCons web site:

        http://www.scons.org/

Or through the download link at the SCons project page at SourceForge:

        http://sourceforge.net/projects/scons/

RPM and Debian packages and a Win32 installer are all available, in
addition to the traditional .tar.gz files.

SCons is a software construction tool (build tool, make tool) written
in Python.  Its design is based on the design which won the Software
Carpentry build tool competition in August 2000 (in turn derived from
the Perl-based Cons build tool).

Distinctive features of SCons include:

  - configuration files are Python scripts, allowing the full use of a
    real scripting language to solve build problems
  - a modular architecture allows the SCons Build Engine to be
    embedded in other Python software
  - a global view of all dependencies; no multiple passes to get
    everything built
  - the ability to scan files for implicit dependencies (#include files);
  - improved parallel build (-j) support
  - use of MD5 signatures to decide if a file has changed
  - easily extensible through user-defined Builder and Scanner objects

An scons-users mailing list has been created for those interested in
getting started using SCons.  You can subscribe at:

        http://lists.sourceforge.net/lists/listinfo/scons-users

Alternatively, we invite you to subscribe to the low-volume
scons-announce mailing list to receive notification when new versions of
SCons become available:

        http://lists.sourceforge.net/lists/listinfo/scons-announce

Special thanks to Charles Crain and Anthony Roach for their
contributions to this release.

On behalf of the SCons team,

	--SK




From jeff at ccvcorp.com  Thu Dec 27 15:20:42 2001
From: jeff at ccvcorp.com (Jeff Shannon)
Date: Thu, 27 Dec 2001 12:20:42 -0800
Subject: REPOST: Re: A new message board is up
References: <40dbad98.0112262232.1868734e@posting.google.com>  <3C2B724D.E4D31E24@ccvcorp.com> <3C2B74B8.D2FE36F5@stroeder.com>
Message-ID: <6$--$$_----_-$-%_$@news.noc.cabal.int>


Michael Str?der wrote:

> Jeff Shannon wrote:
> > [..]
> > I won't be participating in this Python EZBoard.
>
> I always wonder why people put "web forums" in place. I can't read
> them while being off-line (e.g. on the train) and they are damn
> slow. Newsgroups and mailing lists are the right medium for this
> kind of communication.
>
> Ciao, Michael.

Eh, they have their purpose.  They're easier to set up than a
newsgroup, and more widely accessible (decent browsers are more widely
distributed than decent newsreaders).  And once a certain volume is
reached, they're easier to organize and maintain than a mailing list
(including automatic archiving, and purging of old archives, the
latter of which may or may not be desirable).  It's also easier to
include images and such in posts (which, again, may or may not be
desirable).  And the membership/registration requirements are
somewhere in between Usenet (none) and mailing lists (members only).

For an open, technical forum in which long-term archiving is
desirable, Usenet is definately a preferable medium.  For informal
social groups, web forums can make a nice alternative to mailing
lists.

Jeff Shannon
Technician/Programmer
Credit International

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Jeff Shannon 
Newsgroups: comp.lang.python
Subject: cmsg cancel <3C2B829A.DD0AED79 at ccvcorp.com>
Control: cancel <3C2B829A.DD0AED79 at ccvcorp.com>
Date: Mon, 31 Dec 2001 05:26:46 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775601 27193 211.57.49.2 (31 Dec 2001 05:13:21 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:13:21 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From LLoeffler at home.com  Mon Dec  3 04:06:20 2001
From: LLoeffler at home.com (Luke)
Date: Mon, 03 Dec 2001 03:06:20 -0600
Subject: Regular expression as dictionary key?
References: <3C0B2DE9.5040308@home.com> <9ufdkn$21dk$1@agate.berkeley.edu>
Message-ID: <3C0B408C.8030908@home.com>

Daniel Yoo wrote:

> Luke  wrote:
> : Let's say you have a dict of words like
> : words = {"dogs":1,"cats":2}
> 
> : Let's say I'm given a singular form of a word and want to match it with 
> : plurals still, but words["dog"] will obviously raise a KeyError.
> 
> : Without doing a linear substring search on every element in words.key(), 
> : is there a way to take advantage of the dict's binary tree layout 
> : properties (e.g. speed) like:
> 
> : words["dog*"]   # where dog* is a Regex
> 
> : Nonexistant syntax, I know, but you get the idea...  I smell a PEP
> 
> Hmmm... Interesting!  Let's see:
--snip--

Cool, but still a linear search.  Plus it short circuits.

What about this case:
words = {"dogs":32,"donuts":41}
words["do*"] should return [32,41]

So you add a few lines to go exhaustively through the keys and 
accumulate matches... Still linear.  I admitedly don't know much about 
the C implementation of dicts, but it seems there should be a way to 
leverage the dict's arrangement for fast regex keys.

Luke



From chris.perkins at inbusiness.com  Thu Dec 13 10:15:11 2001
From: chris.perkins at inbusiness.com (Chris Perkins)
Date: 13 Dec 2001 07:15:11 -0800
Subject: elegent sql building
References: <1a241b9d.0112120534.cea1fa4@posting.google.com>  <1a241b9d.0112121450.7aa92a12@posting.google.com>
Message-ID: 

cmedcoff at home.com (Charles Medcoff) wrote in message news:<1a241b9d.0112121450.7aa92a12 at posting.google.com>...
> Damn.  I like that.
> 
> "Diving into Python" is the only published resource that goes into
> what I would consider "idoms" or advanced use.  I know that one has to
> put some time in the trenches (nothing like experience), but any
> resource along the lines of this that you can reference would be
> helpful.

Actually I have learned almost all of the (small amount) of Python
that I know by reading this newsgroup for several months. This is
probably one of the least efficient ways imaginable to learn a
language, but.. well, I wasn't in a hurry. After a few months stuff
started to sink in.
This method has one unfortunate effect: I seem to be catching on to
the tricky stuff, but I tend to not know some of the really basic
stuff that nobody asks questions about :(
Other than c.l.p, my best source of "idioms" has been reading:
1) The source of the library modules and the samples that ship with
Python
2) The Activestate Cookbook
3) And of course, as you said, "Dive Into Python" is excellent.

Chris Perkins

P.S.: here's a slightly more general version of my previous
suggestion:

def buildSql(tablename, **cols):
    return """
    SELECT *
    FROM   %s
    WHERE  1 = 1
    %s
    """ % (tablename, InList(cols))

class InList:
    def __init__(self, cols):
        self._cols = cols
    def __getitem__(self, colname):
        vals = self._cols[colname]
        if vals:
            return "AND %s IN ('%s')" % (colname, "','".join(vals))
        else:
            return ''
    def __str__(self):
        return '\n'.join([self[col] for col in self._cols.keys()])

then you can use any column names you need:

sql.buildSql(
        'foo',
        neep=['yak','nork','feep'], 
        yoop=['snurk','feep'], 
        grr=[])


From MarkH at ActiveState.com  Tue Dec  4 23:30:49 2001
From: MarkH at ActiveState.com (Mark Hammond)
Date: Wed, 05 Dec 2001 04:30:49 GMT
Subject: Reading any NT System log entries
References: <9uin27$s5g$1@hercules.iupui.edu>
Message-ID: <3C0DA385.4020508@ActiveState.com>

Jason Byars wrote:

> Hi, I'm in a bit of a bind reading System log print events.  99% of the
> events read fine with win32evtlogutil.SafeFormatMessage(ev_obj, logtype).
> But, every now and then I get and entry with an ascii character above 128
> and SafeFormatMessage throws an error.  Is there some way to clean up those
> entry objects so they can be read?  Thanks!
> 

Can you give details of exactly what fails, or what application is 
inserting unicode objects?  Post the complete traceback when using 
win32evtlogutil.FeedEventLogRecords.

Mark.



From loewis at informatik.hu-berlin.de  Wed Dec 19 19:30:20 2001
From: loewis at informatik.hu-berlin.de (Martin von Loewis)
Date: 20 Dec 2001 01:30:20 +0100
Subject: quick eval question
References: <4c7395cb.0112150728.2275ad75@posting.google.com> <4c7395cb.0112151408.34bd9@posting.google.com>
Message-ID: 

curtin at ubsw.com (craig curtin) writes:

> # now i want a 'path component'
> ePath ="['OUTLOOK']['CREATEDATE']"

I would not use a string to represent a path; a list is much
more natural

ePath = ['OUTLOOK','CREATEDATE']

Then you can write

res = element
for index in ePath:
  res = res[index]

HTH,
Martin


From fperez528 at yahoo.com  Mon Dec 10 20:37:39 2001
From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=)
Date: Wed, 12 Dec 2001 01:05:39 +2328
Subject: Help newbie!
References: <9v5t5g$sp2$1@news.hccnet.nl>  <9v60ho$5qu$1@peabody.colorado.edu> 
Message-ID: <9v736j$rsk$2@peabody.colorado.edu>

Oleg Broytmann wrote:

> On Tue, Dec 11, 2001 at 03:14:35PM +2328, Fernando P?rez wrote:
>> No need to import anything:
>> new_string = 'hello'.replace('hel','hol')
> 
>>>> new_string = 'hello'.replace('hel','hol')
> Traceback (innermost last):
>   File "", line 1, in ?
> AttributeError: 'string' object has no attribute 'replace'
> 
>    (Python 1.5.2, of course).

Ah. Oh well, then just import string or upgrade if it makes sense to.

Cheers,

f


From maxm at mxm.dk  Tue Dec 25 17:29:19 2001
From: maxm at mxm.dk (maxm)
Date: Tue, 25 Dec 2001 23:29:19 +0100
Subject: vi or emacs for editing Python on Linux?
References:   
Message-ID: 

"Fernando P?rez" 

> Question: I didn't catch the Newtonmass reference. ???

Some people (no names mentioned ;-) ) are atheists. But don't want to miss
out on a party oportunity in the dark days of winter.

The great scientist Sir Isaac Newtons birthday was december 25 :-)

http://www.aleph.se/Trans/Cultural/Fun/holidays.html

regards Max M




From donn at drizzle.com  Sun Dec 23 23:22:48 2001
From: donn at drizzle.com (Donn Cave)
Date: Mon, 24 Dec 2001 04:22:48 -0000
Subject: I used os.waitpid,but I still can't Zombie process?
References:   <1008825134.967004@yabetcha.sttl.drizzle.com> 
Message-ID: <1009167768.180019@yabetcha.drizzle.com>

Quoth "lokie.spods" :
| "Donn Cave"  wrote in message
| news:1008825134.967004 at yabetcha.sttl.drizzle.com...
....
|> Hm, I think we're going in circles here - if I remember right, he was
|> having problems with EINTR because of SIGCHLDs.  Between that and the
|> extra problems Python has with signal handling, I personally think SIGCHLD
|> is a total loser for Python programs.

| As all child processes will raise SIGCHLD upon exit it seems stupid to
| ignore the oppertunity to take advantage of the signal and perform cleanup
| as its required, working smarter not harder. Now your point mentions EINTR,
| regardless of whether you write code to handle that signal, or leave it
| unhandled some routines are going to exit anyway with EINTR. Re-reading the
| OP's code snippet, it looks like any IO that could exit with EINTR is in the
| child and out of scope of that signal anyway.

SIGCHLD will abort your I/O functions with EINTR _only_ if you establish
a SIGCHLD handler.  It's a last resort.

| I read your idea of signalling process completion back to the calling
| process via a pipe with interest. It fits in with an idea I'm playing with
| for a threaded DNS server, the idea being that a thread signals the main
| process to awake and deal with the results, so the main process can
| blissfully sleep in a select call until needed. As said server is in C not
| Python, it'll probably be very offtopic to report on success or failure of
| that approach, but intuitively I expect it to work as advertised.

Sure, but it's rather different than what I was talking about there.
I don't expect the child process to actually write anything to the pipe
or be aware in any way of its existence.  Its sole purpose is to generate
end of file when the child exits.  Would be reliable only if certain
details are worked out, though.

	Donn Cave, donn at drizzle.com


From sholden at holdenweb.com  Mon Dec 17 17:57:46 2001
From: sholden at holdenweb.com (Steve Holden)
Date: Mon, 17 Dec 2001 17:57:46 -0500
Subject: Cygwin socket library status enquiry
Message-ID: 

Can anyone say fairly definitively whether there are known socket
communication problems in cygwin with Python 2.1.1-2 (the latest version
ported by Jason Tishler).

My asynchat-based web server runs fine under the native Windows 2.0 port.
When I run it under cygwin it seems to go OK for a few interactions, but
then seems to hang. The output from netstat -an seems to me to be more than
a little confusing: client-side sockets (created to connect to the server by
Internet Explorer) are shown as in a LISTENING state.

If the same thing happened with the native Windows implementation I would be
looking at my code, but I'm wondering whether it's a cygwin problem. Google
seems to indicate that there were socket problems with cygwin a good while
ago, but I don't see recent problem descriptions.

Can anyone tell me what's going on? The netstat output is attached.

regards
 Steve

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    0.0.0.0:1026           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1299           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:21             0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1304           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:80             0.0.0.0:0              LISTENING
  TCP    0.0.0.0:81             0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1154           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1155           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1156           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1157           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1161           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1166           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1173           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1200           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1201           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1202           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1203           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1211           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1217           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1223           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1250           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1251           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1252           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1253           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:3306           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1260           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1266           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:1268           0.0.0.0:0              LISTENING
  TCP    127.0.0.1:1026         127.0.0.1:3306         ESTABLISHED
  TCP    127.0.0.1:1031         0.0.0.0:0              LISTENING
  TCP    127.0.0.1:1299         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:1304         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:1078         0.0.0.0:0              LISTENING
  TCP    127.0.0.1:1154         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:1155         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:1156         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:1157         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:1161         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:1166         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:8080         127.0.0.1:1299         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1304         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1154         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1155         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1156         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1157         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1161         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1166         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1173         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1200         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1201         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1202         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1203         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1211         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1217         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1223         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1250         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1251         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1252         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1253         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1260         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1266         CLOSE_WAIT
  TCP    127.0.0.1:8080         127.0.0.1:1268         CLOSE_WAIT
  TCP    127.0.0.1:1173         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:1200         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:1201         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:1202         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:1203         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:1211         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:1217         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:1223         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:1250         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:1251         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:1252         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:1253         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:3306         127.0.0.1:1026         ESTABLISHED
  TCP    127.0.0.1:1260         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:1266         127.0.0.1:8080         FIN_WAIT_2
  TCP    127.0.0.1:1268         127.0.0.1:8080         FIN_WAIT_2
  TCP    192.168.10.159:137     0.0.0.0:0              LISTENING
  TCP    192.168.10.159:138     0.0.0.0:0              LISTENING
  TCP    192.168.10.159:139     0.0.0.0:0              LISTENING
  UDP    127.0.0.1:1031         *:*
  UDP    127.0.0.1:1078         *:*
  UDP    192.168.10.159:137     *:*
  UDP    192.168.10.159:138     *:*
--


--
http://www.holdenweb.com/






From DeepBleu at DeepBleu.org  Thu Dec 20 11:45:25 2001
From: DeepBleu at DeepBleu.org (DeepBleu)
Date: Thu, 20 Dec 2001 10:45:25 -0600
Subject: DOM - some pointers
References:  <9voi51$fco$1@slb7.atl.mindspring.net>  <23891c90.0112200838.209adc50@posting.google.com>
Message-ID: 

"Paul Boddie"  wrote in message
news:23891c90.0112200838.209adc50 at posting.google.com...
> Martin von Loewis  wrote in message
news:...
> > "Andrew Dalke"  writes:
> >
> > > So I too am looking for pointers.
> >
> > You may want to try getting a copy of "Python & XML", by Jones and
> > Drake. I don't know whether it is already available; but it certainly
> > offers lots of examples - small ones and large ones.
>
Python and XML just came out (and I just ordered it from amazon.com.  It is
available too from bn.com)

> Down this road lies the Enterprise JavaBeans experience, however,
> where it seems like there's a lack of really decent material on the
> Internet, and that people want you to buy their books anyway. Add to
> that a changing standard, old tutorials decaying on Sun's site, and a
> chorus of unanswered cries for help (on a Java forum near you!).
>
Python Programming with the Java(tm) Class Libraries: A Tutorial for
Building Web and Enterprise Applications
by Richard Hightower is due sometime next year.  Along with Jython book.
DeepBleu




From geos at bigfoot.com  Sun Dec  9 16:25:22 2001
From: geos at bigfoot.com (George Song)
Date: 9 Dec 2001 13:25:22 -0800
Subject: Problems with PythonService.exe
References: <2653ed03.0112071028.7d7585ba@posting.google.com> <3C11AC0E.7030409@ActiveState.com>
Message-ID: <2653ed03.0112091325.346268ab@posting.google.com>

Mark Hammond  wrote in message news:<3C11AC0E.7030409 at ActiveState.com>...
>
> Try running "pythonservice.exe /register" from a Command prompt, and let 
> me know what is printed.
> 
> Mark.

Hi Mark,

Thank you for the quick response.

C:\Python21\win32>PythonService.exe /register
Registering the Python Service Manager...

But for whatever reason everything seems to be fine now.  I don't
believe I've done anything differently to the system.  Ah well.

On to more COM fun!


From debl2nonspammywhammy at bellatlantic.net  Sun Dec 30 23:30:08 2001
From: debl2nonspammywhammy at bellatlantic.net (David Lees)
Date: Mon, 31 Dec 2001 04:30:08 GMT
Subject: introduction to xml in python
References:  
Message-ID: <3C2FE9D9.46C7EBEF@bellatlantic.net>

There is a brand new OReilly that has just come out called Python & XML,
by Jones and Drake.
http://www.amazon.com/exec/obidos/ASIN/0596001282/qid=1009772857/sr=1-1/ref=sr_1_6_1/107-9962439-7043717

David Lees

John Hunter wrote:
> 
> >>>>> "Rajarshi" == Rajarshi Guha  writes:
> 
>     Rajarshi> Hi, could somebody point me to some code/tutorial
>     Rajarshi> describing how to use Python to parse XML - I tried
>     Rajarshi> delving into the Python docs, but it seems
>     Rajarshi> confusing. Whats the difference between expat and sax?
>     Rajarshi> How can I generate a parsers etc.
> 
> expat is a XML parser by James Clark written in C.  SAX (Simple API
> XML) is an event driven API for XML parsing.  You may need to do a
> little background research on XML parsing and event driven parsers
> before the python docs will start tom make sense to you.
> 
> You may be interested in http://www.4suite.org, which provides a set
> of XML tools for use in python.
> 
> There is also at least one book devoted to XML in python:
> http://vig.pearsoned.com/store/product/0,,store-562_banner-0_isbn-0130211192,00.html
> 
> Have fun,
> John Hunter


From LLoeffler at home.com  Thu Dec  6 23:15:34 2001
From: LLoeffler at home.com (Luke)
Date: Thu, 06 Dec 2001 22:15:34 -0600
Subject: BREAKING NEWS ON PAYPAL SCAM!!!!!  149
References: <9iWP7.6689$Yy.278711@rwcrnsc53>
Message-ID: <3C104266.5040301@home.com>

Considering that the site is running c2it (citibank paypal alternative) 
ads, I bet they don't have ANY interest in seeing the downfall of paypal.



From gmcm at hypernet.com  Wed Dec  5 08:17:22 2001
From: gmcm at hypernet.com (Gordon McMillan)
Date: 05 Dec 2001 13:17:22 GMT
Subject: COM Registration Attributes
References: 
Message-ID: 

Bill Bell wrote:

> 
> "Python Programming on Win32" mentions that '_reg_options_' is a 
> "dictionary of additional keys to be written to the registry for the 
> COM object".
> 
> Has anyone an example or two, since I've been unable to find any?

class MyCOMServer:
    __reg_options_ = {'mykey':'myvalue'}
    ...

When registered, there will be a key 'mykey' sibling to 'InProcServer32' 
with a default value of 'myvalue'. I don't know if it will handle other 
types, or anything more complex.

-- Gordon
http://www.mcmillan-inc.com/




From nospam at bigfoot.com  Wed Dec 19 12:50:19 2001
From: nospam at bigfoot.com (Gillou)
Date: Wed, 19 Dec 2001 18:50:19 +0100
Subject: How to import modules in cgi applications?
References: <3C20C6F2.7CE2A7B3@yahoo.com>
Message-ID: <9vqjkd$17mv$1@norfair.nerim.net>

1/ Look at your web server log file or error file to see the python
traceback
2/ Try this simple CGI script:

import cgi
cgi.test()

And look if you already got the PYTHONPATH environment variable in the CGI
process.
If not, look at your web server doc for setting/passing environment
variables to the CGI scripts
If U use Apache, take a look at this...

http://httpd.apache.org/docs-2.0/mod/mod_env.html

You're 2 or 3 Apache directives away from the solution...

HTH

--Gillou

"Daniel"  a ?crit dans le message news:
3C20C6F2.7CE2A7B3 at yahoo.com...
> Hi,
> I'm writing a cgi script that uses a package I installed into Python
> called DCOralce2.
> My cgi script (test.py) causes an internal server error if it's run from
> a web browser, but not if I run it from the command line--the problem
> must be finding the module when the python script is run from the web
> client. I tried writing a shell script to set PYTHONPATH and then
> calling my cgi:
>
> #!/bin/sh
> PYTHONPATH="/home/rb/lib/pylib"
> export PYTHONPATH
> ./test.py
>
> where the PYTHONPATH is the path to where DCOralce2 lives, and it's the
> same as the one used in my environment. But this still doesn't work. Any
> suggestions?
>
> Thanks,
> Daniel
>
> --
> To reply to me directly, please remove "UNSPAM" from my email address
>
>




From donn at drizzle.com  Thu Dec 20 00:12:15 2001
From: donn at drizzle.com (Donn Cave)
Date: Thu, 20 Dec 2001 05:12:15 -0000
Subject: I used os.waitpid,but I still can't Zombie process?
References:  
Message-ID: <1008825134.967004@yabetcha.sttl.drizzle.com>

Quoth "lokie.spods" :
...
| However you can save a lot of overhead from the loop, by creating a handler
| for SIGCHLD and calling waitpid(-1, os.WNOHANG) from within the handler. See
| Pythons signal module for more details of that option.

Hm, I think we're going in circles here - if I remember right, he was
having problems with EINTR because of SIGCHLDs.  Between that and the
extra problems Python has with signal handling, I personally think SIGCHLD
is a total loser for Python programs.

Once when we were wrestling with this one someone, maybe me, suggested
a pipe as a signalling device, just leave one end in the child process
and it will become readable on exit because of the end of file.  Could
be tricky to get it to work reliably, and of course not great for massive
numbers of processes, but I don't know if anyone has really checked it out.

	Donn Cave, donn at drizzle.com


From Richard.Philips at ua.ac.be  Wed Dec 26 12:26:31 2001
From: Richard.Philips at ua.ac.be (Richard Philips)
Date: Wed, 26 Dec 2001 18:26:31 +0100
Subject: REPOST: Re: [BEGINNER] meta-functions
References: 
Message-ID: <0$--$$-$$$$%%-$$-$@news.noc.cabal.int>

Igor Mozetic wrote:

>A simple question from a newbie, sorry.
>
>I have functions defined normally, def fname(arg1,arg2):
>and also represented as tuples (fname, arg1, arg2),
>to use them by apply(fname, (arg1,arg2)) - no problem.
>
>How do I make a comparison:  fname == 'string' ?
>I found that I could use repr(fname) and parse the
>resulting string, but I consider this ugly.
>Is there a standard function to return a function name
>as a string?
>
>I'm restricted to Python 1.5.2.
>I'm not on the list, please reply to me.
>
>-Igor Mozetic
>
See:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52315


Richard Philips

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.tele.dk!small.news.tele.dk!134.75.7.11!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Richard Philips 
Newsgroups: comp.lang.python
Subject: cmsg cancel <3C2A0847.9030605 at ua.ac.be>
Control: cancel <3C2A0847.9030605 at ua.ac.be>
Date: Mon, 31 Dec 2001 04:45:58 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009776169 27193 211.57.49.2 (31 Dec 2001 05:22:49 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:22:49 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From maxx at easynews.com  Wed Dec 19 13:17:46 2001
From: maxx at easynews.com (Max)
Date: Wed, 19 Dec 2001 18:17:46 GMT
Subject: Newbie Wondering About Database Support?
References: 
Message-ID: <7sl12ucl674f2brco1ctfl2s7chfq6rioc@4ax.com>

On Tue, 18 Dec 2001 20:13:17 -0000, richardkessler at matteicos.com (Richard
Kessler) wrote:

>I have recently discovered Python and am excited about the possibility of 
>developing with the language. Unfortunately, I develop database centric 
>applications, MS SQL Server, etc. and I do not see much talk about Python and 
>access to databases. Am I missing something or is Python not intended for that 
>purpose. I would love to replace programs currently in VB with Python, but 
>they must be able to access databases.


For connectivity to SQL Server, if the code in running under Windows, see the
examples at http://www.e-coli.net/pyado.html . You will see ADO being used to
connect to a Jet/Access database, but the technique is very similar with MS SQL.

A simplistic example of Python code accessing a SQL Server follows:


import sys, win32com.client

adoConn = win32com.client.Dispatch('ADODB.Connection')

connect = "Provider=SQLOLEDB.1;Data Source=TestServer;Initial Catalog=pubs;User
ID=sa;Password=;"

sql = "SELECT lname FROM employee"

adoConn.Open(connect)
db = adoConn.Execute(sql)
    
while not db[0].EOF:
    lastname=db[0].Fields(0).Value
    print lastname
    db[0].MoveNext()

    



From fredrik at pythonware.com  Sun Dec 16 07:50:59 2001
From: fredrik at pythonware.com (Fredrik Lundh)
Date: Sun, 16 Dec 2001 12:50:59 GMT
Subject: Take 2: PEP draft for expression embedding
References: 
Message-ID: 

Oren Tirosh wrote:
> This new draft should address all the technical issues people here have
> raised in reponses to my previous draft.

it still doesn't explain why messing up the language with ugly and
unreadable syntax is a good idea, when you can get *exactly* the
same advantages in a way that works with *all* existing python
versions and *all* existing syntax-aware tools.






From aleax at aleax.it  Wed Dec 12 08:00:32 2001
From: aleax at aleax.it (Alex Martelli)
Date: Wed, 12 Dec 2001 14:00:32 +0100
Subject: lost interest?
In-Reply-To: <15382.20257.107891.262699@12-248-41-177.client.attbi.com>
References: <20011208001123.A5989@casa.parque> <9v5enr079j@enews4.newsguy.com> <15382.20257.107891.262699@12-248-41-177.client.attbi.com>
Message-ID: <0112121400320F.29111@arthur>

On Tuesday 11 December 2001 19:23, Skip Montanaro wrote:
>     >> CPAN is marvelous.  The way the Perl and Python communities
>     >> operate, it fills a niche perfectly in the Perl world, but I think
>     >> would be a bit of a solution looking for a problem in the Python
>     >> world.
>
>     Alex> If it encourages more reuse of code in module A by the author
> of Alex> module B, I think it would be a VERY good influence "in the
> Python Alex> world".  Why *shouldn't* the useful 3rd-party modules we use
> be Alex> free to rely on other useful 3rd-party modules yet?!
>
> Python authors are free to rely on any modules they like, third-party or
> otherwise.  That they don't suggests to me that there's generally fairly
> little need to do that, at least for widely used packages.

To me, it suggests something different: that authors are duplicating 
functionality or doing without it rather than reusing, say, mx.DateTime or 
other packages offering low-level, reusable functionality -- because nobody 
wants their distributed packages to be harder to install and use, and 
therefore less frequently used, by requiring dependencies on others without 
a cpan-ish infrastructure in place.

We'll only know after 2-3 years that a Cpan-ish infrastructure becomes 
working (if ever): if at that point the dependencies remain as low as 
they're today, then you were right, and encouraging reuse is not among the 
advantages.  I'm ready to bet a good lunch at Bologna's best restaurant, 
wine included, that dependencies will become much more common, i.e., that 
reuse will indeed have been encouraged.


Alex



From ws-news at gmx.at  Tue Dec 18 15:15:25 2001
From: ws-news at gmx.at (Werner Schiendl)
Date: Tue, 18 Dec 2001 21:15:25 +0100
Subject: seeing documentation
References: 
Message-ID: <3c1fa4a7$1@brateggebdc5.br-automation.co.at>

Hi Sarcar,

If you are able to import the module, you can list its contents with dir, e.
g. (i used sys, 'cause I don't have parted)

>>> import sys
>>> dir(sys)
['__displayhook__', '__doc__', ... snipped lots more ..., 'warnoptions',
'winver']

And you can output the docstrings of the module, e. g.

>>> print sys.__doc__
This module provides access to some objects used or maintained by the
interpreter and to functions that interact strongly with the interpreter.

Dynamic objects:

argv -- command line arguments; argv[0] is the script pathname if known
path -- module search path; path[0] is the script directory, else ''
... snipped ...

and it's elements, e. g.

>>> print sys.exit.__doc__
exit([status])

Exit the interpreter by raising SystemExit(status).
If the status is omitted or None, it defaults to zero (i.e., success).
If the status numeric, it will be used as the system exit status.
If it is another kind of object, it will be printed and the system
exit status will be one (i.e., failure).


hth
Werner

"Sarcar, Shourya C (MED)"  wrote in message
news:mailman.1008694342.24749.python-list at python.org...
> i am trying to figure out the interfaces for GNU parted from python
> I am not able to get hold on any documentation. is it possible to get
> documentation out when i am able to do "import parted"
> i think i have a lib for parted in /usr/lib/python but not the source
> code.
>
> thanks in advance
>




From garth_grimm at hp.com  Tue Dec  4 11:01:05 2001
From: garth_grimm at hp.com (Garth Grimm)
Date: Tue, 04 Dec 2001 08:01:05 -0800
Subject: httplib request is slow on read()
References: 
Message-ID: <3C0CF341.4030206@hp.com>

John Hunter wrote:

> I am using httplib to make a direct GET request, and then dumping the
> data to file with 
> 
> of = open('temp.dat', 'w')
> f = h.getfile()
> data = f.read()
> of.write( h.getfile().read() )
> 
> where h is the httplib object.
> 
> The read() part is really slow.  When I request the same data from my
> browser, it loads very quickly, which suggests to me that there may be
> a faster way to get this data into the file.


Check to make sure that that comparison is valid.  Browsers often cache DNS lookups, images, and 
entire web pages.  Your python runs won't do this unless you've coded that support in.  Also, some 
browsers will start rendering before all of the file is received.  You'll have to do some special 
coding if you want your file to start being written before the full response has been received.


> 
> I don't know if read() is waiting for some end of file that is
> delayed... or what...
> 
> Any suggestions?
> 
> Thanks,
> John Hunter
> 



From syver-en+usenet at online.no  Sun Dec  2 14:04:18 2001
From: syver-en+usenet at online.no (Syver Enstad)
Date: 02 Dec 2001 20:04:18 +0100
Subject: request, info from pydoc
Message-ID: 

Is there any tools that allows pydoc to be read in info. I already
have the python info documentation installed, it works great. It would
be helpful to have pydoc integration with emacs too, to browse modules
not from the python library. 
-- 

Vennlig hilsen 

Syver Enstad


From gh_pythonlist at gmx.de  Thu Dec 20 09:24:59 2001
From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=)
Date: Thu, 20 Dec 2001 15:24:59 +0100
Subject: How to generate XML
In-Reply-To: <3c21e330@news.opennet.it>
References: <3c21e330@news.opennet.it>
Message-ID: <20011220142458.GA6294@lilith.hqd-internal>

Le 20/12/01 ? 14:10, Fabrizio ?crivit:
> Does anybody know if there are modules to generate XML?
> I know there is SAX, but it is only for parsing, isn't it?

You can use the DOM API for this. I had a similar question on the Python
XML mailing list, and Martin von L?wis proposed a much simpler approach
instead:

http://mail.python.org/pipermail/xml-sig/2001-December/006779.html

I've also put my first Python XML script online. It reads a
configuration from an XML file using DOM and also creates XML via the
DOM API again. The Python XML docs are thin, so this might actually be
useful for someone:

http://www.cs.fhm.edu/~ifw00065/VitaminP/index.html

Gerhard
-- 
mail:   gerhard  bigfoot  de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))



From jyrinxatmindspringdotcom  Wed Dec  5 00:29:30 2001
From: jyrinxatmindspringdotcom (Jyrinx)
Date: Tue, 4 Dec 2001 21:29:30 -0800
Subject: Python evangelists unite!
References:  <9u77i8$a5j$1@slb0.atl.mindspring.net> <91acf731.0111301017.31cd71a5@posting.google.com> <9ufdth$155$1@slb5.atl.mindspring.net> <91acf731.0112031205.2782a5f9@posting.google.com> <9uhpkh$9u7$1@slb5.atl.mindspring.net> <91acf731.0112040753.49b930cd@posting.google.com> <3C0D217E.A5683D37@ccvcorp.com>
Message-ID: <9ukbaj$thh$1@slb0.atl.mindspring.net>

> The *real* advantage for dynamically adding methods/attributes to an
object, comes
> when you don't have control over the original object.
>
> If I have a commercial library to manage some task, and I want to store
objects
> from *that* library in my own object database, then I don't have the
option of
> having library objects inherit from some Persistent root class.  In Python
this
> can be solved in two ways, one of which is mix-in multiple inheritance,
the other
> of which is dynamically adding whatever methods and attributes are needed,
as they
> are needed.
>
> In other words, it's not a solution for avoiding baggage, it's a solution
for not
> being *able* to put the needed "baggage" in place.   :)

Gotcha. Well, at this point I can see the use for singleton methods in an
object database, but I'm still not convinced of the need in a general
language. In a more self-contained program, how often do you suddenly find
yourself with someone else's object at runtime and need to add functionality
like that? Besides, if I may continue stubbornly to stick by my favorite
contender :-) , I should think it would be trivial to have a Python library
to add this sort of runtime extension, if it isn't easy already. (Great.
I've argued myself in a circle - Ruby supports this paradigm too well; well,
maybe it could be useful; well, it's not hard in Python either :-) ... )
Anyway, this looks to me like a useful feature best relegated to a standard
library, more than a major feature of a general-purpose language.

I could be wrong, though ... where else have you guys found singleton
methods useful?

Jyrinx
jyrinx at mindspring dot com




From tatebll at aol.com  Sun Dec 30 10:07:22 2001
From: tatebll at aol.com (Bill Tate)
Date: 30 Dec 2001 07:07:22 -0800
Subject: REPOST: Re: Zope Documentation (was RE: Python Popularity: Questions and  Comments)
References:   <3C2E55A6.D873E301@engcorp.com>
Message-ID: <2$--$$_----____$-$@news.noc.cabal.int>

Peter Hansen  wrote in message news:<3C2E55A6.D873E301 at engcorp.com>...
> Bill Tate wrote:
> > 
> > I understand the "zen" thing, 
> 
> If you say that, then you don't really understand it. ;-)

  OK - I'll put in another way.  I "perceive" that there exists a
timeline from which the Zope newbie enters the "realm" of
confusion/uncertainty wrt Zope and then eventually achieves some
degree of enlightment, "oneness" or "harmony" if you will with respect
to its use and power.  Fair enough??? :>)

> > but it's not something that business
> > people are going to care about when they making a decision about
> > whether to use it or not.
> 
> As a business person, I take mild exception to that.  I'd rather
> have "zen" from Zope than "marketing" from Microsoft.

Hmmm - so as a business person, that begs the question would you
prefer someone pitching Zope to you in abstract terms or would you
prefer them to describe its benefits in practical and concrete terms
that are relevant to any business???  My personal preference is to
ignore the marketing coming from Sun, MS, Oracle, IBM, et.al.; I
prefer to stick to facts that I can substantiate or back up.

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: tatebll at aol.com (Bill Tate)
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 04:56:48 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774206 27193 211.57.49.2 (31 Dec 2001 04:50:06 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:50:06 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From lac at strakt.com  Sat Dec  8 13:28:02 2001
From: lac at strakt.com (Laura Creighton)
Date: Sat, 08 Dec 2001 19:28:02 +0100
Subject: Tinker vs wxPython ?- Opinions/Views 
In-Reply-To: Message from Roman Milner  
   of "Sat, 08 Dec 2001 01:48:56 CST." <87elm62luf.fsf@speeder.org> 
References: <3ReQ7.21098$2Fd.14596@news1.bloor.is>  <87elm62luf.fsf@speeder.org> 
Message-ID: <200112081828.fB8IS2ua027069@ratthing-b246.strakt.com>

If you want fancier Tkinter widgets, that somebody else has made for you,
try tix
http://tix.sourceforge.net

If you want to make your own new widgets, check out Tkinter 3000
http://www.pythonware.com/products/tkinter/tkinter3000.htm
Actually do that if you want to make your exisiting Tkinter gui faster,
too.

Anygui is not a project about allowing you to have all the widgets
that you have ever seen in any gui whatsoever in whatever toolkit you
have now.  If you thought it was a way to automatically translate from
one GUI to another, you have the wrong idea.  On the other hand, you
should be able to run whatever backend you like in native mode and mix
things, if that is what you want.

And, finally, if you really wanted Tinter, not Tkinter ... ie you
want the text mode gui using curses for no window system at all, you want:
http://home.iximd.com/~dwalker.  And reading Fredrik Lundh will not
help you with this much, though the name is not a coincidence.



From mail at andreas-penzel.de  Sun Dec  2 18:01:54 2001
From: mail at andreas-penzel.de (Andreas Penzel)
Date: Mon, 3 Dec 2001 00:01:54 +0100
Subject: number of values in a list
Message-ID: <9uebug$81d1i$1@ID-69142.news.dfncis.de>

Hello NG!

I have a list and want to know the number of values.
Example: abc = [5,10,15,20,25,30]
result should be: 6

What to do?


Thanks, Andreas




>From "Powerful Cell Phone Accessory"@sonnetusa.com Sun Dec 02 18:06:58 2001
Received: from [192.16.191.8] (helo=hera.cwi.nl)
	by mail.python.org with esmtp (Exim 3.21 #1)
	id 16AfhJ-0001OR-00
	for python-list at python.org; Sun, 02 Dec 2001 18:06:58 -0500
Received: from bacchus.cwi.nl (bacchus.cwi.nl [192.16.191.9]) by hera.cwi.nl with ESMTP
	id AAA05551 for ; Mon, 3 Dec 2001 00:06:54 +0100 (MET)
From: "Powerful Cell Phone Accessory"@sonnetusa.com
Received: from mailout6-0.nyroc.rr.com (mailout6-1.nyroc.rr.com [24.92.226.177]) by bacchus.cwi.nl with ESMTP
	id VAA22700 for ; Sun, 2 Dec 2001 21:25:07 +0100 (MET)
Received: from mail1.twcny.rr.com (mail1-1 [24.92.226.139])
	by mailout6-0.nyroc.rr.com (8.11.6/Road Runner 1.12) with ESMTP id fB2KOv620722;
	Sun, 2 Dec 2001 15:24:57 -0500 (EST)
Received: from sonnetusa.com ([24.24.30.72]) by mail1.twcny.rr.com
          (Post.Office MTA v3.5.3 release 223
          ID# 0-59787U250000L250000S0V35) with SMTP id com;
          Sun, 2 Dec 2001 15:24:54 -0500
Received: from lsawp.hotbot.com by sonnetusa.com (SMI-8.6/SMI-SVR4)
	id PAA18667; Sun, 2 Dec 2001 15:28:30 -0500
Date: Sun, 2 Dec 2001 15:28:30 -0500
Message-Id: <200112022028.PAA18667 at sonnetusa.com>
To: many.rcpt at kevin.sonnetusa.com
Cc: pugh at metigoshe.ndak.net, ray at wwd.net, python-list at cwi.nl,
        wheelersprks at yahoo.com, smcred at jetstream.net, stillett at cmp.com
Subject: How To Greatly Increase Your Calling Area ...                                    [ufypt]
Content-Type: multipart/alternative;
	boundary="----=_NextPart_1007324688.001"
Sender: python-list-admin at python.org
Errors-To: python-list-admin at python.org
X-BeenThere: python-list at python.org
X-Mailman-Version: 2.0.8 (101270)
Precedence: bulk
List-Help: 
List-Post: 
List-Subscribe: ,
	
List-Id: General discussion list for the Python programming language 
List-Unsubscribe: ,
	
List-Archive: 

This is a multi-part message in MIME format.

------=_NextPart_1007324688.001
Content-Type: text/plain; charset="windows-1252"
Content-Transfer-Encoding: 7bit

http://pavilion/pgm/adcopy/booster.html
Increase your cell phone
reception for just $14.99
Click Here

We will increase your reception dramatically or your money back!
Enhance your cell phone, pager, or two way radio's signal for better reception in large
buildings, tunnels, elevators, and many other places where the signal may get weak causing
static, missed calls, dropped calls, etc. This easy-to-install internal antenna is like
adding 4 feet worth of antenna to your phone! this signal booster will:

reduce static
provide clarity
stabilize reception
work on any phone
work on any system

Easy to Install
Just slip in behind battery!

Get a FREE anti-radiation shield!

Click Here

30
Day Money Back Guarantee!

Address Removal Instructions
This advertisement provides all recipients
with a no-cost method to permanently remove thier e-mail address from future mailings. To
permanently remove your address 
click here to send your request.



------=_NextPart_1007324688.001
Content-Type: text/html; charset="windows-1252"
Content-Transfer-Encoding: quoted-printable




http://pavilion/pgm/adcopy/booster.html





Increase your cell phone
reception for just $14.99

Click Here

We will increase your reception dramatically or your mo= ney back! Enhance your cell phone, pager, or two way radio's signal for better re= ception in large buildings, tunnels, elevators, and many other places where the signal m= ay get weak causing static, missed calls, dropped calls, etc. This easy-to-install internal= antenna is like adding 4 feet worth of antenna to your phone! this signal booster will:=

  • reduce static
  • provide clarity
  • stabilize reception
  • work on any phone
  • work on any system

Easy to Install
Just slip in behind battery!



Get a FREE anti-radiation shield!<= /font>


Click Here

30 Day Money Back Guarantee!
 

 


Add= ress Removal Instructions

This advertisement = provides all recipients with a no-cost method to permanently remove thier e-mail address from f= uture mailings. To permanently remove your address
click here to send your request= .

 

------=_NextPart_1007324688.001-- >From "Powerful Cell Phone Accessory"@sonnetusa.com Sun Dec 02 18:07:03 2001 Received: from [192.16.191.8] (helo=hera.cwi.nl) by mail.python.org with esmtp (Exim 3.21 #1) id 16AfhO-0001Tc-00 for python-list at python.org; Sun, 02 Dec 2001 18:07:02 -0500 Received: from bacchus.cwi.nl (bacchus.cwi.nl [192.16.191.9]) by hera.cwi.nl with ESMTP id AAA05549 for ; Mon, 3 Dec 2001 00:06:54 +0100 (MET) From: "Powerful Cell Phone Accessory"@sonnetusa.com Received: from mailout5.nyroc.rr.com (mailout5-0.nyroc.rr.com [24.92.226.122]) by bacchus.cwi.nl with ESMTP id VAA22708 for ; Sun, 2 Dec 2001 21:25:43 +0100 (MET) Received: from mail1.twcny.rr.com (mail1-1 [24.92.226.139]) by mailout5.nyroc.rr.com (8.11.6/Road Runner 1.12) with ESMTP id fB2KPax01070; Sun, 2 Dec 2001 15:25:36 -0500 (EST) Received: from sonnetusa.com ([24.24.30.72]) by mail1.twcny.rr.com (Post.Office MTA v3.5.3 release 223 ID# 0-59787U250000L250000S0V35) with SMTP id com; Sun, 2 Dec 2001 15:25:31 -0500 Received: from gbhdy.hotbot.com by sonnetusa.com (SMI-8.6/SMI-SVR4) id PAA18764; Sun, 2 Dec 2001 15:29:05 -0500 Date: Sun, 2 Dec 2001 15:29:05 -0500 Message-Id: <200112022029.PAA18764 at sonnetusa.com> To: many.rcpt at kevin.sonnetusa.com Cc: pugh at metigoshe.ndak.net, ray at wwd.net, python-list at cwi.nl, wheelersprks at yahoo.com, smcred at jetstream.net, stillett at cmp.com Subject: How To Greatly Increase Your Calling Area ... [ubbbk] Content-Type: multipart/alternative; boundary="----=_NextPart_1007324721.001" Sender: python-list-admin at python.org Errors-To: python-list-admin at python.org X-BeenThere: python-list at python.org X-Mailman-Version: 2.0.8 (101270) Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: This is a multi-part message in MIME format. ------=_NextPart_1007324721.001 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit http://pavilion/pgm/adcopy/booster.html Increase your cell phone reception for just $14.99 Click Here We will increase your reception dramatically or your money back! Enhance your cell phone, pager, or two way radio's signal for better reception in large buildings, tunnels, elevators, and many other places where the signal may get weak causing static, missed calls, dropped calls, etc. This easy-to-install internal antenna is like adding 4 feet worth of antenna to your phone! this signal booster will: reduce static provide clarity stabilize reception work on any phone work on any system Easy to Install Just slip in behind battery! Get a FREE anti-radiation shield! Click Here 30 Day Money Back Guarantee! Address Removal Instructions This advertisement provides all recipients with a no-cost method to permanently remove thier e-mail address from future mailings. To permanently remove your address click here to send your request. ------=_NextPart_1007324721.001 Content-Type: text/html; charset="windows-1252" Content-Transfer-Encoding: quoted-printable http://pavilion/pgm/adcopy/booster.html

Increase your cell phone
reception for just $14.99

Click Here

We will increase your reception dramatically or your mo= ney back! Enhance your cell phone, pager, or two way radio's signal for better re= ception in large buildings, tunnels, elevators, and many other places where the signal m= ay get weak causing static, missed calls, dropped calls, etc. This easy-to-install internal= antenna is like adding 4 feet worth of antenna to your phone! this signal booster will:=

  • reduce static
  • provide clarity
  • stabilize reception
  • work on any phone
  • work on any system

Easy to Install
Just slip in behind battery!



Get a FREE anti-radiation shield!<= /font>


Click Here

30 Day Money Back Guarantee!
 

 


Add= ress Removal Instructions

This advertisement = provides all recipients with a no-cost method to permanently remove thier e-mail address from f= uture mailings. To permanently remove your address
click here to send your request= .

 

------=_NextPart_1007324721.001-- >From "Powerful Cell Phone Accessory"@sonnetusa.com Sun Dec 02 18:07:08 2001 Received: from [192.16.191.8] (helo=hera.cwi.nl) by mail.python.org with esmtp (Exim 3.21 #1) id 16AfhT-0001UB-00 for python-list at python.org; Sun, 02 Dec 2001 18:07:07 -0500 Received: from bacchus.cwi.nl (bacchus.cwi.nl [192.16.191.9]) by hera.cwi.nl with ESMTP id AAA05494 for ; Mon, 3 Dec 2001 00:06:49 +0100 (MET) From: "Powerful Cell Phone Accessory"@sonnetusa.com Received: from mailout5.nyroc.rr.com (mailout5-0.nyroc.rr.com [24.92.226.122]) by bacchus.cwi.nl with ESMTP id VAA22701 for ; Sun, 2 Dec 2001 21:25:08 +0100 (MET) Received: from mail1.twcny.rr.com (mail1-1 [24.92.226.139]) by mailout5.nyroc.rr.com (8.11.6/Road Runner 1.12) with ESMTP id fB2KOwx00597; Sun, 2 Dec 2001 15:24:58 -0500 (EST) Received: from sonnetusa.com ([24.24.30.72]) by mail1.twcny.rr.com (Post.Office MTA v3.5.3 release 223 ID# 0-59787U250000L250000S0V35) with SMTP id com; Sun, 2 Dec 2001 15:24:57 -0500 Received: from sricu.hotbot.com by sonnetusa.com (SMI-8.6/SMI-SVR4) id PAA18670; Sun, 2 Dec 2001 15:28:30 -0500 Date: Sun, 2 Dec 2001 15:28:30 -0500 Message-Id: <200112022028.PAA18670 at sonnetusa.com> To: many.rcpt at kevin.sonnetusa.com Cc: pugh at metigoshe.ndak.net, ray at wwd.net, python-list at cwi.nl, wheelersprks at yahoo.com, smcred at jetstream.net, stillett at cmp.com Subject: How To Greatly Increase Your Calling Area ... [prtkb] Content-Type: multipart/alternative; boundary="----=_NextPart_1007324692.001" Sender: python-list-admin at python.org Errors-To: python-list-admin at python.org X-BeenThere: python-list at python.org X-Mailman-Version: 2.0.8 (101270) Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: This is a multi-part message in MIME format. ------=_NextPart_1007324692.001 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit http://pavilion/pgm/adcopy/booster.html Increase your cell phone reception for just $14.99 Click Here We will increase your reception dramatically or your money back! Enhance your cell phone, pager, or two way radio's signal for better reception in large buildings, tunnels, elevators, and many other places where the signal may get weak causing static, missed calls, dropped calls, etc. This easy-to-install internal antenna is like adding 4 feet worth of antenna to your phone! this signal booster will: reduce static provide clarity stabilize reception work on any phone work on any system Easy to Install Just slip in behind battery! Get a FREE anti-radiation shield! Click Here 30 Day Money Back Guarantee! Address Removal Instructions This advertisement provides all recipients with a no-cost method to permanently remove thier e-mail address from future mailings. To permanently remove your address click here to send your request. ------=_NextPart_1007324692.001 Content-Type: text/html; charset="windows-1252" Content-Transfer-Encoding: quoted-printable http://pavilion/pgm/adcopy/booster.html

Increase your cell phone
reception for just $14.99

Click Here

We will increase your reception dramatically or your mo= ney back! Enhance your cell phone, pager, or two way radio's signal for better re= ception in large buildings, tunnels, elevators, and many other places where the signal m= ay get weak causing static, missed calls, dropped calls, etc. This easy-to-install internal= antenna is like adding 4 feet worth of antenna to your phone! this signal booster will:=

  • reduce static
  • provide clarity
  • stabilize reception
  • work on any phone
  • work on any system

Easy to Install
Just slip in behind battery!



Get a FREE anti-radiation shield!<= /font>


Click Here

30 Day Money Back Guarantee!
 

 


Add= ress Removal Instructions

This advertisement = provides all recipients with a no-cost method to permanently remove thier e-mail address from f= uture mailings. To permanently remove your address
click here to send your request= .

 

------=_NextPart_1007324692.001-- From jkraska at san.rr.com Mon Dec 17 00:31:36 2001 From: jkraska at san.rr.com (Courageous) Date: Mon, 17 Dec 2001 05:31:36 GMT Subject: Wrap C function which takes variable lengthed parameters? References: <6p5j1u0oag2ofkam8o7fig5dvkfc2392hk@4ax.com> <3C19990E.BE0F3FA@alcyone.com> <3C19AC0B.7ABD04DF@xs4all.nl> <3C1D767D.7BBE45EC@cosc.canterbury.ac.nz> Message-ID: On Mon, 17 Dec 2001 17:37:17 +1300, Greg Ewing wrote: >Just van Rossum wrote: >> >> But you can't contstruct a va_list and pass it to a _vararg_ function; > >You can construct a wrapper that will handle up to >some maximum number of parameters, by exploiting the >fact that a varargs function doesn't care if you pass >it more parameters than it's expecting -- Is this guaranteed not to corrupt the stack on all systems? C// From kevin at cazabon.com Mon Dec 17 18:09:49 2001 From: kevin at cazabon.com (Kevin Cazabon) Date: 17 Dec 2001 15:09:49 -0800 Subject: if __name__ == "__main__" References: Message-ID: <5a4226f0.0112171509.30e46e05@posting.google.com> THis is commonly used to allow a script to determine if this module was "executed" or "imported" script another script. In the namespace of the module that was the one actually executed, __name__ will be "__main__". In all others, it will be something else (hmmm... what will it be, never thought about it?). So, you can use "if __name__ == '__main__': do_this()" to build in a self-test for that particular module, or use it to allow the module to be used on its own, or to provide functions to other scripts. Kevin. crennert at pbmplus.com (Chris Rennert) wrote in message news:... > Hello, > > Could someone please fill me in on how the if __name__ == "__main__ > thing works. I am reading through some tutorials and I never really > get a clear definitive answer on that. > Is this like main() in C? > Any help would be greatly appreciated. From ssthapa at classes.cs.uchicago.edu Sat Dec 8 03:47:58 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Sat, 08 Dec 2001 08:47:58 GMT Subject: strict python? References: Message-ID: Brian Sturk wrote: >def func ( self ): > print hello > >def call_func( self ): > self.func <--- no parentheses > >my script that had code like this ran fine, but >didn't call the function. I would have thought that >this would have been an error since there was no >assignment of any kind. I would really object to that. I use expressions like self.func to refer to functions and to create function lookups all the time. E.g. returning self.func so that the it can be used later as a callback or some other function. It's also pretty handy to have a dictionary that associates functions with xml elements for classes that extend the SAX ContentHandler class. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From bror.johansson at avionics.saab.se Tue Dec 4 06:48:43 2001 From: bror.johansson at avionics.saab.se (Bror Johansson) Date: Tue, 4 Dec 2001 12:48:43 +0100 Subject: Where's the error? Message-ID: <9uibrc$199$1@newstoo.ericsson.se> I have tried, retried, and retried again to understand why Python 2.1 tells me this: Traceback (most recent call last): File "D:\Src\Python\renamevobtag.py", line 12, in getlsvobresults regline = re.compile('^(\*)?\s+\\([^\s]+)\s+\\\\([^\s]+)\s+(p(rivate)|(ublic))\s*$') File "d:\python21\lib\sre.py", line 90, in compile return _compile(pattern, flags) File "d:\python21\lib\sre.py", line 136, in _compile raise error, v # invalid expression error: unbalanced parenthesis when approaching this line: regline = re.compile('^(\*)?\s+\\([^\s]+)\s+\\\\([^\s]+)\s+(p(rivate)|(ublic))\s*$') Can anyone help me clear my eyesight? I can of course switch over to 'split', but I want to get rid of the extra backslashes. /BJ From ssthapa at classes.cs.uchicago.edu Wed Dec 19 21:44:18 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Thu, 20 Dec 2001 02:44:18 GMT Subject: Python CPAN beta test References: Message-ID: Walter Moreira wrote: > File "/usr/local/lib/python2.1/xml/sax/__init__.py", line 88, in >make_parser > raise SAXReaderNotAvailable("No parsers found", None) >xml.sax._exceptions.SAXReaderNotAvailable: No parsers found > >When I call the function xml.sax.make_parser() the same exception is >raised. Is there something missing in my installation? > I think you're missing expat. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From paul at zope.com Sat Dec 29 19:57:46 2001 From: paul at zope.com (Paul Everitt) Date: Sat, 29 Dec 2001 19:57:46 -0500 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> <87k7v5hdcv.fsf@moskau.hmotakef.homeip.net> Message-ID: <3C2E668A.9080303@zope.com> Thanks for the pointer. I got the download (had to register, grrr), but it doesn't seem to contain much except code. The online pages seem to have API docs. But I can't find much that documents the actual problem being solved. It seems to all be about the code. Is there some other place to find a step-by-step walkthrough of requirements, use cases, etc.? --Paul Henrik Motakef wrote: > Paul Everitt writes: > > >>I'm interested in hearing more about the Pet Shop example you >>mentioned. Is it a canonical example that is written up somewhere >>else for a different system? >> > > "The JavaTM Pet Store Demo is a sample application from the Java 2 > Platform, Enterprise Edition Blue Prints (J2EETM BluePrints) program > at Java Software, Sun Microsystems. It demonstrates how to use the > capabilities of the J2EE 1.3 platform to develop flexible, scalable, > cross-platform enterprise applications" > (http://developer.java.sun.com/developer/sampsource/petstore/index.html) > > "Compared to the Java Pet Store, Microsoft claims that the .NET > version requires one-third the lines of code (LOCs) and provides 28 > times faster average response times (for 450 concurrent users), > requires one-sixth the CPU-utilization, and scales much better as the > number of users increases." > (http://www.onjava.com/pub/a/2001/11/28/catfight.html) > > hth > Henrik > From max at alcyone.com Tue Dec 11 00:42:12 2001 From: max at alcyone.com (Erik Max Francis) Date: Mon, 10 Dec 2001 21:42:12 -0800 Subject: strict python? References: <3C1060E4.756F33B2@earthlink.net> <9v43b9$o54$1@peabody.colorado.edu> Message-ID: <3C159CB4.A4D15BC3@alcyone.com> Fernando P?rez wrote: > Basically pychecker can do a lot of what my hypothetical -w flag > would, but I still think that kind of language control belongs > inside, not as an add-on. I agree. In my opinion, if PyChecker became a part of the standard distribution (not necessarily as a part of the Python executable itself), it would be win all the way around. -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ Laws are silent in time of war. \__/ Cicero Esperanto reference / http://www.alcyone.com/max/lang/esperanto/ An Esperanto reference for English speakers. From wurmy at earthlink.net Fri Dec 21 20:30:03 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Sat, 22 Dec 2001 01:30:03 GMT Subject: Which Python version? Message-ID: <3C23E0BA.E49446D6@earthlink.net> Howdy y'all, I have been wondering what the best choice of Python version would be when starting a new program or module. The latest version (2.2, since today) would be an obvious choice. But this would put people with older versions at a disadvantage; they'd either have to download the latest Python, or just not use the program/module. (Or patch it... but that is something else.) Also, when a new Python version comes out, auxiliary packages are often not immediately available. Think wxPython, Numeric, etc, but essentially this is true for every package that relies on a certain version (often because of DLL dependencies). So, in my case, I could wait until third-party developers have caught up, but this means that in the meantime I cannot use all those shiny new features of the latest Python incarnation, nor can I use packages that rely on it, which puts _me_ at a disadvantage. This is not desirable either. I don't think there is a real solution for this kind of problem, but I would like to hear what others decide to do in a situation like this. --Hans From ulf.magnusson at ubm-computing.com Sat Dec 29 11:09:36 2001 From: ulf.magnusson at ubm-computing.com (Ulf Magnusson) Date: Sat, 29 Dec 2001 16:09:36 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <4VlX7.6657$l93.1694996@newsb.telia.net> I am shocked and exhilarated what large discussion this turned out to be. I have been reading this news subject (started by Ron Stephens) all day long (Well almost :-) The future of a language (and especially Python) is truly an interesting topic. The submissions to this "news category" have truly been interesting. It was said that "we" (the community) wanted more "real" Commercial usage, Patrick (RPM1 ) said: "The guy with the bag of money needs to say, "Oh yeah, Python, I've heard of that."" It was also said that python vs. other languages didn't lack any functionality well I agree, it don't since it's "Turing complete" like all other computer languages, instead, one could possibly talk about the "supporting libraries" and python is darn good in that area. However, Python do lack one important heuristic for the commercial industry - RUNTIME SPEED - (Well this is not always true) I have a "little" proposal how to get gain more acceptance for the language and to defeat the speed problem: an OPTIMIZING NATIVE CODE COMPILER should be developed... Pheeew.. now I said it... (time to seek out the bomb shelter.. :-)) I guess I am a kind of a optimization junkie for mentioning this... anyhow I am not saying we should compete with languages like C in speed but a fairly optimizing compiler would be nice without compromising the language capabilities. Now the guy with the bag of money can say: "I bought a optimizing Python compiler yesterday"... and his associate would say: "Good for you, now your company can both develop applications rapidly which are free from bugs and even execute them safe and fast" Before you all jump at me at once, let me make a obvious initial statements: 1. Since the language is currently evolving very rapidly it is probably a bad time to start such a project, the language may look completely different in a year and a lot of resources would have been wasted. 2. It may be difficult and dumb to develop a native code compiler because Pythons great introspection capabilities. I haven't really thought about this issue for long, but it should at least be possible and cool... 3. Companies may have trouble to accept python before the language evolvement curve is fairly slow, consider trying to "link" python modules from 1.5.2 and "python 3.0" ouch... And now, what do you valued colleagues have to say about: 1 an optimizing native code compiler? 2 the commercial impact of such a compiler? (If by any chance a commercial company is considering this, I am for hire) /U. Magnusson **************************************** * Ulf Magnusson, Swedish Developer * UBM Computing * Mail: ulf.magnusson at ubm-computing.com * www: http://www.ubm-computing.com **************************************** From syver-en+usenet at online.no Sat Dec 29 10:12:47 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 29 Dec 2001 16:12:47 +0100 Subject: Finding out that Python is in interactive mode in sitecustomize.py References: <3C2B8F47.4CEACF6E@olen.to> Message-ID: Joonas Paalasmaa writes: > How can I find out that Python is started in interactive mode in > sitecustomize.py ? > The need for that information is, that I want that certain > customizations take place only at > interactive mode. If you just need special setup for interactive mode you could do as I do and define the environment variable PYTHONSTARTUP to some python file. The file refered to will be executed only when you're starting python interactively. -- Vennlig hilsen Syver Enstad From djc at object-craft.com.au Mon Dec 24 09:23:34 2001 From: djc at object-craft.com.au (Dave Cole) Date: 25 Dec 2001 01:23:34 +1100 Subject: Albatross 0.04 released (first public announcement) Message-ID: Albatross is a small toolkit for developing highly stateful web applications. The toolkit has been designed to take a lot of the pain out of constructing intranet applications although there is no real reason why you should not use Albatross for deploying publicly accessed web applications. In slightly more than 2600 lines of Python you get the following: - An extensible HTML templating system similar to DTML including tags for: - Tree browsing. - Macro definition and expansion. - Automatic sequence pagination. - Lookup tables to translate internal program value to arbitrary template text. - Application classes which offer the following features: - Optional server side or browser side sessions. - The ability to place Python code for each page in a dynamically loaded module, or to place all page processing code in a single mainline. - The ability to deploy applications either as CGI or via mod_python by changing less than 10 lines of code. The toolkit application functionality is defined by a collection of fine grained mixin classes. Six different application types and four different execution contexts are prepackaged, you are able to define your own drop in replacements for any of the mixins to alter any aspect of the toolkit semantics. Application deployment is controlled by your choice of Request class. It should be possible to develop a Request class for FastCGI or Medusa to allow applications to be deployed on those platforms with minimal changes. Albatross comes with around 120 pages of documentation. HTML, PDF and PostScript formatted documentation is available from the toolkit homepage. The toolkit homepage: http://www.object-craft.com.au/projects/albatross/ Merry Christmas! - Dave -- http://www.object-craft.com.au From jlh at home.com Sat Dec 29 20:13:03 2001 From: jlh at home.com (Jeff Hinrichs) Date: Sat, 29 Dec 2001 19:13:03 -0600 Subject: REMOTE_IMPORT was[Re: The Fiery Bush Python One True Universal Web Server...] References: <3C2CBACB.FBF3C3C9@mindspring.com> <3C2D47F0.6DF7C8BE@mindspring.com> <3C2DF5FF.E332F4EE@mindspring.com> <3C2E61FD.4CA44C0@earthlink.net> Message-ID: <023001c190cf$21487030$6702a8c0@gato> I saw these comments earlier today and it got me thinking.... About a system were you could specify in your code a module, version and a remotemodule server (ala cpan) something like this pseudo code popped in to my head.... moduleName = Remote_Import(genericName, version, remoteHost, useLatest, forceRefresh) import moduleName as genericName Where the remote_import function could specify a module and version and if it wasn't installed fetch it from a remote host and install it. Versioning could be done by naming conventions and then if the import command allowed something like the above you could say import distutils-1.0.9 as distutils It would be easy then to refactor existing code to use this new system. All of this is beyond my current python skills but I thought it might spark something for someone else.... -Jeff >>...I'd like to say that it almost seems like Python > > is not that far away from allowing as a language feature: > > > > from module.python.org import * > > > > or > > > > from module.python.org import graphics > > > > where "module.python.org" is some internet node. > > > > Wouldn't this go some way towards solving the problem of > > encouraging more module sharing a la Perl's CPAN but in a > > Python-esque way...? > > > > -- > > Dr. David J. Ritchie, Sr. > > djrassoc01 at mindspring.com > > http://home.mindspring.com/~djrassoc01/ > > > > > -- > http://mail.python.org/mailman/listinfo/python-list From logiplexsoftware at earthlink.net Fri Dec 21 14:32:52 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Fri, 21 Dec 2001 11:32:52 -0800 Subject: Python on the desktop In-Reply-To: References: Message-ID: <20011221113252.2cdc848f.logiplexsoftware@earthlink.net> On Fri, 21 Dec 2001 14:23:02 -0500 (EST) Steven Majewski wrote: > On Fri, 21 Dec 2001, Courageous wrote: > programmers are doing it for fun. ( Does anybody program in VC++ > for fun? :-) I think there is a small subculture of enthusiasts: I saw an ad in the back of a magazine for "BD/SM/VC++". It had a grainy photo of a man in a leather mask being spanked with a MFC reference manual. -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From cypher_dpg at yahoo.com Fri Dec 7 17:45:46 2001 From: cypher_dpg at yahoo.com (Jeremy Jones) Date: Fri, 7 Dec 2001 17:45:46 -0500 Subject: Why doesn't this work? In-Reply-To: ; from jkraska@san.rr.com on Fri, Dec 07, 2001 at 04:06:53AM +0000 References: Message-ID: <20011207174546.A3571@cerberus.liberty> * Courageous (jkraska at san.rr.com) wrote: > > Python 2.2b2 (#26, Nov 16 2001, 11:44:11) [MSC 32 bit (Intel)] on > win32 > Type "copyright", "credits" or "license" for more information. > IDLE 0.8 -- press F1 for help > >>> def f(): return [1,2,3] > > >>> f() > [1, 2, 3] > >>> f().append(4) > >>> l=f().append(4) > >>> l > >>> I'll let someone else address why this doesn't work. I couldn't tell you. Intuitively, it really looks like it should not work and that Python is behaving properly. But if you do this: >>> def f(): return [1,2,3] >>> f() [1, 2, 3] >>> l = f() >>> l [1, 2, 3] >>> l.append(4) >>> l [1, 2, 3, 4] >>> I think you get behavior closer to what you were looking for. When you did: > >>> f().append(4) it doesn't seem like the [1, 2, 3] "IS" anywhere for you to append anything to it. It seems like you should have to put it into something before you can do anything with it. Jeremy Jones From aleax at aleax.it Fri Dec 28 07:03:03 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 13:03:03 +0100 Subject: REPOST: Re: module path References: Message-ID: <8$--$$_--__-%$-$_$@news.noc.cabal.int> "Garett Shulman" wrote in message news:n1an2u4rvau9f86r5dcl895lokb05354pr at 4ax.com... > I would like to store my modules and scripts in a folder other than > the python folder. Does anyone have any suggestions as to what I need > to do in order to be able to import the scipts in the interpreter? Is > there a path that the interpreter searches which I could modify? Yes, and that path is a list, named 'path', in standard module 'sys'. You can do, for example: import sys sys.path[0:0] = '/my/directory' and on successive imports, "/my/directory" will be tried before other directories on sys.path. There are also more permanent ways to alter sys.path. The handiest one is to put a textfile, any name, extension .pth, in the Python directory (the site-packages one, under Linux; just C:\Python22, under Windows). yourfile.pth can list any number of directories, one per line; they will all be added to sys.path during startup (by module site.py). This makes your directories be appended AFTER others in the path, though. You can also define environment variable PYTHONPATH, or, on Windows, hack the registry. Alex ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail Message-ID: Control: cancel Subject: cmsg cancel From: "Alex Martelli" Newsgroups: comp.lang.python X-No-Archive: yes Lines: 2 NNTP-Posting-Host: wonenara.ozemail.com.au X-Trace: ozemail.com.au 1009643033 203.108.164.177 (Sun, 30 Dec 2001 03:23:53 EST) NNTP-Posting-Date: Sun, 30 Dec 2001 03:23:53 EST Organization: OzEmail Ltd, Australia Distribution: world Date: Sat, 29 Dec 2001 13:25:39 GMT This message was cancelled from within Mozilla. From db3l at fitlinxx.com Tue Dec 4 21:35:03 2001 From: db3l at fitlinxx.com (David Bolen) Date: 04 Dec 2001 21:35:03 -0500 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: Ben Wolfson writes: > On Tue, 04 Dec 2001 19:47:59 -0600, Cliff Wells wrote: > > > After reading this entire thread, I think there are valid arguments on > > both sides, so I'll be avoiding both tabs and spaces in all my code. > > I understand several successful Perl and C programs are written that way. Some even consider it an art form. -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l at fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/ From d_krause at pixelpark.com Thu Dec 27 16:36:12 2001 From: d_krause at pixelpark.com (Dirk Krause) Date: 27 Dec 2001 13:36:12 -0800 Subject: REPOST: Poor man's Winzip Message-ID: <8$--$$_----_-----$@news.noc.cabal.int> Hi, I put up some code on http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/104733 This program does the three essential tasks that (at least) I need: 1. Unzip an archive to a folder 2. Zip a folder to an archive 3. Zip a (big) file to an archive For convenient usage, get Gordon McMillan's Installer Package, and freeze this application with > python freeze.py zip2folder.py After that, you will have a self containing EXE that will work even without having python installed. Drop this thing into the 'sendto' folder, and you have a very convenient way to use this program via right mouseclick/sendto zip2folder. (I fiddled with the registry until I found a link giving the extraordinairy simple an undangerous 'sendto' solution). Regards, Dirk ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: d_krause at pixelpark.com (Dirk Krause) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:28:25 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775578 27193 211.57.49.2 (31 Dec 2001 05:12:58 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:12:58 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From eppstein at ics.uci.edu Thu Dec 6 20:45:07 2001 From: eppstein at ics.uci.edu (David Eppstein) Date: Thu, 06 Dec 2001 17:45:07 -0800 Subject: An implementation of a variation on "for 1 <= i <= 10" [was Re: PEP 276 Simple Iterator for ints (fwd)] References: <9uomtp$e1cbj$1@fido.engr.sgi.com> Message-ID: In article , QnickQm at alum.mit.edu (Nick Mathewson) wrote: > Here's some code that implements almost this behavior. Now you can type: > > for i in 1 <= ints <= 10: > print i Cool. It looks like you haven't added the logic yet to make for i in x < ints <= y work correctly when x and y are not known to be integers, but range() doesn't take nonintegers either (according to the Python 2.1 Library Reference, anyway). -- David Eppstein UC Irvine Dept. of Information & Computer Science eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/ From grey at despair.dmiyu.org Tue Dec 4 10:31:41 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Tue, 04 Dec 2001 15:31:41 -0000 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <3C0BE492.5DACEA18@mega-nerd.com> <3C0C55A8.EAD03FD5@cosc.canterbury.ac.nz> Message-ID: On Tue, 04 Dec 2001 17:48:40 +1300, Greg Ewing wrote: > This concern *has* been addressed, by suggesting the > above be written as Which ignored the point as I stated it was a simplified example. > Also, there seems to be some confusion in this discussion > about two quite different kinds of formatting: Python > block-indentation on the one hand, and cosmetic lining-up > on the other. People arguing in favour of tabs are talking > only about the former, not the latter. No, there is no confusion. The tab people are ignoring that there is formatting other than indention alone. > If you need to do cosmetic lining-up, the best thing is > to use whatever your current convention is for block > indentation up to the syntactic level of the statement, > and then use spaces-only after that. It still won't work > if viewed with a proportional font, but it's the best > that can be done using plain ASCII. Mixing tabs and spaces? You just suggested mixing tabs and spaces. Thank you for finally seeing reason and maybe now you'll understand why tabs are NOT to be used. -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From jkraska at san.rr.com Fri Dec 7 19:30:25 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 08 Dec 2001 00:30:25 GMT Subject: Calling a generator multiple times References: Message-ID: <0gn21usqeasqa1bp4sveh0vjagtmbmfpof@4ax.com> >A generator is a function or method that -- by virtue of using the yield >statement -- I understand how it works, intuitively. My objection is not that I don't understand it, but rather that a lone keyword appearing in the content of the method definition actually changes what is being defined. That's just plain wrong. C// From MAILBOX-SA at nameconnector.com Thu Dec 27 17:03:33 2001 From: MAILBOX-SA at nameconnector.com (System Attendant) Date: Thu, 27 Dec 2001 17:03:33 -0500 Subject: ScanMail Message: To Recipient virus found and action taken. Message-ID: ScanMail for Microsoft Exchange has detected virus-infected attachment(s). Sender = Tania Duby Recipient(s) = python-list at python.org Subject = Scanning Time = 12/27/2001 17:03:33 Action on virus found: The attachment info.DOC.scr exists WORM_BADTRANS.B virus. ScanMail has Moved it. The attachment was moved to C:\Program Files\Trend\Smex\Virus\info.DOC3c2b9ab51.scr_. --------------------------------------------------------------- Warning to recipient. ScanMail has detected a problem with an email message. This message may have contained a virus, or it may have contained an executable file as an attachment (exe,com,bat,pif,shs,js). This message has been cleaned. From maxm at normik.dk Fri Dec 21 05:50:31 2001 From: maxm at normik.dk (Max M) Date: Fri, 21 Dec 2001 11:50:31 +0100 Subject: PyGame on Lamp References: Message-ID: <3c2313e5$0$35624$edfadb0f@dspool01.news.tele.dk> So many fun things to try, so little time :-( "Oleg Broytmann" > http://www.onlamp.com/pub/a/python/2001/12/20/pygame.html From logiplexsoftware at earthlink.net Sat Dec 29 19:13:37 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Sat, 29 Dec 2001 16:13:37 -0800 Subject: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) In-Reply-To: References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> <3C2E498B.6DC757E0@stroeder.com> Message-ID: <20011229161337.231742c0.logiplexsoftware@earthlink.net> On Sat, 29 Dec 2001 23:29:19 GMT Courageous wrote: > C remains in use because it's a better portable > assembly than its unnamed younger decendent, and likewise is quite clear. My sentiments exactly: C is excellent as the equivalent of a modern assembly language. -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From tub4jxr at hotmail.com Tue Dec 18 15:13:43 2001 From: tub4jxr at hotmail.com (Jose Rodriguez) Date: 18 Dec 2001 12:13:43 -0800 Subject: PythonWare: Anyone using for real projects? References: Message-ID: <89302408.0112181213.648c18b9@posting.google.com> We have gotten to using Visual Slickedit and Primalscript mostly after testing a variety of editors including AcitiveState's, Pythonware, Multi-Edit, etc. Primalscript being the more useful of the two. "A. Keyton Weissinger" wrote in message news:... > Besides the pythonworks team, of course... > > I read this review: > http://www.webreview.com/2001/07_20/developers/index02.shtml > > and have stayed away. I am using the BlackAdder beta and so far am > unimpressed (though in their defense it is a beta). > > I've not used ActiveState's VisualPython. I've always liked the slickness of > VStudio, but hated the handcuffs. We'll see if the .NET version is any > better. > > I know Pythonware 1.3 is out. Does it address the issues in the review>? I > will do my homework on this as well, but wanted to see if anyone out there > had answered the question already... > > Thank you!!! > > Keyton > > -----Original Message----- > From: python-list-admin at python.org > [mailto:python-list-admin at python.org]On Behalf Of Benjamin Tai > Sent: Friday, December 14, 2001 7:11 AM > To: python-list at python.org > Subject: what is self._base? > > > Hi, > > I have come across the following statement in a constructor (Programming > Python by Mark Lutz). After extending a type in C (stacktype), it is > wrapped by a Python class (Stack). > > import stacktype > class Stack: > def __init__(self, start=None): > self._base = start or stacktype.Stack() > > However I can't find any documents/explanation for the following: > > 1) What is "_base" > 2) What is "start=None" > 3) Why can't I just write "self = stacktype.Stack()" > > > Any help for this newbie would be appreciated. > > Ben From logiplexsoftware at earthlink.net Fri Dec 21 13:24:05 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Fri, 21 Dec 2001 10:24:05 -0800 Subject: (no subject) In-Reply-To: References: Message-ID: <20011221102405.43af3ea8.logiplexsoftware@earthlink.net> On Fri, 21 Dec 2001 10:53:05 +0300 "Konstantin Kushchov" wrote: > > -- > http://mail.python.org/mailman/listinfo/python-list I'd have to see a lot more information before I could give you a good answer, but I'd venture either "no" or "7" at this point. -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From jeff at ccvcorp.com Mon Dec 3 14:36:49 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Mon, 03 Dec 2001 11:36:49 -0800 Subject: A modest indentation proposal References: Message-ID: <3C0BD451.E807CA31@ccvcorp.com> Erann Gat wrote: > It turns out that what made the bosses unhappy about Lisp was not the > syntax but the fact that no one uses it. And before you protest and tell > me that it's not true that no one uses Lisp, yes, I *know* it's not true. > I also know that indentation is not much of a problem in practice. Well, you could tell your bosses that the folks at Lawrence Livermore (among other places) have been using Python for years (or so all the Python literature tells us), and don't seem to have a problem with indentation. I understand that NASA has some different constraints than LL would, however, I can't see how the indentation "issue" would be more harmful in one case than the other. And LL, being another big gov't/scientific endeavor, should have some similarity... It does sound to me (as someone else has more-or-less pointed out) that your bosses may simply be rationalizing. It's not that indentation is seen as a problem, it's that Python (or change in general?) is seen as a problem and they're finding excuses to avoid it. If that is the case, then your only way to convince them would be to demonstrate (as Laura Creighton suggests) just how much more effective you can be using Python. Jeff Shannon Technician/Programmer Credit International From max at alcyone.com Fri Dec 14 13:41:59 2001 From: max at alcyone.com (Erik Max Francis) Date: Fri, 14 Dec 2001 10:41:59 -0800 Subject: Unsung Python modules References: <3dsnad226b.fsf@ute.mems-exchange.org> Message-ID: <3C1A47F7.583E2A2F@alcyone.com> Andrew Kuchling wrote: > What's your favorite unsung module? Sing with me: asyncore/asynchat, asyncore/asynchat. -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ Laws are silent in time of war. \__/ Cicero Esperanto reference / http://www.alcyone.com/max/lang/esperanto/ An Esperanto reference for English speakers. From db3l at fitlinxx.com Mon Dec 10 15:30:08 2001 From: db3l at fitlinxx.com (David Bolen) Date: 10 Dec 2001 15:30:08 -0500 Subject: Populating a list References: <3C150599.33C3449B@attbi.com> Message-ID: Chris Barker writes: > Python does close the file when it's reference count goes to zero, which > will happen as soon as that line is done processing. I'm pretty sure it > is guaranteed, I certainly have never had a problem with it. That's > what's nice about Python's reference counting scheme. Note that "Python" the language doesn't guarantee this behavior, but rather it's an aspect of the current CPython implementation using reference counting that behaves this way (but Jython doesn't, for example). Of course, plenty of people people write code depending on that behavior and like it, but it's not guaranteed by the language, so if you want to be absolutely certain of recovering resources such as file handles, you should explicitly close them when done using them. -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l at fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/ From tim.one at home.com Tue Dec 4 23:09:49 2001 From: tim.one at home.com (Tim Peters) Date: Tue, 4 Dec 2001 23:09:49 -0500 Subject: Embedding Python in C++ application: Question #1 In-Reply-To: <8a12e538.0112040934.17df3790@posting.google.com> Message-ID: [Russell Turpin] > OK. I'm finding the relevant interfaces in Python/C API. > Do I read this right, that all new objects are created > with a refcount of 1 , Yes. > so that a called function can pass them to the caller without ref-count > manipulation? Yes. The flip side of that is that if you don't pass ownership of the reference on to someone else, you must explicitly Py_DECREF it (else it will leak). From plhess at cvzoom.net Sat Dec 15 00:08:53 2001 From: plhess at cvzoom.net (Peter Hess) Date: 14 Dec 2001 23:08:53 -0600 Subject: Package Question - please help. References: Message-ID: "A. Keyton Weissinger" wrote in news:mailman.1008384979.29742.python-list at python.org: > I have (on a Win2K box) the following dir setup: > > c:\package1 > \__init__.py > \subpackage1 > \__init__.py > \myCode.py > \subpackage2 > \__init__.py > \testMyCode.py > > testMyCode.py is a unit test for myCode.py. It attempts to load a class > from within myCode.py with something like the following: > > from package1.subpackage1.myCode import MyClass > > I've added c:\package1 to the path (by adding it in the registy -- is > there an easier way?). Yep. For Win2k, right-click My Computer | Properties | Advanced tab, click Environment Variable button, add your environment variables in the appropriate box (probably System). The one you want to add is PYTHONPATH, not PATH. Python uses PYTHONPATH (among other things) to determine where to look for modules. You'll need to restart your command shell to pick this change up. More info in the docs (look for PYTHONPATH). > If I attempt to run testMyCode.py from within subpackage2, it dies and > gives me: > > Traceback (most recent call last): > File "testMyCode.py", line 3, in ? > from package1.subpackage1.myCode import MyClass > ImportError: No module named package1.subpackage1.myCode Because the interpreter is looking for a package named package1.subpackage1.myCode in the search path, which doesn't contain a reference to c:\ (where the root of this package is). Check the search path interactively like so: >>> import sys >>> sys.path ['', 'path1', 'path2', ... ] The empty string at the beginning represents the current working directory. os.getcwd() will tell you what it is at the moment. > BUT, if I move that file to the root (c:\) and run it from there, it > runs like a champ. Now the root of the package (package1) is in the CWD, which is on the module search path. -- Peter Hess -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- From max at alcyone.com Tue Dec 4 13:44:28 2001 From: max at alcyone.com (Erik Max Francis) Date: Tue, 04 Dec 2001 10:44:28 -0800 Subject: minidom References: <9uhr26$nfs$1@newsg1.svr.pol.co.uk> <3C0C7DD5.AC50A8CB@engcorp.com> <9ui8sv$7kf$1@newsg4.svr.pol.co.uk> Message-ID: <3C0D198C.7C0AD0E9@alcyone.com> Duncan Smith wrote: > OK. I'll give that a go. I was using 'doc = > xml.dom.minidom.parse(f)' and > getting 'None' returned from 'nodeValue'. Cheers. Note that it's the nodeValue of the child of the element with the tag, not the nodeValue of the element. -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ Laws are silent in time of war. \__/ Cicero Esperanto reference / http://www.alcyone.com/max/lang/esperanto/ An Esperanto reference for English speakers. From bob at passcal.nmt.edu Thu Dec 13 12:30:37 2001 From: bob at passcal.nmt.edu (Bob Greschke) Date: Thu, 13 Dec 2001 10:30:37 -0700 Subject: Python Imaging Library and fonts Message-ID: <9vaoj3$bqr$1@newshost.nmt.edu> At the beginning of my Python program I create an Entry field. I then use cget to get the font that the system has set the Entry field to use. Then I set all of the other fields to use that same font. In general, I personally have no idea what the font is, and I don't even really mind which one it is. I just want everything to use the same one. Further on down the line I use the PIL to draw a graph. How do I convey to the PIL font stuff that I want it to use the same font as the rest of the frame for its labels and such? PIL wants to start with font files. I can't seem to find the connection. This has to run on Solaris, Linux, Windows... Thanks! Bob From phd at phd.pp.ru Tue Dec 11 13:11:30 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Tue, 11 Dec 2001 21:11:30 +0300 Subject: A common GUI define like rebol VID? In-Reply-To: <9v5hdb$bsv$1@tyfon.itea.ntnu.no>; from mlh@idi.ntnu.no on Tue, Dec 11, 2001 at 06:56:59PM +0100 References: <9v12k6$ak9$1@mail.cn99.com> <9v5hdb$bsv$1@tyfon.itea.ntnu.no> Message-ID: <20011211211130.C24106@phd.pp.ru> On Tue, Dec 11, 2001 at 06:56:59PM +0100, Magnus Lie Hetland wrote: > Anygui will hopefully work on all these platforms. (Yes, *including* > DOS... We already have beginning implementations of textgui and cursesgui > in CVS :) Do you mean to reimplement curses for DOS? Or use some DOS implementation of curses? Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From ulbi at ivs.tu-berlin.de Wed Dec 5 08:11:12 2001 From: ulbi at ivs.tu-berlin.de (Andreas Ulbrich) Date: Wed, 05 Dec 2001 14:11:12 +0100 Subject: Printing from Windows References: <9ui1ki$lfv$1@news.netpower.no> <20011204111022.682cc9dc.use-net@schabi.de> <3C0CA3BB.9090508@gmx.net> <20011204160622.7afb6a2a.use-net@schabi.de> Message-ID: <3C0E1CF0.4070401@ivs.tu-berlin.de> Markus Schaber wrote: > Hi, > > On Tue, 04 Dec 2001 11:21:47 +0100 > Andreas Ulbrich wrote: > > >>>Maybe the gtk+ printing works with windows and unix in the same way. >>> >>>This has the disadvantage that gtk+ is not part of standard python, >>>but there are some extreme powerful widgets there (including embedding >>>the mozilla engine). >>> >>I personally prefer PyQt for this purpose. Of course, just like gtk+ its >>not part of the standard Python distribution. Using Qt seems somewhat >>more sane to me. But well that's pretty much a matter of taste :-) >> > > But Qt has the license disadvantage on windows platform. > > markus > Maybe, but AFAIK. PyQT does freely (beer) include Qt. From jeff at ccvcorp.com Thu Dec 27 15:20:42 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Thu, 27 Dec 2001 12:20:42 -0800 Subject: A new message board is up References: <40dbad98.0112262232.1868734e@posting.google.com> <3C2B724D.E4D31E24@ccvcorp.com> <3C2B74B8.D2FE36F5@stroeder.com> Message-ID: <3C2B829A.DD0AED79@ccvcorp.com> Michael Str?der wrote: > Jeff Shannon wrote: > > [..] > > I won't be participating in this Python EZBoard. > > I always wonder why people put "web forums" in place. I can't read > them while being off-line (e.g. on the train) and they are damn > slow. Newsgroups and mailing lists are the right medium for this > kind of communication. > > Ciao, Michael. Eh, they have their purpose. They're easier to set up than a newsgroup, and more widely accessible (decent browsers are more widely distributed than decent newsreaders). And once a certain volume is reached, they're easier to organize and maintain than a mailing list (including automatic archiving, and purging of old archives, the latter of which may or may not be desirable). It's also easier to include images and such in posts (which, again, may or may not be desirable). And the membership/registration requirements are somewhere in between Usenet (none) and mailing lists (members only). For an open, technical forum in which long-term archiving is desirable, Usenet is definately a preferable medium. For informal social groups, web forums can make a nice alternative to mailing lists. Jeff Shannon Technician/Programmer Credit International From ddidierd78 at netzero.net Sun Dec 16 13:25:58 2001 From: ddidierd78 at netzero.net (ddidierd78) Date: Sun, 16 Dec 2001 18:25:58 GMT Subject: /usr/bin/env: python: No such file or directory Message-ID: Hi, I am running redhat 7.2 and installed the following: python2.2-2.2b1-2.i386.rpm python2.2-devel-2.2b1-2.i386.rpm python2.2-tools-2.2b1-2.i386.rpm When trying to run a script, I get the following message: /usr/bin/env: python: No such file or directory additionally the only thing relating to python in /usr/bin is the file python2.2 Thanks for any help, Dan From ghpb at newsguy.com Tue Dec 25 12:49:16 2001 From: ghpb at newsguy.com (Guenter Bechly) Date: Tue, 25 Dec 2001 18:49:16 +0100 Subject: cheap German Python book at Ebay Message-ID: Hi, I just want to let you know that I offer the following German Python book for a start-price of only 1,- Euro at Ebay: Martin von L?wis & Nils Fischbek (1997) "Das Python-Buch - Referenz der objektorientierten Skriptsprache f?r GUIs und Netzwerke", Addison-Wesley, 483 pages plus CD-ROM. Original price 69,90 DM. Excellent condition. http://cgi.ebay.de/aw-cgi/eBayISAPI.dll?ViewItem&item=1400488387 Cheers, Guenter From usenet at NOSPAM-irmen.cjb.net Sat Dec 22 07:56:56 2001 From: usenet at NOSPAM-irmen.cjb.net (Irmen de Jong) Date: Sat, 22 Dec 2001 13:56:56 +0100 Subject: Platform-independent GUID creation? References: <9vtn13$aq9$1@panix3.panix.com> Message-ID: > >Does anyone have a readily-portable equivalent to the pythoncom.CreateGuid() > >function? > > The problem is that the DCE/OSF GUID standard specifies using the MAC > address of the network card as part of a GUID. There isn't a portable > way to get that, unfortunately. I've crafted my own Guid function, and it is used heavily in Pyro (pyro.sourceforge.net). It uses the machine's IP address instead of the MAC address, and adds the Pid and some other stuff (timestamp, random number). I don't know the DCE standard, but I do think that my routine is fairly "safe", so to speak. At least it is portable across all Python implementations, but the machine needs to have an IP address. A physical MAC address is not requiered, so it should work nicely on modem-only machines. Irmen de Jong From loewis at informatik.hu-berlin.de Fri Dec 28 13:37:31 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 28 Dec 2001 19:37:31 +0100 Subject: [Q] Deepcopy with Python 2.2 ? References: <440c5c6a.0112280847.55c92de7@posting.google.com> Message-ID: setar at gmx.de (Oliver Hofmann) writes: > I've had a few problems with copying objects lately when they > reference each other. My understanding is that deepcopy should > take care of that due to the memo - dictionary; this does not > seem to be the case. > > The following code works fine if Base does _not_ inherit > from object. If it does the result is: I'd recommend to report this as a bug at sf.net/projects/python. What happens is: - you define a new type using new-style classes, i.e. none of the builtin deepcopiers applies. In particular, your instance's type is *not* - your type does not implement __deepcopy__ - it does implement __reduce__ (as inherited from object) Unfortunately, it appears that in the reduce case, the memo is not taken into account. This is where I think the bug lies. You can work around this problem by defining a __deepcopy__ method in your Base class def __deepcopy__(self, memo): obj = object.__new__(self.__class__, None) memo[id(self)] = obj for k,v in self.__dict__.iteritems(): obj.__dict__[k] = copy.deepcopy(v, memo) return obj HTH, Martin From com-nospam at ccraig.org Tue Dec 11 11:32:50 2001 From: com-nospam at ccraig.org (Christopher A. Craig) Date: 11 Dec 2001 11:32:50 -0500 Subject: PEP 276 Simple Iterator for ints (fwd) In-Reply-To: <30949732.1008057189@[192.168.1.100]> References: <9uomtp$e1cbj$1@fido.engr.sgi.com> <9up46o$e2ost$1@fido.engr.sgi.com> <3C150188.C31AC4B8@ccvcorp.com> <30949732.1008057189@[192.168.1.100]> Message-ID: David Eppstein writes: > On 12/11/01 8:26 AM -0500, Christopher A. Craig wrote: > > That looks quite clear to me. A heck of a lot clearer than > > > > for i in y > i >= x: print i > > > > Which to me does not specify the step size for floats. (If y=5 and > > x=0, shouldn't that print 3.1415926 at some point?) > > I said, the INTEGERS between x and y. I know it's what you said you wanted, but it's not what y > i >= x indicates for a float. Sure, the only reasonable default step size for floats is 1, but that doesn't mean I have to accept that y > i >= x for floats y and x means "integers such that y > i >= x". Your loop for i in y > i >= x: print i Means "For all integers 'i' starting below y and ending greater than or equal to x, print i". My point is that the syntax: i = floor(y) while i >= x: print i i -= 1 makes a whole lot more sense. It explicitly specifies both that you want integers and what the step size is, while your syntax does not. I agree that if there were only foreach style "for" loops in Python then your proposed syntax would be very elegant (though I would still rather see the bounds cast to integers to make it clear we are in the integer domain), but luckily we have "while" loops, which fit the problem domain you seem to be addressing much better. I may be wrong, there may be some class of problems where you really want to use a foreach style "for" loop to iterate over a set of integers (other than a half-open, increment by one range for sequence indexing), but I can't think of what that might be. -- Christopher A. Craig From richard at bizarsoftware.com.au Mon Dec 10 18:21:29 2001 From: richard at bizarsoftware.com.au (Richard Jones) Date: Tue, 11 Dec 2001 10:21:29 +1100 Subject: Instantiating Python class from C In-Reply-To: <3C1539D8.9090408@research.att.com> References: <3C1539D8.9090408@research.att.com> Message-ID: <200112102320.fBANKZk34525@bigboy.bizarsoftware.com.au> On Tuesday 11 December 2001 9:40 am, Arno Puder wrote: > Hi, > > assume I have a Python class, defined through the interpreter. How do I > instantiate a new object of this class in C within an extension of the > Python interpreter. E.g., > > # Python > class A: > #... > > // C > PyObject* new_A_object = ??? Get a handle to the class and then call it, just like in Python code. The functions you want are: Loading the module that defines the class: http://www.python.org/doc/current/api/importing.html PyImport_ImportModule Getting the class and calling it: http://www.python.org/doc/current/api/object.html PyObject_GetAttrString PyObject_CallObject Richard From wurmy at earthlink.net Wed Dec 5 18:54:27 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Wed, 05 Dec 2001 23:54:27 GMT Subject: Strip HTML tags from downloaded files References: Message-ID: <3C0EB1AA.EFE67FDC@earthlink.net> Thomas Pham wrote: > > When I use urlretrieve to download a file from the web, the raw text file have HTML tags embedded at the beginning and the end of the file. > > > > > >
> > > Is there anyway to strip all the HTML tags from the file? > > Thanks, > -- Look into the sgmllib module. Here's an example; you will probably want to change it to suit your needs: #---begin--- import sgmllib import string class HTMLStripper(sgmllib.SGMLParser): def __init__(self, verbose=0): sgmllib.SGMLParser.__init__(self, verbose) self.data = [] def handle_data(self, data): self.data.append(data) def getdata(self): return string.join(self.data) if __name__ == "__main__": hs = HTMLStripper() hs.feed(open("filename.html", "rb").read()) print hs.getdata() HTH, --Hans From debl2Nonospammmy at bellatlantic.net Sat Dec 22 12:30:15 2001 From: debl2Nonospammmy at bellatlantic.net (David Lees) Date: Sat, 22 Dec 2001 17:30:15 GMT Subject: Fate of win32all? References: <7876a8ea.0112212116.2ebabc23@posting.google.com> <3C242A7F.2060805@skippinet.com.au> Message-ID: <3C24C346.54D5E634@bellatlantic.net> This is a 'me too' reply, but I also want to thank Mark for the PythonWin IDE, which as a long time windows I use regularly. In fact, at work, where Linux is the OS of choice, I still use PythonWin as an editor on Samba mounted drives, while actually executing on the Linux box (using an x-term client running on my local PC). Very convenient, because it allows use of the same editor at home and office. david lees Mark Hammond wrote: > > stalin wrote: > > > I've used win32all occasionally--always in noncommercial settings--and > > have found it helpful. I'd like to thank Mr. Hammond for developing > > the packages > > My pleasure. > > > and ActiveState for supporting their recent maintenance > > by employing Hammond. > > Unfortunately, I am no longer employed by ActiveState :( > > > Mr. Hammond had personally developed the win32 packages to > > considerable maturity before he became involved with ActiveState. His > > employment by ActiveState appears to have come to an untimely end just > > recently ( http://mail.python.org/pipermail/python-dev/2001-December/019038.html > > ). I don't mean to be insensitive--I'm sure Hammond has a lot on his > > mind right now--but I wonder about the fate of win32all. What role > > does ActiveState now play in licensing the package? Has the original > > author lost a degree of his control over it to his former employer? > > Nope. The win32all license remains unchanged. See the license.txt > files in the distribution. Basically *anyone* is free to do whatever > they choose with the package, including building their own distribution. > ActiveState have no special rights over this at all. > > Specifically, I fully intend releasing new win32all packages. > ActiveState did have me working very hard on Komodo, but no longer ;) I > am leaving for a Christmas break, but intend getting a win32all out by > the new year - if not, just a few days after. > > Mark. From usenet at NOSPAM-irmen.cjb.net Fri Dec 28 19:38:33 2001 From: usenet at NOSPAM-irmen.cjb.net (Irmen de Jong) Date: Sat, 29 Dec 2001 01:38:33 +0100 Subject: [ANN] Pyro 2.3 available Message-ID: You can get the latest Pyro version (2.3) at http://pyro.sourceforge.net What's new: Event server fixes (not all problems yet, but many) Speed improvements. Documentation updates. Name Server resolving by hostname config item. What is Pyro? Pyro is an acronym for PYthon Remote Objects. It is a basic Distributed Object Technology system written entirely in Python. It is extremely easy to implement a distributed system with Pyro, because all network communication code is abstracted and hidden from your application. You just get a remote Python object and invoke methods on the object on the other machine. Pyro offers you a Name Server, an Event Service, mobile objects, remote exceptions, dynamic proxies, remote attribute access, automatic reconnection, a detailed manual, and many examples to get you started right away. Irmen de Jong From nospam at bigfoot.com Fri Dec 28 16:47:52 2001 From: nospam at bigfoot.com (Gillou) Date: Fri, 28 Dec 2001 22:47:52 +0100 Subject: using codecs for encryption? References: <3c2bf123_2@corp.newsgroups.com> Message-ID: Yes, Have a look to M2CRYPTO, http://www.post1.com/home/ngps/m2/ "Joshua Muskovitz" a ?crit dans le message news: 3c2bf123_2 at corp.newsgroups.com... > This just in, from the top of my head... > > Has anyone thought about implementing encryption libraries (des, pgp, &c) as > codecs in 2.2? Would there be a way to pass a key (or keypair) to the > codec? The codec would also have to maintain some sort of state somehow. > > I just think it would be really cool to be able to say something like: > > c = DESCodec(key) > plaintext = 'shh, here's the secret formula...' > ciphertext = plaintext.encode(c) > ... > c.resetState() > plaintext = ciphertext.decode(c) > > -- josh > > > > > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- > http://www.newsfeeds.com - The #1 Newsgroup Service in the World! > -----== Over 80,000 Newsgroups - 16 Different Servers! =----- From calves at coelce.com.br Thu Dec 20 08:43:38 2001 From: calves at coelce.com.br (Alves, Carlos Alberto - Coelce) Date: Thu, 20 Dec 2001 10:43:38 -0300 Subject: Comunicating through COM ports Message-ID: <29A97D00F387D411AC7900902770E14803253737@LCOEEXC01> Anybody could give me an example code of how connect/comunicate through COM ports (i.e. COM1, COM2). I'm under windows 98. Thanks!!! Carlos Alberto COELCE/DPRON-Departamento de Projetos e Obras Norte Fone: 677- 2228 e-mail: calves at coelce.com.br \|||/ (o o) --ooo0-(_)-0ooo-- -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin at cazabon.com Sun Dec 9 23:40:40 2001 From: kevin at cazabon.com (Kevin Cazabon) Date: 9 Dec 2001 20:40:40 -0800 Subject: python cgi questions References: <8SRQ7.22622$zp5.1091695@typhoon.austin.rr.com> Message-ID: <5a4226f0.0112092040.5cf0cab1@posting.google.com> I'd suggest going at it the other way around: Use a normal submit button for the form, and include an onclick to update the href location of the frame to the downloaded file. Kind of like:
I believe that will do what you want... try it out though first, of course, it's written off the top of my head. No cgi is really needed here, except myform.cgi for taking the info from the form and updating the database. You could even use a variable value in the onclick so that it downloaded a file specified by some other item on the form. (onclick="_self.location.href=self.form1.selectfieldname.value" Kevin Cazabon. "DeepBlue" wrote in message news:<8SRQ7.22622$zp5.1091695 at typhoon.austin.rr.com>... > I have the following cgi python question. > I need to allow users to download files through a series of HREF links. > But also I need to be able to update a database table when a user clicks on > the link. > So, each file to be downloaded is in its separate Form. And each link has > an ONCLICK event that submits the form for the corresponding file. When the > form is submitted I was hoping that the database is updated with values in > hidden fields in each form, and the user can download the file. > But, I can accomplish only one thing: either the form is submitted or the > file is downloaded. > Can both things be accomplished: > 1. File is downloaded when link is clicked, and > 2. Form is submitted through onclick event in javascript > (onclick=document.form.submit) > > > Also, is it possible using a python script to submit a form in the > background without anything being returned to the browser? > In this case, I send the information via the python script (form submitted) > and the database is updated, but nothing is returned to the browser so that > the current page stays as is. > Thanks for any help or hints, > DB From r.b.rigilink at chello.nl Fri Dec 7 10:21:30 2001 From: r.b.rigilink at chello.nl (Roeland Rengelink) Date: Fri, 07 Dec 2001 15:21:30 GMT Subject: [Q] Overhead for lists as properties? References: <440c5c6a.0112070634.4d6e6d03@posting.google.com> Message-ID: <3C10DEAC.8F293D60@chello.nl> Oliver Hofmann wrote: > > 'lo everyone! > > Trying to figure out why appending to a list that is a class property > takes so much longer than appending to a class attribute; this seems > not to be the case for getting or setting other class attributes like > integers. > > [snip results] First of all, to let properties work as expected, the Tester classes should be new-style classes (derived from object, for example). If I do that, I get: 100043 function calls in 7.330 CPU seconds Ordered by: internal time List reduced from 12 to 10 due to restriction <10> ncalls tottime percall cumtime percall filename:lineno(function) 5 2.560 0.512 3.770 0.754 prof_prop.py:41(testSettingPropList) 5 2.060 0.412 3.100 0.620 prof_prop.py:31(testSettingProp) 50000 1.210 0.000 1.210 0.000 prof_prop.py:18(getB) 50000 1.040 0.000 1.040 0.000 prof_prop.py:15(setA) 5 0.270 0.054 0.270 0.054 prof_prop.py:36(testSettingNormList) 5 0.150 0.030 0.150 0.030 prof_prop.py:26(testSettingNorm) 1 0.040 0.040 7.330 7.330 prof_prop.py:46(main) 10 0.000 0.000 0.000 0.000 prof_prop.py:9(__init__) 0 0.000 0.000 profile:0(profiler) 10 0.000 0.000 0.000 0.000 prof_prop.py:4(__init__) Pretty much what you would expect. Half the overhead seems to be in executing the additional Python code in getB and setA respectively. A similar overhead is in finding and setting up the functions. Hope this helps Roeland -- r.b.rigilink at chello.nl "Half of what I say is nonsense. Unfortunately I don't know which half" From newscheme at hotmail.com Sat Dec 22 04:02:35 2001 From: newscheme at hotmail.com (New Scheme) Date: 22 Dec 2001 01:02:35 -0800 Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic References: Message-ID: David Rush wrote in message news:... > So who the fuck are you anyway? [...] > This is such bullshit... [...] > This is such bullshit, it has to be a troll. You're secretly Erik > Naggum aren't you? [...] > I did it in Scheme because I don't have to fuck around with > a lot of stupid mis-features from 'advanced' languages like > Perl, Python, Tcl, Ruby, or (God help us) C++ and Java [...] > the current generation of no-talent simps graduating into > the CS business. > > Solicit help from the Common Lisp community [...] > They're a bunch of losers who have bought and sold the > lambda-nature for a profit. [...] > So who the fuck are you, Mr. Hotmail.com? Your extreme pathologic response clearly demonstrates the problem with the small, fundamentalist group of scheme "defenders of the faith" that are being left further and further behind as the world moves forward. Anyone calling for injection of fresh ideas into the language is attacked with a level of spite and religious vehemence rarely seen outside of fundamentalist religious sects. Rather than address the issues raised in the positing, you spent considerable effort attacking me and others in your reply. You attacked other languages such as Lisp, C++ and Perl.. You attacked the other programming communities as if they were the devils own. I can just imagine you frothing at the mouth, up on the pulpit declaring that the evil sinners who do not follow the one true way of scheme will rot in hell for all eternity. Resisting the inevitable, sticking your head in the sand and yelling obscenities at anyone and everyone who has the audacity to suggest change is like pissing into an oncoming typhoon you just end up with wet pants, looking like a sad old man who has lost all bowel control. Its time to reinvigorate scheme. See you in hell. ... > david rush > (who has just watched _the matrix_ for the first time and is feeling > pretty radicalized just at the moment) Congratulations on seeing the matrix; its only been out for, like, three years. That explains alot. ----------------------------------------------------------- David Rush wrote in message news:... > > > newscheme at hotmail.com (New Scheme) writes: > > So who the fuck are you anyway? I mean really, behind the > freshly-minted hotmail alias. You sound like Tom Lord, but that's just > my opinion. > > > *************************************************************** > > Time for a Fresh Scheme Standard > > And to Say Goodbye to the RnRS Relic > > This is such bullshit that I think I'm being trolled. Congratulations > whoever, you have succeeded - but I don't agree with either your tone > or your explicit opinions. R5RS is an excellent document, in spite of > its need for revision. I have only two issues that I think *must* be > fixed, and only one of them is truly controversial. > > No I'm not going to list them - If you don't know you can google for > the info, but I suspect that you already do know. And I suspect that > you have a particular wish-list...care to come out of the closet? > > > Is it time for a new scheme standard? > > No. It is time to open discussions. > > > Is it time to make a break from the ossified RnRS document? > > No. It has been one of the most successful language standards > documents in history, at least by my criteria. > > > Is it time to bring Scheme into the 21st century? > > No. The 21st century still has a lot of catching up to do. > > > Scheme has become very dated. The RnRS series of documents are a > > relic of a more dynamic past but are now little more than a fossil > > record of its ever slowing development. > > This is such bullshit, it has to be a troll. You're secretly Erik > Naggum aren't you? The RnRS series is converging on an idealized > language; the changes are *bound* to become smaller over time. > > > With each year that passes, > > scheme becomes more irrelevant to the practical and academic software > > development, education and research worlds. > > Well I can't speak to academia, but I've got 7KLOC (and headed for the > 20s) of very intelligent *commercially-developed* software which is > very relevant to our business. I did it in Scheme because I don't have > to fuck around with a lot of stupid mis-features from 'advanced' > languages like Perl, Python, Tcl, Ruby, or (God help us) C++ and Java; > all languages which will very quickly become dead-weight in legacy > systems ensuring long-term pay stability for the current generation of > no-talent simps graduating into the CS business. > > Scheme Lives! > > > Solicit help from the Common Lisp community and > > draw upon their extensive practical experience. > > There are no good ideas over there. They've completely missed the > boat. They're a bunch of losers who have bought and sold the > lambda-nature for a profit. I mean really, who could take a language > with that 'for' construct seriously. The 'do' is Scheme is bad > enough. And CLOS, let's not waste time with that over-designed Sherman > Tank. It's not even close to the bleeding edge of object-think. > > > Learn from the > > Functional community and their many strong ideas. > > There is a *huge* cross-over from Scheme to the functional > community. Scheme occupies a significant patch of the intellectual > turf: untyped, eager-evaluation lambda-calculus. > > > And ask the compiler vendors about practicalities. > > There are 2: Chez (who seem to be taking the same tack that killed > Smalltalk and charging $4000/seat), and Erian Concept (who I keep > trying - and failing - to convince myself to try their free beer > version). Scheme, in addition to advancing the pursuit of the > lambda-nature is also essentially free: more free than any other > language. Clearly freedom is too difficult for the mainstream software > community to deal with, but so what? If I lived in New Hampshire I > would put a motion to the State legislature to make Scheme the > official computer language of the State (the State motto is 'Live Free > or Die'), there are more high (and low) quality 'free speech' Schemes > than exist for any other language. What does *that* tell you? > > > Its time for a fresh look at scheme. Its time to break away from the > > RnRS and its brotherhood of old men in their isolated, > > self-referential world. Its time to reinvigorate the language. > > Those are fucking *smart* old men. I just want to get them engaged > again. I realize that the political infighting that got us a language > as good as R5RS is a PITA - I have to deal with similar bullshit as a > software architect at my day job. And it's a thankless job because at > the end of the day, people are only going to pick the thing apart, but > still somebody's got to do it. > > I'm not going to pretend that I can keep up with Shriram, Matthias F, > Will, and Jonathan, or even Olin (no offense intended to Olin, I just > am not aware of his contributions to R5RS), Matthias B, Oleg, and A* > Petrofsky. I do care a lot about Scheme, though, and I wish that we > could get some movement. I fear that Scheme might well suffer the fate > of C and get replaced with something almost infinitely worse if these > people are not involved. > > > Its time for a new standard. > > Only if we can get quality people to work on it. So who the fuck are > you, Mr. Hotmail.com? > > > david rush > (who has just watched _the matrix_ for the first time and is feeling > pretty radicalized just at the moment) From Bruce at EckelObjects.com Fri Dec 7 12:38:27 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Fri, 07 Dec 2001 09:38:27 -0800 Subject: list comprehensions to effect visitors In-Reply-To: References: Message-ID: <200112070938270960.006DF984@mail.rdc1.sdca.home.com> Because of the way the Python implementation of the book (this is "Thinking in Patterns", translated) is going, I'm now thinking that it might make more sense to build the book in Python first, then translate it back into Java. For some reason (grin) it seems to be much easier to work out the ideas and designs using Python... :-) Not sure when I'll have the initial posting of the book, though. *********** REPLY SEPARATOR *********** On 12/7/01 at 9:27 AM Cromwell, Jeremy wrote: >Peter, >I thought we weren't supposed to help people with their homework? > >I know, you just want to encourage an author book> whose written some good books on other languages to >complete his Python book for the benefit of all of us. > >subliminal-messages-need-never-be-queued-ly yr's, >********************************************************** >Jeremy Cromwell >CIENA Core Switching Division >jcromwell at ciena.com > > > >-----Original Message----- >From: Peter Hansen [mailto:peter at engcorp.com] >Sent: Thursday, December 06, 2001 7:11 PM >To: python-list at python.org >Subject: Re: list comprehensions to effect visitors > > >Bruce Eckel wrote: >> >> I am in fact feverishly translating "Thinking in Patterns" into >> "Thinking in Python" to prepare for my tutorial at the Python >> conference, which is due monday. I was certain it would be an >> enormous job as it was with C++ and Java to write these examples, >> but as usual Python changes everything, and I might even hit the >> deadline. > >Why not post some of the samples here as a translation exercise? > >I'm sure there would be a few people interested in helping >translate some of them over the weekend. People with no lives. >(No, not people like me. I meant *other* people... ;-) > >the-c.l.p-community-is-a-large-part-of-python's-advantages-ly yr's, >---------------------- >Peter Hansen, P.Eng. >peter at engcorp.com >-- >http://mail.python.org/mailman/listinfo/python-list > >-- >http://mail.python.org/mailman/listinfo/python-list Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From shriek at gmx.co.uk Tue Dec 25 21:23:43 2001 From: shriek at gmx.co.uk (Stephen) Date: 25 Dec 2001 18:23:43 -0800 Subject: packages using a class in the parent directory ? Message-ID: <97ae44ee.0112251823.155015@posting.google.com> Instead of having a directory full of 30-40 python scripts, I'm trying to package them according to functionality, such as ~ app1.py app2.py message.py /Folder1 - __init__.py - a.py - b.py - c.py ... etc /Folder2 - __init__.py - x.py - y.py - z.py where the main apps sit in the base directory and components that they use are packaged in the folders. The only problem is that some of the python scripts in the subdirectories (ie. in Folder1 & Folder2) need to use a base class ('message.py' above). So, how can the packaged scripts import the class ? The solutions seem to be ~ a) copy message.py to Folder1 and Folder2 but then we have to make sure that all copies of the file are kept in sync b) symlink message.py to each folder, but that doesn't work on win32 even with the cygwin tools. c) add message.py to the sitewide import path, but I try to avoid that wherever possible to ease portability (easy to just copy over the folder and it works). Is there a better way ? Thank you, Stephen. From chrishbarker at attbi.com Mon Dec 3 16:38:48 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Mon, 03 Dec 2001 13:38:48 -0800 Subject: A modest indentation proposal References: <3C0BBC1A.6E4154F@home.net> Message-ID: <3C0BF0E8.2F9E2641@attbi.com> Erann Gat wrote: > In article <3C0BBC1A.6E4154F at home.net>, Chris Barker > wrote: > > I if get this straight, you seem to think that the indentation issue is > > the ONLY thing getting in the way of NASA adopting Python. The only > > "show stopper" at any rate. > No, that is not the case. In fact, you seem to have made this up out of > whole cloth. I may have misinterpretted, but: Erann Gat wrote: > Fortunately, in this case the > list of nit-pick issues seems to be rather short. There's not a whole > laundry list of issues, just this one. Unfortunately, it seems to be a > potential show stopper. I wouldn't call that whole cloth, I would call it a quotation. > > By the way, did you suggest to the LISP community that LISP should > > optionally use something other than all those parentheses? That seems to > > be the main unimportant stumbling block when people used to C/C++ > > consider LISP. > > Yes, as a matter of fact I did. I even implemented it (it's easy to do > within standard Lisp), as have dozens of other people. The only reason I > haven't implement this suggestion myself is that I don't know how. All you need is a pre-processor. With the tokenize module, it would be pretty easy to write one in Python. Or use pyindent, and modify it for your desires. By the way, check out this from the pindent header: # Secret feature: # - On input, a block may also be closed with an "end statement" -- # this is a block-closing comment without the '#' sign. So you could make it part of your code, rather than comments, and typing an end shouldn't be considered too laborious, it's pretty commonly used. If you don't know enough Python to complete this task, no wonder you're having problems selling it. > Yes, I suppose you could say this was a test of sorts. Indentation is not > the only issue that meets with objections, but it is the one that is > easiest to solve. My goal in making the suggestion that I did was as much > to see what kind of responses it would get as to actually get the > suggestion implemented. Did we pass or fail? I think we passed with flying colors, but I imagine your criteria are different. If you wanted to find out whether you could get the Python community to all come together and re-work Python to fit your personal needs, the answer is no, and we could have told you that from the beginning. By the way, even very good ideas that are well excepted very rarely actually get implimented unless the driving force behind the idea writes the code. See all the no-yet-implimented PEPs. In the free software world, you are not going to get anything done unless you write the code, or pay someone to write it for you. Good (and bad) ideas are a whole lot more common than good code. I don't know who wrote pindent.py, but you can bet is was someone who wanted it, not someone who did it only because someone else suggested it might be a good idea. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From chris.gonnerman at newcenturycomputers.net Sun Dec 2 10:09:09 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Sun, 2 Dec 2001 09:09:09 -0600 Subject: Newbie : Installing Python locally in acct on shared server References: <3C0A3F04.3090206@lophty.com> Message-ID: <006c01c17b43$6428b820$0101010a@local> ----- Original Message ----- From: "brian donovan" > situation > ----------------------------------------------- > Apache 1.3.2, Linux > > My account name is "luser". > > My account is located in /home/luser > > I've gunzipped and untarred the .tgz and now I have a directory > /home/luser/Python-2.1.1 > > I'd like to be able to point scripts to /home/luser/Python or > /home/luser/Python-2.1.1. > ----------------------------------------------- > > > I've read the README and Makefle that accompany the distro and tried to > use the --prefix=/home/user/Python when I ./configure part of the # > ./configure, make, make test, make install dance and have gotten basic > "hello world" type scripts pointing at this install to work, but > anything that imported a module (any module) failed. HMMMM... First, I'd recommend ./configure --prefix=/home/luser make make test make install Make sure any script you write has #!/home/luser/bin/python at the top. This really should work... From jason at jorendorff.com Mon Dec 10 13:18:11 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Mon, 10 Dec 2001 12:18:11 -0600 Subject: Win32all documentation? In-Reply-To: Message-ID: > Um... yes, though I may be splitting hairs. I've got > a pretty solid grasp of Python in general, and I've > been programming Windows in C/C++ for nearly 10 years. > The part I don't understand clearly is win32all > *itself*. The API is split across a number of modules, roughly on "subject matter" lines. >>> import win32gui >>> def my_callback(window, extra): ... title = win32gui.GetWindowText(window) ... if title: ... print title ... >>> win32gui.EnumWindows(my_callback, None) (70 lines of junk) >>> import win32net >>> print win32net.USE_LOTS_OF_FORCE 2 I found some documentation, but it's quite sparse: http://aspn.activestate.com/ASPN/Python/Reference/Products/ActivePython/Pyth onWin32Extensions/modules.html A few console-mode functions are in "import msvcrt". Good luck. -- Jason Orendorff http://www.jorendorff.com/ From bob at passcal.nmt.edu Tue Dec 4 12:31:14 2001 From: bob at passcal.nmt.edu (Bob Greschke) Date: Tue, 4 Dec 2001 10:31:14 -0700 Subject: C extension/char array question References: <9uh3ur$6ct$1@newshost.nmt.edu> Message-ID: <9uj18e$13di$1@newshost.nmt.edu> You don't know what I'm asking, because I don't know what I'm saying. :) What I want to do (today...I think) is create the equivalent of a C array of strings like char *Array[] = {"THIS", "THAT"}; BUT do it in Python such that it can then be passed to an extension wrapper function, such that it can then be passed on to a C function so that the called function can do something like printf("%s", X[1]); and have the output on the screen be "THAT". I don't know what "char *Array[] = {"THIS", "THAT"};" would look like written in Python, nor do I have any idea what would be used in the PyArg_ParseTuple() function in the wrapper function to make it look like an array of strings. I could just put the creation of Array in the .c extension file with all of the wrapper functions for the program, but it would be cleaner if I could create the list of strings in Python, instead. I'm not sure if this is any clearer or not. :) Bob "Martin von Loewis" wrote in message news:j4zo4zyryl.fsf at informatik.hu-berlin.de... > "Bob Greschke" writes: > > > What I want to be able to do is code the list of things to look for > > ("THIS" and "THAT") into the Python part, and call a C extension > > function that calls the C library function that does the job of > > RememberMe(). > > The simplest solution is to do > > PyObject *RememberMe = NULL; > > PyObject * > MyMod_Remember(PyObject *self, PyObject *args) > { > Py_XDECREF(RememberMe); // forget old value > Py_INCREF(args); > RememberMe = args; // hold onto the argument tuple > Py_INCREF(Py_None); > return Py_None; > } > > > I guess I'm not sure what to put "THIS" and "THAT" into > > (a list?), and what format specifier to use in PyArg_ParseTuple(), to > > make sure that C is able to keep track of the addresses of the char > > array elements so it can use them in the strstr() function -- if this > > can be done in a straightforward manner at all. > > Not sure what you are asking here - if this is a question at all. > > > Will I have to 'recreate' the array of strings in the extension, > > like with malloc()? > > No. Just increment the refcount on the object you get, and you can > hold onto it as long as you want. > > Regards, > Martin From skin_pup at shitbomb.com Sun Dec 16 11:23:24 2001 From: skin_pup at shitbomb.com (Skinny Puppy) Date: Sun, 16 Dec 2001 11:23:24 -0500 Subject: Oscar or Toc protcall. Message-ID: <20011216112324.B21413@shitbomb.com> Has anyone writen the Oscar or Toc protocals for connecting to AIM (AOL) IM in python? I have looked all over, freshmeat.net, google.com, and many other places. But I have not seen it. I would prefer one writen in pure python, but a wrapper over one of the libs would do fine. Thank you Jeremy Rossi From israelrt at optushome.com.au Sat Dec 22 08:00:04 2001 From: israelrt at optushome.com.au (IsraelRT) Date: Sun, 23 Dec 2001 00:00:04 +1100 Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic References: <3218013921984060@naggum.net> Message-ID: On Sat, 22 Dec 2001 12:45:25 GMT, Erik Naggum wrote: > Look, Tengwar is more widely used than Scheme these days. And an infamous Common Lisp user gives popularity as a reason to choose a language ? Wonders will never cease.... From gh_pythonlist at gmx.de Sun Dec 23 11:15:32 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Sun, 23 Dec 2001 17:15:32 +0100 Subject: [ANN] _socket.pyd with SSL support for Python 2.2 Message-ID: <20011223161529.GA1257@lilith.hqd-internal> I put it online because other people might find it useful, too: http://www.cs.fhm.edu/~ifw00065/pyssl/index.html socket.pyd with SSL support for Python 2.2 on Windows Download python22-win32-ssl.zip, unzip it and move all the files into the DLLs directory of your Python 2.2 installation. The OpenSSL DLLs are built with NASM and MS Visual C++ 6 SP4 from OpenSSL 0.9.6c. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From store_li at sina.com Mon Dec 17 08:03:07 2001 From: store_li at sina.com (Kick) Date: Mon, 17 Dec 2001 21:03:07 +0800 Subject: How can I display unicode in Tk widget Message-ID: <9vkqm7$fqo83$1@ID-12869.news.dfncis.de> I use sqlite as my database server and create a database with it, in which contains Unicode(Chinese) char. When I use Chinese platform, the Chinese char can be displayed correct in my winsql windows and sqlite's command line. While, after import python's odbc module and retrieve data using sql statement, I try to display it in a Tk Label. Unfortunately, I can only get one and a half char. Is there any function or something else that can make me use Unicode in Tk? Thanks for any help!! From jeff at ccvcorp.com Fri Dec 28 13:25:36 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Fri, 28 Dec 2001 10:25:36 -0800 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <0$--$$_----_-%$$%$@news.noc.cabal.int> Alex Martelli wrote: > "Fredrik Juhlin" wrote in message > news:mailman.1009544733.30338.python-list at python.org... > > On Fri, Dec 28, 2001 at 12:27:35PM +0100, Alex Martelli wrote: > > > "Steve Lamb" wrote in message > > > news:slrna2nhfo.nme.grey at teleute.dmiyu.org... > > > > On Thu, 27 Dec 2001 17:48:13 +0000, phil hunt > > > > > > > wrote: > > > > > Python runs quickly on my 300 MHz box, which is 3 times slower > > > > > than the slowest PC you can buy today. It can only get more popular. > > > > > > > > Well, if you take the measure of just pure Mhz.... 4 times slower. > ;) > > > > > > FIVE or more. 1.5 GHz desktop machines are hardly news these days. > > I'm afraid you missed the word "slowest" in the original statement, Alex > :) > > Ooops yes -- so did Steve, I think. You CAN still buy PCs whose CPU's > are claimed to run at 900 MHz *AND LESS* (so even the "3 times" in the > OP was incorrect:-). Yes, I still see quite a few 800MHz machines advertised. Of course, my place of employment still maintains a half dozen or so machines in the 150-233 MHz range... (and Python runs quite satisfactorily on them, too!) Jeff Shannon Technician/Programmer Credit International ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Jeff Shannon Newsgroups: comp.lang.python Subject: cmsg cancel <3C2CB920.DAEA7011 at ccvcorp.com> Control: cancel <3C2CB920.DAEA7011 at ccvcorp.com> Date: Mon, 31 Dec 2001 02:58:35 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775161 27193 211.57.49.2 (31 Dec 2001 05:06:01 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:06:01 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From israelrt at optushome.com.au Sat Dec 22 05:47:29 2001 From: israelrt at optushome.com.au (IsraelRT) Date: Sat, 22 Dec 2001 21:47:29 +1100 Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic References: Message-ID: On 22 Dec 2001 01:02:35 -0800, newscheme at hotmail.com (New Scheme) wrote: >Anyone calling for injection of fresh ideas into the language is >attacked with a level of spite and religious vehemence rarely seen >outside of fundamentalist religious sects. Anyone ? Or an anonymous troll who is too scared to use his real name ? > See you in hell. I am sure that a nice warm spot is being kept for you, Mr Troll. From cfwu at larc.ee.nthu.edu.tw Sun Dec 9 03:37:53 2001 From: cfwu at larc.ee.nthu.edu.tw (Chi-Feng Wu) Date: 9 Dec 2001 08:37:53 GMT Subject: How to embed Tcl in Python? Message-ID: <9uv7t1$qvk$1@news.ee.nthu.edu.tw> Hi everyone, Python is my favorite language but I still have difficulty to use it at work. Here almost everyone else is using Tcl as the scripting interface to their tools. Recently I've bee playing with Tkinter and Tix and realize that root = Tkinter.Tk() root.withdraw() tcli = root.tk.eval tcli('puts "Hello Tcl!"') then tcli is effectively a Tcl interpreter! Here is the question: How can I use this tcli (or something else) to provide a scripting interface to my python program? For example, assume we have a function 'enc' written in python, and the usage in python may look like this: from MyCodec import enc output_str = enc(input_str, coding_alg) If I want to use Tcl as the interface to users, then the following Tcl command have to do the same thing in "Tcl Mode": set output_str [enc -input $input_str -alg $coding_alg] But how to 'export' a Python function to the Tcl (interpreter)? Regards, CF -- Chi-Feng Wu, Ph.D Student | Tel: +886 3 5715131 ext. 4154 Dept. Electrical Engineering | Fax: +886 3 5731149 Tsing Hua University | E-mail: cfwu at larc.ee.nthu.edu.tw Hsinchu, Taiwan | http://larc.ee.nthu.edu.tw/~cfwu From chris.gonnerman at newcenturycomputers.net Sat Dec 29 15:42:54 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Sat, 29 Dec 2001 14:42:54 -0600 Subject: Who needs exceptions References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> Message-ID: <007d01c190a9$69145ee0$0101010a@local> ----- Original Message ----- From: "Nils Kassube" > gerson.kurz at t-online.de (Gerson Kurz) writes: > > [Error checking without exceptions] > > Okay, now think about how useful your approach is if you call more > than one function and there is more than one possible way of things > going wrong. Do you really want to maintain error codes this way > and give 'em to the function calling your function? I've done it more or less that way in C for years, and it sucks. It's just too easy to ignore some function returns (who checks fclose()?) in the interest of coding speed. > > So ? After all, C doesn't need it, and I think few C programmers > > would call this feature the "most missing", or? I miss exceptions. I have several C programs, most of which will probably never be rewritten, and debugging changes in them is often a pain. Mind you, I've been doing C for a long time, longer than many on this list. I have learned discipline the hard way. The thing is, exception handling as a base language feature protects newer programmers until they have time to learn that discipline. It also makes more experienced programmers more productive, even if they never use it (IMHO) as errors below the level of the program being written never go unhandled *and* unreported, as in C. > C and programmers who like C should die a slow and painful death > for holding back the computer industry for two decades. OUCH. Like, I hate Ada, but I'd never say anything so terrible about Ada programmers (Visual Basic might be an exception, though...) From lkvam at venix.com Fri Dec 21 09:17:50 2001 From: lkvam at venix.com (Lloyd Kvam) Date: Fri, 21 Dec 2001 09:17:50 -0500 Subject: [Tutor] An hour's talk on python...Suggestions required (from a newbie) References: Message-ID: <3C23448E.6060502@venix.com> For a Java shop, you'd probably want to include an example of Jython fitting in with your existing Java classes. While most modules are available for Jython, there are exceptions. To the extent you are using Python to supplement Java, you don't want to tout modules that aren't available for Jython. Karthik Gurumurthy wrote: > hi all, > > Our company does'nt use python. many have'nt even heard of it. > hi all, > > Ours is mainly a java shop. > > We have lots of internal training sessions @ our place. > Anyone with a decent knowledge of a particular subject can take such > sessions. > I was planning to take an introductory session on python. > > I feel irrespective of how good the language is, not many > w'd want to try it out unless and otherwise they can see lots of > supporting tools and libraries. > > It has to be a 1 hour talk. > Can someone give me pointers as to how this session c'd be organized? > > 1. functional programming in python > 2. about new features that have been included in 2.2? > 3. threading as for as tools/libraries are concerned, > 4. GUI : Tkinter > 5. xml?? : the one which ships with standard module or something else? > 6. cgi: > > am kind of a newbie. > But i want to develop some interest here @ my place. > Any suggestion w'd be of great help to me. > > thanks and regards, > karthik. > > > > -----Original Message----- > From: tutor-admin at python.org [mailto:tutor-admin at python.org]On Behalf Of > Kirk Bailey > Sent: Friday, December 21, 2001 11:40 AM > To: tutor at python.org > Subject: [Tutor] rfc822.rewindbody() > > > OK, I confizedde... how do I properly use rewindbody()? > > -- > Respectfully, > -Kirk D Bailey (C)2001 > Addme! icq #27840081 > end > > > Within the sweep of his sword, Each man is an Ubar. > > http://www.howlermonkey.net/ > http://www.sacredelectron.org/ > > _______________________________________________ > Tutor maillist - Tutor at python.org > http://mail.python.org/mailman/listinfo/tutor > > _______________________________________________ > Tutor maillist - Tutor at python.org > http://mail.python.org/mailman/listinfo/tutor > > -- Lloyd Kvam Venix Corp. 1 Court Street, Suite 378 Lebanon, NH 03766-1358 voice: 603-443-6155 fax: 801-459-9582 From cjensen at bioeng.ucsd.edu Thu Dec 27 20:05:10 2001 From: cjensen at bioeng.ucsd.edu (Curtis Jensen) Date: 27 Dec 2001 17:05:10 -0800 Subject: REPOST: Re: affects on extended modules References: <3C051775.A8D4FD66@bioeng.ucsd.edu> <83pu5zrvbl.fsf@panacea.canonical.org> <3C0E7138.FD485D1D@bioeng.ucsd.edu> Message-ID: <3$--$$_----__--$%$@news.noc.cabal.int> Pedro wrote in message news:... > "Curtis Jensen" wrote: > > > Kragen Sitaker wrote: > >> > >> Curtis Jensen writes: > >> > We have created a python interface to some core libraries of our own > >> > making. We also have a C interface to these same libraries. However, > >> > the the python interface seems to affect the speed of the extended > >> > libraries. ie. some library routines have their own benchmark code, > >> > and the time of exection from the start of the library routine to the > >> > end of the library routine (not including any python code execution), > >> > takes longer than it's C counterpart. > >> > >> In the Python version, the code is in a Python extension module, right? > >> A .so or .dll file? Is it also in the C counterpart? (If that's not > >> it, can you provide more details on how you compiled and linked the > >> two?) > >> > >> In general, referring to dynamically loaded things through symbols --- > >> even from within the same file --- tends to be slower than referring to > >> things that aren't dynamically loaded. > >> > >> What architecture are you on? If you're on the x86, maybe Numeric is > >> being stupid and allocating things that aren't maximally aligned. But > >> you'd probably notice a pretty drastic difference in that case. > >> > >> ... or maybe Numeric is being stupid and allocating things in a way > >> that causes cache-line contention. > >> > >> Hope this helps. > > > > Thanks for the responce. The C counterpart is directly linked together > > into one large binary (yes, the python is using a dynamicaly linked > > object file, a .so). So, That might be the source of the problem. I > > can try and make a dynamicaly linked version of the C counterpart and > > see how that affects the speed. We are running on IRIX 6.5 machines > > (mips). > > Thanks. > > > > Don't know if this helps but I had a similar problem on Linux. > > The context was : a python script was calling an external program and > parsing output (with popen) many times. I decided to optimize this > by turning the external program into a dynamicaly linked library with > python bindings. I expected to gain the extra system calls to fork and > start a new process, but it turned out that this solution was slower. > > The problem was caused by multithreading stuff. When using the library > straight from a C program, I didn't link with multithreaded libraries > and so all system calls weren't protected (they don't need to lock and > unlock their resources). > > Unfortunately, the library was reading files with fgetc (character by > character :( ). Since the Python version I used was compiled with > multi-threading enabled, it turned out that the fgetc function used in > this case lock/unlock features, which cause the extra waste of time. > > To find this, I compiled my library with profiling (I think I needed to > use some system call to activate profiling from the library, since I > couldn't rebuild Python). > > OT : at the end I fixed the library (fgetc replaced by fgets), and didn't > gain anything by turning the external program into a python extension. > Since it seemed that Linux disk cache was good, I removed the python > extension thus keeping a pure Python program, and implemented a cache > for the results of the external program. This was much simpler and more > efficient in this case. Is this a problem with i/o only? Our the code sections that we benchmarked has no i/o in it. -- Curtis Jensen ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: cjensen at bioeng.ucsd.edu (Curtis Jensen) Newsgroups: comp.lang.python Subject: cmsg cancel <1be8d8b.0112271705.50940295 at posting.google.com> Control: cancel <1be8d8b.0112271705.50940295 at posting.google.com> Date: Mon, 31 Dec 2001 02:20:07 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775461 27193 211.57.49.2 (31 Dec 2001 05:11:01 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:11:01 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From achim.domma at syynx.de Fri Dec 28 10:32:55 2001 From: achim.domma at syynx.de (Achim Domma) Date: Fri, 28 Dec 2001 16:32:55 +0100 Subject: REPOST: mod_python and threads Message-ID: <6$--$$_----_---$_$@news.noc.cabal.int> Hi, I'm playing around with mod_python and I like it, but I don't understand how it handles multiple threads. I think apache holds a pool of threads to handle request, so what happens if mod_python uses only one subinterpreter per virtual server ? Are request handled in a serial way or do I have to write threadsafe code ? could somebody enlighten my please ? greetings Achim ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.tele.dk!small.news.tele.dk!134.75.7.11!nntp.kreonet.re.kr!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Achim Domma" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:33:07 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775020 27193 211.57.49.2 (31 Dec 2001 05:03:40 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:03:40 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From akuchlin at mems-exchange.org Thu Dec 20 16:33:53 2001 From: akuchlin at mems-exchange.org (Andrew Kuchling) Date: 20 Dec 2001 16:33:53 -0500 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> <7xlmfxvbx7.fsf@ruckus.brouhaha.com> Message-ID: <3dbsgt7f0e.fsf@ute.mems-exchange.org> Paul Rubin writes: > That's a good point. It's probably too late to start reporting the > incompatibilities as bugs against 2.2c, though that's what they are. And if no one reports bugs, they can't get fixed. You could still go ahead and report them, but unless they're real showstoppers they won't be fixed in 2.2final, which is being wrapped up even as we speak. I don't know if it'll be considered worth fixing them in 2.3. (Or is this talk of incompatibilities simply FUD from people who are scared of upgrading?) --amk (www.amk.ca) I like a lot of glasses about -- it highers the tone. -- Albert, in Peter Greenaway's _The Cook, The Thief, His Wife, and Her Lover_ From jason at jorendorff.com Sat Dec 15 00:43:08 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Fri, 14 Dec 2001 23:43:08 -0600 Subject: open second xterm under X11 In-Reply-To: <3C19D56C.B45C867F@kph.uni-mainz.de> Message-ID: > How can I open and use a second > xterm or text window from within a python program. > Tcl/Tk seems to be overkill and curses too primitive. Hmmm. Try putting this as the first line of your Python script: #!/bin/env xterm -e /bin/env python (If this doesn't work at all, it's because I lack the right environment to test it just now... apologies in advance.) I don't know if that's what you want though. If you actually want several xterms under the control of a single Python program, the easiest thing will be to have several Python processes talking to one another via sockets. A Python program can launch another Python process in a new xterm by calling os.spawnv() or os.fork() + os.execv(), using the command shown above. -- Jason Orendorff http://www.jorendorff.com/ From michael at stroeder.com Thu Dec 27 17:43:03 2001 From: michael at stroeder.com (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Thu, 27 Dec 2001 23:43:03 +0100 Subject: REPOST: Re: A new message board is up References: <40dbad98.0112262232.1868734e@posting.google.com> <3C2B724D.E4D31E24@ccvcorp.com> <3C2B74B8.D2FE36F5@stroeder.com> <3C2B829A.DD0AED79@ccvcorp.com> Message-ID: <4$--$$_----_-$-_%$@news.noc.cabal.int> Jeff Shannon wrote: > > Michael Str?der wrote: > > > I always wonder why people put "web forums" in place. I can't read > > them while being off-line (e.g. on the train) and they are damn > > slow. Newsgroups and mailing lists are the right medium for this > > kind of communication. > > Eh, they have their purpose. They're easier to set up than a > newsgroup, and more widely accessible (decent browsers are more widely > distributed than decent newsreaders). I prefer mailing lists if a news group does not exist. And if the participants are too stupid to use a decent MUA it's not the right forum. I dislike having to load banners and I very much dislike having to stay online to read postings. Period. > And once a certain volume is > reached, they're easier to organize and maintain than a mailing list Sorry, I can't see the advantage. > It's also easier to > include images and such in posts Umh, yeah. The multi-media thingy... ;-) BTW: Did you check the web message board's software how it prevents cross-site scripting attacks, if the session ID leaks through referer URLs and such...? No, thanks. Web discussion boards simply suck. Ciao, Michael. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Michael =?iso-8859-1?Q?Str=F6der?= Newsgroups: comp.lang.python Subject: cmsg cancel <3C2BA3F7.2D569598 at stroeder.com> Control: cancel <3C2BA3F7.2D569598 at stroeder.com> Date: Mon, 31 Dec 2001 01:35:35 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775530 27193 211.57.49.2 (31 Dec 2001 05:12:10 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:12:10 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From fperez528 at yahoo.com Thu Dec 6 12:34:46 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Fri, 07 Dec 2001 17:02:46 +2328 Subject: numerical packages for 1.5.2? References: <9ur8nk$fg6$1@peabody.colorado.edu> Message-ID: <9urlci$nvb$1@peabody.colorado.edu> Mark Fardal wrote: > Fernando P?rez writes: > >> > Given that restriction, what version of Numeric should I be >> > using? > >> Why don't you just create a ~you/local/ directory and build py2.1 >> there? It will take a half hour, and the improvements are >> substantial. You can just tell your friends to have an alias that >> points to ~you/local/bin/python for them to use it without >> upgrading anything. > > So far I've failed to install the rpm for 2.1 on my own computer. > So has my sysop. I doubt I'm going to manage installing 2.1 on > ~10 different systems. No, I said build. As in grab the tarball, ./configure, make, make install. You can tell configure where to put things. The rpms won't work because some things are already hardwired in. > And I can't rule out people wanting to run > the code on systems I don't have access to. For that then you have no option but 1.5.2. > Somebody must have used 1.5.2 at one point--what versions worked > then? Don't know, sorry. >> Just an idea, since you lose some important features with >> python<2.0 for numeric (such as rich comparisons: a> arrays returns a number in old python, but a full array of >> a[i]> algorithms much easier and they also perform faster as the looping >> is done in C). > > What's wrong with less(a,b), besides uglier syntax? > I find a 15.2. Does less(a,b) return an array or a number under old versions? I just don't know. cheers, f From duncan at NOSPAMrcp.co.uk Tue Dec 11 04:44:47 2001 From: duncan at NOSPAMrcp.co.uk (Duncan Booth) Date: Tue, 11 Dec 2001 09:44:47 +0000 (UTC) Subject: How to change IP Address by Python program on Win Platform References: <9v2aqb$mbt$1@ih292.ea.unisys.com> <9v2fh1$pa9$1@ih292.ea.unisys.com> <3C1591EA.2E57F1CD@engcorp.com> Message-ID: Peter Hansen wrote in news:3C1591EA.2E57F1CD at engcorp.com: > If I recall correctly, and believe me I may not :-), I think > I've successfully changed the IP address on a WinNT machine > *without* rebooting. It may simply be that I changed the > routing tables with 'route add' and such, which could easily > be wrapped with Python, but I somehow remember actually > having changed the IP address too. I no longer have an > NT machine handy to test on (thank god :-), but is it > possible that if you change the network settings and simply > ignore the request to reboot, that an address change is > actually accepted immediately? You can definitely change the ip address without rebooting in some circumstances. For example connecting a dial-up modem link adds a new ip address and you can hangup and redial to get a different address. If you use DHCP you can release and renew your IP address from the DHCP server, and this may result in a changed address. More relevantly, I have recently used some software from Veritas which dynamically adds and removes ip addresses at runtime, although each network card also has a fixed ip address that is not changed. So it must be possible, although I don't know offhand what system calls might be involved or whether you can do it from python. -- Duncan Booth duncan at rcp.co.uk int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3" "\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure? From mjackson at wrc.xerox.com Thu Dec 6 10:26:59 2001 From: mjackson at wrc.xerox.com (Mark Jackson) Date: 6 Dec 2001 15:26:59 GMT Subject: getting the name of a variable References: Message-ID: <9uo2o3$rl0$1@news.wrc.xerox.com> > >On 6 Dec 2001 04:47:37 -0800, sandskyfly at hotmail.com (Sandy Norton) > >wrote: > > > >>When I'm debugging I'm always sticking stuff like "print 'x:', x" in my code. > >>So is there a handy function that will print a variable name and value such that: > >> > >>>>> def print_var_name_and_value(var): > >> "prints variable name : value" > >> > >> > >>>>> variable = 'me var' > >>>>> print_var_name_and_value(variable) > >>variable : me var Daniel Klein writes: > >>> def varname(var): > var = str(var) > try: > print var + " : " + str(globals()[var]) > except KeyError: > print var + " : " > > >>> varname('zz') > zz : That's not what Daniel wanted; he was looking for this behavior: >>> a = 'spam' >>> varname(a) a : spam >>> You *can* write a function to search the embedding namespace for an object match (using is, not ==) and get this behavior. . .sometimes. The problem is that the object may have more than one name >>> a = 'spam' >>> b = a >>> varname(a) one spam or another >>> or none at all >>> a = ['eggs','spam'] >>> varname(a[1]) the spam that dare not speak its name >>> -- Mark Jackson - http://www.alumni.caltech.edu/~mjackson This is a clear abuse of the God-given gifts of repression and denial. - The Reverend Theo Fobius (Howard Tayler) From jkraska at san.rr.com Sun Dec 9 12:09:38 2001 From: jkraska at san.rr.com (Courageous) Date: Sun, 09 Dec 2001 17:09:38 GMT Subject: Creating a "package" using C extensions? References: <4bo41u8de4r4njcchh4g3mcuvdhqohhu39@4ax.com> Message-ID: >> I can see that if I just used a normal __init__.py and >> then pointed it to C extension dlls, this would probably >> work. >> >> Is this the approved way of doing this? > >Yes. >You could probably hack something up by butchering the >module object in some way, but the import code assumes that >extension modules are just plain modules, not packages. This is liveable, but somewhat painful for me. Let me tell you why. I am currently translating the back end of a system originally written in Python to a hybridized C++/Python implementation with a C++ core. The heart of the system has a very high invocation frequency, so it makes sense to put that into C++. However, I need to make the prior interface to the Python programmer the same as it was before. So what I am doing is, for every module in the prior package, creating a C++ equivalent. That's a lot of .dlls, if you know what I mean. Perhaps I'll break down and write a makefile. Doing a couple dozen .dlls in VC 6.0 is a bit of a pain. It's too bad there's not a way to create a package-level .dll which responds to Python in such a way as to offer up its internal modules, but all from within a single .dll. That would be cool. C// From maxm at mxm.dk Wed Dec 19 05:03:46 2001 From: maxm at mxm.dk (maxm) Date: Wed, 19 Dec 2001 11:03:46 +0100 Subject: How about adding a sort parameter to dict methods? References: <9vp5p4$51b$1@slb0.atl.mindspring.net> Message-ID: "Andrew Dalke" wrote in message news:9vp5p4$51b$1 at slb0.atl.mindspring.net... > Since there are many equally "valid" modifications to > dictionaries and their methods, the Pythonic solution is to > punt - provide the base functionality that other people can > tweak for their specific needs. And that functionality > should be simple. > > What's present isn't going to aquire your proposed changes, > or anything like it. What you did is the Pythonic solution. Fair enough. As long as there is a good reason :) regards Max M From guido at python.org Sat Dec 22 11:55:23 2001 From: guido at python.org (Guido van Rossum) Date: Sat, 22 Dec 2001 11:55:23 -0500 Subject: Python 2.2 RPMs are here Message-ID: <200112221655.LAA22390@cj20424-a.reston1.va.home.com> Sean Reifschneider made RPMs for Python 2.2. Go get 'em at: http://www.python.org/2.2/rpms.html --Guido van Rossum (home page: http://www.python.org/~guido/) From aleax at aleax.it Fri Dec 28 09:58:25 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 15:58:25 +0100 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <889C110F5BBBFAFD.A03B35C232EA2760.70B0892CB9479323@lp.airnews.net> Message-ID: <3$--$$_----_---$_$@news.noc.cabal.int> "Cameron Laird" wrote in message news:889C110F5BBBFAFD.A03B35C232EA2760.70B0892CB9479323 at lp.airnews.net... > In article , > Patrick wrote: ... > >They DO ask what compilers and linkers we use! They even > >make suggestions! We make very customized software. > >Some customers write parts of their own code through > >'user exits'. ... > There are times when this is an advantage for Python, > for it is a FAR superior "extension language" to Java > and C. While many aspects of software engineering are > best seen at this point as matters of taste, Python's > superiority in this regard is, I argue, a matter of > objective record. Maybe, but Python could be usable as an extension language even if the application was implemented otherwise, in the right environments (JVM: Jython always usable where Java is; Microsoft COM/Automation). > That's no guarantee of customer acceptance, of course. Yep. If you release only under Windows, and user customization is important, it would be folly not to have an excellent COM Object Model exposed: this way, customers can customize in Python, Visual Basic, Delphi, C++, or whatever else is close to their heart. If you release under the JVM, then at least both Java and Jython are usable. Other environments have other such possibilities (alas, maybe not as mature), such as Corba bindings. If you're not in the business of selling programming languages, but applications, and yet those applications are often used as platforms for customer development, then putting some effort into language independence may widen your customer appeal at not too high a price. Alex ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Alex Martelli" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:51:51 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775329 27193 211.57.49.2 (31 Dec 2001 05:08:49 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:08:49 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From kragen at pobox.com Sat Dec 1 05:01:10 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 01 Dec 2001 05:01:10 -0500 Subject: python vs ecmascript References: <01111609593502.02629@logiplex1.logiplex.net> <3c03b0a8$0$25399$edfadb0f@dspool01.news.tele.dk> <2NPM7.568$_06.167730@newsb.telia.net> Message-ID: <83herbtg2h.fsf@panacea.canonical.org> "maxm" writes: > Why not make it a general policy to have relevant module crosslinked? I think that's an excellent idea, and if the maintainers decide to do it, knowing which things *you* guessed were relevant for the things you were searching for will probably help a lot. Figuring out what to crosslink is not trivial! From peter at engcorp.com Thu Dec 27 22:55:53 2001 From: peter at engcorp.com (Peter Hansen) Date: Thu, 27 Dec 2001 22:55:53 -0500 Subject: set decimal place References: <3c291037.4684696@news.tm.net.my> <3C292938.ED322C60@bellatlantic.net> <184fbd02.0112260109.4392423@posting.google.com> <3C2A29A5.8E9FB5BE@engcorp.com> <3C2B794A.800A94E5@attbi.com> Message-ID: <3C2BED49.E54CB73E@engcorp.com> Chris Barker wrote: > > Peter Hansen wrote: > > > >>> 10.0/3 > > 3.3333333333333335 > > >>> round(10.0/3, 4) > > 3.3332999999999999 > > ^^^^^^^ > > This doesn't really solve the OP's problem. > > > The concept of "having 4 decimal places" is meaningless with > > floating point representations until you actually display the > > value as a formatted string. > > not completely. you might want to check if two values are the same to 4 > decimal places, in which case round should work just fine: > > >>> 10.0/3 == 10.00001/3 > 0 > >>> round(10.0/3,4) == round(10.00001/3,4) > 1 I don't know if this is guaranteed to work in all cases. Comparing floating point values directly is generally not a good idea, although I don't know whether this applies to rounded values, and if so how far you have to round them before it makes it safe. If it is safe, you have a valid point, but not likely what the OP wanted. -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From joshm at taconic.net Wed Dec 26 20:00:14 2001 From: joshm at taconic.net (Joshua Muskovitz) Date: Wed, 26 Dec 2001 20:00:14 -0500 Subject: REPOST: Re: references for shifting from Py1.5.2 to Py2.2? References: <3c2a5cd1_2@corp.newsgroups.com> Message-ID: <0$--$$-$$$$%%-_$_$@news.noc.cabal.int> Thanks, both suggestions are just what I was looking for. :-) -- josh -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Joshua Muskovitz" Newsgroups: comp.lang.python Subject: cmsg cancel <3c2a70a1$1_1 at corp.newsgroups.com> Control: cancel <3c2a70a1$1_1 at corp.newsgroups.com> Date: Mon, 31 Dec 2001 03:28:01 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009776052 27193 211.57.49.2 (31 Dec 2001 05:20:52 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:20:52 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From maxm at mxm.dk Sun Dec 16 05:08:25 2001 From: maxm at mxm.dk (maxm) Date: Sun, 16 Dec 2001 11:08:25 +0100 Subject: Recursive update of arbitrarily nested dicts References: <3C1B9E80.FB732387@accessforall.nl> Message-ID: "Ype Kingma" wrote in message news:3C1B9E80.FB732387 at accessforall.nl... > In this case there is only one smaller problem, and there is no > solution to be assembled from the solutions to the smaller problem. > (warning: untested code) > > def rUpdate(nestedDict, keys, value): # keys should be a tuple or a list > firstKey, remainingKeys = keys[0], keys[1:] # divide the problem > if len(remainingKeys) == 0: # non recursive case > # Evt. raise an exception when nestedDict[firstKey] is a dict > nestedDict[firstKey] = value # actual update. > else: > if not nestedDict.has_key[firstKey]: # make sure there is sub dict to recurse on > nestedDict[firstKey] = {} > rUpdate(nestedDict[firstKey], remainingKeys, value) # recurse on smaller problem. whoa ... thats a pretty complex solution. I was hoping for something a bit simpler ;-) In fact I do belive that I have found it myself, after an hour of fun. ;-) def rUpdate(self, targetDict, itemDict): for key, val in itemDict.items(): if type(val) == type({}): newTarget = targetDict.setdefault(key,{}) self.rUpdate(newTarget, val) else: targetDict[key] = val I allways find it amusing that recursive functions in Python ends up so relatively simple, even though I usually have a bit of a problem finding the right solution. I have read somewhere that thinking in pointers is something a programmer either can or cannot do. I have no trouble with pointers. But perhaps it's the same with recursion ... I don't know. I can usually find a solution, but it often takes me far to long. I guess if I do it more I will get better at it. Perhaps I should study some Lisp to get some more experience in it. Anyhoo ... Thanks for the answer. regards Max M From maxm at mxm.dk Thu Dec 13 11:59:58 2001 From: maxm at mxm.dk (maxm) Date: Thu, 13 Dec 2001 17:59:58 +0100 Subject: Where can you find the Python ODBC modual References: Message-ID: Try this: http://www.google.com/search?q=python+odbc+access regards Max M "John Yeager" wrote in message news:Uc4S7.1806$M3.864398 at newsrump.sjc.telocity.net... > This thing is driveing me nuts I am trying to connect to an Access > Database,( boss will not let me use Mysql ), so I am in need of figureing > out how to connect to Microsoft access.. > > Please help > > From loewis at informatik.hu-berlin.de Fri Dec 28 13:37:31 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 28 Dec 2001 19:37:31 +0100 Subject: REPOST: Re: [Q] Deepcopy with Python 2.2 ? References: <440c5c6a.0112280847.55c92de7@posting.google.com> Message-ID: <4$--$$_-----$$%__$@news.noc.cabal.int> setar at gmx.de (Oliver Hofmann) writes: > I've had a few problems with copying objects lately when they > reference each other. My understanding is that deepcopy should > take care of that due to the memo - dictionary; this does not > seem to be the case. > > The following code works fine if Base does _not_ inherit > from object. If it does the result is: I'd recommend to report this as a bug at sf.net/projects/python. What happens is: - you define a new type using new-style classes, i.e. none of the builtin deepcopiers applies. In particular, your instance's type is *not* - your type does not implement __deepcopy__ - it does implement __reduce__ (as inherited from object) Unfortunately, it appears that in the reduce case, the memo is not taken into account. This is where I think the bug lies. You can work around this problem by defining a __deepcopy__ method in your Base class def __deepcopy__(self, memo): obj = object.__new__(self.__class__, None) memo[id(self)] = obj for k,v in self.__dict__.iteritems(): obj.__dict__[k] = copy.deepcopy(v, memo) return obj HTH, Martin ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Martin von Loewis Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:51:56 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775138 27193 211.57.49.2 (31 Dec 2001 05:05:38 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:05:38 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From res0ne7x at verizon.net Thu Dec 20 17:09:48 2001 From: res0ne7x at verizon.net (Gary Herron) Date: Thu, 20 Dec 2001 14:09:48 -0800 Subject: Bug in % string formatting? In-Reply-To: <9vtk6h$ojk$1@peabody.colorado.edu> References: <9vtiev$no8$1@peabody.colorado.edu> <871yhp7guv.fsf@ifm.uni-kiel.de> <9vtk6h$ojk$1@peabody.colorado.edu> Message-ID: <200112202209.fBKM9lu02440@out006pub.verizon.net> > > Argggh! As they say in numerical recipes: you should brush your teeth every > night in front of the operator precedence rules for your language of > choice. > > It does surprise me though that % binds harder than +. I would naively > think that by its nature, % would have fairly low precedence. Oh well, I'm > sure there's a good reason for it being the way it is. Here's a (probably good) reason for the precedence of the '%' operator: With numbers, 'a%b' returns the remainder of 'a' divided by 'b' (the modulus operator). This is akin to division, and the percent sign looks like division, and even the concept of percent (meaning per 100) is relateed to division. Thus it make sense to give the '%' operator the same precedence as division. All those arguments are irrelevant when applied to strings, but an operator's precedence is fixed, and cannot depend on the types of operands. Gary Herron From qrczak at knm.org.pl Sat Dec 1 17:52:48 2001 From: qrczak at knm.org.pl (Marcin 'Qrczak' Kowalczyk) Date: Sat, 1 Dec 2001 22:52:48 +0000 (UTC) Subject: Python-2.2b2 bug? Misc/Makefile.pre.in References: Message-ID: Sat, 01 Dec 2001 20:59:05 GMT, Fredrik Lundh pisze: > Fri Oct 26 14:54:16 2001 UTC (5 weeks, 1 day ago) by akuchling > FILE REMOVED > Delete Makefile.pre.in (BDFL pronouncement) 1. postgresql needs it to build. I copied the version from an older Python and it seems to work. What should postgresql do instead? 2. Python-2.2b2 has installed Makefile.pre.in from the root of the source tree instead, which is different from one in Misc (e.g. no 'boot' target). Was it supposed to work? -- __("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ QRCZAK From cjw at sympatico.ca Fri Dec 28 20:06:17 2001 From: cjw at sympatico.ca (Colin J. Williams) Date: Fri, 28 Dec 2001 20:06:17 -0500 Subject: REPOST: Re:[ANNOUNCE] Microsoft HTML Help of Python 2.2 Docs] References: <3C2BC221.4F5DB23C@sympatico.ca> Message-ID: <1$--$$_----_-%$%%$@news.noc.cabal.int> An HTML attachment was scrubbed... URL: From jkraska at san.rr.com Wed Dec 5 18:59:30 2001 From: jkraska at san.rr.com (Courageous) Date: Wed, 05 Dec 2001 23:59:30 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: >> if isinstance(f, future.Step) or \ >> isinstance(f, future.Status) or ... >klasses = [future.Step, future.Status, ...] >if filter(lambda x: isinstance(f,x), klasses): You're really very annoying. I consider your answer a dodge, in part because you completely avoided the subject which was being addressed, and also in part because you just completely changed the peformance characteristics of what you replaced for the worst. Surely you're aware that probabilistic arrangement of conditional tests will enhance performance, right? But irrelevant, in any case. You just changed the subject. >Ugly... > > txt = """ > Unexpected RETURN intercepted from user code. > This is almost certainly due to an inappropriate > explicit... > """ Uglier in a color hilighting editor, especially considering that you just changed the content of the string that I wrote. This particular answer of yours suggests to me that your practical programming background is extremely shallow. What you just proposed is that the content of each string VARY based on the indentation level at which it is designed. Surely thou jesteth. > When one of the if tests change it usually causes a cascading >re-indent of the second column. Only if you have a sucky editor. >We use tabs exlusively for all our projects, and in practice there is >never a problem getting things to line up (I guess as with the >"whitespace-for-indentation" issue you'll have to try it before you >believe it). I don't believe it because I've tried it. Extensively. Over a period of most of a decade. C// From s.keim at laposte.net Thu Dec 6 06:46:44 2001 From: s.keim at laposte.net (sebastien) Date: 6 Dec 2001 03:46:44 -0800 Subject: pep proposal : A date object for the standard library Message-ID: <7da8d8f8.0112060346.3e50092f@posting.google.com> hello, This is the first draft of a PEP to introduce a high level date class in python standard library. I have highlighted by [???] the points that I'm not sure. Of course that doesn't mean that the other sentences are true ;-) . Since I am not a brilliant English speaker, grammar would probably need a little refactoring too. PEP: XXX Title: Improving date time support in Python Version: Last-Modified: Author: s.keim at laposte.net (S?bastien Keim) Status: Active Type: Informational Created: 29-Nov-2001 Post-History: Abstract Date and Time computation is a bit of mess in almost every programming languages. This is mainly because calendars are a very irregular kind of data. In standard python, dates are defined with two formats: * os module use the POSIX format (elapsed time in seconds since the 1970-01-01) * a tupple is defined in the time module They are low level format, not really user-friendly. This PEP try to define an high level date protocol intended to ease date manipulation in Python. Rationale Fundamentally, a date is the coordinates of a point on the time axis. Calendars are just tools to express this notion with units more suitable for people. During the years people have tried to find a calendar representation that fit their feeling of naturals events. That mean that exist today dozens of calendars, even if the most used is the Gregorian one. This facts mandate several objectives for a python date module: - date arithmetic should be independent of the calendar presentation chosen. - since it's the most widely used, the standard date module should support the Gregorian calendar. - but because some specific applications could need another calendar convention, we shouldmake the creation of new calendar libraries as easy as possible. What exist today for Python A powerful mxDateTime tools already exist but this package is probably to complex to go on the standard distribution[3]. NormalDate define also a light date class[2]. AbstractDate class Many operations on dates, don't bother with the calendar used to process this date. So we can create an AbstractDate class that will define this operations. That mean that they will be allowed for any date objects that would inherit from this class. The first thing that we need is a way to share a date information between dates classes. It's important to define a common lingua for dealing with dates. This will allow the Python users to create several calendar related class without having to boring (to much) with conversions problems. This intermediate format could be defined as a floating point representing the modified juian day numbers[5]. This will be called MJD (Modified Julian Day) in the next part of the document. In this format, the integer part correspond to the number of elapsed days since the start of the day 1858-11-17 CE. Negatives numbers are allowed for date before 1858-11-17. The decimal component is the fraction of the day corresponding to hour minutes and seconds, expressed in GMT. This format has the following advantages: - date arithmetic is easy (number of days between two dates is trivial, the day of week need only to compute a modulo 7 ..) - floating representation allow to compute dates arbitrary far in the past, even if we lose precision. - we keep the better precision for current dates. - algorithms for conversion to Gregorian or Julian dates are well known. - it's a quite standard format. I feel this solution better than the POSIX convention to count the elapsed time in seconds because not all the days have the same length. About once every year or two there is an extra second, called a "leap second" added as the last second of the December 31 or June 30. For example, the last minute of the year 1995 was 61 seconds long, thanks to an added leap second. In MJD format, this seconds won't accumulate for years to years. Each calendar classes should define: - MJD() : method that return the Modified Julian Day from the given date - from_MJD(n) : class method that return a date object from the Modified Julian Day n For converting the MJD in their own calendar protocol. AbstractDate class definition of the operations: - date1 < date2 (and <=, ==, >=, >, <>) - hash value - date + duration ==> date - date - duration ==> date - date - date ==> duration would only depend to from_MJD() and MJD() methods That mean that we will be able to do arithmetic between almost any date objects that would define this two methods. [???]since we deal with real numbers maybe we should define a minimal range where two dates are equals. I don't feel the need to introduce a new type for duration. Duration can be expressed as a floating point number of seconds. This give us all the arithmetic needed and this format is backward compatible with: * timeouts in the thread module * duration computed from dates of files expressed in epoch format(in the os module ) We can define a few numbers of constants: seconds = 1.0 minutes = 60.0 hours = 3600.0 days = 86400.0 weeks = 604800.0 We can't introduce higher constants because we deal here with absolute duration. Length of month or year isn't absolute but relative to the starting date. So relative duration is dependant of the calendar chosen. Default calendar classes AbstractDate class is intended to make the creation of calendar related classes as easy as possible. Netherless I don't think Python user would be happy to have to redefine their own calendar classes for common work on dates. According to the 80-20 rule, this PEP suggest to define for in the standard library a default date class intended to solve the most common date time problems. Default date classe should work with local time. User will have to create subclass for handling non-local times. It would be great if he had only twomethods to redefine, one to convert from GMT to local times, and one for the opposite operation. Because of daylight saving hours, this methods will have to know the empty date to compute, not only the time part. The default methods could use the built-in time module for computing time zone offset. [???] I don't know well the behavior of this module but I don't think it's clever enough to know when daylight saving was introduced in a given time zone. This could introduce errors when we compute dates in the past. [???] The high majority of platforms support the time module but what to do with the one which doesn't? Constructor: If no args current time is used to create the object If one arg ==> the object given in arg must define a MJD() method For more args, the following rule apply: date(year, month, day, hour=0, minute=0, seconds=0) Note that, you could have something like: >>> date(1858,11,17).MJD() -0.25 Where you was probably waiting for 0.0 This is because we use local time, and with your time zone offset, the 1858-11-17 0h00 can actually be something like 1858-11-16 18h00 GMT. [???] Any better way to handle both pure date (without specifying time) and local time zone without ambiguity? A factory function: time(hour, minute, seconds) will create a date object by using current year, month and day. Properties: day(*) month(*) year hour minute second week_day(*) Properties are new in python 2.2, they allow us to assign assessors methods to an attribute. That mean that: - x.day = value will call something like x.set_day(value) - value = x.day will call value = x.get_day() All of this properties return always a valid number, but can accept and process values that are not in the good range. This will allow powerful constructs like x.day += 10 (*) Theses properties use int as input but return a subtype of int that provide the following methods: -name() for sample 'monday' or 'january' -short_name() for sample 'mon' or 'jan' [???] What must be the behavior of x.week_day = Monday : - fix the day to the Monday of the current week - fix the day to the nearest Monday - or to the next (or previous) Monday [???] The returned value could maybe provide more functions for sample: x.month.length() could return the length of the month x.year.leap_year() x.day.year_count() n? of the day in the year But I think we can live without this for the moment. [???] Should we append a week property for dealing with num of weeks ? String formating: str(format=None) : return the date as string, format is a string like in the time.strptime function. (note: __str__ will call self.str()) from_str(value, format=None) : parse a string to create a date object [???] it would me more Pythonic to use the standard constructor to create a date object from string. But on the over hand class constructor is already rather complex. [???] It seems that the time.strptime function doesn't work well on all platforms. Maybe that in theses case we should provide an alternate function like in [4] And what should we do: always use the python function or only when the C one is broken? (then how to detect this?) [???] should we provide a set of predefined format strings (and which ones?)? At least me must define the format string used when format=None (the ISO notation?) localization: Date and time format are heavily related to localization for: (1) daylight saving and time zone (2) date formatting conventions (3) nouns of months and days (1) is currently handled by the time module (almost on my computer). (2) is probably related to locals module but I haven't seen something about it. (3) is dependant of a translation utility for python. I don't know if they are projects for this. For now we could probably just handle (1). But we should be careful to allow us to adopt (2) and (3) later without breaking user code. Backward compatibility issues: All of this can be written in pure python in a standalone module. So I don't note any compatibility problems directly related to this PEP. Since the date class use properties, class methods and built-in types inheritance, it will need Python 2.2. There is probably some changes to do in standard library to really fit the date classes. For sample the date objects currently returned by python modules could support the MJD() method. But this is out of the scope of this PEP. References [1] Calendar FAQ http://www.tondering.dk/claus/calendar.html [2] NormalDate module for Python http://starship.python.net/crew/jbauer/normaldate/ [3] mxDateTime module for Python http://www.lemburg.com/files/python/mxDateTime.html [4] strptime implementation in Python http://www.fukt.hk-r.se/~flognat/hacks/strptime.py [5] The julian day number http://serendipity.magnet.ch/hermetic/cal_stud/jdn.htm Copyright This document has been placed in the public domain. Local Variables: mode: indented-text indent-tabs-mode: nil fill-column: 70 End: From david at dataovation.com Fri Dec 7 18:04:46 2001 From: david at dataovation.com (David A McInnis) Date: Fri, 7 Dec 2001 15:04:46 -0800 Subject: Regex help Message-ID: Is there a more efficient way to do this. It seams like this is executing the search twice. patt = re.compile("fax
\s*([0-9]{3,3}-[0-9]{3,3}-[0-9]{4,4})", re.I) if patt.search(tststring): faxnum = patt.search(tststring).group(1) print faxnum I cannot just do faxnum = patt.search(tststring).group(1) because if there is no match, it returns an error David -------------- next part -------------- An HTML attachment was scrubbed... URL: From greg at cosc.canterbury.ac.nz Mon Dec 17 00:01:43 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Mon, 17 Dec 2001 18:01:43 +1300 Subject: PEP 276 and future iteration PEPs References: Message-ID: <3C1D7C37.DADBAA2@cosc.canterbury.ac.nz> James Althoff wrote: > > For future iteration PEPs, I think I would be more > comfortable with > explicit specification > of the index variable(s), as in > > for i in 0 <= i < 5 Not possible, because this conflicts with existing syntax. I don't like the redundancy of having the 'i' in two places, anyway. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From keyton at weissinger.org Sun Dec 9 17:58:56 2001 From: keyton at weissinger.org (A. Keyton Weissinger) Date: Sun, 9 Dec 2001 17:58:56 -0500 Subject: Populating a list In-Reply-To: <877krwxc91.fsf@toadmail.com> Message-ID: You can also do this: states = [] f=open('/home/mlorfeld/states.txt', 'r+').readlines() for i in f: states.append(i.rstrip()) print states The rstrip() method, as you can probably guess, strips white spaces from the RIGHT end of the string. Not sure on the file closing that Jeremy mentioned (I'm also not that adept). But I thought it was probably good to do so -- just in case: states = [] f=open('/home/mlorfeld/states.txt', 'r+').readlines() for i in f: states.append(i.rstrip()) f.close() print states Keyton -----Original Message----- From: python-list-admin at python.org [mailto:python-list-admin at python.org]On Behalf Of Jeremy Whetzel Sent: Sunday, December 09, 2001 5:25 PM To: python-list at python.org Subject: Re: Populating a list matt at lorfeld.com (mlorfeld) writes: > I am new to python (about 72 hours into learning), and am having > problems with reading a file (sate abbreviations) with one item per > line and populating each line into a list. The problem is that each > item ends with \012 after each state ie WI\012. > > Here is the code that I am using: > > f=open('/home/mlorfeld/states.txt', 'r+') > states=f.readlines()#populates a list from file > f.close > print states The \012 is a newline character, from what I understand. There's a couple of ways you could do this, but I personally (and there may be disagreement on this) would do it this way: states = [] f=open('/home/mlorfeld/states.txt', 'r+').readlines() for i in f: states.append(i[:-1]) print states The biggest reason why I'd do it this way is because then you don't have to worry about closing the file at the end. I'm probably showing my green behind the ears doing it this way, but hey, it's a learning experience. =0) Jeremy -- http://mail.python.org/mailman/listinfo/python-list From clpy at snakefarm.org Thu Dec 6 11:37:07 2001 From: clpy at snakefarm.org (Carsten Gaebler) Date: Thu, 06 Dec 2001 17:37:07 +0100 Subject: Python - string to hexbytes conversion - HELP! References: Message-ID: <3C0F9EB3.2574208E@snakefarm.org> me wrote: > if I do a read and get a='1234567' > I need an equivalent string to be > b=Chr(0x01)+chr(0x23)+chr(x045)+chr(0x67) >>> import binascii >>> binascii.unhexlify("01234567") '\x01#Eg' >>> cg. -- For dealing with Matrix you need something more powerful than Python. Otherwise ... Matrix has you! -- scenes from comp.lang.python From wpmelcher at snet.net Thu Dec 13 15:09:28 2001 From: wpmelcher at snet.net (Bill Melcher) Date: Thu, 13 Dec 2001 20:09:28 GMT Subject: Problems with Tkinter and menus References: <9v9vu2$r6g$1@norfair.nerim.net> <7s4S7.3800$uR5.1208563727@newssvr10.news.prodigy.com> Message-ID: > Of course, if absolutely nothing happened and you didn't even get a menu > when you right-clicked on the window, then something seems even more broken > for you. > Sorry, not quite that broken. There is a window with Tk in the top red border, the usual minimize, full screen and close buttons and right click has the usual entries. What is missing is text in the window and the cascaded menus specified in the code. In addition, with help from the group, I got PySol 4.72 (sadly, not 4.80) running here so I think Python is probably not broken. Since both versions are said to work under Win2K and the corrected version works with Linux, I guess what I need now is a Win98 guy. -- Cheers, Bill TANSTAAFL! From infinitystwin.SPAM at IS.BAD.yahoo.com Wed Dec 12 20:35:54 2001 From: infinitystwin.SPAM at IS.BAD.yahoo.com (Greg Krohn) Date: Wed, 12 Dec 2001 19:35:54 -0600 Subject: Problems with Tkinter and menus References: Message-ID: <3c180502$0$22477$6e49188b@news.goldengate.net> "Fredrik Juhlin" wrote in message news:mailman.1008156077.1151.python-list at python.org... > "Greg Krohn" wrote: > > Works fine for me: Win2K/Python 2.1.1/Tcl 8.3. > > It prints 'hello!' for 'Command1', 'Foo', and > > 'Bar'. Have you tried restarting Python? Maybe > > something got reassigned somehow. > The problem persists for me, unfortunately. > I'm using Linux 2.4.5/XFree86 4.1.0/Python 2.1/Tcl 8.3. I've tried KDE 2.1.1 > and Fvwm 2.2.5 with the same result. > > //FJ > Yeah, I just tried it under linux (2.9.?something?) and it didn't work for me either. That's Python 2.1, also, so it must be a linux thing. I didn't see a bug report. I know about as much about linux as I know about the Hubble Space Telescope, so I'm just going to throw my hands up in the air. greg From budr at sirinet.net Mon Dec 24 10:00:04 2001 From: budr at sirinet.net (Bud Rogers) Date: Mon, 24 Dec 2001 09:00:04 -0600 Subject: vi or emacs for editing Python on Linux? References: <231220011915029251%jwbaxter@spamcop.net> Message-ID: John W. Baxter wrote: > In article , Roy Smith > wrote: > >> About all the vi I really know is :q! > > I don't even know that much...I have to grab a book and look it up > every time I get stuck in vi in a file I don't want to damage. I have heard vi described as that editor that has two modes: one mode beeps at you and the other one corrupts your file. > On the other hand, I've used Emacs since about 1994, essentially full > time, and still know only about two dozen commands. They do what I > need. > > I could probably have learned that much vi. When I first started learning Linux I found both vi and emacs alien and difficult with weird keystroke commands that didn't make any sense to me. I used pico or joe not because I liked them, but because they were slightly less weird. Over time I learned enough of emacs to appreciate its power and extensibility. When I discovered Xemacs and gnus I adopted them wholeheartedly. I never learned more than a dozen or so of the seemingly infinite number of possible Ctl-Alt-Meta-Esc-whatever key chords, but enough to do the things I needed to do. I learned a little bit of lisp, enough to do some special formatting and customize my sig in gnus. A couple of years ago I went to work in a shop full of Digital Unix boxes and decided I needed to learn vi whether I wanted to or not. I started messing around with the vi clones on my Linux box at home. I quickly discovered a couple of things. One, I can bring up vi, make a quickie edit to a config file and save it in less time than it takes for my xemacs to come up and load all its initialization files. Two, the syntax highlighting in vim is an order of magnitude better than any other editor I have ever used, including [x]emacs. These days vim tends to be my editor of choice. I only know and use a fraction of its capabilities, enough to do the things I need to do. Having said all that, here's MHO on the vi vs emacs debate. I don't claim to be an expert on either. Emacs, and by extension Xemacs, is like one of those craftsman's toolboxes that you see in the fine woodworking catalogs. The box itself is something of a work of art. Inside is an astonishing collection of tools all cleverly packed together in the smallest space possible. The box itself is very high density. It weighs about fifty pounds and takes both hands to carry. It's an exciting adventure to unfold and unpack the box and discover all the neat things packed away inside. Even a master craftsman will seldom use more than a few of the many tools available. But if you take the time to learn them all you can make anything from a matchbox to a house. Vi, and especially its clones like elvis or vim, is like one of those swiss army knives that has 40 different blades and gadgets. It will do almost anything you ever want to do once you learn what all the gadgets are and how to use them. It will fit in your pocket although it makes pretty big bump and will likely set off the metal detector at the airport. You will rarely if ever use the magnifying glass or the corkscrew in real life, but they are handy to have if you really need them. And if you ever get stranded in the mountains you will be very glad it's in your pocket. Both editors have a substantial learning curve. It takes some time and effort just to get to the point where you can use them effectively, and more to get comfortable with either one. Either editor has more power and capabilities than most users will ever use. Which one is right for any particular user is a matter of taste and circumstance. I would say for the typical sysadmin who makes lots of small quick edits vi is probably more efficient. A developer who spends all day editing lots of source files might find the emacs environment more comfortable. Serious emacs users typically start emacs when they log in and leave it running til they quit for the day. They may have dozens of files open at any given time and bounce back and forth between them. From syver-en+usenet at online.no Sat Dec 29 17:57:16 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 29 Dec 2001 23:57:16 +0100 Subject: REPOST: Re: SSL Sockets in Windows References: Message-ID: <9$--$$_----__-%-$$@news.noc.cabal.int> Gerhard H?ring writes: > You seem to still have SSL compiled in. Be sure to replace your > _socket.pyd with the one without SSL. Using "python -v" helps tracking > > down which module really is loaded. Ah the -v switch, I forgot about that one. I'll look some more into it. -- Vennlig hilsen Syver Enstad ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Syver Enstad Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:46:52 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774516 27193 211.57.49.2 (31 Dec 2001 04:55:16 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:55:16 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From mwh at python.net Fri Dec 21 09:21:03 2001 From: mwh at python.net (Michael Hudson) Date: Fri, 21 Dec 2001 14:21:03 GMT Subject: python threads References: <96c7f32.0112210450.174f6914@posting.google.com> Message-ID: curt at journyx.com (curt finch) writes: > We ship a web application completely written in python. > > The application server daemon that sits between apache/IIS and the > dbserver would like to take advantage of multi-chip architectures > and have many threads. Each thread would be owned by a logged > in user with it's own db connection and share cached db data with > other threads. > > My understanding is that python's current threads implementation > does not really allow for this in the sense that only one thread > can be running at a time, regardless of the number of chips on > the machine, and additionally that the threads cannot really > interrupt each other and still maintain correct state. > > Is that all correct? Yes. You can of course run multiple Python processes which will utilise multiple processors, but that being possible is not a given. Rearchitecturing your application to make this possible may be easier than making Python free threaded[1], though. > If it is correct, it would help the scalability with regards to > thruput of our app to get this fixed and we'd be willing to help > with both the coding, the testing, and the cost of getting this > accomplished. Note that this is not just a matter of a "fix"; there are some truly subtle issues here, and also the desire to not harm performance in the single-threaded case too much. Googling for "python free threading" should yield a few thousand interesting reads (and indeed the first hit raises some of those subtle issues I was talking about). > Who would be the right people to talk to about this? Like Oleg said, python-dev, or the PythonLabs team at Zope Corp. Cheers, M. [1] "free threading" is the name this issue traditionally goes by in the Python community. Don't really know why. From shriek at gmx.co.uk Sun Dec 23 04:02:58 2001 From: shriek at gmx.co.uk (Stephen) Date: 23 Dec 2001 01:02:58 -0800 Subject: MySQLdb "Illegal instruction" error. References: <97ae44ee.0112222313.1d1c71d6@posting.google.com> Message-ID: <97ae44ee.0112230102.791201d2@posting.google.com> > >>> import MySQLdb > >>> d = MySQLdb.connect("", "test", "", "") > Illegal instruction > > I can confirm that the MySQL database 'test' can be accessed > by anybody on localhost (as well as any other host) using the > mysql client. So, I think it must be MySQLdb on my system. Sorry, the above snippet was wrong - should've been >>> d = MySQLdb.connect("", "", "", "test") but the problem still persists (ie. "Illegal Instruction" error and Python exits). I've tried using MySQLdb for Python1.5.2 and the same problem exists. So, that pretty much rules out Python1 vs Python2 problems - now to work out if it's a MySQLdb or MySQL problem. I can connect to the linux server from a Windows PC running Python2 and using MySQLdb. So, the problem really lies with either MySQL or MySQLdb on my linux box. Am starting to think it's more MySQL but it hasn't shown any other anomalies (in fact, I was quite astounded at how easy MySQLdb installed without complaining about not being able to find libraries etc). Oh, the linux server is also running the latest stable version of MySQL - 3.23.46. Getting pretty desperate so if anybody has any ideas, really appreciate it. Thanks. S. From chrishbarker at attbi.com Tue Dec 4 12:49:51 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Tue, 04 Dec 2001 09:49:51 -0800 Subject: A modest indentation proposal References: <3C0BBC1A.6E4154F@home.net> <3C0BF0E8.2F9E2641@attbi.com> Message-ID: <3C0D0CBF.33CF9EDF@attbi.com> Erann Gat wrote: > Ah. Right. My bad, I apologize. Apology excepted: > Yes, learning about pyindent is one of the useful things that resulted > from this discussion. Apparently, tokenize might be another. But the > real missing piece for me is how to make emacs support this. I have never > hacked an emacs mode. I'm no elisp hacker, but this doesn't sound too difficult. It looks like it's time to take a look at some elisp, and start asking questions on one of the emacs lists. > Well, my confidence about my recollection of what I did and didn't say has > been badly shaken :-) but I'm pretty sure all I ever asked for was > feedback, and not for anyone to do any work. I'm not going to go re-read all the posts, but I don't recall you're directly asking anyone to do anything except support your proposal. However, you did state that you didn't have the skills to do it yourself, so that implies that you want someone else to do it. If you really think this would make a difference to the folks you work with, by all means implement something. My guess is that if they use your hack, they will start to like Python, and soon enough they will realize that the hack is unnecessary. good luck... -Chris -- Christopher Barker, Ph.D. ChrisHBarker at home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From laz at strakt.com Fri Dec 28 08:04:29 2001 From: laz at strakt.com (Fredrik Juhlin) Date: Fri, 28 Dec 2001 14:04:29 +0100 Subject: Python Popularity: Questions and Comments In-Reply-To: References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <20011228130426.GA11771@strakt.com> On Fri, Dec 28, 2001 at 12:27:35PM +0100, Alex Martelli wrote: > "Steve Lamb" wrote in message > news:slrna2nhfo.nme.grey at teleute.dmiyu.org... > > On Thu, 27 Dec 2001 17:48:13 +0000, phil hunt > > > wrote: > > > Python runs quickly on my 300 MHz box, which is 3 times slower > > > than the slowest PC you can buy today. It can only get more popular. > > > > Well, if you take the measure of just pure Mhz.... 4 times slower. ;) > > FIVE or more. 1.5 GHz desktop machines are hardly news these days. I'm afraid you missed the word "slowest" in the original statement, Alex :) /FJ From fredrik at pythonware.com Sat Dec 1 20:25:47 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sun, 02 Dec 2001 01:25:47 GMT Subject: variable scoping across imports? References: <7b408077.0112010826.47a6a758@posting.google.com> <3C093C3F.10AB6FF0@earthlink.net> <83adx2sela.fsf@panacea.canonical.org> Message-ID: Kragen Sitaker wrote: > Hans Nowak writes: > > Let's see... you start x.py... x imports y... y imports x again... > > at that moment x.z0 is None. Now y has a copy of x's namespace with > > z0 == None. This is, however, not the same as the global namespace > > you're currently in. set() changes z0 to 33, but it does *not* > > affect the x module that was imported by y. > > I don't think things work this way, actually assuming Hans meant to write "reference to" instead of "copy of", it does work that way. when you run "python x.py", that script runs in the __main__ namespace. the "set" function sets __main__.z0 to 33, but that's not what the y module is printing. more here: http://effbot.org/guides/import-confusion.htm From morrow at clarityconnect.com Sun Dec 2 21:49:54 2001 From: morrow at clarityconnect.com (Dan Morrow) Date: Sun, 2 Dec 2001 21:49:54 -0500 Subject: tkinter bind command? Message-ID: My question is about binding mouse-events to a canvas. I am creating the canvas inside a object and cannot call the self.canvas.bind -- it complains about "bind." I bought Grayson's book and it addresses this partially on p. 239 -- where binding functions to mouse-events on a canvas is done through a Widget.bind(self.canvas,...) call. Why not a self.canvas.bind(...) call? Page 102 has an example of the latter method for a button. I don't understand why it works for a button, but not a canvas. Does it have anything to do with creating the canvas inside a class/object instead of at the root level? From tundra at tundraware.com Wed Dec 12 17:49:06 2001 From: tundra at tundraware.com (Tim Daneliuk) Date: Wed, 12 Dec 2001 22:49:06 GMT Subject: a lambda in a function References: <9v8knj$f61$1@news.ucar.edu> Message-ID: <3C17DECE.270EDDF5@tundraware.com> Fred Clare wrote: > > Why does interpreting the five lines: > > def func(): > x = 1 > add_one = lambda i: i+x > j = add_one(100) > func() > > Give me: > > Traceback (most recent call last): > File "test.py", line 6, in ? > func() > File "test.py", line 4, in func > j = add_one(100) > File "test.py", line 3, in > add_one = lambda i: i+x > NameError: There is no variable named 'x' > > while interpreting the three lines: > > x = 1 > add_one = lambda i: i+x > j = add_one(100) > > works just fine? This is apparently scope related because this works: def func(): global x x = 1 add_one = lambda i: i+x return add_one(100) When I run your version under PythonWin, I get the following warning after defining func(): :1: SyntaxWarning: local name 'x' in 'func' shadows use of 'x' as global in nested scope 'lambda' -- ------------------------------------------------------------------------------ Tim Daneliuk tundra at tundraware.com From rwgk at yahoo.com Fri Dec 7 22:21:13 2001 From: rwgk at yahoo.com (Ralf W. Grosse-Kunstleve) Date: 7 Dec 2001 19:21:13 -0800 Subject: MINGW References: <9uo25q$ilp$1@bob.news.rcn.net> Message-ID: <8be7693c.0112071921.289557c6@posting.google.com> "David Abrahams" wrote in message news:<9uo25q$ilp$1 at bob.news.rcn.net>... > Is anyone out there successfully using MINGW for development of extensions > with recent versions of Python (e.g. 2.1, 2.2b2)? The procedures I've found > on the web for making it work don't inspire confidence. I would appreciate a > pointer to a known working procedure if anyone can come up with it. > > TIA, > Dave This is what works for us with Python 2.1: http://cctbx.sourceforge.net/page_installation_compilers.html#compilers_mingw32 From xtian at toysinabag.com Tue Dec 11 23:16:47 2001 From: xtian at toysinabag.com (xtian) Date: 11 Dec 2001 20:16:47 -0800 Subject: jpeg files displayed in a loop References: <5a4226f0.0112111203.1d361fa0@posting.google.com> <9v5ro0$2hr$1@peabody.colorado.edu> Message-ID: Fernando P?rez wrote in message news:<9v5ro0$2hr$1 at peabody.colorado.edu>... > Kevin Cazabon wrote: > > Well, you got me curious. Here is the code with some things corrected. This > actually runs, but it hangs at the first image. My cpu usage pegged at 100% > and I just had to kill the job, it wasn't going anywhere. Any ideas? > > > > def showimage(): > image = files.pop() > files.append(image) > image = ImageTk.PhotoImage(Image.open(image)) #ok, do try/except > b.configure(image=image) > b.update_idletasks() > b.after(1000, showimage) > > a = Tkinter.Tk() > b = Tkinter.Label(a) > b.pack() > > files = os.listdir(dir) # ok, check them for file types... > os.chdir(dir) > while 1: > showimage() It's even simpler than what you've got - you don't need to call showimage in a loop. All you need to do is call it once and then call mainloop(). Because each call to showimage schedules the next call with after(), you've got an infinite loop anyway. You're getting big cpu usage because you're setting up a whole heap of callsback to the function, but never letting the event loop run to process them. Pretty cool, though. xtian From cyakycfn at mail.plutz.jp Thu Dec 20 22:32:15 2001 From: cyakycfn at mail.plutz.jp (=?ISO-2022-JP?B?GyRCJDRPIk1tISobKEI=?=) Date: Fri, 21 Dec 2001 12:32:15 +0900 Subject: =?ISO-2022-JP?B?GyRCJDRPIk1tISobKEI=?= Message-ID: <1221101123215.1347@azkah> ????????????????????? ?????????????i???????????????? ?????DL???????????????? ??????????????????? 3??????????????????????????????????? ???????????????????????? ?????????????? ?????????????????????????? ???????????????????????????? http://denou.kir.jp/asuipatu/ From fperez528 at yahoo.com Sat Dec 1 09:09:06 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Sun, 02 Dec 2001 13:37:06 +2328 Subject: Whatever happened to String Interpolation? References: <9u6dbn$nsj$1@peabody.colorado.edu> <9uckd9$o43$1@peabody.colorado.edu> <9ucn17$pea$1@peabody.colorado.edu> Message-ID: <9ue3f4$sbi$2@peabody.colorado.edu> Johann Hibschman wrote: > Fernando =?ISO-8859-1?Q?P=E9rez?= writes: >> >> Oh well. We'll see if this gets anywhere. It would be nice to hear >> from Ping, I wonder if he's around in this group. > > I'll try to point him at the thread, though he's been real busy > of late. If I catch him, what exactly did you want to know? > > --J Oh, I was just curious whether he was still much 'behind' the idea. I get the feeling that unless a PEP has a strong 'champion', its chances of survival in the Python ecosystem are slim. And that's a good thing, it is precisely the kind of editorial ruthlessness that keeps the language clean. But if he's too busy right now to push for it, that's fine. You may also want to mention to him the draft pep that came out today (sheer coincidence): http://www.tothink.com/python/interpp That has already drawn some concern from Tim Peters, it would be good to balance the two ideas and decide which (if any) is sounder, before trying to push one forward. Ping I'm sure understands the issues behind this well enough (he implemented Itpl after all) to make some sort of intelligent comment. cheers, f From bac at OCF.Berkeley.EDU Wed Dec 5 16:33:43 2001 From: bac at OCF.Berkeley.EDU (Brett Cannon) Date: Wed, 5 Dec 2001 13:33:43 -0800 Subject: Strip HTML tags from downloaded files In-Reply-To: References: Message-ID: You can use a regular expression to get rid of them: import re HTML_re=re.compile(r'<[^>]+>\s*') #\s to remove \n; else left in string. non_HTML_text=HTML_re.sub('',HTML_text) Can also use r'<.+?>\s*' for the regex. -Brett Cannon On Wed, 5 Dec 2001, Thomas Pham wrote: > > When I use urlretrieve to download a file from the web, the raw text file have HTML tags embedded at the beginning and the end of the file. > > > > > > > > > > > Is there anyway to strip all the HTML tags from the file? > > Thanks, > -- > > _______________________________________________ > 1 cent a minute calls anywhere in the U.S.! > > http://www.getpennytalk.com/cgi-bin/adforward.cgi?p_key=RG9853KJ&url=http://www.getpennytalk.com > > > > > From rdsteph at earthlink.net Thu Dec 27 18:36:15 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Thu, 27 Dec 2001 23:36:15 GMT Subject: REPOST: Re: Two languages, too similar, competing in the same space. References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> Message-ID: <8$--$$_----_-$-_%$@news.noc.cabal.int> I find this very interesting. Thanks for sharing it, it sounds very useful! HarryO wrote: > On Fri, 28 Dec 2001 09:56:29 +1100, Ron Stephens wrote: > > > ... But > > now that Ruby is out there, it absorbs enormous mind share, and > > development time to recreate libraries etc., which are already available > > in Python, thus hurting Python. > > I have only tried it in a very minimal way, just to see that it did > basically what was advertised, but you might be interested in this. > > There's a Ruby library that allows you to do things like: > > require 'python' > require 'python/httplib' > > h = Py::Httplib::HTTP.new(host) > > h.putrequest('GET', path) > h.putheader('Accept', 'text/html') > h.putheader('Accept', 'text/plain') > h.endheaders() > > Ie, the "require 'python'" makes pulling in Python libraries > as simple as ... > > require 'python/SOME_PYTHON_LIB' > > which is almost as easy as doing it in Python. > > Similarly, referencing elements of such a library simply > requires prefixing them with "Py::". Once you have a > handle to a Python object, you call it the same way you > would in Python. I don't think one could make it much simpler. > > So, to some extent, it's possible to avoid reinventing the > wheel. How well this works, I can't say, just that the > examples I played with worked as advertised. > > Obviously, there's some overhead, in that it's running a copy > of the Python interpreter to execute the Python code, but so > long as the work the library is doing for one is larger than > the actual overhead of the call to it, that shouldn't be a > problem. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2BB10D.BD5002C7 at earthlink.net> Control: cancel <3C2BB10D.BD5002C7 at earthlink.net> Date: Mon, 31 Dec 2001 02:56:47 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775497 27193 211.57.49.2 (31 Dec 2001 05:11:37 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:11:37 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From chrishbarker at attbi.com Fri Dec 28 13:54:14 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Fri, 28 Dec 2001 10:54:14 -0800 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: <3C2CBFD6.21A7FC6C@attbi.com> Alex Martelli wrote: > What huge firm[s] might possibly make a > similar decision in the case of Python? And why? I don't know what firms would do it, but the "why" is the same as for JAVA: The more popular a platform independent/nuetral development language/tool is, the weeker Microsoft's grip on the market is. Right now, if an organisation uses VB for development, they can only deploy on Windows. In order to deploy on another platform , they would have to learn a whoilw new language/development enviroment, and port their products to it. If they, instead were using Python with, for example, wxPython for the GUI, the decision to support another platform would involve only minor learning and porting. This is good for everyone that stands to benifit from people using a non-windows platform (Apple, Sun, the Linux and *BSD vendors, etc.) That is exactly why there is no VB (or MFC) for any non-MS platform. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From James_Althoff at i2.com Fri Dec 7 15:03:01 2001 From: James_Althoff at i2.com (James_Althoff at i2.com) Date: Fri, 7 Dec 2001 12:03:01 -0800 Subject: Calling a generator multiple times Message-ID: Courageous wrote: >Thefact remains, as you state that you understand below, >the current implementation of generators is >counter-intuitive, misleading, and incongruous with >Python itself. As someone who has the vast experience of writing *one* generator in Python -- in the Interval/IteratorBounds exercise that I recently posted -- I, on the contrary, found the generator to be not-counter-intuitive, not-misleading, and not-incongruous-with-Python. I guess it depends on your point of view. For my exercise, the generator made it easier and more straightforward for me to create the iterator that I wanted compared with the alternative of creating an iterator class. So as to not confuse myself, I think of generators thusly: A generator is a function or method that -- by virtue of using the yield statement -- *creates* and *returns* an iterator object when invoked by a caller. The caller normally takes that returned iterator object and uses it by invoking its "next" method until StopIteration is raised. The code inside the generator function or method *runs* when the "next" method of said iterator is invoked. Each time a caller invokes the *generator* function or method, a new iterator object is created and returned. Jim From DeepBleu at DeepBleu.org Thu Dec 27 10:09:45 2001 From: DeepBleu at DeepBleu.org (DeepBleu) Date: Thu, 27 Dec 2001 09:09:45 -0600 Subject: Fate of win32all? References: <7876a8ea.0112212116.2ebabc23@posting.google.com> Message-ID: One word that I feel like sharing here: Mark Hammond is a hero of mine. Have I owned my own company I would hire him for lots of money :) Wishing Mark all the best in his professiol endeavours. DeepBleu "stalin" wrote in message news:7876a8ea.0112212116.2ebabc23 at posting.google.com... > I've used win32all occasionally--always in noncommercial settings--and > have found it helpful. I'd like to thank Mr. Hammond for developing > the packages and ActiveState for supporting their recent maintenance > by employing Hammond. > > Mr. Hammond had personally developed the win32 packages to > considerable maturity before he became involved with ActiveState. His > employment by ActiveState appears to have come to an untimely end just > recently ( http://mail.python.org/pipermail/python-dev/2001-December/019038.html > ). I don't mean to be insensitive--I'm sure Hammond has a lot on his > mind right now--but I wonder about the fate of win32all. What role > does ActiveState now play in licensing the package? Has the original > author lost a degree of his control over it to his former employer? > > My suspicion is rooted in the apparent lack of a binary distribution > of win32all for Python 2.2 independent of ActiveState's ActivePython > product. Queries about a binary distribution of win32all for Python > 2.2 have gone unanswered for months: > > http://groups.google.com/groups?q=win32all+2.2&hl=en&group=comp.lang.python. *&rnum=1&selm=9ralkq%24rdc%241%40ins22.netins.net > > ActiveState's win32all page does not list a binary download for Python > 2.2,: > http://aspn.activestate.com/ASPN/Downloads/ActivePython/Extensions/Win32all > > although they have developed an ActivePython 2.2 alpha that of course > *incorporates* win32all: > http://www.activestate.com/Products/Download/Download.plex?id=ActivePython > > Hammond's personal Starship page makes no mention of a win32all binary > for Python 2.2: > http://starship.python.net/crew/mhammond/win32/Downloads.html > > I wrote this message simply because I'd like to know who holds the > reins of win32all, and what their plans for it are. I am *not* an > anti-ActiveState malcontent looking to spread conspiracy theories, > though I must say that recent developments call the future of the > company into question in my mind. From rereidy at indra.com Thu Dec 13 17:26:45 2001 From: rereidy at indra.com (Ron Reidy) Date: Thu, 13 Dec 2001 15:26:45 -0700 Subject: reading 6-byte ("real48") Borland Pascal Floating Point numbers References: <3c19262e.1671423@news.muenster.de> Message-ID: <3C192B25.4F1BD2F9@indra.com> Martin Bless wrote: > > I have to convert those "good (?) old" 6-byte, "real48" floating point > numbers used in Borland's Pascal to nowadays "normal" floating points. > > Has is already been done? > > Martin You will have to do this using pack(). -- Ron Reidy Oracle DBA Reidy Consulting, L.L.C. From jkraska at san.rr.com Thu Dec 13 19:14:57 2001 From: jkraska at san.rr.com (Courageous) Date: Fri, 14 Dec 2001 00:14:57 GMT Subject: Ordered dictionaries? References: <20011213214515.61016.qmail@web21106.mail.yahoo.com> Message-ID: >> One last Perl module that I need to replace to >> complete my Python toolkit is a custom module that let >> me create a dictionary whose keys were settable and >> retrievable in a particular order. Essentially, this >> let us have a list whose ordered elements were also >> accessible by name. What you are looking for is a tree of some kind. Any variety of tree will due, although once statistical amortization and constant costs are taken into account, Red Black Trees are widely-regarded as superior. IIRC, there already exists several trees in the Vaults of Parnassus, including a Red Black Tree. For Python, any variety of ordered, searchable tree will due. Any of the complexity costs will be masked by the Python interpreter itself for any sane value of N < 1000. C// From kirill at xyz.donetsk.ua Thu Dec 20 05:05:46 2001 From: kirill at xyz.donetsk.ua (Kirill Simonov) Date: Thu, 20 Dec 2001 12:05:46 +0200 Subject: It's Tk's fault In-Reply-To: <9vrji0$hbcov$1@ID-12869.news.dfncis.de>; from store_li@sina.com on Thu, Dec 20, 2001 at 10:46:37AM +0800 References: <9vp5bv$gvfps$1@ID-12869.news.dfncis.de> <9vrji0$hbcov$1@ID-12869.news.dfncis.de> Message-ID: <20011220120545.A960@xyz.donetsk.ua> On Thu, Dec 20, 2001 at 10:46:37AM +0800, Kick wrote: > My string is a ordinary 'string' type according to the result of Print > type(variable) Try to convert data to unicode before using it: data = unicode(data, 'gb2312') Maybe, you need to download additional codecs from "http://sourceforge.net/projects/python-codecs/". Kirill From rdsteph at earthlink.net Thu Dec 27 17:56:29 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Thu, 27 Dec 2001 22:56:29 GMT Subject: REPOST: Two languages, too similar, competing in the same space. References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <6$--$$_----_-$-_%$@news.noc.cabal.int> I appreciate all of the above comments from all of you. To sum up my position, briefly; I feel that Ruby is so similar in design, purpose, and objectives to Python, that it competes directly with Python for developers' mind share. However, Ruby does not, in my opinion, offer compelling enough improvements upon Python, as to justify switching from Python to Ruby. In fact, I much *prefer* Python to Ruby. But I can see where some significant number of Python developers *might* prefer Ruby a little bit, because of some minor differences, enhancements etc. I just don't think that such perceived "enhancements" create any significant enough improvement to *justify* the enormous work in the creation of Ruby, as a Python-like clone. Bruce Eckles said that, if a language can't give dramatic productivity improvements over a predecessor language, that it does not justify one's switching. 10% improvements are not nearly enough, he said. Now, we can argue until the cows come home whether or not Ruby gives *any* improvements at all over Python; I suspect it is a matter of taste. But now that Ruby is out there, it absorbs enormous mind share, and development time to recreate libraries etc., which are already available in Python, thus hurting Python. Of course Perl hackers might have said similar things about Python 10 year ago ;-))). And I like and respect Matz and the whole Ruby community. I wish them well. But I recognize that their success may, on the margins at least, slow down Python. Ah well, .... Ron Stephens http://www.awaretek.com/plf.html ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2BA7B8.35286DE3 at earthlink.net> Control: cancel <3C2BA7B8.35286DE3 at earthlink.net> Date: Mon, 31 Dec 2001 05:16:03 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775527 27193 211.57.49.2 (31 Dec 2001 05:12:07 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:12:07 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From claird at starbase.neosoft.com Thu Dec 27 19:46:34 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 27 Dec 2001 18:46:34 -0600 Subject: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B941D.B1E45AA5@htp-tel.de> Message-ID: <12A9BC72F498525B.53DB158BB2A96C03.580B237ADC0BA1FF@lp.airnews.net> In article , Aahz Maruch wrote: >In article <3C2B941D.B1E45AA5 at htp-tel.de>, >Tom Karas wrote: >> >>What means nntp ? > >It's a protocol for transferring netnews articles, the way HTTP is a >protocol for transferring HTML documents. For more information, poke >around Google. . . . Before that, let me suggest for its focus on "the end-user exper- ience". -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From michael.williams at st-annes.oxford.ac.uk Mon Dec 3 23:24:01 2001 From: michael.williams at st-annes.oxford.ac.uk (Michael Williams) Date: Tue, 04 Dec 2001 04:24:01 +0000 Subject: Using *just* the IDLE editor Message-ID: <3C0C4FE1.5B218CE0@st-annes.oxford.ac.uk> Hi, I'd like to set up (or strip out components or rewrite, but hopefully it won't be that complex) IDLE so that when I start it up with $ idle I just get the IDLE editor and not the interactive shell. (I need to avoid starting the shell for uninteresting reasons). The -e option allows the opening of the editor window, but doesn't prevent opening of the interactive shell. I'm afraid I don't have enough experience of Python (esp Tk) to go through the code and work out what's being done by idle.py so I would be very grateful if someone could point me in the direction of a command line argument to prevent the shell appearing or module I could strip out of the IDLE directory to allow me to just use the editor. -- Michael From shalehperry at attbi.com Mon Dec 10 01:13:30 2001 From: shalehperry at attbi.com (Sean 'Shaleh' Perry) Date: Sun, 09 Dec 2001 22:13:30 -0800 (PST) Subject: Is c or c ++ my language for this task... Or is it Python? In-Reply-To: Message-ID: > > Anyways, I can't seem to see a piece of software out there that > provides this data for me and so undaunted I am going to write it for > myself. > Since you said dll can I presume Windows? Either way, look at some of the available source code for linux (unix) dvd readers or driver code. This may not help on your OS or directly for your problem but it will show how they are getting some of this data. I believe one of the better ones is called 'xine'. From km-list-python at miazine.net Wed Dec 19 05:56:27 2001 From: km-list-python at miazine.net (Kirill Miazine) Date: Wed, 19 Dec 2001 11:56:27 +0100 Subject: Update Oreilly books? In-Reply-To: <20011219074308.GA30387@kub.nl> References: <3C1E3805.6090009@home.com> <20011219074308.GA30387@kub.nl> Message-ID: <20011219115627.F14966@poff.miazine.net> * Bas van Gils [20011219 08:43]: > > I agree... Programming Python is a massive treasure trove of topics. It > > just covers so much. The Tkinter section is great and pretty extensive, > > the networking and CGI areas are good as well. Then there are the > > sections on system scripting and so forth. It is well rounded. My only > > complaint is the excessive code redundancy--they could have shaved > > 100-200 pages off the thing by not reprinting an entire code example > > when one or two lines change... > > I am a believer as well :-) The first edition of PP was my intro in the > world of Python. I still think mr. Lutz dit an excellent job on that Mine too, but I started with PP2. > one. I recently purchased the second edition and am reading it back to > back. IMHO the book is written in a consistent manner, has lots of humor > in it and many insightfull examples. Yes. But as I mentioned before, some people (including me) expected more of a reference book (like Programming Perl is). But examples are always great and Python Pocket Reference together with Programming Python make an unbeatable combination. > However, I agree that some improvements should be made on the index. It > is sometimes hard to find what one needs. Thats why I also bought > "Python Pocket Reference"... I got my Python Pocket Reference 2 Edition yesterday. It's a lot better than PPR1. Highly recommended. -- Kirill From philh at comuno.freeserve.co.uk Wed Dec 12 14:29:05 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Wed, 12 Dec 2001 19:29:05 +0000 Subject: Whatever happened to String Interpolation? References: <9u6dbn$nsj$1@peabody.colorado.edu> <9ue35a$sbi$1@peabody.colorado.edu> <9uerd1$hbk$1@peabody.colorado.edu> Message-ID: On Wed, 12 Dec 2001 09:14:55 -0500, Oren Tirosh wrote: >On Wed, Dec 12, 2001 at 09:25:24AM +0200, Ville Vainio wrote: >> >> > That already exists: type 'python Itpl' in google. >> >> So, it appears to be done already. What's the fuss, then? Wouldn't >> having this in the standard library suffice? Looking at the relatively >> concise syntax on Itpl, why on earth would one want an equivalent >> thing encumbering the core language? > >Something that can be done in a module belongs in a module, not in the core >language. Saving an import statement and a pair of parentheses does not >justify changes to the core language. > >But the proposal in http://www.tothink.com/python/interpp cannot be >implemented in a module. The embedded expressions are fully syntax-checked >at compile time and generate real bytecode. There is no use of eval() or >runtime parsing that are so common in so-called 'scripting' languages and >contribute to their slow performance and security problems. I believe >this is a worthy goal, and it can only be accomplished by extending the >syntax of the language. Rubbish! Ever heard of preprocessors. >The issue of whether it SHOULD be added to the language is, of course, open >for debate but the only way it CAN be implemented is as part of the >language syntax. See above. IMO python doesn't need extra syntax. -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From philh at comuno.freeserve.co.uk Sun Dec 30 19:44:10 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Mon, 31 Dec 2001 00:44:10 +0000 Subject: Is learning Python "extraordinary"? References: <3C2E5706.5880983E@engcorp.com> Message-ID: On Sun, 30 Dec 2001 02:27:04 GMT, Courageous wrote: > >>I think that you're answering with the wrong comparison group as your >>background sample. Certainly I'd expect any professional developer to be >>able to pick up Python in a week. But, among the set of all students >>applying for university admission, how many of them have taught themselves >>Python? I think this is an important distinction. > >When I was in highschool, those individuals who self-taught themselves >computer programming languages I taught myself programming. (From the book "Illustrating BASIC")... > were of the rare breed who were destined >to later be technical wizards in their field. ...hmmm. >Passionately caring about >something above and beyond what you're made to do and having the >initiative to carry it out is a remarkable thing at any age; in a >young mind, it is spectacular. It shows initiative, and is to be applauded, but I wouldn't say spectacular. >Usenet urban legendry would have it that those who hang out in >computer programming language groups are generally taken from the >top 1% of their peers. This is true of comp.lang.python, at least :-) -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From curt at journyx.com Fri Dec 21 07:50:58 2001 From: curt at journyx.com (curt finch) Date: 21 Dec 2001 04:50:58 -0800 Subject: python threads Message-ID: <96c7f32.0112210450.174f6914@posting.google.com> We ship a web application completely written in python. The application server daemon that sits between apache/IIS and the dbserver would like to take advantage of multi-chip architectures and have many threads. Each thread would be owned by a logged in user with it's own db connection and share cached db data with other threads. My understanding is that python's current threads implementation does not really allow for this in the sense that only one thread can be running at a time, regardless of the number of chips on the machine, and additionally that the threads cannot really interrupt each other and still maintain correct state. Is that all correct? If it is correct, it would help the scalability with regards to thruput of our app to get this fixed and we'd be willing to help with both the coding, the testing, and the cost of getting this accomplished. Who would be the right people to talk to about this? __________________________________________________________________ Web-Based Time Tracking. Journyx *FREE* at (800) 755-9878 http://journyx.com/wts.html curt at www.journyx.com ------------------------------------------------------------------ From bill-bell at bill-bell.hamilton.on.ca Sun Dec 9 19:36:41 2001 From: bill-bell at bill-bell.hamilton.on.ca (Bill Bell) Date: Sun, 9 Dec 2001 19:36:41 -0500 Subject: Monitoring running Windows Applications In-Reply-To: <1007801753.511.4368.m12@yahoogroups.com> Message-ID: <3C13BD49.4645.25C283B@localhost> From: root at 127.0.0.1 ((Five Fresh) Fish) > How can one get Python to identify either the applications that are > currently running in Windows, in real-time (ie. as an application > monitor)... > > Or, better, how can one get Python to identify all the open windows, > in real-time? A couple of people have mentioned using PDH for this purpose-- one having pointed out that it's already wrapped for Python. If I remember correctly, PDH is unavailable under Win9x. There's a sample program code (written in C?) available on MSDN that shows how to capture similar information for both Win9x or WinNT/2K. "It is the time that you have wasted for your rose that makes your rose so important."--St-Exupery From cliechti at gmx.net Fri Dec 28 08:27:49 2001 From: cliechti at gmx.net (Chris Liechti) Date: 28 Dec 2001 14:27:49 +0100 Subject: is this a bug or what? References: Message-ID: [posted and mailed] "I.J." wrote in news:a0dv4v$bnh$1 at cer.yubc.net: >>>> M=[[0]*3]*3 >>>> M > [[0, 0, 0], [0, 0, 0], [0, 0, 0]] >>>> M[1][1]=1 >>>> M > [[0, 1, 0], [0, 1, 0], [0, 1, 0]] > > Is this new age math? no your multiplying the reference to one list [0,0,0]. all three sublists are the same object. it works well with strings, numbers and tuples because these are immutable an when you change someting a new object is generated. e.g. l = [0]*4 l[2] = 1 a list like in your example can nicly be created by list comprehesions: M = [ [0]*3 for i in range(3) ] -- Chris From jdhunter at nitace.bsd.uchicago.edu Mon Dec 10 09:09:26 2001 From: jdhunter at nitace.bsd.uchicago.edu (John Hunter) Date: Mon, 10 Dec 2001 08:09:26 -0600 Subject: How to change IP Address by Python program on Win Platform References: <9v2aqb$mbt$1@ih292.ea.unisys.com> Message-ID: >>>>> "Joel" == Joel Quinet writes: Joel> Hi all, I have to change my IP address on my laptop Joel> frequently for testing. I am borring to do it by setting... Joel> I would like to do it by Python script. Joel> How can I do that ? You will need to tell us your platform before anyone can begin to answer this question. John Hunter From uwe at rocksport.de Tue Dec 4 09:53:16 2001 From: uwe at rocksport.de (Uwe Schmitt) Date: 4 Dec 2001 14:53:16 GMT Subject: Numerical Python Question References: <9uieop$bncra$1@hades.rz.uni-sb.de> Message-ID: <9uio0s$brvd7$3@hades.rz.uni-sb.de> I got it: I have to convert hilb and x to Matrix-objects... Greetings, Uwe. -- Dr. rer. nat. Uwe Schmitt Uwe.Schmitt at num.uni-sb.de Universitaet des Saarlandes Angewandte Mathematik Building 36.1 Room 4.17 PO-Box 151150 D-66041 Saarbruecken Mobile:0177/6806587 Fax:+49(0)681/302-4435 Office:+49(0)681/302-2468 From chilopoda at hotmail.com Tue Dec 11 11:05:44 2001 From: chilopoda at hotmail.com (Rene Jensen) Date: Tue, 11 Dec 2001 16:05:44 +0000 (UTC) Subject: constructors for lists and tuples References: <1f5252d4.0112110519.2617d639@posting.google.com> Message-ID: <3fd89c2981ebd022646e2b1b0ab3b14d.45609@mygate.mailgate.org> Lists: MyList = [initializer] * size e.g [None] * 5 = [None,None,...] Tuples: MyTuple = (initializer, ) * size e.g. (10,) * 5 = (10,10,10,10,10) If you would want a list of initialized objects, do this: MyList = [None] * size MyList = map(lambda x:MyClass() , MyList) ..should create different objects rather than MyList = [MyClass()] * size ..that will give you a list of references to the same object "N Becker" wrote in message news:1f5252d4.0112110519.2617d639 at posting.google.com... > what are the constructors for lists and tuples? I wanted to make a > list of a known size and then populate it. Based on my experience > with C++ and STL, I expected to find a constructor that took a size. > I would expect to find like: > > list (size, init=None) > > 2 problems. > > 1) I don't know how to do this > > 2) I don't know where to find documentation on this. All the modules > document the constructors for their extensions, but looking at the > library reference, I didn't see anything documenting the complete > behaviour of the builtin list or tuple. -- Posted from 0xc3f9f26c.mrgnxr1.ras.tele.dk [195.249.242.108] via Mailgate.ORG Server - http://www.Mailgate.ORG From chironsw at swbell.net Tue Dec 11 18:24:14 2001 From: chironsw at swbell.net (Greg Goodman) Date: Tue, 11 Dec 2001 23:24:14 GMT Subject: problems subclassing a PMW widget Message-ID: <3C169773.772BCB93@swbell.net> I'm having a problem subclassing a Pmw widget, and I'm looking for some help. (I looked through the comp.lang.python archive, and found that this question was asked last August, but apparently never answered.) A simple code snippet that illustrates the problem follows: --- start snippet --- import sys import Tkinter import Pmw class UOMEntryField(Pmw.EntryField): """ A Pmw.EntryField subclass """ def __init__(self, parent = None, **kw): Pmw.EntryField.__init__(self, parent, **kw) if __name__ == '__main__': root = Tkinter.Tk() val = Tkinter.DoubleVar() val.set(1.23) widget = UOMEntryField( labelpos='w', label_text='My Label', validate='real', entry_textvariable = val) widget.pack() Tkinter.Button(text='Quit', command=sys.exit).pack() root.mainloop() --- end snippet --- The symptom is that the specified 'real' validation doesn't work. If 'widget' is created as a Pmw.EntryField, everything works. If it is a UOMEntryField (as in the example above), it doesn't. On any keyboard entry into the field, I get a slew of error messages culminating in: AttributeError: UOMEntryField instance has no attribute '_valid' I have traced the problem to the Pmw.MegaArchetype.initialiseoptions() method. The relevant EntryField options are only initialised (and the _entry attribute, among others, created) "if self.__class__ is myClass:". myClass is passed by the Pmw.EntryField constructor as "EntryField". Unfortunately, the class of self is UOMEntryField. Either I'm doing something wrong, or the Pmw widgets aren't meant to be subclassed. I'm hoping it's me. Incidentally, the reason I want to subclass the EntryField is to add a "units of measure" MenuOption to the widget. That way, when I create an entry field, I can also specify a type of UOM, such as 'length' or 'density' or 'velocity', which produces a Menu of allowable units. (For instance, 'length' would imply 'feet', 'inches, 'meters', 'centimeters', etc.) I could also specify an initial unit, such as 'feet' or 'grams/liter' (density) or 'meters/second' (velocity). On changing the UOM selection with the MenuOption, the current value of the field gets automatically converted. Looking forward to any suggestions you can give me, Greg Goodman chironsw.NOSPAM at swbell.net From seb at tesco.net Sat Dec 1 23:06:21 2001 From: seb at tesco.net (seb) Date: Sun, 02 Dec 2001 04:06:21 GMT Subject: Errors and their messages Message-ID: <3c09a403.91845196@news.tesco.net> Hi all, i think i've only ever followed up here before, but here goes: The python error messages presented on the command line seem to me to be particularly gregious. Say someone is looking to get schoolkids to be involved in programming (and python seems to be a reasonable choice here so i understand), then something like: Traceback (innermost last): File "", line 1, in ? File "win32com\client\__init__.py", line 13, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,c lsctx) File "win32com\client\dynamic.py", line 67, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File "win32com\client\dynamic.py", line 58, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.II D_IDispatch) doesn't make it easy. OK, i might be trying to do a bit more here, but even >>> lala Traceback (innermost last): File "", line 1, in ? NameError: lala >>> is cryptic. Don't see how a 9-year old would grasp this. I know thirty year olds that balk at these sort of messages, understandably so, they're not programmers. seb. From apps_xertel at hotmail.com Mon Dec 17 12:05:47 2001 From: apps_xertel at hotmail.com (Aparna Shivakumar) Date: Mon, 17 Dec 2001 17:05:47 +0000 Subject: help Message-ID: An HTML attachment was scrubbed... URL: From ark at research.att.com Sun Dec 2 15:24:01 2001 From: ark at research.att.com (Andrew Koenig) Date: Sun, 2 Dec 2001 20:24:01 GMT Subject: Let's make Python really strict about indentation References: <3C087F11.4030706@post.harvard.edu> <3c0a697c$1@207.229.64.20> Message-ID: Peter> I think not allowing a mixture of tabs and spaces for indenting Peter> is reasonable, it is sloppy and hazardous. Not allowing tabs Peter> at all is overly intolerant. I hope that this thread is just a Peter> bunch of hot air and that cooler heads will prevail. There are lots of editors out there that have separate notions of logical and physical tabs. Suppose you set physical tabs to every 8 positions (the usual Unix convention) and logical tabs to every 4. Then a singly indented line begins with four spaces and a doubly indented line begins with a tab. Indeed, it is not uncommon for editors to quietly turn leading spaces into tabs by default. I am concerned about the possibility of the compiler rejecting programs because of default editor behavior of which beginning programmers cannot reasonably be expected to be aware. -- Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark From jdhunter at nitace.bsd.uchicago.edu Sun Dec 30 13:21:45 2001 From: jdhunter at nitace.bsd.uchicago.edu (John Hunter) Date: Sun, 30 Dec 2001 12:21:45 -0600 Subject: REPOST: Re: Call for a small program - willing to give a bonus References: <3C2F2186.52BF5D0C@htp-tel.de> Message-ID: <5$--$$_----___-_$$@news.noc.cabal.int> >>>>> "Tom" == Tom Karas writes: Tom> Later the program should also be able to play sound. I heard, Tom> this could be difficult with python !? I do not think this is true. The built-in python library supports wave, aif and raw audio formats, among others. Other audio formats such as mp3 are available via extension modules. So you'll have no problem here, I suspect. Guido van Rossum, the inventor of python, worked in the multimedia biz in his life prior to python and I think worked with audio codecs, so it is not surprising that python has multimedia serves built in. Cheers, John Hunter ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: John Hunter Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:28:29 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774133 27193 211.57.49.2 (31 Dec 2001 04:48:53 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:48:53 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From bt98 at doc.ic.ac.uk Fri Dec 14 07:10:56 2001 From: bt98 at doc.ic.ac.uk (Benjamin Tai) Date: Fri, 14 Dec 2001 12:10:56 +0000 Subject: what is self._base? Message-ID: <3C19EC50.153B76A1@doc.ic.ac.uk> Hi, I have come across the following statement in a constructor (Programming Python by Mark Lutz). After extending a type in C (stacktype), it is wrapped by a Python class (Stack). import stacktype class Stack: def __init__(self, start=None): self._base = start or stacktype.Stack() However I can't find any documents/explanation for the following: 1) What is "_base" 2) What is "start=None" 3) Why can't I just write "self = stacktype.Stack()" Any help for this newbie would be appreciated. Ben From wware at alum.mit.edu Mon Dec 31 12:12:43 2001 From: wware at alum.mit.edu (Will Ware) Date: Mon, 31 Dec 2001 12:12:43 -0500 Subject: stackless python References: None <9vpjds$due$1@usc.edu> <1008824522.772261@yabetcha.sttl.drizzle.com> Message-ID: <3C309C8B.81593E2C@alum.mit.edu> Donn Cave wrote: > ... microthreads ... can Scheme do that stuff? Christian Tismer wrote: > I'm pretty sure Scheme can. It has raw continuations, so you can > implement everything with them, why not microthreads? MzScheme has an excellent microthreading capability. It works great under Linux, I haven't tried it under Windows. General info: http://www.cs.rice.edu/CS/PLT/packages/mzscheme/ Threads: http://www.cs.rice.edu/CS/PLT/packages/doc/mzscheme/node91.htm From oren-py-l at hishome.net Sun Dec 23 15:51:05 2001 From: oren-py-l at hishome.net (Oren Tirosh) Date: Sun, 23 Dec 2001 15:51:05 -0500 Subject: How can a module find its own module object? Message-ID: <20011223155105.A30424@hishome.net> 'import myname' is not exactly a reliable way to get your own module object - the file may be renamed, placed in a package, affected by case-sensitivity problems, loaded from somewhere not in the path, etc. Is there any other way for a module to find itself other than searching sys.modules for a module whose __dict__ is globals()? Oren From gh_pythonlist at gmx.de Thu Dec 20 00:37:21 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Thu, 20 Dec 2001 06:37:21 +0100 Subject: Can I change a unicode char to gb2312 using python? In-Reply-To: <20011220073804.E22021@phd.pp.ru> References: <9vq6d9$gvc5p$1@ID-12869.news.dfncis.de> <9vrk0m$h6rua$1@ID-12869.news.dfncis.de> <20011220073804.E22021@phd.pp.ru> Message-ID: <20011220053718.GA2560@lilith.hqd-internal> Le 20/12/01 ? 07:38, Oleg Broytmann ?crivit: > On Thu, Dec 20, 2001 at 10:54:29AM +0800, Kick wrote: > > One piece additional, the python said unknown encoding. :-< > > There is a seprate project somewhere on sf.net that hs many oriental > encodings. I don't rememeber its name, and cnnot find it... but it should > be there. Chinese: http://sourceforge.net/projects/pythonzh/ Japanese: http://pseudo.grad.sccs.chukyo-u.ac.jp/~kajiyama/python/ If this doesn't help yet, maybe someone from the i18n SIG knows a solution: http://www.python.org/sigs/i18n-sig/ Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From keyton at weissinger.org Sun Dec 9 20:01:48 2001 From: keyton at weissinger.org (A. Keyton Weissinger) Date: Sun, 9 Dec 2001 20:01:48 -0500 Subject: Populating a list In-Reply-To: Message-ID: So we're clear. You can either do it this way: states = [] f=open('/home/mlorfeld/states.txt', 'r+').readlines() for i in f: states.append(i.rstrip()) print states The rstrip() method, as you can probably guess, strips white spaces from the RIGHT end of the string. or (from Mr. Martelli -- I like this one better): f = open('/home/mlorfeld/states.txt', 'r+') states = [ line[:-1] for line in f.readlines() ] f.close() Sorry for the misinformation, folks. Keyton From sholden at holdenweb.com Thu Dec 27 14:06:31 2001 From: sholden at holdenweb.com (Steve Holden) Date: Thu, 27 Dec 2001 14:06:31 -0500 Subject: Access Problem References: <3c289e2f$1_2@nopics.sjc> Message-ID: "John Yeager" wrote in message news:3c289e2f$1_2 at nopics.sjc... > Useing the following code to access a Access Database, I run into a problem > getting the Database to Autonumber the primary key > > Here is my code what am I missing > import time > import odbc > > Time = time.ctime(time.time()) > connection = odbc.odbc('Everquest') > cur = connection.cursor() > sql = "Insert into Member VALUES( '(Autonumber goes here )','test', > 'test','NULL','p','R300478','Testuser','Test','%s')" % ( Time ) > cur.execute( sql ) > connection.commit() > cur.close() > connection.close() > > So what am I doing wrrong here? > It would have been more helpful to supply the *actual* code (which I hope the above wasn't), along with the *actual* error message. I assume that the first field in the table's definition is the autonumbered one, but it's always dangerous to assume a particular column ordering in SQL - someone can modify the table definition later without your knowing, and your statement suddenly becomes invalid - or, even worse, puts values in the wrong columns! I'm thinking you probably need something like either: sql = """INSERT INTO Member VALUES (NULL, 'test', 'test', NULL, 'p', 'R300478', 'Testuser', 'Test', '%s')""" % ( Time, ) # Note this is now a tuple or something which uses explicit names for the database columns, and explicitly omits the key field (which then has NULL provided for it, which Access will replace with an autonembered value). Like: sql = """INSERT INTO Member (Field2, Field3, Field4, Field5m Field6, Field7) VALUES ('test', 'test', NULL, 'p' 'R300478', 'Testuser', 'Test', '%s')""" % Time # Tuple not needed with one substitution You should also note that you can supply the variable data as a tuple second argument to the execute if you use parameter substitution, whcih you should look up in the DBI documentation. regards Steve -- http://www.holdenweb.com/ From nospam at mega-nerd.com Tue Dec 4 15:16:57 2001 From: nospam at mega-nerd.com (Erik de Castro Lopo) Date: Tue, 04 Dec 2001 20:16:57 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <3C0BE492.5DACEA18@mega-nerd.com> <3C0C8872.2A3715A4@mega-nerd.com> Message-ID: <3C0D2F38.ED8F1D41@mega-nerd.com> Steve Lamb wrote: > > On Tue, 04 Dec 2001 08:25:23 GMT, Erik de Castro Lopo > wrote: > > Easy. Tabs everywhere: > > > some_dict = { > > 'Jane':{'Age':'21', 'Dept':'0001', 'Ext':'1234'}, > > 'John':{'Age':'22', 'Dept':'0010', 'Ext':'5678'}, > > 'Jeff':{'Age':'23', 'Dept':'0100', 'Ext':'9009'}, > > 'Jody':{'Age':'24', 'Dept':'1000', 'Ext':'8765'}, > > 'Jeny':{'Age':'25', 'Dept':'0110', 'Ext':'4321'} > > } > > > Beautiful!!!! > > Uh, no, rather nasty in fact. Face it, that's the one case where tabs > fail and is so common as to prevent tabs from being ever used in code. Please explian to us rational people why that is nasty. Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam at mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ Perl : executable line noise Python: executable pseudo-code From jdhunter at nitace.bsd.uchicago.edu Thu Dec 6 13:54:28 2001 From: jdhunter at nitace.bsd.uchicago.edu (John Hunter) Date: Thu, 06 Dec 2001 12:54:28 -0600 Subject: httplib slow read References: <48cs0u0a88eef5sacpbo12k1qappf9kodp@4ax.com> <2a9e827c.0112060226.16a20a42@posting.google.com> Message-ID: >>>>> "Kjetil" == Kjetil Jacobsen writes: Kjetil> another option may be to use the pycurl module which wraps Kjetil> the curl library: Thanks for the tip. I have installed it and it looks nice. One thing I have not been able to figure out is how to direct pycurl to print the HTTP header it would send were I too invoke 'perform'. Something like import pycurl c = pycurl.init() c.setopt(pycurl.URL, 'http://www.python.org') c.setopt(pycurl.REFERER, 'http://www.yahoo.com) # tried this but it ain't right. print pycurl.HTTPHEADER How can I do this? Aside from the internal __doc__ and the cURL pages and the pycurl/tests files, is there any documentation I should be aware of? Thanks, John Hunter From bbollenbach at home.com Wed Dec 12 22:53:41 2001 From: bbollenbach at home.com (Brad Bollenbach) Date: Thu, 13 Dec 2001 03:53:41 GMT Subject: XXX References: <20011212111644.A5144@jupiter.senux.com> <3dpu5kpj82.fsf@ute.mems-exchange.org> Message-ID: <9DVR7.114165$6b.9404316@news2.calgary.shaw.ca> In article <3dpu5kpj82.fsf at ute.mems-exchange.org>, Andrew Kuchling wrote: > Tim Hammerquist writes: >> "XXX" has also been used to identify an email, particularly in an AOL >> mailbox. ;) > > On the DB-SIG, people often replace the username and password with > 'xxx' when giving sample code. At least one subscriber's domain > unfailingly sends a note to the list admin address informing me that > the message has been held due to possibly obscene content, and it'll > be sent onward after being inspected. ...which leads me to wonder how many killfiles hit this thread :) From breakfast at 10.am Mon Dec 17 17:10:00 2001 From: breakfast at 10.am (mallum) Date: Mon, 17 Dec 2001 22:10:00 +0000 Subject: pyexpat and unicode In-Reply-To: References: Message-ID: <20011217221000.B482@10.am> Nope. This still breaks, with the same error; import xml.parsers.expat parser = xml.parsers.expat.ParserCreate(encoding='utf8') data_uni = u"\202" data_uni.encode('utf8') parser.Parse(data_uni) Is this a Bug ? -- mallum on Mon, Dec 17, 2001 at 07:10:22PM +0000, python-list-admin at python.org wrote: > mallum wrote: > ... > > data_uni = u"\202" > > data = "there" > > > > data_uni.encode('utf8') > > > > parser.Parse(data) > > parser.Parse(data_uni) > ... > > Does this mean Im unable to pass utf8 encoded strings to pyexpat ? > > According to the docs it should. Can anyone spread some light on this. > > You can't, I believe, pass SOME strings with a certain encoding followed in > the same parse by others with different encodings; or, as in this case, > ones not in fact encoded (remember the call to .encode returns an encoded > string, which you ignore -- it doesn't change data_uni, of course, as it's > immutable, like all strings). > > Separate parses work fine: > > import xml.parsers.expat > parser = xml.parsers.expat.ParserCreate(encoding='utf8') > > data_uni = u"\202" > data = "there" > > denc = data_uni.encode('utf8') > > for thedata in data_uni, data, denc: > parser = xml.parsers.expat.ParserCreate(encoding='utf8') > print 'parsing', repr(thedata) > parser.Parse(data, 1) > print 'done' > > > Alex > > -- > http://mail.python.org/mailman/listinfo/python-list From philh at comuno.freeserve.co.uk Thu Dec 27 15:44:55 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Thu, 27 Dec 2001 20:44:55 +0000 Subject: A new forum is up! References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B5E9F.FF1C2CC@bellatlantic.net> Message-ID: On Thu, 27 Dec 2001 12:14:19 -0600, DeepBleu wrote: > >> Andrew Nguyen wrote: >> > >> > A new forum for Python is up. It has a better feel to it than this >> > forum (in my opinion) > >It depends on how you view this 'forum.' As far as I am concerned, >**nothing** beats NNTP newsgroups viewed in a dedicated NNTP viewer. Ditto -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From zhangsc at neusoft.com Wed Dec 19 22:49:26 2001 From: zhangsc at neusoft.com (=?gb2312?B?1cXJ2bPb?=) Date: Thu, 20 Dec 2001 11:49:26 +0800 Subject: module question Message-ID: <017e01c18909$523f84d0$4301010a@sky> I have a question about a module's attribute and method.How can I know which attribute and method a method has? For example,the module os has attribute 'WNOHANG' and method os.wait() . My next question is os module may use waitpid method,as like os.waitpid(ret,os.WNOHANG),How can I know the relevant value of os.WNOHANG . If I use os.waitpid(ret,0),I want to know what this 0 relevantly refers? (I really don't know what this 0 refers to? ,please tell me) Any idea will be appreciated. Regards, Edward -------------- next part -------------- An HTML attachment was scrubbed... URL: From donn at drizzle.com Wed Dec 19 00:36:59 2001 From: donn at drizzle.com (Donn Cave) Date: Wed, 19 Dec 2001 05:36:59 -0000 Subject: I used os.waitpid,but I still can't Zombie process? References: Message-ID: <1008740219.338089@yabetcha.sttl.drizzle.com> Quoth =?gb2312?B?1cXJ2bPb?= : | I still want to kill Zombie process which cause by child process,so I use os.waitpid,But I found Zombie is still exist,why? my program is follows: | ... | while 1: | ... | ret=os.fork() | if ret==0: | HOST=udpaddr | PORT=21567 | ADDR=(HOST,PORT) | udpSerSock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) | udpSerSock.sendto(data,ADDR) | udpSerSock.close() | break | os.waitpid(ret,os.WNOHANG); | | Where is my program's error? How to correct my program? Any idea will be appreciated. | Edward WNOHANG means "return right away" - whether before or after receiving the process' status. Replace it with 0, if you want to wait for the process and end its zombie unlife. Donn Cave, donn at drizzle.com From cliechti at gmx.net Sat Dec 29 15:49:03 2001 From: cliechti at gmx.net (Chris Liechti) Date: 29 Dec 2001 21:49:03 +0100 Subject: values of sys.platform? for a serial port lib Message-ID: i've written a portable serial port library. it runs now on linux and win32 (using marks win32all) but i would like to make it compatible with more unix like platforms. basicaly it should run on any POSIX compilant system. i'm interested in values for "sys.platform" and, if possible, the name of the serial port (an how the ports are numbered ttyS0, ttyS1 etc.) e.g "linux2" and "/dev/ttyS%d" % port, numbering starting at zero. the library is open source and optimized for binary communication including access to the control lines. i'll post a link just after i have added the new platforms and a licence statement. thanks. chris -- Chris From mwh at python.net Mon Dec 3 06:12:23 2001 From: mwh at python.net (Michael Hudson) Date: Mon, 3 Dec 2001 11:12:23 GMT Subject: Quick GC question References: Message-ID: forgottengentleman_spam at yahoo.com (forgotten gentleman) writes: > Hi, I understand Python uses a reference counting GC, and an optional > LISP-like one which takes care of circular refs. FWIW, I doubt there's a Lisp implementation in existence with a gc much like Python's. > Am I guaranteed that the optional GC will be enabled by default, or > should I get into the habit of typing gc.enable() just in case? I don't think you'll be able to import gc if it's not enabled in the build, and if it's enabled in the build, it will be running by default. So I don't think there's any need to litter your code with gc.enable()s. Cheers, M. -- 8. A programming language is low level when its programs require attention to the irrelevant. -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html From sholden at holdenweb.com Mon Dec 24 18:35:22 2001 From: sholden at holdenweb.com (Steve Holden) Date: Mon, 24 Dec 2001 18:35:22 -0500 Subject: [OT] Season's Greetings Message-ID: To all those who celebrate at this time of year, before the desktop goes down for the holidays: Season's Greetings and a Prosperous 2002 regards Steve -- http://www.holdenweb.com/ From mwh at python.net Tue Dec 18 10:23:19 2001 From: mwh at python.net (Michael Hudson) Date: Tue, 18 Dec 2001 15:23:19 GMT Subject: Cygwin socket library status enquiry References: <20011218131502.GA2268@dothill.com> Message-ID: "Steve Holden" writes: > ----- Original Message ----- > From: "Jason Tishler" > To: "Andy Todd" > Cc: "Steve Holden" ; > Sent: Tuesday, December 18, 2001 8:15 AM > Subject: Re: Cygwin socket library status enquiry [snip[ > > Andy brings up a good point -- What platform are you using? 9x/Me > > or NT/2000/XP? You didn't answer this question (hint, hint). Cheers, M. -- /* I'd just like to take this moment to point out that C has all the expressive power of two dixie cups and a string. */ -- Jamie Zawinski from the xkeycaps source From justin at iago.org Sun Dec 9 00:33:49 2001 From: justin at iago.org (Justin Sheehy) Date: Sun, 09 Dec 2001 00:33:49 -0500 Subject: It's hard to find documentation In-Reply-To: <200112081328040980.0156CC2B@mail.rdc1.sdca.home.com> ("Bruce Eckel"'s message of "Sat, 08 Dec 2001 13:28:04 -0800") References: <200112081328040980.0156CC2B@mail.rdc1.sdca.home.com> Message-ID: "Bruce Eckel" writes: > So let's try to find "Extending and Embedding the Python > Interpreter". Using 'search,' using 'advanced search,' nothing > comes up with that title. Maybe it doesn't exist. Who knows. I have > this struggle a lot when hunting for python information. The Python documentation is great and well-organized. On the other hand, the search mechanism on the python.org website is utterly useless. If I start at http://www.python.org/doc/ I can usually find what I'm looking for very quickly... I gave up on the search interface years ago. I try the above doc location first, and Google second. That combination has worked quite well for me. -Justin From robin at stop.spam.alldunn.com Wed Dec 12 15:43:47 2001 From: robin at stop.spam.alldunn.com (Robin Dunn) Date: Wed, 12 Dec 2001 12:43:47 -0800 Subject: wxPython 2.3.2 References: <3C1697FE.1A0A9888@astro.cornell.edu> Message-ID: <8kPR7.1197$4_1.58860@news.randori.com> > > I notice there have been significant developments re: wxWindows for > the Mac. Do you know if there is a Mac build of wxPython that > uses the wxWindows binaries available for the Mac? > Not yet. wxPython for the Mac is still in an experimental state and has some problems. -- Robin Dunn Software Craftsman robin at AllDunn.com Java give you jitters? http://wxPython.org Relax with wxPython! From joel.quinet at be.unisys.com Tue Dec 11 06:31:53 2001 From: joel.quinet at be.unisys.com (Joel Quinet) Date: Tue, 11 Dec 2001 12:31:53 +0100 Subject: How to start a subprocess and obtain its pid under Windows 2K Message-ID: <9v4ndg$94o$1@ih292.ea.unisys.com> Hi all, I need to start a subprocess from a Python script on Windows 2K. Apparently, the is no methode to get the pid. I need it to be able to kill the subprocess before exiting the main program. Thanks. Joel From zhangsc at neusoft.com Tue Dec 4 21:39:54 2001 From: zhangsc at neusoft.com (=?gb2312?B?1cXJ2bPb?=) Date: Wed, 05 Dec 2001 10:39:54 +0800 Subject: dictionary question Message-ID: <016701c17d36$1f55fec0$4301010a@sky> Hello! I have a question about python's dictionary,I have a dictionary type variable, such as dbs={'xk.dhs.org': '166.111.177.77', 'www.symantec.com':'202.112.237.39', 'ftp.happynet.org':'166.111.160.7'} When I input dbs['www.symantec.com']='202.112.237.15',I want to get the result like that: dbs={'xk.dhs.org': '166.111.177.77', 'www.symantec.com':['202.112.237.39','202.112.237.15'],'ftp.happynet.org':'166.111.160.7'} How to realize this function? When I input dbs['www.symantec.com']='202.112.237.39',how to determine if this item has exists in dbs,if item has existed, the result is still like this: dbs={'xk.dhs.org': '166.111.177.77', 'www.symantec.com':['202.112.237.39','202.112.237.15'],'ftp.happynet.org':'166.111.160.7'} if item doesn't exist,then insert new value into dbs,How to realize this function? When I print dbs,I like the result as follows: 'xk.dhs.org': '166.111.177.77' 'www.symantec.com':'202.112.237.39' 'www.symantec.com':'202.112.237.15' 'ftp.happynet.org':'166.111.160.7' How to realize these function? Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From loewis at informatik.hu-berlin.de Wed Dec 26 19:48:03 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 27 Dec 2001 01:48:03 +0100 Subject: references for shifting from Py1.5.2 to Py2.2? References: <3c2a5cd1_2@corp.newsgroups.com> Message-ID: "Joshua Muskovitz" writes: > One thing I *don't* need is a porting guide -- I'm not trying to move *code* > from 1.5.2 to 2.2, just my own understanding of the language for my own > future projects. I recommend to read Andrew Kuchlings "What's new" summaries in sequence (i.e. for 2.0, 2.1, 2.2); you'll find them on the release pages for each release. Reading them should a) not take more than an hour or so, b) should give you a good overview of what's new, and c) allow you to dig deeper into things that are interesting. You'll find that there hasn't changed that much; for some problems, there is now more than one way to do it. If it is the new libraries you are after, you should find the "more important" ones listed in Andrew's summaries as well - you can then go to the library documentation. If that is not detailed enough, search the library documentation for "versionadded" markup. If that is still not detailed enough, read Misc/NEWS. If you merely want to have a book for reference on your desk, please understand that books will be always behind. Finding a book today that has all details on Python 2.2 will turn out impossible, unless you print out the library documentation. HTH, Martin From eddie at holyrood.ed.ac.uk Mon Dec 3 13:14:10 2001 From: eddie at holyrood.ed.ac.uk (Eddie Corns) Date: Mon, 3 Dec 2001 18:14:10 +0000 (UTC) Subject: Finding strings with exceptions References: Message-ID: <9ugfdi$1ln$1@scotsman.ed.ac.uk> David Brady writes: >Hello, ... >What I want to do is find all instances of an >expression EXCEPT those that also match another >expression. The case in point for today was this: I >was called away from my machine in the middle of >refactoring some code. I was renaming a class to >conform to our project's coding standards, and the new >name requires a prefix. I had to think about why this was a problem at all - I think you mean that you've already done some of them hence they will match. >The old class name (changed to protect the innocent) >is BarThingy. The new name is fooBarThingy. Because >the new class name contains the old one, simple >find-and-replace goes wonky. In the reverse case, I >could put something in the regex that says, "also find >an optional prefix 'foo'." But what I really want to >do is find the class everywhere EXCEPT where that >'foo' prefix exists. Anyone know a good way to do >this? The most obvious way is to protect what you've already converted by changing it to something unique, change the remaining ones then convert the protected ones back. For example: sed 's/fooBarThingy/rumplestiltskin/g' file >file sed 's/BarThingy/fooBarThingy/g' file >file sed 's/rumplestiltskin/fooBarThingy/g' file >file [Obviously you don't do 'file >file' directly but I'm assuming you know that bit. I'm also assuming you know unix-speak. ] Eddie From peter at engcorp.com Mon Dec 3 00:09:07 2001 From: peter at engcorp.com (Peter Hansen) Date: Mon, 03 Dec 2001 00:09:07 -0500 Subject: Python evangelists unite! References: <3C07884E.75E18DF7@engcorp.com> <9ue2o2$b344@news1.gtech.com> Message-ID: <3C0B08F3.C9CDE885@engcorp.com> [Top-quoting corrected.] Peter Milliken wrote: > "Peter Hansen" wrote: > > brueckd at tbye.com wrote: > > > Peter Milliken wrote: > > > > I use Python as a good, quick and dirty hacking language. For real (read > > > > production) stuff that I expect a customer to run or will require more than > > > > a single person working for a couple of hours, I look elsewhere :-). Sure > > > > there are examples of Python being used for "large" jobs - and very > > > > successful they have been too - but these people are masochists (IMO) :-). > > > > They could have been more productive with other languages that provide > > > > better support for generic software engineering principles/standards. > > > > > > I am *so* glad that there are people in the world that share your opinion > > > because you hand me a competitive advantage on a silver platter. I don't > > > even have to work for it! Keep up the good work; many, many thanks! > > > > Dave! :-( Sshhhhh! > > > > (Most of the people here are probably not in business themselves. > > You're not supposed to leak the secret out to our competitors!) > > You both prove *my* point - thanks! :-) You're point being what again? That we could have been more productive using some language other than Python, and that we are masochists because we chose to use Python instead? If that's your claim, you're welcome to it, and Dave and I will continue being *much* more productive than we have ever been with other languages, for reasons clearly and directly attributable to the design of Python and the community. Do you really believe Python has poor support for "generic" engineering principles? Maybe you're just using it wrong. I find it supports *all* the useful engineering principles I've ever learned, and then some. Or did you have some other point I missed? -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From rpm1deletethis at frontiernet.net Mon Dec 3 18:44:01 2001 From: rpm1deletethis at frontiernet.net (RPM1) Date: Mon, 3 Dec 2001 18:44:01 -0500 Subject: Problem with pipes (win32pipe) References: Message-ID: I'm no expert but I have been struggling with popen2 a bit myself. I think I've figured out that you can use the os module and the stat module to help figure out when an input pipe has something in it. first: import stat import os then you can see how many bytes are in the pipe by doing this: count = os.ftstat(fin.fileno())[stat.ST_SIZE] using a separate thread to read the data into a buffer when there is something in the pipe might help too. Maybe someone else can give more definitive answers. I've found that I can only open one set of pipes in Windows 9x at a time. If I open multiple sets of pipes the last one that I close hangs. Windows NT doesn't have this problem. Also if the app you're calling is a 16 bit app, you may need to create a dummy C app to create 32 bit standard handles to pass to your app. Search Google for Python and Bill Tutt to find posts about this issue. Sorry I can't help more. I haven't gotten much help myself with popen2 on Windows here. I believe Unix doesn't have any of these issues. Good luck, Patrick p.s. Please post any good info on Windows popen that you get. "Jeremy Gibson" wrote in message news:AE0A765CAD7C795A.6D9D4CCEA6456F4D.5012B73D9CEA4F92 at lp.airnews.net... > I am having a bear of a time trying to get my python program to talk to a > windows process. The program I am trying to run is call nrcmd. It is a > cisco program that is used for administering router clusters. > > Here is what I have done so far(BTW) the kludgey readlines are going to > be replaced with some pattern matching I just wanted to get talking first. > > ***************************************************** > import os, win32pipe > os.chdir('c:\\program files\\network registrar\\bin') > fin, fout = win32pipe.popen2('nrcmd') > c = 0 > while c < 6: > fout.readline() > c = c+1 > fout.read(7) > ***************************************************** > > The output from this is: > ***************************************************** > 100 Ok\n > cluster = nnn.nnn.nnn.nnn\n > default-format = user\n > user-name = user \n > visibility = 5\n > nrcmd> > ***************************************************** > > At this point any fin.write() will be accepted without complaint, but > nothing is happening. If I attpempt to fout.read() again the program > hangs and must be killed. I assume this is happening because I am > attempting to read a null byte. The return from a successfull (or > unsuccessfull) write should fill the fout buffer with something to read. > > I am sending newlines in the fin.writes I've tried and I've even tried > sending \r\n since this is a windows machine I'm working with. I've also > tried fin.flush() after a write. > > If anyone has any ideas or thoughts on where I might find illumination > for this problem please write to my email, or post to the group. > > Thanks, > Jeremy Gibson From mhammond at skippinet.com.au Sat Dec 22 01:38:49 2001 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 22 Dec 2001 06:38:49 GMT Subject: Fate of win32all? References: <7876a8ea.0112212116.2ebabc23@posting.google.com> Message-ID: <3C242A7F.2060805@skippinet.com.au> stalin wrote: > I've used win32all occasionally--always in noncommercial settings--and > have found it helpful. I'd like to thank Mr. Hammond for developing > the packages My pleasure. > and ActiveState for supporting their recent maintenance > by employing Hammond. Unfortunately, I am no longer employed by ActiveState :( > Mr. Hammond had personally developed the win32 packages to > considerable maturity before he became involved with ActiveState. His > employment by ActiveState appears to have come to an untimely end just > recently ( http://mail.python.org/pipermail/python-dev/2001-December/019038.html > ). I don't mean to be insensitive--I'm sure Hammond has a lot on his > mind right now--but I wonder about the fate of win32all. What role > does ActiveState now play in licensing the package? Has the original > author lost a degree of his control over it to his former employer? Nope. The win32all license remains unchanged. See the license.txt files in the distribution. Basically *anyone* is free to do whatever they choose with the package, including building their own distribution. ActiveState have no special rights over this at all. Specifically, I fully intend releasing new win32all packages. ActiveState did have me working very hard on Komodo, but no longer ;) I am leaving for a Christmas break, but intend getting a win32all out by the new year - if not, just a few days after. Mark. From rcena at epcor.ca Fri Dec 28 23:52:51 2001 From: rcena at epcor.ca (Resty Cena) Date: 28 Dec 2001 20:52:51 -0800 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <458b194a.0112282052.1123341@posting.google.com> The real source of growth for both Python and Ruby are the 3M VB developers worldwide. Whichever can provide what it is that VB developers like about VB on top of what Python and Ruby natively offer will hit the jackpot. To me these are: (a) Visual drag-and-drop application builder with data aware controls, and (b) good support for the big databases (Oracle, Sybase, Informix). I'm going through the gui chapters of Mark Lutz' PP2E, and while I can see that handcrafting gui this way gives me a lot of control, I'm thinking I don't want to do this -- I'm a database application developer. I want to write a dynamic work order system and I have no ambition to become a system tool maker. And so do the 3M VB developers. VB used to be a toy language. Not too long ago no respectable company would use VB for their corporate systems. It did not start to become an enterprise solution until VB3. What happened there? VB 6 will be retired in favor of VB.NET. Personally I think that the direction VB has taken, towards a verbose C#, is misguided. VB should have evolved into something like Python or Ruby. With VB.NET, VB programmers will ask, "What's the point?" Might as well dive into C#. Or look around for something else. Hopefully by that time -- 18 months from now? -- Python and/or Ruby will have what it is VB programmers cannot live without. Folks, come up with (a) and (b) above, then start posting at c.l.vb. Paul Prescod wrote in message news:... > Dave Thomas wrote: > > > > ... Instead, Ruby will attract folks from outside the > > Python world. Ruby and Python differ in philosophy and _feel_. Some > > folks like one, some the other. I don't see it as competition. I see > > it as choice. > > Is there really a difference? Pepsi and Coke are choices. They are also > in competition. They have a somewhat different taste but are more > similar than different. In the long run, there will come a day when > they've taken as much of the market share of other drinks away as they > will, and the primary competition will be between the two of them. > > Paul Prescod From grante at visi.com Wed Dec 19 17:58:23 2001 From: grante at visi.com (Grant Edwards) Date: Wed, 19 Dec 2001 22:58:23 GMT Subject: Why is Complex number notation the way it is? References: <23302360.0112142245.59089e4f@posting.google.com> <3C21173A.8E02D0A0@cosc.canterbury.ac.nz> Message-ID: In article <3C21173A.8E02D0A0 at cosc.canterbury.ac.nz>, Greg Ewing wrote: > Josh Yotty wrote: >> >> I've been coding Python for about a day now, and I can't 'see' why a >> complex number like 2+3i is represented as 2+3j in Python. > > Guido was apparently thinking like an engineer at the > time. Electronic engineers use j instead of i to avoid > confusion with current. And I'm sure it's almost as obvious why "i" is used for current. :) I was told it was because "c" was already taken for capacitance, but I still don't know why "i" was chosen over some other as-yet-unused letter. But, we use notation where current flows from "+" to "-" so don't try to confuse us with facts! -- Grant Edwards grante Yow! I love ROCK 'N at ROLL! I memorized the visi.com all WORDS to "WIPE-OUT" in1965!! From LLoeffler at home.com Tue Dec 4 18:38:59 2001 From: LLoeffler at home.com (Luke) Date: Tue, 04 Dec 2001 17:38:59 -0600 Subject: german documentation References: <9ujjvp$918ch$1@ID-19768.news.dfncis.de> Message-ID: <3C0D5E93.6030604@home.com> Frank Lohfelt wrote: > Hello, i'm search the Python documentation translatet to german to download > and read offline or other Books and guids in german for free download. > > thx Frank, Try these sites. http://www.python.org/doc/NonEnglish.html#german Tschuess From jason at jorendorff.com Tue Dec 11 01:41:15 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Tue, 11 Dec 2001 00:41:15 -0600 Subject: Q: PyObject* to toplevel module In-Reply-To: Message-ID: From: Arno Puder > how do I get a pointer to the PyObject instance representing the > toplevel module? PyObject *main = PyImport_ImportModule("__main__"); In Python, you can "import __main__" or look in sys.modules['__main__']. -- Jason Orendorff http://www.jorendorff.com/ From aleax at aleax.it Fri Dec 28 10:02:44 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 16:02:44 +0100 Subject: REPOST: Re: COM Registration Attributes References: <3C105C56.7080909@ActiveState.com> <5edaf477.0112141237.3f1471b2@posting.google.com> <5edaf477.0112280645.246f7229@posting.google.com> Message-ID: <4$--$$_----_---$_$@news.noc.cabal.int> "Bill Bell" wrote in message news:5edaf477.0112280645.246f7229 at posting.google.com... > I have been wondering again about the best way of handling a > collection of Windows registry key additions, deletions or changes as > part of registering a Python COM server. ... > 4. Wrap atl.dll and make it part of the standard Windows distribution. ... > changes the specs for .rgs scripts. (Mind you, isn't this stuff meant > to become less of an issue?) Option 4 looks nicest to me. Maybe not to Microsoft's legal department, though. It would be at least wise to check with them rather than assuming they'd be glad to see some of their "redistributables" redistributed this way (i.e., as a part of a development environment). > What do others think? Wrapping _winreg (or the win32all equivalent thereof) seems the most clever option to me. Such a wrapper might be part of some Python distribution (or more sensibly of win32all). Alex ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Alex Martelli" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:35:33 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775342 27193 211.57.49.2 (31 Dec 2001 05:09:02 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:09:02 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jason at tishler.net Fri Dec 7 10:35:24 2001 From: jason at tishler.net (Jason Tishler) Date: Fri, 7 Dec 2001 10:35:24 -0500 Subject: Fwd: Re: dll_list::load_after_fork() blues (was Re: [ python-Bugs-489709 ] Building Fails ...) In-Reply-To: Message-ID: <20011207103524.C1592@dothill.com> Michael, On Fri, Dec 07, 2001 at 03:12:48PM +0000, Michael Hudson wrote: > Michael Hudson writes: > > Your patch helps by the way. I tried building without threads -- that > > didn't. > > OTOH, some tests crash: > > 3 tests failed: > test_popen2 test_pty test_socket I know, I know. In fact, the following demonstrates the problem: $ cat test2.py import os import _socket pid = os.fork() $ ./python test2.py C:\home\jtishler\src\PythonCvs\nothreads\python.exe: *** unable to remap C:\cygwin\bin\cygssl.dll to same address as parent -- 0x1A2F0000 0 [main] python 852 sync_with_child: child 2772(0x158) died before initialization with status code 0x1 996 [main] python 852 sync_with_child: *** child state child loading dlls Traceback (most recent call last): File "test2.py", line 4, in ? pid = os.fork() OSError: [Errno 11] Resource temporarily unavailable I guess that commenting out "import _socket" is not an acceptable solution... :,) Jason From jeff at ccvcorp.com Wed Dec 5 15:57:18 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Wed, 05 Dec 2001 12:57:18 -0800 Subject: Tuples -> Function Params? References: <3C0CA191.A9293E69@home.com> Message-ID: <3C0E8A2E.90FBFFC2@ccvcorp.com> Don O'Donnell wrote: > I can't find it in the docs now either. > But I know it's a fairly recent addition. > 2.1 perhaps? Works for me in 2.0, I think that's when it was introduced... Jeff Shannon Technician/Programmer Credit International From phr-n2001d at nightsong.com Thu Dec 20 03:09:31 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 20 Dec 2001 00:09:31 -0800 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> <7x1yhqbefg.fsf@ruckus.brouhaha.com> <9vs0e0$jtm$1@peabody.colorado.edu> Message-ID: <7xr8pq9utg.fsf@ruckus.brouhaha.com> Fernando P?rez writes: > Well, considering that Python 2.0 was out in October 2000, the > 'tight deadline' excuse doesn't fly too well, as far as I'm > concerned. As I said above, I have yet to see a good justification > for this mess. If there is one, Do you mean the Redhat configuration hassles, or the underlying mess of the incompatibility between the two "mature" Python versions? From andy47 at halfcooked.com Tue Dec 4 21:15:17 2001 From: andy47 at halfcooked.com (Andy Todd) Date: 5 Dec 2001 02:15:17 GMT Subject: Difference between 'import' and 'from ... import' References: Message-ID: "Patrick K. O'Brien" wrote in : >As far as I know, the only thing that could have created an __init__.py >file is you. Doing a "from ... import" wouldn't. Just FYI. >Perhaps you copied one over? Or got it some other way? Frankly, I'm not >sure why there *isn't* one by default. Woops, looks like I was getting my wucking fords muddled again, and suffering from keyboard confuse to boot. What I *meant* to say was that I must have created an __init__.py so that I could use 'from ... import'. I will proof read before I post, I will proof read before I post .. > >You're very welcome. > No, thank you. >-- >Patrick K. O'Brien >Orbtech.com - Your Source For Python Development Services > > >"Andy Todd" wrote in message >news:Xns916D6079FB498andytoddspamfreeyaho at 203.109.250.24... > >[snip] > Retiring-in-silence-ly yr's, Andy -- Content free posts a speciality From breakfast at 10.am Mon Dec 17 11:17:00 2001 From: breakfast at 10.am (mallum) Date: Mon, 17 Dec 2001 16:17:00 +0000 Subject: pyexpat and unicode Message-ID: <20011217161700.B828@10.am> Hi all; I may be doing something stupid here and missing the obvious, but if I run the following; ...snip... import xml.parsers.expat parser = xml.parsers.expat.ParserCreate(encoding='utf8') data_uni = u"\202" data = "there" data_uni.encode('utf8') parser.Parse(data) parser.Parse(data_uni) ...... expat barfs with ; Traceback (most recent call last): File "./testuni.py", line 12, in ? parser.Parse(data_uni) UnicodeError: ASCII encoding error: ordinal not in range(128) Does this mean Im unable to pass utf8 encoded strings to pyexpat ? According to the docs it should. Can anyone spread some light on this. -- mallum From stephen at theboulets.net Sun Dec 9 23:20:28 2001 From: stephen at theboulets.net (Stephen Boulet) Date: Sun, 09 Dec 2001 22:20:28 -0600 Subject: pickle question References: <9unov6$c4on9$1@hades.rz.uni-sb.de> <9uo5v7$c2a5i$1@hades.rz.uni-sb.de> Message-ID: Here's some sample code: from cPickle import dump f = open('myFile.pickle, 'wb') dump(sParams, f, 1) f.close() Note the 1 option in the dump command. Also, you'll want the 'rb' option for reading the file before you use pickle's load function. -- Stephen Uwe Schmitt wrote: > Oleg Broytmann wrote: > | On Thu, Dec 06, 2001 at 12:40:06PM +0000, Uwe Schmitt wrote: > |> I pickled some data on my local unix machine. When I try > |> to read this data on a windows machine, nothing is pickled > |> at all. > > | Did you open the pickled file in binary mode? > > No. should I ? > > Yours, Uwe > From achim.domma at syynx.de Fri Dec 28 10:32:55 2001 From: achim.domma at syynx.de (Achim Domma) Date: Fri, 28 Dec 2001 16:32:55 +0100 Subject: mod_python and threads Message-ID: Hi, I'm playing around with mod_python and I like it, but I don't understand how it handles multiple threads. I think apache holds a pool of threads to handle request, so what happens if mod_python uses only one subinterpreter per virtual server ? Are request handled in a serial way or do I have to write threadsafe code ? could somebody enlighten my please ? greetings Achim From david_j_dawkins at spamless.hotmail.com Thu Dec 13 06:20:52 2001 From: david_j_dawkins at spamless.hotmail.com (David Dawkins) Date: Thu, 13 Dec 2001 11:20:52 -0000 Subject: Calling member functions? Message-ID: Hi, I can't quite get this right. How can I give an object instance and a method as a callback for some other module/class to call at a later point? class Handler: def Callback(self): print "Callback called" class Notifier: def __init__(self, object, method): self.m_object = object self.m_method = method def notify(self): ## Now what?? self.m_method(self.m_object) ## naive attempt h = Handler() n = Notifier( h, h.Callback ) h.notify() # I want this to do h.Callback() in effect Thanks David Dawkins -- david_j_dawkins x/AT/x hotmail.com From brian at rk-speed-rugby.dk Wed Dec 5 02:16:43 2001 From: brian at rk-speed-rugby.dk (Brian Elmegaard) Date: 05 Dec 2001 08:16:43 +0100 Subject: Printing from Windows References: <9ui1ki$lfv$1@news.netpower.no> Message-ID: "David Brown" writes: > It doesn't look like there is much hope for using Tkinter for printing, so > I'm generalising my original question. How far can one get with the postscript method of the canvas? -- Brian (remove the sport for mail) http://www.rk-speed.dk http://fiduso.dk http://sunsite.auc.dk/dk-tug \TeX, tak. From usenet at NOSPAM-irmen.cjb.net Tue Dec 11 15:52:27 2001 From: usenet at NOSPAM-irmen.cjb.net (Irmen de Jong) Date: Tue, 11 Dec 2001 21:52:27 +0100 Subject: os.mkdir() errno inconsistency on Windows? Message-ID: <9v5rmb$36u$1@news1.xs4all.nl> Hi; On windows (2000), Python 2.1: Why does os.mkdir() return a different errno when trying to create an already-existing directory, or trying to create the drive root directory? See below: >>> os.mkdir('d:\\test') >>> os.mkdir('d:\\test') Traceback (most recent call last): File "", line 1, in ? OSError: [Errno 17] File exists: 'd:\\test' >>> os.mkdir('d:\\') Traceback (most recent call last): File "", line 1, in ? OSError: [Errno 13] Permission denied: 'd:\\' >>> Thanks, Irmen de Jong. PS Why bother? Because I need to distinguish on exact Errno type, not only on the OSError that's raised. From chrishbarker at attbi.com Thu Dec 27 14:40:58 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Thu, 27 Dec 2001 11:40:58 -0800 Subject: REPOST: Re: set decimal place References: <3c291037.4684696@news.tm.net.my> <3C292938.ED322C60@bellatlantic.net> <184fbd02.0112260109.4392423@posting.google.com> <3C2A29A5.8E9FB5BE@engcorp.com> Message-ID: <5$--$$_----_-$-%_$@news.noc.cabal.int> Peter Hansen wrote: > >>> 10.0/3 > 3.3333333333333335 > >>> round(10.0/3, 4) > 3.3332999999999999 > ^^^^^^^ > This doesn't really solve the OP's problem. > The concept of "having 4 decimal places" is meaningless with > floating point representations until you actually display the > value as a formatted string. not completely. you might want to check if two values are the same to 4 decimal places, in which case round should work just fine: >>> 10.0/3 == 10.00001/3 0 >>> round(10.0/3,4) == round(10.00001/3,4) 1 of course, you would more often want to compare given n significatn figures instaead, in whioch case you can write a function with log, etc that will do it for you. See the archives for a discussion of this, and some posted code. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Chris Barker Newsgroups: comp.lang.python Subject: cmsg cancel <3C2B794A.800A94E5 at attbi.com> Control: cancel <3C2B794A.800A94E5 at attbi.com> Date: Mon, 31 Dec 2001 03:16:36 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775626 27193 211.57.49.2 (31 Dec 2001 05:13:46 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:13:46 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From Bruce at EckelObjects.com Sun Dec 9 23:02:09 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Sun, 09 Dec 2001 20:02:09 -0800 Subject: Populating a list In-Reply-To: References: Message-ID: <200112092002090420.02DCB96E@mail.rdc1.sdca.home.com> I would probably do it like this: lines = [l.rstrip() for l in open('filename')] In Python 2.2 you don't have to say "readlines", as open() produces an iterator. Using rstrip(), I believe, handles more general cases (some oses have two characters to end a line, rather than just one). *********** REPLY SEPARATOR *********** On 12/9/01 at 8:01 PM A. Keyton Weissinger wrote: >So we're clear. You can either do it this way: > >states = [] >f=open('/home/mlorfeld/states.txt', 'r+').readlines() >for i in f: > states.append(i.rstrip()) >print states > >The rstrip() method, as you can probably guess, strips white spaces from >the >RIGHT end of the string. > >or (from Mr. Martelli -- I like this one better): > >f = open('/home/mlorfeld/states.txt', 'r+') >states = [ line[:-1] for line in f.readlines() ] >f.close() > >Sorry for the misinformation, folks. > >Keyton > > >-- >http://mail.python.org/mailman/listinfo/python-list Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From LLoeffler at home.com Sun Dec 2 18:28:45 2001 From: LLoeffler at home.com (Luke) Date: Sun, 02 Dec 2001 17:28:45 -0600 Subject: Very new to this References: <#k0oOh4eBHA.1192@cpimsnntpa03> <#EQGkj4eBHA.1188@cpimsnntpa03> Message-ID: <3C0AB92D.2010407@home.com> import time time.sleep(x) where x is in seconds. Can be a float or int. From GeorgLohrer at gmx.de Thu Dec 27 05:23:52 2001 From: GeorgLohrer at gmx.de (Georg Lohrer) Date: Thu, 27 Dec 2001 11:23:52 +0100 Subject: REPOST: Re: Problems with tkinter in python 2.2 References: <19eb8d3d.0112261056.2227760e@posting.google.com> Message-ID: <0$--$$-$$$$%__%--$@news.noc.cabal.int> On 26 Dec 2001 10:56:09 -0800, kmilo0 at hotmail.com (Kmilo) wrote: [snipped] >Somebody know what i have to do for run, tkinter.py? I got this error as I've built Python from source and forgotten to uncomment the lines below (already uncommented in this sample): # The _tkinter module. # # The command for _tkinter is long and site specific. Please # uncomment and/or edit those parts as indicated. If you don't have a # specific extension (e.g. Tix or BLT), leave the corresponding line # commented out. (Leave the trailing backslashes in! If you # experience strange errors, you may want to join all uncommented # lines and remove the backslashes -- the backslash interpretation is # done by the shell's "read" command and it may not be implemented on # every system. # *** Always uncomment this (leave the leading underscore in!): _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \ # *** Uncomment and edit to reflect where your Tcl/Tk libraries are: -L/usr/lib \ # *** Uncomment and edit to reflect where your Tcl/Tk headers are: -I/usr/include \ # *** Uncomment and edit to reflect where your X11 header files are: -I/usr/X11R6/include \ etc. So, your rpm's seems to have been built without tkinter support. There might be probably another rpm with activated tkinter. Another fault could be, that your LD_LIBRARY_PATH does not point to all necessary lib-paths or PYTHONPATH was not set accordingly. Ciao, Georg ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Georg Lohrer Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:14:54 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775824 27193 211.57.49.2 (31 Dec 2001 05:17:04 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:17:04 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From sholden at holdenweb.com Fri Dec 14 08:13:50 2001 From: sholden at holdenweb.com (Steve Holden) Date: Fri, 14 Dec 2001 08:13:50 -0500 Subject: socket question References: Message-ID: "???" wrote ... > I encountered a question,when I deal with UDP socket connection,my programs existed.I have two programs,one is server.py,another is client.py ,I run them in two computers,server.py is at 10.1.1.27,client is at 10.1.1.67 ,my programs are follows: > > server.py #It works at IP address of 10.1.1.27 > > .... > #I get udpaddr from IP header of 32bit source ip address, > #and I get udpdata[0] from UDP header of 16bit source port number. > addr=udpaddr,udpdata[0] > print type(addr) > print addr > #for some program design reason,I can't use data,addr=udpSerSock.recvfrom(BUFSIZ) to get addr > udpSerSock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) > udpSerSock.sendto(data,addr) > udpSerSock.close() > > client.py #It works at IP address of 10.1.1.67 > > from socket import * > import string > HOST='10.1.1.27' > PORT=21567 > BUFSIZ=1024 > ADDR=(HOST,PORT) > udpCliSock=socket(AF_INET,SOCK_DGRAM) > data=raw_input('>') > udpCliSock.sendto(data,ADDR) > print udpCliSock.getsockname() > data, addr = udpCliSock.recvfrom(BUFSIZ) > if data: > print data > udpCliSock.close() > > First,I run server.py at 10.1.1.27 > $python server.py > > Then I run client.py at 10.1.1.67 > $python client.py > >hello > > The running result of server.py: > > ('10.1.1.67', 1165) > $ > > The running result of client.py,it raise a error: > ('0.0.0.0', 1165) > Traceback (most recent call last): > File "client.py", line 11, in ? > data, addr = udpCliSock.recvfrom(BUFSIZ) > socket.error: (104, 'Connection reset by peer') > > I know that my server.py don't use normal way to return data to client.py ,but I need this way! How to correct my programs? Any ideas will be appreciated! The server should call udpSerSock.bind( ('10.1.1.27', 21567) ) before it issues the recvfrom() call - otherwise, how is the server's UDP layer to know which interface and address to listen on? regards Steve -- http://www.holdenweb.com/ From andreas at mtg.co.at Sat Dec 1 05:35:43 2001 From: andreas at mtg.co.at (Andreas Kostyrka) Date: Sat, 1 Dec 2001 11:35:43 +0100 Subject: Python 2.2: socket.ssl documentation? In-Reply-To: <20011130191622.GA483@lilith.hqd-internal> References: <200111291746.fATHkeY24178@lap1.mtg.at> <20011130191622.GA483@lilith.hqd-internal> Message-ID: <200112011035.fB1AZon01743@lap1.mtg.at> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am Freitag, 30. November 2001 20:16 schrieb Gerhard H?ring: > On Thu, Nov 29, 2001 at 11:09:08PM -0500, Justin Sheehy wrote: > > Andreas Kostyrka writes: > > > Is there any documentation about the ssl support in the socket module? > > > > Yes. > > > > > If so where? > > > > http://python.sourceforge.net/devel-docs/lib/module-socket.html > > http://python.sourceforge.net/devel-docs/lib/ssl-objects.html > > > > > Does it support writing servers? > > > > Sadly, no. > > But several third-party libraries can be used to write SSL servers in > Python. Links and a short overview of them: > htt?://www.cs.fhm.e?u/?ifw00065/??ssl/ What was that URL? www.cs.fhm.eu doesn't seem to exist. :( - -- Andreas Kostyrka; Raiffeisenstr. 16/9; 2320 Zw?lfaxing Tel: +43/676/4091256; Fax: +43/1/7065299 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8CLKEHJdudm4KnO0RAnNlAJ4ljfX4GRBUxSp/9KqAICRAZx9MUQCfcxvk i/H3po51t3916HHjj7wZZD4= =SE4I -----END PGP SIGNATURE----- From justin at iago.org Sat Dec 15 15:16:11 2001 From: justin at iago.org (Justin Sheehy) Date: Sat, 15 Dec 2001 15:16:11 -0500 Subject: Recursive update of arbitrarily nested dicts In-Reply-To: <3C1B9E80.FB732387@accessforall.nl> (Ype Kingma's message of "Sat, 15 Dec 2001 20:03:34 +0100") References: <3C1B9E80.FB732387@accessforall.nl> Message-ID: Ype Kingma writes: > Compilers can do nice things to simplify tail recursion to a loop. > (I wonder whether there is such a compiler for python already.) Neither of the two major implementations (CPython, Jython) performs tail call elimination. As much as I would love to have such optimizations available to me in Python, it does not often end up mattering in practice. (With Python, that is. Tail call elimination matters much more when using languages where the predominant programming style is closer to being purely functional.) It is generally not hard to take a tail-recursive function and rewrite it by hand into an iterative one, performing this optimization at the programmer instead of the compiler in the few cases where it really matters. -Justin From anton at appsolutions.com Sun Dec 23 11:57:55 2001 From: anton at appsolutions.com (Anton van Straaten) Date: Sun, 23 Dec 2001 16:57:55 GMT Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic References: <1009122972.599277@haldjas.folklore.ee> Message-ID: Sander Vesik wrote: >It would have been nice of you to actualy refute his claims, and not just >namecall. Except that the troll's claims are self-fulfilling. By posting an essentially content-free rant under a pseudonym, he generated some annoyed responses. He then used that as "evidence" in his argument: >Anyone calling for injection of fresh ideas into the language is >attacked with a level of spite and religious vehemence rarely seen >outside of fundamentalist religious sects. The problem with this is, had this person posted a reasoned message about the issues in question, it's quite unlikely that the same kind of response would have been generated. Besides, if the troll is claiming that he's afraid to post under his real name because of the response it would generate, is it because he's afraid of a few flames? Or is he simply unwilling to tarnish his reputation, which would certainly suffer if he posted messages like that first one, which was an amateurish call-to-arms based on a faulty premise. I support the idea of some movement in the standards area myself, but that isn't the troll's motivation, you can be sure - or if it is, he has a very strange way of going about it. Anton From rachmat at bcl-computers.com Tue Dec 4 15:10:29 2001 From: rachmat at bcl-computers.com (Rachmat Hartono) Date: Tue, 04 Dec 2001 20:10:29 GMT Subject: Packaging Python into COM object? Message-ID: Hi, I'm just starting to use Python for our project and I have questions.. Is it possible to package all python code into one COM DLL (Windows)? If this is possible, that means I don't have to put Python distribution (2.1.1 or 2.2) in my installation package once I'm ready to ship the product right? What modules needs to be distributed though? Can anyone give me a pointer of how I can do this? Thanks. From forgottengentleman_spam at yahoo.com Sun Dec 2 16:15:39 2001 From: forgottengentleman_spam at yahoo.com (forgotten gentleman) Date: 2 Dec 2001 13:15:39 -0800 Subject: Quick GC question Message-ID: Hi, I understand Python uses a reference counting GC, and an optional LISP-like one which takes care of circular refs. Am I guaranteed that the optional GC will be enabled by default, or should I get into the habit of typing gc.enable() just in case? Thanks. From m.bless at gmx.de Thu Dec 13 17:11:41 2001 From: m.bless at gmx.de (Martin Bless) Date: Thu, 13 Dec 2001 22:11:41 GMT Subject: reading 6-byte ("real48") Borland Pascal Floating Point numbers Message-ID: <3c19262e.1671423@news.muenster.de> I have to convert those "good (?) old" 6-byte, "real48" floating point numbers used in Borland's Pascal to nowadays "normal" floating points. Has is already been done? Martin From stuart at bmsi.com Tue Dec 18 16:03:39 2001 From: stuart at bmsi.com (Stuart D. Gathman) Date: Tue, 18 Dec 2001 16:03:39 -0500 Subject: Python as RedHat/SysV service Message-ID: <9voavb$rpj$1@nntp2-cm.news.eni.net> I have a system service written in python. On RedHat systems, this service is conveniently installed and started by placing a script in /etc/rc.d/init.d to start,stop,reload, etc the service. The standard methods for checking whether a service is running or sending it a signal rely on the process name: e.g. 'inetd'. In this case, the process name is always 'python2'. Is there a way to change the process name of a running python program? Or is it better to craft a new version of 'pidof' that works for python processes? Has anyone dealt with this before? -- Stuart D. Gathman Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154 "Confutatis maledictis, flamis acribus addictis" - Mozart background song for the Microsoft "Where do you want to go from here?" commercial. From LLoeffler at home.com Mon Dec 3 13:06:41 2001 From: LLoeffler at home.com (Luke) Date: Mon, 03 Dec 2001 12:06:41 -0600 Subject: Regular expression as dictionary key? References: <3C0B2DE9.5040308@home.com> <9ugdnp$8fe$1@slb0.atl.mindspring.net> Message-ID: <3C0BBF31.3000105@home.com> > I suspect though that you really just want a way to use a > regular expression as a key, and created this singular/plural > example as justification. Yes and no. This is one of many possible applications. The plural search is a naive example, but for this application doesn't need to be excat either since the results are fuzzy anyway. I suppose plodding through 10,000 or so keys won't slow things down horribly. I'll come up with a tree or build some caching scheme if things get too bad. I've got some C to read now. L From phr-n2001d at nightsong.com Fri Dec 14 00:12:10 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 13 Dec 2001 21:12:10 -0800 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <1008303437.718558@cswreg.cos.agilent.com> <9vbvi5$cm0$1@peabody.colorado.edu> Message-ID: <7xhequjsgl.fsf@ruckus.brouhaha.com> Fernando P?rez writes: > For some bizarre reason, redhat 7.2 includes two versions of pyhton with 1.5 > being the default. The reason may be that some of the red hat configuration scripts were written under python 1.5, and 2.1 broke backwards compatibility. In particular the "rand" module was renamed "random" and maybe changed. From mlh at idi.ntnu.no Tue Dec 11 12:56:59 2001 From: mlh at idi.ntnu.no (Magnus Lie Hetland) Date: Tue, 11 Dec 2001 18:56:59 +0100 Subject: A common GUI define like rebol VID? References: <9v12k6$ak9$1@mail.cn99.com> Message-ID: <9v5hdb$bsv$1@tyfon.itea.ntnu.no> "Oleg Broytmann" wrote in message news:mailman.1007975174.26122.python-list at python.org... > On Mon, Dec 10, 2001 at 09:21:55AM +0800, luckey wrote: > > I don't understand why not python define a common GUI like REBOL VID ? > > Because Python is The Real Programming Language, not a small GUI toy. > How do you think to implemet that comman GUI on a Palm? Amiga? DOS? (Python > works on many, many different platforms, not only on XWindows and that > broken M$ Ophis GUI). I know you've already mentioned Anygui -- I'd just like to poit out that Anygui will hopefully work on all these platforms. (Yes, *including* DOS... We already have beginning implementations of textgui and cursesgui in CVS :) We don't currently have a Palm-specific backend, but have been talking about a Qt backend for embedded linux. I'm sure we'll get something for Pippin (Palm Python) eventually as well. > Oleg. > -- > Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru > Programmers don't die, they just GOSUB without RETURN. -- Magnus Lie Hetland The Anygui Project http://hetland.org http://anygui.sf.net From martin.franklin at westgeo.com Tue Dec 4 10:14:47 2001 From: martin.franklin at westgeo.com (Martin Franklin) Date: Tue, 4 Dec 2001 15:14:47 +0000 Subject: Using *just* the IDLE editor References: <3C0C4FE1.5B218CE0@st-annes.oxford.ac.uk> Message-ID: <9uip84$hj0$1@mail1.wg.waii.com> Michael Williams wrote: > Hi, > > I'd like to set up (or strip out components or rewrite, but hopefully > it won't be that complex) IDLE so that when I start it up with > > $ idle > > I just get the IDLE editor and not the interactive shell. (I need to > avoid starting the shell for uninteresting reasons). The -e option > allows the opening of the editor window, but doesn't prevent opening > of the interactive shell. I'm afraid I don't have enough experience of > Python (esp Tk) to go through the code and work out what's being done > by idle.py so I would be very grateful if someone could point me in > the direction of a command line argument to prevent the shell > appearing or module I could strip out of the IDLE directory to allow > me to just use the editor. Take a look in the EditorWindow.py module's test() function for tips......... From robin at jessikat.fsnet.co.uk Fri Dec 21 06:16:01 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Fri, 21 Dec 2001 11:16:01 +0000 Subject: mayavi .sf.net Message-ID: <1Vp8CKAxnxI8Ew+0@jessikat.demon.co.uk> I'm having problems today with my network connection attempting to download the latest mayavi from sf. I'm using wget -c http://.... but get messages such as # wget -c http://prdownloads.sourceforge.net/mayavi/MayaVi-1.1.tar.gz --11:12:40-- http://prdownloads.sourceforge.net/mayavi/MayaVi- 1.1.tar.gz => `MayaVi-1.1.tar.gz' Connecting to prdownloads.sourceforge.net:80... connected! HTTP request sent, awaiting response... 200 OK Continued download failed on this file, which conflicts with `-c'. Refusing to truncate existing file `MayaVi-1.1.tar.gz'. does SF really not allow continued downloads or is there something else wrong here? I can certainly continue http downloads from other sites so it can't be all my fault. -- Robin Becker From soppers3 at cti.ecp.fr Fri Dec 28 22:46:53 2001 From: soppers3 at cti.ecp.fr (Stephane SOPPERA) Date: Sat, 29 Dec 2001 04:46:53 +0100 Subject: [Q] how to use IDLE in linux References: Message-ID: <3C2D3CAD.ABBE79F8@cti.ecp.fr> Young-Jin Lee wrote: > Hi, I have problem using IDLE in Linux. I installed Python 2.2 and tried to > launch IDLE, but it didn't work. What's your linux distribution? If you have a Debian Woody, you should installed also the pack idle-Python2.2 and idle. That's not a part of the standard python package. Anyway, to run idle, you should use 'idle-python2.2' command or something like this instead of just 'idle'. -- Stephane SOPPERA http://stephane.soppera.free.fr From just at xs4all.nl Thu Dec 13 17:57:32 2001 From: just at xs4all.nl (Just van Rossum) Date: Thu, 13 Dec 2001 23:57:32 +0100 Subject: Wrap C function which takes variable lengthed parameters? References: <6p5j1u0oag2ofkam8o7fig5dvkfc2392hk@4ax.com> <3C19990E.BE0F3FA@alcyone.com> Message-ID: <3C19AC0B.7ABD04DF@xs4all.nl> Erik Max Francis wrote: > > Courageous wrote: > > > Ouch! There's a way to do this, if I recall. Something to do > > with generating the varargs and prepping it correctly. Whether > > or not you can do this _portably_ is not something that I recall. > > Yes. Varargs can be used to make a va_list and pass that into another > function. Use of varargs and va_list are ANSI compliant. But you can't contstruct a va_list and pass it to a _vararg_ function; or at least it's not standard, portable, etc. See eg. http://www.eskimo.com/~scs/C-faq/varargs/invvarargs.19920714.html Unless I missed something, I think this is what the OP wanted. Just From kevin at cazabon.com Mon Dec 10 01:38:54 2001 From: kevin at cazabon.com (Kevin Cazabon) Date: 9 Dec 2001 22:38:54 -0800 Subject: Populating a list References: Message-ID: <5a4226f0.0112092238.7212f87@posting.google.com> The reason you'd get an error is that you have no handle on the open file. (f is a list, not a file pointer). The file is still open however, you just have no way to close it. I'd hope that Python would close the file once it goes out of scope, but I couldn't guarantee it. To be safe, I'd suggest doing the open and readlines separately, so you can keep a reference to the file, then use it to close the file. f = open(filename, "r") crap = [item.rstrip() for item in f.readlines()] f.close() Just MHO Kevin. > Main reason why I mentioned the thing of leaving out the f.close() at > the end is because, for me at least, it generates an error if I try to > close it since it's not really the open file, but a list of all the > lines read from the file. Otherwise I definitely would close it, too. > > *scratches head* Unless I'm doing something wrong... > > Jeremy From robin at jessikat.fsnet.co.uk Wed Dec 5 11:47:31 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Wed, 5 Dec 2001 16:47:31 +0000 Subject: zip vs 0-length files again Message-ID: Tim Peters posted stuff about winzip and .tgz files in the pas, but it was alleged that .zip's were OK. I have a freeBSD 4.4 built zipfile with 7 length zero __init__.py files. At least one of these fails to be extracted on a client's NT box. I am enquiring as to the version of zip/winzip being used. With my version 8 under win2k this doesn't happen. Can anyone recall more specific details of the problem? -- Robin Becker From duncan at NOSPAMrcp.co.uk Tue Dec 4 03:57:16 2001 From: duncan at NOSPAMrcp.co.uk (Duncan Booth) Date: Tue, 4 Dec 2001 08:57:16 +0000 (UTC) Subject: Tuples -> Function Params? References: Message-ID: Philip Swartzleonard wrote in news:Xns916D6505401FRASXnewsDFE1 at 130.133.1.4: > a,b,c = self.color > glColor3f(a,b,c) > > Ok, the question is, is there a way to do this where i don't > unpack > the tuple and pass sepearte arugments? Recent versions of Python: glColor3f(*self.color) For older versions, use the apply function. -- Duncan Booth duncan at rcp.co.uk int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3" "\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure? From fperez528 at yahoo.com Thu Dec 6 13:12:05 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Fri, 07 Dec 2001 17:40:05 +2328 Subject: GUI builder References: Message-ID: <9urnih$ph6$2@peabody.colorado.edu> Timothy Collins wrote: > Just wondering if anyone knows where I could get my hands on a gui > builder that would work with python. I have tried "Boa Constructor" > and it works, but only to a point - if I try to open the frame build > it coughs up errors until it just stops. Any other free or nearly > free visual IDE's out there? If you want to use QT (the bindings can be found at google(pyqt)), it comes with a very nice and well documented builder called QT Designer. Cheers, f From skip at pobox.com Thu Dec 27 23:23:13 2001 From: skip at pobox.com (Skip Montanaro) Date: Thu, 27 Dec 2001 22:23:13 -0600 Subject: re module question In-Reply-To: References: Message-ID: <15403.62385.96738.532726@12-248-41-177.client.attbi.com> David> patt = re.compile("mailto:(.*)\">.*",re.I) David> match = patt.search(tststring) David> if match: David> email = match.group(1) David> I can locate the first instance of mailto: . . . but what if I David> have a document with more than once instance of the match. How David> do I pick them out? You probably want re.findall... -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From johannh at uclink.berkeley.edu Sun Dec 2 11:48:01 2001 From: johannh at uclink.berkeley.edu (Johann Hibschman) Date: 02 Dec 2001 08:48:01 -0800 Subject: Whatever happened to String Interpolation? References: <9u6dbn$nsj$1@peabody.colorado.edu> <9uc26v$akh$1@peabody.colorado.edu> <9uckd9$o43$1@peabody.colorado.edu> <9ucn17$pea$1@peabody.colorado.edu> Message-ID: Fernando =?ISO-8859-1?Q?P=E9rez?= writes: > > Oh well. We'll see if this gets anywhere. It would be nice to hear > from Ping, I wonder if he's around in this group. I'll try to point him at the thread, though he's been real busy of late. If I catch him, what exactly did you want to know? --J From sholden at holdenweb.com Fri Dec 21 14:09:11 2001 From: sholden at holdenweb.com (Steve Holden) Date: Fri, 21 Dec 2001 14:09:11 -0500 Subject: Distutils question References: <9vu28t$4g9$1@peabody.colorado.edu> Message-ID: "Fernando P?rez" wrote ... > Michael Hudson wrote: > > And they probably hang out on the distutils-sig; I suggest asking > > there might have better luck. > > mmmh. Didn't know about such a thing. Thanks, google did its usual good deed, > I'll try to bugger those folks a bit. Erm, Fernando means, of course, "...bug those folks a bit". At least, I hope he does. Otherwise see the recent post under "Huge dicts..." regards Steve -- http://www.holdenweb.com/ From James_Althoff at i2.com Tue Dec 11 13:29:00 2001 From: James_Althoff at i2.com (James_Althoff at i2.com) Date: Tue, 11 Dec 2001 10:29:00 -0800 Subject: more fun with PEP 276 Message-ID: Nick Mathewson >James_Althoff at i2.com wrote: > >> / and // weren't my first choice (< and <= were -- I'm still working >> on that approach) but since they had the advantage of actually >> *working* in this scheme, I just went with it. > >Did you see my post under the subject heading of > "An implementation of a variation on "for 1 <= i <= 10" ? Yes, I saw your original post -- and very nice work! Good job. I thought I spotted some difficulties with the shortcuts that were left out: the one-sided relations. I've been working on a variant that tries to get the one-sided relations to work the way I want and adds a few twists of its own. I'll try to post it soon and you can have a look. Jim From robin at jessikat.fsnet.co.uk Wed Dec 5 04:01:10 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Wed, 5 Dec 2001 09:01:10 +0000 Subject: ANN: Pyro 2.2 is available References: <9ujgn4$cb7$1@news1.xs4all.nl> Message-ID: In article <9ujgn4$cb7$1 at news1.xs4all.nl>, Irmen de Jong writes > >"Robin Becker" wrote [...] >> and it works :) > >Do you mean >- Pyro 2.2 works (the new version) >- Pyro does the job for you in general >- Pyro works and other tools you've tried don't? > >Irmen de Jong > > all the versions I have tried have worked pretty well out of the box. I haven't tried 2.2 extensively yet, but I'm sure that it works as well if not better than previous versions. -- Robin Becker From uwe at rocksport.de Tue Dec 4 07:15:21 2001 From: uwe at rocksport.de (Uwe Schmitt) Date: 4 Dec 2001 12:15:21 GMT Subject: Numerical Python Question Message-ID: <9uieop$bncra$1@hades.rz.uni-sb.de> Hi, I tried the following code: from Numeric import * from Matrix import * n=5 hilb=zeros((n,n),Float) for i in range(n): for j in range(n): val= 1.0/(i+j+1) hilb[i,j]=val x=ones((n,1),Float) b=hilb*x print "x= ", x print "b= ", b As hilb is a n x n matrix and x is n x 1 the result b should be n x 1. But the program outputs a n x n matrix !!! Is this a bug, or did I miss something ? Greetings, Uwe. -- Dr. rer. nat. Uwe Schmitt Uwe.Schmitt at num.uni-sb.de Universitaet des Saarlandes Angewandte Mathematik Building 36.1 Room 4.17 PO-Box 151150 D-66041 Saarbruecken Mobile:0177/6806587 Fax:+49(0)681/302-4435 Office:+49(0)681/302-2468 From dyoo at hkn.eecs.berkeley.edu Wed Dec 26 00:12:52 2001 From: dyoo at hkn.eecs.berkeley.edu (Daniel Yoo) Date: Wed, 26 Dec 2001 05:12:52 +0000 (UTC) Subject: How do I access DoS thru Python? References: <40dbad98.0112242348.46af380f@posting.google.com> Message-ID: Andrew Nguyen wrote: : Well, the subject answers it... Without further information, I have to guess that by 'DoS', you're talking about the operating system interface, and not "Denial of Service". Have you seen the os.system() and os.popen() functions? http://www.python.org/doc/current/lib/os-process.html#l2h-1218 http://www.python.org/doc/current/lib/os-newstreams.html#l2h-1130 I'm not sure if this is what you're looking for. Please tell us more information on what you're trying to do. From shalehperry at attbi.com Sat Dec 8 11:43:06 2001 From: shalehperry at attbi.com (Sean 'Shaleh' Perry) Date: Sat, 08 Dec 2001 08:43:06 -0800 (PST) Subject: Need help with regular expression In-Reply-To: <20011208113002.A21206@newcreature.org> Message-ID: > > The above RE works just fine except that I can't have the ending > sequence in the string. I want to be able to "escape" the ending > sequence with either double quotes (">>") or single quotes ('>>'). > > I can't seem to figure out how to do this, though. Can anyone give me > any ideas? > people the world over bang their heads against this one the first (and hundredth) time through. Go to a bookstore and find "Master Regular Expressions". Most everything he says works in python even though he uses perl for most of the examples. There is a specific item about this in there if I recall. From QnickQm at alum.mit.edu Mon Dec 10 21:12:23 2001 From: QnickQm at alum.mit.edu (Nick Mathewson) Date: Tue, 11 Dec 2001 02:12:23 GMT Subject: more fun with PEP 276 References: Message-ID: In article , James_Althoff at i2.com wrote: [...] > / and // weren't my first choice (< and <= were -- I'm still working > on that approach) but since they had the advantage of actually > *working* in this scheme, I just went with it. Did you see my post under the subject heading of "An implementation of a variation on "for 1 <= i <= 10" ? I believe I managed to get "for i in 1 <= Integers() <= 10" nailed, and I _think_ I got "for i in 1 <= ints <= 10" down pretty well too. I'll repeat the information here: ============================================================ Here's some code that implements almost this behavior. Now you can type: for i in 1 <= ints <= 10: print i I don't have "for i in ints <= 10" going yet, but that should be a fairly easy extension. This code requires that you have at least Python 2.2 for the iterator logic to work. Python2.2 is still in beta, but hey -- so is this code. :) #!/usr/bin/python class Integers: def __init__(self, step=None, auto=0): self.lb = None #Lower bound (inclusive) self.ub = None #Upper bound (inclusive) self.up = None #Flag: Are we counting up (ai>c)? self.step = step #Stepping increment self.auto = auto #Automatically return an iterator when we have 2 # bounds? def __gt__(self, n): self.lb = n+1 if self.ub == None: self.up = 1 if self.auto and self.ub != None and self.lb != None: return iter(self) else: return self def __lt__(self, n): self.ub = n-1 if self.lb == None: self.up = 0 if self.auto and self.ub != None and self.lb != None: return iter(self) else: return self def __ge__(self, n): self.lb=n if self.ub == None: self.up = 1 if self.auto and self.ub != None and self.lb != None: return iter(self) else: return self def __le__(self, n): self.ub=n if self.lb == None: self.up = 0 if self.auto and self.ub != None and self.lb != None: return iter(self) else: return self def __nonzero__(self): return 1 def __iter__(self): if self.step == None: self.step = (-1, 1)[self.up] else: assert self.step != 0 and self.up == (self.step > 0) if self.up: return iter(xrange(self.lb, self.ub+1, self.step)) else: return iter(xrange(self.ub, self.lb-1, self.step)) ints = Integers(step=1, auto=1) if __name__=='__main__': assert [i for i in 1 <= Integers() <= 10] == range(1,11) assert [i for i in 10 >= Integers() >= 1] == range(10,0,-1) assert [i for i in 1 < Integers() < 10] == range(2,10) assert [i for i in 10 > Integers() > 1] == range(9,1,-1) assert [i for i in 1 < Integers() <= 10] == range(2,11) assert [i for i in 10 > Integers() >= 1] == range(9,0,-1) assert [i for i in 1 <= Integers() < 10] == range(1,10) assert [i for i in 10 >= Integers() > 1] == range(10,1,-1) assert [i for i in 2 <= Integers(step=2) < 99] == range(2,99,2) n = 0 for i in 1 <= ints <= 10: for j in 1 <= ints <= 10: n += 1 assert n == 100 assert zip(1 <= ints <= 3, 1 <= ints <= 3) == zip((1,2,3), (1,2,3)) ============================================================ Yrs, -- Nick Mathewson Remove Q's to respond. No spam. From grahamd at dscpl.com.au Mon Dec 24 04:13:03 2001 From: grahamd at dscpl.com.au (Graham Dumpleton) Date: 24 Dec 2001 01:13:03 -0800 Subject: Leading distributed object packages for python? References: Message-ID: Syver Enstad wrote in message news:... > grahamd at dscpl.com.au (Graham Dumpleton) writes: > > Somewhat related is OSE. Check out: > > > > http://ose.sourceforge.net > > Hmm, looks cool. Especially that they seem to have focus on logging > and other debugging facilities sounds interesting. But I get this knee > jerk reaction when I see that it contains another container library > for C++. Why the hell can't people just use the standard library, oh, well. If you read the history for OSE posted on the web site you will see that OSE actually predates the STL. OSE actually originated at a time when available C++ compilers did not even implement templates. The provision of template collection classes at that time was only possible because of a hacked up version of a C preprocessor made available by Texas Instruments which did some magic such that the proposed (at that time) C++ template syntax could be used. It was a couple of years before the AT&T cfront 3.0 compiler with template support became generally available. It was another few years after that that the STL even became available in any sort of form, let alone being standardised. In that time, too much had already been developed within OSE, plus in other projects which relied upon OSE, which used the existing collection classes. It didn't make much sense to be ripping out five years of work which had proven to be robust and easy to use, certainly easier to use and understand than STL has proven to be. Frankly, to try and reimplement the upper levels of OSE and host it on top of STL would be a nightmare, most likely taking a few years and of course yielding something which could in no way be interface compatible. In short not worth the effort. Such is the history of OSE. :-) From mhammond at skippinet.com.au Fri Dec 28 23:28:13 2001 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 29 Dec 2001 04:28:13 GMT Subject: REPOST: win32all-141 for Python 2.2 Message-ID: <0$--$$_----_-%$_$$@news.noc.cabal.int> I have made a new win32all release for Python 2.2. Hrmm - it seems I can't login to starship :( So I have temporarily placed it at: http://users.bigpond.net.au/mhammond/win32all-141.exe The only new known issue is that "Active Debugging" will probably not work - using the Microsoft Debuggers when using Python in an ASP or IE page will fail. I will move this to starship, including details of exactly what has changed, ASAP. Mark. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Mark Hammond Newsgroups: comp.lang.python Subject: cmsg cancel <3C2D4676.5060700 at skippinet.com.au> Control: cancel <3C2D4676.5060700 at skippinet.com.au> Date: Mon, 31 Dec 2001 03:05:35 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774882 27193 211.57.49.2 (31 Dec 2001 05:01:22 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:01:22 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jhauser at ifm.uni-kiel.de Fri Dec 21 05:24:58 2001 From: jhauser at ifm.uni-kiel.de (Janko Hauser) Date: 21 Dec 2001 11:24:58 +0100 Subject: Anyone stil using CXX References: Message-ID: <874rmkc1l1.fsf@ifm.uni-kiel.de> hoel at germanlloyd.org (Berthold H?llmann) writes: > Hello, > > Is there anyone out there using the CXX package for writing C++ > extension for Python? I'm looking for some more examploes on the usage > and for a mailinlist for sharing problems, solutions, and experiences. > > Cheers > Don't know about the current usage of CXX, but a strong contender is the boost framework. Just for the notes. __Janko From martin.franklin at westgeo.com Wed Dec 12 09:18:34 2001 From: martin.franklin at westgeo.com (Martin Franklin) Date: Wed, 12 Dec 2001 14:18:34 +0000 Subject: problems subclassing a PMW widget References: Message-ID: <9v7ouq$52oo$1@mail1.wg.waii.com> Laura Creighton wrote: >> Greg Goodman: >> Either I'm doing something wrong, or the Pmw widgets aren't meant to be >> subclassed. I'm hoping it's me. > > I have very bad news for you. I could never get it to work and > neither could anybody else I talked to. I hope you only need one Laura, Whats the problem with this?:- import sys import Tkinter import Pmw class UOMEntryField(Pmw.EntryField): """ A Pmw.EntryField subclass """ def __init__(self, parent = None, **kw): optiondefs = ( ('command', None, None), ('errorbackground', 'pink', None), ('invalidcommand', self.bell, None), ('labelmargin', 0, Pmw.INITOPT), ('labelpos', None, Pmw.INITOPT), ('modifiedcommand', None, None), ('validate', None, self._validate), ('extravalidators', {}, None), ('value', '', Pmw.INITOPT), ) self.defineoptions(kw, optiondefs) Pmw.EntryField.__init__(self, parent, **kw) self.initialiseoptions(UOMEntryField) if __name__ == '__main__': root = Tkinter.Tk() val = Tkinter.DoubleVar() val.set(1.23) widget = UOMEntryField( labelpos='w', label_text='My Label', validate='real', entry_textvariable = val) widget.pack() Tkinter.Button(text='Quit', command=sys.exit).pack() root.mainloop() Martin From syver-en+usenet at online.no Mon Dec 24 01:06:04 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 24 Dec 2001 07:06:04 +0100 Subject: Emacs python mode, pyshell behaving strangely (win2k) Message-ID: Merry Christmas, emacs'ers and pythoneers. I have a strange problem with the python mode python shell. If I create a Tkinter(a python gui toolkit) window and call the Tkinter mainloop on it, the python process gets detached from the emacs shell window. When I later close the Tkinter window I can't reach the python process from the shell window. This behaviour is the same when starting the python interpreter from the ordinary emacs shell. But not the same when starting the python interpreter from an ordinary os shell (cmd.exe). The behaviour of the emacs shell after closing the Tkinter window is seems the same as starting the python interpreter in an emacs shell without specifying the -i option, if that is of any help. Is there any way to resolve this problem? -- Vennlig hilsen Syver Enstad From pinard at iro.umontreal.ca Tue Dec 18 13:51:21 2001 From: pinard at iro.umontreal.ca (=?iso-8859-1?q?Fran=E7ois?= Pinard) Date: 18 Dec 2001 13:51:21 -0500 Subject: pymacs and rlcompleter In-Reply-To: <87bsgw1pju.fsf@moskau.hmotakef.homeip.net> References: <87bsgw1pju.fsf@moskau.hmotakef.homeip.net> Message-ID: [Henrik Motakef] > However, the "folding" question is easy: Use the "Outline" minor mode. > It has a variable "outline-regexp" to specify what it should consider > a collapsable "header". Setting this to "\t*.*:" works for me. Besides, there is an `outdent.el' package which fits nicely with Python mode. I do not remember where I found it. Probably next to `python-mode.el' :-). -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From Bruce at EckelObjects.com Sun Dec 9 10:16:45 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Sun, 09 Dec 2001 07:16:45 -0800 Subject: Does 'super' exist? In-Reply-To: References: Message-ID: <200112090716450170.001FDEEA@mail.rdc1.sdca.home.com> Thanks. Looks like the syntax for calling the base-class B's constructor would then be: super(B, self).__init__() I see the value of super() for MI but I was thinking I might get a free ride in the form of less typing for SI base-class calls. Oh well. *********** REPLY SEPARATOR *********** On 12/9/01 at 7:34 AM Ben Wolfson wrote: >On Sat, 08 Dec 2001 19:03:12 -0800, "Bruce Eckel" >wrote: > >>It's a little hard to tell, does 'super' exist in 2.2? If so, where >>might I find the syntax? Thanks. > >Probably the best place to look is www.python.org/2.2/descrintro.html . >super is in 2.2. > >-- >Barnabas T. Rumjuggler >You're going to set me up as a kind of slovenly attached pig that >Jack Kornfeld can slice down in his violent zen compassion? > -- Larry Block >-- >http://mail.python.org/mailman/listinfo/python-list From phd at phd.pp.ru Tue Dec 11 16:35:21 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Wed, 12 Dec 2001 00:35:21 +0300 Subject: Help newbie! In-Reply-To: <9v5t5g$sp2$1@news.hccnet.nl>; from j.barelds@good-it.com on Tue, Dec 11, 2001 at 10:17:35PM +0100 References: <9v5t5g$sp2$1@news.hccnet.nl> Message-ID: <20011212003521.C26715@phd.pp.ru> On Tue, Dec 11, 2001 at 10:17:35PM +0100, Johan Barelds wrote: > >>> replace("hello","hel","hol") > Traceback (most recent call last): > File "", line 1, in ? > NameError: name 'replace' is not defined > ======================================================================== > What do i have to do to get the command "replace" working? Either "from string import replace", or import string string.replace(... Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From tatebll at aol.com Sun Dec 30 17:40:06 2001 From: tatebll at aol.com (Bill Tate) Date: 30 Dec 2001 14:40:06 -0800 Subject: REPOST: Re: Python Popularity, python at sourceforge References: Message-ID: <6$--$$_----____$-$@news.noc.cabal.int> Roeland Rengelink wrote in message news:... > Hi, > > As was remarked earlier in this thread, a measure of Python's > popularity, if not quality, can be obtained by looking at the number > of sourceforge projects using Python. Below you'll find a number of > tables comparing sourceforge projects using Python to those using > Perl, PHP, Java, C and C++. These numbers were obtained by > screen-scraping the sourceforge trove pages. > > I started this analysis expecting to find clear evidence for Python's > - exploding popularity > - cross-platform usability > - ease of development > > Alas, the numbers are far more ambigious than I'd hoped. To summarize: > > 1. Python is the smallest of the 6 languages discussed here. > 2. Python is currently growing slower than PHP and Java, but faster > than C and Perl. > - Python has only been gaining on Perl for the last 6 months > - the difference in growth w.r.t PHP and Java may be getting smaller > 3. Java is more cross-platform than Python. Perl, C, C++ are less. > 4. There is no clear evidence for Python's ease of development. > You raise some interesting numbers, but I'm not sure I share some of your conclusions. The basis for your conclusions appear to be derived in large part from projects on sourceforge. While I don't disagree that the numbers could suggest something consistent with your conclusions, there's a couple of things worth noting. First, maturity of the language. Are the number of projects on sourceforge more indicative of the maturity (or lack thereof) of a language as opposed to inferring popularity or growth of the language. C is still hugely popular on Unix and Linux, but I wouldn't necessarily infer that the number of projects on sourceforge for C as being indicative of either its usage or popularity. For python, there is a huge, pre-existing standard library, much of which perhaps doesn't require a dedicated sourceforge project. Second, python developers routinely make use of extensions to existing C and C++ libraries. Many of these extensions do not require a specific project on sourceforge. They are distributed through various means and not necessarily through sourceforge. Third, project numbers do not necessarily equate to developer usage or preference of a particular language. Perhaps in concert with other measures (newsgroup/discussion group activity), something can be inferred about these numbers. Fourth - does the number of actual projects convey the degree of cross-platform support that already exists? Lastly, your numbers I believe omitted RUBY. Ruby appears to be gaining in popularity and the number of projects is increasing. Would your conclusions be the same (in terms of rate of growth rather than totals) had they incorporated into your numbers? WRT Exploding popularity - Regardless of what may or may not be happening, I'll take moderate and un-hyped growth anyday. Ease of Usage - Personally, I don't think we need numbers from Sourceforge to reach a conclusion here. I don't think there is an question on Python's ease of use. Its almost pro forma language that appears at the beginning of any sentence that starts with "What's Python?" ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: tatebll at aol.com (Bill Tate) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:51:10 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774030 27193 211.57.49.2 (31 Dec 2001 04:47:10 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:47:10 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From fperez528 at yahoo.com Wed Dec 19 09:42:06 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Thu, 20 Dec 2001 14:10:06 +2328 Subject: Bug in % string formatting? References: <9vtiev$no8$1@peabody.colorado.edu> <871yhp7guv.fsf@ifm.uni-kiel.de> Message-ID: <9vtk6h$ojk$1@peabody.colorado.edu> Janko Hauser wrote: > Operator precedence :-), change it to >>>> print format_string % (names['John'][:] + names['Jane'][:] ) > Argggh! As they say in numerical recipes: you should brush your teeth every night in front of the operator precedence rules for your language of choice. It does surprise me though that % binds harder than +. I would naively think that by its nature, % would have fairly low precedence. Oh well, I'm sure there's a good reason for it being the way it is. Thanks Janko! Cheers, f From pzw1 at hotmail.com Fri Dec 14 03:13:28 2001 From: pzw1 at hotmail.com (Peter Wang) Date: 14 Dec 2001 00:13:28 -0800 Subject: Preserving program structure References: Message-ID: "David Dawkins" wrote in message news: > So I'm using IDLE, and Alt-F5 tells me I have a problem with > indentation. > It seems I had (inadvertently) mixed tab and space characters. > No amount of "tabbifying" and "untabbifying" resolved the issue, > so I had to shift *everything* to the left-margin, and re-create > the indentation with a consistent scheme (8 space hard tabs). IDLE really seems to have a problem with this. it seems that no matter what you have selected in the options ("Use tabs"/"Use spaces"), when it autoindents, it automatically matches the tabbing with the block of code you are in. one thing you can do is turn on "show whitespace", which you show you exactly where the suspect spaces or tabs are. so although i liked the syntax highlighting, i switched back to using UltraEdit (under windows). vi under linux, of course. one of the nice features of ultraedit is the "convert all leading space to tabs" (and vice versa) function. > While doing so, I stuffed up a lot of the program logic, because > it wasn't always obvious which block a particular statement > belonged in. This dismayed me intensely. yes, i can imagine... > How do experienced Python programmers avoid this problem? well, there are several layers to your problem. Layer -1: you always back up your code using source control, so you never totally F yourself if, for example, you strip out all the tabs and hit Ctrl-S inadvertently. :) Layer -2: use an editor you are really comfortable with, or find one and learn its ins and outs, so you don't get hit with nasty surprises. Layer -3: pick an indentation scheme and stick with it. at my company, we settled on (IMHO) a good scheme, where leading indentation for setting out code block level use tabs, and all indentation or spacing meant to line things up beyond that (e.g. for continuation lines, or end-of-line comments) are done with spaces.[1] that way we maximize productivity across different people who need different tab widths to best read code and still preserve legibility of continuation lines. > I don't see much code out there with comments like "# endif", etc. no, that really wouldn't be a good thing because it violates the "Don't Repeat Yourself" principle. by not indenting the next block, you've already told your human and computer audiences that the block has closed. an additional delimiter would be at best redundant and at worst erronous and confusing. if you really feel compelled to set out a certain block of code, put in a blank line before/after it to visually separate it. -peter [1] the unfortunate thing is that tabs and spaces are cross-overloaded. tabs are good for delimiting blocks, but they can be overloaded to be simple substitutes for spaces. spaces are good for lining things up pretty, but are bad for block delimiting because different people will frequently have legitimate reasons for wanting/needing different widths for block delimiting. (the frequently-used argument that "spaces are just as easy for delimiting blocks if you use a sensible editor" is sort of moot because not everyone has a sensible editor.) people will frequently think that only tabs or only spaces should be used to fill both needs, and come out with very religious opinions about them. From sebascabot at sympatico.ca Mon Dec 3 17:54:16 2001 From: sebascabot at sympatico.ca (Sébastien Cabot) Date: Mon, 3 Dec 2001 14:54:16 -0800 Subject: Problem when calling __init__() in base class Message-ID: (With Python2.1.1, on Debian, with Python megawidget) We have the following in the class 'ScrolledFrame' of the Pmw. class ScrolledFrame(Pmw.MegaWidget): def __init__(self, parent = None, **kw): ... In my inherited class, I call __init__() of the base class 'Pmw.ScrolledFrame.' class MyScrolledFrame(Pmw.ScrolledFrame): def __init__(self, parent, **kw): Pmw.ScrolledFrame.__init__(self, parent, kw) ... Then I get this error: ... Pmw.ScrolledFrame.__init__(self, parent, kw) TypeError: __init__() takes at most 2 arguments (3 given) What I'm doing wrong ? Where's my third arguments now ? Here's my test code which raise the error #--- test.py ---------------------------------------- import Tkinter import Pmw class MyScrolledFrame(Pmw.ScrolledFrame): def __init__(self, parent, **kw): Pmw.ScrolledFrame.__init__(self, parent, kw) if __name__ == '__main__': root = Tkinter.Tk() Pmw.initialise(root) MyScrolledFrame(root, labelpos="n", label_text="Special").pack() From syver-en+usenet at online.no Sun Dec 23 06:28:02 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 23 Dec 2001 12:28:02 +0100 Subject: SnoPy 0.1 - SNOBOL pattern matching for Python References: Message-ID: Dale Strickland-Clark writes: > But having just checked the links, I see it's Linux only :-(. Use Cygwin? > -- > Dale Strickland-Clark > Riverhall Systems Ltd -- Vennlig hilsen Syver Enstad From deweese at usc.edu Wed Dec 19 03:30:58 2001 From: deweese at usc.edu (John DeWeese) Date: Wed, 19 Dec 2001 00:30:58 -0800 Subject: stackless python Message-ID: <9vpjds$due$1@usc.edu> Hello, I'm a python newbie interested in using stackless python to support hundreds of simulation objects for a game. I've checked out various articles and it sounds great, and I've visited stackless.com. Seems that branch is becoming a bit dated. I also see that some features such as generators (not relevant to me) have made it into python 2.2. So, what's up, can anyone share their experiences regarding stackless python, micro-threads, etc.? Thanks! From DeepBlue at DeepBlue.org Thu Dec 13 09:01:30 2001 From: DeepBlue at DeepBlue.org (DeepBlue) Date: Thu, 13 Dec 2001 08:01:30 -0600 Subject: where has infomation of jython?!!! References: <9v9mmt$212o$1@news.cz.js.cn> Message-ID: There is no error. Just a page that is vague and nonsensical coming from someone who is a PC geek and who does not know how to communicate in good standard English. Try: http://jython.sourceforge.net/ DeepBlue "Zoom Quiet" wrote in message news:9v9mmt$212o$1 at news.cz.js.cn... > please me why www.jython.com can not visited in chinese? > "socket error" always?! > > -- > /======================\ > | Time is unimportant; > | only life important! > \======================/ > > From ssthapa at classes.cs.uchicago.edu Thu Dec 20 11:07:38 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Thu, 20 Dec 2001 16:07:38 GMT Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> Message-ID: Fernando P?rez wrote: >All the scripts for which this is an issue are distributed by them, as part >of their own system setup. So they can point every script which explicitly >needs 1.5 to use it. > >They cause their users a fair amount of annoyance and I have yet to see a >solid technical reason to justify it. My post from yesterday included ways >out of this with (as far as I could tell) reasonable solutions for them. >Yesterday someone from redhat was around on this thread (or the /usr/bin/env >thread), I'm curious to hear from them. There may be a solid technical reason >for them doing things this way, but so far I'm unconvinced. What about users and other vendors that have working python scripts that use things that have changed between python 1.5 and 2.x? It would be a bit embarassing for redhat to claim compatibility between major versions and suddenly have working python scripts break after doing a point upgrade. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From jkraska at san.rr.com Fri Dec 21 12:57:00 2001 From: jkraska at san.rr.com (Courageous) Date: Fri, 21 Dec 2001 17:57:00 GMT Subject: An hour's talk on python...Suggestions required (from a newbie) References: <3C22D248.3CA5DB26@my995internet.com> Message-ID: Since yours is a Java shop, no discussion of Python in that context will be complete without discussing Jython. This provides you with both the ability to interactively invoke Java in the interpreter as well as the ability to embed Python scripts in Java. C// From amuys at shortech.com.au Mon Dec 17 23:36:33 2001 From: amuys at shortech.com.au (Andrae Muys) Date: 17 Dec 2001 20:36:33 -0800 Subject: Looping in Python References: <9vl8os$gcs$1@bob.news.rcn.net> Message-ID: <7934d084.0112172036.486d4672@posting.google.com> "basegmez" wrote in message news:<9vl8os$gcs$1 at bob.news.rcn.net>... > If everything is an object in Python then why not: > > Syntax: > > loop(start=0, stop, step=1): > (loop.count and loop.value automagically generated by Python, > loop count starts from 1 and incremented by 1, > loop value starts from start value and incremented by step value, > stop value is a long integer) > If you feel like pushing it, "loop.start", "loop.stop" and "loop.step" may > be added. > If it could implement floating point step values, it would be even better > but I am not sure if this would be feasible. > I realized that there have been some lengthy (to put it mildly) discussions > of loop structures, if this is already proposed and rejected, just ignore > it. If not, someone may be able to come up with better alternatives to > "loop.count" and "loop.value" even the "loop" keyword. This was the most > Pythonic way I could come up with. With python 2.2 we now have access to Generators, which can achieve the same thing. Consider the following... from __future__ import generators def frange(start,stop,step=1.0): while start < stop: yield start start += step l = [] for i in frange(1.0, 10.0): l.append(i) print l [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0] l = [i for i in frange(1.0, 10.0)] print l l = [] loop = frange(1.0,10.0): l.append(loop.next()) l.append(loop.next()) l.append(loop.next()) print l [1.0, 2.0, 3.0] Andrae Muys From brian at sweetapp.com Sun Dec 2 14:08:10 2001 From: brian at sweetapp.com (Brian Quinlan) Date: Sun, 2 Dec 2001 11:08:10 -0800 Subject: Are there any PEPs for typed arguments? In-Reply-To: <9udsh4$3pf$1@rex.ip-plus.net> Message-ID: <007601c17b64$af4e12c0$445d4540@Dell2> F. GEIGER wrote: > Are there any ideas to promote these lines > > def meth(a, b, c, d): > assert type(a) == IntType > assert type(b) == StringType > assert isinstance(c, MyClass) > > return > > into something like this: > > def meth(a: IntType, b: StringType, c: MyClass, d): > > return > > in a future version of Python? I think that a better question is why are you adding these asserts in the first place? Are you claiming that "meth" would not work correctly if I passed a small long for "a" or that I could not use a instance that supports __getitem__ (that always returns a length 1 string), __len__ and a few other string methods for "b"? So why restrict the use of compatible types? Cheers, Brian From nobody at nowhere Thu Dec 13 01:10:22 2001 From: nobody at nowhere (nobody at nowhere) Date: Thu, 13 Dec 2001 06:10:22 GMT Subject: Games Made w/ Python Message-ID: <9v9gss$5hr$1@nntp9.atl.mindspring.net> X-No-Archive: yes Is Python an appropriate language for game programming? TIA. From rdsteph at earthlink.net Thu Dec 27 05:15:32 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Thu, 27 Dec 2001 10:15:32 GMT Subject: Literally thousands of Pythonic online articles Message-ID: <3C2AF56C.1DDF68E7@earthlink.net> Bored with the holidays? Then maybe you should check out the list of online Python related articles generated by Hans Nowak's Pythonic Webcrawler at http://www.awaretek.com/plf.html Even though it's still a little rough around the edges, in its alpha state, one can spend a lot of time browsing the online articles listed by date of first posting to the web. Better yet, why not fool around with the source code (it's GPL) and improve it, add more site configurations to be searched, or even add an automatic routine to update the list daily or even hourly to a web site. Anyway, check it out if you wish. It takes a half minute to download the output.html file using my cable modem (its almost a MB in size); with a 56K connection it could take awhile. But remember its thousands of links. Also, you can get around the download time angle by downloading and running the mygale.py script locally on your machine. Ron Stephens http://www.awaretek.com From chrishbarker at attbi.com Tue Dec 11 13:00:35 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Tue, 11 Dec 2001 10:00:35 -0800 Subject: Populating a list References: <32c382ad.0112091404.6cfe4a56@posting.google.com> <3C154077.CA89133B@tundraware.com> <3C159023.D2D6F681@tundraware.com> <3C159483.FF112BFB@tundraware.com> Message-ID: <3C1649C3.D75FE0EA@attbi.com> Tim Daneliuk wrote: > Oh, never mind, the original version does work - I fatfingered the test > code... Sigh. The modified version does work, but is limited to DOS type > text files, whereas the original version does appear to be platform neutral. Actually, this is not quite right. DOS text files are delineated with a "\r\n", and Unix text files with "\n". Python internally expects "\n". If you read a DOS file on a DOS compatable system (windows*, OS/2, whatever) that was opened as a text file, the translation will be done for you, and you will have "\n" intenally, so either splitlines() or split("\n") will work. If, on the other hand, you read a DOS style text file on a *nix sytem, no tranlatin will be done and you will have "\r\n", and splitlines() will work, but split("\n") will leave a "\r" on the line. An example: >>> unixtext = "this is a line\nthis is another" >>> dostext = "this is a line\r\nthis is another" >>> unixtext.split("\n") ['this is a line', 'this is another'] >>> dostext.split("\n") ['this is a line\r', 'this is another'] # see the extra "\r" ? >>> unixtext.splitlines() ['this is a line', 'this is another'] >>> dostext.splitlines() ['this is a line', 'this is another'] splitlines takes care of it. By the way, I had never notices splitlines() before, thanks for pointing it out. On another note: There has been talk on Python-dev about having a "universal" text file type that would translate non-native text files automagiacally. I'm not sure if any real code has been written yet to support it, however. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From peter at engcorp.com Sat Dec 29 18:39:41 2001 From: peter at engcorp.com (Peter Hansen) Date: Sat, 29 Dec 2001 18:39:41 -0500 Subject: REPOST: Re: values of sys.platform? for a serial port lib References: Message-ID: <4$--$$_----__$%_-$@news.noc.cabal.int> Chris Liechti wrote: > > i've written a portable serial port library. it runs now on linux and win32 > (using marks win32all) but i would like to make it compatible with more > unix like platforms. basicaly it should run on any POSIX compilant system. > > i'm interested in values for "sys.platform" and, if possible, the name of > the serial port (an how the ports are numbered ttyS0, ttyS1 etc.) > e.g "linux2" and "/dev/ttyS%d" % port, numbering starting at zero. Between links on Unix, third-party serial port devices under Windows which might not use the COMx convention, and other such variations, I'd strongly recommend you *not* try to use an index origin of 0 but instead pass the open() routine (or whatever you have) a *string* naming the serial port. By the way, does your win32 implementation work well with threads, if one thread is trying to read from the port while the other is trying to write to it? -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Peter Hansen Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E543D.4BFB07D at engcorp.com> Control: cancel <3C2E543D.4BFB07D at engcorp.com> Date: Mon, 31 Dec 2001 03:22:28 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774486 27193 211.57.49.2 (31 Dec 2001 04:54:46 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:54:46 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From andy47 at halfcooked.com Mon Dec 3 00:33:50 2001 From: andy47 at halfcooked.com (Andy Todd) Date: 3 Dec 2001 05:33:50 GMT Subject: Python in commercial software Message-ID: I don't know if anyone else has spotted this but an eagle eyed colleague of mine was at the Brio conference today and noticed that the latest version of Brio Portal (http://www.brio.com/products/brio_portal/index.html) has dropped javascript as its scripting language and has bundled jython. The marketing department is obviously a bit slow and the only reference on their web site is in the 'whats new in Brio Portal 7.0' pdf available on the product page. For those who don't know Brio or who don't want to venture to their web site Portal is an enterprise reporting solution designed to sit on top of corporate data warehouses and produce decision support information. Its a good tool and I'd recommend trying it if you are implementing a corporate reporting (or EIS or MIS) solution. I'm not affiliated with Brio Software by the way, I've just used it and like it. Regards, Andy -- Content free posts a speciality From gminick at hacker.pl Tue Dec 4 11:06:18 2001 From: gminick at hacker.pl (Wojtek Walczak) Date: Tue, 4 Dec 2001 16:06:18 +0000 (UTC) Subject: newbie str to int References: <9pbetr$jp83@imsp212.netvigator.com> Message-ID: Dnia Wed, 03 Oct 2001 23:11:00 GMT, Andrei Kulakov napisa?(a): >On Tue, 2 Oct 2001 12:22:29 +0800, James wrote: >> I am switching from Perl to Python, and would >> like to convert string '123abc' to integer 123. >> foo = int('123abc') # error >> foo = string.atoi('123abc') #error >> foo = eval('123abc') # error >import string >lst = "" >for char in "123abc": > if char in string.digits: > lst += char > else: > break >num = int(lst) or sth like that: a = '123abc456gfh' b = [] for i in a: if i.isdigit(): b = b +i print b # 123456 HTH. -- [ Wojtek gminick Walczak ][ http://hacker.pl/gminick/ ] [ gminick (at) hacker.pl ][ gminick (at) klub.chip.pl ] From nika at kassube.de Sun Dec 30 08:36:28 2001 From: nika at kassube.de (Nils Kassube) Date: 30 Dec 2001 14:36:28 +0100 Subject: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> Message-ID: <87ellcrfs3.fsf@kursk.kassube.de> Cliff Wells writes: > My PC will need to be a _lot_ faster before it can run an OS written in > Python... maybe you should retarget that statement at programmers who I never claimed that an OS should be written in Python. There are several good all purpose languages who are better for this task, e.g. Lisp and Ada. > develop run-of-the-mill applications in C. Like any other language, C has > places where it shines and places where it isn't really appropriate. Yes, it really shines for security and stability problems. Heck, even bit-fiddling is better done using Ada. BTW: int add_two_numbers(int a, int b){ return a+b; } What's the meaning (semantics) of add_two_numbers(23575,23575)? Cheers, Nils -- "Q: What is the difference between C++ programmers and Ada programmers? A: Ada programmers write code that blows up *on*purpose*." (Marin David Condic) From chris.gonnerman at newcenturycomputers.net Sun Dec 16 23:50:13 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Sun, 16 Dec 2001 22:50:13 -0600 Subject: How to kill Zombie process? References: <026b01c186a3$5e10b8f0$4301010a@sky> Message-ID: <008401c186b6$52f2d3a0$0101010a@local> You need os.wait() or an equivalent. Unixoid OS's will keep a process in the process table to retain it's return status until you retrieve it with the wait(2) syscall. ----- Original Message ----- From: ??? To: python-list Sent: Sunday, December 16, 2001 8:34 PM Subject: How to kill Zombie process? When I use ret=os.fork(),it will create a parent process and child process,when child process exists,it will creaet a Zombie process,How to kill it in parent's process? For example: udpSerSock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) while 1: message=recvfrom(BUFSIZ) ret=os.fork() if ret==0: udpSerSock.close() ip=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) #something deal .... ip.close() break #ps -a I will find a Zombie process 5463 pts/3 00:00:01 python 5465 pts/3 00:00:00 python #Zombie process How to kill it? Any ideas will be appreciated,Thanks! Edward -------------- next part -------------- An HTML attachment was scrubbed... URL: From pj at sgi.com Thu Dec 6 19:58:00 2001 From: pj at sgi.com (Paul Jackson) Date: 7 Dec 2001 00:58:00 GMT Subject: PEP 276 Simple Iterator for ints (fwd) References: <9uomtp$e1cbj$1@fido.engr.sgi.com> Message-ID: <9up46o$e2ost$1@fido.engr.sgi.com> David writes: |> The clear rule is, the middle term of a three-way comparison |> is always a variable, just like the way (in current Python) |> the left term of an "in" Ok - so you choose to go down that fork in the decision tree: The problem I have with this then is that it results in the comparison operators <, <=, ..., >, >= sometimes requiring a list of assignable expressions on one or the other side, as opposed to their current usage, which requires comparable expressions on both sides. This sort of subtle, context sensitive syntax change feels weird and unsettling to me. Oh, and that brings up another fine point. Whereas I can say: for (a,b) in ((1,10), (2,11)): I suspect you wouldn't want me to be able to say: for (1,10) <= (a,b) <= (2,11): Or perhaps you would ?? This starts to get complicated again. -- I won't rest till it's the best ... Manager, Linux Scalability Paul Jackson 1.650.933.1373 From DaveP at dpawson.freeserve.co.uk Tue Dec 4 13:02:48 2001 From: DaveP at dpawson.freeserve.co.uk (Dave Pawson) Date: 4 Dec 2001 18:02:48 GMT Subject: 2.1.1 and regexp References: Message-ID: "Fredrik Lundh" wrote in news:iX_O7.765$l93.304398 @newsb.telia.net: > Dave Pawson wrote: >> Now I'm even more confused :-) > do you get this deep inside the 4suite code, or is this > in your own code? > > does it say: > > AttributeError: 're' module has no attribute 'compile' > > or > > AttributeError: some object has no attribute 'compile' > > if the latter, "re" is probably not what you think: indeedy. I fell for what must be a real newbie trap. > > import re > > # compile some regexps > re = re.compile("...") > re2 = re.compile("...") # oops > > if the former, maybe you have your own "re" (or "sre") script > or module somewhere in the path? Huge chuckles. I had re.py (stop laughing :-) > > adding a "print re" or even "print re.__file__" to the line before > the one that gives you the error might provide additional clues. > > running the interpreter with the -v option might also help. > > hope this helps! Luckily I found it on my own (less embarassment?) Hint to other newbies, don't name your files after module names, or be prepared to blush! Three installs of python and some help from Uche at 4suite solved it for me. Thanks Fredrik, I'll creep into a corner. Still grinning at the power of py though!!! Regards DaveP From david at dataovation.com Thu Dec 27 20:51:20 2001 From: david at dataovation.com (David A McInnis) Date: Thu, 27 Dec 2001 17:51:20 -0800 Subject: re module question Message-ID: I have been playing around with the regex module (re) and have figured out how to locate a pattern once. My question is how do I do it more than once. For example (where tststring is my test input string): patt = re.compile("mailto:(.*)\">.*",re.I) match = patt.search(tststring) if match: email = match.group(1) I can locate the first instance of mailto: . . . but what if I have a document with more than once instance of the match. How do I pick them out? David McInnis -------------- next part -------------- An HTML attachment was scrubbed... URL: From peoter_veliki at hotmail.com Wed Dec 19 15:14:33 2001 From: peoter_veliki at hotmail.com (Peoter Veliki) Date: Wed, 19 Dec 2001 12:14:33 -0800 Subject: moderator: please unsubscribe me! Message-ID: Moderator, I haven't been able to unsubscribe. Please do it for me. Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From tanzer at swing.co.at Tue Dec 4 03:12:45 2001 From: tanzer at swing.co.at (Christian Tanzer) Date: Tue, 04 Dec 2001 09:12:45 +0100 Subject: Python evangelists unite! In-Reply-To: Your message of "Tue, 04 Dec 2001 15:09:05 +1100." <9uhia9$b3m7@news1.gtech.com> Message-ID: "Peter Milliken" wrote: > > > > I use Python as a good, quick and dirty hacking language. For real > > > > (read production) stuff that I expect a customer to run or will > > > > require more than a single person working for a couple of hours, I > > > > look elsewhere :-). > > > > > > Like what? > > What about languages such as Oberon, Modula-2/3, Smalltalk, Java, Pascal, > Ada plus many others. Interesting collection. Having used several of them I wouldn't prefer them over Python for most kinds of production stuff (with the exception of Ada for hard real-time applications -- and guess what, for the RT stuff C has to be used in my customer's circles ). And Smalltalk clearly has more things in common with Python than with the other languages you mention. > > > > They could have been more productive with other languages that provide > > > > better support for generic software engineering principles/standards. > > > > > > What other languages? What principles/standards? (snipped third party interpretation) > No, I didn't mean 'generic' in that sense :-). I was refering more to the > concepts of information hiding, programming via 'contract', pre/post > conditions, types and type checking, compile time checking i.e. mispell a > variable in Python and spend ages looking for it! :-) run-time checking etc > etc (I could think up others, but these will do for the time being :-)). Do you remember Ariane 5? The one thing they didn't do was to test the software in the new environment... I also find it amusing that you don't mention the one language which actually supports pre/post conditions out of the box (BTW, it is a lot easier to add support for pre/post conditions to Python (and Smalltalk) than to your favorite languages). Christian -- Christian Tanzer tanzer at swing.co.at Glasauergasse 32 Tel: +43 1 876 62 36 A-1130 Vienna, Austria Fax: +43 1 877 66 92 From pythonnet at hotmail.com Thu Dec 27 13:06:45 2001 From: pythonnet at hotmail.com (Andrew Nguyen) Date: 27 Dec 2001 10:06:45 -0800 Subject: REPOST: Re: A new message board is up References: <40dbad98.0112262232.1868734e@posting.google.com> Message-ID: <7$--$$_----_%_-_-$@news.noc.cabal.int> Oh my, I geuss I have to explain to you this: I CAN PUT IT ON SO THAT YOU DON'T HAVE TO REGISTER THE MODS ARE ME AND I PROMISE I WILL ONLY DELETE WHEN NESCASARY(SP?) OK and yes, python does need a lighter heart. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: pythonnet at hotmail.com (Andrew Nguyen) Newsgroups: comp.lang.python Subject: cmsg cancel <40dbad98.0112271006.b98e822 at posting.google.com> Control: cancel <40dbad98.0112271006.b98e822 at posting.google.com> Date: Mon, 31 Dec 2001 01:48:40 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775699 27193 211.57.49.2 (31 Dec 2001 05:14:59 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:14:59 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From pythonnet at hotmail.com Fri Dec 28 00:13:57 2001 From: pythonnet at hotmail.com (Andrew Nguyen) Date: 27 Dec 2001 21:13:57 -0800 Subject: New Array proposal (So that it will actually be read) Message-ID: <40dbad98.0112272113.40a21ab7@posting.google.com> I think that an array sould have natural dimension support, instead of : List = [[4,4,4], [3,3,3]] Just to define it, we should do this: List|A,B,C| to make a 3 dimensional array, so if I did this: List|4,2| it would call up the variable from 4:2. to put variables in, we would do this: List = | | |1,1|,|1,1| | , |1,1|, | and so on, so that they have 3 parts, but... to get to them blah blah blah blah blah.... But, with natural dimension support, List(1,1,1) = 1 List(2,3,1) = 1 and so on... List(2,4,1,5,8,4) = 6 From logiplexsoftware at earthlink.net Fri Dec 28 18:35:58 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Fri, 28 Dec 2001 15:35:58 -0800 Subject: Python on the desktop In-Reply-To: References: <94e3fce8.0112210053.2568529d@posting.google.com> <3C238618.9F54E5CA@attbi.com> Message-ID: <20011228153558.27fbbd15.logiplexsoftware@earthlink.net> On Fri, 28 Dec 2001 22:26:55 GMT Courageous wrote: > > I was responding as could only someone who's actually been exposed > in detail to Microsoft's hegemoney. > > > > Um. I feel that I need to point out that my misspelling above is > deliberate. > > See? It's still not working... why would someone deliberately misspell something? -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From lbergman at abi.tconline.net Fri Dec 7 16:12:46 2001 From: lbergman at abi.tconline.net (Lewis Bergman) Date: Fri, 7 Dec 2001 15:12:46 -0600 Subject: finance programs Message-ID: <200112072112.fB7LCkG02672@lewis.abi.tconline.net> Hello, I am working my way through the tutorial before working on a finance package. I have scoured the site and found little in relation to finance and python. The mail list mentioned on python.org is all but dead. I did find a couple of apps at the vault but no response has yet come from my inquires to them (over a week ago). Are there any fnance packages being worked on that anyone knows about? Maybe something that I can at least get ideas from? Thanks for the time. -- Lewis Bergman Texas Communications 4309 Maple St. Abilene, TX 79602-8044 915-695-6962 ext 115 From johnroth at ameritech.net Fri Dec 21 09:08:03 2001 From: johnroth at ameritech.net (John Roth) Date: Fri, 21 Dec 2001 06:08:03 -0800 Subject: Python on the desktop References: <94e3fce8.0112210053.2568529d@posting.google.com> Message-ID: "Sarat Venugopal" wrote in message news:94e3fce8.0112210053.2568529d at posting.google.com... > Hi all, > I am fairly new to Python, in the sense that I haven't written > anything substantial in it, although I have gone through all the major > books so far. Coming from a strong, industrial strength C++ > application development background, let me make some quick > observations. Needless to say, I am quite fascinated with the language > primarily beacause of the strong emphasis on readability and > maintainability of the code(Indentation, namespaces and the works). I > guess if speed is the only issue, Python should suffice for a number > of applications. > > 1. If python is to permeate the realm of commercial desktop (in > whatever scope), we need the ability to convert it into a native > executable(I have taken a look at some of the limited solutions > available from individuals). I read somewhere, it may never be > possible in Python. Can anyone throw light on this? > Most commercial applications wouldn't want to expose the source code > or even leave it as byte-code(Note: ActiveState has announced a > compiler for Perl) There's a compiler project somewhere, but I've lost track of it. It may be going great, or it may be moribund. > 2. Absence of a standard GUI, which really fits the major platforms. > For a lanuage like Python, this is really a handicap. Would I do it in > Tkinter on Windows? No way. I guess that's why there are so many other > independent implementations out there. There is so much fragmentation > of effort here(Analogous to KDE, GNOME,...on Linux). If anygui works and becomes popular, that problem will be solved. It's currently in alpha test. > 3. Does the community see Python as a full-fledged programming > language? I remember Zope being projected as the killer app for > Python. Does that mean Python is going to hide behind web servers, be > yet another general/web scripting language and probably a rapid > prototyping tool? I guess the language deserves a better treatment. Of course it's a full fledged programming language. I use it as such, and so do many other people and projects. John Roth From kragen at pobox.com Wed Dec 5 05:11:22 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 05 Dec 2001 05:11:22 -0500 Subject: How many threads can I create ??? References: <3C0BAF40.EBC30CFC@softax.com.pl> Message-ID: <83vgfmou2d.fsf@panacea.canonical.org> Tim Roberts writes: > The only use for your test is to establish the limits. Now you know the > limit: 85. However, that fact is not particularly useful. It is > counterproductive to launch an application with a hundred threads. You > will simply waste CPU time thrashing in the scheduler. Only a very poor scheduler will thrash with 85 threads, 2 of which are runnable at any given time. It's not at all hard to use 85 or 200 or 300 threads if you're writing, say, a multithreaded web server. At the moment, just running a normal Linux box, I have 80 threads on my machine, and it works fine. (Those threads mostly living in separate virtual memory spaces doesn't make it any easier on the scheduler. It makes it harder.) Some people might argue that writing a multithreaded web server is a stupid idea if you're planning to service 85 or 200 or 300 clients simultaneously. They are wrong. While a multithreaded web server often won't be as efficient as an event-driven single-threaded web server, it can be a hell of a lot easier to program, and if your program is running in the Python interpreter, your bottleneck is unlikely to be context-switching time anyway. From tim at vegeta.ath.cx Fri Dec 14 17:28:01 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Fri, 14 Dec 2001 22:28:01 GMT Subject: Unsung Python modules References: <3dsnad226b.fsf@ute.mems-exchange.org> Message-ID: Skip Montanaro graced us by uttering: > > Tim> 1) readline (optional built-in) > Tim> 2) xreadlines > > Tim> Two similarly named but unrelated modules have made my > Tim> whole life much easier. =) > > I agree on the readline module (don't have a lot of need to text > file processing that sys.stdin.readlines() won't handle). Well, here's the evolution of the textfile iteration: # Incarnation 1 while 1: line = fh.readline() if not line: break process(line) # Incarnation 2 for line in fh.xreadlines(): # same interface as xreadlines mod process(line) # Incarnation 3 (py2.2+) for line in fh: process(line) Python's textfile iteration structures improved by orders of magnitude with each step. Sure, sys.stdin.readlines() will do until I have to parse a daemon log or flat text db; then there's no good reason or even advantage to loading the whole file in memory at once. > It seems like I've travelled back to the dark ages whenever I have > to use Python without readline or a "real" Bourne shell. Being > able to recall a line or two from an interactive session from a few > minutes before (or a few days before) makes day-to-day interaction > with these tools so much easier. Readline gets slammed for being a > bloated pig, but it is a highly useful bloated pig... ;-) Agreed! =) Tim Hammerquist -- Tell me -- How's your love life? Killed any girlfriends recently? Or sentenced any more of them to Hell? -- Desire to Morpheus, The Sandman From bkc at Murkworks.com Sun Dec 30 11:27:19 2001 From: bkc at Murkworks.com (Brad Clements) Date: Sun, 30 Dec 2001 11:27:19 -0500 Subject: REPOST: CEPort: I Need help with compile.c bug Message-ID: <4$--$$_----__$-%%$@news.noc.cabal.int> Sorry to post here, but I'm trying to figure out where in the 2.2 code to look to solve this problem. I'm porting the release22-maint CVS checkout to CE 3.0 Seems to work okay, except that many of the regression tests fail because the CE port is casting numbers to long somewhere... so numeric output has L at end. I'm looking for a suggestion where to look in the code. It's on input, not output, that the problem is occuring. I'm looking at the diffs and nothing seems to stick out. Thanks for any suggestions.. Here's an example on CE 3.0 >>> import dis >>> def a(): x = 1 >>> dis.dis(a) 0L SET_LINENO 1L 3L SET_LINENO 1L 6L LOAD_CONST 1L (1L) 9L STORE_FAST 0L (x) 12L LOAD_CONST 0L (None) 15L RETURN_VALUE >>> x = 1 >>> type(x) >>> On Python 2.1 for Windows, I get: >>> def a(): ... x = 1 ... >>> dis.dis(a) 0 SET_LINENO 1 3 SET_LINENO 2 6 LOAD_CONST 1 (1) 9 STORE_FAST 0 (x) 12 LOAD_CONST 0 (None) 15 RETURN_VALUE >>> x = 1 >>> type(x) -- Brad Clements, DevNet Sysop 5 Developer Network Sysop Team -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp.gblx.net!feeder.qis.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Brad Clements" Newsgroups: comp.lang.python Subject: cmsg cancel <3c2f4102_5 at news.newsgroups.com> Control: cancel <3c2f4102_5 at news.newsgroups.com> Date: Mon, 31 Dec 2001 04:12:34 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774190 27193 211.57.49.2 (31 Dec 2001 04:49:50 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:49:50 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From rxg218 at psu.edu Sun Dec 30 18:23:41 2001 From: rxg218 at psu.edu (Rajarshi Guha) Date: Sun, 30 Dec 2001 18:23:41 -0500 Subject: introduction to xml in python Message-ID: Hi, could somebody point me to some code/tutorial describing how to use Python to parse XML - I tried delving into the Python docs, but it seems confusing. Whats the difference between expat and sax? How can I generate a parsers etc. any suggestions appreciated. TIA, -- ------------------------------------------------------------------- Rajarshi Guha | email: rajarshi at presidency.com 417 Davey Laboratory | web : www.rajarshi.outputto.com Department of Chemistry | ICQ : 123242928 Pennsylvania State University | AIM : LoverOfPanda ------------------------------------------------------------------- GPG Fingerprint: DCCB 4D1A 5A8B 2F5A B5F6 1F9E CDC4 5574 9017 AF2A Public Key : http://pgp.mit.edu/ ------------------------------------------------------------------- A meeting is an event at which the minutes are kept and the hours are lost. From vbman8 at yahoo.co.in Thu Dec 27 00:39:50 2001 From: vbman8 at yahoo.co.in (vbman8) Date: Thu, 27 Dec 2001 05:39:50 -0000 Subject: How to include text and images both in a single PS file Message-ID: Hi, How to create a PS file that will first have some text then some picture and then again text in it. Please give full example and/or the links. Thanks. Regards, Vbman From use-net at schabi.de Tue Dec 4 10:06:22 2001 From: use-net at schabi.de (Markus Schaber) Date: Tue, 4 Dec 2001 16:06:22 +0100 Subject: Printing from Windows References: <9ui1ki$lfv$1@news.netpower.no> <20011204111022.682cc9dc.use-net@schabi.de> <3C0CA3BB.9090508@gmx.net> Message-ID: <20011204160622.7afb6a2a.use-net@schabi.de> Hi, On Tue, 04 Dec 2001 11:21:47 +0100 Andreas Ulbrich wrote: > > Maybe the gtk+ printing works with windows and unix in the same way. > > > > This has the disadvantage that gtk+ is not part of standard python, > > but there are some extreme powerful widgets there (including embedding > > the mozilla engine). > > I personally prefer PyQt for this purpose. Of course, just like gtk+ its > not part of the standard Python distribution. Using Qt seems somewhat > more sane to me. But well that's pretty much a matter of taste :-) But Qt has the license disadvantage on windows platform. markus -- "GPL software is not free - the cost is cooperation" From rdsteph at earthlink.net Wed Dec 26 22:58:52 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Thu, 27 Dec 2001 03:58:52 GMT Subject: Python Popularity: Questions and Comments Message-ID: <3C2A9D33.67FEC261@earthlink.net> OK, so its between the holidays and the newsgroup is quiet, so maybe I dare waste a little bandwidth with that most useless (but fun) commodity: gossip. How is Python doing popularity wise? After such a meteoric growth thought the nineties, and a spectacular climax in 2000 and early 2001, is Python leveling out, going dot.bust, or still not yet at the knee of the software world's most spectacular growth curve? I'd be interested in some comments and observations and opinions from others. Meanwhile, here are a few of my own: Python, while fabulously successful, is at an interesting point in its growth curve. It will be difficult to maintain the extremely high rate of growth exhibited so far; new contenders are possible problems; and the recessionary economy could also negatively impact Python's growth. 1. Ruby is an especially interesting competitor to Python. I have been monitoring the Ruby newsgroup, and it shows incredible growth and vitality. Furthermore, Ruby is aimed right at the heart of Python's niche. If we view Microsoft's Visual Studio, especially Visual Studio.net's C# and VB, as the official 800 lb. gorilla of software development; and if we view Java as the 400 lb. gorilla pretender to the throne; and if we view Borland's Delphi and Kylix as no more than a smart leader of a chimp; then everything else is the pack of open source chimps. The open source world is still led by PERL, but PERL is truly more of a text processing, web CGI, scripting specialist; not so much of a direct threat to Python. PHP is a server side scripting specialist. Even JavaScript is strong in its narrow niche of client side web scripting. Lisp and Scheme dominate thier academic world. But Python aims to be much more than these; Python aims to be a powerful general purpose programming language, in addition to being a very easy to learn and easy to use scripting language. And who can say that Python does not succeed very well in all of the above? But Ruby is also a more general purpose, object oriented, relatively easy to read, language. Ruby folks include those who like its more Perl-like syntax, but Ruby's core converts believe that its pure, absolute object oriented nature exceeds those of Python and make it more worthy to long term success. They seem to see Ruby as a more modern, up-to-date version of Python. They see Python as a compromise between object oriented and procedural programming. Be that as it may, I suspect that much of Ruby's momentum is simply due to its newness; all things new are seen as sexy in this world of ours. But nonetheless, Ruby has the following going for it. a. Usage on the Ruby newsgroup is growing much faster than on comp.lang.python in the last year that I have been observing it. A year ago, Python got typically three times as many posts per day as Ruby. Now, its more like a 4:3 ratio, with Python getting say, 4000 per month, and Ruby 3000. At this rate, Ruby could pass Python is afew months, by this measure! (Rest assured, Ptyhonis fdoing much better if mesured by Sourceforge projects, about 1300 to 80). By the way, Just van Rossum's http://starship.python.net/~just/comp.lang.python/ graph of Python newsgroup coverage seems to show a slight decline from over 6000 per month in late-middle 2001 to the current 3500 or so I see on here. Mr. van Rossum said he may not be able to update these any more due to some Yahoo change; anyway, am I interpreting these numbers and trends accurately? Will the Python newsgroup usage turn upwards again? Does it matter? b. Ruby is getting alot of favorable press, and new books are coming out now. First, Pickaxe , now, Matz' own Ruby in a Nutshell and several others soon to be or already here. c. Ruby actually seems to be a nice language to me. Its object oriented features seem well thought out and yet its still easy to comprehend. I will never leave Python behind, but will others? I see quite a few former Pythonistas posting glowing reviews on comp.lang.ruby, but not as many as I see former Perl aficionados. d. Ruby has some smart and aggressive coders doing libraries, extensions, Java version etc. etc. etc., tehy are agressive and motivated; tehy think they will see world domination ;-))) Ruby also has some problems I see: a. Its windows version seems to have lots of problems. Specifically, threading doesn't work well at all on Windows, but that's not the only problem. Ruby on Windows is slow and somewhat buggy; seems to need a re-write and Matz is engaged in an extensive re-write. Who knows how successful? b. Ruby has no where near the libraries Python has, since Ruby is so much newer. But itime never stands still.... What so you all think of Ruby, and its impact on Python? 2. The economy is hurting Python's open source development model. It was bad enough when the core Python coders were jerked around by Be Open; now I am very sad to hear of Mark Hammond's not being with ActiveState anymore? Without Mark Hommond's win32 work, Python would be a mere shell of its current self. A person who has given so much to the Python community as Mr. Hammond, deserves much better. How can an open source community like Python help reward its hard working heroes like Mr. Hammond? Will Guido and his team be next to suffer yet again? If ActiveState can't support Python development, much less a true Python.Net, who can? Will Zope survive financially? We should care. Why doesn't someone form a company to market a first class Zope based ISP service? The Zope folks saids they need such a thing to help promote Zope. If it could not be profitable, is Python and all open source development a mere flash in the pan? Without Mark Hammond, Python windows based development would fall into the sloughs of despond just like Ruby? I hope not. 3. Third, Python faces the laws of large numbers. It is exceedingly hard to continue a growth spurt past a certain point. Maybe were at that point, maybe not. But ask yourself this; Two years from now, will you see more Python success stories, more growth, or a leveling out? Five years from Now? Ten years from now, will Python still be Relevant? Oh, I know that Python will still be being used, and the community will still exist, but will it really be a thing that seems to Matter, like it does now. I like to Look on the brighter side of life, but I also like to win a few Spanish Civil Wars. What do you guys think???? Ron Stephens http://www.awaretek.com/plf.html Python City From yuvale at radware.com Sun Dec 30 11:00:54 2001 From: yuvale at radware.com (yuval) Date: 30 Dec 2001 08:00:54 -0800 Subject: REPOST: Tkinter gui for the winnt subst command Message-ID: <8$--$$_----_%-_%-$@news.noc.cabal.int> I need to map and remap (cmd.exe subst ...) certain directories on my computer very often. Therefore I wrote a Tkinter gui which upon button press performs essentially cmd.exe /c subst ... with various arguments. I tried several approaches (os.popen, os.system,spawnv) for running the command. Unfortunately with all these approaches it takes the command a very, very long time (~30 seconds) to complete. I am running Python 2.1. Does anybody know where the problem lies and how to solve it? ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: yuvale at radware.com (yuval) Newsgroups: comp.lang.python Subject: cmsg cancel <11f1fe5.0112300800.680cb872 at posting.google.com> Control: cancel <11f1fe5.0112300800.680cb872 at posting.google.com> Date: Mon, 31 Dec 2001 04:59:53 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774196 27193 211.57.49.2 (31 Dec 2001 04:49:56 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:49:56 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From eppstein at ics.uci.edu Wed Dec 12 12:12:48 2001 From: eppstein at ics.uci.edu (David Eppstein) Date: Wed, 12 Dec 2001 09:12:48 -0800 Subject: more fun with PEP 276 References: Message-ID: In article , philh at comuno.freeserve.co.uk (phil hunt) wrote: > how about: > > for i in -5 to 5: > > or > > for i in -5 to 5 step 2: > > > Here, "to" and "to...step" are keywords that create an xrange with the > required values Not bad, but seems to force closed intervals only, which is somewhat at odds with other features of Python. -- David Eppstein UC Irvine Dept. of Information & Computer Science eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/ From ktilton at nyc.rr.com Thu Dec 27 04:09:50 2001 From: ktilton at nyc.rr.com (Kenny Tilton) Date: Thu, 27 Dec 2001 09:09:50 GMT Subject: age of new pythonistas [was: The Editor Poll results are in!] References: <60c49aa9.0112202148.7218555b@posting.google.com> Message-ID: <3C2AE63A.24D736F2@nyc.rr.com> Tim Hammerquist wrote: > > Dan Compton graced us by uttering: > > Wait, didn't you give up on Perl before you knew it well enough to make > that kind of statement? Intelligence is all about dealing with partial information. Experience is all about needing less and less information all the time to make accurate judgments. Got those from fortune cookies, FWIW. kenny clinisys From clpy at snakefarm.org Tue Dec 11 01:55:59 2001 From: clpy at snakefarm.org (Carsten Gaebler) Date: Tue, 11 Dec 2001 07:55:59 +0100 Subject: Can't catch SIGUSR1 References: <3C14CB36.F857A0E6@snakefarm.org> Message-ID: <3C15ADFF.9C9C0648@snakefarm.org> Carsten Gaebler wrote: > I'm experiencing a strange problem with this short test script which > is supposed to catch a SIGUSR1: The weird thing is: Perl can catch SIGUSR1. If I strace my python script and send a SIGUSR1, strace doesn't even notice. I'm confused. cg. -- Why settle for snake oil if you can have the whole snake? http://python.org/ From phd at phd.pp.ru Thu Dec 13 06:34:46 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Thu, 13 Dec 2001 14:34:46 +0300 Subject: Calling member functions? In-Reply-To: ; from david_j_dawkins@spamless.hotmail.com on Thu, Dec 13, 2001 at 11:20:52AM -0000 References: Message-ID: <20011213143446.H9671@phd.pp.ru> On Thu, Dec 13, 2001 at 11:20:52AM -0000, David Dawkins wrote: > class Handler: > def Callback(self): > print "Callback called" > > class Notifier: > > def __init__(self, object, method): > self.m_object = object > self.m_method = method > > def notify(self): > ## Now what?? > self.m_method(self.m_object) ## naive attempt ^^^^^^^^ You call a method with one argument, but the Callback method does not accept any arguments. > h = Handler() > n = Notifier( h, h.Callback ) > h.notify() # I want this to do h.Callback() in effect h.notify()? You certainly meant n.notify()! Other than that you naive attempt is pretty close! Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From roblytle at ieee.org Fri Dec 28 18:47:42 2001 From: roblytle at ieee.org (Rob) Date: Fri, 28 Dec 2001 23:47:42 GMT Subject: REPOST: need help with class of arrays which have attibutes Message-ID: <7$--$$_-----$$--%$@news.noc.cabal.int> Hi, I'm trying to contruct a class of arrays which have attributes. This one respresents a wire[] array which can have x,y,z etc coordinates. I just can't figure out how to do it. Here is what I have so far: (it uses Numpy) from Numeric import * class arr: a=zeros((20)) class b: x1=0 y1=0 z1=0 x2=0 y2=0 lz2=0 DelX=0.0 DelY=0.0 DelZ=0.0 class Cond(arr,b): c=arr.b def wire(self): return c I have also tried using mapping, but all the array members end up having the same attributes. Here was the try at that one: wire=map(lambda dummy: Cond(), zeros((20))) In this case, Cond was originally the "b" array above, by itself. Thanks for any help you can give! Rob ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Rob" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:36:03 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774977 27193 211.57.49.2 (31 Dec 2001 05:02:57 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:02:57 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From shalehperry at attbi.com Sun Dec 30 02:54:33 2001 From: shalehperry at attbi.com (Sean 'Shaleh' Perry) Date: Sat, 29 Dec 2001 23:54:33 -0800 (PST) Subject: Reg-Ex and lambda optimization In-Reply-To: Message-ID: > > Daft name, great module though, > look for glob() in your documentation. > > Unsure how I found it with a name like that, > but boy does it do the business! Keep the re package > for file contents, and scour the documentation. > It is named after file globbing, which is what command line shells like UNIX's sh and DOS's command have called it for years. From peter at engcorp.com Sat Dec 29 21:57:41 2001 From: peter at engcorp.com (Peter Hansen) Date: Sat, 29 Dec 2001 21:57:41 -0500 Subject: REPOST: Re: values of sys.platform? for a serial port lib References: <3C2E543D.4BFB07D@engcorp.com> Message-ID: <4$--$$_----__$%--$@news.noc.cabal.int> Chris Liechti wrote: > > Peter Hansen wrote: > > I'd strongly recommend you *not* try to use an > > index origin of 0 but instead pass the open() routine (or > > whatever you have) a *string* naming the serial port. > > i want it to run mainly on win32 and linux. the user of the lib should not > need to care about device names. Very good point. Let me change my recommendation and say don't *prevent* someone from specifying a special-case name for the device. The fact that this matches what you actually did in no way indicates my original comment was wrong or simplistic or any other bad thing. > i also have an optional argument to specify the port string, but when this > is used it isn't portable anymore. Just a thought, but could you make this the same argument as the port number, allowing either an integer or a string? I could also see a benefit, in a cross-platform serial-port app, in having a method to return the actual device name in use, for display/troubleshooting purposes, even if specified as a number. > > By the way, does your win32 implementation work well with > > threads, if one thread is trying to read from the port while > > the other is trying to write to it? > > i haven't tested it that way. i use it in a multi-threaded environment, but > the class that accesses the serial port (and generates binary communication > frames) uses means from the module threading. You may know this already, but in Windows you need to use "overlapped" I/O operations if you want to be able to have a read thread and a write thread waiting independently on operations on the same serial port. Without this, any time one thread is blocked waiting for results for its operation, the other thread will also block when it tries to access the device even if its operation would not otherwise block. (Or something like that... I don't know the full details behind it, only what I learned trying to implement a win32file- based serial port class which didn't have this limitation.) -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Peter Hansen Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E82A5.D4E1EEB3 at engcorp.com> Control: cancel <3C2E82A5.D4E1EEB3 at engcorp.com> Date: Mon, 31 Dec 2001 04:28:50 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774425 27193 211.57.49.2 (31 Dec 2001 04:53:45 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:53:45 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jkraska at san.rr.com Tue Dec 11 22:37:46 2001 From: jkraska at san.rr.com (Courageous) Date: Wed, 12 Dec 2001 03:37:46 GMT Subject: XXX References: Message-ID: On Wed, 12 Dec 2001 11:16:44 +0900, Brian Lee wrote: >Hi > >I'm newbie at Python programming. Sometimes I read ``XXX'' >character as comments in Python source code file. Does that >mean something special? Some color hiliting editors automatically highlight 'XXX' and 'TODO' in a special color to draw attention to the text which follows. Because of the special treatment by the hiliter, one generally uses 'XXX' as alert! note well! read me!. This isn't unique to Python at all. C// From fperez528 at yahoo.com Mon Dec 17 07:15:30 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Tue, 18 Dec 2001 11:43:30 +2328 Subject: dynamic modules References: <9vo01n$9j8$1@news.tpi.pl> Message-ID: <9vo2s4$noo$1@peabody.colorado.edu> Marek Budyn wrote: > Hi! > > I wanted go create dynamically loaded and removed plugins. I mean, id a > module a initalizes with 10 MB data structude, i would like to remove it > from memory if it is not needed eg. > > p1 = import plugin1 > > ... > > unload(p1) > > Is it possible in python ? And if so, how can I do this ? > Thanks for help! import plugin1 as p1 ... del p1 In the next gc pass it should get picked up. f From ullrich at math.okstate.edu Mon Dec 3 13:05:13 2001 From: ullrich at math.okstate.edu (David C. Ullrich) Date: Mon, 03 Dec 2001 18:05:13 GMT Subject: Do 2.2 and 2.1.1coexist well? References: Message-ID: <3c0bbd3c.252211976@news> On Sun, 2 Dec 2001 03:57:12 -0500, "Tim Peters" wrote: >[Ron Turner] >> Is it safe to install and run both 2.2 and 2.1.1 on the same machine? I >> realize that the directory structures are nicely separated, but I am not >> certain whether there may be DLLs or other files that would cause >> contention or loss of state. We don't seek to launch simultaneous >> sessions. We just need to maintain the two installations, if possible. I've been meaning to ask about this, didn't want to sound stupid: >You're apparently running on Windows. Whether it's "safe" depends entirely >on what you do. For example, due to the way Windows works, file extensions >(like .py and .pyw) can be associated with only one executable, so if you're >relying on stuff like "start program.py" working from a DOS box, it will >pick up whichever version of Python you installed most recently. File associations is no problem - people who enjoy such things can have great fun arranging trick ways to send a .py file to various different python.exe's (adding various shell commands, and/or associating .py with something that reads the first line of the file for the name of the executable as in UNIX...) >I personally never use the registry for anything related to Python >(including file extensions -- I never rely on them), and have at least half >a dozen versions of Python installed on my Windows box. No problem. But Python itself seems to use the registry, for example it appears that that's where it reads PYTHONPATH from. So sissys like me get nervous installing a new version if we hope to keep the old one... Right now it looks like all the Python stuff is under HKEY_LOCAL_MACHINE/Software/Python/PythonCore/1.5. Presumably if a person installed 2.x that would appear under PythonCore/2.x without making any changes to PythonCore/1.5? >> Related: Does the "Non-Administrative Install" option (under Advanced >> Options in the 2.2 Wise Install Wizard) offer a straightforward way to >> ensure the separation described above? That directs the DLLs to >> be installed within the 2.2's own directory structure. > >The Windows Python DLLs for 2.2 and 2.1.1 have different names, so there's >no conflict there. Depending on user privilege and OS, it may not be >*possible* to install the Python DLL into a system directory, and the >Non-Admin install option is more aimed at that. Non-Admin install also >writes registry info under HKEY_CURRENT_USER instead of HKEY_LOCAL_MACHINE, >which is again partly an issue of privilege, but also on Win2K is a way for >each user on a machine to have their own file associations (a new feature in >Win2K; can't be done under earlier OSes). > > David C. Ullrich From chrishbarker at attbi.com Fri Dec 14 14:56:16 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Fri, 14 Dec 2001 11:56:16 -0800 Subject: Preserving program structure References: Message-ID: <3C1A5960.4A27136D@attbi.com> David Dawkins wrote: > So I'm using IDLE, and Alt-F5 tells me I have a problem with > indentation. > > It seems I had (inadvertently) mixed tab and space characters. > No amount of "tabbifying" and "untabbifying" resolved the issue, > so I had to shift *everything* to the left-margin, and re-create > the indentation with a consistent scheme (8 space hard tabs). I'm confused. How is it that "untabbifying" didn't resolve it? While you may have had a couple of indentations messed up, I would think that would be a whole lot easier to fix than re-indenting the entire code! By the way, I don't know about IDLE, but PythonWin (and other editors) has a mode that allows you to see tabs and spaces, so you can easily go in a clean out the ones that you don't want. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From sholden at holdenweb.com Mon Dec 31 14:19:25 2001 From: sholden at holdenweb.com (Steve Holden) Date: Mon, 31 Dec 2001 14:19:25 -0500 Subject: Search the difference: Why this function defenition does'nt work? References: <3C260A92.5030907@student.kun.nl> <3C261778.60108@student.kun.nl> <3C2646FB.7000000@student.kun.nl> Message-ID: "husam" wrote, after much discussion, ... [ ... ] > >>>>I'm not trying to add string to a list of integeres. What I wanted to do > >>>>is to add each argument of func2('a','b','c') to sum=['e']. Since sum is > >>>>a list of chars, and the arguments are accessable as a sequence, one > >>>>would expect that the addition operation would be correct. On the > >>>>interactive shell, it is a trivial operation. But, only when i use it in > >>>>the function defenition i get problems. Adding 'a' to ['b'] does not > >>>>work, but adding list('a') to ['b'] it does, so, i thought that this > >>>>might help my code, but converting the args to a list did not helpe > >>>>either . I really didn't get yet! > >>>> [Aahz]: > >>>use list.append() > >>> [husam]: > >>I know that this works, but it does not help my understanding! > >> > > [Aahz]: > > What don't you understand? The '+' operation in Python applies to types > > that are more-or-less equivalent. You can't do this, either: > > > > > >>>>t='a', > >>>>t > >>>> > > ('a',) > > > >>>>l=['b'] > >>>>l > >>>> > > ['b'] > > > >>>>l+t > >>>> > > Traceback (most recent call last): > > File "", line 1, in ? > > TypeError: can only concatenate list (not "tuple") to list > > > > The '+' operation for lists is equivalent to list.extend(). > > [husam]: > > yes, but the arguments are passed as a tuple and the addition still not > working even after converting it to a list with: list(x) > > your example shows an illegal addition operation, i agree with you, but > what i'm doing is adding items of a list of chars to sum=['a'], which > doesn't work only when i do sum=args[0]. > I see no difference between sum=['a'] and sum=args[0], simply because > args[0] is the first index of the arguments list passed to the function. > args[0] is nothing but one char 'b' or whatever char. > What you appear to have failed to notice is that sum = ['a'] is *not* the same as sum = args[0] which is equivalent to sum = 'a' Although you are correct in your assumption that strings can be treated as sequences os characters, this does *not* allow you to mix strings and lists in the same operation. Therefore, in your second example, when you initialize your sum using sum=args[:0] you are creating a list, containing the first element of the args list. You can append further elements to this list using sum.append(x), and you can add other lists using sum = sum + lst. You cannot treat this list containing a single string element the same as a string. Your second funtion could be written: def fun2 (*args): sum=args[0] for next in args[1:] sum=sum+next return sum in which case it would return a STRING (the concatenation of all the strings supplied as arguments), or it could be written def fun2 (*args): sum=args[:0] for next in args[1:] sum.append(next) return sum in which case it would return a LIST containing the elements of the argument list. regards Steve -- http://www.holdenweb.com/ From kfarmer at thuban.org Thu Dec 6 03:51:44 2001 From: kfarmer at thuban.org (Keith Farmer) Date: Thu, 06 Dec 2001 08:51:44 GMT Subject: ANN: PyAppBar (win32) (beta) Message-ID: http://www.thuban.org/projects Allows the creation of a win32 appbar, using the win32 extensions. wxAppBarDemo.pyw uses the PyAppBarFrame class to make an appbar of a wxPython frame. It will start with a window in the middle of the screen. Left-click the window to exit. Right-click will cycle the window between undocked and docked to the top, left, right, and bottom states. The size of the undocked window is saved. Known Bug: changing the taskbar's always-on-top status, or the autohide status will probably freeze both the taskbar and the appbar. Killing the Python process will release the taskbar. If anybody can help me fix the problem, I'd certainly appreciate it. My knowledge of win32 debugging is rather poor. I figure this opens up the possibility of creating an appbar to run python applets inside of, which I think would be just plain nifty. Any takers? ---------- Keith J. Farmer kfarmer at thuban.org http://www.thuban.org From e.leunissen at fake.nl Thu Dec 13 10:46:33 2001 From: e.leunissen at fake.nl (Erik Leunissen) Date: Thu, 13 Dec 2001 16:46:33 +0100 Subject: Does httplib support keep-alive connections? Message-ID: <3C18CD59.4030100@fake.nl> Hello, The subject header says it pretty much. Thanks in advance for any info. Greetings, Erik Leunissen. -- Replace `fake' by `hccnet' to obtain the real e-mail adres. From grante at visi.com Thu Dec 20 16:29:23 2001 From: grante at visi.com (Grant Edwards) Date: Thu, 20 Dec 2001 21:29:23 GMT Subject: Raw sockets References: <2c55c8be.0112201244.2e4e1027@posting.google.com> Message-ID: In article <2c55c8be.0112201244.2e4e1027 at posting.google.com>, Ben Ainsworth wrote: >> [1] If you're going to use tcp, then why do you need raw sockets? > > I've got the impression that you need the tighter control over > TCP that raw sockets allows, Tighter control than raw sockets? Raw sockets is as low-level as it gets. You even have to put the Ethernet addresses in yourself. -- Grant Edwards grante Yow! Do you need at any MOUTH-TO-MOUTH visi.com resuscitation? From loewis at informatik.hu-berlin.de Fri Dec 21 17:34:56 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 21 Dec 2001 23:34:56 +0100 Subject: distutils problem with interdependent modules References: Message-ID: "Daniel Wexler" writes: > C1, C2 - two pure C libraries (i.e.. not Python extensions) > P1, P2 - two C extension modules > > C2 requires functions in C1 > P1 requires functions in C2 > P2 requires functions in P1 and C1 Please don't do that. On Unix, P2 cannot see any symbols from P1. Never mis-use an extension module as a shared library. Regards, Martin From raiseexception at yahoo.com Wed Dec 19 12:56:48 2001 From: raiseexception at yahoo.com (Raise Exception) Date: 19 Dec 2001 09:56:48 -0800 Subject: Help! py2exe or Standalone.py fails with M2Crypto, can't find M2Crypto.SSL.S??? Message-ID: <97706cb6.0112190956.49d80d20@posting.google.com> Hi, I'm trying to generate a standalone EXE file using a pretty simple program I wrote. It uses some of the usual Python modules, Tk, and M2Crypto. When I use the py2exe program and McMillans's Standalone.py, using M2Crypto generates the same error. I can even generate the error by simply creating a "test.py" file with just one line containing "import M2Crypto". py2exe says: D:\test\dist\test>test Traceback (most recent call last): File "", line 195, in ? File "", line 193, in _force_imports File "imputil.pyc", line 98, in _import_hook File "", line 43, in _import_top_module File "imputil.pyc", line 207, in import_top File "imputil.pyc", line 262, in _import_one File "", line 118, in _process_result File "M2Crypto\__init__.pyc", line 15, in ? File "imputil.pyc", line 88, in _import_hook File "imputil.pyc", line 334, in _do_import File "imputil.pyc", line 262, in _import_one File "", line 118, in _process_result File "M2Crypto\SSL\__init__.pyc", line 15, in ? File "imputil.pyc", line 88, in _import_hook File "imputil.pyc", line 334, in _do_import File "imputil.pyc", line 262, in _import_one File "", line 118, in _process_result File "M2Crypto\SSL\Context.pyc", line 8, in ? File "imputil.pyc", line 88, in _import_hook File "imputil.pyc", line 334, in _do_import File "imputil.pyc", line 262, in _import_one File "", line 118, in _process_result File "M2Crypto\SSL\cb.pyc", line 9, in ? File "imputil.pyc", line 88, in _import_hook File "imputil.pyc", line 334, in _do_import File "imputil.pyc", line 262, in _import_one File "", line 118, in _process_result File "M2Crypto\SSL\Connection.pyc", line 16, in ? File "imputil.pyc", line 127, in _import_hook File "", line 91, in _finish_import File "imputil.pyc", line 324, in _import_fromlist ImportError: cannot import name M2Crypto.SSL.S Standalone.py says: Traceback (most recent call last): File "", line 1, in ? File "D:\distrib\Installer\iu.py", line 250, in importHook mod = _self_doimport(nm, ctx, fqname) File "D:\distrib\Installer\iu.py", line 318, in doimport exec co in mod.__dict__ File "d:\python21\lib\M2Crypto\__init__.py", line 15, in ? import SSL File "D:\distrib\Installer\iu.py", line 250, in importHook mod = _self_doimport(nm, ctx, fqname) File "D:\distrib\Installer\iu.py", line 318, in doimport exec co in mod.__dict__ File "d:\python21\lib\M2Crypto\SSL\__init__.py", line 15, in ? from Context import Context File "D:\distrib\Installer\iu.py", line 250, in importHook mod = _self_doimport(nm, ctx, fqname) File "D:\distrib\Installer\iu.py", line 318, in doimport exec co in mod.__dict__ File "d:\python21\lib\M2Crypto\SSL\Context.py", line 8, in ? import cb File "D:\distrib\Installer\iu.py", line 250, in importHook mod = _self_doimport(nm, ctx, fqname) File "D:\distrib\Installer\iu.py", line 318, in doimport exec co in mod.__dict__ File "d:\python21\lib\M2Crypto\SSL\cb.py", line 9, in ? import Connection, Context File "D:\distrib\Installer\iu.py", line 250, in importHook mod = _self_doimport(nm, ctx, fqname) File "D:\distrib\Installer\iu.py", line 318, in doimport exec co in mod.__dict__ File "d:\python21\lib\M2Crypto\SSL\Connection.py", line 16, in ? SSLError = getattr(__import__('M2Crypto.SSL', globals(), locals(), 'SSLError'), 'SSLError') File "D:\distrib\Installer\iu.py", line 287, in importHook raise ImportError, "%s not found in %s" % (nm, ctx) ImportError: S not found in M2Crypto.SSL Note that if I run my program in the interpreter, everything runs fine. I don't know what is causing M2Crypto to try and find a module called "SSL.S". Has anyoneone else ran into this? Of course I'm going to dig thru it, but I'm on a schedule and would rather fix it first then figure it out later. :) TIA. From mjais at web.de Thu Dec 13 08:40:19 2001 From: mjais at web.de (Markus Jais) Date: Thu, 13 Dec 2001 14:40:19 +0100 Subject: python and SOAP?? Message-ID: hello I saw at soapware.org, that there are at least 2 SOAP implementations for python supporting both client and server development. one is SOAP.py in version 0.97 from Cayce Ullman and Brian Matthews. and the other is a implementation from pytonware. does anybody have experience with these modules??? the latest stable version of the pythonware module is 18 months old. is this project dead???? the SOAP.py seems to be under active development. can anybody recommend me which one to choose??? or what the differences are?? thanks a lot markus From root at [127.0.0.1] Sun Dec 9 01:52:46 2001 From: root at [127.0.0.1] (nobody) Date: Sun, 9 Dec 2001 16:52:46 +1000 Subject: Hiding stuff like passwords in source? References: <3c127bc8$0$29049$afc38c87@news.optusnet.com.au> <1007871781.601711@yabetcha.sttl.drizzle.com> Message-ID: <3c130a3f$0$2581$afc38c87@news.optusnet.com.au> > Can't protect them from prying eyes covers a lot of UNIX platforms. > It's more like "don't" than "can't" - enviroment variables just aren't > subject to any kind of access control, and if you think "well, they Eep! > should be!", I suppose next you won't want us to be able to see your > commands and parameters, etc. Well then replace the if os.getenv() bit with a test for an external file, if it exists import it's contents. The important thing is to put the 'constants' at the top so they're easily seen, and properly protect the more complex code lower down so if a file doesn't exist etc. it doesn't crash. From wurmy at earthlink.net Sun Dec 30 00:30:12 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Sun, 30 Dec 2001 05:30:12 GMT Subject: Paramaterized local variable name References: <9c3f2e9c.0112292115.6a4e22af@posting.google.com> Message-ID: <3C2EA509.63ACDDC9@earthlink.net> Tim Cera wrote: > > Hello, > > I have the following code: > > def paging(data, key, query_dict): > for i in range(0, len(data[key]), use_pagesize): > start = data[key][i].name > ...etc. > > which works fine for data[key][i].name, but sometimes I want this > function to process data[key][i].rev. > > So, if local_name is equal to 'name' or 'rev' or 'whatever', what I > want is something like: > > def paging(data, key, query_dict, local_name): > for i in range(0, len(data[key]), use_pagesize): > start = data[key][i]. > # What goes here ^^^^ ? You probably want start = getattr(data[key][i], local_name) Now you can set local_name to a string "name" or "rev" or whatever attribute of data[key][i] you want to access. --Hans From maarten at kittensandcats.net Sat Dec 29 18:27:20 2001 From: maarten at kittensandcats.net (Maarten Wiltink) Date: Sun, 30 Dec 2001 00:27:20 +0100 Subject: REPOST: Re: Was that to inpolite? Re: Call for a small program References: <3C2BAEF3.CC34B8DD@htp-tel.de> <3C2E0D55.9EC9B67F@htp-tel.de> Message-ID: <5$--$$_----___%%%$@news.noc.cabal.int> Tom Karas wrote in message <3C2E0D55.9EC9B67F at htp-tel.de>... >Hello out there. > >A few quick questions: > > Was my "Call" to inpolite? > > Was it the wrong place / newsgroup to ask? > >I just wonder, because there wasn?t even a reaction like "Go away" or >"Plonk / Killfile" > >This may sound odd, but i would be even willing to pay for a solution >that would >fit the basic needs (running on windows and linux and some features) I was out for a week and seem to have missed your initial post. (And, I'm too lazy to go look it up.) Generally, if there is no flaming, but no answer either, nobody may know it, or everybody may think someone else will get the door. (And generally, if you know words like "plonk", you're sufficiently familiar with netiquette that you don't have to worry about it.) Speaking just for myself, my time is either my boss's or my own. Contact him, not me, for paid jobs and in the other case, don't ever offer me money. I'm here strictly for entertainment purposes. Groetjes, Maarten Wiltink ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Maarten Wiltink" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:27:40 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774492 27193 211.57.49.2 (31 Dec 2001 04:54:52 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:54:52 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From chrishbarker at attbi.com Fri Dec 28 13:54:14 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Fri, 28 Dec 2001 10:54:14 -0800 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: <3$--$$_----_-%$$%$@news.noc.cabal.int> Alex Martelli wrote: > What huge firm[s] might possibly make a > similar decision in the case of Python? And why? I don't know what firms would do it, but the "why" is the same as for JAVA: The more popular a platform independent/nuetral development language/tool is, the weeker Microsoft's grip on the market is. Right now, if an organisation uses VB for development, they can only deploy on Windows. In order to deploy on another platform , they would have to learn a whoilw new language/development enviroment, and port their products to it. If they, instead were using Python with, for example, wxPython for the GUI, the decision to support another platform would involve only minor learning and porting. This is good for everyone that stands to benifit from people using a non-windows platform (Apple, Sun, the Linux and *BSD vendors, etc.) That is exactly why there is no VB (or MFC) for any non-MS platform. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Chris Barker Newsgroups: comp.lang.python Subject: cmsg cancel <3C2CBFD6.21A7FC6C at attbi.com> Control: cancel <3C2CBFD6.21A7FC6C at attbi.com> Date: Mon, 31 Dec 2001 03:19:51 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775151 27193 211.57.49.2 (31 Dec 2001 05:05:51 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:05:51 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From claird at starbase.neosoft.com Fri Dec 28 09:10:14 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 28 Dec 2001 08:10:14 -0600 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: <0$--$$_----_-%-%%$@news.noc.cabal.int> In article , Alex Martelli wrote: . . . >in it for them? Can you even FIND OUT what programming >languages are in fact used by the various departments >and fiefs of these large organizations? Sometimes. Let me warn the inexperienced, though: even when you think you know the answer--because, for example, the company president has chosen to assert a technical proposition like, "Java helped us blah-blah"--there's no guarantee that the public information corresponds to the inside reality. I have ABUNDANT evidence on this score. Organizations often "dis- inform", and at least as often, they have poor collective intelligence about their own behavior. . . . >This tells us nothing about marketing _technologies_ >as opposed to products and services. In that field, >Sun's very successful efforts at marketing Java may >be more instructive. But, who has a billion dollars >available to throw at the task? And how to they plan >to recoup the investment? Sun has presumably judged >that opposing Microsoft's dominance has huge strategic >value for them: they don't make money directly out of >Java (not, by far, enough to make the huge marketing >investments profitable), but apparently they think >they're getting value for money through other revenue >channels. What huge firm[s] might possibly make a >similar decision in the case of Python? And why? An intriguing question, to which we per- haps shall return later. . . . -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: claird at starbase.neosoft.com (Cameron Laird) Newsgroups: comp.lang.python Subject: cmsg cancel <5162AA73D84B5DBA.D2515DB62E721798.F62643D4812CA388 at lp.airnews.net> Control: cancel <5162AA73D84B5DBA.D2515DB62E721798.F62643D4812CA388 at lp.airnews.net> Date: Mon, 31 Dec 2001 03:54:44 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775409 27193 211.57.49.2 (31 Dec 2001 05:10:09 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:10:09 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From BPettersen at NAREX.com Tue Dec 11 16:13:30 2001 From: BPettersen at NAREX.com (Bjorn Pettersen) Date: Tue, 11 Dec 2001 14:13:30 -0700 Subject: input Message-ID: <60FB8BB7F0EFC7409B75EEEC13E20192158C94@admin56.narex.com> > From: Preben [mailto:preben_er_t0ff at hotmail.com] > > How do I make a unbufferedinput from the user? > (So they don't have to hit enter to send) > > Is it possible to make it so that you don't see what you're > typing.. e.g. to logins? or maybe replacing the output with * ?? If you're on Windows the msvcrt module is your friend >>> import msvcrt >>> while 1: ... c = msvcrt.getch() ... print 'you typed', c ... if c == 'q': break ... you typed a you typed b you typed c you typed d -- bjorn From Bruce at EckelObjects.com Fri Dec 7 11:13:49 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Fri, 07 Dec 2001 08:13:49 -0800 Subject: OK, now *this* is cool In-Reply-To: References: Message-ID: <200112070813490000.002076B3@mail.rdc1.sdca.home.com> I think so, at least. Based on Tim's pointer about __subclasses__() in 2.2, I can automatically generate an instance of all of my subclasses. class Flower(object): def __repr__(self): return self.__class__.__name__ class Gladiolus(Flower): pass class Runuculus(Flower): pass class Chrysanthemum(Flower): pass class Rose(Flower): pass class CrystalPassion(Rose): pass print [Klass() for Klass in Flower.__subclasses__()] Output: [Gladiolus, Runuculus, Chrysanthemum, Rose] Note that you'd have to do a recursive call to get all the classes in the tree, as __subclasses__() only goes one level down. Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From timr at probo.com Sun Dec 30 17:28:16 2001 From: timr at probo.com (Tim Roberts) Date: Sun, 30 Dec 2001 14:28:16 -0800 Subject: REPOST: Re: Python and Ruby: a comparison References: <3C2B9A61.EE1618DB@earthlink.net> <2WpX7.1145$0s5.714029@news20> <3C2E6876.4CBF45D4@geneva-link.ch> Message-ID: <2$--$$_----__$--%$@news.noc.cabal.int> Boris Borcic wrote: >Conrad Schneiker wrote: > >> So my question is: at such a presently entirely hypothetical future >> juncture, is there any practical and desirable middle ground for a common >> single successor language to the current generations of Python and Ruby? > >What would be fun is to have library interoperability completed >with interlingual source-to-source conversion from adequately >constrained style... premitting more or less, to use one's language >superficial idioms to mean corresponding idioms in the other >language. Oddly enough, I believe that is almost exactly what Bill Gates believes he has created with .NET and the common language runtime. -- - Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!zeus.visi.com!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Tim Roberts Newsgroups: comp.lang.python Subject: cmsg cancel <465v2u4lv3illoviq19nhdf1r2vcknbakn at 4ax.com> Control: cancel <465v2u4lv3illoviq19nhdf1r2vcknbakn at 4ax.com> Date: Mon, 31 Dec 2001 03:09:44 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774033 27193 211.57.49.2 (31 Dec 2001 04:47:13 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:47:13 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From kseehof at neuralintegrator.com Thu Dec 13 20:51:18 2001 From: kseehof at neuralintegrator.com (Ken Seehof) Date: Thu, 13 Dec 2001 17:51:18 -0800 Subject: neural networks References: <3C17DA8F.931CAE22@gol.ge> <9v8qkf$l7p$1@samson.globalone.no> Message-ID: <013201c18443$dc6b9d80$d446b43f@kens> > "Giorgi Lekishvili" skrev i melding > news:3C17DA8F.931CAE22 at gol.ge... > > hello all! > > > > I wonder if someone could indicate on a Python-written Neural Netowork > > resources... > > > > Will SciPy ever contain it? > > > > Thank you, > > Giorgi > > > > Check out: > http://www.python.org/doc/PyCPP.html > > > http://starship.python.net/crew/seehof/NeuralPython.html > > Anyone know where the code for NeuralPython/NeuralIntegrator can be found?? > > -- > Thor A. Johansen Neural Integrator is not released yet. We are still debating license issues (i.e. we need to be conviced, and need a VC that is convinced, that there is a specific way to make a reasonable profit if the whole thing is open source). There should be a beta out soon (Feb) that implements a backpropagation learning module within a very general purpose connectionist framework (python and c++) with a graphical map editor (no, the GUI will not get in the way of *nix geeks; it's script friendly too). The site has moved to: www.neuralintegrator.com Regards, Ken kseehof at neuralintegrator.com From mertz at gnosis.cx Thu Dec 27 16:07:22 2001 From: mertz at gnosis.cx (Lulu of the Lotus-Eaters) Date: Thu, 27 Dec 2001 16:07:22 -0500 Subject: A new message board is up (fwd) Message-ID: > I always wonder why people put "web forums" in place. I can't read > them while being off-line (e.g. on the train) and they are damn > slow. Newsgroups and mailing lists are the right medium for this > kind of communication. |Eh, they have their purpose. They're easier to set up than a |newsgroup, and more widely accessible (decent browsers are more widely |distributed than decent newsreaders). |And the membership/registration requirements are |somewhere in between Usenet (none) and mailing lists (members only). I'm also solidly in the pro-NNTP camp. One of the things I have always disliked about places like /. is the use of a web forum when an NNTP gateway would be so obviously more appropriate (and my userID on /. is in the low four-digit range). In terms of the alleged advantages of web forums, I really do not see any of the proposed ones. Setting up a mailing list is extremely simple if you use a majordomo or listserv. Just send a few admin messages--you need to read the details, but this is easier than learning Apache (let alone a web-list server package). Moreover, depending on what you mean by decent, both Netscape/Mozilla and IE-Outlook let you read both mailing lists and newsgroups (I wouldn't use those myself, but they are certainly more than adequate for browsing... and better than most web forums). With Usenet, it is perfectly possible to create a moderated newsgroup that only accepts posts from members. That would certainly not be appropriate for c.l.python, but in principle one has this choice. Everyone can still read them, of course. With a mailing list you can either restrict posting or reading--or both or neither. One of the worst things about web forums is that they are damn hard to archive personally. I have mail and news archives on my personal system going back to 1993, with instant offline indexing, and organization into categories that make sense to me. What I have kept is a tiny, tiny fraction of what groups.google.com now has... but it is the stuff that *I* wanted to save, for whatever reason (in truth, I'm unlikely to refer back to eight year old posts... but sometimes to the one year old ones). And many of the mailing lists I have received over time are not archived anywhere I know of, so my personal copies are irreplaceable. In contrast, it is nearly impossible to save a web forum post that I find interesting. If it is -really- important, I can cut-and-paste, save-as-file, try-to-organize. But there is a lot of manual work involved. The maintainer of the web forum *might* provide a decent archive... unless they go out of "business", or their server goes down, or they have a software error, or the change their minds, or... Yours, Lulu... From curtin at ubsw.com Sat Dec 15 10:28:36 2001 From: curtin at ubsw.com (craig curtin) Date: 15 Dec 2001 07:28:36 -0800 Subject: quick eval question Message-ID: <4c7395cb.0112150728.2275ad75@posting.google.com> hi, i'm looking to do something like this but my brain is failing... i = [1,2,3,4,5] j = '[2]' k = eval( i j ) ie. i want to get k = 3 ... From guido at python.org Fri Dec 21 14:54:36 2001 From: guido at python.org (Guido van Rossum) Date: Fri, 21 Dec 2001 14:54:36 -0500 Subject: RELEASED - Python 2.2 final Message-ID: <200112211954.OAA16972@cj20424-a.reston1.va.home.com> On December 21, just in time to be placed under the Christmas tree, we're issuing the final release of Python 2.2. We're proud of this release, and expect that you'll like it. Please check it out here: http://www.python.org/2.2/ Our thanks to everyone who helped test Python 2.2 during the alpha, beta and release candidate phases, and to everyone who contributed patches, feedback, and suggestions! Please continue to report any bugs you find to the bug tracker: http://sourceforge.net/bugs/?group_id=5470 Highlights of what's new for this release are outlined below. For a more complete list, please see: http://sf.net/project/shownotes.php?release_id=?????? What's new since 2.1 -------------------- In brief (for PEPs, see http://www.python.org/peps/): - type/class unification (PEP 252 and 253) - iterators (PEP 234) and generators (PEP 255) - nested scopes standard (PEP 227) - int overflows return longs (PEP 237) - new operator // to future-proof int division (PEP 238) Andrew Kuchling has written a gentle introduction to the most important changes, titled "What's New in Python 2.2": http://www.amk.ca/python/2.2/ A thorough introduction to the type/class unification is at: http://www.python.org/2.2/descrintro.html Status of the type/class unification ------------------------------------ With a set of changes as large as this, it's unavoidable that after the release we'll find that there are certain things that would work better if we did them a little differently. Also, it is clear that some of the new features (e.g. class and static methods, properties, super, and slots, to mention a few) could use additional syntactic sugar to make their use easier and more intuitive. This will almost certainly require us to make changes in future releases. However, with the release of these features as part of the Python 2.2 release, we are committed to the same standard of release-to-release compatibility that we have used in the past, as explained in PEP 5. When we feel the need to change things, we'll use the PEP system to propose changes, and we'll provide warnings and backwards compatiblity for at least a year -- or more in cases where a year is deemed too short by the user community. In the meantime, we'll work on completing the documentation for these features (both in Python and in the C API) as they are found in Python 2.2. This documentation will clarify the status of individual features. What's new since 2.2c1 ---------------------- (Adapted from the Misc/NEWS file.) Type/class unification and new-style classes - pickle.py, cPickle: allow pickling instances of new-style classes with a custom metaclass. Core and builtins - weakref proxy object: when comparing, unwrap both arguments if both are proxies. Extension modules - binascii.b2a_base64(): fix a potential buffer overrun when encoding very short strings. - cPickle: the obscure "fast" mode caused stack overflows on the Mac. We fixed this by setting the recursion limit much smaller. If the limit is too low (it only affects performance), you can change it by defining PY_CPICKLE_FAST_LIMIT when compiling cPickle.c (or in pyconfig.h). Library - dumbdbm.py: fixed a dumb old bug (the file didn't get synched at close or delete time). - rfc822.py: fixed a bug where the address '<>' was converted to None instead of an empty string (also fixes the email.Utils module). - xmlrpclib.py: version 1.0.0; uses precision for doubles. - test suite: the pickle and cPickle tests were not executing any code when run from the standard regresssion test. Windows - distutils package: fixed broken Windows installers (bdist_wininst). - tempfile.py: prevent mysterious warnings when TemporaryFileWrapper instances are deleted at process exit time. - socket.py: prevent mysterious warnings when socket instances are deleted at process exit time. - posixmodule.c: fix a Windows crash with stat() of a filename ending in backslash. Mac - The Carbon toolbox modules have been upgraded to Universal Headers 3.4, and experimental CoreGraphics and CarbonEvents modules have been added. All only for framework-enabled MacOSX. --Guido van Rossum (home page: http://www.python.org/~guido/) From jdhunter at nitace.bsd.uchicago.edu Mon Dec 10 09:13:30 2001 From: jdhunter at nitace.bsd.uchicago.edu (John Hunter) Date: Mon, 10 Dec 2001 08:13:30 -0600 Subject: help with installing pymat on linux RH7.1 References: Message-ID: >>>>> "Les" == Les Ander writes: Les> this is refering to the matlabs libeng.so library Les> I don't know how to fix this, can some one suggest someway to Les> fix this? thanks les I think you need to set your LD_LIBRARY_PATH to include the dir with libeng.so. I use tcshrc, which uses setenv, and I have setenv LD_LIBRARY_PATH .:/usr/local/lib:/usr/lib:/usr/X11R6/lib:/usr/local/matlab/extern/lib/lnx86:/usr/local/matlab/sys/os/lnx86/ for sh and bash, you would do export LD_LIBRARY_PATH=.:/usr/local/lib:/usr/lib:/usr/X11R6/lib:/usr/local/matlab/extern/lib/lnx86:/usr/local/matlab/sys/os/lnx86/ Just change the paths to reflect the locations of the libs on your system. John Hunter From syver-en+usenet at online.no Fri Dec 28 01:18:03 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 28 Dec 2001 07:18:03 +0100 Subject: REPOST: Re: SSL Sockets in Windows References: Message-ID: <4$--$$_--_--_-%$-$@news.noc.cabal.int> Hi Al, I'm not exactly an expert on SSL :-). I know it's what goes on behind the scenes when my browser uses an https url and communication is encrypted and whatnot. Do you have (or can you refer me to) a quick example to check that SSL is indeed working on Python? -- Vennlig hilsen Syver Enstad ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail Message-ID: Control: cancel Subject: cmsg cancel From: Syver Enstad Newsgroups: comp.lang.python X-No-Archive: yes Lines: 2 NNTP-Posting-Host: wonenara.ozemail.com.au X-Trace: ozemail.com.au 1009643103 203.108.164.177 (Sun, 30 Dec 2001 03:25:03 EST) NNTP-Posting-Date: Sun, 30 Dec 2001 03:25:03 EST Organization: OzEmail Ltd, Australia Distribution: world Date: Sat, 29 Dec 2001 13:32:11 GMT This message was cancelled from within Mozilla. From hancock at anansispaceworks.com Fri Dec 21 18:04:30 2001 From: hancock at anansispaceworks.com (Terry Hancock) Date: Fri, 21 Dec 2001 15:04:30 -0800 Subject: Modifying environment variables Message-ID: <3C23BFFE.A4369345@anansispaceworks.com> Hi, I've been using Python for a lot of different programming tasks, but haven't experimented with it much as a scripting language. In my current problem, I needed a smarter way to parse user's "PATH" (Solaris/UNIX environment), so I implemented a simple program which uses the os module to break up the path, do some simple tests on it and reassemble it. However, all this work is wasted, because after I leave the script, the PATH is unaffected. It seems that assigning values to os.environ['PATH'] can affect subshells, but not the one I'm running the script from. Is there a way to get around this limitation? It would be a lot nicer if I could just call the script from the users' .cshrc file (I should've mentioned that they are invariably using csh or tcsh). Thanks for any pointers. Terry (please CC). -- ------------------------------------------------------ Terry Hancock hancock at anansispaceworks.com Anansi Spaceworks http://www.anansispaceworks.com P.O. Box 60583 Pasadena, CA 91116-6583 ------------------------------------------------------ From jlh at home.com Sun Dec 2 21:28:55 2001 From: jlh at home.com (Jeff Hinrichs) Date: Sun, 2 Dec 2001 20:28:55 -0600 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <100d01c17ba0$1e2f6190$6702a8c0@gato> Message-ID: <10dd01c17ba2$418aac10$6702a8c0@gato> > Be comforted to know the LORD has told me, to tell you, you will be saved > for spreading the good word... > > > @home.com > > ...though he says he can only do so much to keep your connection up. I'm of the cox'ian @home persuasion which means I'm still up, but Ma'Bell got sent to hell From peter at engcorp.com Thu Dec 6 20:49:55 2001 From: peter at engcorp.com (Peter Hansen) Date: Thu, 06 Dec 2001 20:49:55 -0500 Subject: Is it possible to kill a thread ? References: <9unnfb$6fp$1@wanadoo.fr> <3C0FCD72.A5FA167C@ccvcorp.com> Message-ID: <3C102043.A1BD81E0@engcorp.com> Grant Edwards wrote: > > In article <3C0FCD72.A5FA167C at ccvcorp.com>, Jeff Shannon wrote: > > Create a threading.Event object, and pass it to the thread at startup. When > > you want to close the application, set the event, and then join() the thread. > > In the thread, you periodically check the event. When the event becomes set, > > then the thread terminates itself. At that point, your main thread returns > > from join() and you can finish shutting down. > > The problem with this is that one often creates a thread so > that it can do some possibly blocking operation without > stopping the rest of the program. If the thread is blocked, it > can't check the event. If the thread isn't going to block, > then why create a thread? [Yes, there are other reasons for > splitting something into a thread, but in many cases I create a > thread specifically because it's goign to block.] Have the thread block with a timeout. Periodically wake up and check the signal that asks it to die... (In Python this is the only clean and practical way to make this work, AFAIK.) -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From LLoeffler at home.com Mon Dec 3 02:46:49 2001 From: LLoeffler at home.com (Luke) Date: Mon, 03 Dec 2001 01:46:49 -0600 Subject: Regular expression as dictionary key? Message-ID: <3C0B2DE9.5040308@home.com> Let's say you have a dict of words like words = {"dogs":1,"cats":2} Let's say I'm given a singular form of a word and want to match it with plurals still, but words["dog"] will obviously raise a KeyError. Without doing a linear substring search on every element in words.key(), is there a way to take advantage of the dict's binary tree layout properties (e.g. speed) like: words["dog*"] # where dog* is a Regex Nonexistant syntax, I know, but you get the idea... I smell a PEP Luke From aahz at panix.com Fri Dec 21 18:07:04 2001 From: aahz at panix.com (Aahz Maruch) Date: 21 Dec 2001 15:07:04 -0800 Subject: Platform-independent GUID creation? References: <789798cc.0112211457.10505b9c@posting.google.com> Message-ID: In article <789798cc.0112211457.10505b9c at posting.google.com>, Jeff Koftinoff wrote: >"Steve Holden" wrote in message news:... >> >> Whatever. I'll settle for a Unix "create GUID" routine and one >> for the Mac (I would assume for these purposes that OSX shold be >> treated like some flavor of U*ix?). These could be included along >> with the win32 CreateGuid() and a platform choice to give something >> *reasonably* portable. > >The problem of course with creating a GUID this way is that it REQUIRES >the computer to have an ethernet adapter. > >I got bitten by this one before when some clients only had modems, and >my app needed to create a GUID on their computer. Close, but not quite. The standard does specify a mechanism for creating GUIDs with computers that don't have network adapters, but it specifically doesn't guarantee that they will be truly unique. If your system was closed, you could assign each client a unique base for generating GUIDs. Better, though (particularly if there's any chance your system will need to interoperate with others (or if there's a mixture of clients)), would be to generate GUIDs on the server and download batches to the clients. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 10 days and counting From gerson.kurz at t-online.de Sat Dec 29 10:44:35 2001 From: gerson.kurz at t-online.de (Gerson Kurz) Date: Sat, 29 Dec 2001 15:44:35 GMT Subject: Two languages, too similar, competing in the same space. References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> Message-ID: <3c2de385.9780406@news.t-online.de> On Thu, 27 Dec 2001 22:56:29 GMT, Ron Stephens wrote: >I feel that Ruby is so similar in design, purpose, and objectives to >Python, that it competes directly with Python for developers' mind share. Here are some comments on the "Features of Ruby", as advertised on http://www.ruby-lang.org/en/whats.html. > Ruby has simple syntax, partially inspired by Eiffel and Ada. I would consider neither Eiffel nor Ada having a inspiring and simple syntax. Eiffel is for business people who have outgrown COBOL. I think the Python syntax is by far the cleanest syntax I've seen; and that Ruby has *a lot* of perlisms in it. > Ruby has exception handling features, like Java or > Python, to make it easy to handle errors. Call me oldfashioned, but I don't like exception handling - I like if-then-else and error checking style. Exception handling is cool for exceptions - that is: *unlikely* situations -, but it is not cool for something as commonplace as open() failing because the file doesn't exist. > Ruby's operators are syntax sugar for the > methods. You can redefine them easily. There was once an aprils-fool joke called "Generalizing Overloading for C++ 2000" (See http://www.research.att.com/~bs/whitespace98.pdf). So much for the need to redefine operators. > Ruby is a complete, full, pure object oriented > language: OOL. This means all data in Ruby is > an object, not in the sense of Python or Perl, > but in the sense of Smalltalk: no exceptions. > Example: In Ruby, the number 1 is an instance > of class Fixnum. I've always found it terrible that languages try to *force* a paradigm onto your code. As wittness java: isn't it a joke that "everything has to be a class" and then they introduce static member functions just to get a main()? I like pythons pragmatic approach *much* better: You can do OOP where you need it, and use other things when you feel like it. > Ruby features single inheritance only, *on purpose*. > But Ruby knows the concept of modules (called > Categories in Objective-C). Modules are collections > of methods. Every class can import a module and so > gets all its methods for free. Some of us think that > this is a much clearer way than multiple inheritance, > which is complex, and not used very often compared with > single inheritance (don't count C++ here, as it has > often no other choice due to strong type checking!). That reminds me of how the book "Inside OLE2" advertises COMs non-support for multiple inheritance with the argument "you don't need it to do OOP", while really its just forcing you to use more complex design when simple multiple inheritance would do. I also like the way python features add-in classes. From idoerg at cc.huji.ac.il Thu Dec 27 05:03:14 2001 From: idoerg at cc.huji.ac.il (Iddo) Date: 27 Dec 2001 02:03:14 -0800 Subject: long lines in HTML attachments Message-ID: <7a256ac1.0112270203.77efb6f2@posting.google.com> Hi, I am trying to use smtplib and mimecntl to email an attached html document. The trouble is that the html document contains some very long physical lines (500 chars). It is important that those lines be preserved as such, since I use
 formatting in the htdoc. Some
mail clients (e.g. Pine 4.40) truncate or insert a linefeed in those
lines, creating a mess. Any way of attaching my long-lined files and
getting them through intact? Following is a code snippet of what I do.
Any help would be appreciated.

Thanks,

Iddo
---------------------------------- CUT HERE --------------------------


def email_with_attachments(to_addr, subject, msg_string, attachment):
    f = mimecntl.MIME_document("",type='text/plain')
    f.write(msg_string)
    # Create the message + attachment
    attach = mimecntl.MIME_recoder()
    att_file = open(attachment[1],"r")
    att_stream = att_file.read()
    attach.write(att_stream)
    attach['content-type']=mimecntl.MIMEField('content-type',attachment[0],
                                                   
name=attachment[1])
    attach['content-length']=mimecntl.MIMEField(
                                   'content-length',
                                   len(att_stream))
    attach['content-disposition']=mimecntl.MIMEField(
                                   'content-disposition',
                                   'attachment', 
                                    filename=attachment[1])
    msg = mimecntl.MIME_document((f,attach), 
                                  From='myself at myserver.org',
                                  To=to_addr,Subject=subject)
    # send msg using smtp
    smtp = smtplib.SMTP('localhost')
    smtp.sendmail('myself at myserver.org',to_addr,msg.dump())
    smtp.quit()
if __name__ == '__main__':
    attach_info = ('text/html','/my/html_file.html')
    email_with_attachments('you at youraddress','hi there',attach_info)


From aleax at aleax.it  Fri Dec 28 05:37:21 2001
From: aleax at aleax.it (Alex Martelli)
Date: Fri, 28 Dec 2001 11:37:21 +0100
Subject: Python Popularity: Questions and Comments
References: <3C2A9D33.67FEC261@earthlink.net>  <3C2B9E04.9957801F@earthlink.net> 
Message-ID: 

"RPM1"  wrote in message
news:u2nk47nvtu000c at corp.supernews.com...
    ...
> "full technical support"
>
> That's what gets thrown in my face whenever I mention Python.
> (And I mention it a lot).  The company I work for writes point
> of sale software in C and VB, because "there's support" and

VB is a commercial product.  C, like Python, is just a language,
of which exist implementations, both commercial and otherwise.

You can get many different implementations of C, and a few of
Python (the latter are typically "distributions" of the standard
implementation with packaging and support tweaks).  For several
of those implementations, you can buy technical support, "full"
(whatever THAT means) or otherwise -- this goes both for C and
Python, of course.

Firms like ActiveState (www.activestate.com) will typically be
overjoyed to sell you "full technical support" for Python on
the platforms they support.  See, for example:
http://www.activestate.com/Products/Enterprise_Solutions/Python.plex
for quite a few commercial offerings by ActiveState of Python
*Support* products/services, specifically.  I'm sure many other
purveyors of such products and services exist, and I hope relevant
URL's will be posted on this thread.

When you can get somebody to put this sort of thing in writing,
or say it in front of enough witnesses that they can't later
easily backtrack -- so that they've basically admitted that
if "there's support" then they HAVE to look at Python in depth --
you may then follow up by contacting the *SALES* organizations
of such suppliers as ActiveState.  Forget marketing: you need
hungry, aggressive *SALESPEOPLE* to ram change down the throat
of some organization that's clutching at straws to resist change.

Marketing is about product positioning on the market (features,
release timing, pricing models, etc), information flow from the
prospective-audience to the designers and vice versa, and, to a
VERY modest extent, general "public relations" and persuasion.
Don't confuse it with *SALES*, as we techies so often do -- that's
quite as bad as confusing very different tech roles, such as
software development and system administration.


> "customers won't pay for something made with freeware."

I wear Mephisto shoes, but I'm not going to claim that "customers
won't pay for software developed by somebody wearing Nike shoes".

As a non-sequitur, though, it's roughly on a par with this quote.

How will the customers know, and why should they care, what
brand of shoes (if any) the developers choose to wear?

How will the customers know, and why should they care, if (e.g)
your C++ sources were finally compiled/linked with free products
such as gcc, or for-pay ones such as commercial compilers?  The
same, obviously, goes for Python -- how will the customers know,
and why should they care, what kind of support contract YOU have
with ActiveState or other suppliers, if any?


> I think if Python wants to get "bigger" or more acceptable,
> it needs marketing.  The guy with the bag of money needs
> to say, "Oh yeah, Python, I've heard of that."  Customers

I'm not sure "Python" itself "wants" anything, just as I
doubt, say, "C", or "Java", have desires, feelings, hopes.

> ask us if we have a Java 'solution', they don't ask if we
> have a Python 'solution'.  That's got to change if Python
> 'wants' to grow more, (I don't know that it does).

Neither do I.  More to the point, this looks like a commercial
issue.  Is there money to be made by this sort of promotion,
which in turn does surely cost money?  If so, then it's more
of an issue of entrepreneurship -- get capital, start company,
invest, draw profits.  For typical Python *users*, well, if
their competition is using less-effective tools, why shouldn't
they just enjoy the resulting competitive advantage?  Production
costs aren't everything, of course, but in most endeavours they
do matter a lot to competitive positioning in the market.  In
many cases one goes to a LOT of trouble to try to have slightly
lower production costs than one's competition.  If in this case
my competition is willingly going to its own slaughter, should I
spend time and energy to reverse that?  As Clough put it, "Thou
shalt not kill, but needst not strive, officiously, to keep
alive".

Yeah, yeah, I know, this is not the prevailing ethos in Open
Source and more generally in the computer world -- we're all
missionaries out to save the world with our zeal and diligence,
particularly by ramming the "right" technologies down the
unwilling throats of everybody else.  For their own good, of
course.  Yeah, well.


>     It seems to me, (with my limited experience), that the
> most dedicated audience Python has is the scientific
> community.  I would start there.  Get some big chemical,
> pharmaceutical, or biological corporations to use Python,
> (by catering to their needs), and then they will in turn

Done, see http://www.python.org/psa/Users.html.  AlpgaGene,
Inc, NorthSide Physical Therapy, Thermo BioStar, Biosoft,
Caltech, are among the firms in this general sector who
not only use Python but are willing to be identified as
doing so on that page.

> support the language when they see the wonderful end
> product.  Then people like me can say to my boss, "look
> Dow, Johnson & Johnson, and ADM all use Python
> heavily, so there's nothing to be afraid of."

Why should such firms care about letting it be known
whether they use Python heavily, or Java, or C++, or
whatever else?  That's not their core business.  What's
in it for them?  Can you even FIND OUT what programming
languages are in fact used by the various departments
and fiefs of these large organizations?


> Maybe I'm wrong.  But it seems to me that Microsoft
> is ahead, not because of the high quality of their
> product, but because of there timing and marketing.

I think Microsoft's marketing has typically been truly
abysmal in most respects -- quite a match for the median
quality of most of their wares.  There are no doubt some
exceptions on both scores (e.g., the COM architecture,
and the .NET Framework, have some technically excellent
traits; marketing in both cases has done a horrid hash
of a job, particularly NOT managing to convey public
information about the technologies in question, and to
some extent, at least in COM's case, definitely NOT
steering product positioning according to market needs).

We'll see how their latest game-box offering fares, but
so far every one of their attempts beyond the desktop
has been substantially a failure, cross-subsidized by
profits on desktop operating systems, office apps, and
to a lesser extent other desktop apps (including games,
software development tools, etc).

This tells us nothing about marketing _technologies_
as opposed to products and services.  In that field,
Sun's very successful efforts at marketing Java may
be more instructive.  But, who has a billion dollars
available to throw at the task?  And how to they plan
to recoup the investment?  Sun has presumably judged
that opposing Microsoft's dominance has huge strategic
value for them: they don't make money directly out of
Java (not, by far, enough to make the huge marketing
investments profitable), but apparently they think
they're getting value for money through other revenue
channels.  What huge firm[s] might possibly make a
similar decision in the case of Python?  And why?


Alex





From jkraska at san.rr.com  Sun Dec 30 00:32:14 2001
From: jkraska at san.rr.com (Courageous)
Date: Sun, 30 Dec 2001 05:32:14 GMT
Subject: Is learning Python "extraordinary"?
References: <3C2DC53F.31010.D9D6B0A@localhost> 
Message-ID: <9e9t2ucvm4dgcfcg53k7h1a0pe7612kmf2@4ax.com>

>It shows intellectual curiosity and self-motivation, two things any
>admissions board smiles on.  However, for MIT, you should make clear that
>your studies have convinced you Python is merely a bad implementation of
>Scheme .

:) A good alternative to sucking up is contrariness, where if you say
something the opposite of what they believe, this convinces them that
you must be intelligent, because only intelligent people are iconoclasts.

C//



From brian at sweetapp.com  Thu Dec 13 01:43:10 2001
From: brian at sweetapp.com (Brian Quinlan)
Date: Wed, 12 Dec 2001 22:43:10 -0800
Subject: [XML-SIG] Pyana 0.2.0 released
In-Reply-To: <200112130613.fBD6DW801317@mira.informatik.hu-berlin.de>
Message-ID: <006101c183a1$71bd9df0$445d4540@Dell2>

Hi Martin,

> How does that [Pyana] compare to PIRXX?

The stated goals of the two projects (to provide Python interfaces to
the Apache group's Xalan & Xerces products) are pretty similar and
J?rgen Hermann and I are going to coordinate to make sure that they
interoperate.

But the current statuses of the two projects are very different. 

Right now, Pyana development is focused on providing XSLT services to
Python. There are functions to do XSLT transformations from various
sources (strings, files, URIs and reader objects). Output can be
directed to strings, files, writer objects or to a (only partially
complete) DOM. It is also possible to extend XPath with Python
functions. For a useful example script that demonstrates many of Pyana
features, take a look at:
http://pyana.sourceforge.net/examples/check_links.py

PIRXX is focused on providing Xerces XML services to Python. The current
release of PIRXX provides SAX2 interfaces but I believe that J?rgen is
working on DOM support.

So, right now, Pyana is probably your best bet for high-performance XSLT
processing in Python while PIRXX offers Xerces SAX2 interfaces.

Sorry me the long answer; let me know if I missed the point completely
:-)

Cheers,
Brian




From Bill.Scherer at VerizonWireless.com  Tue Dec 11 14:04:55 2001
From: Bill.Scherer at VerizonWireless.com (Scherer, Bill)
Date: Tue, 11 Dec 2001 14:04:55 -0500 (EST)
Subject: CGI form repost from browser--how to prevent?
In-Reply-To: 
Message-ID: 

Chris - 

Try tracking the state in J(ava)Script on the client side.  When 
the user performs an action leading to a form submission, set 
the flag just prior to the submit() call.  Check the flag before 
that. If it's in a submitted state, ignore the user request, or 
inform them that a submit is in progress or whatever...


On 11 Dec 2001, Chris wrote:

> I'm writing a Python cgi script that does some inserts into a mysql
> database based on data in an html form submitted by a user.  Is there
> any way to prevent the browser from reposting the data from the form
> when the user hits refresh in the browser after they have submitted
> the form?  When this happens, the script receives the same cgi form
> data and performs the same inserts on the database.  I think maybe
> this can be prevented by storing some state info with cookies??  Not
> sure (have never used cookies).  Any ideas on an easy way to prevent
> this?
> 
> Many Thanks.
> 
> -Chris
> 

-- 
Bill.Scherer at Verizon Wireless
RHCE 807101044903581




From peter at engcorp.com  Wed Dec 26 20:59:24 2001
From: peter at engcorp.com (Peter Hansen)
Date: Wed, 26 Dec 2001 20:59:24 -0500
Subject: REPOST: Re: references for shifting from Py1.5.2 to Py2.2?
References: <3c2a5cd1_2@corp.newsgroups.com>
Message-ID: <3$--$$-$$$$%%-$$-$@news.noc.cabal.int>

Joshua Muskovitz wrote:
> 
> After a long hiatus, I'm returning to the Python community.  I haven't
> touched Python since 1.5.2, and I'd like to climb the curve to 2.2 as
> quickly as possible.  What are the definitive references for making the
> transition?  

For a start, and maybe sufficiency, look at the changes made
in the intervening releases:

For example, the section "What's new in release 1.6?" at
http://www.python.org/1.6.1/

... and "What's New in Python 2.0?" at 
http://www.python.org/2.0/ or, even better,
look at Andrew Kuchling's detailed descriptions
for 2.0 through 2.2 at http://www.amk.ca/python
under the rubrik "What's New in Python".

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!news.kigam.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Peter Hansen 
Newsgroups: comp.lang.python
Subject: cmsg cancel <3C2A807C.255A9D82 at engcorp.com>
Control: cancel <3C2A807C.255A9D82 at engcorp.com>
Date: Mon, 31 Dec 2001 02:29:20 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775974 27193 211.57.49.2 (31 Dec 2001 05:19:34 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:19:34 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From mkelly2002NOSPAM at earthlink.net  Mon Dec 31 16:31:46 2001
From: mkelly2002NOSPAM at earthlink.net (Michael Kelly)
Date: Mon, 31 Dec 2001 21:31:46 GMT
Subject: Two languages, too similar, competing in the same space.
References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> 
Message-ID: <27m13uk49bkq96osejhav6hc4g7gtmlign@4ax.com>

On Mon, 31 Dec 2001 08:47:15 -0800, "Bruce Eckel"
 wrote:

>Learning Perl, for example, is
>what lead me to Python.

Likewise playing around with Ruby makes me
wonder if I should attempt SmallTalk again. :)


Mike

--

"I don't want to belong to any club that would have me as a member."
    -- Groucho Marx


From donn at drizzle.com  Mon Dec 17 02:02:29 2001
From: donn at drizzle.com (Donn Cave)
Date: Mon, 17 Dec 2001 07:02:29 -0000
Subject: socket question:socket.error:(4,'Interrupted system call')
References: None 
Message-ID: <1008572549.58900@yabetcha.sttl.drizzle.com>

Quoth =?gb2312?B?1cXJ2bPb?= :

| I have compiled a program to deal with Zombie process which caused by child process,it follows:
| ...
| ipsock=socket.socket(socket.AF_INET,10,8)
| while 1:
|   recvpack=ipsock.recv(1024)
|   ...
|   def sig_chld(signum, frame):
|   os.waitpid(-1,os.WNOHANG);
|   signal.signal(signal.SIGCHLD,sig_chld);
|   ret=os.fork()
|   if ret==0: #child process
|      .....
|
| It raise a error:
| Traceback (most recent call last):
|   File "d88.py", line 26, in ?
|     recvpack=ipsock.recv(1024)
| socket.error: (4, 'Interrupted system call')
|
| Why is error? How to correct it? Any ideas will be appreciated.

You asked for SIGCHLD, it arrived during recv() and interrupted it.

This would happen with C just as it would in Python.  In C it might
be worth your while to deal with it, but Python is so awkward with
signals anyway that in my opinion it's better to avoid them - no
signals.

I'm not sure I understand how the sig_chld handler fits into your
application, but if possible, I would simply call waitpid() at some
convenient interval to reap zombie processes.

	Donn Cave, donn at drizzle.com


From peter at engcorp.com  Sun Dec 30 18:31:13 2001
From: peter at engcorp.com (Peter Hansen)
Date: Sun, 30 Dec 2001 18:31:13 -0500
Subject: Early Internet reminiscing (was Re: A new forum is up! Q: what means 
 nntp)
References: <40dbad98.0112262238.73fc14f9@posting.google.com>  <3C2B941D.B1E45AA5@htp-tel.de>     <3C2CA285.BE256C16@engcorp.com> 
Message-ID: <3C2FA3C1.659C35A0@engcorp.com>

Laura Creighton wrote:
> 
> Peter Hansen doubts he was reading netnews in 1980.  Peter Hansen is in
> Toronto, if I remember correctly, and so his doubts are probably wrong.
> In 1980 Henry Spencer and I at utzoo made usenet international with
> the 23rd or 28th usenet site (the lpr paper is too faded to tell now.)
> We spread usenet to Canadian universities and companies all over
> Canada.  

Very cool!  I was actually at University of Guelph, with 
a couple of friends including Simon Gibson, getting in 
the way of university students and the sys admins (Barry
Stahlbaum might remember me if he's still around :-) and
the name Henry Spencer is synonymous in my mind with a lot
of things relating to the early net.  I'm afraid I have to
say I don't recognize the name Laura Creighton, but let's
just blame my terrible memory. :)  I'm happy to meet one of 
the dedicated souls who were responsible for my early 
introduction to computers.  Thank you, Laura.

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com


From akuchlin at mems-exchange.org  Sat Dec 29 22:02:20 2001
From: akuchlin at mems-exchange.org (Andrew Kuchling)
Date: 29 Dec 2001 22:02:20 -0500
Subject: ETA for Win32all under Python 2.2?
References:  
Message-ID: <3dheq9if5v.fsf@mozart.mems-exchange.org>

Martin von Loewis  writes:
> I think this reliance on a single person to build a binary package is
> unacceptable, especially since Mark has written all this documentation
> to get others started. It is time that Win32all maintainance is
> off-loaded to other shoulders.

Now that the MacOS code lives in the main CVS tree, maybe the win32
code should, too.  (Though not necessarily in the dist/ part; if it's
too large maybe it should go into nondist/.)

--amk



From jslowery at hotmail.com  Sun Dec 16 21:20:11 2001
From: jslowery at hotmail.com (Jeremy Lowery)
Date: Sun, 16 Dec 2001 20:20:11 -0600
Subject: custom rhooks
Message-ID: <8ycT7.187687$AR6.3957612@e3500-atl1.usenetserver.com>

I have sets of dynamic modules created with new.module that are maintained
in my app. How would one allow these to be imported in a restricted
execution environment that runs inside the app. If anyone knwos how, or
knows some sourcecode where people have already done this, I'd appreciate
it. I've looked at Grail's applet hooks but I can't seem to figure anything
out from it.

Jeremy






From robin at jessikat.fsnet.co.uk  Thu Dec  6 08:30:31 2001
From: robin at jessikat.fsnet.co.uk (Robin Becker)
Date: Thu, 6 Dec 2001 13:30:31 +0000
Subject: pep proposal : A date object for the standard library
References: <7da8d8f8.0112060346.3e50092f@posting.google.com>
Message-ID: 

It seems odd to define dates as a duration in days from a fixed time and
then define durations in a different scale ie seconds. Wouldn't it be
better to adopt the integers to represent days and the fraction to
represent fractions of a day which is what various proprietary date
formats do already (although with different origin). Dates and durations
could then have a common underlying representation.

Of course in the modern world we need nano-seconds and luckily
1+nano != 1 in ieee arithmetic

so the nano second expressed in days is not effectively zero, but the
pico second is off the scale and cannot be added to days with any
accuracy.


No matter what format is used eventually all compact date
representations run out of accuracy in one direction or another so
wouldn't it be wise to establish the representation limits in years and
fractions of a second and make these a required part of implementations
of AbstractDate derived classes.
-- 
Robin Becker


From dalke at dalkescientific.com  Tue Dec 18 23:45:32 2001
From: dalke at dalkescientific.com (Andrew Dalke)
Date: Tue, 18 Dec 2001 21:45:32 -0700
Subject: How about adding a sort parameter to dict methods?
References: 
Message-ID: <9vp5p4$51b$1@slb0.atl.mindspring.net>

maxm wrote:
> My guess is that a LOT of people has done this before me.
> So I just wondered if it wouldn't be a good idea to add
> a 'sort' parameter to the method to specify if it should
> be sorted or not.

>    def keys(self, sort=0):
>        keys=self.data.keys()
>        if sort:
>            keys.sort()
>        return keys

If it were done, it would need to take a sort function (as
you mentioned later in your post).  Flags are often the
ugly solution, and your approach of passing in a string
value as the flag is almost never the right solution.
Here's what it looks like with a sort function:

class _no_sort:
  pass

class OrderedDict(UserDict.UserDict):
  ...
  def keys(self, sort = _no_sort):
    keys = self.data.keys()
    if sort is not _no_sort:
        keys.sort(sort)
    return keys

(The '_no_sort' class is needed to distinguish between
using None, for the default sorting method, as compared to
no specified argument, meaning do not apply a sort.  This
could also be done with *args as in

  def keys(self, *sort):
    if sort and len(sort) > 1:
        raise TypeError("too many parameters")
    keys = self.data.keys()
    if sort:
        keys.sort(sort[0])
    return keys
)


What you want is needed less often than you think.  Other
solutions are possible, like:

def sorted_list(list, fctn = None):
    list.sort(fctn)
    return list

result = sorted_list(d.keys())

There's also a problem in what you have.  People expect
that

  dict.items() == zip(dict.keys(), dict.values())

and that's a guarantee made in the documentation.  But
once you pass in a sort function that doesn't occur.  It,
some may want the sort function for 'values' to return
the list sorted by the keys, even though the keys aren't
returnd.

In addition, roughly as often people want the elements in
insertion order, not in sort order.

Since there are many equally "valid" modifications to
dictionaries and their methods, the Pythonic solution is to
punt - provide the base functionality that other people can
tweak for their specific needs.  And that functionality
should be simple.

What's present isn't going to aquire your proposed changes,
or anything like it.  What you did is the Pythonic solution.

                    Andrew
                    dalke at dalkescientific.com





From sde at recombinant.demon.co.uk  Thu Dec 20 13:49:39 2001
From: sde at recombinant.demon.co.uk (Stephen D Evans)
Date: Thu, 20 Dec 2001 18:49:39 -0000
Subject: Huge Dicts and perfomance
References: 
Message-ID: <1008874192.15275.0.nnrp-02.d4e54907@news.demon.co.uk>

Are you using a list for the first index ? e.g. using list comprehensions:

dict = [ {} for i in range(2) ] # create a list of dictionaries
dict[0][objectname] = object
dict[1][(obj-a, obj-b)] = obj(a, b)

This should give a slight performance increase.

Which version of python are you using? Some windows versions run noticeably
slower than others with large amounts of data. (As an observation - the
cygwin http://sources.redhat.com/cygwin/ version runs faster on the windows
platform when using large dictionaries.)

Stephen D Evans

A picture speaks a thousand words.
"Lucio Torre"  wrote in message
news:mailman.1008865945.12538.python-list at python.org...
> Hi,
>
> I am making an application where i want to store links betwen nodes. So
> i have a dictionary where i store the objects.
>
> dict[0][objectname] = object
>
> the [0] is because i to signify a link betwen obj-a and obj-b, i do:
>
> dict[1][(obj-a, obj-b)] = obj(a, b)
>
> and so on, to six levels deep.
>
> and i also store links betwen dict[x][y] and other nodes (the stored
> object has those links)
>
> and i want to say for example, if i have a and b, what other nodes
> usually come togheter? so i follow the links and find the root nodes (z,
> x) and the groups (a, z) and (s, x).
>
> the main problem of course is that doing it this way, performance sucks.
> I took me nothing to code it, but it takes to much to run (more than
> coding). So, any ideas on how to achieve my goal in a better (faster) way?
>
> thanks,
>
> Lucio.
>
>
>




From reijs at tebenet.nl  Mon Dec 10 15:10:24 2001
From: reijs at tebenet.nl (sjier)
Date: Mon, 10 Dec 2001 21:10:24 +0100
Subject: ** Anybody Hiring? **
References: <3C140B54.E1780E4C@worldnet.att.net>
Message-ID: <9v34oc$f3i$02$1@news.t-online.com>

Actually yes, we -LagoSoft AG- are seeking a programmer Python/TCL. Location
is however Constance, Lake of Constance, Germany. Interested:
bart.reijs at lagosoft.de  www.lagosoft.de
If not: good luck


"Cris Fugate"  schrieb im Newsbeitrag
news:3C140B54.E1780E4C at worldnet.att.net...
> Got laid off. I have 1 year experience with Python and 4 years
> experience with Tk (Tcl).
> Is anybody hiring?
>
> Cris Fugate
> crisfugate at excite.com
>




From mal at lemburg.com  Thu Dec 20 16:02:17 2001
From: mal at lemburg.com (M.-A. Lemburg)
Date: Thu, 20 Dec 2001 22:02:17 +0100
Subject: ANN: eGenix.com mx BASE Extension Package 2.0.3
Message-ID: <3C2251D9.6D2CD433@lemburg.com>

________________________________________________________________________

ANNOUNCING:

            eGenix.com mx BASE Extension Package for Python
                            Version 2.0.3

      Open Source Python extensions providing important and useful
                  services for Python programmers.


________________________________________________________________________

WHAT IS IT ?:

The eGenix.com mx BASE Extensions for Python are a collection of
professional quality software tools which enhance Python's usability
in many important areas such as fast text searching, date/time
processing and high speed datatypes.

Python is an object-oriented Open Source programming language which
runs on all modern platforms (http://www.python.org/). By integrating
ease-of-use, clarity in coding, enterprise application connectivity
and rapid application design, Python establishes an ideal programming
platform for todays IT challenges.

The tools have a proven record of being portable across many Unix and
Windows platforms. You can write applications which use the tools on
Windows and then run them on Unix platforms without change due to the
consistent platform independent interfaces.

All available packages have proven their stability and usefulness in
many mission critical applications and various commercial settings all
around the world.

________________________________________________________________________

WHAT'S NEW ?

The packages were updated to work and compile with Python 2.2 in
addition to all the previous versions (Python 1.5.2, 2.0, 2.1.x).

The mxDateTime subpackage was enhanced to support more date/time
string formats in the parser. Several other subpackages have received
minor fixes to achieve even better portability. eGenix.com mx BASE
should compile on all platforms supported by Python and distutils
out-of-the-box.

As always we are providing precompiled versions of the package for
Windows and Linux as well as sources which allow you to install the
package on all other supported platforms.

________________________________________________________________________

EGENIX.COM MX BASE PACKAGE OVERVIEW:

mxDateTime - Generic Date/Time Types

     mxDateTime is an extension package that provides three new object
     types, DateTime, DateTimeDelta and RelativeDateTime, which let
     you store and handle date/time values in a much more natural way
     than by using ticks (seconds since 1.1.70 0:00 UTC; the encoding
     used by the time module).

     You can add, subtract and even multiply instances, pickle and
     copy them and convert the results to strings, COM dates, ticks
     and some other more esoteric values. In addition, there are
     several convenient constructors and formatters at hand to greatly
     simplify dealing with dates and times in real-world applications.

     In addition to providing an easy-to-use Python interface the
     package also exports a comfortable C API interface for other
     extensions to build upon. This is especially interesting for
     database applications which often have to deal with date/time
     values (the mxODBC package is one example of an extension using
     this interface).

mxTextTools - Fast Text Processing Tools

     mxTextTools is an extension package for Python that provides
     several useful functions and types that implement
     high-performance text manipulation and searching algorithms in
     addition to a very flexible and extendable state machine, the
     Tagging Engine, that allows scanning and processing text based on
     low-level byte-code "programs" written using Python tuples. It
     gives you access to the speed of C without the need to do any
     compile and link steps every time you change the parsing
     description.

     Applications include parsing structured text, finding and
     extracting text (either exact or using translation tables) and
     recombining strings to form new text.

mxStack - Fast and Memory-Efficient Stack Type

     mxStack is an extension package that provides a new object type
     called Stack. It works much like what you would expect from such
     a type, having .push() and .pop() methods and focusses on
     obtaining maximum speed at low memory costs.

mxTools - Collection of Additional Builtins

     mxTools is an extension package that includes a collection of
     handy functions and objects giving additional functionality in
     form of new builtins to the Python programmer.

     The package auto-installs the new functions and objects as
     builtins upon first import. This means that they become
     instantely available to all other modules without any further
     action on your part. Add the line import NewBuiltins to your
     site.py script and they will be available to all users at your
     site as if they were installed in the Python interpreter itself.

mxProxy - Generic Proxy Wrapper Type

     mxProxy is an extension package that provides a new type that is
     suitable to implement Bastion like features without the need to
     use restricted execution environments.

     The type's main features are secure data encapsulation (the
     hidden objects are not accessible from Python since they are
     stored in internal C structures), customizable attribute lookup
     methods and a cleanup protocol that helps in breaking circular
     references prior to object deletion.

     The latest version adds a very interesting new feature: weak
     references which help you work with circular references in a way
     that doesn't cause memory leakage in a Python system. Note that
     even though Python 2.1+ has its own weak reference implemetation,
     this package can be used to write applications which also work on
     Python 1.5.2 and 2.0.

mxBeeBase - On-disk B+Tree Based Database Kit

     mxBeeBase is a high performance construction kit for disk based
     indexed databases. It offers components which you can plug
     together to easily build your own custom mid-sized databases (the
     current size limit is sizeof(long) which gives you an address
     range of around 2GB on 32-bit platforms).
 
     The two basic building blocks in mxBeeBase are storage and
     index. Storage is implemented as variable record length data
     storage with integrated data protection features, automatic data
     recovery and locking for multi process access. Indexes use a high
     performance optimized B+Tree implementation built on top of
     Thomas Niemann's Cookbook B+Tree implementation
     (http://epaperpress.com/).

________________________________________________________________________

WHERE CAN I GET IT ?

The download archives and instructions for installing the packages can
be found at:

     http://www.egenix.com/files/python/

________________________________________________________________________

WHAT DOES IT COST ?

The BASE packages come with a Python 2.0 style license, which means
that you can use them in both commercial and non-commercial settings
without fee or charge. All packages come with full source code.


________________________________________________________________________

WHERE CAN I GET SUPPORT ?

Commercial quality support for these packages is available from
eGenix.com Software GmbH. Please see

http://www.egenix.com/files/python/eGenix-mx-Extensions.html#Support 

for details about the eGenix support offerings.

________________________________________________________________________

REFERENCE:

eGenix.com mx BASE Extension Package 2.0.3 - eGenix.com mx BASE Extension Package 2.0.3 with precompiled binaries for Windows and Linux. (20-Dec-2001) ________________________________________________________________________ Enjoy, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From david_j_dawkins at spamless.hotmail.com Thu Dec 13 13:39:15 2001 From: david_j_dawkins at spamless.hotmail.com (David Dawkins) Date: Thu, 13 Dec 2001 18:39:15 -0000 Subject: Calling member functions? References: Message-ID: "Oleg Broytmann" wrote in message news:mailman.1008247097.13811.python-list at python.org... > On Thu, Dec 13, 2001 at 12:22:17PM -0000, David Dawkins wrote: > > > > self.m_method(self.m_object) ## naive attempt > > > > > > ^^^^^^^^ You call a method with one argument, but the > > > Callback method does not accept any arguments. > > > > but then how does Handler.Callback receive its own "self" value? In this > > m_method is not a method - it is *bound* method! It is h.Callback - an > object, that stores both h and Callback! So when you call it, Python gets > the self for Callback from the bound method; the self will by just h! > Understand? > > vvvvvvvvvv - you initialized m_method with the bound method > > > > n = Notifier( h, h.Callback ) Yes, I understand now! Thanks for your help. David From gmcm at hypernet.com Sun Dec 9 11:23:28 2001 From: gmcm at hypernet.com (Gordon McMillan) Date: 09 Dec 2001 16:23:28 GMT Subject: Tougher challenge (was Re: Monitoring running Windows Applications) References: <3c13b5b2.56161165@127.0.0.1> <3c138470.18641895@127.0.0.1> Message-ID: Five Fresh) Fish wrote: >>How can one get Python to identify either the applications that are >>currently running in Windows, in real-time (ie. as an application >>monitor)... >> >>Or, better, how can one get Python to identify all the open windows, in >>real-time? [and again] > Here's the tougher challenge: can this be done without using the Mark > Hammond's Win32 extensions? (I suspect the answer is no; I simply > can't conceive of any way to query the OS without having hooks into the > OS...) You could live on the edge and use calldll / dynwin from nightmare.com. -- Gordon http://www.mcmillan-inc.com/ From peter at engcorp.com Sat Dec 8 22:58:32 2001 From: peter at engcorp.com (Peter Hansen) Date: Sat, 08 Dec 2001 22:58:32 -0500 Subject: Tinker vs wxPython ?- Opinions/Views References: <3ReQ7.21098$2Fd.14596@news1.bloor.is> <87elm62luf.fsf@speeder.org> Message-ID: <3C12E168.91F9129A@engcorp.com> Roman Milner wrote: > > Tkinter Pros: [...] > Tkinter Cons: [...] > wxPython Pros: [...] > wxPython Cons: [...] > Difficult to learn [...] > Less stable than Tkinter [...] I have to disagree with these two. I was able to create several attractive, simple interfaces which looked like I wanted them much more quickly with wxPython, and I have never had any stability problems with either. I found I had to fight with Tkinter at every turn, however, to make my interface look like I wanted it to, and often had to give up my ideal and go with something rudimentary. With wxPython, I pictured what I wanted and created it. Studying the demo app code went a long way towards making the documentation acceptable. In fact, I think I would say once I learned to use the source examples, I found wxPython *better* documented for my needs than Tkinter was. Clearly this is a case of YMMV... -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From rdsteph at earthlink.net Wed Dec 26 19:49:24 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Thu, 27 Dec 2001 00:49:24 GMT Subject: Python City: Tutorials and Book Reviews + Message-ID: <3C2A70CA.E70745AF@earthlink.net> I have added 2 more book reviews and also links to 14 Pythonic tutorials to the web site at http://www.awaretek.com/plf.html formerly known as the Python Liberation Front. Also you will find links to Hans Nowak's mygale webcrawler and other programs. I would appreciate it if anyone knows of any other Python tutorials, I would like to include links to any such that I may have missed, I am hoping that the convenient links to so many good tutorials, all in one place, along with so many book reviews and many other features, may be of use to newbies to Python programming. Also, if you have any scripts, even pre-alpha ones, this might be a good place to display them and ask for comment and/or code additions. RS From rpm1deletethis at frontiernet.net Thu Dec 27 20:47:51 2001 From: rpm1deletethis at frontiernet.net (RPM1) Date: Thu, 27 Dec 2001 20:47:51 -0500 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: <9$--$$_-----$%%-$$@news.noc.cabal.int> "Ron Stephens" wrote in message > I recently read an interview with a Digital Creations top manager where he said > that he hopes someone starts a successful business based solely on providing > ISP services using Zope, with full technical support. Is anyone looking into > this? Does anyone think this could be a successful business model? I am > interested in opinions on this. > "full technical support" That's what gets thrown in my face whenever I mention Python. (And I mention it a lot). The company I work for writes point of sale software in C and VB, because "there's support" and "customers won't pay for something made with freeware." I think if Python wants to get "bigger" or more acceptable, it needs marketing. The guy with the bag of money needs to say, "Oh yeah, Python, I've heard of that." Customers ask us if we have a Java 'solution', they don't ask if we have a Python 'solution'. That's got to change if Python 'wants' to grow more, (I don't know that it does). It seems to me, (with my limited experience), that the most dedicated audience Python has is the scientific community. I would start there. Get some big chemical, pharmaceutical, or biological corporations to use Python, (by catering to their needs), and then they will in turn support the language when they see the wonderful end product. Then people like me can say to my boss, "look Dow, Johnson & Johnson, and ADM all use Python heavily, so there's nothing to be afraid of." Maybe I'm wrong. But it seems to me that Microsoft is ahead, not because of the high quality of their product, but because of there timing and marketing. Patrick ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newsengine.sol.net!news-feed.riddles.org.uk!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "RPM1" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:00:29 GMT Organization: The World's Usenet -- http://www.Supernews.com Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775445 27193 211.57.49.2 (31 Dec 2001 05:10:45 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:10:45 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From bbollenbach at home.com Sun Dec 9 11:11:27 2001 From: bbollenbach at home.com (Brad Bollenbach) Date: Sun, 09 Dec 2001 16:11:27 GMT Subject: join vs instances References: Message-ID: In article , Robin Becker wrote: > I had expected to be able to use things like UserStrings interchangeably > with ordinary strings, but You can. If you couldn't, UserString wouldn't serve much purpose. >>>> from UserString import UserString >>>> C=['a',UserString('B'),'c'] >>>> ''.join(C) > Traceback (most recent call last): > File "", line 1, in ? > TypeError: sequence item 1: expected string, instance found> Keep in mind that when you call a class Foo as a function (as in x = Foo()) it returns and /instance/ of said class. To get to the data in the string itself, you have to do what the docs say: The instance's content is kept in a regular string or Unicode string object, which is accessible via the data attribute of UserString instances. So: mothra at mothra:~$ python2.1 Python 2.1.1 (#1, Nov 11 2001, 18:19:24) [GCC 2.95.4 20011006 (Debian prerelease)] on linux2 Type "copyright", "credits" or "license" for more information. >>> from UserString import UserString >>> x = UserString('b') >>> ''.join(['a', x.data, 'c']) 'abc' Hope that helps, Brad From loewis at informatik.hu-berlin.de Wed Dec 26 18:54:44 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 27 Dec 2001 00:54:44 +0100 Subject: REPOST: Re: O'Reilly's Python and XML References: Message-ID: <1$--$$-$$$$%__%-$$@news.noc.cabal.int> "A. Keyton Weissinger" writes: > Anyone have any word on PyXML for Python 2.2? When will it be released, etc? PyXML 0.7 builds fine with Python 2.2 if you have a compiler. If you don't have a compiler, what platform do you want binaries for? In any case, many of the libraries presented in the book will work with the stock Python xml libraries, no PyXML needed. Only when it comes to validation or enhanced DOM features, you need PyXML, and only for XSLT, you need 4Suite (for the plain 4XPath application, PyXML 0.7 should be good enough). Regards, Martin ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Martin von Loewis Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:02:56 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009776027 27193 211.57.49.2 (31 Dec 2001 05:20:27 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:20:27 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jessefw at loop.com Sat Dec 29 16:29:35 2001 From: jessefw at loop.com (Jesse F. W) Date: Sat, 29 Dec 2001 13:29:35 -0800 Subject: Is learning Python "extraordinary"? Message-ID: <3C2DC53F.31010.D9D6B0A@localhost> I am a high school senior, and like many others, I am applying to college. I am applying to MIT (as well as many other schools). MIT describes what they are looking for as students who do or have done "extraordinary things". My question is this, Is teaching myself Python (with the aid of the Python tutorials and some help from the various lists) an "extraordinary thing"? How many python-list'ers are high school students? Thank you(boy, what a strange question this is) all, Jesse Weinstein From phr-n2001d at nightsong.com Fri Dec 21 19:36:15 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 21 Dec 2001 16:36:15 -0800 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> <7xlmfxvbx7.fsf@ruckus.brouhaha.com> <3dbsgt7f0e.fsf@ute.mems-exchange.org> <7xheqkr05q.fsf@ruckus.brouhaha.com> Message-ID: <7xy9jwozuo.fsf@ruckus.brouhaha.com> "Fredrik Lundh" writes: > > It's a bug if something is gratuitously, unnecessarily incompatible, > > like "rand" disappearing. > > can you find "rand" in any recent python documentation? > > have you ever used the module for anything? > > have you ever seen any program using it? > > do you even know what it does? I haven't used it in my own code. Some of the Red Hat configuration scripts use it. I found that out when I installed Python 2.1 on my Red Hat system, replacing Python 1.5, and the installation scripts broke because they could no longer import "rand". Grr, growl, gnash. I don't know precisely what it does but it appears to be pretty close to what "random" does. I know that because I added a "rand.py" file containing the single line "import * from random" and that made the Red Hat scripts work again. From loewis at informatik.hu-berlin.de Wed Dec 26 19:27:58 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 27 Dec 2001 01:27:58 +0100 Subject: REPOST: Re: Efficient storage of floats References: <3c272d5e$0$202$626a54ce@news.free.fr> Message-ID: <9$--$$-$$$$%__%%-$@news.noc.cabal.int> "Francois Petitjean" writes: > Is it possible to have a quantitative assessment of the overhead of the two > methods 1(list) or 2(array)? (overhead in memory footprint or CPU cycles). Getting the overhead in memory consumption is possible, but it is quite time consuming (you'll have to consider malloc overhead as well); see my earlier articles on "size of objects" for examples. It is well possible that the list version consumes five times or more than memory than the array version. On CPU cycles, you get additional indirections with the lists, but this is difficult to estimate - that is best done through bench marking. > And is it interesting to preinitialize the structure? The number of > points is typically 800*2 (for symmetry) that is say up to 8000 > floats. Depends on how often you destroy and recreate them, compared to actually using the data. For a list, pre-allocation is quite pointless, since the list will over-allocate anyway. For an array, it may be reasonable. BTW, pre-allocating [(0.0, 0.0, 0.0)*800] is worse than pre-allocating [None*800]. All 800 references will point to the same object in each case, only that "creating" None is more efficient than creating the tuple. Regards, Martin ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Martin von Loewis Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:18:33 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009776204 27193 211.57.49.2 (31 Dec 2001 05:23:24 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:23:24 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From bill-bell at bill-bell.hamilton.on.ca Fri Dec 28 09:45:39 2001 From: bill-bell at bill-bell.hamilton.on.ca (Bill Bell) Date: 28 Dec 2001 06:45:39 -0800 Subject: COM Registration Attributes References: <3C105C56.7080909@ActiveState.com> <5edaf477.0112141237.3f1471b2@posting.google.com> Message-ID: <5edaf477.0112280645.246f7229@posting.google.com> I have been wondering again about the best way of handling a collection of Windows registry key additions, deletions or changes as part of registering a Python COM server. I can think of a few options: 1. Just use RegCreateKey, etc in the available library. 2. Create a wrapper for atl.dll to provide an automation interface useable by Python so that the Python coder can simply embed instructions as .rgs scripts in his/her Python scripts. 3. Write a module (probably using 'shlex') that parses .rgs scripts and makes the necesssary calls to RegCreateKey, etc. 4. Wrap atl.dll and make it part of the standard Windows distribution. I find doing it the first way makes for code that it hard to read and, therefore, hard to maintain. Option 2 ain't too bad; however, to implement it for general use by the Python community makes it necessary to store an additional DLL somewhere with all the attendant security issues. Option 3 makes it possible to use already available modules with wide distribution; however, it entails maintenance if MS changes the specs for .rgs scripts. (Mind you, isn't this stuff meant to become less of an issue?) Option 4 looks nicest to me. What do others think? Bill bill-bell at bill-bell.hamilton.on.ca (Bill Bell) wrote in message news:<5edaf477.0112141237.3f1471b2 at posting.google.com>... > Mark Hammond wrote, in part: > > > Thanks, Gordon. I just prototyped a simple COM that needs to > > > declare itself safe for Internet Explorer. Looks like I need to continue > > > to do that in the good old-fashioned way, with 'RegOpenKey', etc. > > > Would seem more elegant to be able to use '_reg_options_'. > > A patch to allow _reg_options_ to do this sort of thing (assuming it did > > not break what it does now) would be welcome :) > > I haven't extended _reg_options_. However, since ATL.Registrar lacks > an automation interface I have whipped up a wrapper that provides > access to two of Registrar's methods. > > The following fragment is a typical usage: > > UseCommandLine ( WebPASSCOMServer ) > from win32com.client import Dispatch > from sys import argv > registrar = Dispatch ( 'RegistrarCOMWrapper.Register' ) > regString = \ > ''' > HKCR > { > NoRemove 'CLSID' > { > ForceRemove '{D471BE26-C3C8-4773-B438-041BA612C563}' > { > 'Implemented Categories' > { > '{7DD95801-9882-11CF-9FA9-00AA006C42C4}' > '{7DD95802-9882-11CF-9FA9-00AA006C42C4}' > } > } > } > NoRemove 'Component Categories' > { > NoRemove '{7DD95801-9882-11CF-9FA9-00AA006C42C4}' > NoRemove '{7DD95802-9882-11CF-9FA9-00AA006C42C4}' > } > } > ''' > // following lines parallel the way 'UseCommandLine' works > if '--unregister' in argv: registrar . StringUnregister ( > regString ) > else: registrar . StringRegister ( regString ) > > To me, the nice thing about this approach is that it involves the use > of the '.rgs' scripts that are familiar to people who work with MSVC. > > I have done only very limited trials, on Win2K at that. Would welcome > comment, including a suggestion of where I might put this ugly thing > in case someone else might consider using it. > > BIll From robin at brainexeculink.com Sat Dec 29 16:02:12 2001 From: robin at brainexeculink.com (robin at brainexeculink.com) Date: Sat, 29 Dec 2001 16:02:12 -0500 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <458b194a.0112282052.1123341@posting.google.com> Message-ID: rcena at epcor.ca (Resty Cena) wrote: >Whichever can provide what it is that VB >developers like about VB on top of what Python and Ruby natively offer >will hit the jackpot. To me these are: (a) Visual drag-and-drop >application builder with data aware controls, and (b) good support for >the big databases (Oracle, Sybase, Informix). Yes. Snap-in database support -- not only for the big databases but for lightweight solutions as well -- makes VB popular. And it's a big reason people use PHP (to wander into another branch of this thread). Python needs standard database modules with a high degree of interface conformance -- more than what the current DB API provides. And these need to *work*. I can't tell you how much time our company wasted looking for the best PostgreSQL interface, for example. Since I'm talking databases, I wish someone with more time and brains than I would pick up the Gadfly project and bring it up to date. We need a pure Python SQL database. That too would help "sell" the language. As far as GUIs go, either Boa Constructor or something like the anygui project has the potential to be the Python "killer app". A third application domain that needs to grow in maturity and standardisation is server-side web pages. Not everyone wants to write their own framework (though I have). There should be an out-of-the-box module that easily integrates Python with Apache and takes care of most of the dirty work. Standardisation is more important than sophistication. I would love for all the brilliant Python contributors to stop right here at version 2.2 and put all their talents into these three areas. The core language is just fine, thank you. The existing modules are mostly very good. What is needed are database, gui, and web components to turn this language into a full development package. The payoff would be immense. >With VB.NET, VB >programmers will ask, "What's the point?" Might as well dive into C#. I did precisely one project in VB way back in version 2-3 days. It didn't take me very long to say "What's the point?" Then I went out and bought some C++ books. [shudder] VB is popular even though it doesn't work. PHP is popular even though it works in a small domain. But both products work "well enough". That's the key. Python does not yet work "well enough" in the most common problem domains. It requires too much wheel re-invention. ----- robin robin at brainexeculink.com (remove "brain" to reply) From toha at ozemail.com.au Sun Dec 30 00:32:30 2001 From: toha at ozemail.com.au (Aloysius Toh) Date: Sun, 30 Dec 2001 15:32:30 +1000 Subject: /usr/bin/env: python: No such file or directory References: <9vivft$593$1@peabody.colorado.edu> <171220010818339518%jwbaxter@spamcop.net> <9vnvue$m5d$1@peabody.colorado.edu> <9vo6ng$mhs$1@nntp6.u.washington.edu> Message-ID: Redhat 7.2 has both 1.5 and 2.1 wrote in message news:m3ellkoijn.fsf at nbecker.fred.net... > The correct solution is for Redhat to put: > #!/usr/bin/python1.5 > > I proposed that to them before and they rejected it. From skip at pobox.com Tue Dec 11 17:39:27 2001 From: skip at pobox.com (Skip Montanaro) Date: Tue, 11 Dec 2001 16:39:27 -0600 Subject: CGI form repost from browser--how to prevent? In-Reply-To: <8dtR7.6164$Rw2.4462556@newssrv26.news.prodigy.com> References: <8dtR7.6164$Rw2.4462556@newssrv26.news.prodigy.com> Message-ID: <15382.35615.683228.172436@beluga.mojam.com> dsavitsk> dsavitsk> something like that should work ... i think? Yes, if you set the hidden value to "yes" before calling submit()... -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From syver-en+usenet at online.no Wed Dec 19 02:55:03 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 19 Dec 2001 08:55:03 +0100 Subject: [VPython] Why are some objects displayed and some are not? References: <9vpgra$k68$1@newsreaderg1.core.theplanet.net> Message-ID: "F. GEIGER" writes: > I wanted to display a pile of boxes of different sizes. So I tried the > > 2-liner of the tutorial: > > redbox=box(pos=vector(4,2,3), size=(8.,4.,6.),color=color.red) > greenball=sphere(pos=vector(4,7,3), radius=2, color=color.green) > > Worked: Displayed a red box with a green sphere upon it. > > Then I tried > > redbox=box(pos=vector(4,2,3), size=(8.,4.,6.),color=color.red) > #greenball=sphere(pos=vector(4,7,3), radius=2, color=color.green) > > Did not work: The screnn stayed black. So I seem to miss something > when > > displaying objects. What does the sphere do, that the box does not? > > Any hints? I just tried what you did on my machine, it works fine. (python 2.1 win2k) -- Vennlig hilsen Syver Enstad From peter at engcorp.com Fri Dec 7 19:51:32 2001 From: peter at engcorp.com (Peter Hansen) Date: Fri, 07 Dec 2001 19:51:32 -0500 Subject: string conversion and formatters References: Message-ID: <3C116414.AC83416B@engcorp.com> Chris Liechti wrote: > > "Spiffy" wrote: > > > Traceback (most recent call last): > > File "C:\Program Files\Python2\convertor.py", line 17, in ? > > print "Decimal: %d" % (hex) > ^^^^^ > these parentheses don't do anything useful here. if you want a single > element tuple use "(hex,)". note also that your variable "hex" shadows the > built in function "hex". i would sugest a difrent name. Agreed about the name, but not the comment about the parentheses not doing something useful. More accurately, they are not *necessary*, but they are quite useful. Specifically they serve as a guide to the maintainer that the second argument to % is a tuple, not a comma-separated sequence of items. I used to forget to add the parentheses when I changed things like print "%d" % val into print "%d (%s)" % val, name so now I always include the parentheses (without the trailing comma though) even with single-item format strings, and have ceased to make the above mistake. (Just a minor item, I know.) -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From jgardn at alumni.washington.edu Wed Dec 5 10:50:25 2001 From: jgardn at alumni.washington.edu (Jonathan Gardner) Date: Thu, 6 Dec 2001 00:50:25 +0900 Subject: Learning resources needed In-Reply-To: <9ukp40$90u84$1@ID-106629.news.dfncis.de> References: <9ukp40$90u84$1@ID-106629.news.dfncis.de> Message-ID: <200112051556.fB5FuuJ12414@my.knctv.co.kr> On Wednesday 05 December 2001 06:26 pm, Duke wrote: > I am looking to learn Python/Tkinter. I'm a competent C/C++/Java > programmer, however I don't have any experience with Tcl/Tk. If you are looking to develop GUI apps, look towards PyQt. Qt runs on X, Windows, and now Mac as well. I tried to learn Tcl/Tk, but I ended up using PyQt because it is a lot simpler and a lot easier to work with and customize. Jonathan From nikander at mindspring.com Wed Dec 19 12:33:21 2001 From: nikander at mindspring.com (Robert Nikander) Date: Wed, 19 Dec 2001 12:33:21 -0500 Subject: tp_free and tp_dealloc? Message-ID: <20011219.123319.1139068338.8495@localhost.localdomain> Greetings Pythoners... I am writing my first extension types and am having a couple problems. One is that I and am confused about the tp_free vs the tp_dealloc slots in PyTypeObject. Examples in the Python documentation say that you should actually free the object when dealloc is called, using: PyObject_Del( obj ); But PEP 253 on subtyping builtins says that the tp_dealloc should unref or delete its members and that *tp_free* is used to delete the object. So: 'tp_free' is opposite 'tp_alloc' and 'tp_new' is opposite 'tp_dealloc' (BTW: I am on Python 2.2c1) My little test type ('Dog') and a script that creates a Dog shows that tp_free is never getting called. Also a Dog works fine but a Python subclass segfaults when the object is dealloc'd. Can someone enlighten me? Thanks, Rob Here is some of my code: typedef struct { PyObject_HEAD int weight; char * name; } Dog; static int dog_init(PyObject * self, PyObject * args, PyObject * kwargs) { int w; char * name = NULL; Dog * new_dog = (Dog*)self; if(!PyArg_ParseTuple(args, "si:Dog __init__", &name, &w)) { return -1; } new_dog->weight = w; new_dog->name = name; return 0; } static void dog_dealloc(Dog * dog) { printf("dog_dealloc is running\n"); printf(" name is %s\n", dog->name); /* This next line causes seg fault, not sure how to get rid of name. */ /* PyMem_Free(dog->name); */ printf(" deleted the name\n"); PyObject_Del(dog); printf(" deleted object.\n"); } .... DogType.tp_free = dog_free; DogType.tp_dealloc = (destructor)dog_dealloc; DogType.tp_init = dog_init; DogType.tp_new = PyType_GenericNew; DogType.tp_alloc = PyType_GenericAlloc; DogType.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; PyType_Ready( &DogType ); ---- Python test program --- # Create a Dog and try subclassing Dog import robs d = robs.Dog("Cloe", 72) print d, d.name class FatDog(robs.Dog): def __init__(self, n, w): robs.Dog.__init__(self, n, w+10) ## If I uncomment the next 3 commented lines, # I get a seg fault in the middle of dealloc for the fat dog #fd = FatDog("Lester", 85) #print fd.name, fd.weight del d #del fd print 'done' From mwh at python.net Wed Dec 12 10:18:56 2001 From: mwh at python.net (Michael Hudson) Date: Wed, 12 Dec 2001 15:18:56 GMT Subject: Import random References: Message-ID: "Daniel Pote" writes: > Michael Hudson said: > > "Daniel Pote" writes: > > > >> >>>> from math import exp, sqrt > >> >>>> 4 * exp(-0.5)/sqrt(2.0) > >> > > >> Result is: 0.0 > > > > Congratulations, you have a seriously broken installation. Did > > you compile it yourself? Which compiler did you use? > > I used the pre-compiled package from hpux.connect.org.uk Well, has anyone you know of used that same package sucessfully on a similar system to yours? Do you know/Can you find out what they did differently? I can't actually solve your problem -- I've never been close to a HP-UX box -- so I'm just trying to ask questions that will help you solve it yourself... Cheers, M. -- MARVIN: What a depressingly stupid machine. -- The Hitch-Hikers Guide to the Galaxy, Episode 7 From claird at starbase.neosoft.com Fri Dec 28 10:21:55 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 28 Dec 2001 09:21:55 -0600 Subject: tcl??? References: <%FOW7.8662$7p6.139123@rwcrnsc51.ops.asp.att.net> Message-ID: <5B2C114B09F60421.20863CA7F38A0CEF.DE1A496BB79AB1C7@lp.airnews.net> In article , ~Jason~ wrote: >I am running XP; and the error I am getting when I type in "tclsh80" is >[File"","line 1, in ? tclsh80 NameError: Name tclsh80' is not >defined] . . . I'm more confused than before. You're on a Windows XP host, and you have successfully installed Python (or ActivePython?), correct? What version is that? What application do you launch that suggests you "type tclsh80"? -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From chrishbarker at attbi.com Mon Dec 10 14:07:22 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Mon, 10 Dec 2001 11:07:22 -0800 Subject: Date manipulation in Python References: Message-ID: <3C1507EA.EBC7B920@attbi.com> David Brady wrote: but I'd like to be > able to move around in the date and still be able to > print out the correct calendar. For example, if today > were Saturday, December 1st, I'd like to be able to > show the week from Monday, November 26th through > Sunday, December 30th. check out the mxDateTime module, it does all this and more! http://www.lemburg.com/files/python/ -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From pobrien at orbtech.com Mon Dec 3 14:48:01 2001 From: pobrien at orbtech.com (Patrick K. O'Brien) Date: Mon, 03 Dec 2001 19:48:01 GMT Subject: Difference between 'import' and 'from ... import' References: Message-ID: I got the following: C:\Code\Gadfly> python Python 2.1.1 (#20, Jul 20 2001, 01:19:29) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. >>> import gadfly kjParser.py:16: DeprecationWarning: the regex module is deprecated; please use t he re module import regex C:\PYTHON21\lib\regsub.py:15: DeprecationWarning: the regsub module is deprecate d; please use re.sub() DeprecationWarning) >>> gadfly >>> dir(gadfly) ['GF_Cursor', '__builtins__', '__doc__', '__file__', '__name__', 'error', 'gadfl y', 'sql', 'sqlbind', 'sqlgen', 'verbosity'] >>> In other words, it worked. All I did was download, unzip, "python gfinstall.py", and then what you see above. What didn't work for me was what you said worked for you: C:\Code>python Python 2.1.1 (#20, Jul 20 2001, 01:19:29) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. >>> from Gadfly import gadfly Traceback (most recent call last): File "", line 1, in ? ImportError: No module named Gadfly >>> Indeed, on my machine the Gadfly directory does not have an __init__.py file, so Gadfly is *not* a package. Does this help at all? -- Patrick K. O'Brien Orbtech.com - Your Source For Python Development Services "Andy Todd" wrote in message news:Xns916C95F7E80D6andytoddspamfreeyaho at 203.109.250.24... > I'm having a problem with imports and would appreciate any hints, tips or > pointers to documentation or faqs. > > I've got a package installed in a directory on my PYTHONPATH and I cannot > seem to import a module from that package directly. The directory is > c:\python21\Gadfly and the module is gadfly.py. If I try; > > >>> from Gadfly import gadfly > > everything works and I can specify a connection and access my database. > But, if I try; > > >>> import gadfly > > I get an error message; > > Traceback (most recent call last): > > File "", line 1, in ? > > SystemError: NULL result without error in call_object > > I've tried googling for this error message but it seems to be a generic > error which is masking my real problem. > > This has got me a little stumped because the other modules in this package > will import (e.g. sqlgen, sqlwhere) so I presume there is something in > gadfly.py that the interpreter doesn't like. > > The gadfly documentation only talks about 'from gadfly import gadfly' and > I'm just wondering if there is something specific in the module which > prohibits a direct import. > > I'm running Python 2.1.1 on Windows98 with the latest version of gadfly > from http://www.chordate.com/gadfly.html > > Thanks in advance, > Andy > -- > Content free posts a speciality > From richardjones at optushome.com.au Wed Dec 26 17:53:36 2001 From: richardjones at optushome.com.au (Richard Jones) Date: Thu, 27 Dec 2001 09:53:36 +1100 Subject: The Python community needs a lighter heart to it. In-Reply-To: <40dbad98.0112261431.3e928cf2@posting.google.com> References: <40dbad98.0112261431.3e928cf2@posting.google.com> Message-ID: <200112262253.fBQMrbJ17248@mail016.syd.optusnet.com.au> On Thu, 27 Dec 2001 09:31, Andrew Nguyen wrote: > The python community is a bunch of people who can't take a joke. You are definitely looking in the wrong place. I've been a part of the community through this mailing list for many years now, and I've found the people here to be quite capable of both taking and creating humour. > Also, usenet SUXXOR (sucks) because itttt issss soooo cunfuseeeng... Use the mailing list then... > Why not switch to an EZBoard? Why have maling lists that are too > confusing? > I for one say that we create a NEW forum! Nothing stopping you. I won't be visiting it though :) > I bet you, that if we put a link on the python homepage with a link to > an EZBoard, python would be Much more popular. The most exciting topic > I have seen to date is 'Fun with Classess in Python 2.2'. Mailing lists and/or newsgroups are available to all and don't require a hefty web server since the reading of the messages is distributed. > Also, the Python Game Dev community DOESN'T EVEN HAVE A FORUM!!! Only > IRC wich in my opinion is not that great. With a forum for it, we > could trade code and things like that. anyways, it is hard finding > about new styles and things like that! Er, hello, have you _visited_ www.pygame.org? On that page there's a link to the mailing list, irc chat info, code repository, and so on. The mailing list is an excellent place to ask questions or punt ideas to. Richard From lists at toadmail.com Mon Dec 10 18:19:53 2001 From: lists at toadmail.com (Jeremy Whetzel) Date: 10 Dec 2001 18:19:53 -0500 Subject: Populating a list References: <5a4226f0.0112092238.7212f87@posting.google.com> Message-ID: <87zo4q7jdy.fsf@toadmail.com> kevin at cazabon.com (Kevin Cazabon) writes: > The reason you'd get an error is that you have no handle on the open > file. (f is a list, not a file pointer). The file is still open > however, you just have no way to close it. I'd hope that Python would > close the file once it goes out of scope, but I couldn't guarantee it. > > To be safe, I'd suggest doing the open and readlines separately, so > you can keep a reference to the file, then use it to close the file. > > f = open(filename, "r") > crap = [item.rstrip() for item in f.readlines()] > f.close() Ahhhh... I got it. Thank you. I really thought it closed the file because of the readlines() on the end of the 'open' function. *scurries off to fix current project* Jeremy From carlca at dircon.co.uk Fri Dec 14 06:26:33 2001 From: carlca at dircon.co.uk (Carl Caulkett) Date: Fri, 14 Dec 2001 11:26:33 -0000 Subject: which book? References: Message-ID: In article , preben_er_t0ff at hotmail.com says... > I've been recommended to buy a Python book, > but I'm not sure which one I should buy.. > > Somebody told me to buy Python2.1 Bible. > Anybody got an opinion? Hi Preben, You may be interested to know that O'Reilly have an online books subscription service called Safari which allows you to gain access to fully searchable and hyperlinked versions of a large number of books. The selection includes all of the O'Reilly Python books as well as "Core Python", which IMO is a very good starting point. -- Carl From keyton at weissinger.org Tue Dec 25 17:08:34 2001 From: keyton at weissinger.org (A. Keyton Weissinger) Date: Tue, 25 Dec 2001 17:08:34 -0500 Subject: idle In-Reply-To: <4n5W7.104500$RE3.18654002@typhoon.southeast.rr.com> Message-ID: It is under the same license as Python itself, I believe, if that is what you are asking. As far as the source itself, it comes with Python... Keyton -----Original Message----- From: python-list-admin at python.org [mailto:python-list-admin at python.org]On Behalf Of Steve Story Sent: Tuesday, December 25, 2001 3:32 PM To: python-list at python.org Subject: idle is the Python IDLE open source? -- http://mail.python.org/mailman/listinfo/python-list From chrishbarker at attbi.com Tue Dec 11 16:57:53 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Tue, 11 Dec 2001 13:57:53 -0800 Subject: Some stupid questions References: <9v5ea4$d1ek8$1@ID-119882.news.dfncis.de> <9v5g8b09pq@enews4.newsguy.com> <9v5tjd$d81ug$1@ID-119882.news.dfncis.de> Message-ID: <3C168161.D6101A6A@attbi.com> Another rookie wrote: > > In both cases, of course, there will be a "hefty" runtime (in a Java > > jar, or as Windows DLL's, etc) that your "stand-alone" applications > > will have to carry -- just as if they were written in any other > > language requiring significant runtime support, such as Visual Basic. > > > Do u mean that my executable will be slow? No. It means that it will have to be accompanied by one or more DLLs, and could be fairly large. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From investornews at usa.net Tue Dec 4 17:19:23 2001 From: investornews at usa.net (Investor News) Date: Tue, 4 Dec 2001 17:19:23 Subject: The Best Smart Card Story You've Never Heard Message-ID: An HTML attachment was scrubbed... URL: From tim at vegeta.ath.cx Tue Dec 18 19:03:08 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Wed, 19 Dec 2001 00:03:08 GMT Subject: Python equivalent to @lines = 'command'; References: Message-ID: Christer Frovik <013-139047 at telia.com> graced us by uttering: > Tim Hammerquist wrote: > > import os > > lines = os.popen('ls -1').readlines() > > for line in lines: > > process(line) > > Thanks, you've made my day. > > I wish those pyTHON (giggle) tutorials would include more of > these 'neat recepies'. Glad to help. If you're going to be doing a lot of text-processing, you might find the shlex module interesting. http://www.python.org/doc/current/lib/module-shlex.html HTH Tim Hammerquist -- $ echo pizza > /dev/oven From kragen at pobox.com Sat Dec 1 05:51:25 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 01 Dec 2001 05:51:25 -0500 Subject: Newbie question --> Internet-Connection References: <9u83ng$i4v$05$1@news.t-online.com> Message-ID: <838zcntdqq.fsf@panacea.canonical.org> Thomas Metz writes: > how can I check the state of an internet-connection (connected/disconnected) > with python? What's an internet-connection? What platform are you on? How portable does your code need to be? From dalke at dalkescientific.com Thu Dec 20 13:05:22 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Thu, 20 Dec 2001 11:05:22 -0700 Subject: How to generate XML References: <3c21e330@news.opennet.it> Message-ID: <9vt907$lc9$1@slb6.atl.mindspring.net> Fabrizio: > Does anybody know if there are modules to generate XML? > I know there is SAX, but it is only for parsing, isn't it? Others have mentioned DOM. You can also use SAX to generate XML, if you're careful. from xml.sax import saxutils gen = saxutils.XMLGenerator() gen.startDocument() gen.startElement("begin", {}) gen.characters("some that gets &escaped;\n") gen.endElement("begin") gen.endDocument() prints the following some <text> that gets &escaped; I've written a few tree traveral algorithms which mimic the SAX event mechanism. Makes it very easy to convert the tree to XML. Andrew dalke at dalkescientific.com From atuc at gmx.de Sun Dec 2 14:56:51 2001 From: atuc at gmx.de (Tuca Atuc) Date: Sun, 2 Dec 2001 20:56:51 +0100 Subject: Python and FLTK References: <3C097361.F0297DEA@iprimus.com.au> Message-ID: <9ue0sf$qoa$07$1@news.t-online.com> "Mike Tsakiris" schrieb im Newsbeitrag news:3C097361.F0297DEA at iprimus.com.au... > Is anybody working of porting FLTK to Python; > There was one in Sourceforge, but seems to have stopped. > > email gideon at computer.org i think he is working on this, alex From loewis at informatik.hu-berlin.de Sun Dec 23 18:34:50 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 24 Dec 2001 00:34:50 +0100 Subject: Another distutils question References: <9vumpp$hn2$1@peabody.colorado.edu> Message-ID: Fernando =?ISO-8859-1?Q?P=E9rez?= writes: > I understand. What I meant to say is I don't want to add another > module to my package, and using yours (or Rene's, I guess) would > require adding it in, since it isn't 'standard' in the sense of > being included in Python's distribution. Does that make sense or am > I still mistaken? It makes sense; I had the same concerns when adding it to PyXML. However, the advantages outweighed the disadvantages. > Thanks for your info though. I hope distutils doesn't die though. It seems > like an important part of Python. It is, and I'm pretty sure it won't die. It's just that people either have get used to work-arounds, or have to take responsibility and maintain it. There is actually a set of patches pending on SF which need review, so all it needs is someone to step forward as the maintainer of distutils - you would not need to write actual code, just integrating contributions would be good enough (and no, Fernando, I'm not asking you specifically - anybody can do that). Regards, Martin From pinard at iro.umontreal.ca Tue Dec 18 19:07:35 2001 From: pinard at iro.umontreal.ca (=?iso-8859-1?q?Fran=E7ois?= Pinard) Date: 18 Dec 2001 19:07:35 -0500 Subject: pymacs and rlcompleter In-Reply-To: <200112181235.fBICZd706819@relay.wineasy.se> References: <200112181235.fBICZd706819@relay.wineasy.se> Message-ID: [o polite] > I miss a couple of things in emacs python-mode. [...] Any hope of > getting these functions with the promising pymacs? Pymacs is an interface allowing to use Python in Emacs instead of Emacs LISP, while Python mode is written in pure Emacs LISP. I would guess the authors are not likely to give up on that purity, if it can be maintained. :-) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From ballabio at mac.com Thu Dec 13 04:34:38 2001 From: ballabio at mac.com (Luigi Ballabio) Date: Thu, 13 Dec 2001 09:34:38 +0000 Subject: a lambda in a function In-Reply-To: <9v8knj$f61$1@news.ucar.edu> Message-ID: <5.1.0.14.0.20011213092423.00a6d4e0@mail.mac.com> At 10:12 PM 12/12/01 +0000, Fred Clare wrote: >Why does interpreting the five lines: >def func(): > x = 1 > add_one = lambda i: i+x > j = add_one(100) >func() > >Give me: > > Traceback (most recent call last): > File "test.py", line 6, in ? > func() > File "test.py", line 4, in func > j = add_one(100) > File "test.py", line 3, in > add_one = lambda i: i+x > NameError: There is no variable named 'x' It's a scope thing. The scope of the lambda doesn't "see" the scope of the enclosing function---only the global scope. You can fix it in two ways: the first is to import x into the lambda scope by means of a default parameter; this works in all versions of Python: def f(): x = 1 add_one = lambda i,x=x: i+x j = add_one(100) The second works for Python 2.1 and above: the interpreted lets you declare that you want the scope of the function to be visible from the lambda. The directive you have to add is: from __future__ import nested_scopes def f(): x = 1 add_one = lambda i: i+x # it will work now j = add_one(100) You'll be happy to know that starting from Python 2.2 the above is the default behavior---i.e., had you used Python 2.2b2, your code would have ran as expected. Bye, Luigi From tony at lsl.co.uk Wed Dec 12 12:02:42 2001 From: tony at lsl.co.uk (Tony J Ibbs (Tibs)) Date: Wed, 12 Dec 2001 17:02:42 -0000 Subject: more fun with PEP 276 In-Reply-To: Message-ID: <016f01c1832e$cffe0530$545aa8c0@lslp862.int.lsl.co.uk> The attributions have gotten tangled, but trying to reconstruct them, I *think* someone called Billy (being quoted by wtanksley) may have written: > >>Minor niggle: how would users remember which operator > >>represents which type of range ending? Do you have a > >>proposed mnemonic? to which phil hunt responded: > how about: > > for i in -5 to 5: > > or > > for i in -5 to 5 step 2: Nah - that still doesn't resolve the "open or closed" end problem. For American English speakers, I suspect that:: for i in -5 through 5: and:: for i in -5 to 5: may work (did I get that right?), but for British English speakers those wouldn't work terribly well (even despite the gradual merging of languages), since that distinctive use of "through" is not common. Maybe the only sensible solution would be something like:: for i in -5 uptobutnotincluding 5: and:: for i in -5 uptoandnotforgetting 5: On the other hand, maybe the problem with finding a "spelling" for the issue that actually works for more than a handful of people at a time is why this issue doesn't get addressed? (mind you, *I* thought the ``for -5 < i <= 3:`` proposal (sorry if I got it wrong) was meant as a neat piece of humour when I first read it, so who am I to comment?) Tibs -- Tony J Ibbs (Tibs) http://www.tibsnjoan.co.uk/ I hope that's my tongue in my cheek and not my foot in my mouth... My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.) From jlh at home.com Mon Dec 3 22:29:23 2001 From: jlh at home.com (Jeff Hinrichs) Date: Mon, 3 Dec 2001 21:29:23 -0600 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> Message-ID: <129201c17c73$de5cc6f0$6702a8c0@gato> > Sadly, we just have to live with spaces in their unintended role, but > I think that rather than wasting time inventing urban legends, > folklore and "reasons" why one is better than the other, we should be > talking about practical measures that projects can use to avoid > tab/space mixing and other text-based nightmares (DOS text vs. UNIX > text, for example). Got my vote. I was just in the mood tonight so I figured what they hey how about some pointless fun. -jeff From kdahlhaus at yahoo.com Mon Dec 3 15:15:29 2001 From: kdahlhaus at yahoo.com (Kevin Dahlhausen) Date: 3 Dec 2001 12:15:29 -0800 Subject: Python and FLTK References: <3C097361.F0297DEA@iprimus.com.au> <9ue0sf$qoa$07$1@news.t-online.com> Message-ID: <283adf56.0112031215.619b7289@posting.google.com> "Tuca Atuc" wrote in message news:<9ue0sf$qoa$07$1 at news.t-online.com>... > "Mike Tsakiris" schrieb im Newsbeitrag > news:3C097361.F0297DEA at iprimus.com.au... > > Is anybody working of porting FLTK to Python; > > There was one in Sourceforge, but seems to have stopped. > > > > > email gideon at computer.org i think he is working on this, > alex Yes, I was working on the Sourceforge one. It works pretty well, only you can not subclass widgets within Python. We started looking at the Boost Python Library instead of swig, which would allow the subclassing, but did not get very far. Please post your response from gideon. From loewis at informatik.hu-berlin.de Sun Dec 16 07:59:29 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 16 Dec 2001 13:59:29 +0100 Subject: Compiling Python with Tkinter References: Message-ID: Ben Ocean writes: > Here's what I've done but it doesn't work: Can you elaborate how exactly it does not work? With the information you gave us, I'd say you have done everything correctly. That assumes, of course, that tcltk is really installed in /opt/tcltk, that the include files and libraries are present, that PIL is installed in ../Extensions, that the Tcl version you have is 8.3, and so on and so forth. Regards, Martin From paul at boddie.net Wed Dec 19 09:48:57 2001 From: paul at boddie.net (Paul Boddie) Date: 19 Dec 2001 06:48:57 -0800 Subject: /usr/bin/env: python: No such file or directory References: <915a998f.0112161542.2ab07235@posting.google.com> Message-ID: <23891c90.0112190648.7742d07@posting.google.com> hamish_lawson at yahoo.co.uk (Hamish Lawson) wrote in message news:<915a998f.0112161542.2ab07235 at posting.google.com>... > > When trying to run a script, I get the following message: > > > > /usr/bin/env: python: No such file or directory > > Though perhaps not the case here, I'll just mention a problem that is > worth being aware of when transferring a script from a Windows/DOS > system to Unix. If the difference in line-ending conventions hasn't > been taken care of (such as by using ASCII mode during FTP transfer), > then the spurious ^M in the script's #! line can trip up the shell or > the env command, since it will be trying to run the program python^M. This may well be the case, in fact. One solution is to write a short Python script to replace the DOS line endings with the native equivalent. Something like this, perhaps: # Warning! Untested! Try it on something you've already backed up! s = open(filename, "rb").read() # NOTE: Python 2 string methods used - import string and use # NOTE: string.replace with earlier releases of Python. s = s.replace("\r\n", "\n") open(filename, "w").write(s) Yes, I know it could have been done on one line (or using 'sed')! :-) Paul From philh at comuno.freeserve.co.uk Sun Dec 30 19:39:54 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Mon, 31 Dec 2001 00:39:54 +0000 Subject: REPOST: Re: Is learning Python "extraordinary"? References: Message-ID: <6$--$$_----__-%%%$@news.noc.cabal.int> On Sat, 29 Dec 2001 13:29:35 -0800, Jesse F. W wrote: > > I am a high school senior, and like many others, I am applying >to college. I am applying to MIT (as well as many other schools). >MIT describes what they are looking for as students who do or have >done "extraordinary things". My question is this, Is teaching myself >Python (with the aid of the Python tutorials and some help from the >various lists) an "extraordinary thing"? Since (just about) everyone here has learned Python, why would we think it was extraordinary? -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: philh at comuno.freeserve.co.uk (phil hunt) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:00:32 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009773996 27193 211.57.49.2 (31 Dec 2001 04:46:36 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:46:36 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From dyoo at hkn.eecs.berkeley.edu Wed Dec 26 00:06:11 2001 From: dyoo at hkn.eecs.berkeley.edu (Daniel Yoo) Date: Wed, 26 Dec 2001 05:06:11 +0000 (UTC) Subject: Learning how question References: Message-ID: ~Jason~ wrote: : I am able to run the hello world, how do I put it into the form of : an .exe? Hi Jason, There are several utilities you can use to make Python programs into independent .exe's. Here's one of them: http://py2exe.sourceforge.net However, you might want to see if you can avoid making .exe's in the first place. Are you planning to share your program with other people? Making .exe's is a specialized topic, so if you're just trying to learn Python, you probably don't need to worry about making .exe's until later. From dyoo at hkn.eecs.berkeley.edu Thu Dec 27 15:42:31 2001 From: dyoo at hkn.eecs.berkeley.edu (Daniel Yoo) Date: Thu, 27 Dec 2001 20:42:31 +0000 (UTC) Subject: cmp [__eq__] References: Message-ID: Mark McEahern wrote: :> Perhaps then could someone explain to me how one compares classes :> useing the == operator, or indeed if this bad programming practice. : By overloading the __cmp__ method. Don't confuse the return value of : __cmp__ with whether or not the result of the comparison is that the two : instances being compared are equal. Examine this sample and note that : __cmp__ isn't merely used to determine equality. It is also used to : determine sort order. And if you just want to be able to compare two things for equality, it's probably better to write an __eq__ method instead. Unlike __cmp__, __eq__ is meant to be a boolean function, so it should be more familiar to use. There's more information on __eq__ and the other rich comparison methods here: http://www.python.org/doc/current/ref/customization.html Good luck! From brian at sweetapp.com Tue Dec 11 22:45:49 2001 From: brian at sweetapp.com (Brian Quinlan) Date: Tue, 11 Dec 2001 19:45:49 -0800 Subject: Pyana 0.2.0 released Message-ID: <003c01c182bf$7d7ad190$445d4540@Dell2> Pyana is an interface between the Apache Project's Xalan XSLT engine and Python. See http://pyana.sourceforge.net for complete information. Also recommended is: http://pyana.sourceforge.net/examples/ Changes: o Made the API easier to use o Build works with Xalan 1.2 (binaries generated with Xalan 1.2) o Added support for output to a "writer" object o Memory leak fixes o DOM output (DOM only partially implemented) o Experimental support for NodeSets in XPath extensions Cheers, Brian From crispin at iinet.net.au Thu Dec 20 01:34:57 2001 From: crispin at iinet.net.au (Crispin Wellington) Date: 19 Dec 2001 22:34:57 -0800 Subject: Help! py2exe or Standalone.py fails with M2Crypto, can't find M2Crypto.SSL.S??? References: <97706cb6.0112190956.49d80d20@posting.google.com> Message-ID: <4391255a.0112192234.39c3ab24@posting.google.com> raiseexception at yahoo.com (Raise Exception) wrote in message news:<97706cb6.0112190956.49d80d20 at posting.google.com>... > Hi, I'm trying to generate a standalone EXE file using a pretty > simple program I wrote. It uses some of the usual Python modules, > Tk, and M2Crypto. When I use the py2exe program and McMillans's > Standalone.py, using M2Crypto generates the same error. I can > even generate the error by simply creating a "test.py" file with > just one line containing "import M2Crypto". py2exe says: > > snip > > File "d:\python21\lib\M2Crypto\SSL\Connection.py", line 16, in ? > SSLError = getattr(__import__('M2Crypto.SSL', globals(), locals(), > 'SSLError'), 'SSLError') > File "D:\distrib\Installer\iu.py", line 287, in importHook > raise ImportError, "%s not found in %s" % (nm, ctx) > ImportError: S not found in M2Crypto.SSL > > Note that if I run my program in the interpreter, everything runs > fine. I don't know what is causing M2Crypto to try and find a > module called "SSL.S". Has anyoneone else ran into this? Of course > I'm going to dig thru it, but I'm on a schedule and would rather fix > it first then figure it out later. :) > > TIA. Edit line 16 of the offending Connection.py change from SSLError = getattr(__import__('M2Crypto.SSL', globals(), locals(), 'SSLError'), 'SSLError') to SSLError = getattr(__import__('M2Crypto.SSL', globals(), locals(), ['SSLError']), 'SSLError') And rebuild your project. It should work now. Kind Regards Crispin Wellington crispin at iinet.net.au From dgrisby at uk.research.att.com Thu Dec 13 11:36:13 2001 From: dgrisby at uk.research.att.com (Duncan Grisby) Date: 13 Dec 2001 16:36:13 GMT Subject: python and SOAP?? References: Message-ID: <9valdt$ik6$1@pea.uk.research.att.com> In article , Markus Jais wrote: >On Thu, 13 Dec 2001 16:31:34 +0100, Cameron Laird wrote: > >> http://www.onlamp.com/pub/a/python/2001/06/14/pysoap.html > >thanks for the URL. was very helpful. It's a good article. I'd like to correct a common myth about CORBA, though. The article says: """ Compared to other distributed programming tools like DCOM or CORBA (or, more properly, the IIOP which transports CORBA,) SOAP is * platform-neutral, * computing language-independent, and * Unicode-ready. """ CORBA's IIOP _is_ platform-neutral, language independent, and Unicode ready. Cheers, Duncan. -- -- Duncan Grisby \ Research Engineer -- -- AT&T Laboratories Cambridge -- -- http://www.uk.research.att.com/~dpg1 -- From just at xs4all.nl Sat Dec 8 15:58:35 2001 From: just at xs4all.nl (Just van Rossum) Date: Sat, 08 Dec 2001 21:58:35 +0100 Subject: Calling a generator multiple times References: <0gn21usqeasqa1bp4sveh0vjagtmbmfpof@4ax.com> <3C11FE92.1218662@letterror.com> Message-ID: <3C127EFB.A7C2F00@xs4all.nl> Oren Tirosh wrote: > I think that the alternative I have presented might have been preferred, > though, if it were included in the proposals at that time. I doubt it. I for one don't understand your proposal at all... Just From aleax at aleax.it Fri Dec 28 11:00:14 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 17:00:14 +0100 Subject: strange Tkinter problem References: Message-ID: "tjiit" wrote in message news:a0baad$vu4$01$1 at news.t-online.com... > I have an application using a Tkinter GUI which starts a network > connection if you click on a button. The strange thing is that the GUI > freezes and the connection is established. Does this mean that Tkinter > executes the functions bound do an event and then returns when the > function has ended? I thought it would to kinda multi-threading so it No! If threads were generated "behind your back", you'd have a very hard time handling the resulting mess. > could handle large events and keep interactive while doing it. > Can anyone give me a (some) hints? http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82965 The Recipe is about the other, harder half of the problem -- a thread different from the GUI-controlling one wants to talk with the GUI-thread. Starting a new thread from the GUI one (e.g. from a callback: all callbacks run on the GUI thread!) is easy, with module threading; the problem is coordinating multiple threads, and the recipe helps with that part. Alex From mertz at gnosis.cx Sun Dec 16 15:37:00 2001 From: mertz at gnosis.cx (Lulu of the Lotus-Eaters) Date: Sun, 16 Dec 2001 15:37:00 -0500 Subject: Idiomatic portable way to strip line endings? (fwd) Message-ID: m.bless at gmx.de (Martin Bless) wrote: |To be on the safe side here's what I sometimes use: |def removecrlf( line): | """Remove \r\n or \n from end of string.""" | if line[-1:] == '\n': | if line[-2:-1] == '\r': | return line[:-2] | else: | return line[:-1] | else: | return line This is probably not quite safe enough. MacOS lines end with '\r'. Adding that case is left as an exercise to readers (I like the regex version that someone--Skip?--posted in this thread). Yours, Lulu... From gh_pythonlist at gmx.de Sun Dec 23 06:26:35 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Sun, 23 Dec 2001 12:26:35 +0100 Subject: SnoPy 0.1 - SNOBOL pattern matching for Python In-Reply-To: References: Message-ID: <20011223112632.GA1307@lilith.hqd-internal> Le 23/12/01 ? 10:58, Dale Strickland-Clark ?crivit: > Don Rozenberg wrote: > > [announcing SnoPy] > > Wow! That's interesting. Snobol was one of the first languages I > learned and I loved it. > > I still have some Snobol4 books by Griswold on my shelves here. > > But having just checked the links, I see it's Linux only :-(. Only the Makefile seems to be Linux (Unix?) specific for now. Provided you have the necessary tools (bison, SWIG, GNAT) it would be pretty easy to build it on Windows. If anybody plans to do this, she/he might find the Makefiles from my pyAda project (http://pyada.sf.net/) useful for building DLLs with GNAT on Windows. They enable you to write Python extensions with GNAT on Linux, FreeBSD, Solaris and Windows. I don't have any plans, however, to do further work on it. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From logiplexsoftware at earthlink.net Wed Dec 19 15:24:35 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Wed, 19 Dec 2001 12:24:35 -0800 Subject: wxwin2.2 --> Seg.fault In-Reply-To: <3C1FCF80.2060603@thomas-guettler.de> References: <3C1FCF80.2060603@thomas-guettler.de> Message-ID: <20011219122435.74be86ed.logiplexsoftware@earthlink.net> On Wed, 19 Dec 2001 00:21:36 +0100 Thomas Guettler wrote: > > I am looking for a GUI API for python. WxPython should be better, > but I get a seg.fault if I press ctrl-c in the terminal the application > was started with. I use wxwin2.2 on Debian. Is tkinter more stable? Ctrl-C is supposed to kill an application. I expect if you do the same to a Tkinter app you will get similar results, so I am not sure what your complaint is. Nevertheless, you should probably download wxPython 2.3.2 which has been recently released. 2.2 is pretty old. > If you scan through this newsgroup you get the impression that more > people use tkinter. This may be because wxPython has its own mailing list. > I don't want to make a bad decision now, because changing the GUI > library costs a lot of time later > > What do you think? Tkinter is okay to learn on, but wxPython gives you more room to grow. wxPython has a much larger widget selection and since it uses the native GUI's widgets, it tends to look better as well. Tkinter is more widely ported, but that's changing as wxWindows gets ported to more platforms. Good Luck. From deblnonospammyno at raqia.com Fri Dec 21 11:45:56 2001 From: deblnonospammyno at raqia.com (David Lees) Date: Fri, 21 Dec 2001 11:45:56 -0500 Subject: FW: Comunicating through COM ports References: Message-ID: <3C236744.2CBCFEC3@raqia.com> Python21/scripts/PythonSerial david lees > "Alves, Carlos Alberto - Coelce" wrote: > > Thanks for the example. But, where can I find such module Serial?! > > -----Original Message----- > From: David Mallwitz [mailto:dmallwitz at cox.rr.com] > Sent: Thursday, December 20, 2001 10:26 PM > To: python-list at python.org > Subject: Re: Comunicating through COM ports > > Comunicating through COM portsChapter 19 of Mark Hammond and Andy > Robinson's > 'Python Programmingon on Win32' covers this quit well, and with the > Activestate Python distro there is a multithreaded demo called > 'win32comport_demo.py'. But here's what I do - example is from a > console > connection to an old Cisco router. > > >>> from Serial import Serial > >>> ### open the COM1 port > >>> serialconfig = Serial.PortDict() > >>> serialconfig['port'] = Serial.COM1 > >>> serialconfig['rxBufSize'] = 4096 > >>> port = Serial.Port(serialconfig) > >>> port.open() > >>> port.write('show conf \r') > >>> x = port.read() > >>> x > 'show conf \r\nUsing 768 out of 32762 bytes\r\n!\r\nversion 11.1\r\nno > > service u > dp-small-servers\r\nno service tcp-small-servers\r\n!\r\nhostname > Router\r\n!\r\ > n!\r\nip subnet-zero\r\nno ip domain-lookup\r\n!\r\nhub ether 0 1\r\n > link-test\ > r\n auto-polarity\r\n!\r\nhub ether 0 2\r\n link-test\r\n > auto-polarity\r\n!\r\n > hub ether 0 3\r\n link-test\r\n auto-polarity\r\n --More-- ' > > Best, > Dave > > "Alves, Carlos Alberto - Coelce" wrote in > message > news:mailman.1008852145.28654.python-list at python.org... > Anybody could give me an example code of how connect/comunicate > through COM > ports (i.e. COM1, COM2). I'm under windows 98. > Thanks!!! > Carlos Alberto > COELCE/DPRON-Departamento de Projetos e Obras Norte > Fone: 677- 2228 > e-mail: calves at coelce.com.br > \|||/ > (o o) > --ooo0-(_)-0ooo-- > > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- > http://www.newsfeeds.com - The #1 Newsgroup Service in the World! > Check out our new Unlimited Server. No Download or Time Limits! > -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- > -- > http://mail.python.org/mailman/listinfo/python-list -- debl From fredrik at pythonware.com Thu Dec 20 03:33:31 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 20 Dec 2001 08:33:31 GMT Subject: Tkinter+ backspace characters (and an re.sub problem) References: <3c202041$1_6@goliath.newsgroups.com> Message-ID: David Mallwitz wrote: > The Tkinter Text widget doesn't understand '\b' or '\x08' as the > backspace character when sent a string containing either of them. Nor does > it understand '^H' as a substitute for '\b'. > I've done some googling, but haven't found a solution other than doing a > regexp sub on the string before sending it to the text widget. That seemed > like a good idea, but I'm not able to construct the regexp in a way that > will handle stacked backspace characters. > Any ideas on how to tell the widget to process a backspace? Or on how to > construct an RE that will match multiple '\b's? something like this should work: from Tkinter import * import re message = 'all work and no play makes Jack\x08\x08\x08\x08Dave a dull boy' text = Text() text.pack() # find backspace/non-backspace runs for fragment in re.findall("\x08+|[^\x08]+", message): if fragment[0] == "\x08": # delete len(fragment) characters before current insertion point text.delete("%s-%dc" % (INSERT, len(fragment)), INSERT) else: text.insert(INSERT, fragment) mainloop() From chris.gonnerman at newcenturycomputers.net Sat Dec 29 10:48:51 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Sat, 29 Dec 2001 09:48:51 -0600 Subject: Help with TCL References: <2D4X7.19180$uM.182933@rwcrnsc54> Message-ID: <006b01c19080$5995fce0$0101010a@local> ----- Original Message ----- From: "~Jason~" > I am trying to learn programming. I am running XP Pro. and when I > try to run tcl I get the following error [File"",line 1, > in ? tclsh80 nameerror: name tclsh80' is not defined] why am I > getting this error and how do I correct it. I even changed it to > tclsh83 which is what the folder says my version is. You are making a very common mistake. No matter how hard you try, you just can't type the names of executable program files at the Python >>> prompt and expect them to work. Program files, i.e. *.exe under Windows, have to be run from the Start, Run dialog, by double-clicking the program file, or from the MS-DOS command prompt. Not that it's impossible under Python, just silly: import os os.system("tclsh83") Note that THIS won't work if the PATH environment variable does not include the path to the tclsh83.exe program file. Windows programmers MUST learn to use the MS-DOS prompt, even if you rarely visit it. Is this a FAQ? (I haven't looked.) If not it should be. From dale at riverhall.NOTHANKS.co.uk Sat Dec 22 05:00:28 2001 From: dale at riverhall.NOTHANKS.co.uk (Dale Strickland-Clark) Date: Sat, 22 Dec 2001 10:00:28 +0000 Subject: Fate of win32all? References: <7876a8ea.0112212116.2ebabc23@posting.google.com> <3C242A7F.2060805@skippinet.com.au> Message-ID: Mark Hammond wrote: >Nope. The win32all license remains unchanged. See the license.txt >files in the distribution. Basically *anyone* is free to do whatever >they choose with the package, including building their own distribution. > ActiveState have no special rights over this at all. > >Specifically, I fully intend releasing new win32all packages. >ActiveState did have me working very hard on Komodo, but no longer ;) I >am leaving for a Christmas break, but intend getting a win32all out by >the new year - if not, just a few days after. > >Mark. That is *SUCH* good news. Have a good holiday and I hope you find some financially rewarding employment when you want it. -- Dale Strickland-Clark Riverhall Systems Ltd From sdm7g at Virginia.EDU Fri Dec 21 14:23:02 2001 From: sdm7g at Virginia.EDU (Steven Majewski) Date: Fri, 21 Dec 2001 14:23:02 -0500 (EST) Subject: Python on the desktop In-Reply-To: Message-ID: On Fri, 21 Dec 2001, Courageous wrote: > > >Does C++ have a standard GUI?? > > Well, in effect, yes. Since the vast majority of all platforms > are x86 windows platforms, and the vast majority of C++ developers > use Visual C++, it would follow that the standard GUI for C++ is > MFC. :) :) :) > Actually, the vast majority of all platforms are embedded systems. But you can't really draw any connection between the number of systems and the number of programmers -- for either embedded systems or Windows platforms. For embedded systems, the programmer/product ratio is usually much smaller, while MS seems to be on a quest to chew up both more processor cycles and more programmer cycles! ;-) Probably still can't draw any consistent conclusions: Linux probably has a very high programmer/product ration, because so many linux programmers are doing it for fun. ( Does anybody program in VC++ for fun? :-) -- Steve From usenet at NOSPAM-irmen.cjb.net Thu Dec 13 01:39:59 2001 From: usenet at NOSPAM-irmen.cjb.net (Irmen de Jong) Date: Thu, 13 Dec 2001 07:39:59 +0100 Subject: os.mkdir() errno inconsistency on Windows? References: Message-ID: <9v9ifv$enm$1@news1.xs4all.nl> "Tim Peters" wrote in message news:mailman.1008107491.4060.python-list at python.org... > Only Microsoft knows: Python reports the errno value set by Microsoft's > _mkdir() function. Hmm. Great. Because Microsoft treats the root and its subdirectories as different objects, I have to write code that handles both cases. Anyway, thanks for clearing things up. The answer was quite obvious. Irmen de Jong From jgardn at alumni.washington.edu Tue Dec 4 20:32:52 2001 From: jgardn at alumni.washington.edu (Jonathan Gardner) Date: Wed, 5 Dec 2001 10:32:52 +0900 Subject: The Editor Poll results are in! In-Reply-To: References: <3bfd7f87@news.airtel.net> Message-ID: <200112050139.fB51deJ28532@my.knctv.co.kr> On Wednesday 05 December 2001 02:24 am, Grant Edwards wrote: > If I recall my chemistry correctly, "organic" refers to > chemical compounds involving carbon, espcially things with > carbon-carbon bonds forming chains/rings. > > Stuff like gasoline, plastics, nerve gas, that sort of thing. Kind of makes you wonder what us non-vegan people eat... Jonathan From chrishbarker at attbi.com Mon Dec 10 13:18:28 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Mon, 10 Dec 2001 10:18:28 -0800 Subject: Most popular Python modules/extensions? References: Message-ID: <3C14FC74.7AB77172@attbi.com> Robert Feldt wrote: > Are there any stats on the most popular/downloaded Python > extensions/modules? Any info relating to this appreciated. Why do you want to know? I was making noise about putting together a comprehensive Python distribution a while ago, and needed this info. Are you planning something like that? Just curious..... -Chris From jwbaxter at spamcop.net Wed Dec 26 20:09:07 2001 From: jwbaxter at spamcop.net (John W. Baxter) Date: Wed, 26 Dec 2001 17:09:07 -0800 Subject: Thinking in Python Revision 0.1 Available for Download References: Message-ID: <261220011709072938%jwbaxter@spamcop.net> In article , Bruce Eckel wrote: > Just under the wire, I've manage to post the first early alpha > version (0.1) of "Thinking in Python." You can go to the page that > connects you to the download here: > http://www.mindview.net/Books/TIPython Thank you, Bruce. You write so darn well that I'm hooked (and I haven't looked yet). I hope the project works out for you! --John From bokr at accessone.com Fri Dec 28 13:46:38 2001 From: bokr at accessone.com (Bengt Richter) Date: Fri, 28 Dec 2001 18:46:38 GMT Subject: REPOST: Re: [development doc updates] References: Message-ID: <9$--$$_----_-%__%$@news.noc.cabal.int> On Fri, 28 Dec 2001 00:03:42 -0500 (EST), "Fred L. Drake" wrote: >The development version of the documentation has been updated: > > http://python.sourceforge.net/devel-docs/ > >A variety of updates made since Python 2.2 was released. > > Do these devel-docs exist as downloadable .zip or .tgz of HTML tree? ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: bokr at accessone.com (Bengt Richter) Newsgroups: comp.lang.python Subject: cmsg cancel <3c2cbe75.81538125 at wa.news.verio.net> Control: cancel <3c2cbe75.81538125 at wa.news.verio.net> Date: Mon, 31 Dec 2001 02:34:56 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775134 27193 211.57.49.2 (31 Dec 2001 05:05:34 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:05:34 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From max at alcyone.com Mon Dec 17 02:19:22 2001 From: max at alcyone.com (Erik Max Francis) Date: Sun, 16 Dec 2001 23:19:22 -0800 Subject: Tar for python? Better compressed file archives 'r us? References: Message-ID: <3C1D9C7A.77FBFE2C@alcyone.com> Richard Jones wrote: > Does anyone have tar written in python? I've just compared the > difference > between a .zip and .tgz of the same directory structure, and the sizes > are: > > -rw-rw-r-- 1 builder builder 3796376 Dec 17 15:39 zope.zip > -rw-rw-r-- 1 builder builder 2270562 Dec 17 15:55 zope.tgz That's really zope.tar.gz; it's a gzip'ed tar file. Under UNIX we consider collecting a bunch of files into one (tar) and compressing them (compress or gzip) as two separate operations. I don't know if there's tar functionality available for Python; if not, simple concatenation of files with a tiny header at the end would be relatively straightforward. There _is_, however, support for gzip in Python; try the gzip module. -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ Laws are silent in time of war. \__/ Cicero Esperanto reference / http://www.alcyone.com/max/lang/esperanto/ An Esperanto reference for English speakers. From alanmk at hotmail.com Tue Dec 4 06:33:42 2001 From: alanmk at hotmail.com (Alan Kennedy) Date: 4 Dec 2001 03:33:42 -0800 Subject: upload file via form References: Message-ID: Hi Iddo, The solution to this problem should really be in the documentation for cgi.py You need to add an "enctype" attribute to your form declaration, so that the form data gets posted in the body of the HTTP request, rather than the header. So your FORM element should read like this

...
More details on this topic from the HTML spec at http://www.w3.org/TR/html4/interact/forms.html#edef-FORM Regards, Alan. Iddo Friedberg wrote in message news:... > Hi, > > This seems like a FAQ, but looking at the newsgroups, manuals etc. I could > not find a reference to this. > > I am trying to load a file to the server via a form. Here's the form: > > > > Try This > > >
>

Upload a file!

> > >
> > And here's the CGI script which is supposed to read and display the > contents: > > #!/usr/local/bin/python > import cgi > > form = cgi.FieldStorage() > if form['userfile'].file: > contents = form['userfile'].file.value > else: > contents = "Nothing here!" > > print "Content-type: text/html" > print > print "
"
> print contents
> print "
" > > I always get a "Nothing here!" What am I doing wrong? > > I'm using an Apache1.3, on Linux RH7.1. > > > Yours, > > Iddo From mwh at python.net Sat Dec 29 17:12:13 2001 From: mwh at python.net (Michael Hudson) Date: Sat, 29 Dec 2001 22:12:13 GMT Subject: REPOST: Re: Is learning Python "extraordinary"? References: Message-ID: <4$--$$_----___-$-$@news.noc.cabal.int> "Jesse F. W" writes: > I am a high school senior, and like many others, I am applying > to college. I am applying to MIT (as well as many other schools). > MIT describes what they are looking for as students who do or have > done "extraordinary things". My question is this, Is teaching > myself Python (with the aid of the Python tutorials and some help > from the various lists) an "extraordinary thing"? How many > python-list'ers are high school students? Dunno about Python specifically, but I'd hope that a willingness to learn new languages would help your cause. I bet most CS admission tutors fall off their chairs when an applicant has heard of a language that isn't C++, Java or VB. I'm not an admission tutor, though, so I may be unnecessarily pessimistic. Also I'd imagine that learning a little lisp is unlikely to hurt an application to MIT... Cheers, M. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Michael Hudson Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:03:01 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774527 27193 211.57.49.2 (31 Dec 2001 04:55:27 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:55:27 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From tweek154 at yahoo.com Wed Dec 26 14:30:33 2001 From: tweek154 at yahoo.com (tweek) Date: 26 Dec 2001 11:30:33 -0800 Subject: REPOST: dtuple and sql functions Message-ID: <0$--$$-$$$$%_%-_$$@news.noc.cabal.int> i am dealing with converting the date format from a MySQL database and i'd prefer to use the built in sql function than convert it using python. here is what im trying to accomplish: flist = ["AssignedTo", "DATE_FORMAT(DueDate, '%m/%e/%Y')"] descr = dtuple.TupleDescriptor([[n] for n in flist]) sql = """SELECT %s FROM joblog""" % ", ".join(flist) c.execute(sql) temp = c.fetchall() now unfortunately the field name is now called: temp.DATE_FORMAT(DueDate, '%m/%e/%Y') which should be invalid anyways. what i want is to use it as temp.DueDate Tweek ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!nycmny1-snh1.gtei.net!news.gtei.net!newsfeed.mathworks.com!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: tweek154 at yahoo.com (tweek) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:56:06 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009776125 27193 211.57.49.2 (31 Dec 2001 05:22:05 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:22:05 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From use-net at schabi.de Wed Dec 5 04:25:53 2001 From: use-net at schabi.de (Markus Schaber) Date: Wed, 5 Dec 2001 10:25:53 +0100 Subject: Fullscreen window in pythongtk References: <20011204155812.0c760e00.use-net@schabi.de> Message-ID: <20011205102553.63b6bd4a.use-net@schabi.de> Hi, On Tue, 4 Dec 2001 15:58:12 +0100 Markus Schaber wrote: > Now the window has the correct size, but the window manager shifts the > window left and down so the left and top decoration (title bar etc.) are > visible. (I'm using sawfish/gnome. Opera and XAWTV do fullscreen fine.) Just an addition: Logging in in the failsafe xterm mode, and then running my program without any window manager does it correct. So I think I only miss some hints I have to give to the window manager. Thanks, markus -- "GPL software is not free - the cost is cooperation" From zope at thewebsons.com Sun Dec 16 12:52:08 2001 From: zope at thewebsons.com (Ben Ocean) Date: Sun, 16 Dec 2001 09:52:08 -0800 Subject: Compiling Python with Tkinter In-Reply-To: References: Message-ID: <5.1.0.14.0.20011216094846.00a03400@thewebsons.com> At 01:59 PM 12/16/01 +0100, you wrote: >Ben Ocean writes: > > > Here's what I've done but it doesn't work: > >Can you elaborate how exactly it does not work? With the information >you gave us, I'd say you have done everything correctly. That assumes, >of course, that tcltk is really installed in /opt/tcltk, that the >include files and libraries are present, that PIL is installed in >../Extensions, that the Tcl version you have is 8.3, and so on and so >forth. After correcting a few mistakes to which you brought my attention, I now get this output upon attempting make: ... In file included from ./Modules/_tkinter.c:45: /opt/tcltk/include/tk.h:83:29: X11/Xlib.h: No such file or directory This file does *not* exist, anywhere: #find / -name "Xlib.h" #find / -name "X11*" /usr/bin/X11 /usr/lib/X11 /usr/X11R6 /usr/X11R6/lib/X11 /var/cache/man/X11R6 /etc/X11 #ls /usr/X11R6/lib/X11/ fs #ls /usr/bin/X11/ fsinfo fslsfonts fstobdf mkfontdir xfs #ls /etc/X11/ applnk fs prefdm I never use XWindows, so I'm wondering if it's even installed properly, or if I really need it for Tkinter. Your advice? TIA, BenO From andreas at mtg.co.at Sat Dec 1 06:32:11 2001 From: andreas at mtg.co.at (Andreas Kostyrka) Date: Sat, 1 Dec 2001 12:32:11 +0100 Subject: Whatever happened to String Interpolation? In-Reply-To: <9u6kft$5b$1@peabody.colorado.edu> References: <9u6dbn$nsj$1@peabody.colorado.edu> <9u6kft$5b$1@peabody.colorado.edu> Message-ID: <200112011132.fB1BWJn02092@lap1.mtg.at> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am Mittwoch, 28. November 2001 19:10 schrieb Fernando P?rez: > A more serious one: dynamic code generation. Just today I had to jump > through some annoying hoops (like defining x="'%s'" and y='%' and use > those in a string) to generate code that would include % characters > but which would first have to be parsed by a %. I know this isn't > exactly common, though. What about "%%%(x)s%%" % locals() > I am a big defender of not extending things unless truly needed, and > with time I've learned to do things the 'python way', without saying > at every corner 'but language_x has this feature!'. But string > handling is the one that *constantly* feels kludgy in an otherwise > stunningly clean and elegant language. Nope it does not ;) Adding magic handling of strings would make another wart in a clean and elegant language. > > I felt that pep215 had a clean argument, the extension is very > orthogonal to the existing features, and can make a lot of code > simply a lot cleaner. I feel those are strong arguments. Not really. Python already has: 1.) print >>f, data 2.) "format" % data If you do not want exact formating the first one is quite acceptable: >>> import cStringIO >>> x=cStringIO.StringIO() >>> print >>x, "Hello World." >>> x.getvalue() 'Hello World.\n' > Well, I can keep dreaming... Try Ruby. It's got more perlish features. Andreas - -- Andreas Kostyrka; Raiffeisenstr. 16/9; 2320 Zw?lfaxing Tel: +43/676/4091256; Fax: +43/1/7065299 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8CL/AHJdudm4KnO0RAsfuAKDNxz6nibRM5U7qUaB1XBUN6LgKvwCfU2Pz g5gfuw07Gm3NHrbWA7ePvi0= =A74K -----END PGP SIGNATURE----- From mynews44 at yahoo.com Mon Dec 10 00:55:24 2001 From: mynews44 at yahoo.com (google account) Date: 9 Dec 2001 21:55:24 -0800 Subject: Is c or c ++ my language for this task... Or is it Python? Message-ID: Hi guys. I have just recently purchased for myself a Pioneer DVD-Rom drive. I was hoping that there would be a piece of software available that would give me some added info about movie titles that I placed in it. Information such as the encoding method, whether it is RSDL or what.. If it is RSDL, where the layer changes (this is the vital thing!), possibly a layer indicator as seen on Sony DVD players (a little graphic that indicates whereabouts on the side the laser is pointing at any moment) what compression methods/levels are used for video and audio, whether it has been 16x9 enhanced or not. I can't think of anything else right now, but I am sure I will one day soon. Anyways, I can't seem to see a piece of software out there that provides this data for me and so undaunted I am going to write it for myself. The biggest problem for me is that I am pretty much a total newbie as a programmer. I have used python to write a few scripts to automate some of the more boring tasks required to maintain a unix based apache server (such as adding virtualhost entries to the httpd.conf or creating users with chrooted ftponly access) and I did one semester of c++ (where I got full marks in a year that failed over 50% of students*) but apart from that, nothing. What I want to know is what language I am going to have to learn to accomplish what I need. I should imagine that it will require some relatively low level stuff, probably the creation of a dll file that can talk to the driver, as well as some nice gui front end stuff later on. I am thinking that I can use c or c++ for the low level driver communication and maybe python to create a pretty gui. Perhaps I can do the lot in C. Perhaps I should use something different. Perhaps you guys could suggest a better method to begin planning from... Really, any help would be great. TIA Google account spam catcher. nemir at hot mail dot com From fperez528 at yahoo.com Tue Dec 25 18:44:44 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Wed, 26 Dec 2001 23:12:44 +2328 Subject: custom split function References: Message-ID: I.J. wrote: > Hi > Is there a way to spit file content into list of individual > bytes/characters. > I know it could be done with substring manipulation but I hope there is more > direct way. > Bye file = open('filename') file_as_string = file.read() Now you have your whole file in a string, which for most purposes can be thought of as a list of characters. And you can always do file_as_list = list(file_as_string) if you really want it as a list. hth, f From schneiker at jump.net Sat Dec 29 23:07:06 2001 From: schneiker at jump.net (Conrad Schneiker) Date: Sat, 29 Dec 2001 22:07:06 -0600 Subject: REPOST: Re: Python and Ruby: a comparison References: <3C2B9A61.EE1618DB@earthlink.net> <2WpX7.1145$0s5.714029@news20> <3C2E645C.429536E8@earthlink.net> Message-ID: <5$--$$_----__-_$_$@news.noc.cabal.int> "Ron Stephens" wrote: > Very interesting idea. Unfortunately, I doubt if it woudl be possible. For one > thing, very few people would be willing to compromise on syntax. Ruby folks > would rightfully be loath to give up their end-begin block delimiters, and > likewise we Python folks would not want o give up our whitespace block > delimiters. If that were the most serious problem, their might be some hope after all. After all, while both language camps admonish newbies to get used to their respective style and point out respective offsetting advantages that may not be evident at first, do _most_ people _really_ care that much? I mildly dislike indendation syntax, but that wouldn't keep me from using a successor language if indendation syntax proved a simpler and cleaner way overall of incorporating all Python3000/Ruby.next features. Hopefully most other people would feel that way, or vice versa. I would expect the biggest practical hurdle to be whether Matz and Guido were interested and could discover/invent something mutually desirable. I would expect (naively perhaps) that most people would follow their lead. > Also, backwards portability would be a big problem. Granted, which was why the anticipated (albeit hypothetical) Python3000/Ruby.next syntactic discontinuties was the point of departure for discussion. > However, for what its worth, the PERL 6 implements, whom I met and conversed > with at the MIT Lightweight Languages conference, are definitely truing, as a > goal, to create a PERL 6 runtime environment that can easily and credibly, > someday later on, run Perl, Ruby, and Python. I'm looking forward to that. And there are plans to develop tools to deal with the backwards portability issues between Perl 5 and Perl 6 too. "Boris Borcic" wrote: > I guess what I mean to say, exactly, is that the weakest form > for an analogue to a "middle ground for a single successor language" > might be not a single successor language, but a pair of parallel > subsets of each language that can be automatically translated > source-to-source while preserving a smack of idiomatical expression. Interesting idea. Conrad ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Conrad Schneiker" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:40:31 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774405 27193 211.57.49.2 (31 Dec 2001 04:53:25 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:53:25 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From phd at phd.pp.ru Sat Dec 29 11:56:48 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Sat, 29 Dec 2001 19:56:48 +0300 Subject: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) In-Reply-To: <3c2de385.9780406@news.t-online.de>; from gerson.kurz@t-online.de on Sat, Dec 29, 2001 at 03:44:35PM +0000 References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> Message-ID: <20011229195648.A864@phd.pp.ru> On Sat, Dec 29, 2001 at 03:44:35PM +0000, Gerson Kurz wrote: > > Ruby has exception handling features, like Java or > > Python, to make it easy to handle errors. > Call me oldfashioned, but I don't like exception handling - I like > if-then-else and error checking style. Exception handling is cool for > exceptions - that is: *unlikely* situations -, but it is not cool for > something as commonplace as open() failing because the file doesn't > exist. Ok, let me call you oldfashioned. Errno chcecking is good in local context: file = open(...) if not file: report_error() But is not so easy to pass errno to upper context. To explain what I mean I am writing a pice of code using exceptions: def top(): try: upper() except IOError: report_error() def upper(): data4 = lower() process(data4) def lower(): file = open(...) retunr file.read(4) Now please rewrite the code without exceptions, using errno checking. Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From ben at wblogan.net Mon Dec 24 08:57:48 2001 From: ben at wblogan.net (Ben Logan) Date: Mon, 24 Dec 2001 08:57:48 -0500 Subject: Libplot: PS busted? Message-ID: <20011224085748.A6949@newcreature.org> Hi, I'm using the python libplot module (from biggles.sourceforge.net/libplot), and am having trouble getting any Postscript output. The following script doesn't produce any errors or ps output: #!/usr/bin/python2 import libplot ofile=open("test.ps","w") efile=open("errors","w") pl = libplot.Plotter("ps",outfile=ofile,errfile=efile) pl.openpl() pl.fspace(0,0,20,20) pl.pencolor(0,0,0) pl.fline(0,0,20,20) pl.circle(10,10,5) pl.closepl() ofile.close() efile.close() Yet, if I replace the plotter type "ps" with "fig", and change the filename to "test.fig", I get a valid Fig file. Has anyone had any experience with this module? What am I missing? Thanks, Ben -- Ben Logan: ben at wblogan dot net OpenPGP Key KeyID: A1ADD1F0 Ah say, son, you're about as sharp as a bowlin' ball. From gmcm at hypernet.com Sun Dec 9 20:04:48 2001 From: gmcm at hypernet.com (Gordon McMillan) Date: 10 Dec 2001 01:04:48 GMT Subject: Does 'super' exist? References: Message-ID: Bruce Eckel wrote: [...] > This happened to some degree with Java's awful > 'System.out.println()' which I tried shortening to prt() or > something, but finally realized that everytime someone saw that > they'd have to think "oh, that's actually System.out.println()," > wasting one of the 7+-2 things they can hold in their head at any > one time. Man I wish package authors (who typically want to expose a.b...z as a.z for "ease of typing") would realize this. Experienced users have easy ways of shortening the load on their fingers, but beginners are frustrated in their attempts to "use the source, Luke". -- Gordon http://www.mcmillan-inc.com/ From fgeiger at datec.at Wed Dec 19 02:49:32 2001 From: fgeiger at datec.at (F. GEIGER) Date: Wed, 19 Dec 2001 08:49:32 +0100 Subject: [VPython] Why are some objects displayed and some are not? Message-ID: <9vpgra$k68$1@newsreaderg1.core.theplanet.net> I wanted to display a pile of boxes of different sizes. So I tried the 2-liner of the tutorial: redbox=box(pos=vector(4,2,3), size=(8.,4.,6.),color=color.red) greenball=sphere(pos=vector(4,7,3), radius=2, color=color.green) Worked: Displayed a red box with a green sphere upon it. Then I tried redbox=box(pos=vector(4,2,3), size=(8.,4.,6.),color=color.red) #greenball=sphere(pos=vector(4,7,3), radius=2, color=color.green) Did not work: The screnn stayed black. So I seem to miss something when displaying objects. What does the sphere do, that the box does not? Any hints? Thanks in advance and best regards Franz P.S.: ASPython 2.1.1 on W2k Prof./SP2, VPython of 10. Dec. 2001 From sill at sill.silmarill.org Sun Dec 16 16:09:48 2001 From: sill at sill.silmarill.org (Andrei Kulakov) Date: Sun, 16 Dec 2001 21:09:48 GMT Subject: persistant options References: Message-ID: In article , Andrei Kulakov wrote: > Hello, > > I'm looking for solutions or advice on persistant options / config file. > > Here's an example file: > > ~/.programrc > # this option does [...] > opt1 = 3 > > When the program is run and this option's changed from inside program, > it should be written back to the config file. > > I know how to do this but I thought maybe there's a module that does > this sort of thing already. I searched VoP but there's nothing of this > sort there.. It seems like a lot of programs would benefit from this > capability.. right? > > - Andrei > When I was asking that question, I thought about having a conf file that's both modified by user directly and updated by program when user changes some options there, but now that I thought about this, I realized some options should be in a conf file and shouldnt' be changed from inside program at all, while others can be changed from the program and kept in a shelve file or a dbm file and shouldn't be in the conf file. Thanks to all who answered! - Andrei -- Cymbaline: intelligent learning mp3 player - python, linux, console. get it at: cy.silmarill.org From wtr at hannover.sgh-net.de Mon Dec 10 16:07:06 2001 From: wtr at hannover.sgh-net.de (Wolfgang Teschner) Date: Mon, 10 Dec 2001 22:07:06 +0100 Subject: jpeg files displayed in a loop Message-ID: Hi, I want to automatically display all jpeg files of a dir in a long loop, with a wait time between the different displays. Just that. No user input. With PIL, it seems to be impossible because of TKinters mainloop. Are there other ways/packages for this purpose? Just displaying the images as they are... platform is win32, but I would be interested for independant solutions, if they exist. Thanks, wolfgang teschner From barry at zope.com Thu Dec 27 22:27:24 2001 From: barry at zope.com (Barry A. Warsaw) Date: 27 Dec 2001 22:27:24 -0500 Subject: age of new pythonistas References: Message-ID: >>>>> "FL" == Fredrik Lundh writes: FL> iirc, Barry's a few years older than Mark (or was it the other FL> way around?), and I'm a few years older than my sister. I'm definitely the middle child of the Pythonlabs crew, which is weird because I'm the oldest of my siblings. In an interesting twist of fate or karma, Guido and Tim like to make me drink strange concoctions they claim is really weak beer, but which I'm beginning to suspect is not. -Barry From grey at despair.dmiyu.org Thu Dec 27 20:10:55 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Fri, 28 Dec 2001 01:10:55 -0000 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9901.998345FB@earthlink.net> Message-ID: On Thu, 27 Dec 2001 21:53:41 GMT, Ron Stephens wrote: > Now, my perception is that most Ruby developers run under Linux or some > other Unix. I wonder what percentage of Python developers run Windows, and > what percentage run Linux? I have no idea, does anyone have a guess? If you > put my back to the wall to make a prediction, I'd guess that more than half > of us on this newsgroup use windows. Anyone? Well, sure, worded that way. I /use/ Windows. I need something for my games and while Linux suits 99.5% of my productivity needs it isn't quite there in the games market. Did you mean, perhaps, use Windows exclusively? -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From fdrake at acm.org Fri Dec 28 00:03:42 2001 From: fdrake at acm.org (Fred L. Drake) Date: Fri, 28 Dec 2001 00:03:42 -0500 (EST) Subject: [development doc updates] Message-ID: <20011228050342.CB129286BB@beowolf.digicool.com> The development version of the documentation has been updated: http://python.sourceforge.net/devel-docs/ A variety of updates made since Python 2.2 was released. From fdrake at acm.org Tue Dec 11 17:16:01 2001 From: fdrake at acm.org (Fred L. Drake) Date: Tue, 11 Dec 2001 17:16:01 -0500 (EST) Subject: [development doc updates] Message-ID: <20011211221601.DB780286BC@cj42289-a.reston1.va.home.com> The development version of the documentation has been updated: http://python.sourceforge.net/devel-docs/ Many various updates, including documentation for generators and extended call syntax. From prjoshi at ntc.net.np Sun Dec 30 06:44:49 2001 From: prjoshi at ntc.net.np (extremelogic2002) Date: Sun, 30 Dec 2001 11:44:49 -0000 Subject: About Icons and Tkinter Message-ID: How to change icons in Tkinter applications? Thanks From tim.one at home.com Sun Dec 9 18:49:36 2001 From: tim.one at home.com (Tim Peters) Date: Sun, 9 Dec 2001 18:49:36 -0500 Subject: Calling a generator multiple times In-Reply-To: Message-ID: [Tim] > A BDFL Pronouncement is called for precisely in those areas where > extended debate has proved that consensus will never be reached. The > choices then are eternal paralysis, or, if Guido wants something enough, > he breaks the deadlock by Decree and life moves on. [Courageous] > This is fair enough, and I can live with it. That's good -- since the alternative appears to be death . > It's not like generators are all that hard, or anything. And it's not > that I think that the current _behavior_ of generators is wrong; rather, > I'm flummoxed as to the leaving of the syntax as it is, as it leads to > surprises. The syntax as is predicts other behavior to me. > > For example, when I wrote my first generator, I knew _conceptually_ > exactly what to expect based on my prior use of stackless > continuations, continuations in lisp, cooperative multi-threading > environments I've written, and esoteric and ill-advised :) use of > setjmp and longjmp in the past. This isn't typical. Most people coming to generators won't have any relevant experience beyond vanilla function calls. The syntax chosen emphasizes the similarities to functions, not the differences. In this respect it follows the Icon language, which also makes no syntactic distinction between generators and functions (although the reason for that cuts deeper in Icon -- still, the conceptual distinction exists there too, and the lack of multiple syntactic clues there hasn't been a problem for them in real life either). > However, what threw me was the behavior on the first invocation. > Since I was defining a method, I expected that when called the > first time the code prior to first yield would execute. That's > not what happened. The code executed on the first next. Sure, that's how they work, and it sounds like you also dived in at the deep end. The expected first use for generators is via: for whatever in generator(): process whatever Indeed, Icon and CLU both *restrict* generators to iteration contexts. Tying it into Python's iteration protocol, and exposing .next(), are advanced features. Most users won't need to know about that. > I can see perfectly well why it went the other way, but I certainly > hope you can see how I would state that code appearing in a function > definition probably ought to execute when the function is apparently > called or someone is going to be surprised. I'd be more sympathetic if it required great effort to get unconfused again; but it doesn't, so I'm not more concerned about this than that, e.g., mutating methods of mutable objects generally return None (another thing you were suprised by a few days ago). > And they will be. I guarantee it. I'm willing to bet that almost > every single new user of generators is going to encountered this > and have the same experience of surprise. Some will, some won't. If they stick to generators in for-loops, the question will never even arise -- "it just works" then. > Will this _baffle_ anyone? Hell, no. It's not that hard to say > "what the fuck!?", read the manual a little more carefully, and > come to an understanding. It's not a _difficult_ concept to > grasp, just an unexpected one. Expectations come from prior experience, and you had too much <0.6 wink>. These isn't Scheme, or even Stackless Python. Most people will get their expectations about how generators work from the Python docs. From kmarkie2002 at yahoo.com Mon Dec 17 09:14:26 2001 From: kmarkie2002 at yahoo.com (kmarkie2002) Date: Mon, 17 Dec 2001 14:14:26 -0000 Subject: CONVERTING TIFF FILES TO JPEG FILES Message-ID: <9vkuk2+8a3i@eGroups.com> Hello- I'm looking for a way to convert a TIFF file to a JPEG file. Is there a free program that I can download for this? From pete at shinners.org Tue Dec 4 11:49:52 2001 From: pete at shinners.org (Pete Shinners) Date: Tue, 04 Dec 2001 16:49:52 GMT Subject: "print 0.1==0.1" -> TypeError; what did I do? References: <87pu5vqxvv.fsf@dgp.toronto.edu> <87bshf7yb1.fsf@dgp.toronto.edu> Message-ID: <3C0D0000.2090208@shinners.org> Maciej Kalisiak wrote: >> hasattr(None, "spam") >> > > Yes! After following your suggestions about PyErr_Occurred() I > quickly found the problem, thanks! I'm curious though, how exactly > did the above statement get rid of the exception?? v = PyObject_GetAttr(v, name); if (v == NULL) { PyErr_Clear(); Py_INCREF(Py_False); return Py_False; } if you peek inside the "hasattr" source, you see this block. if the object does not have the given attribute, an AttributeError will replace your current one when calling "PyObject_GetAttr". hasattr then clears this python error and returns. therefore, the exception being raised by your function is being overwritten by another exception, then all the exceptions are cleared. (and your exception magically goes away) of course, in the correct python world, the code would have never gotten this far, because your extension function _must_ return NULL if anything raised an exception inside it. From chris.gonnerman at newcenturycomputers.net Sun Dec 2 09:56:46 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Sun, 2 Dec 2001 08:56:46 -0600 Subject: cgi question! problem with correct python version References: <9ucugc$7lqqu$1@ID-75083.news.dfncis.de> Message-ID: <001601c17b41$aab89a00$0101010a@local> ----- Original Message ----- From: "Markus Jais" > hello > I am using RedHat 7.1 and I have installed the old python 1.5.2 which seems > to be needed by RedHat 7.1 and also the Python 2.1 > > now I have a strange problem. > > 1st script: > ---- > #!/usr/bin/env python Here is your confusion... /usr/bin/env looks for a program in the PATH. Your PATH variable is different than the webservers. < hack hack > > #!/usr/local/bin/python > > then I get verison 2.1 That's what you should be doing in your case. > can anybody tell me, why the apache is using the old version?? > is there something wrong with the environment of apache??? No, /usr/local/bin is just not in Apache's PATH, likely for security reasons. From aahz at panix.com Thu Dec 27 16:57:55 2001 From: aahz at panix.com (Aahz Maruch) Date: 27 Dec 2001 13:57:55 -0800 Subject: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B941D.B1E45AA5@htp-tel.de> Message-ID: In article <3C2B941D.B1E45AA5 at htp-tel.de>, Tom Karas wrote: > >What means nntp ? It's a protocol for transferring netnews articles, the way HTTP is a protocol for transferring HTML documents. For more information, poke around Google. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 4 days and counting From mcfletch at rogers.com Thu Dec 6 01:58:08 2001 From: mcfletch at rogers.com (Mike C. Fletcher) Date: Thu, 06 Dec 2001 01:58:08 -0500 Subject: Multi-isinstance idiom (Re: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)) References: <3C0EAEBF.61858076@cosc.canterbury.ac.nz> Message-ID: <3C0F1700.9050800@rogers.com> That doesn't seem to keep the semantics, it only works if the tested class is an actual sub-class of your combination class, not if it's a child of just one of the parents (that is, it's an "and" test with an extra class added as well). If you want an or test, how about: try: raise f except (future.Step, yada, yada): blah except: stuffWhenNotSubClass Problem is that it's nothing like intuitive, an explicit function like: def ismultiinstance( test, classes ): for classObject in classes: if isinstance( test, classObject): return 1 return 0 Would be much easier to read, though not very computationally efficient (extra function call, loop overhead) compared to letting the C exception machinery handle the project. Enjoy, Mike Greg Ewing wrote: >Bjorn Pettersen wrote: > >>>From: Courageous [mailto:jkraska at san.rr.com] >>> >>> if isinstance(f, future.Step) or \ >>> isinstance(f, future.Status) or \ >>> isinstance(f, future.Announce) or \ >>> isinstance(f, possibility.Observe) or \ >>> isinstance(f, future.Incarnate) or \ >>> isinstance(f, future.Start) or \ >>> isinstance(f, future.Timeout): >>> >>Ack, so much typing :-) >> > >How about > > class ClassesOfInterest(future.Step, future.Status, future.Announce, > possibility.Observe, future.Incarnate, future.Start, >future.Timeout): > pass > > if isinstance(f, ClassesOfInterest): > ... > From sholden at holdenweb.com Tue Dec 18 16:43:50 2001 From: sholden at holdenweb.com (Steve Holden) Date: Tue, 18 Dec 2001 16:43:50 -0500 Subject: Reading files References: Message-ID: "Preben" wrote in message news:yHOT7.43$cf4.2324 at nreader3.kpnqwest.net... > I've noticed when I read/make a file on linux-based systems, they get messed > up on win-systems. > > Sombody told me that it's the 'end-string' char thats different... Is this > true? > > And how can I easily make a converter? > just chop the endline char and replace it? > Just the the Tools/scripts/lfcr.py script from your distribution! regards Steve -- http://www.holdenweb.com/ From imvenki at hotmail.com Fri Dec 21 03:52:29 2001 From: imvenki at hotmail.com (venkatakrishnan.k) Date: 21 Dec 2001 00:52:29 -0800 Subject: Bus Error in HP-UX 11.00 References: <950ee0f0.0112172230.1d7eba3f@posting.google.com> <950ee0f0.0112200655.4a0325be@posting.google.com> Message-ID: <950ee0f0.0112210052.6af7dc1c@posting.google.com> Since i have to again compile python from source, i just want to see whether anybody provides HP ported binaries for Python2.2 !!!! thanks, venkatakrishnan.k Jody Winston wrote in message news:... > imvenki at hotmail.com (venkatakrishnan.k) writes: > > > Hai, > > I was using Python2.1 which was build from source using gcc-3.0.1 > > compiler. > > I did the conventional configure, make & make install dance for my > > source. > > Whether i was right or wrong,i concluded that the problem was with my > > build. > > So i opted for a readymade binary for python for HP. > > I got a HP-ported python binary from > > > > http://hpux.connect.org.uk/hppd/hpux/Languages/python-2.1 > > > > and i am no longer getting that "Bus Error". > > So i assumed that my conclusion was right. > > > > But i have one more problem. > > I am actually porting my python code developed for Windows to HP. > > I use ActivePython-2.1 from www.activestate.com for Windows. > > It comes with builtin support for packages like distutils & zlib. > > But i was shocked to see that these packages are missing in my HP-UX > > binary. > > Now i am searching for a binaries for all such additional packages. > > Does anybody have the binary or i have to do the same 'configure ;make > > ; make install' activity???? > > > > Python 2.2 builds and runs straight out of the box on HP using HP's > compilers. You'll get distutils but you'll have to download zlib and > compile it then add it to Setup/Modules. From lac at strakt.com Fri Dec 7 05:45:05 2001 From: lac at strakt.com (Laura Creighton) Date: Fri, 07 Dec 2001 11:45:05 +0100 Subject: cmd module documentation lying? In-Reply-To: Message from "pwang99c" of "." <9upn65+mast@eGroups.com> References: <9upn65+mast@eGroups.com> Message-ID: <200112071045.fB7Aj5ua023654@ratthing-b246.strakt.com> 1. first of all, you appear to be sending to python-list at cwi.nl, which I suspect of being a copy of python-list at python.org. I happened to read my cc line, and I have moved it to python-list at python.org. If python-list at cwi.nl forwards transparantly, then I just didn't need to, there is no problem. But I am one of those odd people that read mail headers, a lot, and I don't recall this before. So perhaps you have a problem... > so... is this a known problem, or am i misunderstanding something? should i > be emailing David Beazley about his book? or is there some place for more up > -to-date documentation on the cmd module? (besides the source itself. :-) Yes. http://systems.cs.uchicago.edu/python/ You want the Bug database. I don't know if your bug is there offhand, if not that is where you should put it. Laura Creighton From maxm at mxm.dk Sun Dec 30 11:36:03 2001 From: maxm at mxm.dk (maxm) Date: Sun, 30 Dec 2001 17:36:03 +0100 Subject: Zope Documentation (was RE: Python Popularity: Questions and Comments) References: <3C2E55A6.D873E301@engcorp.com> Message-ID: <%nHX7.5124$aS.893825@news010.worldonline.dk> "Bill Tate" wrote in message > "Xxxxxx is the world's first company dedicated to using the science > of experience strategy, design, and technology to create > extraordinary results for our clients. > > Our entire team is committed to transforming our clients' > businesses through the creation of multi-channel experiences that > inspire and strengthen dynamic connections among people, businesses, > channels, and communities." Somebody needs to read the cluetrain manifesto ;-) http://www.cluetrain.org/ regards Max M From michele at diee.unica.it Mon Dec 24 11:31:39 2001 From: michele at diee.unica.it (Michele Marchesi) Date: Mon, 24 Dec 2001 17:31:39 +0100 Subject: XP2002 - FINAL CALL FOR PAPERS Message-ID: <3C27586B.F2E21CE@diee.unica.it> ********* XP2002 - FINAL CALL FOR PAPERS ********* ********* DEADLINE EXTENSION!! ********* Please note that the call for paper deadline has been extended to January, 10, 2002. A call for Practitioner's Reports expiring on February 28, 2002 has been added. ****************************************** 3rd International Conference on eXtreme Programming and Agile Processes in Software Engineering - XP2002 26-29 May, 2002, Alghero, Sardinia, Italy Home Page: http://www.xp2002.org General Chair: Kent Beck, Three Rivers Institute, USA Program Chair: Michele Marchesi, University of Cagliari, Italy Program Co-chair: Giancarlo Succi, University of Bolzano, Italy PRESENTATION OF XP2002 Building on the success of XP2000 and XP2001, the Third International Conference on eXtreme Programming and Agile Processes in Software Engineering will be a forum to discuss theories, practices, experiences, and tools on XP and other agile software processes, like SCRUM, the Adaptive Software Process, Feature Driven Development and the Crystal series. XP2002 will bring together people from industry and academia to share experiences and ideas and to provide an archival source for important papers on agile process-related topics. The conference is also meant to provide information and education to practitioners, identify directions for further research, and to be an ongoing platform for technology transfer. The conference will include technical presentations, panels, poster sessions, activity sessions, workshops, and tutorials. CONFERENCE TOPICS The conference will stress practical applications and implications of XP and other agile processes (AP). Conference topics include, but are not limited to: - Foundations and rationale of XP and AP - Case studies and experiments - Methodology and process - Organizational and management issues and patterns - Scalability issues - Education and training - Introducing AP into an organization - Relation to reuse - Relation to UML and the Unified Process - Relation to the CMM and ISO 9001 - Empirical findings of XP and AP effectiveness - XP Practices: user stories, on-site customer, planning game, short releases, metaphor, simple design, refactoring, pair programming, continuous integration, collective code ownership, no overtime, coding standards - Unit and acceptance testing: practices and experiences - Use of supportive software development tools and environments - Refactoring and continuous integration - Merging of agile processes - Other issues on agile methodologies IMPORTANT DEADLINES: Workshops and active sessions proposals: December 31, 2001 Paper submission: January, 10, 2002 Paper acceptance notification: February 20, 2002 Practitioner's Reports submission: February 28, 2002 Practitioner's Reports acceptance notification: March, 15, 2002 Final manuscript submission: April 1, 2002 For more information, including conference topics and instructions to authors, please refer to XP2002 Web site: http://www.xp2002.org or send an e-mail to: michele at diee.unica.it [Apologies if you receive this more than once] -- ________________________________________________________ /\ \ \_| Prof. Michele Marchesi | | DIEE - Univ. Cagliari - p.zza D'Armi - 09123 CA | |Tel:+39 070 6755899/+39 010 3532783 Fax:+39 070 6755900| | Cell.: 338 8349880 - Casa/Home: +39 010 566354 | | e-mail: michele at diee.unica.it | | XP2002 site: http://www.xp2002.org | | ____________________________________________________|__ \_/______________________________________________________/ From simon at brunningonline.net Tue Dec 11 10:04:36 2001 From: simon at brunningonline.net (Simon Brunning) Date: 11 Dec 2001 07:04:36 -0800 Subject: Problems using tkSimpleDialog Message-ID: <314b29e9.0112110704.1b42edd4@posting.google.com> I an having trouble with this module. I'm running Python 2.1 on Win NT 4. Here is what I am doing: Python 2.1.1 (#20, Jul 20 2001, 01:19:29) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. >>> import tkSimpleDialog >>> tkSimpleDialog.askstring('Title in here', 'Prompt here') Traceback (most recent call last): File "", line 1, in ? File "D:\dev\python\lib\lib-tk\tkSimpleDialog.py", line 287, in askstring d = apply(_QueryString, (title, prompt), kw) File "D:\dev\python\lib\lib-tk\tkSimpleDialog.py", line 177, in __init__ Dialog.__init__(self, parent, title) File "D:\dev\python\lib\lib-tk\tkSimpleDialog.py", line 71, in __init__ self.geometry("+%d+%d" % (parent.winfo_rootx()+50, AttributeError: 'None' object has no attribute 'winfo_rootx' >>> Interestingly, I *do* see the required dialog here, along with an empty window titled 'tk'. Entering anything into the dialog gets me: Exception in Tkinter callback Traceback (most recent call last): File "D:\dev\python\lib\lib-tk\Tkinter.py", line 1285, in __call__ return apply(self.func, args) File "D:\dev\python\lib\lib-tk\tkSimpleDialog.py", line 127, in ok self.cancel() File "D:\dev\python\lib\lib-tk\tkSimpleDialog.py", line 132, in cancel self.parent.focus_set() AttributeError: 'None' object has no attribute 'focus_set' What am I doing wrong? Cheers, Simon B. From jkraska at san.rr.com Sat Dec 8 12:15:53 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 08 Dec 2001 17:15:53 GMT Subject: Calling a generator multiple times References: <0gn21usqeasqa1bp4sveh0vjagtmbmfpof@4ax.com> <3C11FE92.1218662@letterror.com> Message-ID: >If it _was_ "plain wrong" it wouldn't be the way it is. One of the objections to what I've written has been, on several occasions, "After you've worked with them for a while, you'll not have any problems with them" or some equivalent. What's wrong-headed about this kind of thinking is that this is true of original programmers everywhere. They always generally understand their own code. Embedding a keyword deep in a function definition and then having this embedding make the function in effect behave entirely differently isn't just wrong, it's bizarre. C// From eppstein at ics.uci.edu Thu Dec 6 20:46:42 2001 From: eppstein at ics.uci.edu (David Eppstein) Date: Thu, 06 Dec 2001 17:46:42 -0800 Subject: PEP 276 Simple Iterator for ints (fwd) References: <9uomtp$e1cbj$1@fido.engr.sgi.com> <9up46o$e2ost$1@fido.engr.sgi.com> Message-ID: In article <9up46o$e2ost$1 at fido.engr.sgi.com>, pj at sgi.com (Paul Jackson) wrote: > Ok - so you choose to go down that fork in the decision tree: > > The problem I have with this then is that it results > in the comparison operators <, <=, ..., >, >= sometimes > requiring a list of assignable expressions on one or the > other side, as opposed to their current usage, which > requires comparable expressions on both sides. > > This sort of subtle, context sensitive syntax change > feels weird and unsettling to me. And you're not equally unsettled by the identical behavior of "in"? > I suspect you wouldn't want me to be able to say: > > for (1,10) <= (a,b) <= (2,11): > > Or perhaps you would ?? This starts to get complicated again. I'm not sure about that one. -- David Eppstein UC Irvine Dept. of Information & Computer Science eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/ From dyoo at hkn.eecs.berkeley.edu Thu Dec 27 01:32:39 2001 From: dyoo at hkn.eecs.berkeley.edu (Daniel Yoo) Date: Thu, 27 Dec 2001 06:32:39 +0000 (UTC) Subject: REPOST: Re: How to include text and images both in a single PS file References: Message-ID: <4$--$$-$$$$%_%__-$@news.noc.cabal.int> vbman8 wrote: : How to create a PS file that will first have some text then some : picture and then again text in it. Please give full example and/or : the links. Thanks. Have you had a chance to look at ReportLab yet? http://www.reportlab.com/download.html It appears that ReportLab can output Postscript as well as PDF files, so it's worth a look. Good luck to you. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!news.kigam.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Daniel Yoo Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:45:12 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775897 27193 211.57.49.2 (31 Dec 2001 05:18:17 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:18:17 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From leipold at acm.org Sun Dec 30 17:00:27 2001 From: leipold at acm.org (Walt Leipold) Date: 30 Dec 2001 14:00:27 -0800 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <458b194a.0112282052.1123341@posting.google.com> Message-ID: <71f60588.0112301400.36aed62c@posting.google.com> robin at brainexeculink.com wrote: > Since I'm talking databases, I wish someone with more time and brains > than I would pick up the Gadfly project and bring it up to date. We > need a pure Python SQL database. That too would help "sell" the > language. Right on! Gadfly rocks, but it's showing its age. Any takers? ------------------------------------------------------------------------ "If all you have is a hammer, Walt Leipold everything looks like a nail." leipold at acm.org ------------------------------------------------------------------------ From claird at starbase.neosoft.com Thu Dec 27 19:43:32 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 27 Dec 2001 18:43:32 -0600 Subject: REPOST: Re: tcl??? References: <%FOW7.8662$7p6.139123@rwcrnsc51.ops.asp.att.net> Message-ID: <5$--$$_----_--$__$@news.noc.cabal.int> In article <%FOW7.8662$7p6.139123 at rwcrnsc51.ops.asp.att.net>, ~Jason~ wrote: >I am playing around with Python and it is telling me that to activate tcl >type tclch80. I do this and I get an error. I think may be it is because >either I am typing in the wrong version or I do not have it? Am I right and >if so how do I correct it? And if I am wrong, how do I fix it? What it >wants me to do is type [% put "Hello World"] and I do that and I get an >error, why? . . . I don't recognize this description--which likely reflects more on my ignorance than your own pre- cision. What operating system are you using? You're likely to get farther with tclsh rather than tclch80 and puts "Hello World" rather than put "Hello World" It's likely that those in a position to answer you will do so more swiftly and accurately when you supply an exact error message, as opposed to, "I get an error." Tell us which error. You might like to read . -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: claird at starbase.neosoft.com (Cameron Laird) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:44:26 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775479 27193 211.57.49.2 (31 Dec 2001 05:11:19 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:11:19 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From robin at jessikat.fsnet.co.uk Fri Dec 7 03:46:40 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Fri, 7 Dec 2001 08:46:40 +0000 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C0FBAA8.F1A44304@attbi.com> <3C100EFF.6EEA6C7A@cosc.canterbury.ac.nz> Message-ID: In article <3C100EFF.6EEA6C7A at cosc.canterbury.ac.nz>, Greg Ewing writes >Chris Barker wrote: >> >> I would >> argue that applications that deal with nanoseconds are of a different >> breed than those that deal with day, month, year type calculations. > >I'm not sure that's true. Consider something like generating >timestamps for transactions. They need to be unique over >a long time, and need quite fine-grained accuracy as well, >certainly much less than a second. Even microseconds might >be too coarse -- today's processors can do a LOT of >computation in a microsecond! > >I suggest femtoseconds. It's the smallest time unit I've >heard anyone talk about. If you need something smaller >you're probably a bleeding-edge particle physicist with >more things to worry about than finding a time module... > I think there may be a need for a long term dating system, but that isn't the same as counting femtoseconds. The IAU routinely adjust sidereal time with leap seconds etc as the Earth's rotation changes. A true dating system would need to take such events into account as otherwise transactions could take place in non-time. Of course the difficulty is not that of counting the femtoseconds but of mapping them back into our familiar days and months. -- Robin Becker From ben at wblogan.net Sat Dec 8 13:32:30 2001 From: ben at wblogan.net (Ben Logan) Date: Sat, 8 Dec 2001 13:32:30 -0500 Subject: Need help with regular expression In-Reply-To: ; from shalehperry@attbi.com on Sat, Dec 08, 2001 at 08:43:06AM -0800 References: <20011208113002.A21206@newcreature.org> Message-ID: <20011208133230.A5441@newcreature.org> Well at least I'm not the only one... I don't have the money to go buy the book, and I checked my libraries, but they don't have it. I also searched the web for useful info, but found none. Since I've got an ever-increasing bruise on my head, could you (or anyone) tell me how it's done? :) Thanks, Ben On Sat, Dec 08, 2001 at 08:43:06AM -0800, Sean 'Shaleh' Perry wrote: > people the world over bang their heads against this one the first (and > hundredth) time through. Go to a bookstore and find "Master Regular > Expressions". Most everything he says works in python even though he uses perl > for most of the examples. There is a specific item about this in there if I > recall. > -- Ben Logan: ben at wblogan dot net OpenPGP Key KeyID: A1ADD1F0 From LLoeffler at home.com Tue Dec 4 13:28:53 2001 From: LLoeffler at home.com (Luke) Date: Tue, 04 Dec 2001 12:28:53 -0600 Subject: Script at boot References: <3C0D15B8.8090205@home.com> Message-ID: <3C0D15E5.4020603@home.com> Jeez I'm retarded. Nevermind that. From ungrzr2 at ubatxbat.pbz Thu Dec 20 00:18:56 2001 From: ungrzr2 at ubatxbat.pbz ({-- Rot13 - Hateme) Date: 20 Dec 2001 05:18:56 GMT Subject: Can I change a unicode char to gb2312 using python? References: <9vq6d9$gvc5p$1@ID-12869.news.dfncis.de> Message-ID: "Kick" wrote in news:9vq6d9$gvc5p$1 at ID-12869.news.dfncis.de: > I know that Java have a method that can manually encode string, like > that, > > System.out.println(new String("some chinese char".getBytes()"GB2312")) > > Is there any python function or method can do the same work? > > Thanks for any help! > Python cannot do GB codec. You have to convert your chinese code to utf-8 or some other form of unicode before handling them. There is a iconv wrapper on the net. It helps if you use unix. From dale at riverhall.NOTHANKS.co.uk Sun Dec 30 14:20:26 2001 From: dale at riverhall.NOTHANKS.co.uk (Dale Strickland-Clark) Date: Sun, 30 Dec 2001 19:20:26 +0000 Subject: win32all-141 for Python 2.2 References: <3C2D4676.5060700@skippinet.com.au> Message-ID: <06qu2u85qldj0066b9kn78tge4uvmev50l@4ax.com> Mark Hammond wrote: >I have made a new win32all release for Python 2.2. > >Hrmm - it seems I can't login to starship :( So I have temporarily >placed it at: > >http://users.bigpond.net.au/mhammond/win32all-141.exe > Thanks Mark. This was all that was stopping me looking at 2.2. -- Dale Strickland-Clark Riverhall Systems Ltd From gsmickle at yahoo.com Fri Dec 7 19:41:54 2001 From: gsmickle at yahoo.com (gsmickle) Date: Sat, 08 Dec 2001 00:41:54 -0000 Subject: Good book for Learning Python?? Message-ID: <9urnki+qeq5@eGroups.com> Hello All, I am new to the list and would like to get some input on some good books for learning Python? Thanks, Greg From hancock at anansispaceworks.com Mon Dec 24 17:58:33 2001 From: hancock at anansispaceworks.com (Terry Hancock) Date: Mon, 24 Dec 2001 14:58:33 -0800 Subject: Modifying environment variables References: Message-ID: <3C27B319.28D4DF09@anansispaceworks.com> Thanks for the two answers below! >> ~How to set an environment variable in a shell, using >> ~a Python script. Emile van Sebille: > set X=`python -c"print 'hello'"` Martin von Loewis: > Print a shell command on standard output, then, in the > shell, do > eval `script_name` That'll make my problem a lot simpler. Terry -- ------------------------------------------------------ Terry Hancock hancock at anansispaceworks.com Anansi Spaceworks http://www.anansispaceworks.com P.O. Box 60583 Pasadena, CA 91116-6583 ------------------------------------------------------ From use-net at schabi.de Thu Dec 13 05:47:37 2001 From: use-net at schabi.de (Markus Schaber) Date: Thu, 13 Dec 2001 11:47:37 +0100 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> Message-ID: <20011213114737.1f27a4fd.use-net@schabi.de> Hi, Angus Mackay wrote: > there seems to be lots of stuff that refrences python 1.5.x or requires > it but he www.python.org website doesn't mention it at all. On www.python.org, in the left bar, under "special topics", there is python 1.5.2 :-) Markus -- "GPL software is not free - the cost is cooperation" From fperez528 at yahoo.com Sun Dec 2 15:49:26 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Mon, 03 Dec 2001 20:17:26 +2328 Subject: Draft PEP: string interpolation with backquotes References: Message-ID: <9uhfb2$l98$1@peabody.colorado.edu> Steven Majewski wrote: > > You've made a pretty convincing argument about why it's a handy > feature, but I haven't heard an argument for why it requires > a new syntax (or new sematics for an old syntax). I know, because ultimately it's just convenience. I currently use the Itpl module, which implements it fully, and I get by fine. It's not that big of a deal to write print itpl('blah $...') vs print $'blah $...' I guess the only argument I'd push forward would be that it would make life a bit easier for newcomers: newbies tend to stick to the language without knowing much about modules available. So they often spend months (or longer) doing things 'the hard way' when there's a module that can make things much easier. But I know that isn't a super-convincing argument, and that a few comments in the tutorials concerning the existence of alternate/better ways of doing things can go a long ways. So I guess that a combination of: a) including Itpl in the standard distro b) mentioning it in the documentation in appropriate places would probably go a long way. By the way, the docs comment is a general one. While I *love* the python documentation and think it's in general top notch, if there's one minor comment I'd make it is that in the more basic parts it would't hurt to mention (and hyperlink) a bit more of the functionality available in the standard library. Currently one tends to read the basic docs and miss a lot of functionality unless one deliberately runs through the stdlib docs. Minor gripe though, and not meaning to disparage the great work of the doc team. > > I would say that Python is not very 'syntactically open' -- > certainly not in the way that Lisp or Forth is. > And in the long run, I agree with that philosophy. A strong editorial stance keeps things clean and sane for the long haul. It's a delicate balance (between featuritis and freezing progress), but in general I agree it's best to err on the side of caution. One can always add a feature later, but removing a misfeature is nearly impossible. Cheers, f From duncan at NOSPAMrcp.co.uk Tue Dec 11 04:34:32 2001 From: duncan at NOSPAMrcp.co.uk (Duncan Booth) Date: Tue, 11 Dec 2001 09:34:32 +0000 (UTC) Subject: FW: Strange behaviour of __del__ References: Message-ID: David Bolen wrote in news:u7kru70s6.fsf at ctwd0143.fitlinxx.com: > I'm not sure of precisely when the traceback is cleared (and it seems > to be somewhat Python version specific), but for example, the same > thing can happen even if the next command isn't del: The del command throws an exception (because there is no a). The traceback for the previous exception is held until the next exception is thrown, when it is replaced by the traceback information for the new exception. The class object continues to exist until the stack frame that references it is destroyed. Since the only stack frame with a reference to the object is the __init__, you can make sure the __del__ is called earlier by deleting self before raising the exception: script1.py: class A: def __init__(self, a): if a: del self raise RuntimeError def __del__(self): print 'In __del__()...' and now: >>> a = script1.A(1) In __del__()... Traceback (most recent call last): File "", line 1, in ? a = script1.A(1) File "D:\Python21\script1.py", line 5, in __init__ raise RuntimeError RuntimeError >>> del a Traceback (most recent call last): File "", line 1, in ? del a NameError: name 'a' is not defined which is perhaps less confusing. -- Duncan Booth duncan at rcp.co.uk int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3" "\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure? From duncan at NOSPAMrcp.co.uk Wed Dec 5 10:49:14 2001 From: duncan at NOSPAMrcp.co.uk (Duncan Booth) Date: Wed, 5 Dec 2001 15:49:14 +0000 (UTC) Subject: COM servers from within a Python service (on Win2k) References: <83y9kiouf2.fsf@panacea.canonical.org> Message-ID: Syver Enstad wrote in news:u4rn5vh0x.fsf at online.no: > Kragen Sitaker writes: > >> Duncan Booth writes: >> > Andrew Bennetts wrote in >> > news:mailman.1007522528.18068.python-list at python.org: >> > > Can anyone show me how to make this work? >> > >> > I have emailed you a working example. It is a minimal service which >> > contains a COM server. >> >> Can you post it? >> > > Yess, yess, preciousss, post for me too. Gollum. > Strange, last time this was discussed nobody was very interested. Split up on the begin/end lines. The only thing to watch is that you must use DCOMCNFG.EXE to set the default security to include access by your userid otherwise access to the COM object will be denied. Then run servicetest.py to check it all works. The most likely problem will be some of the long lines wrapping. Dont forget to change the guid if you use this for anything. BTW, I suspect the QS_ALLEVENTS value should actually be QS_ALLINPUT. ---- begin readme.txt ---- This is a simple NT/2000 service that exposes a COM object. servicetest.py runs unit tests including installing and removing the service. It leaves the service installed and running on completion. Alternatively install the service with: service.py install You must start the service to register the COM object: service.py start Stopping the service (service.py stop) does not uninstall the COM object. You must remove the service (service.py remove) to unregister the COM object. When the service is running it writes stdout and stderr to logfile.txt, but these may be buffered so output won't necessarily appear immediately. Creating the exposed object will start the service. Destroying the object doesn't stop the service (although it could be made to do this quite easily). To change the object that is exposed, edit COMNAME in service.py. ---- end readme.txt ---- ---- begin servicetest.py ---- import unittest,weakref,types,os,sys,time,re import service import win32service, win32serviceutil,pywintypes import win32com.client from win32service import SERVICE_STOPPED, SERVICE_START_PENDING, SERVICE_STOP_PENDING, \ SERVICE_RUNNING, SERVICE_CONTINUE_PENDING, SERVICE_PAUSE_PENDING, SERVICE_PAUSED SERVICENAME = service.MyService._svc_name_ COMNAME = service.COMOBJECT._reg_progid_ SERVICE_STATES = { SERVICE_STOPPED: "Stopped", SERVICE_START_PENDING: "Starting", SERVICE_STOP_PENDING: "Stopping", SERVICE_RUNNING: "Running", SERVICE_CONTINUE_PENDING: "Continuing", SERVICE_PAUSE_PENDING: "Pausing", SERVICE_PAUSED: "Paused", } class ServiceStatus: def __init__(self): self.serviceType, self.currentState, self.controlsAccepted, \ self.win32ExitCode, self.serviceSpecificExitCode, self.checkPoint, \ self.waitHint = win32serviceutil.QueryServiceStatus(SERVICENAME) # Uninstalling a service is asynchronous, so after uninstalling we might # get a service status. If so sleep a bit and try again. def isServiceInstalled(expected=None): def installed(): try: s = ServiceStatus() except pywintypes.error, (code, fn, msg): if code==1060: return 0 # Not installed. raise return 1 for i in range(10): inst = installed() if expected is None or inst==expected: break time.sleep(0.05) return inst def serviceState(): """Returns service state SERVICE_STOPPED, SERVICE_RUNNING, or SERVICE_PAUSED. If the service is changing state it waits up to 10 seconds for the state change to complete.""" maxtime = time.time() + 10 while time.time() < maxtime: s = ServiceStatus() # Raises exception if not installed. if s.currentState in (SERVICE_START_PENDING, SERVICE_STOP_PENDING, \ SERVICE_CONTINUE_PENDING, SERVICE_PAUSE_PENDING): time.sleep(0.05) continue return s.currentState def commandWithOutput(command, expected): import tempfile tmpfile = tempfile.mktemp() try: cmdLine = '"%s" %s>%s' % (sys.executable, command , tmpfile) os.system(cmdLine) output = open(tmpfile, "r").read() if not output.find(expected) >= 0: print "Expected:",`expected` print "Got:",`output` assert output.find(expected) >= 0 finally: os.unlink(tmpfile) def serviceStart(): if not serviceState()==SERVICE_RUNNING: commandWithOutput("service.py start", "Starting service %s\n" % SERVICENAME) assert serviceState()==SERVICE_RUNNING def serviceInstall(): if not isServiceInstalled(): commandWithOutput("service.py install", "\nService installed\n") assert isServiceInstalled(1), "Service should now be installed" def serviceStop(): if serviceState() != SERVICE_STOPPED: commandWithOutput("service.py stop", "Stopping service %s\n" % SERVICENAME) assert serviceState()==SERVICE_STOPPED def serviceRemove(): if isServiceInstalled(1): commandWithOutput("service.py remove", "Removing service %s\n" % SERVICENAME) assert not isServiceInstalled(0), "Service should now be removed" class ServiceTestCase(unittest.TestCase): def checkInstallation(self): """Test service install/start/stop/remove""" serviceInstall() serviceStart() serviceStop() serviceRemove() # After removing the service, the COM object should not exist self.assertRaises(pywintypes.com_error, win32com.client.Dispatch, COMNAME) class ComTestCase(unittest.TestCase): """Test the COM object in the service.""" # N.B. Because it takes a comparatively long time to install and remove the service # the setUp installs it, but the tearDown leaves it installed. # Individual tests start and stop the service as required. def setUp(self): if not isServiceInstalled(): OUT = "\nService installed\n" commandWithOutput("service.py install", OUT) assert isServiceInstalled(1), "Service should now be installed" def checkServiceAutoStarts(self): # The COM object isn't registered until we start the service, # so make sure service has been started at least once serviceStart() serviceStop() assert serviceState()==SERVICE_STOPPED obj = win32com.client.Dispatch(COMNAME) assert serviceState()==SERVICE_RUNNING def checkComMethods(self): serviceStop() serviceStart() obj = win32com.client.Dispatch(COMNAME) assert obj.Hello("World")=="Hello World" assert obj.Hello("Test2")=="Hello Test2" assert obj.globalCalls()==2 assert obj.noCalls==2 del obj obj = win32com.client.Dispatch(COMNAME) assert obj.Hello("World")=="Hello World" assert obj.globalCalls()==3 assert obj.noCalls==1 del obj serviceStop() serviceStart() obj = win32com.client.Dispatch(COMNAME) assert obj.Hello("World")=="Hello World" assert obj.globalCalls()==1 assert obj.noCalls==1 def suite(): suite = unittest.makeSuite(ServiceTestCase, 'check') suite.addTest(unittest.makeSuite(ComTestCase, 'check')) return suite allTests = suite() if __name__=='__main__': if len(sys.argv) > 1 and sys.argv[1] == 'gui': import unittestgui unittestgui.main("servicetest.allTests") else: verbose = 1 if '-v' in sys.argv or '--verbose' in sys.argv: verbose += 1 runner = unittest.TextTestRunner(verbosity=verbose) runner.run(allTests) ---- end servicetest.py ---- ---- begin comobject.py ---- import sys import pythoncom, win32api, time, win32con globalCalls = 0 class HelloWorld: _reg_clsctx_ = pythoncom.CLSCTX_LOCAL_SERVER _reg_class_spec_ = "comobject.HelloWorld" # Don't copy this: generate a new guid with pythoncom.CreateGuid() _reg_clsid_ = "{8196223B-4BC8-4B91-A9E8-3FFA0A72FD5A}" _reg_desc_ = "Python Test COM Server" _reg_progid_ = "Python.TestServer" _public_methods_ = ['Hello', 'globalCalls'] _public_attrs_ = ['softspace', 'noCalls'] _readonly_attrs_ = ['noCalls'] def __init__(self): self.softspace = 1 self.noCalls = 0 def globalCalls(self): return globalCalls def Hello(self, who): global globalCalls self.noCalls = self.noCalls + 1 globalCalls += 1 # insert "softspace" number of spaces msg = "Hello" + " " * self.softspace + str(who) service.LOG("Message: %s" % msg) return msg def registerCOMservice(servicename, classes=HelloWorld): try: import win32com.server.register register = win32com.server.register register.RegisterClasses(classes) # Now complete the registration for a service. clsid = classes._reg_clsid_ keyNameRoot = "CLSID\\%s" % str(clsid) register._set_subkeys(keyNameRoot, { 'AppId': str(clsid)} ) # The serviceparameter gets passed to us when started for COM. Appidkeys = { "LocalService": servicename, "ServiceParameters": "LocalServiceStartup"} register._set_subkeys("AppID\\%s" % clsid, Appidkeys) except: service.LOG("registerCOMservice", sys.exc_info()) def unregisterCOMservice(classes=HelloWorld): import win32com.server.register win32com.server.register.UnregisterClasses(classes) # So that we can get at the logger # This has to come after the class definition of the COM object. import service ---- end comobject.py ---- ---- begin service.py ---- # Very small service written in Python import win32serviceutil import win32service import win32event, win32api import time, sys, os import comobject import pythoncom, win32api, time, win32con try: p = os.path LOGFILE = p.join(p.dirname(p.abspath(__file__)), "logfile.txt") except NameError: LOGFILE = "logfile.txt" # This is the class we wish to make available via COM. COMOBJECT = comobject.HelloWorld def log_time(): """Return a simple time string without spaces suitable for logging """ return ("%4.4d-%2.2d-%2.2dT%2.2d:%2.2d:%2.2d" % time.gmtime(time.time())[:6]) class Logger: def __init__(self, filename=LOGFILE): self.logfile = open(filename, "w+t") sys.stderr = sys.stdout = self.logfile import os print os.getcwd() def log(self, summary, error=None): time = log_time() self.logfile.write("%s: %s\n" % (time, summary)) if error: try: self.logfile.write(format_exception( error[0], error[1], error[2], trailer='\n', limit=100)) except: self.logfile.write("%s: %s\n" % error[:2]) self.logfile.flush() def __call__(self, summary, error=None): self.log(summary, error) class MyService(win32serviceutil.ServiceFramework): _svc_name_ = "PythonCOMService" _svc_display_name_ = "Python COM service" def __init__(self, *args): try: self.log = Logger() global LOG LOG = self.log self.log("Service starting, args=%s" % args) win32serviceutil.ServiceFramework.__init__(self, *args) self.ReportServiceStatus(win32service.SERVICE_START_PENDING) # Create an event which we will use to wait on. # The service stop request will set this event. self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) #comobject.registerCOMservice(self._svc_name_, self.log, COMOBJECT) self.classes = [COMOBJECT._reg_clsid_] except: self.log("Exception during service start", error=sys.exc_info()) def SvcStop(self): try: # Tell the SCM we are starting the stop process. self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) win32event.SetEvent(self.hWaitStop) except: self.log("SvcStop()", sys.exc_info()) # Stop the COM thread #win32api.PostThreadMessage(self.threadId, win32con.WM_QUIT, 0, 0); def SvcDoRun(self): # Runs a COM loop self.log("Running") try: self.ReportServiceStatus(win32service.SERVICE_START_PENDING) sys.coinit_flags = 2 from win32com.server import factory self.threadId = win32api.GetCurrentThreadId() pythoncom.CoInitialize() infos = factory.RegisterClassFactories(self.classes) pythoncom.CoResumeClassObjects() self.ReportServiceStatus(win32service.SERVICE_RUNNING) while 1: res = win32event.MsgWaitForMultipleObjects((self.hWaitStop,), 0, 2000, win32event.QS_ALLEVENTS) if res == win32event.WAIT_OBJECT_0: break # Must be terminating pythoncom.PumpWaitingMessages() factory.RevokeClassFactories(infos) pythoncom.CoUninitialize() except: self.log("SvcDoRun()", sys.exc_info()) self.log("Service stopped") self.ReportServiceStatus(win32service.SERVICE_STOPPED) if __name__=='__main__': # If we are removing the service, also remove the COM registration. if "remove" in sys.argv: comobject.unregisterCOMservice(COMOBJECT) elif 'install' in sys.argv: comobject.registerCOMservice(MyService._svc_name_, COMOBJECT) win32serviceutil.HandleCommandLine(MyService) ---- end service.py ---- -- Duncan Booth duncan at rcp.co.uk int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3" "\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure? From grey at despair.dmiyu.org Mon Dec 3 18:52:47 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Mon, 03 Dec 2001 23:52:47 -0000 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: On 3 Dec 2001 23:17:22 GMT, Quinn Dunkan wrote: > Not for me it doesn't, when I use proportional fonts. Anyone who uses proportional fonts for programming gets what they deserve because neither spaces nor tabs work. -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From lull at acm.org Mon Dec 31 17:03:03 2001 From: lull at acm.org (John Lull) Date: 31 Dec 2001 16:03:03 -0600 Subject: Multiple active locales, AKA class-based API for the locale module. Message-ID: I'm working on a COM local/remote server that must support multiple clients using different locales simultaneously. What I'd really like is a class-based API for something very similar to the current locale module. At first glance, this looks like a fairly straight-forward bit of work. Has anyone else has already done this? If not, is this something others might also be interested in? Assuming it is, is it something that ought to ultimately become part of the standard locale module, or would it be better packaged separately? Regards, John From andreas.ulbrich at gmx.net Wed Dec 5 08:07:29 2001 From: andreas.ulbrich at gmx.net (Andreas Ulbrich) Date: Wed, 05 Dec 2001 14:07:29 +0100 Subject: Jython References: <3C0E019E.BF5179C7@lucent.com> Message-ID: <3C0E1C11.1080300@gmx.net> Eoin Kelly wrote: > > > Hello, > > Can anyone please tell me of references to information regarding thread > safety issues with jython > > Thank in adv, > Eoin > > Jython safety is pretty good. I never got hurt using jython. :-) As far as security is concerned, well jython is 100% pure Java. Everything that applies to Java is valid for Jython too. From tim.one at home.com Sun Dec 23 14:32:09 2001 From: tim.one at home.com (Tim Peters) Date: Sun, 23 Dec 2001 14:32:09 -0500 Subject: SnoPy 0.1 - SNOBOL pattern matching for Python In-Reply-To: <7x4rmi88v4.fsf@ruckus.brouhaha.com> Message-ID: [Paul Rubin] > Wow, cool. A lot of SNOBOL patterns can be transformed into regular > expressions. However, a lot of them can't be. Regular expressions > have caught on as a pattern language because they can be interpreted > very efficiently. But few of the popular "regular expression" packages restrict themselves to the theoretical notion of "regular expression" that *can* be matched very efficiently. Perl/Python regexps are not "regular" in the efficient theoretical sense, and the regexp engines underlying Perl and Python are as general as SNOBOL4's pattern-matching engine (they're general backtracking engines, not linear-time DFAs). They're also just as slow in some cases. For example, try def sloooow(m, n): import re re.match('.*x' * m + 'y', 'x' * n) # can't match, but sure tries in Python for various values of m and n. Say, sloooow(8, 50). That's a theoretically pure regular expression, and *can* be matched very efficiently, but the regexp engines don't use the theoretical DFA approach because it's inadequate to deal with non-regular gimmicks like backreferences. So, in the end, non-regular regexps give a bizarre pattern-matching language that's also slow and feeble. I've been trying for a decade to account for their popularity anyway, but have given up. > Completely general SNOBOL patterns can be extremely slow to interpret. The simple regexp above takes exponential time in Python/Perl, same as in a SNOBOL4 rewrite, and for the same reason. > When SNOBOL was invented, these things weren't understood as well as they > are now. All the relevant portions of finite automata theory were well-known then. The fascination with trying to *use* regexps started (AFAICT) with Unix, and they have a certain seduction in that very simple patterns are very easy to express. The SNOBOL4 folks knew beforehand that (theoretical) regexps were too feeble for the tasks they wanted to tackle, so didn't even bother with them. > The successor to SNOBOL is called ICON: http://www.cs.arizona.edu/icon > Python draws some ideas from Icon and looking at Icon will probably > be interesting to Python fans, even if they don't take up programming > in it. s/ICON/Icon/ (one *pleasant* use of regexps ), and I fully agree. SNOBOL4 remains a superior pattern-matching language, though (Icon met its design goal of "opening up" the SNOBOL4 pattern engine and integrating goal-directed bactracking into the semantics of the language, but in doing so it lost the economy of expression afforded by SNOBOL4's distinct pattern-matching sublanguage; there isn't a SNOBOL4 pattern you can't write an Icon program to emulate, but it *feels* like emulation, not direct specification, in Icon -- in Icon you have to spell out more of "how to do it", not just "what it is". That's both a strength and a weakness, of course, but more of a weakness for casual pattern users.). pattern-matching-is-hard-ly y'rs - tim From djc at object-craft.com.au Mon Dec 17 15:11:52 2001 From: djc at object-craft.com.au (Dave Cole) Date: 18 Dec 2001 07:11:52 +1100 Subject: Wrap C function which takes variable lengthed parameters? References: <6p5j1u0oag2ofkam8o7fig5dvkfc2392hk@4ax.com> <3C19990E.BE0F3FA@alcyone.com> <3C19AC0B.7ABD04DF@xs4all.nl> <3C1D767D.7BBE45EC@cosc.canterbury.ac.nz> <3C1E0E6B.9F0C2A18@pobox.com> Message-ID: >>>>> "Jason" == Jason Harper writes: Jason> I'm not sure if that's 100% true - I have used a compiler Jason> (fortunately long dead), which claimed to be fully ANSI Jason> compliant, that absolutely required that a varargs function Jason> consume exactly as many args as were passed to it or it would Jason> crash on return. My guess is that you were using BTOS/CTOS (shudder). - Dave -- http://www.object-craft.com.au From ws-news at gmx.at Tue Dec 18 14:53:10 2001 From: ws-news at gmx.at (Werner Schiendl) Date: Tue, 18 Dec 2001 20:53:10 +0100 Subject: dynamic modules References: <9vo01n$9j8$1@news.tpi.pl> Message-ID: <3c1f9f6f$1@brateggebdc5.br-automation.co.at> Hi, you can create a type (a class) instead of a plain module. When the reference count drops to zero, the instance will then be deleted. It is probably possibly to create a singleton class, that always returns one single instance if there is one instead of creating a new one every time. But I never tried that. hth Werner "Marek Budyn" wrote in message news:9vo01n$9j8$1 at news.tpi.pl... > Hi! > > I wanted go create dynamically loaded and removed plugins. I mean, id a > module a initalizes with 10 MB data structude, i would like to remove it > from memory if it is not needed eg. > > p1 = import plugin1 > > ... > > unload(p1) > > Is it possible in python ? And if so, how can I do this ? > Thanks for help! > > Marek Budyn > rayn at infostrade.com.pl > > > > From fperez528 at yahoo.com Mon Dec 17 07:47:08 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Tue, 18 Dec 2001 12:15:08 +2328 Subject: WYSIWYG text Editor in python? References: <3C1DDCAC.C477A0A6@cicei.ulpgc.es> <9vo3ib$oho$1@peabody.colorado.edu> Message-ID: <9vo4ne$p85$1@peabody.colorado.edu> Fernando P?rez wrote: > If you also need to edit it, you > can always use lyx as a user-friendly front end (it runs in windows, though > I've never tried it). > Never tried it under Windows, that is. I've used Lyx extensively under linux, and it's fantastic. Full access to raw tex when you need it, but word-processor type editing 99% of the time (or 100%, if you don't have the need to do manual fine-tuning). Cheers, f From horatio at qpsf.edu.au Sat Dec 1 06:19:13 2001 From: horatio at qpsf.edu.au (Horatio Davis) Date: Sat, 1 Dec 2001 21:19:13 +1000 (EST) Subject: Scientific Libraries in Python In-Reply-To: <83k7w7tgfi.fsf@panacea.canonical.org> Message-ID: On 1 Dec 2001, Kragen Sitaker wrote: > Travis Oliphant writes: > > > > The LGPL does what it seems like you want you want (doesn't allow people > > to take your particular code, alter it slightly and make it proprietary), > > but it also allows people to release a larger application which only links > > to your code under a non-GPL license. > > Right. Their only obligation would be to let people drop in newer > versions of MayaVi. So, for example, Mathematica or IDL could add > MayaVi as a plotting option if you released it under the LGPL. http://www.wolfram.com/products/mathematica/tour/page8.html http://www.rsinc.com/Info/Aerospace/index.cfm These packages already have visualization options which, surprisingly, they seem happy with. If they wanted to add the VTK as their visualization library, they could do so now, because VTK is free-as-in-beer. If they want to move away from their proprietary languages and use Python to work with the VTK... at the risk of further embarrassing Prabhu, I respectfully submit that MayaVi would eat them for breakfast. It would just gain bigger teeth if the rest of us could use it (and Scigraphica, for that matter) without being GPL'd for our troubles. > > Enthought is also interested in distributing an "everything included" > > distribution which contains many of the above packages you mentioned, but > > to distribute such a beast which all worked together dynamically, my > > understanding is that none of the included packages could be GPL (LGPL > > would be O.K.) > > That is only the case if some of the included packages are proprietary > or under a GPL-incompatible free-software license. Does Enthought > want to include proprietary software in their distribution? I was assuming that they'd be distributing SciPy in their distribution. What do you mean by "political obstacles"? nnnggh-must-not-start-licensing-flamewar-MUST-NOT-'ly yours, Horatio From patrick.vrijlandt at tip.nl Sat Dec 1 17:18:24 2001 From: patrick.vrijlandt at tip.nl (Patrick Vrijlandt) Date: Sat, 1 Dec 2001 23:18:24 +0100 Subject: PythonWin DDE Conversion error References: <3c07f946.27546641@news> <3c0839b8.44047280@news> Message-ID: <9ubl8c$ave$1@nereid.worldonline.nl> This error has been discussed before. I believe you could start pythonwin win parameter /nodde if nothing else helps. Patrick Phredd Phlintstone wrote in message news:3c0839b8.44047280 at news... > On Fri, 30 Nov 2001 21:45:02 GMT, Mark_Pryor > wrote: > > >Hi, > >On Fri, 30 Nov 2001 21:28:47 GMT, phony_address at yahoo.com (Phredd > >Phlintstone) wrote: > > > > > >I have the same trouble, but only when running Apache 1.3.20. If I > >stop Apache and launch PythonWin, then all goes well. Make sure > >that you don't have more than one instance of PythonWin running, too. > > > >good luck, > >Mark Pryor > > Ah...you were right. I had Python running twice. Butt the problem is > ... when I start the program from Start > Programs > PythonWin > Environment, it doesn't open, though it appears in my tray as running. > > Please post any responses to this to this newsgroup. From roth at ursus.net Sun Dec 16 15:34:11 2001 From: roth at ursus.net (Carl D. Roth) Date: 16 Dec 2001 12:34:11 -0800 Subject: /usr/bin/env: python: No such file or directory References: Message-ID: ==> "d" == ddidierd78 writes: d> Hi, I am running redhat 7.2 and installed the following: d> python2.2-2.2b1-2.i386.rpm python2.2-devel-2.2b1-2.i386.rpm d> python2.2-tools-2.2b1-2.i386.rpm d> When trying to run a script, I get the following message: d> /usr/bin/env: python: No such file or directory The stock redhat configuration uses python 1.5 as 'python'. If you can't find it, you should check to make sure your python package is still OK. Don't uninstall it, because it works alongside the python2 packages. Your system administration tools that come with RHL probably do *not* work with python 2. If you want to run python 2 instead of python 1.5 on that system, change the 'env' line to refer to 'python2' or 'python2.2'. -- C From andrewsterian at yahoo.com Mon Dec 24 23:13:54 2001 From: andrewsterian at yahoo.com (Andrew Sterian) Date: 24 Dec 2001 20:13:54 -0800 Subject: Looking for ELF file interface Message-ID: <7754c18e.0112242013.6d31ae13@posting.google.com> Does anyone know of a Python module for reading ELF files? Either something standalone or a wrapper for libelf. I found Will Ware's posting here from Aug. 2000 but it doesn't recognize the ELF files I am generating. Thanks. From syver-en+usenet at online.no Sat Dec 15 20:11:02 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 16 Dec 2001 02:11:02 +0100 Subject: Unsung Python modules References: <3dsnad226b.fsf@ute.mems-exchange.org> Message-ID: jason petrone writes: > My .emacs file is almost 400 > lines of > > custom elisp. Thankfully customization of VIM doesn't require > thinking > > polish-- I can just write python code to do the heavy stuff. You'll be pleased to know that a python interface to emacs now exists, pymacs. I use it myself and have written all of my recent extensions in python instead of elisp. -- Vennlig hilsen Syver Enstad From phd at phd.pp.ru Thu Dec 6 13:28:48 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Thu, 6 Dec 2001 21:28:48 +0300 Subject: pep proposal : A date object for the standard library In-Reply-To: <3C0FBAA8.F1A44304@attbi.com>; from chrishbarker@attbi.com on Thu, Dec 06, 2001 at 10:36:24AM -0800 References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C0FBAA8.F1A44304@attbi.com> Message-ID: <20011206212848.O4616@phd.pp.ru> On Thu, Dec 06, 2001 at 10:36:24AM -0800, Chris Barker wrote: > I use mxDateTime frequently, and it is a fabulous package. I have no > idea what Marc-Andr? Lemburg thinks about putting it into the standard Just a day ago the question was raised (by me) in zope list. The answer was: both Guido and Marc-Andre said "no". It is a matter of support. Who will support the module in the std python lib? Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From chris.gonnerman at newcenturycomputers.net Tue Dec 11 08:45:39 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Tue, 11 Dec 2001 07:45:39 -0600 Subject: reading from a serial port (boot) References: <3C15A6EE.9050408@beth.uniforum.org.za> Message-ID: <005701c1824a$203acdc0$0101010a@local> ----- Original Message ----- From: "mixo" > My serial port permission look like this: > > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > crw-rw---- 1 root uucp 4, 64 Dec 11 07:54 ttyS0 > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > Now I have a script that starts up as the machine boots and > read from the serial port. My problem is, it does not get > anything from the port, unless I manualy start it as 'root'. > What do I need do /change to get it to start reading at > boot time? Sounds like everything is cool. Are you sure that the serial ports are accessible at the point you start the daemon automatically? That is, it looks like you might be running Linux, and Linux systems often have rc files to initialize the serial ports. If your daemon starts too soon the serial ports will be unstable or unusable. > P.S > The script to start the daemon has the following permissions > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > -rwxr-xr-x 1 root root 1463 Dec 10 17:29 myscript.sh > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > The daemon itself, > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > -rwxr-xr-x 1 root root 3678 Dec 10 16:04 mydaemon.py > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > -- > http://mail.python.org/mailman/listinfo/python-list > > From gh_pythonlist at gmx.de Fri Dec 28 15:09:59 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Fri, 28 Dec 2001 21:09:59 +0100 Subject: Games Made w/ Python In-Reply-To: <200112281720.fBSHKGua023530@ratthing-b246.strakt.com> References: <9v9gss$5hr$1@nntp9.atl.mindspring.net> <20011213065432.GB897@lilith.hqd-internal> <200112281720.fBSHKGua023530@ratthing-b246.strakt.com> Message-ID: <20011228200958.GB1093@lilith.hqd-internal> Le 28/12/01 ? 18:20, Laura Creighton ?crivit: > > Btw., your mail scored pretty high in my spam filter (SpamAssassin with > > Vipul's Razor). > > > > X-Spam-Status: No, hits=3 required=5 tests=NO_REAL_NAME,NO_MX_FOR_FROM > > > > Please consider using a realname on Usenet. It's just nicer than talking > > to nobody@'s, fish@'s and root@'s :-) > > > > Gerhard > > I have some friends who are Mathematical Ecologists. They were > simulating the Grand Banks for the Canadian Department of Fisheries. > They were finding lots and lots of bugs in S the Statistical package > they were using. No matter how many times they reported them, they > never seemed to get fixed, commented upon, or even noticed. They > were quite annoyed > > Finally, I told them, 'Guys, you have got to stop sending your bug > reports in from account names of bluefish, tunnyfish, and _especially_ > fishee. Get nice account names from the university.' .... worked > like a charm. I have no problem with strange or even fake email adresses on Usenet, but I'd like to know who I'm talking to. There are at least three possibilities to achieve this: - configure your client to put your realname in the email address like "John Doe " - put your name below the message or - put it in your signature IMHO it's good practise to remind newbies of the netiquette ... Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From dalke at dalkescientific.com Fri Dec 14 16:13:06 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Fri, 14 Dec 2001 14:13:06 -0700 Subject: XML parsing besides SAX and DOM References: <9v7d9h$s00$1@slb2.atl.mindspring.net> Message-ID: <9vdpob$ovi$1@slb7.atl.mindspring.net> Me: > I've been doing XML processing of a record-oriented >data set where in a record: > > - the data isn't deep (pretty much flat) > - all the text is used from between the start and end tags > - the text is short (easily fits into memory) > >I developed another XML API to simplify this case, and I'm >curious about other similar systems (eg, I may want to >scrap my work). I know about SAX and DOM and about RAX. >What others are there? Someone asked me in personal email why I thought the existing systems were too complicated. Since I think my response describes one of the things I feel is clunky about working with XML, I'm posting it here. === Suppose you have a file containing lines formatted with one of three forms: 1) name = value example: color = light blue 2) blank (only spaces) 3) comments indicated by a '#' in the first column The standard way to parse that (using Python 2.2 iterators) is something like this: for line in file: if line[:1] == "#": continue if line.strip() == "": continue pos = line.find("=") if pos == -1: raise TypeError("Cannot find the '=' in %s" % repr(line)) left = line[:pos].strip() right = line[pos+1:].strip() print repr(left), repr(right) Consider the equivalent XML file with entries of the form colorlight blue Parsing this with SAX requires something akin to import xml.sax.handler class ReadEntries(handler.ContentHandler): def startDocument(self): self.capture = 0 self.text = None self.data = None def startElement(self, tag, attrs): if tag in ["left", "right"]: self.capture = 1 self.data = {} self.text = "" def characters(self, s): if self.capture: self.text += s def endElement(self, tag): if tag in ["left", "right"]: self.data[tag] = self.text self.text = None self.capture = 0 elif tag == "entry": print self.data["left"], self.data["right"] self.data = None import xml.sax parser = xml.sax.make_parser() parser.setContentHandler(ReadEntries()) parser.parseFile(...) Doing the same with DOM is less work, but I don't recall the way to do it -- plus, the DOM implementations for Python want to store the whole document in memory, and some of my documents are much bigger than physical RAM. The project I'm working on is a way to tokenize flat files as if they are in XML, so I can make color = light blue generate SAX2 events to make it look like color =light blue This can be done with import Martel, SimpleFields comment = Martel.Group("comment", Martel.Str("#") + Martel.ToEol()) entry = Martel.Group("entry", Martel.Re(r"(?P[^=]+)=(?P[^\R]+)\R")) blank = Martel.Re(r"(?P[ \t]*\R)") format = Martel.Rep(comment | entry | blank) iterator = format.make_iterator("entry") for record in iterator.iterateString("color = light blue\n", SimpleFields.SimpleFields()): print record.groups["left"][0].strip(), print record.groups["right"][0].strip() which is only a couple lines more than the easiest flat-file solution. Yet it's all based on XML parsing techniques. (It also requires an iterator object that can turn the SAX callback into iterable chunks, which I've done.) Since I can't believe I'm the first to develop a technique like this (indeed, I got some of the ideas for it based on RAX), I'm looking to see what I can learn from related approaches. Andrew dalke at dalkescientific.com From wurmy at earthlink.net Wed Dec 26 12:27:54 2001 From: wurmy at earthlink.net (Mari Mcdade) Date: Wed, 26 Dec 2001 17:27:54 GMT Subject: Range of characters? References: Message-ID: <3C2A074D.8214E5E0@earthlink.net> David Brady wrote: > > Hello, > > I want to iterate over a range of characters, and > though I have a solution, it "feels wrong"... I think > (I hope, anyway) that I'm getting along well enough > with Python that I can tell when I've strayed from the > Pythonic Way. What's the best way to do this? > > Suppose, for example, that we want to generate every > possible name for Python and it's clones, Aython, > Bython, Cython, etc. Here is the code I would write > to do it: > > for c in range(ord('A'), ord('Z')+1): > print "%sython" % chr(c) > > It seems to me that flipping back and forth between > ord and chr, and especially the ord('Z')+1 have a > hackish smell to them. Is there a better way? Your way isn't wrong, but Python can loop over sequences of characters too, so why not use that: >>> import string >>> for c in string.uppercase: print "%sython" % (c) Aython Bython Cython ... etc... You don't need the string module, really, but using the literal string "ABCDEFGHIJKLMNOPQRSTUVWXYZ" seemed a bit ugly. ;-) HTH, --Hans From joshm at taconic.net Thu Dec 27 23:20:46 2001 From: joshm at taconic.net (Joshua Muskovitz) Date: Thu, 27 Dec 2001 23:20:46 -0500 Subject: using codecs for encryption? Message-ID: <3c2bf123_2@corp.newsgroups.com> This just in, from the top of my head... Has anyone thought about implementing encryption libraries (des, pgp, &c) as codecs in 2.2? Would there be a way to pass a key (or keypair) to the codec? The codec would also have to maintain some sort of state somehow. I just think it would be really cool to be able to say something like: c = DESCodec(key) plaintext = 'shh, here's the secret formula...' ciphertext = plaintext.encode(c) ... c.resetState() plaintext = ciphertext.decode(c) -- josh -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- From jkraska at san.rr.com Thu Dec 27 13:51:19 2001 From: jkraska at san.rr.com (Courageous) Date: Thu, 27 Dec 2001 18:51:19 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <3jqm2ukc9ll6mv7f5edd94hcsm7c7j9s50@4ax.com> >I don't want programming to be forcibly OO. In Ruby, can you write >a procedure which isn't part of a class? (Like you can in Python, but >can't in Java). If not, then Ruby is forcing you to hammer square pegs >into round holes. I agree with you in spirit, however I should like to point out that Python's module system puts your functions into a module object, indeed making these functions completely object oriented, except without the added syntactic weight. You have all of the benefits with syntactic brevity at the same time, which would seem to satisfy the Occam's Razor of programming, or at least to me. C// From skip at pobox.com Wed Dec 19 15:38:21 2001 From: skip at pobox.com (Skip Montanaro) Date: Wed, 19 Dec 2001 14:38:21 -0600 Subject: ANN: ciphon 0.3.4 In-Reply-To: References: <20011219092711.31a8282a.gry@ll.mit.edu> Message-ID: <15392.64189.974127.975151@beluga.mojam.com> Suchandra> Sorry, given the recent discussions, I thought people Suchandra> following the list would have already known. Ciphon is a Suchandra> utility that offers similar functionality to perl's CPAN Suchandra> shell. It'll let you download and install python modules Suchandra> automatically. Next question... I tried installing cryptkit and got this: ciphon> install cryptkit Traceback (most recent call last): File "/usr/local/bin/ciphon.py", line 134, in ? main.begin() File "/usr/local/bin/ciphon.py", line 67, in begin dispatch(input) File "/usr/local/lib/python2.2/site-packages/Ciphon/install.py", line 148, in main installer = Installer(input[1]) File "/usr/local/lib/python2.2/site-packages/Ciphon/install.py", line 13, in __init__ self.__installed = config.getInstalled() File "/usr/local/lib/python2.2/site-packages/Ciphon/config.py", line 331, in getInstalled installed = InstalledPackages() File "/usr/local/lib/python2.2/site-packages/Ciphon/config.py", line 240, in __init__ installedParser) File "/usr/local/lib/python2.2/site-packages/_xmlplus/sax/__init__.py", line 31, in parse parser.parse(filename_or_stream) File "/usr/local/lib/python2.2/site-packages/_xmlplus/sax/expatreader.py", line 38, in parse source = saxutils.prepare_input_source(source) File "/usr/local/lib/python2.2/site-packages/_xmlplus/sax/saxutils.py", line 375, in prepare_input_source f = urllib.urlopen(source.getSystemId()) File "/usr/local/lib/python2.2/urllib.py", line 73, in urlopen return _urlopener.open(url) File "/usr/local/lib/python2.2/urllib.py", line 178, in open return getattr(self, name)(url) File "/usr/local/lib/python2.2/urllib.py", line 405, in open_file return self.open_local_file(url) File "/usr/local/lib/python2.2/urllib.py", line 412, in open_local_file stats = os.stat(localname) OSError: [Errno 2] No such file or directory: '/home/skip/.ciphon/installed.xml' I tried creating an empty installed.xml file, but that just moved the error further up the food chain. I suspect ciphon ought to handle creation of this file itself. % ls -l .ciphon/ total 8 -rw-rw-r-- 1 skip skip 2288 Dec 19 14:32 packages.xml -rw-rw-r-- 1 skip skip 207 Dec 19 14:32 servers.xml In anticipation of getting past this particular hurdle I wonder, how do I submit a package for management by ciphon? -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From mlh at idi.ntnu.no Tue Dec 11 13:28:34 2001 From: mlh at idi.ntnu.no (Magnus Lie Hetland) Date: Tue, 11 Dec 2001 19:28:34 +0100 Subject: A common GUI define like rebol VID? References: <9v12k6$ak9$1@mail.cn99.com> <9v5hdb$bsv$1@tyfon.itea.ntnu.no> <20011211211130.C24106@phd.pp.ru> Message-ID: <01e701c18271$a47b3da0$156ff181@idi.ntnu.no> From: "Oleg Broytmann" > On Tue, Dec 11, 2001 at 06:56:59PM +0100, Magnus Lie Hetland wrote: > > Anygui will hopefully work on all these platforms. (Yes, *including* > > DOS... We already have beginning implementations of textgui and cursesgui > > in CVS :) > > Do you mean to reimplement curses for DOS? Or use some DOS > implementation of curses? We are not reimplementing curses for DOS, no... If there is a version of curses for DOS, Anygui will work with that. (I don't know anything about curses in DOS, actually ;) And if there is no curses, you can use textgui, which only needs the print statement. Slightly corny, but mighty cool, IMO. (And at least it works ;) Here is an actual screenshot (I never thought I'd say that about contents of a plain-text usenet posting ;) ): +-Window 1---------------------------------------+ | ^F focus; ^Q quit; space click | | | | +----------+ Label 1 | | |Click Me | | | +----------+ | | | | | | | +------------------------------------------------+ +-Window 2---------------------------------------+ | | | | | +----------+ +----------+ | | |Cheshire | |0 | | | +----------+ +----------+ | | | | | | | +------------------------------------------------+ This was copied straight from the screen -- and this program works well with Tk, wxPython, Qt, GTK, Java Swing, BeOS/Bethon, win32all, and curses too. > Oleg. -- Magnus Lie Hetland The Anygui Project http://hetland.org http://anygui.sf.net From db3l at fitlinxx.com Fri Dec 28 22:17:47 2001 From: db3l at fitlinxx.com (David Bolen) Date: 28 Dec 2001 22:17:47 -0500 Subject: ETA for Win32all under Python 2.2? References: Message-ID: David Brady writes: > Did you see the part where I said "anything you could > fix yourself"? You have apparently overlooked my vast > capacity for ignorance. It's vast. It's vaster > than... well, it's really vast, okay? Vast. Perhaps I was misreading it, but that earlier comment of yours seemed to say that the "longstanding rule in [your] family" should have precluded asking about something you could do yourself, so the response here seemed reasonable, since it said you could do it yourself :-) > Where do I get the package to build? The top level ActiveState pages for the win32all package (http://aspn.activestate.com/ASPN/Downloads/ActivePython/Extensions/Win32all) contain a reference to accessing with CVS, which points you to Mark's original win32all pages at http://starship.python.net/crew/mhammond/cvs.html. > How do I build the package? For the most part, you just pick the top level workspace/project file (it's already set up for VC 6) and build as any other VC 6 project. You do have to set up the directories where you have your Python installation first. It should be covered in the win32all web pages, which have a pointer to the specific build instructions at http://starship.python.net/crew/mhammond/win32/BuildingExtensions.html. > If your reply has anything to do with CVS, how the > heck do I get at it from Win32? (Lots of people have > told me they've heard of other people doing this, but > I'm starting to think it's an urban legend.) Just use a Win32 binary of CVS. If you've got a Cygwin environment, you should have one already, or there's a native NT binary available at http://www.cvsnt.com. I personally prefer the command line, but you can also use WinCVS as covered on Mark's win32all pages as noted above, including a reference on where to get it (http://www.wincvs.org). > > (if it doesn't, please submit a bug report). > > *sigh* Vast, man, vast. How do I submit a bug > report? Not that vast - although slightly grey at the moment now that Mark is no longer with ActiveState, but the ActiveState pages (above) have a Bug Reports option along the right edge, where you can submit bug reports. Or, given the current state of affairs, probably just an e-mail to Mark. > -dB > P.S. Please note, I may be ignorant, but I'm not > stupid. If there is a good place that explains how to > get and build Python and its packages, I'll happily > wade through the documentation. It's *finding* the > documentation that's killing me. I think most of this is pretty clear but perhaps it's finding that first page that is tricky. For win32all start with the ActiveState pages for the package, or via Mark's original win32all page http://starship.python.net/crew/mhammond/win32. As for Python itself, it's not that different - you can either download the specific version source from the main download location (http://www.python.org/download - get the .tgz file since that has source since Unix systems typically build from source), or access it via CVS from the SourceForge project (http://python.sourceforge.net) and check out the FAQ for accessing the tree via CVS. Then just check out the tag you want for the release you want. Once you have the source, build instructions are included in various readme's in it, and there are again VC project files that you can select to make the build. It's pretty painless, particularly if you're used to VC. -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l at fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/ From Bruce at EckelObjects.com Sat Dec 8 17:26:50 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Sat, 08 Dec 2001 14:26:50 -0800 Subject: It's hard to find documentation In-Reply-To: <20011208213833.GA1268@lilith.hqd-internal> References: <200112081328040980.0156CC2B@mail.rdc1.sdca.home.com> <20011208213833.GA1268@lilith.hqd-internal> Message-ID: <200112081426500540.018C99EB@mail.rdc1.sdca.home.com> Sure, but why can't I use the search mechanism to do this? If it won't discover a document when I give it the exact title, it seems pretty difficult to find lesser things. For that matter, I can't think of when the search mechanism on the site has given me what I was looking for. It seems to vary between thousands of documents and "nothing found" *********** REPLY SEPARATOR *********** On 12/8/01 at 10:38 PM Gerhard H?ring wrote: >Le 08/12/01 ? 13:28, Bruce Eckel ?crivit: >> Here's an example. In the Python FAQ, there's a reference (no URL) >> to a document: >> 5.1. Can I create my own functions in C? >> Yes, you can create built-in modules containing functions, >> variables, exceptions and even new types in C. This is explained in >> the document "Extending and Embedding the Python Interpreter" (the >> LaTeX file Doc/ext.tex). Also read the chapter on dynamic loading. >> >> So let's try to find "Extending and Embedding the Python >> Interpreter". Using 'search,' using 'advanced search,' nothing >> comes up with that title. Maybe it doesn't exist. Who knows. I have >> this struggle a lot when hunting for python information. > >The docs you're refering to are in the standard Python documentation, >for example here: > >http://www.python.org/doc/current/ext/ext.html > >I agree that documentation can always be improved. Especially with >respect to extension programming. On the other hand, especially the docs >on the C API have improved lately. But I still need to go hunting for >examples in existing C modules most of the time. > >Gerhard >-- >mail: gerhard bigfoot de registered Linux user #64239 >web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 >public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 >reduce(lambda x,y:x+y,map(lambda >x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) > >-- >http://mail.python.org/mailman/listinfo/python-list Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From klopsix at poczta.onet.pl Fri Dec 28 18:13:22 2001 From: klopsix at poczta.onet.pl (Tomasz Wójcik) Date: Sat, 29 Dec 2001 00:13:22 +0100 Subject: REPOST: Allegro interface for Python Message-ID: <1$--$$_----_-%_-%$@news.noc.cabal.int> Have you found anything interesting? Is it possible???? ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.cwix.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Tomasz W?jcik" Newsgroups: comp.lang.python Subject: cmsg cancel <3c2cfc94$1 at news.vogel.pl> Control: cancel <3c2cfc94$1 at news.vogel.pl> Date: Mon, 31 Dec 2001 03:56:22 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774995 27193 211.57.49.2 (31 Dec 2001 05:03:15 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:03:15 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From nickb at earth.ox.ac.uk Thu Dec 13 07:38:10 2001 From: nickb at earth.ox.ac.uk (Nick Belshaw) Date: Thu, 13 Dec 2001 12:38:10 +0000 Subject: GUI builder References: Message-ID: <3C18A132.84A2F9F7@earth.ox.ac.uk> Timothy Collins wrote: > Just wondering if anyone knows where I could get my hands on a gui builder > that would work with python. I have tried "Boa Constructor" and it works, > but only to a point - if I try to open the frame build it coughs up errors > until it just stops. Any other free or nearly free visual IDE's out there? I have used SpecPython - an extension of SpecTcl - for python+Tkinter on linux stuff - worked well for me.... -maybe here - http://www.geocities.com/eric_brunel/SpecPython.en.html cheers N From peter at engcorp.com Tue Dec 4 10:20:58 2001 From: peter at engcorp.com (Peter Hansen) Date: Tue, 04 Dec 2001 10:20:58 -0500 Subject: minidom References: <9uhr26$nfs$1@newsg1.svr.pol.co.uk> <3C0C7DD5.AC50A8CB@engcorp.com> Message-ID: <3C0CE9DA.128BBF4A@engcorp.com> Martin von Loewis wrote: > > Peter Hansen writes: > > > For one, you should probably start your XML document with > > or it won't be valid XML (but that's > > not necessary for this case.) > > That is not true. Presence of the XML declaration is not a validity > constraint in XML. Is it not required in any way at all? I always thought it was. > > >>> from xml.dom import minidom > > >>> doc = minidom.parseString(open('test.xml').read()) > > >>> doc.getElementsByTagName('DESCRIPTION')[0].childNodes[0].nodeValue > > u'EngineStart Leak' > > Actually, obtaining the text by looking at the first child is > unreliable: The first child may be a comment, and the text may be Yes, this was not intended to be good style, or generally useful, but merely an inspiration to the OP to use the interactive console as a start in learning more about the API. I could have made that clearer. -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From gmcm at hypernet.com Thu Dec 27 08:33:23 2001 From: gmcm at hypernet.com (Gordon McMillan) Date: 27 Dec 2001 13:33:23 GMT Subject: Book "python programming patterns". anybody read this?? References: Message-ID: Peter Milliken wrote: > No Gordon, that's a ridiculous assumption! > > Who said the code was bad? Not I! >From the first reply to my first post: >> it's probably not very good code. And you (apparently) agreed. > Your original email implied that you > had to put some amount of study into understanding the examples - there > was an implication that the examples where not straight forward and > therefore required some considerable time and effort on your part to > understand what was going on. Yes. > Nobody has tried to equate this with "bad code", just bad coding > practice (in our opinion - well, Roy's and mine :-)) - a very different > thing. I fail to discern the distinction, particularly as stated above. > Perhaps if you take objection to our comments you should perhaps > clarify and quantify your comments on just how much effort was required > to understand the examples? and why? i.e. if the book is more > "algorithmic" in nature then perhaps you cannot get away from examples > that do take some considerable study effort - if this is the case then > perhaps you should provide that clarification/caveat on your comment. Already did so. From my second post: >> The hardest thing to follow was his (highly efficient) >> implementation of an algorithm for computing whether one set >> is a subset of another. So it's not for people who don't >> like low-level stuff. > Otherwise I'll have to stick with my decision (unless I stood in the > book store and read the book! :-)). I have no objection to your decision. All three posts I've made have said that the book is not for everyone. I just don't want you (plural) to chase off people who could get something from the book. Save your money. Just don't slur the book based on an unfounded inference. -- Gordon http://www.mcmillan-inc.com/ From radix at twistedmatrix.com Sun Dec 16 12:51:39 2001 From: radix at twistedmatrix.com (radix) Date: Sun, 16 Dec 2001 12:51:39 -0500 Subject: Oscar or Toc protcall. References: Message-ID: On Sun, 16 Dec 2001 11:23:24 -0500, Skinny Puppy wrote: > Has anyone writen the Oscar or Toc protocals for connecting to AIM (AOL) > IM in python? I have looked all over, freshmeat.net, google.com, and > many other places. But I have not seen it. I would prefer one writen > in pure python, but a wrapper over one of the libs would do fine. Yes, Twisted (the event-oriented networking infrastructure) has TOC support, and there have been rumours of maybe some effort going into OSCAR support some time in the future. You can get Twisted at http://twistedmatrix.com. Come talk to the developers and other interested people on #Python @ irc.openprojects.net. -- I'm not a PSU agent. -- Chris Armstrong <<< radix at twistedmatrix.com >>> http://twistedmatrix.com/users/carmstro.twistd/ From aleaxit at yahoo.com Sat Dec 8 18:14:00 2001 From: aleaxit at yahoo.com (Alex Martelli) Date: Sun, 9 Dec 2001 00:14:00 +0100 Subject: Calling a generator multiple times References: Message-ID: <9uu6rr01bna@enews2.newsguy.com> Bruce Eckel wrote: ... > I believe that this is too restrictive a definition. My experience > of generators (from C++/STL) is that a generator is simply a > callable entity that returns an object every time you call it; this > call takes no arguments so it is "generating" objects rather than ...so a Python generator such as: def imageneratorhonest(sequence1, sequence2): for item in sequence1: yield item for item in sequence2: yield item isn't a generator...? Unfortunately, clashes with some preexisting definition are inevitable each time a common term is adopted in a specifical technical sense in any universe of discourse -- package, module, function, type, method, class, instance, exception, attribute, item, just to give a few examples, are all terms which may be usefully used in some sense or other, but since Python has adopted each of them in one specific sense (sometimes the same as a few other languages, sometimes not), it's best to avoid using them in their other senses when talking about Python. I learned this the hard way when writing about bridge: perfectly reasonable idioms such as "on the other hand", "the trick is", "a good deal", etc, cause far too much confusion when used in a universe of language where "hand", "trick" and "deal" acquire specific, specialized meanings:-). Alex From robin at stop.spam.alldunn.com Tue Dec 11 16:16:01 2001 From: robin at stop.spam.alldunn.com (Robin Dunn) Date: Tue, 11 Dec 2001 13:16:01 -0800 Subject: [wxPython rePOST] Can I use wxMetafile? References: <11b62679.0112102305.b7856e2@posting.google.com> Message-ID: "young-il sohn" wrote in message news:11b62679.0112102305.b7856e2 at posting.google.com... > If anyone knows about the usage of wxMetafile and wxMetaFileDC in > wxPython, please allow me to know about that. That will be a great > help to my current project. I would like to convert the drawing which > is drawn using wxPanel and several wx-classes in my application into > another application such as MS-WORD or EXCEL. > > Currently I use Windows NT 4.0 and Windows 98, Python 2.1 and wxPython > 2.3.1 > Upgrade to 2.3.2. There have been some changes there and I expect the metafile classes to work now. -- Robin Dunn Software Craftsman robin at AllDunn.com Java give you jitters? http://wxPython.org Relax with wxPython! From slzatz at hotmail.com Sun Dec 30 00:15:36 2001 From: slzatz at hotmail.com (Steve Zatz) Date: Sun, 30 Dec 2001 05:15:36 GMT Subject: REPOST: Help - command line arguments Message-ID: <7$--$$_----__%--%$@news.noc.cabal.int> I am new to Python and although I am sure that the following is obvious I can't figure the following out or find an answer in any of the texts that I have access to. My question is: Can you run a script that takes command line arguments from within the Python shell or from the Python command line? For example, something like: test.py -a -b runs fine from the *Windows XP* command prompt. >From the Python command line, I can do the following: import test test.main() which doesn't produce an exception but I can't figure out how to input the command line arguments. And from the Python Shell, just running test.main() produces a getopt exception which does not occur when it runs from the Python command line. (But in either case, I can't figure out how to use command line arguments.) Again, any help would be appreciated. Thanks. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Steve Zatz" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:45:39 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774392 27193 211.57.49.2 (31 Dec 2001 04:53:12 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:53:12 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From peter at engcorp.com Wed Dec 26 14:48:53 2001 From: peter at engcorp.com (Peter Hansen) Date: Wed, 26 Dec 2001 14:48:53 -0500 Subject: set decimal place References: <3c291037.4684696@news.tm.net.my> <3C292938.ED322C60@bellatlantic.net> <184fbd02.0112260109.4392423@posting.google.com> Message-ID: <3C2A29A5.8E9FB5BE@engcorp.com> Goh S H wrote: > David Lees wrote in > message news:<3C292938.ED322C60 at bellatlantic.net>... > > kwsiew at tm.net.my wrote: > > > > > > is there a way(or any function) to set decimal place in python(to any > > > decimal place I want) > > > example : > > > 2)10.0/3 = 3.3333333333333335 (I want 3.3333 - 4 decimal place) > > > >>> print '%8.1f' % (17.0/4) > > 4.3 > > >>> print '%8.4f' % (10.0/4) > > 2.5000 > > OR use built-in function round if you're expecting float instead of string >>> 10.0/3 3.3333333333333335 >>> round(10.0/3, 4) 3.3332999999999999 ^^^^^^^ This doesn't really solve the OP's problem. >>> print round(10.0/3, 4) 3.3333 >>> print "%.4f" % (10.0/3) 3.3333 The concept of "having 4 decimal places" is meaningless with floating point representations until you actually display the value as a formatted string. -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From jason at jorendorff.com Mon Dec 31 13:11:46 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Mon, 31 Dec 2001 12:11:46 -0600 Subject: does python support overloaded methods?(py newbie) In-Reply-To: Message-ID: karthik tamu wrote: > wanted to confirm this. Overloading method names(with parameters > belonging to different types) is possible in python??. > from what i can see it should not be possible. Not possible or useful in Python, for your example anyway. exchange_rates = { 'inr' : 0.020733, 'eur' : 0.890522, 'usd' : 1.000000 } def calculate(amount, from_cur, to_cur): from_rate = exchange_rates[from_cur] to_rate = exchange_rates[to_cur] return amount * from_rate / to_rate print calculate(1000, 'inr', 'usd') ## Jason Orendorff http://www.jorendorff.com/ From sfeil at io.com Sat Dec 22 20:46:54 2001 From: sfeil at io.com (Steven Feil) Date: Sun, 23 Dec 2001 01:46:54 GMT Subject: Extending Python classes Message-ID: Question 1: In the document "Extending and Embedding the Python Interpreter", there is a chapter called "Defining new types". What is the difference between a "Type" and a class in python? Question 2: Is there a way to associate an instance of a class with a C-Language pointer? If these questions don't make since here is an explanation of what I have now and what I am trying to acomplish..... I am working with a project that uses both C and Python. The inner workings require a lot of calculations. I have written this part in C in a way that optimize the complex calculation. I would like to import this program into python and take advantages of OOP. As it turns out I have looked into OOP before, but Python is the first OOP language that I am excited about. Here is an abstract description of what is happening. 1. A machine is built using instructions contained in a text file. 2. The machine is given a single value from this, it calculates a result. 3. Step 2 is repeated as many times as necessary. 4. The machine is decommissioned. I wrote the C code with this in mind. I have functional equivalents to a constructor and destructor methods called BuildMachine() and FreeMachine(). Build allocates a block of memory that contains all data associated with a OOP instance and returns a pointer. (In actuality the root block has pointers to two other blocks of memory. The root block is always the same size of memory but the size of the two other blocks are dependent on the amount of data in the build instructions.) Currently I am running each active machine as a separate Linux process. Each machine is accessed with a pair of fifo's (one for input and one for output). When I am done with a machine the fifo closes and the process ends. Currently, I am experimenting with machines that have no memory of the previous calculation. Using the current setup it is possible to build machines that have memory of the previous calculations. In order to be effective I would need to have to have a reset. Because I am using fifo's, it is difficult to send a reset, so I am not using machines with memory. I would like to create a python class with with a calculate method and a reset method (in addition to the constructor and destructor methods). ======================================================================== Steven Feil | Gram-pa, back at the turn of the .~. Programmer/Developer | century, why did people use an /V\ sfeil at io.com | operating system, when they were not // \\ | allowed to see the source code? (X_X) ======================================================================== From boud at rempt.xs4all.nl Sun Dec 2 03:16:36 2001 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 2 Dec 2001 08:16:36 GMT Subject: Python, PyQT and QSpinBox References: <9ubnie$34b$1@snipp.uninett.no> Message-ID: <9uco14$3cb$1@news1.xs4all.nl> Yngve F. Johansen wrote: > Hello > I'm rather new to Python, and to GUI programming as well. I've been fooling > around with the QT toolkit, and find it extremely easy and intuitive to work > with, short of one thing I can't figure out: > I use a QSpinBox in my dialog, and it works, kind of. The problem is when I > enter text rather than use the Up/Down buttons. The text isn't > updated/converted > to an integer-value automatically, but if I move the mouse-pointer over the > widget buttons it gets converted. > Is there a way to change this behavior? I've tried to subclass the QSpinBox > and > write my own functions, but it didn't help a whole lot. Which version of Qt are you using? The Qt 3 QSpinbox has a function interpretText() that should be called whenever the user manually edits the contents of the spinbox. I think that this function should do the right thing by default (i.e. call mapTextToValue(), but you could always subclass QSpinbox and reimplement interpretText to do what you want. If you could post a small sample script showing the behaviour, I'm sure I cold help you find a solution. -- Boudewijn Rempt | http://www.valdyas.org From sorpippo at libero.it Mon Dec 31 11:43:52 2001 From: sorpippo at libero.it (Cosmic_NTT) Date: Mon, 31 Dec 2001 16:43:52 GMT Subject: Python VS PHP Message-ID: Hi everybody and..... good 2K+2. OK, OK...Python & php cannot be used together : pcre linking It seems that python cannot be used in conjunction with PHP : the Make with both resulted in : ########################## /usr/lib/python1.5/config/libpython1.5.a(pypcre.o): In function `pcre_study': /usr/src/bs/BUILD/Python-1.5.2/Modules/./pypcre.c:514: multiple definition of `pcre_malloc' modules/php4/libphp4.a(pcre.o):/tmp/php-4.1.0/ext/pcre/pcrelib/pcre.c:309: first defined here /usr/lib/python1.5/config/libpython1.5.a(pypcre.o): In function `pcre_study': /usr/src/bs/BUILD/Python-1.5.2/Modules/./pypcre.c:516: multiple definition of `pcre_free' modules/php4/libphp4.a(pcre.o):/tmp/php-4.1.0/ext/pcre/pcrelib/pcre.c:309: first defined here collect2: ld returned 1 exit status make[2]: *** [target_static] Error 1 make[1]: *** [build-std] Error 2 make: *** [build] Error 2 ############################# But how to solve the problem? Ciao. Giuseppe. From dalke at dalkescientific.com Sun Dec 9 17:41:55 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Sun, 9 Dec 2001 15:41:55 -0700 Subject: __subclasses__() (was OK, now *this* is cool) References: <3C112086.5F7072A9@accessforall.nl> <3C13404D.F7A60179@accessforall.nl> <3C13CB48.D1357B4C@accessforall.nl> Message-ID: <9v0pon$lf8$1@slb7.atl.mindspring.net> Ype Kingma: > Jython leaves all it's garbage collection to the Java VM. > This simplifies the Jython source code (a lot, no reference > counting anywhere). On the downside it is more difficult > to have a method executed when an object becomes garbage. "more difficut" means it's still possible. How? I have a Python wrapper on top of a C library. I use __del__ to call the special deallocator for the library when the object is no longer needed. The library also has bindings for use with Java. I tried using JPython (it was a while ago) but got memory leaks all over the place because it doesn't call __del__ methods; prefering the Java garbage collector. How do I make Jython work with that wrapper? try/finally doesn't work for my needs. Andrew dalke at dalkescientific.com From jafo-pythonlist at tummy.com Sat Dec 22 05:33:47 2001 From: jafo-pythonlist at tummy.com (Sean Reifschneider) Date: Sat, 22 Dec 2001 03:33:47 -0700 Subject: RELEASED - Python 2.2 final In-Reply-To: <3C23B499.F601B20D@iinet.net.au>; from jbell@iinet.net.au on Sat, Dec 22, 2001 at 06:15:54AM +0800 References: <3C23B499.F601B20D@iinet.net.au> Message-ID: <20011222033347.C26726@tummy.com> On Sat, Dec 22, 2001 at 06:15:54AM +0800, John Bell wrote: >Great! Will the RPM's be released pre Xmas too? They should appear on the python.org site shortly, check for them there at: http://python.org/2.2/rpms.html Until that time, you can also find them under ftp.tummy.com:/pub/tummy/RPMS -- binaries are under the 7.2 directory, and the SRPM is in the "SRPMS" directory. Enjoy, Sean -- If you talk to God, you are praying; if God talks to you, you have schizophrenia. -- Thomas Szasz Sean Reifschneider, Inimitably Superfluous tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python From kragen at pobox.com Fri Dec 21 06:24:55 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 21 Dec 2001 06:24:55 -0500 Subject: Is there a tool for python under Linux? References: Message-ID: <834rmkak8o.fsf@panacea.canonical.org> =?gb2312?B?1cXJ2bPb?= writes: > I want to know if there is a tool which can compile python's > source code into a standalone EXE file under Red Hat Linux7.0 ,for > example,compile my.py into my.exe under Linux. If I understand correctly, you want to generate an MS-DOS or Windows executable under Linux? I don't know if that's possible, but I haven't tried it. From maxm at mxm.dk Thu Dec 13 09:13:12 2001 From: maxm at mxm.dk (maxm) Date: Thu, 13 Dec 2001 15:13:12 +0100 Subject: unintentionaly shared attributes in two different instances References: Message-ID: "Alexandre Fayolle" wrote in message > Don't use mutable primitives (lists, dictionaries or class instances) as > default value in a method or function. See ?4.7.1 in the Python tutorial: > > "Important warning: The default value is evaluated only once. This makes a > difference when the default is a mutable object such as a list or dictionary." Bummer ... thanks! regards Max M From jkraska at san.rr.com Sun Dec 23 14:24:01 2001 From: jkraska at san.rr.com (Courageous) Date: Sun, 23 Dec 2001 19:24:01 GMT Subject: Looping constructs References: <3c25d37e_9@news.newsgroups.com> Message-ID: <1jbc2u8tknpcfs9rsdmqdnifareief76jc@4ax.com> >That's not really true. You're not a _True_ Scottsman. :) C// From andreas at mtg.co.at Sat Dec 29 07:37:58 2001 From: andreas at mtg.co.at (Andreas Kostyrka) Date: Sat, 29 Dec 2001 13:37:58 +0100 Subject: CGI form repost from browser--how to prevent? In-Reply-To: References: Message-ID: <20011229133758.B5961@vaio2.mtg.co.at> On Tue, Dec 11, 2001 at 10:51:53AM -0800, Chris wrote: > I'm writing a Python cgi script that does some inserts into a mysql > database based on data in an html form submitted by a user. Is there > any way to prevent the browser from reposting the data from the form > when the user hits refresh in the browser after they have submitted > the form? When this happens, the script receives the same cgi form > data and performs the same inserts on the database. I think maybe > this can be prevented by storing some state info with cookies?? Not > sure (have never used cookies). Any ideas on an easy way to prevent > this? Make it a POST Method. This way a standard conforming browser has to ask permission from the user to repost the data. Andreas From M.Kollenaar at slo.nl Thu Dec 6 10:21:25 2001 From: M.Kollenaar at slo.nl (M.Kollenaar) Date: Thu, 6 Dec 2001 16:21:25 +0100 Subject: Newbie - Exporting Excel Spreadsheet References: <673dc1dc.0112051334.370c75f2@posting.google.com> <3C0F7CFC.B7E73192@computer.org> Message-ID: <9uo28c$9r7q2$1@ID-34238.news.dfncis.de> Hi, Is it also possible to fetch text from a Word2000 document with Python and a bunch of modules? Marcel "StationSteve" schreef in bericht news:3C0F7CFC.B7E73192 at computer.org... > You might want to go to your local bookstore and find a copy of "Python - > Programming on Win32", by Mark Hammond & Andy Robinson, published by > O'Reilly (Crocodile on the cover). Chapter 9 talks about Excel, and I > found it *VERY* useful in some work I did in controlling Excel from a > Python program. > SteveS. > > James Fugard wrote: > > > TIA for any help that I may get. I have a small project that I'm > > trying to do in Python...and I'm a hack at best! Here is what I'm > > trying to do. Call and capture a row in an Excel spreadsheet and then > > use manipulate the data in the cell of the various columns. > > > > Here is what I've been able to get some far: > > > > # Call all used modules > > import os,win32api,glob,odbc,dbi,time > > # Make the database connection using the system DNS > > MyConnection = odbc.odbc('Client_Data_Log') > > MyCursor = MyConnection.cursor() > > MyCursor.execute('SELECT * FROM "Client Data Log$"') # the sheet name > > print MyCursor.fetchall() > > > > This will give me everything + a bunch of dbi time stuff. If someone > > could tell me where to find info on calling a particular cell or a > > piece of sample code to follow(like G12 for example) that would be > > great. Thanks again. James > From mwh at python.net Mon Dec 10 06:56:03 2001 From: mwh at python.net (Michael Hudson) Date: Mon, 10 Dec 2001 11:56:03 GMT Subject: join vs instances References: Message-ID: Robin Becker writes: > what do I need in a class to get an instance to respect the string > join? Unfortunately, you can't. There is no satisfactory distinction on when things like this work and when they don't, but there's a general movement in favour of being more flexible, i.e. ''.join(UserString('ab')) might work at some point. Doesn't seem to in 2.2b2+, though. As a work around, it you control the call of string.join, replace sep.join(seq) with sep.join(map(str, seq)) HTH, M. -- Good? Bad? Strap him into the IETF-approved witch-dunking apparatus immediately! -- NTK now, 21/07/2000 From oren-py-l at hishome.net Sun Dec 2 17:08:05 2001 From: oren-py-l at hishome.net (Oren Tirosh) Date: Sun, 2 Dec 2001 17:08:05 -0500 Subject: Draft PEP: string interpolation with backquotes In-Reply-To: ; from tim.one@home.com on Sun, Dec 02, 2001 at 02:44:22PM -0500 References: <20011202080626.A76724@hishome.net> Message-ID: <20011202170805.A36879@hishome.net> On Sun, Dec 02, 2001 at 02:44:22PM -0500, Tim Peters wrote: > Seems overspecified: "U" and "R" are also legit prefixes, so "I" should be > too. The order of prefixes shouldn't matter (just as it doesn't matter now > for mixing 'u'/'U' and 'r'/'R'). The order of prefixes does matter. Try it. ur"foo" is valid, but ru"foo" isn't. I don't know the original rationale for this decision but I tried to keep it. Do you have any special arguments one way or the other? Naturally, the "i" prefix should be case insensitive, just like "r" and "u". > > The prefix "i" stands for "interpolation" or "in-line". Within > > a string with an "i" prefix an expression enclosed in backquotes is > > converted into its string representation > > That's ambiguous, and this is a real problem: Python generally has two > forms of "string representation", str() and repr(). Unfortunately for the > proposal, backticks are a shortcut for repr() but str() is probably more > useful in this context. I meant str(). repr() isn't very useful when embedding strings because of the quotes. I should have been more specific. Yes, this is inconsistent with the standard use of backquotes which is equivalent to repr(), not str(). I believe this is an acceptable compromise since it does the Right Thing for formatting. I wonder how ABC's backquotes worked inside strings. > > The expression may be any valid Python expression not containing > > the backquote character. > > This is an unnecessary difference with current backtick expressions. It's > not particularly pretty to look at, but nested backtick expressions are > unambiguous and work fine. Artificially restricting them in this context > would be a wart (not to mention that you couldn't reuse the compiler code > that compiles them now). I am aware of this. The reason for this restriction is simplicity. String interpolation is meant for short expressions, often just a single name. In my proposed implementation most of the processing occurs at the tokenizer while parsing nested backtick expressions unambigously is a job for the parser so this keeps the implementation simple. A possible approach I have considered is to allow nested backticks inside interpolations as long as they are surrounded by at least one level of parens/braces etc. The tokenizer already counts paren levels for expressions extending across newlines. I consider the fact that interpolation is done very early, starting at the tokenizer level to be the most important feature of this proposal. It's good that Python has an eval() function but overuse of runtime evaluation is one of the first steps on the road to scripting language hell :-) A late-binding string interpolation system is a form of functional programming implemented with runtime evaluation. No thanks, we already have lambda functions for that. Oren Tirosh From syver-en+usenet at online.no Mon Dec 3 19:23:10 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 04 Dec 2001 01:23:10 +0100 Subject: request, info from pydoc References: Message-ID: Michael Hudson writes: > Haven't heard of any. Would be cool, though (hint, hint :). Yeah, I agree, I looked briefly at the classes that implement pydoc, and they already have a hierarchy for generating to different forms of output. One for text and one for html, so it should definetively be doable, let's say another subclass for texinfo. That has to be compiled/processed in some way to make info files? The problem is that I don't know the first thing about texinfo and all that stuff so I'll have to check out that first, but it sounds a bit daunting with makeinfo and tex. I'd like to do some work on it but I'll probably stop because there seems to be too many issues at the time being. There is a version for java that I thought I could check out to see how they've done it, but then I'll have learn and setup a java environment before I can make use of it > > Cheers, > M. -- Vennlig hilsen Syver Enstad From fperez528 at yahoo.com Tue Dec 18 18:58:36 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Wed, 19 Dec 2001 23:26:36 +2328 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> <7x1yhqbefg.fsf@ruckus.brouhaha.com> Message-ID: <9vs0e0$jtm$1@peabody.colorado.edu> Paul Rubin wrote: > Fernando P?rez writes: >> All the scripts for which this is an issue are distributed by them, as part >> of their own system setup. So they can point every script which explicitly >> needs 1.5 to use it. >> >> They cause their users a fair amount of annoyance and I have yet to >> see a solid technical reason to justify it. > > IMO the annoyance was caused by the needless incompatibility between > Python 1.5.x and 2.x.x. The redhat people had a product to ship on a > deadline; yes they could have updated all those scripts and QA'd them > again, but at the expense of either a schedule slip or resources being > directed away from something else. Instead, they stuck with what > worked. Maybe they'll update the scripts in a future Redhat release. Well, considering that Python 2.0 was out in October 2000, the 'tight deadline' excuse doesn't fly too well, as far as I'm concerned. As I said above, I have yet to see a good justification for this mess. If there is one, I'd love to hear it. cheers, f. From sdm7g at Virginia.EDU Fri Dec 14 11:06:46 2001 From: sdm7g at Virginia.EDU (Steven Majewski) Date: Fri, 14 Dec 2001 11:06:46 -0500 (EST) Subject: Fallen Angels, Originators of Evil on Planet Earth? In-Reply-To: <3ditb9q0xr.fsf@ute.mems-exchange.org> Message-ID: If you buy into the initial statement of the problem, but not the theory of demonic time-sharing, then that would explain why demonic possession is a relatively rare phenomenon in modern times compared to ages past. The number of deamons have remained relatively constant, while the human population has soared, so deamons are spread thin and percentage of the population who are deamon possessed has fallen. But I don't believe that the deamon population is constant: there are lots being generated on computers every day, and I'll bet that some of them have escaped! ( Maybe they don't actually die when you 'kill' them! ) -- Steve On 14 Dec 2001, Andrew Kuchling wrote: > news at originsofevil.com writes: > > Fallen Angels, Originators of Evil on Planet Earth? > > And they multitask, too! From _Demon Possession Handbook for Human > Service Workers_, at http://diskbooks.org/part1.html: > > 10. Demonic Time-Sharing > > Back in the days when Jesus walked the earth and evicted a > legion [6,000] demons out of one man, the world population was > a fraction of what it is today. In fact, population experts > believe the number of people alive today exceeds all the > people who have died since the dawn of creation. Let's assume > that the number of demons is fixed and that number is the same > today as it was when Adam and Eve walked in the Garden of > Eden. This means that demons today have to cover more > territory -- in terms of human beings -- than at any time in > the history of the human race. One way demons can accomplish > this feat is through what computer experts refer to as > time-sharing. In the computer world, a large main-frame > computer can be used by many people at the same time, without > those users even knowing about the existence of each > other. When telephone lines are used, people from all over the > world can access the same computer simultaneously. The > computer works with each user in turn and does so with such > speed that each simultaneous user has the illusion of being > the only person logged on at that time. The Internet uses a > form of time-sharing. It may not be as fast as you would like, > but it's time sharing. > > Demons may work the same way. Although they are not > omnipresent in the same sense as God is everywhere at the same > time, apparently they can move from point to point at very > high speeds. Assuming that their minimum speed of travel is > the speed of electricity, 186,000 miles per second, a single > demon can trouble a large number of people in the course of a > few minutes. This is like a computer is able to work with a > large number of customers, through time-sharing. > > I can well believe that demons are involved in threaded programming. > > --amk > -- > http://mail.python.org/mailman/listinfo/python-list > From lac at strakt.com Sun Dec 30 11:52:31 2001 From: lac at strakt.com (Laura Creighton) Date: Sun, 30 Dec 2001 17:52:31 +0100 Subject: Icons and Tkinter!....From PRJoshi In-Reply-To: Message from "Pravin Raj Joshi" of "Sun, 30 Dec 2001 17:51:53 +0530." References: Message-ID: <200112301652.fBUGqVua025458@ratthing-b246.strakt.com> 1. Put this bookmark in your web browser. http://groups.google.com/advanced_group_search?as_ugroup=comp.lang.python 2. Go there. Search for something useful. I tried 'change tk icon' in the 'all of the words' box. You will get many hits. The first one I think will interest you. 3. It is inconvenient for those of us who read comp.lang.python as a digestified mail archive to receive your mail in HTML again after we have already seen it in ascii. Laura Creighton From LLoeffler at home.com Sun Dec 2 18:33:08 2001 From: LLoeffler at home.com (Luke) Date: Sun, 02 Dec 2001 17:33:08 -0600 Subject: making a file hidden in win32? References: Message-ID: <3C0ABA34.5090601@home.com> why not this import os from sys import platform if platform == "win32": os.system("attrib +h c:\\spam.txt") From peterb at cortland.com Thu Dec 13 04:54:54 2001 From: peterb at cortland.com (Peter Bismuti) Date: Thu, 13 Dec 2001 01:54:54 -0800 Subject: tabs vs spaces, what do IDEs use? References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> Message-ID: <3c17d349$1@207.229.64.20> > Why don't issue a DeprecationWarning whenever tabs are found in the > source file? That wouldn't "break" things, but it would surely > motivate tab-using people to learn the right way of doing things. I've noticed that both JBuilder (if I remember correctly) and VisualStudio.net use tabs as the default for indenting with a width of 4. This is certainly a strong piece of anecdotal evidence that refutes this idea that "normal" people uses spaces for indenting. I like the idea of the warning as long as I can set a flag to turn it off. From jkraska at san.rr.com Thu Dec 6 17:09:16 2001 From: jkraska at san.rr.com (Courageous) Date: Thu, 06 Dec 2001 22:09:16 GMT Subject: Calling a generator multiple times References: <200112061113290670.0100F457@mail.rdc1.sdca.home.com> Message-ID: >> I'm trying to create a clever way to call a generator multiple >> times, but the only thing I've been able to come up with is: I personally think that current generator behavior is all whacked. The first call to some generator g() should behave like: f=g() f.next() Subsequent calls to g() should behave like f.next() The current behavior should be accessible but not the default. I base this opinion in part upon the way that the generator is defined. As long as the generator is defined with a signature which makes it appear as an ordinary function, that's exactly how it should behave. The semantics of having the function behave slightly differently upon the second invocation isn't nearly as surprising as the fact that, under the current definition, a generator really doesn't behave like a function at all. C// From rdsteph at earthlink.net Sat Dec 29 10:36:20 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sat, 29 Dec 2001 15:36:20 GMT Subject: Python Popularity, python at sourceforge References: Message-ID: <3C2DE34A.4C30FAD2@earthlink.net> Wow. Thanks, very interesting "gossip" which i enjoy ;-)))) Roeland Rengelink wrote: > Hi, > > As was remarked earlier in this thread, a measure of Python's > popularity, if not quality, can be obtained by looking at the number > of sourceforge projects using Python. Below you'll find a number of > tables comparing sourceforge projects using Python to those using > Perl, PHP, Java, C and C++. These numbers were obtained by > screen-scraping the sourceforge trove pages. > > I started this analysis expecting to find clear evidence for Python's > - exploding popularity > - cross-platform usability > - ease of development > > Alas, the numbers are far more ambigious than I'd hoped. To summarize: > > 1. Python is the smallest of the 6 languages discussed here. > 2. Python is currently growing slower than PHP and Java, but faster > than C and Perl. > - Python has only been gaining on Perl for the last 6 months > - the difference in growth w.r.t PHP and Java may be getting smaller > 3. Java is more cross-platform than Python. Perl, C, C++ are less. > 4. There is no clear evidence for Python's ease of development. > > The most interesting result (I think) is Python's changing role from a > glue/scripting language to a stand-alone development language. > Cross-language development statistics are investigated at the end of > this post. > > 1. All projects > > The following two tables list the cumulative number and quarterly > growth rates of sourceforge projects using Python, Perl, PHP, Java or > C++ as one of their programming languages. Note that projects using > more than one of these languages contribute to the numbers of each of > those languages. > > The following conclusions can be drawn > - Python is only half as big as any of the other languages. > - The growth rate of Perl, as compared to Python, has been steadily > declining since ther third quarter of 2000. It has become smaller > than Python's growth rate in the third quarter of 2001. > - The growth rates of PHP and Java have been much larger than > Python's. However, up to the third quarter of 2001 their growth rates > declined relative to Python. > - Since the third quarter of 2000, C has been the slowest growing > language. > - The growth rate of Python is most similar to that of C++ > > To summarize: > > Early 2000 Python was the slowest growing language. Currently only PHP > and Java are growing faster, and the gap is closing > > Table 1a. Cumulative number of projects > Python=1 > Python Perl PHP Java C C++ Perl PHP Java C C++ > 00-03-01 98 172 84 139 529 361 1.8 0.9 1.4 5.4 3.7 > 00-06-01 221 417 251 371 1220 882 1.9 1.1 1.7 5.5 4.0 > 00-09-01 374 785 555 756 2030 1518 2.1 1.5 2.0 5.4 4.1 > 00-12-01 528 1178 883 1257 2827 2220 2.2 1.7 2.4 5.4 4.2 > 01-03-01 701 1575 1328 1841 3706 2949 2.2 1.9 2.6 5.3 4.2 > 01-06-01 898 2020 1867 2539 4652 3806 2.2 2.1 2.8 5.2 4.2 > 01-09-01 1097 2406 2326 3164 5513 4589 2.2 2.1 2.9 5.0 4.2 > 01-12-01 1266 2690 2745 3774 6189 5285 2.1 2.2 3.0 4.9 4.2 > > Table 1b. Quarterly growth rates > Percentage growth Python=1 > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 125 142 198 166 130 144 1.1 1.6 1.3 1.0 1.1 > 00-09-01 69 88 121 103 66 72 1.3 1.7 1.5 1.0 1.0 > 00-12-01 41 50 59 66 39 46 1.2 1.4 1.6 1.0 1.1 > 01-03-01 32 33 50 46 31 32 1.0 1.5 1.4 0.9 1.0 > 01-06-01 28 28 40 37 25 29 1.0 1.4 1.3 0.9 1.0 > 01-09-01 22 19 24 24 18 20 0.9 1.1 1.1 0.8 0.9 > 01-12-01 15 11 18 19 12 15 0.8 1.2 1.3 0.8 1.0 > > 2. Cross platform projects > > Python advertises itself as a cross-platform development language. > Here, I assume that cross-platform means either OS-independent, or for > 2 or more of the the different OS families [Unix, Win, Mac] > > The conclusion here is pretty much expected: > - Python is more 'cross-platform' than Perl, C and C++, but less so > than Java, and comparable to PHP > > Table 2a Cumulative number of cross-platform projects > Python=1 > Python Perl PHP Java C C++ Perl PHP Java C C++ > 00-06-01 157 273 172 311 590 484 1.7 1.1 2.0 3.8 3.1 > 00-12-01 365 722 598 1047 1317 1159 2.0 1.6 2.9 3.6 3.2 > 01-06-01 626 1243 1298 2135 2122 1939 2.0 2.1 3.4 3.4 3.1 > 01-12-01 900 1658 1959 3198 2836 2701 1.8 2.2 3.6 3.2 3.0 > > Table 2b Cross-platform projects as fraction of all new projects > Python=1 > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 71 65 68 83 48 54 0.9 1.0 1.2 0.7 0.8 > 00-12-01 67 59 67 83 45 50 0.9 1.0 1.2 0.7 0.7 > 01-06-01 70 61 71 84 44 49 0.9 1.0 1.2 0.6 0.7 > 01-12-01 74 61 75 86 46 51 0.8 1.0 1.2 0.6 0.7 > > 3. Active projects > > Python also advertises itself for its ease of development. One could > expect that easy projects are more active than difficult projects. > > The following tables list statistics for projects that have an > activiy_ranking of more than 80 %. Since I don't know how this > activity is measured I can't really interpret these numbers. > > Activity ranking is a relative measure of a projects activity, which > is computed over all sourceforge projects. An activity ranking of 80% > means 80% as active as the most active sourceforge project. Activity > seemt to comprise both developer activity (checkins, bug fixes) and > user activity (downloads, bug reports). > > The most notable result from these tables is probably that the numbers > are so similiar. Hence, my tentative conclusion: > > - Project activity is largely independent from the choice of > programming language and therefore also independent of the > 'accessability' of the language > > Table 3a Cumulative number of active projects > Python=1 > Python Perl PHP Java C C++ Perl PHP Java C C++ > 00-06-01 24 36 21 33 156 94 1.5 0.9 1.4 6.5 3.9 > 00-12-01 43 59 49 74 268 174 1.4 1.1 1.7 6.2 4.0 > 01-06-01 59 95 81 127 368 263 1.6 1.4 2.2 6.2 4.5 > 01-12-01 74 120 128 182 441 347 1.6 1.7 2.5 6.0 4.7 > > Table 3b Percentage active as fraction of all projects > Python=1 > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 10 8 8 8 12 10 0.8 0.8 0.8 1.2 1.0 > 00-12-01 6 3 4 4 6 5 0.5 0.7 0.7 1.1 1.0 > 01-06-01 4 4 3 4 5 5 1.0 0.8 1.0 1.3 1.3 > 01-12-01 4 3 5 4 4 5 0.9 1.3 1.1 1.2 1.4 > > 4 Mature projects > > Ease of development may also be reflected in what percentage of > projects reaches a mature development status. The following tables > give numbers for projects that reached a mature or production/stable > development status. > > The data suggest that Perl and C project reach a mature development > status more often than Python, PHP, Java and C++ projects. > > Note that development status is assessed by the project developers > themselves > > Table 4a Cumulative number of mature projects > Python=1 > Python Perl PHP Java C C++ Perl PHP Java C C++ > 00-06-01 43 118 41 59 294 168 2.7 1.0 1.4 6.8 3.9 > 00-12-01 87 233 109 161 599 342 2.7 1.3 1.9 6.9 3.9 > 01-06-01 122 367 194 286 887 503 3.0 1.6 2.3 7.3 4.1 > 01-12-01 160 455 280 399 1110 644 2.8 1.8 2.5 6.9 4.0 > > Table 4b Percentage mature as fraction of all projects started. > Python=1 > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 19 28 16 15 24 19 1.5 0.8 0.8 1.2 1.0 > 00-12-01 14 15 10 11 18 13 1.1 0.8 0.8 1.3 0.9 > 01-06-01 9 15 8 9 15 10 1.7 0.9 1.0 1.7 1.1 > 01-12-01 10 13 9 9 14 9 1.3 0.9 0.9 1.4 0.9 > > 5. Cross language development > > The most interesting results are obtained when we compare projects > that use a single language with those that use multiple languages. The > follwing tables compare the fraction of projects that use more than > one language, to those that only use a single language. > > There are many trends here. > > - Python, Perl, PHP and Java projects are increasingly becoming > single-language projects. > - The percentage of cross-language projects in cross-platform projects > is lower for Python, Perl, PHP and Java, while its substantially > higher for C and C++ projects. > - Of the currently active Python projects nearly all old projects > included other languages, while only a third of the new projects > does so. > - Perl is the only language for which the fraction of multi-language > projects is larger for active projects. > - For the mature Python projects there is also a large difference in > the fraction of cross-language projects between old and new > projects. > - For all languages the percentage of mature projects that use more > than one language is smaller. > > One conclusion > > - Python is increasingly used a stand-alone development language, > especially in active and mature projects. > > Table 5a Percentage of all new projects > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 55 51 41 35 47 46 0.9 0.8 0.6 0.9 0.8 > 00-12-01 52 42 37 33 47 46 0.8 0.7 0.6 0.9 0.9 > 01-06-01 51 48 39 30 46 46 0.9 0.8 0.6 0.9 0.9 > 01-12-01 45 42 31 26 47 43 0.9 0.7 0.6 1.0 1.0 > > Table 5b Percentage of new cross platform projects > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 52 47 44 32 56 51 0.9 0.8 0.6 1.1 1.0 > 00-12-01 50 40 33 30 54 50 0.8 0.7 0.6 1.1 1.0 > 01-06-01 51 43 36 27 54 52 0.8 0.7 0.5 1.1 1.0 > 01-12-01 44 39 28 24 56 48 0.9 0.7 0.6 1.3 1.1 > > Table 5c Percentage of active projects > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 87 58 19 12 51 44 0.7 0.2 0.1 0.6 0.5 > 00-12-01 68 60 17 46 44 51 0.9 0.3 0.7 0.7 0.7 > 01-06-01 50 55 40 32 47 37 1.1 0.8 0.6 0.9 0.7 > 01-12-01 33 64 25 19 52 47 1.9 0.8 0.6 1.6 1.4 > > Table 5c Percentage of mature projects > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 58 36 34 27 37 37 0.6 0.6 0.5 0.6 0.6 > 00-12-01 47 26 20 32 37 44 0.5 0.4 0.7 0.8 0.9 > 01-06-01 45 37 32 24 34 36 0.8 0.7 0.5 0.8 0.8 > 01-12-01 34 31 25 22 36 40 0.9 0.7 0.6 1.1 1.2 > > Undoubtedly there's more to be gained from these numbers. But this is > starting to look like work, so... > > Roeland > > -- > r.b.rigilink at chello.nl > > "Half of what I say is nonsense. Unfortunately I don't know which half" From phr-n2001d at nightsong.com Thu Dec 20 16:06:44 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 20 Dec 2001 13:06:44 -0800 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> Message-ID: <7xlmfxvbx7.fsf@ruckus.brouhaha.com> ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) writes: > What about users and other vendors that have working python scripts that > use things that have changed between python 1.5 and 2.x? It would be a bit > embarassing for redhat to claim compatibility between major versions and > suddenly have working python scripts break after doing a point upgrade. That's a good point. It's probably too late to start reporting the incompatibilities as bugs against 2.2c, though that's what they are. From lucio at movilogic.com Thu Dec 20 14:32:10 2001 From: lucio at movilogic.com (Lucio Torre) Date: Thu, 20 Dec 2001 16:32:10 -0300 Subject: Huge Dicts and perfomance References: <1008874192.15275.0.nnrp-02.d4e54907@news.demon.co.uk> Message-ID: <3C223CBA.5080205@movilogic.com> Stephen D Evans wrote: >Are you using a list for the first index ? e.g. using list comprehensions: > >dict = [ {} for i in range(2) ] # create a list of dictionaries >dict[0][objectname] = object >dict[1][(obj-a, obj-b)] = obj(a, b) > >This should give a slight performance increase. > Ill try it. > >Which version of python are you using? Some windows versions run noticeably >slower than others with large amounts of data. (As an observation - the >cygwin http://sources.redhat.com/cygwin/ version runs faster on the windows >platform when using large dictionaries.) > I really dont know :) i have 1.5.2, and 2.0, and 2.1 installed in my linux box, and cant remember now which one is the default (and i dont have the machine with me, now). But i can pick anyone i like. I think i prefer 1.5.2 because ZODB is available as a separate package. Is there a zodb for 2.x? Any idea of the overhead of adding zodb? Or should i just use the dbsomehting module? Thanks! Lucio. > >Stephen D Evans > >A picture speaks a thousand words. >"Lucio Torre" wrote in message >news:mailman.1008865945.12538.python-list at python.org... > >>Hi, >> >>I am making an application where i want to store links betwen nodes. So >>i have a dictionary where i store the objects. >> >>dict[0][objectname] = object >> >>the [0] is because i to signify a link betwen obj-a and obj-b, i do: >> >>dict[1][(obj-a, obj-b)] = obj(a, b) >> >>and so on, to six levels deep. >> >>and i also store links betwen dict[x][y] and other nodes (the stored >>object has those links) >> >>and i want to say for example, if i have a and b, what other nodes >>usually come togheter? so i follow the links and find the root nodes (z, >>x) and the groups (a, z) and (s, x). >> >>the main problem of course is that doing it this way, performance sucks. >>I took me nothing to code it, but it takes to much to run (more than >>coding). So, any ideas on how to achieve my goal in a better (faster) way? >> >>thanks, >> >>Lucio. >> >> >> > > From mgerrans at ix.netcom.com Sat Dec 8 03:23:14 2001 From: mgerrans at ix.netcom.com (Matt Gerrans) Date: Sat, 8 Dec 2001 00:23:14 -0800 Subject: Monitoring running Windows Applications References: <3c13b5b2.56161165@127.0.0.1> Message-ID: <9usis8$t0h$1@slb4.atl.mindspring.net> The Python Windows modules don't seem to include ToolHelp API, which you need to enumerate processes (CreateToolhelp32Snapshot(), Process32First() and Process32Next()). However they do include EnumWindows() in the win32gui module. That may be sufficient for your needs; it will allow you to enumerate all top-level windows. win32gui also includes EnumChildWindows() if you want to delve deeper. That would, for instance, allow you to look at (among the plethora of other child windows) all the documents being edited in a MDI application like Excel. This assumes the document window titles include the document title, which they usually do. Of course, if you really want to get a process list, you need to use the ToolHelp API. You can write a Python extension, or better yet, write a COM Automation server that does what you want and use win32com.client.Dispatch to easily connect to it. In fact, I like this idea and may do it myself... - Matt (Five Fresh) Fish wrote in message news:3c13b5b2.56161165 at 127.0.0.1... > Here is, I think, a stumper: > > How can one get Python to identify either the applications that are > currently running in Windows, in real-time (ie. as an application > monitor)... > > Or, better, how can one get Python to identify all the open windows, in > real-time? > > [The idea being that if one can do this, it'd be a breeze to create a tool > that can keep an automatic diary of one's work tasks during the day...] From hauser at ifm.uni-kiel.de Tue Dec 4 07:47:56 2001 From: hauser at ifm.uni-kiel.de (Janko Hauser) Date: 04 Dec 2001 13:47:56 +0100 Subject: Numerical Python Question References: <9uieop$bncra$1@hades.rz.uni-sb.de> Message-ID: <87d71vdudf.fsf@ifm.uni-kiel.de> Uwe Schmitt writes: > Hi, > > I tried the following code: > > > from Numeric import * > from Matrix import * > > n=5 > > hilb=zeros((n,n),Float) > > for i in range(n): > for j in range(n): > val= 1.0/(i+j+1) > hilb[i,j]=val > > x=ones((n,1),Float) > > b=hilb*x > > print "x= ", x > > print "b= ", b > > > As hilb is a n x n matrix and x is n x 1 the result b should be n x 1. > But the program outputs a n x n matrix !!! > hilb is a NxN array not a matrix. You need to wrap it into a matrix, so that the multiplication operator is overloaded. mHilb=Matrix(hilb) b=mHilb*x print b.shape HTH __Janko -- Institut fuer Meereskunde phone: 49-431-597 3989 Dept. Theoretical Oceanography fax : 49-431-565876 Duesternbrooker Weg 20 email: jhauser at ifm.uni-kiel.de 24105 Kiel, Germany From hgg9140 at seanet.com Fri Dec 28 16:01:04 2001 From: hgg9140 at seanet.com (Harry George) Date: 28 Dec 2001 13:01:04 -0800 Subject: REPOST: ANN: Pdx 1.4.1 (markup language) Message-ID: <4$--$$_----__-$%_$@news.noc.cabal.int> Pdx (POD Extended) is a markup language with backends for HTML, Latex, and Docbook. See: http://www.seanet.com/~hgg9140/comp/pdx-1.4.1/doc/index.html It is available at: http://www.seanet.com/~hgg9140/comp/ Recent changes: 2001-12-28: v1.4.1 - Revised documentation structure (GNU style README, INSTALL, etc.) 2001-09-03: v1.4.0 - Numbered_heads now provides final "." - C<...> preserves spaces. - Design History decomposed by releases. - Tables no longer require a caption. -- Harry George hgg9140 at seanet.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Harry George Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:02:54 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774282 27193 211.57.49.2 (31 Dec 2001 04:51:22 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:51:22 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From bmcyitz at freebox.com Wed Dec 19 09:26:03 2001 From: bmcyitz at freebox.com (Yitz) Date: 19 Dec 2001 06:26:03 -0800 Subject: Dictionaries as records References: Message-ID: Skip Montanaro wrote in message news:... Bill> I have a file with 200K records and 16 fields. This file is Bill> parsed and each row is put into a dictionary and the dictionary is Bill> added to a list. The raw file is only about 50mb. Bill> I was shocked to see that my memory use jumped to 500MB! > You might want to consider storing it in an on-disk mapping object. Check > out the anydbm, bsddb, gdbm modules and the like. That will solve the memory problem, but it may be slow due to disk access. Here is a compromise (this code assumes that the set of keys for each dictionary is the same, otherwise modify accordingly): from UserList import UserList class ListOfDicts(UserList): '''Store a list of tuples, but make it act like a list of dictionaries. The constructor takes an optional list of tuples.''' def __init__(self, tuples=None): UserList.__init__(self, tuples) self.keys = ("name", "address", "etc") def _tuple2dict(self, tuple): d = {} map(d.setdefault, self.keys, tuple) return d def _dict2tuple(self, dict): return tuple(map(dict.get, self.keys)) def __contains__(self, item): return self._dict2tuple(item) in self.data def __getitem__(self, i): return self._tuple2dict(self.data[i]) def __setitem__(self, i, item): self.data[i] = self._dict2tuple(item) def __add__(self, other): if isinstance(other, UserList): return self.__class__(self.data + map(self._dict2tuple, other.data)) else: return self.__class__(self.data + map(self._dict2tuple, other)) def __radd__(self, other): if isinstance(other, UserList): return self.__class__(map(self._dict2tuple, other.data) + self.data) else: return self.__class__(map(self._dict2tuple, other) + self.data) def __iadd__(self, other): if isinstance(other, UserList): self.data += map(self._dict2tuple, other.data) else: self.data += map(self._dict2tuple, other) return self def append(self, item): self.data.append(self._dict2tuple(item)) def insert(self, i, item): self.data.insert(i, self._dict2tuple(item)) def pop(self, i=-1): return self._tuple2dict(self.data.pop(i)) def remove(self, item): self.data.remove(self._dict2tuple(item)) def count(self, item): return self.data.count(self._dict2tuple(item)) def index(self, item): return self.data.index(self._dict2tuple(item)) def extend(self, other): if isinstance(other, UserList): self.data.extend(map(self._dict2tuple, other.data)) else: self.data.extend(map(self._dict2tuple, other)) From James_Althoff at i2.com Thu Dec 6 13:33:54 2001 From: James_Althoff at i2.com (James_Althoff at i2.com) Date: Thu, 6 Dec 2001 10:33:54 -0800 Subject: getting the name of a variable Message-ID: Michael Hudson wrote: >sandskyfly at hotmail.com (Sandy Norton) writes: >> When I'm debugging I'm always sticking stuff like "print 'x:', x" in >> my code. So is there a handy function that will print a variable >> name and value such that: >> >> >>> def print_var_name_and_value(var): >> "prints variable name : value" >> >> >> >>> variable = 'me var' >> >>> print_var_name_and_value(variable) >> variable : me var > >Not really. Hit google groups for more info. Some highlights: > >a gross implementation attempt by me: > > http://groups.google.com/groups?selm=m38zytnexz.fsf%40atrus.jesus.cam.ac.uk > >a nice explanation of why this not really possible by /F: > >http://groups.google.com/groups?selm=3a03261b_1%40corp.newsfeeds.com It seems though, for the narrow purpose requested here, if you are willing to turn things around and pass the *name* of the variable instead of its value then -- using nested scopes -- one could write something like: >>> def prvar(x): ... print x, ':', eval(x) ... >>> z = 1 >>> prvar('z') z : 1 >>> Might save a little bit of typing. >>> def prvar(*varnames): ... for name in varnames: ... print name, ':', eval(name), ';', ... >>> a = 1 >>> b = 2 >>> c = 3 >>> prvar('a','b','c') a : 1 ; b : 2 ; c : 3 ; Jim From fperez528 at yahoo.com Mon Dec 10 09:24:33 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Tue, 11 Dec 2001 13:52:33 +2328 Subject: jpeg files displayed in a loop References: <5a4226f0.0112111203.1d361fa0@posting.google.com> Message-ID: <9v5ro0$2hr$1@peabody.colorado.edu> Kevin Cazabon wrote: > # ok, probably a couple minor typos, but it should be that simple. > Well, you got me curious. Here is the code with some things corrected. This actually runs, but it hangs at the first image. My cpu usage pegged at 100% and I just had to kill the job, it wasn't going anywhere. Any ideas? #!/usr/bin/env python import Tkinter import Image, ImageTk import os dir = "/usr/local/home/fperez/local/python/jpegs" def showimage(): image = files.pop() files.append(image) image = ImageTk.PhotoImage(Image.open(image)) #ok, do try/except b.configure(image=image) b.update_idletasks() b.after(1000, showimage) a = Tkinter.Tk() b = Tkinter.Label(a) b.pack() files = os.listdir(dir) # ok, check them for file types... os.chdir(dir) while 1: showimage() From mwh at python.net Sat Dec 29 10:18:29 2001 From: mwh at python.net (Michael Hudson) Date: Sat, 29 Dec 2001 15:18:29 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <32c382ad.0112272324.4c78689b@posting.google.com> <3C2C88A6.9D13A3D6@earthlink.net> <3C2CD7EB.F90E6C9@earthlink.net> Message-ID: Hans Nowak writes: > Yes, I've been checking out some old binaries, and strip was available > as early as 1.4. (Don't know about any older versions.) It's present in revision 1.1 in CVS from 1990; tags suggest this was before the release of version 0.9.8; I'd be surpsried to find it wasn't in the original version posted to alt.sources. Cheers, M. From jeff at ccvcorp.com Thu Dec 27 14:22:15 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Thu, 27 Dec 2001 11:22:15 -0800 Subject: cmp References: Message-ID: <3C2B74E6.597B894D@ccvcorp.com> Matt Russell wrote: > Well, I just made myself look silly. I admit it... > > when I type 1==1 into the interpreter, I thought if it was true, the > result is 1 - this is right. But cmp(1,1) actually returns 0 (in > accordance to the docs) > > But why then are we given the mechanism to compare instances of > classes via the __cmp__ def ? > > Collegues of mine have used this to return 1 (truth) if two instances > are equal (instanceA==instanceB).... this obviously wasn't the > intended purpose. (__cmp__ shuold return 0 if the result of cmp(a,b) > is to be trusted?? > > Perhaps then could someone explain to me how one compares classes > useing the == operator, or indeed if this bad programming practice. > > I hope I didn't waste too much of guido's time when I posted a bug on > sourceforge :( cmp(a, b) is not a boolean function, as your colleagues apparently feel it should be. It's actually a trinary function--it can return -1, 0, or +1, representing a being less than, equal to, or greater than b, respectively. Comparing classes with the == operator is fine. If you've declared a __cmp__() for your class, then == will use that. If you haven't, then == uses 'is' -- in other words, it tests for object identity. Note that if cmp(a, b) returns 0, then a == b will evaluate to 1. >>> class test: ... def __init__(self, val): ... self.value = val ... def __cmp__(self, other): ... try: ... return cmp(self.value, other.value) ... except: ... return -1 ... >>> a = test(1) >>> b = test(2) >>> c = test(2) >>> a < b 1 >>> b is c 0 >>> b == c 1 >>> Jeff Shannon Technician/Programmer Credit International From sandskyfly at hotmail.com Fri Dec 7 02:04:54 2001 From: sandskyfly at hotmail.com (Sandy Norton) Date: 6 Dec 2001 23:04:54 -0800 Subject: getting the name of a variable References: Message-ID: Thanks Jason, Your sweet function does exactly what I need. I really do recommend you upload it as a cookbook recipe! Also thanks to all the other responders... It's been highly educational, especially the part about cool cats not caring about their own names. (-; regards, Sandy > Sandy Norton wrote: > > When I'm debugging I'm always sticking stuff like "print 'x:', x" > > in my code. "Jason Orendorff" wrote: > Try this. > > import inspect > import sys > import re > > _out_re = re.compile(r"^out\s*\(\s*(.*)\s*\)$") > > def out(variable): > """ Prints variable name and value to sys.stderr. """ > frame, filename, lineno, fnname, lines, i = inspect.stack(1)[1] > my_line = lines[i].strip() > match = _out_re.match(my_line) > if match: > my_line = match.group(1) > print >> sys.stderr, "%s: %r" % (my_line, variable) > > This works by loading the source code of the caller from its > source file. So if you call out() from the Python prompt, it fails. > Try using it in an actual program or module instead. From en at enlightened.de Thu Dec 6 11:04:54 2001 From: en at enlightened.de (Nicolai Ehemann) Date: 6 Dec 2001 08:04:54 -0800 Subject: close window with python curses module Message-ID: <57c2c2f1.0112060804.708629fc@posting.google.com> I have a python application which uses curses. Now and then, I'd like to open dialog boxes for user input, which are closed after that. As they should appear on different locations of the screen and with different sizes, i don't want to use the same window object for all of them. So, is there a way to destruct a curses window object, or do you have any other suggestions for this problem? From meowbot at meowing.net Mon Dec 31 03:09:27 2001 From: meowbot at meowing.net (A Meowbot) Date: Mon, 31 Dec 2001 08:09:27 GMT Subject: Cancel messages References: Message-ID: <87zo3zolop.fsf@k0deZ.scriptkiddie.net> Gerhard H?ring wrote: > What's going on here? A mailman bug from the mail <-> news gateway, No. > or somebody coverage-testing their Mozilla?! Someone has decided to cancel thousands of articles in many newsgroups using open proxies. It hurts less if you don't try to figure out why someone would want to spend time doing something like that. From fperez528 at yahoo.com Tue Dec 18 12:10:16 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Wed, 19 Dec 2001 16:38:16 +2328 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <7xhequjsgl.fsf@ruckus.brouhaha.com> <9vc581$g0h$1@peabody.colorado.edu> <97ae44ee.0112181624.2293a692@posting.google.com> Message-ID: <9vr8gp$3af$1@peabody.colorado.edu> Stephen wrote: > I'm sat on a RedHat 7.2 box too and am very hesitant to upgrade to > Python 2.x for fear of breaking a lot of the RedHat-distributed > scripts, including the firewall. The alternative seems to be to > install Python 2.1.1 without symlinking it to /usr/bin/python > ie. Leave Python 1.5.2 the default Python and then use the hash-bang > to explicitly call python 2.x (#!/usr/bin/python2) in my scripts. > Is this right ? yes, this will work. You can install the python2 rpm alongside with python1.5. Look into /usr/bin/python*, you'll see both side by side. The trick is, python1.5 is the default, and *don't change that* (you'll break everything if you do). But as long as you don't mind changing by hand references to python2 in everything else you write or use, you'll be fine. This is clumsy, and is why yesterday I wrote a detailed post on the issue hoping to hear from the redhats for a reasonable explanation. As far as I can tell, their python distribution is simply broken. The problems can be worked around, but it's an annoyance. > On this note, I tried installing expat-1.1-4tummy.src.rpm and > python2-2.1.1-3.src.rpm (following the instructions to 'rebuild' > it, as per http://www.python.org/2.1.1/rpms.html) > but where does the rebuilt python get installed ? > > Afterwards, it claims the RPM is not installed > $ rpm -q python*rpm > package python2-2.1.1-3.src.rpm is not installed query for the package name only, not the full filename. The rpm querying is tricky to use, fire up kpackage and just look at the list, much easier. > Thanks for any help, > > Stephen cheers, f From kdahlhaus at yahoo.com Tue Dec 11 12:43:20 2001 From: kdahlhaus at yahoo.com (Kevin Dahlhausen) Date: 11 Dec 2001 09:43:20 -0800 Subject: Python Vim Module - works References: Message-ID: <283adf56.0112110943.24784aad@posting.google.com> > > http://www.nh.ultranet.com/~bsturk/vim.html It looks sounds great. I'm having some trouble running it under NT 4.0, SP 6, Gvim 6.0u though. It gives this error when :pyf vimsh.py line 181, in read r,w,e = select.select([self.outd], [], [], self.delay ) select.error: (2, 'No such file or directory') Any ideas? From matt at lorfeld.com Mon Dec 24 17:06:03 2001 From: matt at lorfeld.com (mlorfeld) Date: 24 Dec 2001 14:06:03 -0800 Subject: Web Collaboration References: <32c382ad.0112240012.462d9daa@posting.google.com> <7xu1uh2ea5.fsf@ruckus.brouhaha.com> Message-ID: <32c382ad.0112241406.4809a64a@posting.google.com> Paul Rubin wrote in message news:<7xu1uh2ea5.fsf at ruckus.brouhaha.com>... > You may get more flexibility having a little client side application > that navigates the users' browser on command. Under Windows you'd > probably use the MSIE Automation interface (IWebBrowser2 COM object) > for that. With Linux browsers there's probably something comparable. > The client side navigating app could itself be a little http listener, > using the python library class for that. I don't think I included this in the original thread, but the goal of the web cobrowsing was to allow cross platform/browser collaboration. To me that points to a server side application. Eventually this should run on Windows, Mac, Linux, Solaris, Xnix... as well as Mozilla, Konquer (ack), MSIE (ack ack), etc. Whether cgi, asp, or something else is the right medium I'm not sure. Another goal is to develop this openly. I'm interested in the http listener, could you expand upon that? At most we want a plug-in to the browser, instead of having a seperate application package as the combination of all collaboration tools would then call for more application packages or one bloated AP. -matt From Eugene.Leitl at lrz.uni-muenchen.de Sun Dec 16 06:30:14 2001 From: Eugene.Leitl at lrz.uni-muenchen.de (Eugene Leitl) Date: Sun, 16 Dec 2001 12:30:14 +0100 (MET) Subject: Python Hosting Questions In-Reply-To: <20011216060856.A10587@newcreature.org> Message-ID: On Sun, 16 Dec 2001, Ben Logan wrote: > I'm not sure what all you are looking for, but we are pretty happy > with http://www.hostforweb.com. They don't advertise Python, but > they've got it. They run Redhat, too, which is nice since that's what > I run. Right now I'm very happy with $9.99/month http://phpwebhosting.com , which a poster in this group recommended me. They don't advertize running Python, but they have 1.5.2 installed. Because they have shell account (ssh), and allow you to use gcc they have no problem with you installing a local Python (you can ask for more than 150 MBytes space at no extra cost, so the space is not a problem). > HostForWeb's packages start at $5/month, too. Unfortunately, the > Python version is 1.5.2. I think there are only the standard modules > installed, but you have compiler access (I was able to compile the > gdmodule...too bad gdlib wasn't compiled with TTF support, though). > They might consider installing Python2.x...I don't know. -- Eugen* Leitl leitl ______________________________________________________________ ICBMTO: N48 04'14.8'' E11 36'41.2'' http://www.leitl.org 57F9CFD3: ED90 0433 EB74 E4A9 537F CFF5 86E7 629B 57F9 CFD3 From info at mjais.de Sun Dec 2 05:06:54 2001 From: info at mjais.de (Markus Jais) Date: Sun, 02 Dec 2001 11:06:54 +0100 Subject: cgi question! problem with correct python version Message-ID: <9ucugc$7lqqu$1@ID-75083.news.dfncis.de> hello I am using RedHat 7.1 and I have installed the old python 1.5.2 which seems to be needed by RedHat 7.1 and also the Python 2.1 now I have a strange problem. 1st script: ---- #!/usr/bin/env python import sys print sys.version ---- output: 2.1 (#1, Jun 4 2001, 12:55:45) [GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-81)] when I have a CGI script like this: ---- #!/usr/bin/env python import sys print "Content-type: text/html\n\n" print "" print sys.version, "
" print "" ---- output: 1.5.2 (#1, Mar 3 2001, 01:35:43) [GCC 2.96 20000731 (Red Hat Linux 7.1 2 when I change the first line to #!/usr/local/bin/python then I get verison 2.1 can anybody tell me, why the apache is using the old version?? is there something wrong with the environment of apache??? markus From kragen at pobox.com Thu Dec 6 12:59:40 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 06 Dec 2001 12:59:40 -0500 Subject: ANN: Simple Newsgroup Searchterm Monitor (attached) References: <3c13ba77.19343935@127.0.0.1> <3C0DBB04.5070102@home.com> <3c21bc9f.19896499@127.0.0.1> <3c0fec5e.9446833@127.0.0.1> Message-ID: <83r8q8mdpv.fsf@panacea.canonical.org> root at 127.0.0.1 ((Five Fresh) Fish) writes: > On 05 Dec 2001 19:28:42 -0500, David Bolen wrote: > >If the scripts are really that small just keep them in text form where > >they're readable without needing decoding. > > You're perfectly, technically correct. So what? It's okay for someone to > post 2000 lines of Python code, but unacceptable to post 10 lines of > UUEncoded binary? That's just bloody stupid. I don't understand why your dander is so up. It's not as if David was being rude in his post. My view: seeing the text on my screen as part of the post is more convenient than running my newsreader's uudecode command (which I don't actually know yet, because I just switched newsreaders), creating a directory to extract the file into, unzipping the file into that directory, opening the files in that directory, and then deleting the directory with rm -rf. It also makes it easier to reply. A really, really smart newsreader would display a directory of the zipfile contents inline and let me click on individual items to expand their contents inline. Do you know of a newsreader that's this smart? From r.b.rigilink at chello.nl Sun Dec 30 20:07:02 2001 From: r.b.rigilink at chello.nl (Roeland Rengelink) Date: Mon, 31 Dec 2001 01:07:02 GMT Subject: Python Popularity, python at sourceforge References: Message-ID: <3C2FBA84.490E5D7E@chello.nl> Bill Tate wrote: > > Roeland Rengelink wrote in message news:... > > Hi, > > [snip] > > > > Alas, the numbers are far more ambigious than I'd hoped. To summarize: > > > > 1. Python is the smallest of the 6 languages discussed here. > > 2. Python is currently growing slower than PHP and Java, but faster > > than C and Perl. > > - Python has only been gaining on Perl for the last 6 months > > - the difference in growth w.r.t PHP and Java may be getting smaller > > 3. Java is more cross-platform than Python. Perl, C, C++ are less. > > 4. There is no clear evidence for Python's ease of development. > > > > You raise some interesting numbers, but I'm not sure I share some of > your conclusions. The basis for your conclusions appear to be derived > in large part from projects on sourceforge. While I don't disagree > that the numbers could suggest something consistent with your > conclusions, there's a couple of things worth noting. > Well, _only_ from sourceforge projects actually ;) What I tried to do was to take a theory (Python is growing rapidly, is cross-platform, is easy-to-use) and test the prediction that these properties would be reflected in sourceforge statistics. So I tried to look for evidence in the sourceforge statistics for Python's rising popularity, cross-platform usability and ease of usage. What I found was some evidence for the rising popularity and cross-platform usability. As far as ease-of-use is concerned, I see that I was a little careless in my wording. My reasoning went as follows: Given that Python's obvious qualities as a RAD language, do we see those qualities reflected in sourceforge statistics. I could think of two possible predictions. 1) Python's qualities lead to a higher percentage of finished projects. Or 2) Python's qualities lead to more rapid (active) development. I don't think I found clear evidence to support either of these two predictions. However, these predictions were very naive. Hence, my failure to confirm them does not imply that Python is not easy to use. (But wouldn't it have been fun, if I'd found that Python projects are more likely to reach a mature status) > First, maturity of the language. Are the number of projects on > sourceforge more indicative of the maturity (or lack thereof) of a > language as opposed to inferring popularity or growth of the language. > C is still hugely popular on Unix and Linux, but I wouldn't > necessarily infer that the number of projects on sourceforge for C as > being indicative of either its usage or popularity. For python, there > is a huge, pre-existing standard library, much of which perhaps > doesn't require a dedicated sourceforge project. > That's why I tried to focus in the relative rate of growth of the languages. It is a fact that the number of PHP projects at sourceforge is growing more rapidly than the number of Python projects. One could of course argue that Python is more mature and therefore doesn't need as many projects as PHP. But I think it is more likely that, currently, the number of PHP users/developers is growing more rapidly than the number of Python users. > Second, python developers routinely make use of extensions to existing > C and C++ libraries. Many of these extensions do not require a > specific project on sourceforge. They are distributed through various > means and not necessarily through sourceforge. > If one assumes that a fixed percentage of development in a given language takes place on sourceforge (not necessarily the same percentages for each language), then sourceforge statistics provide a measure of the rate of growth of language usage. If one furthermore assumes that these percentages are roughly the same for all languages then sourceforge satistics also provide a measure of relative popularity of these languages. If you mean to say that these percentages are probably not the same I would agree with you. > Third, project numbers do not necessarily equate to developer usage or > preference of a particular language. Perhaps in concert with other > measures (newsgroup/discussion group activity), something can be > inferred about these numbers. > Well, I'm assuming that, in their free time, developers will choose what, to them, is the most appropriate tool for their project. Most appropriate may of course mean 'most fun' or 'best' or 'known' or whatever. However, I would think that if developer preference was reflected in anything, then it would it would be in the choice they make on how to spend their free time. > Fourth - does the number of actual projects convey the degree of > cross-platform support that already exists? > These are project that claim to be cross-platform, which doesn't mean that they are projects to support cross-platformness. So the percentage of projects that claim to be cross-platform may in fact be indicative of the cross-platform support that does exist. I find that that percentage is higher for Java projects than for Python, and higher for Python than for Perl. This confirms the generally held believe that Java is more cross-platform than Python, which in turn is more cross-platform than Perl. > Lastly, your numbers I believe omitted RUBY. Ruby appears to be > gaining in popularity and the number of projects is increasing. Would > your conclusions be the same (in terms of rate of growth rather than > totals) had they incorporated into your numbers? > There are currently only 81 Ruby projects at sourceforge. I think that that's too small a number to make reasonable comparisons to other languages. > WRT Exploding popularity - Regardless of what may or may not be > happening, I'll take moderate and un-hyped growth anyday. > I agree very much. What I found interesting about the thread though, was that it was taken for granted that Python is growing rapidly in popularity, raising the question of why Python is not used more in commercial enterprise. Some suggested that this might be the result of some conservatism in business that is the result of interference from clueless managers. My suggestion would be that Python is not growing nearly as rapidly as some might think and/or that commercial enterprises may not necessarily be more conservative than open source developers. > Ease of Usage - Personally, I don't think we need numbers from > Sourceforge to reach a conclusion here. I don't think there is an > question on Python's ease of use. Its almost pro forma language that > appears at the beginning of any sentence that starts with "What's > Python?" I agree, see the beginning of this post. Thanks for your comments, Roeland -- r.b.rigilink at chello.nl "Half of what I say is nonsense. Unfortunately I don't know which half" From kwsiew at tm.net.my Tue Dec 25 18:59:12 2001 From: kwsiew at tm.net.my (kwsiew at tm.net.my) Date: Tue, 25 Dec 2001 23:59:12 GMT Subject: set decimal place Message-ID: <3c291037.4684696@news.tm.net.my> is there a way(or any function) to set decimal place in python(to any decimal place I want) example : 1)17.0/4 = 4.25 (but I want it to be 4.3) 2)10.0/3 = 3.3333333333333335 (I want 3.3333 - 4 decimal place) 3) 20.0/7 = 2.8571428571428572( I want 2.86 or 2.85714) thank you rgds, SKW From ahimsa at inext.co.za Fri Dec 28 14:52:22 2001 From: ahimsa at inext.co.za (Ahimsa Consulting) Date: Fri, 28 Dec 2001 21:52:22 +0200 Subject: IDEStation installation under Linux References: Message-ID: <002e01c18fd9$c1acff60$0100000a@aeon2k> Hi all A cross-reference post: I'm looking for some input into the process of installing IDEStudio under Linux RH7.2. Anyone familiar with the process please contact me privately. Many thanks Andrew From wpmelcher at snet.net Mon Dec 3 10:42:42 2001 From: wpmelcher at snet.net (Bill Melcher) Date: Mon, 03 Dec 2001 15:42:42 GMT Subject: Win98 PySol/Python Problems II Message-ID: Hi Guys, Thank you all for your interest and help in my thread "Win98 PySol problem" thread. (See below for my current complaints.) (-: Matthew Dixon Cowles: Especially for the mod to tkutl.py - That got rid of my first problem, the 'dither' problem Kragen Sitaker: For considerable help and good ideas when I was struggling with 'mechanics' Neil Hodgson: For turning me on to SciTE - great product that bypasses all the DOS crap AND also captures both stdout and stderr in a file (?) that can be scrolled! Also thanks to David Brady who said in the "WINDOWS USERS????" thread: "If you want a script to run by double-clicking it in Explorer, and you *don't* want a dos window to open, save the file as .pyw instead of .py. .pyw is for "Python Windows" scripts; they don't open a console window." This is exactly the kind of little bit of information that 'everybody knows' and is so hard to find. Another bit of good advice (from me ) is to buy a book or two! I've been reading O'Reilly's "Programming Python", Second Edition (got to be careful about the Python version covered). My problems with PySol and Python have not yet ended. PySol - The 'bundle' Marcus alludes to involves (apparently) running 'python pysol.py' with the --bundle option. This does not work. I get an error when I reach the statement bundle = bundle + 1 The complaint is that bundle has been referenced before it was defined or some such. I'll keep working on this but if any one has a bright idea, please let me know. I do know that there is no pysol.pyc created when I run pysol.py and that the pysol.pyc's that Marcus created for distribution range in size from 1,012KB (PySol 4.20) to 1,150KB (PySol 4.72 - for Python 2.1). The latter is from the distribution that does not work because of the -dither problem. Python - So I get the book and try a little simple stuff. Whoops! PythonWin 2.1.1 (#20, Jul 26 2001, 11:38:51) [MSC 32 bit (Intel)] on win32. Portions Copyright 1994-2001 Mark Hammond (MarkH at ActiveState.com) - see 'Help/About PythonWin' for further copyright information. >>> import os >>> os.environ.keys() ['TMP', 'INCLUDE', 'PATH', 'BKOFFICE', 'INETSDK', 'TEMP', 'WINBOOTDIR', 'BASEMAKE', 'MSSDK', 'BLASTER', 'LIB', 'COMSPEC', 'PROMPT', 'CMDLINE', 'MSTOOLS', 'WINDIR', 'DXSDKROOT'] >>> os.environ.keys('PATH') Traceback (most recent call last): File "", line 1, in ? TypeError: keys() takes exactly 1 argument (2 given) >>> os.environ.keys['PATH'] Traceback (most recent call last): File "", line 1, in ? TypeError: unsubscriptable object >>> The reason I tried the brackets is because the two books I have show braces rather than parenthesis. Neither form works. I have tried other Python shells and they all have the same problem. In this case a bit of help would be great - I really have no idea how to deal with this. -- Cheers, Bill TANSTAAFL! From fperez528 at yahoo.com Sat Dec 1 18:54:57 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Sun, 02 Dec 2001 23:22:57 +2328 Subject: Draft PEP: string interpolation with backquotes References: <9uern5$hbk$2@peabody.colorado.edu> <3C0B0FE5.2B173246@cosc.canterbury.ac.nz> Message-ID: <9uf5qi$p3q$1@peabody.colorado.edu> Greg Ewing wrote: > Also, what is the parser supposed to make of things like > > $"x is $x & y is $y" > > ? Is it supposed to be smart enough to realise that it > has to stop after "x" and not try to interpret the rest > as an '&' operator followed by a variable followed by > an 'is' operator followed by a syntax error? > > I think that "as far as it can be evaluated" is too > fuzzy a specification. Even if the parser can be taught > to understand exactly what it means, I'm not sure that > humans can... I should just have quoted the pep. You are right, "as far as it can be evaluated" is a bad way to say it. PEP 215: http://python.sourceforge.net/peps/pep-0215.html The details are there. As far as the above, it's actually simple: In [1]: from Itpl import itpl In [2]: x=4 In [3]: y=5 In [4]: itpl('$x+y') Out[4]= '4+y' In [5]: itpl('${x+y}') Out[5]= '9' The $ grabs out to operators only. The pep gives more details. Cheers, f From aleax at aleax.it Tue Dec 11 09:13:44 2001 From: aleax at aleax.it (Alex Martelli) Date: Tue, 11 Dec 2001 15:13:44 +0100 Subject: clearity of exposition References: Message-ID: <9v55e702l1j@enews4.newsguy.com> "John Thingstad" wrote in message news:mailman.1008014772.30614.python-list at python.org... ... > In mathemathics we are awarded simplicity and cleary of exposition. > I think the same should be true of programming. It *IS* true -- no "should" about it. Assuming that "awarded" can be read as "rewarded for", and "cleary" as "clarity". If you ever have to maintain your code, you will be rewarded for clarity and simplicity by having fewer lurking bugs, having an easier time finding and fixing those which are there, AND being able to modify your code more easily, smoothly and productively. If somebody else has to maintain your code, rewards will come in terms of that "somebody else" wishing good things about you in his or her mind rather than sending you terrible curses (as he or she might, and likely would, for "cleverness" and obscurity in your code). One may or may not believe that such curses and blessings have any practical, actual effect, of course, but, just in case, wouldn't you rather be blessed than cursed?-) > So now I mostly program in python. > My new logic lanuage is closing on completion. (formula.sourceforge.net) > It was a pleasure to write to read and is a pleasure to read. Sounds good! I hope you soon release something so we kibitzers get to share the pleasure:-). Alex From jeff at ccvcorp.com Thu Dec 27 15:28:14 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Thu, 27 Dec 2001 12:28:14 -0800 Subject: Replacing ActivePython? References: Message-ID: <3C2B845D.3A421FB6@ccvcorp.com> David Brady wrote: > I know I'll need to grab win32all and install it... > what else should I do? For example, how do I make WSH > execute .pys files? They don't appear to be > recognized under the python.org sources. I'm assuming > that it's some sort of registry tweak that's handled > in the ActiveState installer. The win32all package includes scripts that will register Python for use by ActiveScripting (and thus, WSH). I don't recall exactly where, but I think underneath win32comext somewhere--it's discussed in the docs at some point. There may be other registration scripts that need to be run, as well, but I believe that installing win32all on top of PythonLabs Python yields almost exactly the same thing as ActivePython. Mind you, you'll still have to wait for Mark Hammond to build win32all for 2.2 .... though it sounds like he'll have lots of time to work on that now. :( (Wishing good karma to Mark...) Jeff Shannon Technician/Programmer Credit International From wurmy at earthlink.net Sun Dec 30 00:30:12 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Sun, 30 Dec 2001 05:30:12 GMT Subject: REPOST: Re: Paramaterized local variable name References: <9c3f2e9c.0112292115.6a4e22af@posting.google.com> Message-ID: <9$--$$_----__$%--$@news.noc.cabal.int> Tim Cera wrote: > > Hello, > > I have the following code: > > def paging(data, key, query_dict): > for i in range(0, len(data[key]), use_pagesize): > start = data[key][i].name > ...etc. > > which works fine for data[key][i].name, but sometimes I want this > function to process data[key][i].rev. > > So, if local_name is equal to 'name' or 'rev' or 'whatever', what I > want is something like: > > def paging(data, key, query_dict, local_name): > for i in range(0, len(data[key]), use_pagesize): > start = data[key][i]. > # What goes here ^^^^ ? You probably want start = getattr(data[key][i], local_name) Now you can set local_name to a string "name" or "rev" or whatever attribute of data[key][i] you want to access. --Hans ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Hans Nowak Newsgroups: comp.lang.python Subject: cmsg cancel <3C2EA509.63ACDDC9 at earthlink.net> Control: cancel <3C2EA509.63ACDDC9 at earthlink.net> Date: Mon, 31 Dec 2001 02:20:33 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774382 27193 211.57.49.2 (31 Dec 2001 04:53:02 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:53:02 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From skip at pobox.com Tue Dec 11 10:38:07 2001 From: skip at pobox.com (Skip Montanaro) Date: Tue, 11 Dec 2001 09:38:07 -0600 Subject: lost interest? In-Reply-To: <3C14FEBD.AD52B516@attbi.com> References: <20011208001123.A5989@casa.parque> <3C14FEBD.AD52B516@attbi.com> Message-ID: <15382.10335.190985.78201@12-248-41-177.client.attbi.com> Chris> Justin Sheehy wrote: >> I'd ask a different question from yours. Why is it a problem that >> Python doesn't have an equivalent to CPAN? ... it has to pose enough >> of a problem in its absence that those people will have real >> motivation to make it happen. Chris> A big problem I have seen is people not wanting to use exactly Chris> the module they really nedd because it is "not part of the Chris> standard distirubion". If it was a whole lot easier to find, get Chris> and install third-party packages, perhaps this concern would go Chris> away. I do a little Perl programming under the guise of using Mason. I find CPAN indispensible for a few reasons: * It appears that more of what the Python distribution calls "core" modules are distributed separate from Perl proper. * I don't know my way around the Perl world very well. * Perl's third-party modules tend to rely heavily on other third-party modules for their proper functioning, so CPAN's ability to register and handle inter-module dependencies is important. If I take a peek into the python2.1/site-packages directory of manatee.mojam.com, a machine that I have been working on heavily the past week or so, I see these third-party modules: csv mx TextFile MySQLdb timeoutsocket PIL The only interdependency there is between MySQLdb and mx.DateTime, and that's a "soft" dependency. MySQLdb will adapt and work without mx.DateTime present. I don't know precisely how many third-party Perl packages I've installed to work with Mason (I only use a half dozen or so directly), but /root/.cpan on manatee currently contains the source for 32 packages and it's near the 25MB disk space limit I placed on it, so I'm sure other packages have been purged. CPAN is marvelous. The way the Perl and Python communities operate, it fills a niche perfectly in the Perl world, but I think would be a bit of a solution looking for a problem in the Python world. The one feature that would be useful in the Python world is the 'i'nfo command. That seems to me to be handled pretty well by the Vaults of Parnassus. -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) P.S. Chris, I see you're another recent "convert" from Excite at Home to AT&T Broadband... ;-) From aahz at panix.com Thu Dec 27 13:53:53 2001 From: aahz at panix.com (Aahz Maruch) Date: 27 Dec 2001 10:53:53 -0800 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <4$--$$_----_%___%$@news.noc.cabal.int> In article , phil hunt wrote: > >Python runs quickly on my 300 MHz box, which is 3 times slower >than the slowest PC you can buy today. It can only get more popular. MHz != speed -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 4 days and counting ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: aahz at panix.com (Aahz Maruch) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:08:42 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775662 27193 211.57.49.2 (31 Dec 2001 05:14:22 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:14:22 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jadestar at idiom.com Sat Dec 29 10:52:06 2001 From: jadestar at idiom.com (James T. Dennis) Date: 29 Dec 2001 15:52:06 GMT Subject: REPOST: Re: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> <7xlmfxvbx7.fsf@ruckus.brouhaha.com> <3dbsgt7f0e.fsf@ute.mems-exchange.org> <7xheqkr05q.fsf@ruckus.brouhaha.com> Message-ID: <1$--$$_----___%$%$@news.noc.cabal.int> Paul Rubin wrote: > "Fredrik Lundh" writes: >>> Not bugs per se unless perfect backward compatibility was >>> an overriding concern. >> it isn't. > It's a bug if something is gratuitously, unnecessarily incompatible, > like "rand" disappearing. What was the reason for that? While that topic has come up: I find whrandom to be an unsightly name for accessing a set of functions which is so commonly accessed by novice students. What was wrong with must calling it rand or random? Is it pure pedantry? ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!zeus.visi.com!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "James T. Dennis" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:17:28 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774723 27193 211.57.49.2 (31 Dec 2001 04:58:43 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:58:43 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From skip at pobox.com Mon Dec 24 18:04:57 2001 From: skip at pobox.com (Skip Montanaro) Date: Mon, 24 Dec 2001 17:04:57 -0600 Subject: vi or emacs for editing Python on Linux? In-Reply-To: References: <1009127729.9271.0.nnrp-12.c2de51d8@news.demon.co.uk> Message-ID: <15399.46233.688279.919771@12-248-41-177.client.attbi.com> Steve> ... I *do* work on unix systems scattered across the nation and Steve> my personal workspace is not on every single one. You know what Steve> is, though? ssh. That means scp is there so when I need to get Steve> something to/from that machine I can always scp to another Steve> machine, edit, scp back. Even better, install tramp on (just) your local machine. It works like ange-ftp/efs, but with ssh protocols. Got an asymmetric link (like a cable modem)? It understands rsync as well, so only your deltas go back across the link in the slow direction. http://tramp.sourceforge.net/ Cheers, -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From bokr at accessone.com Thu Dec 6 02:34:26 2001 From: bokr at accessone.com (Bengt Richter) Date: Thu, 06 Dec 2001 07:34:26 GMT Subject: Is Python suitable for some binary file editing? References: <1FD639F0.1DA46084@cns.net.au> Message-ID: <3c0f1c66.1119038642@wa.news.verio.net> On 05 Dec 2001 19:54:34 -0500, David Bolen wrote: >Tim Hammerquist writes: > >> I'd have preferred: >> >> Replace 2 bytes in place beginning at offset 100 (101st byte): >> >> f = open('text_input', 'r+b') >> f.seek(100) >> f.write(chr(123) + chr(0x80)) >> f.seek(0,2) >> f.close() > >That would work too, but not for the original request, which was to >have a separate copy: > >David Rollo wrote: >> The file conversion is simply making the same change to a handful of >> characters at a particular offset, and saving under a new filename. > >so I don't think he wanted to modify the original files. > Even if he did, he might want to be sure he had a valid new file before eliminating the original. From rdsteph at earthlink.net Sat Dec 29 20:01:35 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sun, 30 Dec 2001 01:01:35 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <458b194a.0112282052.1123341@posting.google.com> Message-ID: <3C2E688C.13DE2394@earthlink.net> Good points, if Python had "food enough" database, gui, and web components on top of Python, it coudl be a ture "killer language" for these times.... By the way, I am re-checking out PythonCard today, and i am impressed again, especially tha tthe documentation has progressed quite a bit. Good stuff....check out the documentation at http://pythoncard.sourceforge.net/toc.html ... robin at brainexeculink.com wrote: > rcena at epcor.ca (Resty Cena) wrote: > > >Whichever can provide what it is that VB > >developers like about VB on top of what Python and Ruby natively offer > >will hit the jackpot. To me these are: (a) Visual drag-and-drop > >application builder with data aware controls, and (b) good support for > >the big databases (Oracle, Sybase, Informix). > > Yes. > > Snap-in database support -- not only for the big databases but for > lightweight solutions as well -- makes VB popular. And it's a big > reason people use PHP (to wander into another branch of this thread). > > Python needs standard database modules with a high degree of interface > conformance -- more than what the current DB API provides. And these > need to *work*. I can't tell you how much time our company wasted > looking for the best PostgreSQL interface, for example. > > Since I'm talking databases, I wish someone with more time and brains > than I would pick up the Gadfly project and bring it up to date. We > need a pure Python SQL database. That too would help "sell" the > language. > > As far as GUIs go, either Boa Constructor or something like the anygui > project has the potential to be the Python "killer app". > > A third application domain that needs to grow in maturity and > standardisation is server-side web pages. Not everyone wants to write > their own framework (though I have). There should be an out-of-the-box > module that easily integrates Python with Apache and takes care of > most of the dirty work. > > Standardisation is more important than sophistication. > > I would love for all the brilliant Python contributors to stop right > here at version 2.2 and put all their talents into these three areas. > The core language is just fine, thank you. The existing modules are > mostly very good. What is needed are database, gui, and web components > to turn this language into a full development package. > > The payoff would be immense. > > >With VB.NET, VB > >programmers will ask, "What's the point?" Might as well dive into C#. > > I did precisely one project in VB way back in version 2-3 days. It > didn't take me very long to say "What's the point?" Then I went out > and bought some C++ books. [shudder] > > VB is popular even though it doesn't work. PHP is popular even though > it works in a small domain. But both products work "well enough". > That's the key. > > Python does not yet work "well enough" in the most common problem > domains. It requires too much wheel re-invention. > > ----- > robin > robin at brainexeculink.com > (remove "brain" to reply) From skip at pobox.com Sun Dec 16 13:53:01 2001 From: skip at pobox.com (Skip Montanaro) Date: Sun, 16 Dec 2001 12:53:01 -0600 Subject: Idiomatic portable way to strip line endings? In-Reply-To: References: Message-ID: <15388.60813.970030.100364@12-248-41-177.client.attbi.com> John> Huh? This works fine on Windows. The C library (which is what John> Python is based on, after all) is defined to convert the operating John> system dependent line end sequence to '\n' on input, and back on John> output. Even if you get the file from an operating system that uses another line ending convention? -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From rotterdamtom at hotmail.com Sat Dec 22 05:51:06 2001 From: rotterdamtom at hotmail.com (tom jansen) Date: Sat, 22 Dec 2001 10:51:06 +0000 Subject: informatie m.b.t de mailinglist Message-ID: Geachte meneer/ mevrouw Op het net heb ik de aanbieding gezien van Euro 49.00 voor 20 miljoen werkende adressen. Ik ben geinteresseerd. Kunt u meer informatie geven Vriendelijke groet, Tom Rotterdam _________________________________________________________________ MSN Foto's is de eenvoudigste manier om je foto's te delen en af te drukken: http://photos.msn.nl/Support/WorldWide.aspx From syver-en+usenet at online.no Sat Dec 29 10:12:47 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 29 Dec 2001 16:12:47 +0100 Subject: REPOST: Re: Finding out that Python is in interactive mode in sitecustomize.py References: <3C2B8F47.4CEACF6E@olen.to> Message-ID: <6$--$$_----__-%_%$@news.noc.cabal.int> Joonas Paalasmaa writes: > How can I find out that Python is started in interactive mode in > sitecustomize.py ? > The need for that information is, that I want that certain > customizations take place only at > interactive mode. If you just need special setup for interactive mode you could do as I do and define the environment variable PYTHONSTARTUP to some python file. The file refered to will be executed only when you're starting python interactively. -- Vennlig hilsen Syver Enstad ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Syver Enstad Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:55:09 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774739 27193 211.57.49.2 (31 Dec 2001 04:58:59 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:58:59 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From fredrik at pythonware.com Fri Dec 21 15:11:30 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 21 Dec 2001 20:11:30 GMT Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> <7xlmfxvbx7.fsf@ruckus.brouhaha.com> <3dbsgt7f0e.fsf@ute.mems-exchange.org> <7xheqkr05q.fsf@ruckus.brouhaha.com> Message-ID: Paul Rubin wrote > > it isn't. > > It's a bug if something is gratuitously, unnecessarily incompatible, > like "rand" disappearing. can you find "rand" in any recent python documentation? have you ever used the module for anything? have you ever seen any program using it? do you even know what it does? From paul1brian at yahoo.com Mon Dec 10 14:13:06 2001 From: paul1brian at yahoo.com (Paul Brian) Date: Mon, 10 Dec 2001 19:13:06 -0000 Subject: reference counting for garbage collection Message-ID: <1008011593.29363.0.nnrp-10.c1c3e1d9@news.demon.co.uk> Dear all, I am getting confused over object references/pointers etc.... If I create a function : def foo(server): ''' creates a connection to server and returns it''' conn = mycleverconnection(server) return conn and then I do x = foo('10.x.x.x.') will the function foo still keep some reference to conn such that del(x) will *not* destroy conn but conn will still stay alive? if not 1) is there some tool that shows me what exactly is alive in the python environment 2) is there some notes on references, keep alives and other mysterious things in the docs 3) what have I done wrong in the stuff I just wrote (no not the above:-)? (Ok so 3 is my problem :-) From jkraska at san.rr.com Sun Dec 30 13:34:54 2001 From: jkraska at san.rr.com (Courageous) Date: Sun, 30 Dec 2001 18:34:54 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <4VlX7.6657$l93.1694996@newsb.telia.net> <6o6s2u4pa4kvqben6ftatrfttu9s78ee1k@4ax.com> Message-ID: >C is: Easy to learn >Python is: Hard to learn (well relativly to C) If you didn't just say that backwards, you are a mutant. :) >Generates piss pore performance code (I am sorry to say) Python is almost always faster than the equivalent C, for somewhat arcane definitions of the "equivalent C". For example, if you set up every object in your C class hierarchy to contain attributes which were in a hash table, and then always accessed them that way, what you would come up with would almost certainly be slower than Python. C// From Duxbuz at bbtinternet.com Mon Dec 10 17:37:58 2001 From: Duxbuz at bbtinternet.com (Ian) Date: Mon, 10 Dec 2001 22:37:58 -0000 Subject: python log() Message-ID: <9v3dfg$jj3$1@neptunium.btinternet.com> Hello I am new to python and am trying to use it to work out a sum log(20/7) / log(2) which gives result 1.0 I am expecting to get 1.51 as a result, and using different langs such as perl or php, I get the desired result of 1.51 It seems to me that python only goes to a certain decimal place, not as much as the other compilers, can this be altered in anyway? Ta. From ykingma at accessforall.nl Wed Dec 12 13:22:01 2001 From: ykingma at accessforall.nl (Ype Kingma) Date: Wed, 12 Dec 2001 19:22:01 +0100 Subject: __subclasses__() (was OK, now *this* is cool) References: <3C112086.5F7072A9@accessforall.nl> <3C13404D.F7A60179@accessforall.nl> <3C13CB48.D1357B4C@accessforall.nl> <9v0pon$lf8$1@slb7.atl.mindspring.net> Message-ID: <3C17A045.32922B85@accessforall.nl> Andrew Dalke wrote: > > Ype Kingma: > > Jython leaves all it's garbage collection to the Java VM. > > This simplifies the Jython source code (a lot, no reference > > counting anywhere). On the downside it is more difficult > > to have a method executed when an object becomes garbage. > > "more difficut" means it's still possible. How? > > I have a Python wrapper on top of a C library. I use > __del__ to call the special deallocator for the library > when the object is no longer needed. > > The library also has bindings for use with Java. I tried > using JPython (it was a while ago) but got memory leaks > all over the place because it doesn't call __del__ methods; > prefering the Java garbage collector. > > How do I make Jython work with that wrapper? try/finally > doesn't work for my needs. > I had another look at the jython sources. Since just over a year it will call your __del__() method when it is present at object instantiation time, ie. when you have a 'def __del__(self):' in your class. It's implemented by calling from an overriden 'java.lang.Object.finalize()'. This means that __del__() can be called after the object has been identified as garbage by the JVM. The call is not guaranteed at all, but it will eventually be called under memory pressure when the JVM does not exit beforehand and there is some CPU time to spare. It leaves you at the mercy of the garbage collector of the JVM, but this is probably the best thing that can be done in jython. It is also very python-esque in that it uses what happens to be available in the environment. This means there is no need for the (untested) code of my previous post. Have fun, Ype From rdsteph at earthlink.net Sat Dec 29 10:36:20 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sat, 29 Dec 2001 15:36:20 GMT Subject: REPOST: Re: Python Popularity, python at sourceforge References: Message-ID: <5$--$$_----__$%$_$@news.noc.cabal.int> Wow. Thanks, very interesting "gossip" which i enjoy ;-)))) Roeland Rengelink wrote: > Hi, > > As was remarked earlier in this thread, a measure of Python's > popularity, if not quality, can be obtained by looking at the number > of sourceforge projects using Python. Below you'll find a number of > tables comparing sourceforge projects using Python to those using > Perl, PHP, Java, C and C++. These numbers were obtained by > screen-scraping the sourceforge trove pages. > > I started this analysis expecting to find clear evidence for Python's > - exploding popularity > - cross-platform usability > - ease of development > > Alas, the numbers are far more ambigious than I'd hoped. To summarize: > > 1. Python is the smallest of the 6 languages discussed here. > 2. Python is currently growing slower than PHP and Java, but faster > than C and Perl. > - Python has only been gaining on Perl for the last 6 months > - the difference in growth w.r.t PHP and Java may be getting smaller > 3. Java is more cross-platform than Python. Perl, C, C++ are less. > 4. There is no clear evidence for Python's ease of development. > > The most interesting result (I think) is Python's changing role from a > glue/scripting language to a stand-alone development language. > Cross-language development statistics are investigated at the end of > this post. > > 1. All projects > > The following two tables list the cumulative number and quarterly > growth rates of sourceforge projects using Python, Perl, PHP, Java or > C++ as one of their programming languages. Note that projects using > more than one of these languages contribute to the numbers of each of > those languages. > > The following conclusions can be drawn > - Python is only half as big as any of the other languages. > - The growth rate of Perl, as compared to Python, has been steadily > declining since ther third quarter of 2000. It has become smaller > than Python's growth rate in the third quarter of 2001. > - The growth rates of PHP and Java have been much larger than > Python's. However, up to the third quarter of 2001 their growth rates > declined relative to Python. > - Since the third quarter of 2000, C has been the slowest growing > language. > - The growth rate of Python is most similar to that of C++ > > To summarize: > > Early 2000 Python was the slowest growing language. Currently only PHP > and Java are growing faster, and the gap is closing > > Table 1a. Cumulative number of projects > Python=1 > Python Perl PHP Java C C++ Perl PHP Java C C++ > 00-03-01 98 172 84 139 529 361 1.8 0.9 1.4 5.4 3.7 > 00-06-01 221 417 251 371 1220 882 1.9 1.1 1.7 5.5 4.0 > 00-09-01 374 785 555 756 2030 1518 2.1 1.5 2.0 5.4 4.1 > 00-12-01 528 1178 883 1257 2827 2220 2.2 1.7 2.4 5.4 4.2 > 01-03-01 701 1575 1328 1841 3706 2949 2.2 1.9 2.6 5.3 4.2 > 01-06-01 898 2020 1867 2539 4652 3806 2.2 2.1 2.8 5.2 4.2 > 01-09-01 1097 2406 2326 3164 5513 4589 2.2 2.1 2.9 5.0 4.2 > 01-12-01 1266 2690 2745 3774 6189 5285 2.1 2.2 3.0 4.9 4.2 > > Table 1b. Quarterly growth rates > Percentage growth Python=1 > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 125 142 198 166 130 144 1.1 1.6 1.3 1.0 1.1 > 00-09-01 69 88 121 103 66 72 1.3 1.7 1.5 1.0 1.0 > 00-12-01 41 50 59 66 39 46 1.2 1.4 1.6 1.0 1.1 > 01-03-01 32 33 50 46 31 32 1.0 1.5 1.4 0.9 1.0 > 01-06-01 28 28 40 37 25 29 1.0 1.4 1.3 0.9 1.0 > 01-09-01 22 19 24 24 18 20 0.9 1.1 1.1 0.8 0.9 > 01-12-01 15 11 18 19 12 15 0.8 1.2 1.3 0.8 1.0 > > 2. Cross platform projects > > Python advertises itself as a cross-platform development language. > Here, I assume that cross-platform means either OS-independent, or for > 2 or more of the the different OS families [Unix, Win, Mac] > > The conclusion here is pretty much expected: > - Python is more 'cross-platform' than Perl, C and C++, but less so > than Java, and comparable to PHP > > Table 2a Cumulative number of cross-platform projects > Python=1 > Python Perl PHP Java C C++ Perl PHP Java C C++ > 00-06-01 157 273 172 311 590 484 1.7 1.1 2.0 3.8 3.1 > 00-12-01 365 722 598 1047 1317 1159 2.0 1.6 2.9 3.6 3.2 > 01-06-01 626 1243 1298 2135 2122 1939 2.0 2.1 3.4 3.4 3.1 > 01-12-01 900 1658 1959 3198 2836 2701 1.8 2.2 3.6 3.2 3.0 > > Table 2b Cross-platform projects as fraction of all new projects > Python=1 > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 71 65 68 83 48 54 0.9 1.0 1.2 0.7 0.8 > 00-12-01 67 59 67 83 45 50 0.9 1.0 1.2 0.7 0.7 > 01-06-01 70 61 71 84 44 49 0.9 1.0 1.2 0.6 0.7 > 01-12-01 74 61 75 86 46 51 0.8 1.0 1.2 0.6 0.7 > > 3. Active projects > > Python also advertises itself for its ease of development. One could > expect that easy projects are more active than difficult projects. > > The following tables list statistics for projects that have an > activiy_ranking of more than 80 %. Since I don't know how this > activity is measured I can't really interpret these numbers. > > Activity ranking is a relative measure of a projects activity, which > is computed over all sourceforge projects. An activity ranking of 80% > means 80% as active as the most active sourceforge project. Activity > seemt to comprise both developer activity (checkins, bug fixes) and > user activity (downloads, bug reports). > > The most notable result from these tables is probably that the numbers > are so similiar. Hence, my tentative conclusion: > > - Project activity is largely independent from the choice of > programming language and therefore also independent of the > 'accessability' of the language > > Table 3a Cumulative number of active projects > Python=1 > Python Perl PHP Java C C++ Perl PHP Java C C++ > 00-06-01 24 36 21 33 156 94 1.5 0.9 1.4 6.5 3.9 > 00-12-01 43 59 49 74 268 174 1.4 1.1 1.7 6.2 4.0 > 01-06-01 59 95 81 127 368 263 1.6 1.4 2.2 6.2 4.5 > 01-12-01 74 120 128 182 441 347 1.6 1.7 2.5 6.0 4.7 > > Table 3b Percentage active as fraction of all projects > Python=1 > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 10 8 8 8 12 10 0.8 0.8 0.8 1.2 1.0 > 00-12-01 6 3 4 4 6 5 0.5 0.7 0.7 1.1 1.0 > 01-06-01 4 4 3 4 5 5 1.0 0.8 1.0 1.3 1.3 > 01-12-01 4 3 5 4 4 5 0.9 1.3 1.1 1.2 1.4 > > 4 Mature projects > > Ease of development may also be reflected in what percentage of > projects reaches a mature development status. The following tables > give numbers for projects that reached a mature or production/stable > development status. > > The data suggest that Perl and C project reach a mature development > status more often than Python, PHP, Java and C++ projects. > > Note that development status is assessed by the project developers > themselves > > Table 4a Cumulative number of mature projects > Python=1 > Python Perl PHP Java C C++ Perl PHP Java C C++ > 00-06-01 43 118 41 59 294 168 2.7 1.0 1.4 6.8 3.9 > 00-12-01 87 233 109 161 599 342 2.7 1.3 1.9 6.9 3.9 > 01-06-01 122 367 194 286 887 503 3.0 1.6 2.3 7.3 4.1 > 01-12-01 160 455 280 399 1110 644 2.8 1.8 2.5 6.9 4.0 > > Table 4b Percentage mature as fraction of all projects started. > Python=1 > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 19 28 16 15 24 19 1.5 0.8 0.8 1.2 1.0 > 00-12-01 14 15 10 11 18 13 1.1 0.8 0.8 1.3 0.9 > 01-06-01 9 15 8 9 15 10 1.7 0.9 1.0 1.7 1.1 > 01-12-01 10 13 9 9 14 9 1.3 0.9 0.9 1.4 0.9 > > 5. Cross language development > > The most interesting results are obtained when we compare projects > that use a single language with those that use multiple languages. The > follwing tables compare the fraction of projects that use more than > one language, to those that only use a single language. > > There are many trends here. > > - Python, Perl, PHP and Java projects are increasingly becoming > single-language projects. > - The percentage of cross-language projects in cross-platform projects > is lower for Python, Perl, PHP and Java, while its substantially > higher for C and C++ projects. > - Of the currently active Python projects nearly all old projects > included other languages, while only a third of the new projects > does so. > - Perl is the only language for which the fraction of multi-language > projects is larger for active projects. > - For the mature Python projects there is also a large difference in > the fraction of cross-language projects between old and new > projects. > - For all languages the percentage of mature projects that use more > than one language is smaller. > > One conclusion > > - Python is increasingly used a stand-alone development language, > especially in active and mature projects. > > Table 5a Percentage of all new projects > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 55 51 41 35 47 46 0.9 0.8 0.6 0.9 0.8 > 00-12-01 52 42 37 33 47 46 0.8 0.7 0.6 0.9 0.9 > 01-06-01 51 48 39 30 46 46 0.9 0.8 0.6 0.9 0.9 > 01-12-01 45 42 31 26 47 43 0.9 0.7 0.6 1.0 1.0 > > Table 5b Percentage of new cross platform projects > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 52 47 44 32 56 51 0.9 0.8 0.6 1.1 1.0 > 00-12-01 50 40 33 30 54 50 0.8 0.7 0.6 1.1 1.0 > 01-06-01 51 43 36 27 54 52 0.8 0.7 0.5 1.1 1.0 > 01-12-01 44 39 28 24 56 48 0.9 0.7 0.6 1.3 1.1 > > Table 5c Percentage of active projects > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 87 58 19 12 51 44 0.7 0.2 0.1 0.6 0.5 > 00-12-01 68 60 17 46 44 51 0.9 0.3 0.7 0.7 0.7 > 01-06-01 50 55 40 32 47 37 1.1 0.8 0.6 0.9 0.7 > 01-12-01 33 64 25 19 52 47 1.9 0.8 0.6 1.6 1.4 > > Table 5c Percentage of mature projects > Pyth Prl PHP Jav C C++ Perl PHP Java C C++ > 00-06-01 58 36 34 27 37 37 0.6 0.6 0.5 0.6 0.6 > 00-12-01 47 26 20 32 37 44 0.5 0.4 0.7 0.8 0.9 > 01-06-01 45 37 32 24 34 36 0.8 0.7 0.5 0.8 0.8 > 01-12-01 34 31 25 22 36 40 0.9 0.7 0.6 1.1 1.2 > > Undoubtedly there's more to be gained from these numbers. But this is > starting to look like work, so... > > Roeland > > -- > r.b.rigilink at chello.nl > > "Half of what I say is nonsense. Unfortunately I don't know which half" ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2DE34A.4C30FAD2 at earthlink.net> Control: cancel <3C2DE34A.4C30FAD2 at earthlink.net> Date: Mon, 31 Dec 2001 02:00:40 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774733 27193 211.57.49.2 (31 Dec 2001 04:58:53 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:58:53 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From gh_pythonlist at gmx.de Thu Dec 13 01:54:32 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Thu, 13 Dec 2001 07:54:32 +0100 Subject: Games Made w/ Python In-Reply-To: <9v9gss$5hr$1@nntp9.atl.mindspring.net> References: <9v9gss$5hr$1@nntp9.atl.mindspring.net> Message-ID: <20011213065432.GB897@lilith.hqd-internal> Le 13/12/01 ? 06:10, nobody at nowhere ?crivit: > Is Python an appropriate language for game programming? Yes! Check out http://www.pygame.org/ It rocks. Btw., your mail scored pretty high in my spam filter (SpamAssassin with Vipul's Razor). X-Spam-Status: No, hits=3 required=5 tests=NO_REAL_NAME,NO_MX_FOR_FROM Please consider using a realname on Usenet. It's just nicer than talking to nobody@'s, fish@'s and root@'s :-) Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From homsa at spray.se Sun Dec 2 16:14:34 2001 From: homsa at spray.se (Bear B) Date: Sun, 2 Dec 2001 22:14:34 +0100 Subject: Using COM and .pyc Message-ID: I have problems doing some changes in a .py - file that contains source to two com-classes under python-win. Do I have to register this com-classes after every time I have saved my changes, or is it just necessary to register it once? Is it not true, that my old .pyc - file should be replaced whith a new .pyc - file after my changes have been made? I have tried SO MANY ways to make things work, but all a get is exceptions and errors. Can someone please give me some advises how to make this work?! /Becke From starx at pacbell.net Tue Dec 4 07:24:16 2001 From: starx at pacbell.net (Philip Swartzleonard) Date: 4 Dec 2001 12:24:16 GMT Subject: Non-number Multidimensional Array: Best way? Message-ID: I'm using a multidimensional array to store the map data for this 'rougelike' project i'm working on, and i'm wondering if the best way to go about doing it is Numeric (Assuming i can find the docs for the 'pyobject' part...), or raw python lists, or something else. Right now, my 'Map' (bad name, maybe) class is a 'list of lists' mess that i don't completly understand, and the elements are static 'copies' of derivitives of the class 'tile' (that is, there are really only a few tiles that exist in another module, and each element is a reference to one of those... important b/c the tiles have complicated initilization (i.e. gl display lists), and are then unchanging). In the future, however, every class will have to be it's own instance of a 'cell' class or similar, to handle contaiment. Another problem is that i will need to deal with LOTS of these things, and they will get quite large (i'm at 25x25 now and it's not very big %D) Right now the main function is to draw a region of itself, by calling the draw function of all of it's constituants. This is a little complicated, as it must set the GL matrix to the appropriate translation before calling each element.draw() function. I THINK the complex slicing goodies in numeric will help with this, and keep my brain from frying on list looping :). I also have the origin set as the lower left corner (south west?), but this dosen't matter at this time, it's just what evolved :) Any ideas are appreciated. (Will be? :) Sorry for the incoherence factor :) -- Philip Sw "Starweaver" [rasx] :: From ssthapa at classes.cs.uchicago.edu Fri Dec 14 12:37:30 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Fri, 14 Dec 2001 17:37:30 GMT Subject: Python CPAN beta test References: Message-ID: Bryan wrote: >Congratulations, and thank you. The readline support is a nice touch. >Unfortunately I have not been able to successfully install a package with >ciphon-0.3. Whether by RPM or not, the fetch and build process runs as >expected but afterwards dies with the helpful message: > >Error installing package: Installing package >Giving up... The patch I sent you sent to you last night should have fixed your problem. I've placed a new version of ciphon on tummy long with your package. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From philh at comuno.freeserve.co.uk Thu Dec 27 12:48:13 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Thu, 27 Dec 2001 17:48:13 +0000 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <6$--$$_----_%_-$_$@news.noc.cabal.int> On Thu, 27 Dec 2001 03:58:52 GMT, Ron Stephens wrote: >OK, so its between the holidays and the newsgroup is quiet, so maybe I >dare waste a little bandwidth with that most useless (but fun) >commodity: gossip. > >How is Python doing popularity wise? After such a meteoric growth >thought the nineties, and a spectacular climax in 2000 and early 2001, >is Python leveling out, going dot.bust, or still not yet at the knee of >the software world's most spectacular growth curve? > >I'd be interested in some comments and observations and opinions from >others. Meanwhile, here are a few of my own: > >Python, while fabulously successful, is at an interesting point in its >growth curve. It will be difficult to maintain the extremely high rate >of growth exhibited so far; new contenders are possible problems; and >the recessionary economy could also negatively impact Python's growth. > >1. Ruby is an especially interesting competitor to Python. I have been >monitoring the Ruby newsgroup, and it shows incredible growth and >vitality. Furthermore, Ruby is aimed right at the heart of Python's >niche. >From what I've seen of it, Ruby is quite similar to Python; however, Python has more developers, more libraries, etc. I see no compelling reason for me to switch to Ruby. >If we view Microsoft's Visual Studio, especially Visual Studio.net's C# >and VB, as the official 800 lb. gorilla of software development; and if >we view Java as the 400 lb. gorilla pretender to the throne; and if we >view Borland's Delphi and Kylix as no more than a smart leader of a >chimp; then everything else is the pack of open source chimps. Just as Python can compile to the JVM, I'm sure it will compile to Microsoft's .net platform. >The open source world is still led by PERL, but PERL is truly more of a >text processing, web CGI, scripting specialist; not so much of a direct >threat to Python. Perl is OK for small programs. I dislike its syntax, however. > PHP is a server side scripting specialist. If Python solutions for serving web pages were more mature/available, this would cause a good deal of growth for Python. PHP as a programming language isn't anything special, but for making dynamic web pages it's a very good tool, as it is easy to use. > Even >JavaScript is strong in its narrow niche of client side web scripting. >Lisp and Scheme dominate thier academic world. But Python aims to be >much more than these; Python aims to be a powerful general purpose >programming language, in addition to being a very easy to learn and easy >to use scripting language. And who can say that Python does not succeed >very well in all of the above? > >But Ruby is also a more general purpose, object oriented, relatively >easy to read, language. Ruby folks include those who like its more >Perl-like syntax, but Ruby's core converts believe that its pure, >absolute object oriented nature exceeds those of Python and make it more >worthy to long term success. They seem to see Ruby as a more modern, >up-to-date version of Python. They see Python as a compromise between >object oriented and procedural programming. I don't want programming to be forcibly OO. In Ruby, can you write a procedure which isn't part of a class? (Like you can in Python, but can't in Java). If not, then Ruby is forcing you to hammer square pegs into round holes. >c. Ruby actually seems to be a nice language to me. Its object oriented >features seem well thought out and yet its still easy to comprehend. I >will never leave Python behind, but will others? What can I do in Ruby that I cannot just as easily do in python? Until that\ question is answered, Ruby will stay behind python in popularity. >Ten years from now, will Python still be Relevant? I think so. I expectb Python to keep growing. As computers get faster, programming in C++ makes less and less sense. People will move over to more high level langauges, such as Java, C#, Perl and Python. Java and C# are roughly on the same level, faster than Perl/Python but slower to code in. Python offers the fastest coding time, as it is "executable pseudocode", so I expect more and more stuff to be done in it. Python runs quickly on my 300 MHz box, which is 3 times slower than the slowest PC you can buy today. It can only get more popular. -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: philh at comuno.freeserve.co.uk (phil hunt) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:58:34 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775678 27193 211.57.49.2 (31 Dec 2001 05:14:38 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:14:38 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jkraska at san.rr.com Sat Dec 8 16:17:00 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 08 Dec 2001 21:17:00 GMT Subject: Calling a generator multiple times References: <0gn21usqeasqa1bp4sveh0vjagtmbmfpof@4ax.com> <3C11FE92.1218662@letterror.com> <3C127F1D.DD609D4D@xs4all.nl> Message-ID: <46051ugbk2aeaqeq4sb2aslurf4t22o70b@4ax.com> >How can you say that with such absolutely certainty? Have you read >the PEP now? Explain to me, very carefully now, why I should have to read a language designer's doc in order to consider for a moment how your average user will encounter a language construct? For the record, yes, I have read this PEP. It's the very first thing that I did before mucking around with generators and before posting even my first message regarding generators here. Pronouncements like the following: "so I have consulted my language designer's intuition. It tells me that the syntax proposed in the PEP is exactly right" aren't exactly persuasive, especially when you consider the paragraph that immediately preceeds this decree. C// From syver-en+usenet at online.no Sat Dec 29 17:57:16 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 29 Dec 2001 23:57:16 +0100 Subject: SSL Sockets in Windows References: Message-ID: Gerhard H?ring writes: > You seem to still have SSL compiled in. Be sure to replace your > _socket.pyd with the one without SSL. Using "python -v" helps tracking > > down which module really is loaded. Ah the -v switch, I forgot about that one. I'll look some more into it. -- Vennlig hilsen Syver Enstad From loewis at informatik.hu-berlin.de Wed Dec 19 05:23:51 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 19 Dec 2001 11:23:51 +0100 Subject: DOM - some pointers References: <9voi51$fco$1@slb7.atl.mindspring.net> Message-ID: "Andrew Dalke" writes: > So I too am looking for pointers. You may want to try getting a copy of "Python & XML", by Jones and Drake. I don't know whether it is already available; but it certainly offers lots of examples - small ones and large ones. Regards, Martin From jkraska at san.rr.com Sat Dec 29 16:19:17 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 29 Dec 2001 21:19:17 GMT Subject: REPOST: Re: Who needs exceptions References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> Message-ID: <0$--$$_----_%-__-$@news.noc.cabal.int> >It also makes more experienced programmers more productive, even if >they never use it (IMHO) as errors below the level of the program >being written never go unhandled *and* unreported, as in C. Indeed. Exceptions fit well with Python, in part because they allow the programmer to write more syntactically compact code than they would if they had to use an alternative. C// ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Courageous Newsgroups: comp.lang.python Subject: cmsg cancel <1hcs2uogfn6u2s83m33r5a62i1l2mtqt4l at 4ax.com> Control: cancel <1hcs2uogfn6u2s83m33r5a62i1l2mtqt4l at 4ax.com> Date: Mon, 31 Dec 2001 01:48:30 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774561 27193 211.57.49.2 (31 Dec 2001 04:56:01 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:56:01 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From maxm at mxm.dk Sat Dec 22 14:26:36 2001 From: maxm at mxm.dk (maxm) Date: Sat, 22 Dec 2001 20:26:36 +0100 Subject: Fate of win32all? References: <7876a8ea.0112212116.2ebabc23@posting.google.com> <3C242A7F.2060805@skippinet.com.au> Message-ID: From: "Mark Hammond" > Unfortunately, I am no longer employed by ActiveState :( Hi Mark That saddens me ... I really LOVE PythonWin. I don't think I would have ever learned Python if it hadn't been around. Just knowing that it was possible to use ado, com, dll's etc. from Python, made it a _much_ safer bet for me and my company. It sucks to get sacked, and doesn't do wonders for ones self-confience. It ain't much fun! Especially leading up to Christmas. The good side for you must be that you can once again work on what you find relevant and techically challenging, and not what some "suit" can think up. Sometimes when one works in a company it is too easy to get sucked up in company politics and bad management. Up to the point that one can forget ones love for technology, and how much fun it can be being a techie. Naturally I don't know if you have had it like that, but sometimes a change of venue can really get the joy back in ones work. warm regards Max M From robin at jessikat.fsnet.co.uk Sun Dec 16 08:25:52 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Sun, 16 Dec 2001 13:25:52 +0000 Subject: default webbrowser References: Message-ID: In article , Martin von Loewis writes >Robin Becker writes: > >> I'm trying to use the webbrowser module, but don't seem to have a >> 'default' webbrowser set up somehow. Any win32 experts know what I have >> to do to get win2k to use netscape as a default browser? > >netscape *is* the default on Windows, but it tries to find it in your >PATH. > >If that fails, it tries to do os.startfile to open a browser; if you >manage to associate anything with the extension of the file you are >trying to open, it should work with webbrowser as well. > >Regards, >Martin I have associated netscape with html files, but it's not on the path and I get strange messages from double clicking on html files. It's something to do with having allowed IE to be the default browser at one point and then netscape not quite getting itself back properly -- Robin Becker From christophertavares at earthlink.net Tue Dec 11 03:26:20 2001 From: christophertavares at earthlink.net (Chris Tavares) Date: Tue, 11 Dec 2001 08:26:20 GMT Subject: banging head against sys.stdin and tkinter on win32 References: <3c15a9e3$1_2@goliath.newsgroups.com> Message-ID: "David Mallwitz" wrote in message news:3c15a9e3$1_2 at goliath.newsgroups.com... > thump thump thump > > A few weeks ago I decided to try to become more proficient in Python by > writing a plain vanilla GUI app that interfaces with a serial port. Turns > out to have been pretty straightforward and everything is now at least > working, if not working the way I want it to. The program is a single > Tkinter text widget in its own thread to display everything that is read > from the serial port, another thread to read from that port, and one more > thread to continuously read input from the user. I don't need to process any > input from the user, just send it straight to the device attached to the > serial port. > So far no problem. I've been using a while 1 loop and msvcrt to poll for > any keystrokes, but this keeps a console window open and all commands must > be typed in that window. I'd like to 86 the console and just have all > input/output done on the display window (I'm familiar with the .pyw filename > trick, won't work, msvcrt need that console window to function). This is > where the headbanging thing happens. > I've tried wrapping the window in a class and defining a read method in > order to redirect sys.stdin - no joy, msvcrt just wants to use a console > window no matter what. I used an Entry widget for a while, but the number of > bind statements was prohibitively long, and would all need to be changed if > I tried to communicate with a different type of device. Input and raw_input > don't really apply here since I need to work on a character by character > basis and not wait for \n to terminate a string. > Am I even on the right track here? I'll gladly RTFM if someone will > point me to where an appropriate FM is. For that matter, where is the source > code for msvcrt? There is no file with that name in my Python path (or > anywhere else), yet I have to import it as a module. > > Best, > Dave > You're not on the right track. Now that that's taken care of :-)... msvcrt is an extension module written in C (actually, it just provides Python interfaces to a bunch of functions in the MS C Runtime library), so that's why there's no source code. It's in the Python source distribution if you're really interested. The function in question is actually a Win32 CONSOLE function, and so it needs a console to work. Thus, redirecting stdin won't help. The right way to handle this problem is what you were doing - use an entry widget (or whatever they call it in TK) - trap the events as the buffer changes and send out the keystrokes to the serial port. Unfortunately I haven't touched Python GUI programming in a LONG time, so I can't help you with the bindings, sorry. -Chris From rupert.kolb at med.uni-tuebingen.de Wed Dec 5 10:15:09 2001 From: rupert.kolb at med.uni-tuebingen.de (Rupert Kolb) Date: Wed, 05 Dec 2001 16:15:09 +0100 Subject: The Best Smart Card Story You've Never Heard References: Message-ID: <3C0E39FD.F74E4014@med.uni-tuebingen.de> > Investor News schrieb: > > E-Smart Technologies- ESMT > ?The Best Story You?ve Never Heard? > > THE COMPANY > [...] > -- http://mail.python.org/mailman/listinfo/python-list Hi, Am I right, that this list is for discussing Python related things. Neither this mail, nor the other "amusement" related mails I got in the past have something to do with Python. I do NOT like this spam! The python-list has unfortunately a lot of spam in comparsion to other lists. And, since I'm at the python-list, I get significant more spam emails to my PM than before. That means, that spamers are NOT afraid of sending spam to the list or the private email addresses of the people which are active at the list. I think, the maintainers should do something against the spam. Maybe other people at the list disagree. Or how should we solve this problem? And should we solve this? -- Rupert Kolb From calves at coelce.com.br Fri Dec 21 15:30:12 2001 From: calves at coelce.com.br (Alves, Carlos Alberto - Coelce) Date: Fri, 21 Dec 2001 17:30:12 -0300 Subject: FW: Comunicating through COM ports Message-ID: <29A97D00F387D411AC7900902770E148032F49FC@LCOEEXC01> I'm using Python 2.1 and I installed it through .exe installer from www.python.org -----Original Message----- From: David Mallwitz [mailto:dmallwitz at cox.rr.com] Sent: Friday, December 21, 2001 4:12 PM To: python-list at python.org Subject: Re: Comunicating through COM ports FW: Comunicating through COM portsWhich Python distribution are you using? Or did you compile from source? Dave "Alves, Carlos Alberto - Coelce" wrote in message news:mailman.1008955468.30561.python-list at python.org... Sorry, but as I said before, I'm under windows98 and I haven't such directory. Do I need to download that module from anywhere?!If so, give me an URL. -----Original Message----- From: David Lees [mailto:deblnonospammyno at raqia.com] Sent: Friday, December 21, 2001 1:46 PM To: python-list at python.org Subject: Re: FW: Comunicating through COM ports Python21/scripts/PythonSerial david lees > "Alves, Carlos Alberto - Coelce" wrote: > > Thanks for the example. But, where can I find such module Serial?! > > -----Original Message----- > From: David Mallwitz [mailto:dmallwitz at cox.rr.com] > Sent: Thursday, December 20, 2001 10:26 PM > To: python-list at python.org > Subject: Re: Comunicating through COM ports > > Comunicating through COM portsChapter 19 of Mark Hammond and Andy > Robinson's > 'Python Programmingon on Win32' covers this quit well, and with the > Activestate Python distro there is a multithreaded demo called > 'win32comport_demo.py'. But here's what I do - example is from a > console > connection to an old Cisco router. > > >>> from Serial import Serial > >>> ### open the COM1 port > >>> serialconfig = Serial.PortDict() > >>> serialconfig['port'] = Serial.COM1 > >>> serialconfig['rxBufSize'] = 4096 > >>> port = Serial.Port(serialconfig) > >>> port.open() > >>> port.write('show conf \r') > >>> x = port.read() > >>> x > 'show conf \r\nUsing 768 out of 32762 bytes\r\n!\r\nversion 11.1\r\nno > > service u > dp-small-servers\r\nno service tcp-small-servers\r\n!\r\nhostname > Router\r\n!\r\ > n!\r\nip subnet-zero\r\nno ip domain-lookup\r\n!\r\nhub ether 0 1\r\n > link-test\ > r\n auto-polarity\r\n!\r\nhub ether 0 2\r\n link-test\r\n > auto-polarity\r\n!\r\n > hub ether 0 3\r\n link-test\r\n auto-polarity\r\n --More-- ' > > Best, > Dave > > "Alves, Carlos Alberto - Coelce" wrote in > message > news:mailman.1008852145.28654.python-list at python.org... > Anybody could give me an example code of how connect/comunicate > through COM > ports (i.e. COM1, COM2). I'm under windows 98. > Thanks!!! > Carlos Alberto > COELCE/DPRON-Departamento de Projetos e Obras Norte > Fone: 677- 2228 > e-mail: calves at coelce.com.br > \|||/ > (o o) > --ooo0-(_)-0ooo-- > > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- > http://www.newsfeeds.com - The #1 Newsgroup Service in the World! > Check out our new Unlimited Server. No Download or Time Limits! > -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- > -- > http://mail.python.org/mailman/listinfo/python-list -- debl -- http://mail.python.org/mailman/listinfo/python-list -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- -- http://mail.python.org/mailman/listinfo/python-list -------------- next part -------------- An HTML attachment was scrubbed... URL: From daves_spam_dodging_account at yahoo.com Fri Dec 7 17:05:33 2001 From: daves_spam_dodging_account at yahoo.com (David Brady) Date: Fri, 7 Dec 2001 14:05:33 -0800 (PST) Subject: Win32all documentation? Message-ID: <20011207220533.12896.qmail@web21103.mail.yahoo.com> Hello, Is there a good source for *complete* documentation of win32all and the wonders it can accomplish? I have found lots of examples on the web that show part of how to use a certain module, but then fail to explain the rest of it. ActiveState's documentation is either very elusive or doesn't exist; what scraps I have been able to find are usually incomplete and/or do not give any hints as to where other, related scraps might be found. I'm interested in things like enumerating all the windows on the desktop, or the child windows of a window, or calling SystemParametersInfo to change the Windows desktop background image, getting and setting captions of windows, scripting app interaction (like mouse clicks and such, not just SendKeys). I've found an example on using SendKeys from WSH; I'd love to find ANY more documentation on the WSH itself and/or how to call it from Python.... Phew. I know it's a long list, but I'm hoping that there's a bunch of documentation out there that I just don't know how to find. All I really need is maybe some pointers to urls or MSDN locations... If someone would just lead me to water, I promise to drink as much as I can. :-) I have searched all over ActiveState, especially in the Python Cookbook area (which is where I found most of the examples that hint to me that these things can be done); I have also searched all of the resources exposed on the Python search pages. For the Windows-specific portions of my query, I have scoured MSDN as well. Connecting to WSH, for example, is explained, but no documentation seems extant for *USING* it once you've connected. Any help would be greatly appreciated. Thank you very much, -dB ===== David Brady daves_spam_dodging_account at yahoo.com I'm feeling very surreal today... or *AM* I? __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com From peter at engcorp.com Sat Dec 29 18:45:42 2001 From: peter at engcorp.com (Peter Hansen) Date: Sat, 29 Dec 2001 18:45:42 -0500 Subject: REPOST: Re: Zope Documentation (was RE: Python Popularity: Questions and References: Message-ID: <6$--$$_----__$%_-$@news.noc.cabal.int> Bill Tate wrote: > > I understand the "zen" thing, If you say that, then you don't really understand it. ;-) > but it's not something that business > people are going to care about when they making a decision about > whether to use it or not. As a business person, I take mild exception to that. I'd rather have "zen" from Zope than "marketing" from Microsoft. -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Peter Hansen Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E55A6.D873E301 at engcorp.com> Control: cancel <3C2E55A6.D873E301 at engcorp.com> Date: Mon, 31 Dec 2001 03:12:34 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774479 27193 211.57.49.2 (31 Dec 2001 04:54:39 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:54:39 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From mwh at python.net Tue Dec 11 08:51:05 2001 From: mwh at python.net (Michael Hudson) Date: Tue, 11 Dec 2001 13:51:05 GMT Subject: Wanted: pointer to detailed PyTypeObject documentation References: Message-ID: Courageous writes: > Does anyone have a pointer to something which documents what > each attribute of the PyTypeObject is for? I doubt it. You're talking about new-in-2.2 stuff? > My Essential Reference is a bit out of date, and I can't find online > what the exact meaning of some of the additional attributes are. I think you'll need to use the source, Luke. *Maybe* this will be documented soon... but don't hold your breath. Cheers, M. -- This is an off-the-top-of-the-head-and-not-quite-sober suggestion, so is probably technically laughable. I'll see how embarassed I feel tomorrow morning. -- Patrick Gosling, ucam.comp.misc From jason at jorendorff.com Tue Dec 11 19:35:45 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Tue, 11 Dec 2001 18:35:45 -0600 Subject: Getting at an item in a list of tupples In-Reply-To: <9v66mi$17mi$1@newshost.nmt.edu> Message-ID: > I want to do something like > print max(of all of the floats) > print min(of all of the floats) > > In general, how do you get at the floats (or ints, or strings)? F = [tup[1] for tup in a] print max(F) print min(F) -- Jason Orendorff http://www.jorendorff.com/ From loewis at informatik.hu-berlin.de Fri Dec 28 12:56:14 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 28 Dec 2001 18:56:14 +0100 Subject: REPOST: Re: base64.decodestring gives binascii.error References: <3C2C03CB.7030000@pacific-shores.com> <3C2C9D79.9050501@pacific-shores.com> Message-ID: <7$--$$_-----$$%__$@news.noc.cabal.int> Erik Myllymaki writes: > The '_' and '!' were in the original string that was then encoded, not > in the resulting encoded string. So why are you passing the original string to decodestring, then? Regards, Martin ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Martin von Loewis Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:16:35 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775175 27193 211.57.49.2 (31 Dec 2001 05:06:15 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:06:15 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From gleb at asd.iao.ru Mon Dec 24 12:55:39 2001 From: gleb at asd.iao.ru (Gleb Kulikov) Date: Tue, 25 Dec 2001 00:55:39 +0700 (TSK) Subject: ? -- how to use shared data? Message-ID: Hello, all! How can i gentle solve the follows problem: There is some binary buffer with fixed length, placed into named shared memory block. Data in that area is frequently changed by external (hardware) device. I'm afraid, is too uneffective constantly create new memory chunks and copy data by PyString_FromStringAndSize. Is there any safe method to make direct binding (reflection) of Python's string (or what can i use) to that memory buffer? Thank you. From bokr at accessone.com Tue Dec 11 20:31:30 2001 From: bokr at accessone.com (Bengt Richter) Date: Wed, 12 Dec 2001 01:31:30 GMT Subject: PEP 276 Simple Iterator for ints (fwd) References: Message-ID: <3c16b337.104828785@wa.news.verio.net> On Tue, 11 Dec 2001 16:43:16 -0700, "Bjorn Pettersen" wrote: >> From: Bengt Richter [mailto:bokr at accessone.com]=20 >>=20 >> On Tue, 27 Nov 2001 10:27:31 -0800, James_Althoff at i2.com wrote: >>=20 >> > >> >Greg Ewing wrote: >> >>While trying to think of a range syntax that looks unambiguously=20 >> >>half-open without clashing with list or tuple constructors, the=20 >> >>following blindingly obvious solution occurred to me: >> >> >> >> for 0 <=3D i < 5: >> >> ... >> > >> >Greg, >> > >> >Since this looks like a suggestion for replacing xrange in=20 >> the general=20 >> >case, did you have any thoughts on how one might specify a=20 >> step value? >> > >>=20 >> How about if a bare [x:y:z] were interepreted as an=20 >> abbreviation for slice(x,y,z) and you defined what one might=20 >> expect as an iterator for the slice type? >>=20 >> Then you could write >> for i in [0:5]: # or [:5] >> ... > >PEP 204 (http://python.sourceforge.net/peps/pep-0204.html) suggested >exactly this and was rejected. > Not exactly. The notation looks the same, but UIAM PEP 204 notation resulted in a list type, whereas I was suggesting generating a slice type, which would define a different iterator. From loewis at informatik.hu-berlin.de Wed Dec 26 19:38:24 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 27 Dec 2001 01:38:24 +0100 Subject: Where to post Jython questions? References: Message-ID: Oleg Broytmann writes: > On Wed, Dec 26, 2001 at 09:45:22AM -0800, Daniel Klein wrote: > > Is the the proper place to post questions/conversations for Jython? If > > not, please advise. > > http://www.jython.org/, Resources, Mailing Lists. Nevertheless, I think questions on Jython are welcome, here, too. Some may turn out to be Python questions proper. Regards, Martin From tismer at tismer.com Mon Dec 31 08:45:29 2001 From: tismer at tismer.com (Christian Tismer) Date: Mon, 31 Dec 2001 14:45:29 +0100 Subject: Is Stackless Python DEAD? References: <184fbd02.0110262039.74799675@posting.google.com> Message-ID: <3C306BF9.5040801@tismer.com> Well, it is a little late to answer this, but... Michael Hudson wrote: > Martin von Loewis writes: ... ... >>- It adds a field nesting_level to the thread state, without >> ever checking its value (it just counts the nesting level) >> > > I imagine this was just for bragging with :) Yes. I needed a way to track when and why there are still recursions. At sme pahse I also had the idea to drive decisions on this when I'm allowed to switch things, but later I learned that this is the wrong way. >>- it adds a number of _nr variants of functions (non-recursive), >> e.g. for map and eval. In __builtins__, the _nr versions are >> available as "map" and "eval", while the original versions are >> preserved as apply_orig and map_orig: >> * Are the _nr versions functionally completely backwards-compatible? >> If not, why? If yes, why is the original version preserved? >> > > I think the originals are just around because the implementation of > the _nr variants was tricky and Chris needed something to test > against. Not sure, though. A) they are completely compatible except for the special unwinding rule. A special token may be returned that tells to unwind the stack. The versions without _nr are kept for binary compatibility with existing code which is not aware of the unwind token. In this case, Stackless behaves like standard Python, it just does recursions. The _nr versions are for extensions which make use of the stackless features. >> * Just to implement map, 150 lines of builtin_map had to be >> rewritten into 350 lines (builtin_map, make_stub_code, >> make_map_frame, builtin_map_nr, builtin_map_loop). The author >> indicates that the same procedure still needs to be done for >> apply and filter. Just what is the "same procedure"? Isn't there >> some better way? >> > > This is where implementing stackless in C really, really hurts. [great explanation of stackless techniques skipped.] I agree this is not easy to undrstand and to implement. I always was thinking of a framework which makes this easier, but I didn'tcome up with something suitable. ... >>- The code adds PREPARE macros into each branch of ceval. Why? >>- It adds a long list of explicitly not-supported opcodes into >> the ceval switch, instead of using 'default:'. No explanation >> for that change is given, other than 'unused opcodes go here'. >> Is it necessary to separately maintain them? Why? >> > > This was an optimization Chris used to try and get back some of the > performance lost during the stackless changes. IIRC, he handles > exceptions and return values as "pseudo-opcodes" rather than using the > WHY_foo constants the current ceval.c uses. I never really understood > this part. This is really just an optimization. The PREPARE macros were used to limit code increase, and to gove me some more options to play with. Finally, the PREPARE macros do an optimized opcode prefetch which turns out to be a drastical speedup for the interpreter loop. Standard Python does an increment for every byte code and then one for the optional argument, and the argument is picked bytewise. What I do is a single add to the program counter, dependent of the opcode/argument size which is computed in the PREPARE macro. Then, on intel machines, I use a short word access to the argument which gives a considerable savings. (Although this wouldn't be necessary if the compilers weren't that dumb). >>It may be that some of these questions can be answered giving a good >>reason for the change, but I doubt that this code can be incorporated >>as-is, just saying "you need all of this for Stackless Python". I >>don't believe you do, but I cannot work it out myself, either. >> > > I think integrating stackless into the core is a fairly huge amount of > work. I'd like to think I could do it, given several months of > full-time effort (which isn't going to happen). About the only likely > way I see for it to get in is for it to become important to Zope > Corp. for some reason, and them paying Tim or Guido (or Chris) to do > it. I'm at a redesign for Stackless 2.2. I hope to make it simpler, split apart Stackless and optimization, and continuations are no longer my primary target, but built-in microthreads. ciao - chris -- Christian Tismer :^) Mission Impossible 5oftware : Have a break! Take a ride on Python's Kaunstr. 26 : *Starship* http://starship.python.net/ 14163 Berlin : PGP key -> http://wwwkeys.pgp.net/ PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF where do you want to jump today? http://www.stackless.com/ From greg at cosc.canterbury.ac.nz Sun Dec 9 23:23:12 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Mon, 10 Dec 2001 17:23:12 +1300 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C0FBAA8.F1A44304@attbi.com> <3C100EFF.6EEA6C7A@cosc.canterbury.ac.nz> Message-ID: <3C1438B0.B1C6D749@cosc.canterbury.ac.nz> Robin Becker wrote: > > Of course the > difficulty is not that of counting the femtoseconds but of mapping them > back into our familiar days and months. Yes. Once you've solved that problem down to the level of seconds, smaller units aren't any harder. So we might as well choose a unit smaller than anything anyone is likely to need. Alternatively, define the format so that it includes a scale factor -- effectively an unlimited-precision float. Then the range would be extensible in both directions. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From invalid_email at www.skeleton-man.f2s.com Sun Dec 2 05:38:54 2001 From: invalid_email at www.skeleton-man.f2s.com (Skeleton Man) Date: Sun, 2 Dec 2001 21:38:54 +1100 Subject: New updates needed for an old computer language humor piece References: <3c09aaf3_2@corp-goliath.newsgroups.com> Message-ID: <3c0a03b7$1_1@news.iprimus.com.au> That's a pretty acurate description of perl in general.. *L* Perhaps that should be on perldoc: perlfaq "how do i effeciently shoot myself in the foot ?" -- Regards, Chris ---- -Begin Xmas Signature------ *__=*Time::HiRes::usleep=>my at m=map{$_+=$_%2?-1:+1}map ord, split//=>'Ldssx!Bishrul`r!`oe!`!I`qqx!Odv!Xd`s/////////'. 'Ldssx!Bishrul`r!`oe!`!I`qqx!Odv!Xd`s/////////'; unshift @m=>(32)x at m;require Time::HiRes;for(0.. at m){ print map(chr, at m[0..(@m/2-1)])=>"\b"x(@m/2);push at m=> shift at m=>__(0170*0xA**3);} From Bruce at EckelObjects.com Sun Dec 30 12:07:10 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Sun, 30 Dec 2001 09:07:10 -0800 Subject: win32all-141 for Python 2.2 In-Reply-To: <3C2D4676.5060700@skippinet.com.au> References: <3C2D4676.5060700@skippinet.com.au> Message-ID: <200112300907100940.003426FD@mail.rdc1.sdca.home.com> I tried this on my stuff (I rely heavily on PythonCOM for my build systems) and it worked flawlessly. Hooray! And thanks again to Mark. *********** REPLY SEPARATOR *********** On 12/29/01 at 4:28 AM Mark Hammond wrote: >I have made a new win32all release for Python 2.2. > >Hrmm - it seems I can't login to starship :( So I have temporarily >placed it at: > >http://users.bigpond.net.au/mhammond/win32all-141.exe > >The only new known issue is that "Active Debugging" will probably not >work - using the Microsoft Debuggers when using Python in an ASP or IE >page will fail. > >I will move this to starship, including details of exactly what has >changed, ASAP. > >Mark. > >-- >http://mail.python.org/mailman/listinfo/python-list Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From chilopoda at hotmail.com Wed Dec 12 12:52:12 2001 From: chilopoda at hotmail.com (Rene Jensen) Date: Wed, 12 Dec 2001 17:52:12 +0000 (UTC) Subject: WGL in python, ChoosePixelFormat error Message-ID: <24bfc89266728f0b6632b23acd7028aa.45609@mygate.mailgate.org> Hi all. Does anyone know where to find an example of how to set up an opengl context via wgl? Is this being posted in the wrong forum? I get a strange error when trying to call ChoosePixelFormat This is how I try to setup my gl-context using win32all and wgl: # Register window-class .. # Create window.. # GetDC.. Desc = PIXELFORMATDESCRIPTOR() Desc.xxx = yyy .. PDesc = PIXELFORMATDESCRIPTORPtr (Desc) format = ChoosePixelFormat (windowDC, PDesc) ..Which results in: TypeError: Type Error. Expected _p_q_const__PIXELFORMATDESCRIPTOR But what does that mean? Thanks in advance all! I've just started using python, and loved it instantly. I'm trying to make a radiosity-renderer for creating shadowmaps in 3d games. I really hope python is good enough for it, because I simply love the simplicity of the code. chilopoda at hotmail.com -- Posted from 0xc3d7612c.mrgnxr2.ras.tele.dk [195.215.97.44] via Mailgate.ORG Server - http://www.Mailgate.ORG From usenet at thinkspot.net Sun Dec 30 01:02:57 2001 From: usenet at thinkspot.net (Sheila King) Date: Sat, 29 Dec 2001 22:02:57 -0800 Subject: REPOST: Re: Is learning Python "extraordinary"? References: <3C2E5706.5880983E@engcorp.com> <3C2EAD4D.77564075@engcorp.com> Message-ID: <3$--$$_----___%%%$@news.noc.cabal.int> On Sun, 30 Dec 2001 00:59:41 -0500, Peter Hansen wrote in comp.lang.python in article <3C2EAD4D.77564075 at engcorp.com>: > It is still my opinion that a bright person who has learned > several computer languages can learn Python enough to start > working on non-trivial tasks with not much more than a week > of learning, but that opinion is based solely on observation > of a dozen perhaps quite bright people doing just that. I agree with the above assessment. Still, it is unusual, in the least to find high school students that know 3+ programming languages. (Well, maybe not in the heart of the Silicon Valley.) Anyhow, I think Jesse has probably decided by now, that it is certainly worth mentioning in his essay. ;) -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Sheila King Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:57:12 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774338 27193 211.57.49.2 (31 Dec 2001 04:52:18 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:52:18 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From phd at phd.pp.ru Wed Dec 19 08:40:25 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Wed, 19 Dec 2001 16:40:25 +0300 Subject: =?koi8-r?B?zvIg5O7x8u7p7e7pIP3q7u3u7OjoIC0g6iDk7vHy8+/t7ukg8O7x6u746CEu?= =?koi8-r?B?Lg==?= In-Reply-To: <000901c186f7$da1a8620$32c8a8c0@webmaster>; from mailer@mailer.ru on Mon, Dec 17, 2001 at 06:39:21PM +0600 References: <000901c186f7$da1a8620$32c8a8c0@webmaster> Message-ID: <20011219164025.A14533@phd.pp.ru> On Mon, Dec 17, 2001 at 06:39:21PM +0600, mailer wrote: > It was russian spam. Please complain to abuse at swbell.net (network where email originates) and to abuse at alabanza.com (network hosting email address referenced in spam). Information from SpamCop. Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From mcfletch at rogers.com Sat Dec 8 04:44:14 2001 From: mcfletch at rogers.com (Mike C. Fletcher) Date: Sat, 08 Dec 2001 04:44:14 -0500 Subject: Monitoring running Windows Applications References: <3c13b5b2.56161165@127.0.0.1> Message-ID: <3C11E0EE.8070605@rogers.com> >>> import win32pdhutil >>> win32pdhutil.ShowAllProcesses() Look at the code for that to get ideas... HTH, Mike (Five Fresh) Fish wrote: > Here is, I think, a stumper: > > How can one get Python to identify either the applications that are > currently running in Windows, in real-time (ie. as an application > monitor)... > > Or, better, how can one get Python to identify all the open windows, in > real-time? > > [The idea being that if one can do this, it'd be a breeze to create a tool > that can keep an automatic diary of one's work tasks during the day...] > -- _______________________________________ Mike C. Fletcher http://members.rogers.com/mcfletch/ From erlangen72 at hotmail.com Tue Dec 18 21:23:56 2001 From: erlangen72 at hotmail.com (Mark_Pryor) Date: Wed, 19 Dec 2001 02:23:56 GMT Subject: EM_GETLINE,Win32gui, address of buffer Message-ID: <0TST7.436$Cw3.49740@newsread2.prod.itd.earthlink.net> Hi Using 2.1.1 build 212 from AS calling Win32gui.SendMessage( hwnd, cMes, wParam, lParam) When I use the message, EM_GETLINE, the lParam calls for an address of a string buffer. How do I prepare this buffer in Python? tia, Mark Pryor -- ICQ 64329574 Pgp KeyID: 0x1A966EC5 Here is the script that I'm using. Its a hack to get the text of the caret line in UltraEdit-32. # begin WinEnum.py import os, sys import win32api as wi import win32gui as ui import win32con as wc import re myhwnd = 0 myti = '' mycl = '' def Callback(hwnd, skip): global myhwnd global myti ti = ui.GetWindowText(hwnd) if ti.find(skip) >=0: myhwnd = hwnd myti = ti print hwnd, "uedit32 found",skip return 0 else: #print hwnd, ti return 1 try: ui.EnumWindows(Callback, "UltraEdit-32") except: print "error", myhwnd #[^\[\]] pat = re.compile('\[([^\[\]]*)\]') mtch = pat.search(myti) #os.path.basename(mtch.group(1)) mybase = mtch.group(1) print "mybase=",mybase mybase.strip() # get the starting child window, that has the right edit control #////////////////////////////// myhwnd = ui.FindWindowEx(myhwnd,0, "MDICLIENT",'') print "MDI", myhwnd myhwnd = ui.FindWindowEx(myhwnd,0,0,mybase) print "tab found",myhwnd try: myhwnd = ui.FindWindowEx(myhwnd,0,0,'') print "frame found",myhwnd except: print "error", myhwnd try: myhwnd = ui.FindWindowEx(myhwnd,0,'EditControl','') print "Edit control found",myhwnd except: print "error", myhwnd # now we have the handle to the EditControl, get the line number #/////////////////////////////////////////////// print myhwnd res = ui.SendMessage(myhwnd,wc.EM_LINEINDEX,-1,0) print "char number=",res llen = ui.SendMessage(myhwnd,wc.EM_LINELENGTH,res,0) res = ui.SendMessage(myhwnd,wc.EM_LINEFROMCHAR,res,0) print wc.EM_LINEINDEX print "line number=",res # get the text in the edit line #////////////// things fall apart here and UE crashes mytext = '' obj = ui.PyMakeBuffer( llen, 0) #res = ui.SendMessage(myhwnd,wc.EM_GETLINE,res, obj ) print res, ui.PyGetString(obj) -- ICQ 64329574 Pgp KeyID: 0x1A966EC5 From cjensen at bioeng.ucsd.edu Thu Dec 27 20:05:10 2001 From: cjensen at bioeng.ucsd.edu (Curtis Jensen) Date: 27 Dec 2001 17:05:10 -0800 Subject: affects on extended modules References: <3C051775.A8D4FD66@bioeng.ucsd.edu> <83pu5zrvbl.fsf@panacea.canonical.org> <3C0E7138.FD485D1D@bioeng.ucsd.edu> Message-ID: <1be8d8b.0112271705.50940295@posting.google.com> Pedro wrote in message news:... > "Curtis Jensen" wrote: > > > Kragen Sitaker wrote: > >> > >> Curtis Jensen writes: > >> > We have created a python interface to some core libraries of our own > >> > making. We also have a C interface to these same libraries. However, > >> > the the python interface seems to affect the speed of the extended > >> > libraries. ie. some library routines have their own benchmark code, > >> > and the time of exection from the start of the library routine to the > >> > end of the library routine (not including any python code execution), > >> > takes longer than it's C counterpart. > >> > >> In the Python version, the code is in a Python extension module, right? > >> A .so or .dll file? Is it also in the C counterpart? (If that's not > >> it, can you provide more details on how you compiled and linked the > >> two?) > >> > >> In general, referring to dynamically loaded things through symbols --- > >> even from within the same file --- tends to be slower than referring to > >> things that aren't dynamically loaded. > >> > >> What architecture are you on? If you're on the x86, maybe Numeric is > >> being stupid and allocating things that aren't maximally aligned. But > >> you'd probably notice a pretty drastic difference in that case. > >> > >> ... or maybe Numeric is being stupid and allocating things in a way > >> that causes cache-line contention. > >> > >> Hope this helps. > > > > Thanks for the responce. The C counterpart is directly linked together > > into one large binary (yes, the python is using a dynamicaly linked > > object file, a .so). So, That might be the source of the problem. I > > can try and make a dynamicaly linked version of the C counterpart and > > see how that affects the speed. We are running on IRIX 6.5 machines > > (mips). > > Thanks. > > > > Don't know if this helps but I had a similar problem on Linux. > > The context was : a python script was calling an external program and > parsing output (with popen) many times. I decided to optimize this > by turning the external program into a dynamicaly linked library with > python bindings. I expected to gain the extra system calls to fork and > start a new process, but it turned out that this solution was slower. > > The problem was caused by multithreading stuff. When using the library > straight from a C program, I didn't link with multithreaded libraries > and so all system calls weren't protected (they don't need to lock and > unlock their resources). > > Unfortunately, the library was reading files with fgetc (character by > character :( ). Since the Python version I used was compiled with > multi-threading enabled, it turned out that the fgetc function used in > this case lock/unlock features, which cause the extra waste of time. > > To find this, I compiled my library with profiling (I think I needed to > use some system call to activate profiling from the library, since I > couldn't rebuild Python). > > OT : at the end I fixed the library (fgetc replaced by fgets), and didn't > gain anything by turning the external program into a python extension. > Since it seemed that Linux disk cache was good, I removed the python > extension thus keeping a pure Python program, and implemented a cache > for the results of the external program. This was much simpler and more > efficient in this case. Is this a problem with i/o only? Our the code sections that we benchmarked has no i/o in it. -- Curtis Jensen From mats at laplaza.org Wed Dec 12 13:06:32 2001 From: mats at laplaza.org (Mats Wichmann) Date: Wed, 12 Dec 2001 18:06:32 GMT Subject: lost interest? References: <20011208001123.A5989@casa.parque> <3C14FEBD.AD52B516@attbi.com> Message-ID: <3c178a5c.36573229@news.laplaza.org> On Mon, 10 Dec 2001 10:28:13 -0800, Chris Barker wrote: :Justin Sheehy wrote: : :> I'd ask a different question from yours. Why is it a problem that :> Python doesn't have an equivalent to CPAN? "Perl has it" isn't :> enough. In order for a number of people to put time and work into :> this, it has to pose enough of a problem in its absence that those :> people will have real motivation to make it happen. : :A big problem I have seen is people not wanting to use exactly the :module they really nedd because it is "not part of the standard :distirubion". If it was a whole lot easier to find, get and install :third-party packages, perhaps this concern would go away. : :I am working on a program with Python right now. When we upgraded to :2.1, we had to find and install: Python, Numeric, mxDateTime, PIL, and :wxPython. On both Linux and Windows machines. I would have been a whole :lot happier it I could have gotten all that from one place! For those who need it, this pretty much sums up the reason why. I've half-heartedly participated in this debate in the past. One of the main arguments against always seems to be, why duplicate what the native OS can do in terms of installation ("why would I want a Python-based solution?"). And that's fine, if you are using an OS that's well supported, and preferably are using only one. We've already heard "ActiveState's blah blah can do that" (Windows only); Debian's apt can do that; Mandrake's urpmi can do that; comes with a Windows installer, etc. Some people, for example, don't care to produce a Windows installable, or don't bother with Linux, or... The problem really comes in when you're trying to specify a Python Environment that has designs on being as cross-platform as Python is, and not all of the users care to be Python fans and keep up on everything that's going on. Probably there aren't enough people in that boat to really push for a solution: in other words, the open source model tends to work when there's enough momentum to provide a solution. For those things that are available as a distutils setup, installation is easy enough - it solves most of the problems. Mats Wichmann From laurent.pointal at laposte.net Mon Dec 3 15:09:56 2001 From: laurent.pointal at laposte.net (Laurent Pointal) Date: 03 Dec 2001 20:09:56 GMT Subject: floating Pt. Division errors in Windows 2000 References: <05DN7.34897$H7.4336901@ruti.visi.com> Message-ID: [posted and mailed] "Leon Webster" wrote in news:05DN7.34897$H7.4336901 at ruti.visi.com: > I am just learning Python using the book Learning Python. Here's a > sample problem from the book: >>>>a = 3 >>>>b =4 >>>>b/(2.0 + a) > > When I execute this on my laptop (win2k machine, pentium III), I get > the following answer: > > 0.80000000000000004 > > The same program on Linux provides the right answer (0.8), as does a > program written in Java. > > Does anyone know why this happens? Is this a problem with Python on > Windows or Win 2k? Python display maximum number precision, this is why you see the 4e-17 value, because its present in memory to code 0.8 in binary format. If you request Java or C to give 20 decimal after dot, you should get same result. I just built this small C code: int main(int argc, char* argv[]) { printf("%0.20f",0.8); return 0; } And it display (PIII+Win2K too): 0.80000000000000004000 Note that old Python versions act like C and Java by limitating the default displayed precision. > Thanks much > > Leon A+ Laurent. From thorj at east.no Wed Dec 12 18:52:47 2001 From: thorj at east.no (Thor Arne Johansen) Date: Thu, 13 Dec 2001 00:52:47 +0100 Subject: neural networks References: <3C17DA8F.931CAE22@gol.ge> Message-ID: <9v8qkf$l7p$1@samson.globalone.no> "Giorgi Lekishvili" skrev i melding news:3C17DA8F.931CAE22 at gol.ge... > hello all! > > I wonder if someone could indicate on a Python-written Neural Netowork > resources... > > Will SciPy ever contain it? > > Thank you, > Giorgi > Check out: http://www.python.org/doc/PyCPP.html http://starship.python.net/crew/seehof/NeuralPython.html Anyone know where the code for NeuralPython/NeuralIntegrator can be found?? -- Thor A. Johansen From just at xs4all.nl Sat Dec 8 15:59:09 2001 From: just at xs4all.nl (Just van Rossum) Date: Sat, 08 Dec 2001 21:59:09 +0100 Subject: Calling a generator multiple times References: <0gn21usqeasqa1bp4sveh0vjagtmbmfpof@4ax.com> <3C11FE92.1218662@letterror.com> Message-ID: <3C127F1D.DD609D4D@xs4all.nl> Courageous wrote: > > >If it _was_ "plain wrong" it wouldn't be the way it is. > > One of the objections to what I've written has been, on several > occasions, "After you've worked with them for a while, you'll > not have any problems with them" or some equivalent. What's > wrong-headed about this kind of thinking is that this is true > of original programmers everywhere. They always generally > understand their own code. Embedding a keyword deep in a function > definition and then having this embedding make the function > in effect behave entirely differently isn't just wrong, it's > bizarre. How can you say that with such absolutely certainty? Have you read the PEP now? Just From tim at vegeta.ath.cx Thu Dec 27 04:17:20 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Thu, 27 Dec 2001 09:17:20 GMT Subject: REPOST: Re: age of new pythonistas [was: The Editor Poll results are in!] References: <60c49aa9.0112202148.7218555b@posting.google.com> <3C2AE63A.24D736F2@nyc.rr.com> Message-ID: <2$--$$-$$$$%_-$_$$@news.noc.cabal.int> Kenny Tilton graced us by uttering: > Tim Hammerquist wrote: > > Wait, didn't you give up on Perl before you knew it well enough > > to make that kind of statement? > > Intelligence is all about dealing with partial information. s/Intelligence/Life/ Cheers! Tim Hammerquist -- But the price of getting what you want is getting what you once wanted. -- Morpheus, The Sandman ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news-xfer.siscom.net!feed1.newsreader.com!netnews.com!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Tim Hammerquist Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:34:25 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775870 27193 211.57.49.2 (31 Dec 2001 05:17:50 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:17:50 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From timr at probo.com Thu Dec 27 13:59:17 2001 From: timr at probo.com (Tim Roberts) Date: Thu, 27 Dec 2001 10:59:17 -0800 Subject: REPOST: Re: dtuple and sql functions References: Message-ID: <7$--$$_----_%___%$@news.noc.cabal.int> tweek154 at yahoo.com (tweek) wrote: >i am dealing with converting the date format from a MySQL database and >i'd prefer to use the built in sql function than convert it using >python. here is what im trying to accomplish: > > >flist = ["AssignedTo", "DATE_FORMAT(DueDate, '%m/%e/%Y')"] >descr = dtuple.TupleDescriptor([[n] for n in flist]) > >sql = """SELECT %s FROM joblog""" % ", ".join(flist) >c.execute(sql) >temp = c.fetchall() > > >now unfortunately the field name is now called: >temp.DATE_FORMAT(DueDate, '%m/%e/%Y') > >which should be invalid anyways. what i want is to use it as >temp.DueDate SELECT clauses always allow renaming. Try this: flist = ["AssignedTo", "DATE_FORMAT(DueDate, '%m/%e/%Y') AS DueDate"] I don't know whether this screws up your TupleDescriptor function. If so, you could tweak flist after the call. -- - Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Tim Roberts Newsgroups: comp.lang.python Subject: cmsg cancel <5qrm2u8ghafrgfmir1t95nrp3vt58elio6 at 4ax.com> Control: cancel <5qrm2u8ghafrgfmir1t95nrp3vt58elio6 at 4ax.com> Date: Mon, 31 Dec 2001 03:12:22 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775665 27193 211.57.49.2 (31 Dec 2001 05:14:25 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:14:25 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From chrishbarker at home.net Mon Dec 3 13:21:35 2001 From: chrishbarker at home.net (Chris Barker) Date: Mon, 03 Dec 2001 10:21:35 -0800 Subject: summing NumPy byte arrays References: <3C07DA0A.2DB4F78C@alex2.labs.agilent.com> <3C07EB40.1EFC594B@home.net> <9u8vbf$p1g$1@peabody.colorado.edu> Message-ID: <3C0BC2AF.EF1B7D56@home.net> Fernando P?rez wrote: > Just curious: why not call reduce() with an object whose __add__ > method does the work of adding an int +byte as int? The loop would be > done in C (by reduce) and the tying should work ok. > > Maybe I'm missing something, We use Numeric arrays because they provide very nice notation, and because they are MUCH faster for crunching a lot of number. I assume that if the OP is conserned about memory enough that he wants to use 1byte integers, he has a LOT of numbers to work with. An example: #!/usr/bin/env python from Numeric import * import RandomArray import time # create a long 1byte integer array n = 500000 m = 10 X = RandomArray.randint(0,255,(n,)).astype('b') start = time.clock() for i in range(m): # do it in loop to make it take longer s = sum(X) print "it look %f seconds to use Numeric.sum"%(time.clock()-start) print s # this is fast, but it gets the wrong answer becasuse the answer won't fit into 1-byte. # and with reduce(): start = time.clock() for i in range(m): # do it in a loop to make it take longer s = reduce(lambda x,y: x+y, X) print "it look %f seconds to use reduce()"%(time.clock()-start) print s # this is a LOT slower. # now my suggestion: start = time.clock() for i in range(m): # do it in loop to make it take longer s = sum(X.copy().astype(Int)) print "it look %f seconds to use Numeric.sum, with a typecast"%(time.clock()-start) print s it look 0.090000 seconds to use Numeric.sum 14 it look 11.390000 seconds to use reduce() 63494670 it look 0.470000 seconds to use Numeric.sum, with a typecast 63494670 What I suggested is about 5 times slower than what he wants, and uses four times as much memory. The reduce() method doesn't use the memory, but takes 126 times as long. If speed matters in this application, that is a BIG difference! -Chris -- Christopher Barker, Ph.D. ChrisHBarker at home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From bill-bell at bill-bell.hamilton.on.ca Wed Dec 5 11:18:24 2001 From: bill-bell at bill-bell.hamilton.on.ca (Bill Bell) Date: Wed, 5 Dec 2001 11:18:24 -0500 Subject: COM Registration Attributes In-Reply-To: <1007567248.786.38725.m3@yahoogroups.com> Message-ID: <3C0E0280.26592.314C102@localhost> Gordon McMillan wrote: > Bill Bell wrote: > > "Python Programming on Win32" mentions that '_reg_options_' is a > > "dictionary of additional keys to be written to the registry for the > > COM object". > > > > Has anyone an example or two, since I've been unable to find any? > > class MyCOMServer: > __reg_options_ = {'mykey':'myvalue'} > ... > > When registered, there will be a key 'mykey' sibling to > 'InProcServer32' with a default value of 'myvalue'. I don't know if it > will handle other types, or anything more complex. Thanks, Gordon. I just prototyped a simple COM that needs to declare itself safe for Internet Explorer. Looks like I need to continue to do that in the good old-fashioned way, with 'RegOpenKey', etc. Would seem more elegant to be able to use '_reg_options_'. Bill "It is the time that you have wasted for your rose that makes your rose so important."--St-Exupery From newsgroups at thomas-guettler.de Tue Dec 18 18:21:36 2001 From: newsgroups at thomas-guettler.de (Thomas Guettler) Date: Wed, 19 Dec 2001 00:21:36 +0100 Subject: wxwin2.2 --> Seg.fault Message-ID: <3C1FCF80.2060603@thomas-guettler.de> I am looking for a GUI API for python. WxPython should be better, but I get a seg.fault if I press ctrl-c in the terminal the application was started with. I use wxwin2.2 on Debian. Is tkinter more stable? If you scan through this newsgroup you get the impression that more people use tkinter. I don't want to make a bad decision now, because changing the GUI library costs a lot of time later What do you think? guettli From km-list-python at miazine.net Thu Dec 20 13:02:57 2001 From: km-list-python at miazine.net (Kirill Miazine) Date: Thu, 20 Dec 2001 19:02:57 +0100 Subject: age of new pythonistas [was: The Editor Poll results are in!] In-Reply-To: References: Message-ID: <20011220190257.D29157@poff.miazine.net> * Stephen Ferg [20011214 07:14]: > My age at the time that I discovered Python (about a year ago): > 54 > > My pre-Python programming experience: PL/I, Cobol, Visual Basic, > PowerBuilder, and REXX. IBM MVS, DOS, Windows, no Unix. > > It looks like many new Pythonistas are older, rather than younger. I'm 19. Programming Python for only one week (and already sublcassing and doing other "advanced" things :). I've using Perl for 2 years and a little bit C. > When you are younger, your whole universe consists of the language > that you learned first -- it takes a while to learn that the universe > contains many, many languages to choose from. Then, when you realize > you have a choice, it takes a while to find Python in the welter of > alternatives. And finally, it is only after you have been around a > while, and seen the alternatives, that you can really appreciate how > much better Python is than any of the alternatives. I agree. I'm happy I discovered Python so early :-) -- Kirill From wurmy at earthlink.net Fri Dec 7 01:34:20 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Fri, 07 Dec 2001 06:34:20 GMT Subject: strict python? References: Message-ID: <3C1060E4.756F33B2@earthlink.net> Brian Sturk wrote: > > Can python be more strict about declarations? I didn't see a flag to > the interpreter, and haven't seen anything yet in my book or on > www.python.org. I ask because I got burned by something > like this: > > def func ( self ): > print hello > > def call_func( self ): > self.func <--- no parentheses > > my script that had code like this ran fine, but > didn't call the function. I would have thought that > this would have been an error since there was no > assignment of any kind. > > It took me a little for me to figure it out in my real > script. It'd be nice to have this stuff pointed out > while parsing it. Is it possible? Well, 'self.func' is a perfectly valid Python expression, just like '3'. Not very useful when used like this, but still, perfectly valid. The Python parser doesn't flag this as an error, for this reason, and doesn't give any warnings either, but I believe PyChecker does. See http://sourceforge.net/projects/pychecker for more info. --Hans From fredrik at pythonware.com Wed Dec 19 18:23:03 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 19 Dec 2001 23:23:03 GMT Subject: moderator: please unsubscribe me! References: Message-ID: John Roth wrote: > This is not a mailing list. but it's connected to one. for more info, see: http://mail.python.org/mailman/listinfo/python-list that page also lets you unsubscribe, ask mailman to send your password again (which you'll need to unsubscribe), set subscription options, etc. From gh_pythonlist at gmx.de Thu Dec 6 18:15:32 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Fri, 7 Dec 2001 00:15:32 +0100 Subject: MINGW In-Reply-To: <9uo25q$ilp$1@bob.news.rcn.net> References: <9uo25q$ilp$1@bob.news.rcn.net> Message-ID: <20011206231531.GA1137@lilith.hqd-internal> Le 06/12/01 ? 10:24, David Abrahams ?crivit: > Is anyone out there successfully using MINGW for development of extensions > with recent versions of Python (e.g. 2.1, 2.2b2)? The procedures I've found > on the web for making it work don't inspire confidence. I would appreciate a > pointer to a known working procedure if anyone can come up with it. I've posted a HOWTO that goes in this direction a few months ago: http://groups.google.com/groups?q=python+debugging+windows+howto I've also once built Boost.Python with MINGW on Windows. I did this by adjusting the gcc specific Makefiles in Boost. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From syver-en+usenet at online.no Sat Dec 29 10:03:16 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 29 Dec 2001 16:03:16 +0100 Subject: REPOST: Re: SSL Sockets in Windows References: Message-ID: <4$--$$_-----$%_$$$@news.noc.cabal.int> Gerhard H?ring writes: > Le 28/12/01 ? 07:18, Syver Enstad ?crivit: > > > > Hi Al, I'm not exactly an expert on SSL :-). I know it's what goes > on > > > behind the scenes when my browser uses an https url and > communication > > > is encrypted and whatnot. > > > > Do you have (or can you refer me to) a quick > > example to check that SSL is indeed working on Python? > > You can check pretty easily if your Python is compiled with SSL > support: > > > 'ssl' in dir(socket) Yes, returns true (1) > If so, you should be able to fetch a HTML page with the urllib module: > > > print urllib.urlopen("https://www.sf.net/").read() Yes, this fetches the front page of sourceforge, which says that I'm not logged in. What would happen if I didn't have SSL installed. You see I compiled up a new version of _socket.pyd with VC++ 6 and this time I specified that SSL shouldn't be compiled in. 'ssl' in dir(socket) still returns true, and the download goes without a hitch too. I haven't checked with a packet sniffer though. > reduce(lambda x,y:x+y,map(lambda > x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) Cute, and true. -- Vennlig hilsen Syver Enstad ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Syver Enstad Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:12:08 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774749 27193 211.57.49.2 (31 Dec 2001 04:59:09 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:59:09 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From brueckd at tbye.com Sat Dec 22 10:49:45 2001 From: brueckd at tbye.com (brueckd at tbye.com) Date: Sat, 22 Dec 2001 07:49:45 -0800 (PST) Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic In-Reply-To: <92592u85pq0t8hvhklgq5jjojiuldtv7dr@4ax.com> Message-ID: Whew... these days the only newsgroup I follow closely is c.l.py. I had forgotten how hostile and childish threads could become! -Dave From dyoo at hkn.eecs.berkeley.edu Sun Dec 2 23:55:41 2001 From: dyoo at hkn.eecs.berkeley.edu (Daniel Yoo) Date: Mon, 3 Dec 2001 04:55:41 +0000 (UTC) Subject: A Python bytecode assember? Message-ID: <9uf0kd$1r4r$1@agate.berkeley.edu> Hi everyone, I'm planning to do a small project with Python's bytecode, and I'd like to know if anyone's written a bytecode assember for it? I've taken a look at Michael Hudson's 'bytecodehacks' package at: http://bytecodehacks.sourceforge.net/ but the code looks like it hasn't been touched since March 2000. Can anyone talk about their experiences with bytecodehacks? I need a bytecode assember that supports jumps, so if someone's hacked up bytecodehacks to support this, I'll be a very happy person. Thanks again! From LLoeffler at home.com Wed Dec 12 13:27:33 2001 From: LLoeffler at home.com (Luke) Date: Wed, 12 Dec 2001 12:27:33 -0600 Subject: neral networks References: <3C17DA8F.931CAE22@gol.ge> Message-ID: <3C17A195.3050405@home.com> Maybe you'd be interested in looking at this http://www.enme.ucalgary.ca/~nascheme/python/bpnn.py It's an implementation of a back propogating neural network. LL From fperez528 at yahoo.com Mon Dec 24 08:35:20 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Tue, 25 Dec 2001 13:03:20 +2328 Subject: vi or emacs for editing Python on Linux? References: Message-ID: maxm wrote: > > I do use Vim occasionally for the odd sysadmin work, but I spend far more > time editing multiple source programs so startup time is not really that > important. > A final suggestion from an emacser: for the light-quick jobs, I've gotten used to jed. It's a little editor which in many respects behaves like emacs, but is *much* lighter so it starts a lot faster, and just in a terminal windows. But its keybindings and overall behavior are emacs-compatible. So basically what I use is Xemacs as a single big job that's *always* running on one of my virtual desktops with a bunch of code buffers, and jed as my environment EDITOR variable for when I need to quickly fire up an editor from less or mc (Midninght Commander, a Norton Commander clone which is the single most efficient tool for file management in this side of the galaxy :). This gives me quick startup times for the occasional odd job without the need for any mental gear shifting. Question: I didn't catch the Newtonmass reference. ??? Cheers, f. From aahz at panix.com Sat Dec 29 11:12:42 2001 From: aahz at panix.com (Aahz Maruch) Date: 29 Dec 2001 08:12:42 -0800 Subject: REPOST: whrandom (was Re: Python 1.5.x vs Python 2.x.x) References: <3C180FF7.DEAEA6C6@radical.ca> <7xheqkr05q.fsf@ruckus.brouhaha.com> Message-ID: <3$--$$_----___%$%$@news.noc.cabal.int> In article , James T. Dennis wrote: > > While that topic has come up: I find whrandom to be an unsightly > name for accessing a set of functions which is so commonly accessed > by novice students. What was wrong with must calling it rand or > random? Is it pure pedantry? You're not supposed to use whrandom, although unfortunately the docs have been less clear about this historically than they should have been. The specific functionality of random is located in whrandom, to provide an abstraction layer in case some better pseudo-random algorithm comes along. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 2 days and counting ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: aahz at panix.com (Aahz Maruch) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:35:51 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774710 27193 211.57.49.2 (31 Dec 2001 04:58:30 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:58:30 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From peter at engcorp.com Fri Dec 28 11:49:09 2001 From: peter at engcorp.com (Peter Hansen) Date: Fri, 28 Dec 2001 11:49:09 -0500 Subject: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B941D.B1E45AA5@htp-tel.de> Message-ID: <3C2CA285.BE256C16@engcorp.com> Alex Martelli wrote: > "Aahz Maruch" wrote: > > DeepBleu wrote: > > > > > >NNTP is an internet protocol like SMTP, POP3 and HTTP for > > >communication. Also, it is the oldest one and it used to be the most > > >instructive before AOL hit the scene along with the 'gold rush' :) > > > > Really? NNTP is older than SMTP? Mind telling me where you found that > > little gem? > > SMTP must be older, by a few years (say '82 vs '86?). FTP must be > older still -- before SMTP, mail was distributed with an FTP tweak. > > Of course, netnews used other transport-level protocols (mostly > based on UUCP, as I recall) well before the Internet was officially > inaugurated (1983, wasn't it?). I *thought* I remembered reading Usenet back around 1980 or 81 but that seems unlikely since Usenet first started in 79 but was limited to only a few computers until probably well after 82. I see that NNTP (RFC977) came around in 1986 while SMTP dates from around 1981 (RFC788) although a previous MTP (RFC780) which is presumably not quite as simple dates from 1980. And I was reminded again of the humorous coincidence that our network mail standards were written by somebody named "Postel". :) -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From km-list-python at miazine.net Fri Dec 21 08:33:11 2001 From: km-list-python at miazine.net (Kirill Miazine) Date: Fri, 21 Dec 2001 14:33:11 +0100 Subject: tt replacement Message-ID: <20011221143311.B18250@poff.miazine.net> Hello, I bet there exists Python's equivalent/replacement for Template-Toolkit (http://tt2.org), but where can I find that replacement? I want to migrate one application which uses Template-Toolkit over to Python, but I'm stuck with my searches for something that'll be able to replace TT. I didn't plan to use Zope, but maybe I'll go for it anyway. Thanks in advance -- Kirill From philh at comuno.freeserve.co.uk Wed Dec 12 14:27:53 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Wed, 12 Dec 2001 19:27:53 +0000 Subject: Whatever happened to String Interpolation? References: <9u6dbn$nsj$1@peabody.colorado.edu> <9uerd1$hbk$1@peabody.colorado.edu> <9v731i$rsk$1@peabody.colorado.edu> Message-ID: On Wed, 12 Dec 2001 01:02:58 +2328, Fernando P?rez wrote: >Ville Vainio wrote: > >> Fernando P?rez writes: >> >>> That already exists: type 'python Itpl' in google. >> >> So, it appears to be done already. What's the fuss, then? Wouldn't >> having this in the standard library suffice? Looking at the relatively >> concise syntax on Itpl, why on earth would one want an equivalent >> thing encumbering the core language? > >Well, at least having it in the standard library would be IMO a big >advancement. As it stands now, one often tries to work around it to avoid >generating an extra dependency for a project. Why not just put the itpl.py file in your project? Then there's no extra downloading required. -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From jkraska at san.rr.com Sat Dec 8 13:59:15 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 08 Dec 2001 18:59:15 GMT Subject: Creating a "package" using C extensions? Message-ID: <4bo41u8de4r4njcchh4g3mcuvdhqohhu39@4ax.com> So. I've written Python C extensions before. And I've written Python packages before, with subdirectories and __init__.py files and so forth before. What I'm unclear on is the proper way to combine these. I can see that if I just used a normal __init__.py and then pointed it to C extension dlls, this would probably work. Is this the approved way of doing this? Is there a way to govern the entire thing entirely from C? IOW, is there a __init__.py equivalent for C modules? C// From wurmy at earthlink.net Sat Dec 29 01:41:40 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Sat, 29 Dec 2001 06:41:40 GMT Subject: REPOST: Re: PythonCard, ease of use, and the GUI problem/opportunity/niche References: <3C2A9D33.67FEC261@earthlink.net> <458b194a.0112282052.1123341@posting.google.com> <3C2D620C.2E67414D@earthlink.net> Message-ID: <4$--$$_----_-%$_$$@news.noc.cabal.int> Ron Stephens wrote: [an easy-to-use GUI builder] > The only hope that I know of right now is PythonCard, only a six month old project led by Kevin Altis. I > really admire Kevin and his team and I admire this project. I think they are ace coders (especially Kevin ) > who are capable of doing what needs getting done. But I am afraid they will miss the mark, partly for the same > reason as Zope has its detractors, namely, lack of good, easy to use documentation for learning and using the > language. There's also Boa Constructor, which looks very promising, but unfortunately it has the same state as PythonCard... pre-alpha. If this ever really gets off the ground, it will be like having a Delphi using Python rather than Pascal. The current CVS version doesn't like wxPython 2.3.2, though. So I couldn't test the latest code. :-( http://boa-constructor.sourceforge.net/ --Hans ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Hans Nowak Newsgroups: comp.lang.python Subject: cmsg cancel <3C2D644B.CE2FFED at earthlink.net> Control: cancel <3C2D644B.CE2FFED at earthlink.net> Date: Mon, 31 Dec 2001 03:37:33 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774835 27193 211.57.49.2 (31 Dec 2001 05:00:35 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:00:35 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From loewis at informatik.hu-berlin.de Fri Dec 28 12:54:22 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 28 Dec 2001 18:54:22 +0100 Subject: Two languages, too similar, competing in the same space. References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> Message-ID: Ron Stephens writes: > I feel that Ruby is so similar in design, purpose, and objectives to > Python, that it competes directly with Python for developers' mind > share. I think it competes with Perl much more than with Python, if for no other reason that there are probably more Perl developers out there than Python developers. > And I like and respect Matz and the whole Ruby community. I wish them well. > But I recognize that their success may, on the margins at least, slow down > Python. Python is a programming language, so it does not have, in itself, "speed", meaning it cannot be slowed down. Perhaps you meant that it will decrease the growth rate of the number of Python developers world-wide. That is hard to find out, as there are two many other factors involved, and because it is difficult to find out how things would have developed without Ruby. Perhaps ypu meant that the rate in which Python releases appear will be affected, or the rate in which changes are made to Python. I do not think this is true. People contributing to Python development are unlikely to switch to Ruby, since they have already invested quite some time into that project, which they might consider lost if they switch to another language. Regards, Martin From tim at vegeta.ath.cx Sat Dec 22 03:18:13 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Sat, 22 Dec 2001 08:18:13 GMT Subject: vi or emacs for editing Python on Linux? References: Message-ID: Steve Lamb graced us by uttering: > Anyway, point is not to try to wrap one editor in another editor's > keystrokes. You're spending more time rebinding everything and > working around how you think things should work than you would just > learning the editor for what it is. In general, I agree with you, but there should be certain exceptions, I think. For example, applying basic vi-keybindings to Slrn and Mutt so I can do all my IMAP and NNTP work without *ever* taking my fingers off the home row... ...except to change songs in Xmms... ...no, even that's a mere b. I wonder what that little thing next to my keyboard is. The one that says "Logitech" with a cord coming out the back... ;) Tim Hammerquist -- $ echo `find /mnt/windows | wc -l` wasted directory entries. From fperez528 at yahoo.com Sun Dec 30 08:12:37 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Mon, 31 Dec 2001 12:40:37 +2328 Subject: /usr/bin/env: python: No such file or directory References: Message-ID: Trond Eivind Glomsr?d wrote: [snip] > I see someone from RH is listening, so let me ask again, and apologies for any inflammatory language in my first post. But the issue made me waste so many hours this past week that I wasn't in a particularly good mood about it. I understand your compatibility issues. On the other hand, I'm sure you realize you are breaking an extremely widely used convention by installing the currently standard series of python as /usr/bin/python2, since that means the idiom '#!/usr/bin/env python' won't work for many people, and it will be particularly suprising to those who assumed they had installed Python 2.x. I know, they can always go and fix all their scripts, but that puts an undue burden on the user, it seems to me. I see a few options for RedHat to do things 'right' for your users in terms of providing a saner python environment without breaking your own internal setup: 1) Upgrade your internal anaconda and other system code to work with Python 2.x, *without requiring it*. This way you could ship 7.2 with python 2.x as the default python and the same programs would still run under python 1.x in older redhat releases. This shouldn't be too hard at all, since almost all of python 1.5 code runs unchanged under 2.x. In fact I suspect the code may actually work already, once the support packages are copied to the right place (haven't had time to try). If that's the case, it is a real shame that you put pyhton1.5 as the system default without any real techical justification. or 2) Change only the first line in your system python scripts to explicitly point to /usr/bin/python1.5. I don't know if this would change anything with respect to your older releases, but the code itself wouldn't be affected. Again, this would allow python 2.x to be the default at /usr/bin/python with absolutely minor changes to all your system scripts. And if someone is going to install system 7.2 scripts on a 7.1 machine, as bizarre as that sounds, a simple fix would be for them to link python1.5 to python. These seem to be perfectly reasonable solutions, while the current setup leaves the users in a particularly unpleasant situation: any code you run with '#!/usr/bin/env python' will trigger a call to python1.5, which may cause it not to run (if it needs python2 features), but you can't change the system default without breaking fundamental functionality. So could you explain to us why RedHat chose not to allow their users to use python2 as the standard system default, even though as I pointed, there are very reasonable ways of maintaining compatibility for your own scripts? Regards, F. From tatebll at aol.com Sun Dec 30 12:15:08 2001 From: tatebll at aol.com (Bill Tate) Date: 30 Dec 2001 09:15:08 -0800 Subject: Zope Documentation (was RE: Python Popularity: Questions and Comments) References: <3c2f03f4$0$2592$afc38c87@news.optusnet.com.au> Message-ID: djmitchell wrote in message news:<3c2f03f4$0$2592$afc38c87 at news.optusnet.com.au>... > Bill Tate wrote: > > > I understand the "zen" thing, but it's not something that business > > people are going to care about when they making a decision about > > whether to use it or not. > > Yep, exactly. > > My last boss was a "who cares what it is? If it's open source and you > techos recommend it, we'll give it a try" kind of guy. If we could present > a justification in terms of risk/benefit that looked good, he gave us his > blessing. I switched him from thinking development=C++/Java to Perl and > Python, we replaced Solaris and AIX boxes with Linux, and we saved our > employers enormous quantities of money. When I tried to talk him into > looking at Zope, I found there was no frame of reference I could use - no > comparisons with J2EE or n-tier COM, which are probably about the closest > alternatives in terms of development approach If he was to let me take on > some work using Zope, his problems were: > - trying to convince his superiors that this unheard-of Zope thing was > better in some vaguely-defined way than J2EE and large COM solutions > - how to estimate the design/dev times using Zope. At least with J2EE and > COM there's some body of evidence out there as to how long projects take > from conception to production. We'd proven that Python compared to C++ > gave something around 10:1 reduction in dev times, but Zope isn't Python > - how was Zope going to perform on hardware from vendor X. We already had > reasonable expectations as to how J2EE performed on specific hardware, and > could budget our hardware purchases with some degree of confidence. The > Zope web site suggests "it runs fast", but there's no data at all that I > could find to back it up > > I knew I was on a loser even as I was saying something like "it's a better > Java than Java" as I was describing Zope's platform independence. When I > had to resort to crap platitudes like this, even though I believe it, I > knew nobody holding development purse strings was going to let me finish > the spiel. > > Zope seems to have an "it's better than the rest; just take our word for > it" mentality attached to it, and solid comparisons with other tools or > performance data just doesn't appear to be out there. Sun took this tack > with Java in the early days, and MS did with COM/MTS a few years ago, and > large corporates had a belief that Sun and MS wouldn't let their customers > down (else they'd lose market share and shareholders would get upset). > With Zope not having a major corporation behind it, and the NASDAQ collapse > in 2000, there's that much less blind faith available for Zope. Even a > small pilot or proof-of-concept implementation costs serious dollars, and > that type of money just isn't around any more. > > I'd LOVE to use Zope for something grander than my personal site holding my > resume and pictures of my kids, but if I couldn't convince one of the most > receptive managers I've ever had, it seems like an impossible task. It's > sort of like the conceptual leap that was required to embrace OO > development several years ago; there was a large body of evidence as to how > non-OO development worked in "best practice" scenarios, lots of project > managers skilled in non-OO development and a general feeling of comfort > that the old ways worked. Why change to OO, and take on all the unknown > development risks? > > Based on the available documentation, Zope seems to need this sort of > "death or glory" approach, and hardly anyone seems willing to take these > risks at present. Although I'd love to see the next Yahoo! or Amazon > startup use Zope, there's just no way the men holding the chequebooks would > allow it. > > If anyone's got any suggestions as to how Zope can be made into less of a > perceived business risk, I'd love to help make it happen, but it seems > beyond me at present. I couldn't of said it better if I tried - its this aspect of zope that I would like to help the community address. Can't get by on - try it you'll like it. From chrishbarker at attbi.com Tue Dec 11 17:02:18 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Tue, 11 Dec 2001 14:02:18 -0800 Subject: Help newbie! References: <9v5t5g$sp2$1@news.hccnet.nl> Message-ID: <3C16826A.F140E23D@attbi.com> Johan Barelds wrote: > >>> replace("hello","hel","hol") > Traceback (most recent call last): > File "", line 1, in ? > NameError: name 'replace' is not defined > ======================================================================== > What do i have to do to get the command "replace" working? you have two options: 1) it is a method of string objects: >>> oldstring = "hello" >>> newstring = oldstring.replace("hel","hol") >>> newstring 'hollo' 2) is is in the string module: >>> import string >>> string.replace("hello","hel","hol") 'hollo' >>> Also, check out: http://www.python.org/doc/current/tut/tut.html and http://www.python.org/doc/Newbies.html -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From fperez528 at yahoo.com Wed Dec 19 19:32:25 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Fri, 21 Dec 2001 00:00:25 +2328 Subject: Another distutils question Message-ID: <9vumpp$hn2$1@peabody.colorado.edu> For the distutils gurus out there: how can I specify a hierarchy of nested directories to be copied somewhere? I tried: data_files = [('doc/'+name,glob.glob('doc/*'))] where my doc/ directory has subdirs, but this fails when it encounters the first subdir name. I guess I could recreate the whole thing manually, but it seems so ungodly clumsy and ugly that I'm sure there must be a better way. This is Python after all, isn't it? :) Thanks for any help, f From claird at starbase.neosoft.com Thu Dec 27 20:53:22 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 27 Dec 2001 19:53:22 -0600 Subject: State of the SysAd art (was: vi or emacs for editing Python on Linux?) References: <2E48C714A6E1FBA1.19DE5ADEBF7F088A.DF90F2C1E6CC9E7C@lp.airnews.net> Message-ID: In article , Emile van Sebille wrote: . . . >> Then how are you getting onto the machine? I hope not plain old >telnet. >> Furthermore there are other options of gettimg things onto that machine >than >> scp. That was, of course, an example to point out that one doesn't need >to >> edit on that machine to get work done. I have been on a machine where ssh >was >> available but scp out of it was not. >> >> cat > sift.pl >> >> Any other questions or can we finally put the bullshit argument to >rest? >> > >I still support clients running xenix, sco, hpux and aix on dial-in modem >lines running getty. Sometimes I have to go on site because they don't have >dial-in capabilities. The argument may be bullshit for recent installs, and >yes I'd certainly prefer they all upgraded immediately. OTOH, vi works just >fine for all those cases where one needs to edit on the machine to get work >done. . . . What--no Ultrix? I entirely agree that in-place editing is not strictly necessary. I was arguing for ssh, CVS, and IP reacha- bility while some readers were ... well, younger than they are now. At the same time, I ask for tolerance of our brethren who cope with more conservative computing regimes. vi happens to fit my personal style better than emacs, but I'm very, very wary of generalizing that experience at all. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From DeepBlue at DeepBlue.org Mon Dec 10 11:18:36 2001 From: DeepBlue at DeepBlue.org (DeepBlue) Date: Mon, 10 Dec 2001 10:18:36 -0600 Subject: python cgi questions References: <8SRQ7.22622$zp5.1091695@typhoon.austin.rr.com> <5a4226f0.0112092040.5cf0cab1@posting.google.com> Message-ID: Kevin I got it working with the following: download file (or you can attach onClick to a button of type Button) the function download_submit(): function download_submit () { window.open('File_To_Download'); document.form1.submit(); } This is downloading and submitting. What you mention below was not doing both things. It was either or. The window.open() solves the problem. However, I still do not know how to run a script (by submitting a form) to update the database without refreshing the current page. I do not know if this is even possible. DeepBlue "DeepBlue" wrote in message news:u19hnsnqo9tt9e at corp.supernews.com... > > "Kevin Cazabon" wrote in message > news:5a4226f0.0112092040.5cf0cab1 at posting.google.com... > > I'd suggest going at it the other way around: > > > > Use a normal submit button for the form, and include an onclick to > > update the href location of the frame to the downloaded file. Kind of > > like: > > > >
> > > > > onclick="_self.location.href='/downloads/file.exe'"> > >
> > > I tried that and it would not work. It just ran myform.cgi > I changed the type from submit to button. Then it would download the file > but the form is not submitted. > DeepBlue > > > > I believe that will do what you want... try it out though first, of > > course, it's written off the top of my head. > > > > No cgi is really needed here, except myform.cgi for taking the info > > from the form and updating the database. You could even use a > > variable value in the onclick so that it downloaded a file specified > > by some other item on the form. > > (onclick="_self.location.href=self.form1.selectfieldname.value" > > > > Kevin Cazabon. > > > > > > > > "DeepBlue" wrote in message > news:<8SRQ7.22622$zp5.1091695 at typhoon.austin.rr.com>... > > > I have the following cgi python question. > > > I need to allow users to download files through a series of HREF links. > > > But also I need to be able to update a database table when a user clicks > on > > > the link. > > > So, each file to be downloaded is in its separate Form. And each link > has > > > an ONCLICK event that submits the form for the corresponding file. When > the > > > form is submitted I was hoping that the database is updated with values > in > > > hidden fields in each form, and the user can download the file. > > > But, I can accomplish only one thing: either the form is submitted or > the > > > file is downloaded. > > > Can both things be accomplished: > > > 1. File is downloaded when link is clicked, and > > > 2. Form is submitted through onclick event in javascript > > > (onclick=document.form.submit) > > > > > > > > > Also, is it possible using a python script to submit a form in the > > > background without anything being returned to the browser? > > > In this case, I send the information via the python script (form > submitted) > > > and the database is updated, but nothing is returned to the browser so > that > > > the current page stays as is. > > > Thanks for any help or hints, > > > DB > > From peter at engcorp.com Sat Dec 29 18:43:04 2001 From: peter at engcorp.com (Peter Hansen) Date: Sat, 29 Dec 2001 18:43:04 -0500 Subject: REPOST: Re: win32all-141 for Python 2.2 References: <3C2D4676.5060700@skippinet.com.au> <3C2D49E6.39FD96BE@earthlink.net> Message-ID: <5$--$$_----__$%_-$@news.noc.cabal.int> Ron Stephens wrote: > > Thanks, Mark. I really appreciate your efforts. I also suggest that > *anyone* and everyone* using Python and Windows rush out and buy your > book, Python Programming on Win32. Do you have any other book projects in > mind? >From what I understand of how book publishing works, Mark probably makes about 10 cents on each sale. ;-) It would be better to just send him a cheque! -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Peter Hansen Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E5508.7B5455C0 at engcorp.com> Control: cancel <3C2E5508.7B5455C0 at engcorp.com> Date: Mon, 31 Dec 2001 03:38:59 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774483 27193 211.57.49.2 (31 Dec 2001 04:54:43 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:54:43 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From wpmelcher at snet.net Fri Dec 7 07:52:05 2001 From: wpmelcher at snet.net (Bill Melcher) Date: Fri, 07 Dec 2001 12:52:05 GMT Subject: Polish the interface of applications References: <9uqdgq$j1a$1@pegasus.csx.cam.ac.uk> Message-ID: "Xiao-Qin Xia" wrote in message news:9uqdgq$j1a$1 at pegasus.csx.cam.ac.uk... > Hi, everybody, > > When I run my applications based on Tkinter, there is always a TK icon at > the left of the title line of the window (northerwest of window), is there > any way to replace it with my own icon (.bmp, jpg or gif)? I don't know about this -- I am new to Python and TK.....But > The other thing is when the application (main.py) is running under windows > XX, there is always a DOS window opened besides my application window. Is > there any way to avoid displaying the DOS window? Yes there is! Change the extension of the module you start your application with from .py to .pyw. So in this case, just rename main.py to main.pyw and you will no longer see the DOS window. > > Cheers, > > Xiao-Qin Xia > -- Cheers, Bill TANSTAAFL! From mkelly2002NOSPAM at earthlink.net Sun Dec 23 17:40:45 2001 From: mkelly2002NOSPAM at earthlink.net (Michael Kelly) Date: Sun, 23 Dec 2001 22:40:45 GMT Subject: Looping constructs References: <3c25d37e_9@news.newsgroups.com> Message-ID: On 23 Dec 2001 10:39:44 -0800, aahz at panix.com (Aahz Maruch) wrote: >That's not really true. OTOH, to make it not true, one has to stay away >from Perl esoterica.... Hmmmmm, Perl esoterica? Isn't that redundant? :) I thought the whole point of the language was to enable aficionados to minimize typing by using runes instead of English-like constructs. :) Mike -- "I don't want to belong to any club that would have me as a member." -- Groucho Marx From daniel.dittmar at sap.com Tue Dec 11 09:15:10 2001 From: daniel.dittmar at sap.com (Daniel Dittmar) Date: Tue, 11 Dec 2001 15:15:10 +0100 Subject: constructors for lists and tuples References: <1f5252d4.0112110519.2617d639@posting.google.com> Message-ID: <9v54df$7k2$1@news1.wdf.sap-ag.de> > what are the constructors for lists and tuples? I wanted to make a > list of a known size and then populate it. [...] > list (size, init=None) [None] * size You could do the same for tuples, but as tuples are immutable, that wouldn't be really useful for your purpose. > 2) I don't know where to find documentation on this. All the modules > document the constructors for their extensions, but looking at the > library reference, I didn't see anything documenting the complete > behaviour of the builtin list or tuple. The 'constructors' for builtin types are wired into the syntax, so this is described in the Language Reference (e.g. http://www.python.org/doc/current/ref/lists.html for lists). Daniel From henrik at moskau.hmotakef.homeip.net Mon Dec 17 17:19:40 2001 From: henrik at moskau.hmotakef.homeip.net (Henrik Motakef) Date: 17 Dec 2001 22:19:40 +0000 Subject: WYSIWYG text Editor in python? References: <3C1DDCAC.C477A0A6@cicei.ulpgc.es> <9vlgpe$o8v$1@news1.xs4all.nl> <9vlodr$32h$1@news1.xs4all.nl> Message-ID: <876675h4lf.fsf@moskau.hmotakef.homeip.net> boud at rempt.xs4all.nl (Boudewijn Rempt) writes: > > You know about scintilla / scite ? http://www.scintilla.org/ > Yes - it's written in C++, not Python It's usable in the standard wxPython install, via a class called wxStyledTextEdit or similar (I don't have access to the box where it's installed right now.) From tim.one at home.com Sun Dec 23 00:21:54 2001 From: tim.one at home.com (Tim Peters) Date: Sun, 23 Dec 2001 00:21:54 -0500 Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic In-Reply-To: <007201c18b6a$3c924e20$0101010a@local> Message-ID: [Chris Gonnerman] > Who are these people, and what are they doing in this list? This comes from the Usenet (comp.lang.python) side of the list -- language wars are often massively cross-posted to irrelevant groups, because one person does so for dubious reasons, and then everyone else doesn't bother to trim the x-posted newgroups from their replies. > I bear no malice toward any language (unless you count disgust > with Visual Basic or confusion with Perl) and would not engage > in such heated battle with anyone over any language. Wuss. > This is the only list I still subscribe to because 1) I love > Python and 2) the people, from GvR on down, are reasonable and > generally quite polite. We're working hard to change that, and are grateful to the splintered Lisp communities for showing us how far we still need to go. nobody-fights-like-identical-twins-ly y'rs - tim From freebird317 at hotmail.com Thu Dec 27 19:55:53 2001 From: freebird317 at hotmail.com (~Jason~) Date: Fri, 28 Dec 2001 00:55:53 GMT Subject: REPOST: Re: tcl??? References: <%FOW7.8662$7p6.139123@rwcrnsc51.ops.asp.att.net> Message-ID: <3$--$$_-----$%%-$$@news.noc.cabal.int> I am running XP; and the error I am getting when I type in "tclsh80" is [File"","line 1, in ? tclsh80 NameError: Name tclsh80' is not defined] "Cameron Laird" wrote in message news:F04033885EB8E6B4.9FC55B6D4BB76607.687DFFE1D62C3AA4 at lp.airnews.net... > In article <%FOW7.8662$7p6.139123 at rwcrnsc51.ops.asp.att.net>, > ~Jason~ wrote: > >I am playing around with Python and it is telling me that to activate tcl > >type tclch80. I do this and I get an error. I think may be it is because > >either I am typing in the wrong version or I do not have it? Am I right and > >if so how do I correct it? And if I am wrong, how do I fix it? What it > >wants me to do is type [% put "Hello World"] and I do that and I get an > >error, why? > . > . > . > I don't recognize this description--which likely > reflects more on my ignorance than your own pre- > cision. > > What operating system are you using? > > You're likely to get farther with > tclsh > rather than > tclch80 > and > puts "Hello World" > rather than > put "Hello World" > > It's likely that those in a position to answer you > will do so more swiftly and accurately when you > supply an exact error message, as opposed to, "I > get an error." Tell us which error. You might > like to read . > -- > > Cameron Laird > Business: http://www.Phaseit.net > Personal: http://starbase.neosoft.com/~claird/home.html ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "~Jason~" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:47:44 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775470 27193 211.57.49.2 (31 Dec 2001 05:11:10 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:11:10 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From DeepBlue at DeepBlue.org Fri Dec 14 09:28:00 2001 From: DeepBlue at DeepBlue.org (DeepBlue) Date: Fri, 14 Dec 2001 08:28:00 -0600 Subject: which book? References: Message-ID: Learning Python by Lutz and Ascher and Python Essential Reference 2nd Ed by Beazley At a more later stage: Programming Python 2nd Edition by Lutz For web application and Python, check amazon.com or bn.com and search for Python. DeepBlue "Preben" wrote in message news:I68S7.32$zw1.1838 at nreader1.kpnqwest.net... > I've been recommended to buy a Python book, > but I'm not sure which one I should buy.. > > Somebody told me to buy Python2.1 Bible. > Anybody got an opinion? > > From joel.quinet at be.unisys.com Tue Dec 11 12:42:44 2001 From: joel.quinet at be.unisys.com (Joel Quinet) Date: Tue, 11 Dec 2001 18:42:44 +0100 Subject: Unicode problem from SQL Server DB Message-ID: <9v5d52$psg$1@ih292.ea.unisys.com> Hi all, I have put a pdf file in a binary field in a sql server DB. When I read it back, I receive the double size of data. I suppose my data are encoded in unicode. How can I convert them ?? My test script follow Thanks import win32com.client mServer = '(local)' mUsr = 'sa' mPwd = '' mDb = 'TestDb' conn = win32com.client.Dispatch(r'ADODB.Connection') DSN = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=" + mUsr + ";" + "Password=" + mPwd + ";Initial Catalog= " + mDb + " ; Data Source=" + mServer + "" conn.Open(DSN) rs = win32com.client.Dispatch(r'ADODB.Recordset') rs_name = 'select * from TABLE1' rs.Open(rs_name, conn, 1, 3) #rs.AddNew #rs.Fields("Numero").Value = 1 #rs.Fields("Fichier").Value = '' #f = open ('./frgf00.pdf', 'rb') #data = f.read() #print 'Len : ', len(data) #rs.Fields("Fichier").AppendChunk (data) #f.close() #rs.Update() print rs.Fields("Numero").Value f = open('./temp.pdf', 'wb') data = rs.Fields("Fichier").GetChunk (1000000) f.write ( data ) f.close() rs.Close() conn.Close() From DaveP at dpawson.freeserve.co.uk Sun Dec 2 14:32:33 2001 From: DaveP at dpawson.freeserve.co.uk (Dave Pawson) Date: 2 Dec 2001 19:32:33 GMT Subject: fileinput.input problem Message-ID: Newbie question on text filtering. I'm filtering a file, containing a line such as I want the result to format the number as hh:mm:ss i.e. I need to pull the content (between quotes) and do the conversion. The conversion is not the problem, its finding 'everything' between quotes. I have def tits(str): """Swap time in this smil ='nnns' for hh:mm:ss format """ timeStringStart=string.find(line,'timeinthissmil') # line below is suspect. timeString=str[timeStringStart+16:timeStringStart+22] tim = eval(timeString) print "As int", int(tim) hrs= int(divmod(tim, 60)[0]) minsR = tim - (hrs * 60) mins = int(tim - (hrs * 60)) secs = int(60 *(minsR - mins)) tmp = string.zfill(`hrs`,2)+':'+string.zfill(`mins`,2)+':'+string.zfill (`secs`,2) return tmp How can I only select the part between quotes, so that it works with values ranging from 0.03 through to 1200.2 Any help appreciated. TIA DaveP From danielk at aracnet.com Sat Dec 29 13:11:00 2001 From: danielk at aracnet.com (Daniel Klein) Date: Sat, 29 Dec 2001 10:11:00 -0800 Subject: REPOST: Re: [Q] Deepcopy with Python 2.2 ? References: <440c5c6a.0112280847.55c92de7@posting.google.com> Message-ID: <5$--$$_----_%-_%$$@news.noc.cabal.int> On 28 Dec 2001 08:47:05 -0800, setar at gmx.de (Oliver Hofmann) wrote: >'lo everyone! > >I've had a few problems with copying objects lately when they >reference each other. My understanding is that deepcopy should >take care of that due to the memo - dictionary; this does not >seem to be the case. > >The following code works fine if Base does _not_ inherit >from object. If it does the result is: > >RuntimeError: maximum recursion depth exceeded You can increase the recursion limit using sys.setrecursionlimit() Daniel Klein ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Daniel Klein Newsgroups: comp.lang.python Subject: cmsg cancel <0m1s2uoptu84bpjvrjpeic6te3qf05s7q0 at 4ax.com> Control: cancel <0m1s2uoptu84bpjvrjpeic6te3qf05s7q0 at 4ax.com> Date: Mon, 31 Dec 2001 03:16:55 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774647 27193 211.57.49.2 (31 Dec 2001 04:57:27 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:57:27 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From stefan at snobis.de Sun Dec 30 06:14:02 2001 From: stefan at snobis.de (Stefan Nobis) Date: 30 Dec 2001 12:14:02 +0100 Subject: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> Message-ID: <87sn9tdkp1.fsf@520075220525-0001.dialin.t-online.de> gerson.kurz at t-online.de (Gerson Kurz) writes: > So ? After all, C doesn't need it, and I think few C programmers would > call this feature the "most missing", or? Take a closer look at the standard C libraries. They are *very* bad. I would call it very error-prone, if a function returns a value, that could be a correct value as good as an error code. This sort of in-band error-handling is the dead of every big library. So exception handling is very bad needed for good libraries. And that's are only the simpler issues. There are other issues like objects on the stack and the time, when they are destroyed and the like. That said i call every language broken, which does not have exception handling (or something similiar). -- Until the next mail..., Stefan. From sfam at mailandnews.com Sat Dec 1 23:16:37 2001 From: sfam at mailandnews.com (Kaden) Date: 2 Dec 2001 04:16:37 GMT Subject: Help with classes Message-ID: <9uc9v5$g69$1@news.xmission.com> Hello, I discovered Python a while back, but have just now had the time to actually look at it. I have experience with UNIX shell scripting and I know enough C/C++ to get a vague idea what the code is doing by reading it, although I can't write it to save my life. So I'm not a _complete_ idiot when it comes to programming, but I'm pretty close. So, with that here's the problem I'm having: I am playing with classes and trying to get the hang of them. I pretty much understand how inheritance and sub/superclassing goes I think. I just am having trouble figuring out how to get different classes to communicate with each other. The best way I can think to explain this is to post an example, so here's a nearly verbatum snippet from a tutorial I recently read: class Basket: def __init__(self,contents=None): self.contents = contents or [] def add(self,element): self.contents.append(element) print "You put the", element, "in your basket." def remove(self,element): self.contents.remove(element) print "You remove the", element, "from your basket." def print_me(self): result = "" for element in self.contents: result = result + " " + `element` print "You look in your basket and see:" + result class NiceBasket(Basket): def open(self): print "You open your basket." state = "open" def close(self): print "You close your basket." state = "closed" Now then, the above class works. However, I want to be able to add some checks, such as checking to see if NiceBasket is closed when you try to add soemthing to it. I can't figure out how to do this. That's where the 'state = ""' lines came in. I thought I'd set a variable and then have it checked. I don't know how to do this though. I played with a couple things, but couldn't get anything to work, so I just removed the things I tried and left the variables since they really aren't affecting anything at this point. The only way I could see this working is if the checks were done in the Basket class, but that would be the wrong place since NiceBasket is the class gives the baskets the ability to be opened. So any checks would have to be in NiceBasket, right? I'm not asking for anyone to do my homework for me or anything like that. If you have a URL that explains this that you could offer me that would be fine. I don't have a problem figuring things out on my own. I just don't know where to look to get the information I need to be able to do that. Thanks From jdhunter at nitace.bsd.uchicago.edu Sun Dec 30 21:43:51 2001 From: jdhunter at nitace.bsd.uchicago.edu (John Hunter) Date: Sun, 30 Dec 2001 20:43:51 -0600 Subject: Python and Ruby: a comparison References: <3C2B9A61.EE1618DB@earthlink.net> <2WpX7.1145$0s5.714029@news20> <3C2E6876.4CBF45D4@geneva-link.ch> <465v2u4lv3illoviq19nhdf1r2vcknbakn@4ax.com> Message-ID: >>>>> "Tim" == Tim Roberts writes: Tim> Oddly enough, I believe that is almost exactly what Bill Tim> Gates believes he has created with .NET and the common Tim> language runtime. And which Ximian and GNOME are bringing to the open source world with Mono: http://www.go-mono.org See also the article in this months Dr Dobbs by GNOME founder Miguel de Icaza and Brian Jepson: http://www.ddj.com/documents/s=1818/ddj0201a/0201a.htm They say that one of the reasons they decided to go with .NET is because it would reduce the cost of having to provide language bindings (python, tcl, perl, java etc) to the GNOME API. John Hunter From cuiod-tec at web.de Thu Dec 6 02:11:57 2001 From: cuiod-tec at web.de (Jens Gelhaar) Date: 5 Dec 2001 23:11:57 -0800 Subject: COMServer graphical output References: <_6tP7.5693$Rw2.4095674@newssrv26.news.prodigy.com> Message-ID: "dsavitsk" wrote in message news:<_6tP7.5693$Rw2.4095674 at newssrv26.news.prodigy.com>... > It doesn't seem that this is a COM question at all? The COM server should > get the data from Access, do whatever to the data, then return it as per > normal. What I trying to do is: The GUI is sending me same datas and I like to return a chart as a bitmap or something else. I know, I could write the bitmap in a file and open the file from the GUI, but this is simply to slow. > The server itself shouldn't have a GUI. It should just be an object like > any other. The GUI is ACCESS 2000 or VISUAL BASIC or something else but NOT Python. That means, even when I change to an "REAL" SQL-Server, my front end would still be VISUAL BASIC. The GUI would request some datas from the SQL-Server, send it to my Python COMServer and my COMServer would return a chart as a visualisation. Beside, I know I could do everthing in python (wxWindows, ZODB or Gadfly, Python). But unforternatly, I have some hardware interfaces with DLL drivers without source and not the time to put everthing together by my self with python. From michael at stroeder.com Thu Dec 27 14:21:28 2001 From: michael at stroeder.com (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Thu, 27 Dec 2001 20:21:28 +0100 Subject: REPOST: Re: A new message board is up References: <40dbad98.0112262232.1868734e@posting.google.com> <3C2B724D.E4D31E24@ccvcorp.com> Message-ID: <3$--$$_----_-$-%_$@news.noc.cabal.int> Jeff Shannon wrote: > [..] > I won't be participating in this Python EZBoard. I always wonder why people put "web forums" in place. I can't read them while being off-line (e.g. on the train) and they are damn slow. Newsgroups and mailing lists are the right medium for this kind of communication. Ciao, Michael. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Michael =?iso-8859-1?Q?Str=F6der?= Newsgroups: comp.lang.python Subject: cmsg cancel <3C2B74B8.D2FE36F5 at stroeder.com> Control: cancel <3C2B74B8.D2FE36F5 at stroeder.com> Date: Mon, 31 Dec 2001 02:05:42 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775620 27193 211.57.49.2 (31 Dec 2001 05:13:40 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:13:40 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From peter at engcorp.com Wed Dec 5 22:08:42 2001 From: peter at engcorp.com (Peter Hansen) Date: Wed, 05 Dec 2001 22:08:42 -0500 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <23891c90.0112040300.77f64f8e@posting.google.com> <23891c90.0112050738.60ed8b25@posting.google.com> Message-ID: <3C0EE13A.302F1857@engcorp.com> Ken Seehof wrote: > > I am promoting some new legislation that is currently being considered in > Congress. The new law will require that all programming languages must > treat the tab character as a syntax error by June 2004. Some details have > not yet been resolved, such as whether or not to permanently remove tab from > the new ASCII standard (this would have the side effect of decrementing the > ordinal values of all characters after 9). It is estimated that this will > save the computer industry several billion dollars worth of programming time > every year. Most of the savings are expected to be due to decreased > newsgroup volume on tab related topics. My god! Haven't you considered the environmental impact of having to dispose of all those tabs?! Where will we put them all? It's irresponsible ideas like this proposed by narrow-minded technologists that are the cause of so many of the world's ills today. For shame. (My suggestion would be that we send them into SPACE... ) From ajs at ix.netcom.com Sat Dec 29 10:24:54 2001 From: ajs at ix.netcom.com (Arthur Siegel) Date: Sat, 29 Dec 2001 10:24:54 -0500 Subject: Python Popularity: Questions and Comments Message-ID: <000b01c1907c$f898ea40$a9e1fea9@carol> Paul Prescod writes - >When one of Python's killer apps takes over the universe (Zope, Pygame, >Alice, Mojonation whatever), Python will take over the universe. I am confused by the discussion only to the extent that it is my perception that Python slower but surely *is* taking over the universe. Steady as we go. Precisely because of the reasons you point to. It is wonderfully general purpose, with an appeal to such a wide audience needing to solve widely divergent problems, and coming to *their* problem with widely divergent backgrounds and experience. The only misstep I can see at this point is to skew Python's development in a particular direction to solve a particular problem for a particular segment of its potential audience - whether it be the novices, biochemists, mathematicians or web application builders. Modules aside, of course. Art From aroach at electriceyeball.com Mon Dec 3 10:35:46 2001 From: aroach at electriceyeball.com (Anthony Roach) Date: Mon, 3 Dec 2001 10:35:46 -0500 Subject: python-friendly ISPs In-Reply-To: ; from Eugene.Leitl@lrz.uni-muenchen.de on Mon, Dec 03, 2001 at 02:38:28PM +0100 References: Message-ID: <20011203103546.A2558@stoic.electriceyeball.com> On Mon, Dec 03, 2001 at 02:38:28PM +0100, Eugene Leitl wrote: > I've just reread > http://www.corrt.com/info/pyisp-list.html > > Any interesting newcomers/other recommendations for Python-friendly web > hosts? I'm looking for something cheap, 100-500 MBytes space. >3 > GBytes/month traffic. I use PHP Webhosting (www.phpwebhosting.com). They have Python installed on every host, and they support CGI written in Python. Most hosts just have Python 1.5.2 installed, but they will install a newer version on request. They have unmetered disk space, but they limit you to 5GB/month of bandwidth. They charge $10/month for hosting. -- Homepage: http://www.electriceyeball.com Email: Anthony Roach PGP Key: http://www.electriceyeball.com/aroach.asc From kbanjara at hotmail.com Tue Dec 18 19:55:35 2001 From: kbanjara at hotmail.com (bigbadbull) Date: 18 Dec 2001 16:55:35 -0800 Subject: PoPy Install problems. Help! Message-ID: <9a928441.0112181655.1c1aa4ca@posting.google.com> Hello all: Getting PoPy itself was a small challenge, but installing it has been more so. I cant get it to compile. Below are the details. Can anyone help? Error on which compiler dies: ---------------------------- ././PoPymodule.c: In function `PoPy_lobDetector': ././PoPymodule.c:180: warning: implicit declaration of function `sem_wait' ././PoPymodule.c:180: `mutex' undeclared (first use in this function) ././PoPymodule.c:180: (Each undeclared identifier is reported only once ././PoPymodule.c:180: for each function it appears in.) make: *** [PoPymodule.o] Error 1 Platform: Redhat 7.1, Python 2.1., popy 2.0.8 -------- My Edits to get over previous problems: -------------------------------------- I copied all the mx header files into /usr/include. I also edited the following lines in PoPymodule.h: #include "/usr/include/pgsql/postgres.h" #include "/usr/include/pgsql/catalog/pg_type.h" #include "/usr/include/pgsql/libpq-fe.h" #include "/usr/include/pgsql/libpq/libpq-fs.h" They were in the form: #include Install Log: ----------- # ./autogen.sh --with-popy-blob=yes --with-python-version=2.1 ++ dirname ./autogen.sh + srcdir=. + PROJECT=PoPy python module + TEST_TYPE=-d + FILE=src + DIE=0 + test 0 -eq 1 + test -z '--with-popy-blob=yes --with-python-version=2.1' + autoconf + ./configure --with-popy-blob=yes --with-python-version=2.1 creating cache ./config.cache checking for python... /usr/bin/python checking python version... 2.1 checking python installation prefix... /usr checking python installation exec_prefix... /usr checking definitions in Python library makefile... done checking location of python library... $(prefix)/lib/python2.1/site-packages checking location of python shared modules... $(exec_prefix)/lib/python2.1/site-packages checking how to run the C preprocessor... gcc -E checking for mxDateTime.h... yes checking location of mxDateTime... /usr/lib/python2.1/site-packages/DateTime checking for PQconnectStart in -lpq... yes checking for strncasecmp... yes updating cache ./config.cache creating ./config.status creating Setup creating popy-config creating popy-config.1 creating INSTALL creating Makefile.pre creating Makefile + echo + echo 'Now type '\''make'\'' to compile PoPy python module.' Now type 'make' to compile PoPy python module. # ls aclocal.m4 config.cache configure.in INSTALL Makefile.pre.in popy-config.in README AUTHORS config.log COPYING INSTALL.in popy-config PoPymodule.c Setup autogen.sh config.status CVS Makefile popy-config.1 PoPymodule.h Setup.in ChangeLog configure debian Makefile.pre popy-config.1.in python-uninstall-log # make gcc -fPIC -Wstrict-prototypes -Wall -O6 -fomit-frame-pointer -DBLOB -I/usr/include/python2.1 -I/usr/lib/python2.1/config -DHAVE_CONFIG_H=1 -I/usr/include/postgresql -Wall -DVERSION=\"2.0.8\" -c ././PoPymodule.c -o ./PoPymodule.o In file included from PoPymodule.h:42, from ././PoPymodule.c:39: /usr/include/pgsql/catalog/pg_type.h:172: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:173: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:176: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:177: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:180: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:181: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:184: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:185: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:188: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:189: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:192: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:193: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:196: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:197: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:200: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:201: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:204: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:205: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:208: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:209: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:212: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:213: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:216: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:217: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:220: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:221: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:224: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:225: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:228: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:229: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:232: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:233: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:235: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:236: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:237: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:238: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:239: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:240: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:241: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:242: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:243: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:247: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:248: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:249: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:253: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:254: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:263: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:264: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:266: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:267: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:269: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:270: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:272: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:273: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:275: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:276: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:279: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:280: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:282: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:283: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:287: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:288: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:290: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:291: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:293: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:294: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:296: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:297: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:299: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:300: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:302: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:303: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:306: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:307: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:309: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:310: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:311: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:313: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:316: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:317: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:318: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:319: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:321: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:322: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:328: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:329: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:330: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:331: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:332: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:333: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:334: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:335: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:336: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:337: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:338: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:339: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:340: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:341: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:342: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:343: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:344: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:345: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:346: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:347: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:348: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:349: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:350: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:351: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:352: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:353: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:354: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:361: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:362: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:363: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:364: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:365: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:366: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:367: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:368: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:370: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:371: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:374: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:375: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:377: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:378: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:382: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:383: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:384: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:385: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:387: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:388: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:389: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:391: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:394: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:395: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:396: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:398: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:401: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:402: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:404: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:405: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:406: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:408: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:413: warning: function declaration isn't a prototype /usr/include/pgsql/catalog/pg_type.h:414: warning: function declaration isn't a prototype ././PoPymodule.c: In function `PoPy_lobDetector': ././PoPymodule.c:180: warning: implicit declaration of function `sem_wait' ././PoPymodule.c:180: `mutex' undeclared (first use in this function) ././PoPymodule.c:180: (Each undeclared identifier is reported only once ././PoPymodule.c:180: for each function it appears in.) make: *** [PoPymodule.o] Error 1 From wurmy at earthlink.net Thu Dec 6 11:35:19 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Thu, 06 Dec 2001 16:35:19 GMT Subject: getting the name of a variable References: Message-ID: <3C0F9C39.F9427A83@earthlink.net> Sandy Norton wrote: > > When I'm debugging I'm always sticking stuff like "print 'x:', x" in my code. > So is there a handy function that will print a variable name and value such that: > > >>> def print_var_name_and_value(var): > "prints variable name : value" > > > >>> variable = 'me var' > >>> print_var_name_and_value(variable) > variable : me var > > Any responses, pointers, hints would be much appreciated. I don't think "variables" have a notion of their name; essentially they are objects floating somewhere in memory, with a name (or multiple names) in a namespace referring to them. Some objects do have a __name__ attribute, like classes, but even this doesn't always return the desired result: >>> class Foo: pass >>> Bar = Foo >>> Bar.__name__ 'Foo' # instead of "Bar" Aside from that, objects can have multiple names bound to them, all of which are equally valid: >>> l = range(10) >>> m = n = l In other words, the list object doesn't keep track of all the names referring to it... therefore it cannot "know" what its name is, and even if it did keep track, there is not just one name. You can do some trickery with globals(), like Daniel Klein did, but this only works for the global namespace; you're out of luck when you want to use this debugging construct inside a function. --Hans From syt at gemini.logilab.fr Mon Dec 10 12:01:16 2001 From: syt at gemini.logilab.fr (Sylvain Thenault) Date: Mon, 10 Dec 2001 17:01:16 +0000 (UTC) Subject: "import" analysis Message-ID: I didn't found anything interesting about this on google: does anyone know a tool which parse a project's files and tell you which modules are imported but not present in the parsed project nor in the standard python library ? TIA -- Sylvain Thenault LOGILAB http://www.logilab.org From phony_address at yahoo.com Tue Dec 4 08:39:22 2001 From: phony_address at yahoo.com (Phredd Phlintstone) Date: Tue, 04 Dec 2001 13:39:22 GMT Subject: Any magazines about Python? Message-ID: <3c0cd177.5568479@news> I like to read away from my computer, and am wondering if any of the popular computer magazines have regular articles/columns about Python? I am very newbie, and starting to understand just the most basic programming principles from the Gauld book, "Learn to Program Using Python." I know about online resources but am wondering if my local magazine rack has any promise. Thanks Please post any responses to this to this newsgroup. From Tom.Karas at htp-tel.de Mon Dec 17 17:43:58 2001 From: Tom.Karas at htp-tel.de (Tom Karas) Date: Mon, 17 Dec 2001 23:43:58 +0100 Subject: do not know what is wrong python under win2k Message-ID: <3C1E752E.8864E2E9@htp-tel.de> Hello folks, i went to the libary to get a copy of "Learning Python" where it is written that i should write: import sys print sys.argv into a file called "spam.py" and after that i should do the following: >>> python spam.py -i eggs -o bacon but i got the following error Traceback ( File "", line 1 python spam.py -i eggs -o bacon ^ SyntaxError: invalid syntax although i saved the file "spam.py" into the same directory where the python.exe is located. What did i made wrong - i am conviced i did exactly like it was written in the book. Any help appreciated Best regards tom karas From fperez528 at yahoo.com Thu Dec 6 17:38:48 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Fri, 07 Dec 2001 22:06:48 +2328 Subject: Good book for Learning Python?? References: Message-ID: <9us76v$6j3$1@peabody.colorado.edu> Syver Enstad wrote: > "gsmickle" writes: > >> Hello All, >> >> I am new to the list and would like to get some input on some good >> books for learning Python? > > For win32 o'reillys python programming on win32 by Hammond and > Robinson. > > Another good one is Programming Python (also o'reilly) > Sorry but no, that's not a book for *learning* Python. It's a heavy duty language reference. Oddly enough, O'reilly publishes a book called 'Learning Python', whose intended purpose I suspect is more inline with the original poster's request. Cheers, f. PS. And once you need a language reference, I'd suggest holding back on the monster Programming Python and just get Beazley's 'Python Essential Reference'. It seems to cover all you need for a fraction of the weight. Between it and the builtin docs (use the indices wisely), my copy of Programming Python gets opened about once a month. From bkc at Murkworks.com Sun Dec 30 11:27:19 2001 From: bkc at Murkworks.com (Brad Clements) Date: Sun, 30 Dec 2001 11:27:19 -0500 Subject: CEPort: I Need help with compile.c bug Message-ID: <3c2f4102_5@news.newsgroups.com> Sorry to post here, but I'm trying to figure out where in the 2.2 code to look to solve this problem. I'm porting the release22-maint CVS checkout to CE 3.0 Seems to work okay, except that many of the regression tests fail because the CE port is casting numbers to long somewhere... so numeric output has L at end. I'm looking for a suggestion where to look in the code. It's on input, not output, that the problem is occuring. I'm looking at the diffs and nothing seems to stick out. Thanks for any suggestions.. Here's an example on CE 3.0 >>> import dis >>> def a(): x = 1 >>> dis.dis(a) 0L SET_LINENO 1L 3L SET_LINENO 1L 6L LOAD_CONST 1L (1L) 9L STORE_FAST 0L (x) 12L LOAD_CONST 0L (None) 15L RETURN_VALUE >>> x = 1 >>> type(x) >>> On Python 2.1 for Windows, I get: >>> def a(): ... x = 1 ... >>> dis.dis(a) 0 SET_LINENO 1 3 SET_LINENO 2 6 LOAD_CONST 1 (1) 9 STORE_FAST 0 (x) 12 LOAD_CONST 0 (None) 15 RETURN_VALUE >>> x = 1 >>> type(x) -- Brad Clements, DevNet Sysop 5 Developer Network Sysop Team -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- From aleax at aleax.it Mon Dec 17 16:11:32 2001 From: aleax at aleax.it (Alex Martelli) Date: Mon, 17 Dec 2001 21:11:32 GMT Subject: Why no match? References: Message-ID: <8ctT7.13638$o9.556973@news1.tin.it> Robin Becker wrote: > I'm puzzled as to why the second of these pattern matches fails. They > only differ in that the second is supposed to match to the end of line. > Can any regexpert supply an answer? While waiting for regexperts, here's my take on it: >>>> import re >>>> re.compile(r'^self\s*\.\s*test\s*=\s*\d\s*').match('self.test=11') > Sure, this matches -- look at the end of the pattern: an equal sign, 0 or more spaces, one digit, zero or more spaces, no constraints on what comes after. This part I just described in words matches the '=1' part of the argument to method match, no? >>>> re.compile(r'^self\s*\.\s*test\s*=\s*\d\s*$').match('self.test=11') >>>> But this specifies that the string ends after the match, and it doesn't, as it has an extra digit '1' at the end. So, the result is None. Maybe you want \d+ (one *or more* digits) in the pattern rather than just \d (*exactly* one digit) as you have now? Alex From freebird317 at hotmail.com Fri Dec 28 15:29:50 2001 From: freebird317 at hotmail.com (~Jason~) Date: Fri, 28 Dec 2001 20:29:50 GMT Subject: Help with TCL Message-ID: <2D4X7.19180$uM.182933@rwcrnsc54> I am trying to learn programming. I am running XP Pro. and when I try to run tcl I get the following error [File"",line 1, in ? tclsh80 nameerror: name tclsh80' is not defined] why am I getting this error and how do I correct it. I even changed it to tclsh83 which is what the folder says my version is. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If GOD be for us, who can be against us? ~ Romans 8:31~ Jason Lehman freebird317 at hotmail.com From max at alcyone.com Tue Dec 4 01:57:07 2001 From: max at alcyone.com (Erik Max Francis) Date: Mon, 03 Dec 2001 22:57:07 -0800 Subject: minidom References: <9uhr26$nfs$1@newsg1.svr.pol.co.uk> Message-ID: <3C0C73C3.A3A0325D@alcyone.com> Duncan Smith wrote: > This may be a stupid question, but I'm struggling. I can retreive > information from an XML file (using minidom) as long as it is a node > attribute. But I cannot figure out how to get data otherwise. eg. > > > > EngineStart Leak > > good > > bad > > XPOS etc. no problem. But how (using minidom) do I retreive 'Engine > Start > Leak' and 'good' etc? Anyone know of any good documentation / worked > examples for minidom? Thanks in advance. If VAR is your root element, then the other element nodes are children of it. If not and there's a different root element, then all these element nodes are siblings of it. Nodes are arranged in a hierarchical structure: VAR element [with attributes] DESCRIPTION element text node ("EngineStart Leak") STATENAME element text node ("good") STATENAME element text node ("bad") Traverse the tree by looking at the childNodes attribute (Python attribute, not XML attribute). -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ Laws are silent in time of war. \__/ Cicero Esperanto reference / http://www.alcyone.com/max/lang/esperanto/ An Esperanto reference for English speakers. From pinard at iro.umontreal.ca Mon Dec 17 16:55:53 2001 From: pinard at iro.umontreal.ca (=?iso-8859-1?q?Fran=E7ois?= Pinard) Date: 17 Dec 2001 16:55:53 -0500 Subject: request: more samples for Pymacs, please In-Reply-To: References: Message-ID: [Fran?ois Pinard] > I was not expecting Pymacs > to work on Windows-9x, as so far that I know, there are now sub-processes > there. Oops! Please replace `now' by `no' in the sentence above. English is a strange language for me, in which small errors may have a wide effect on the meaning. Errors that I make far too easily... sorry! -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From khartlage at t-online.de Sun Dec 30 14:19:14 2001 From: khartlage at t-online.de (Klaus Hartlage) Date: Sun, 30 Dec 2001 20:19:14 +0100 Subject: REPOST: Re: Call for a small program - willing to give a bonus References: <3C2F2186.52BF5D0C@htp-tel.de> Message-ID: <2$--$$_----__$_%-$@news.noc.cabal.int> Tom Karas wrote: > Hello out there. > ..... > > Hello out there, > who wants to practice his skills and make the start of a language > learn > software. .... > Later the program should also be able to play sound. I heard, > this could be difficult with python !? > > So maybe Java would be a better bet ? > > I am even willing to pay a little for the solution that fits some basic > needs, > but because i am a student this will be more like a little bonus. Suggestion: Write to a shareware/freeware author and ask him to add the required functionality!? Example for a Java program: http://www.jlearnit.com/ ( "JlearnIt is a multilingual dictionary sorted by categories that helps you to learn the vocabulary of another language progressively" ) -- Klaus Hartlage Math java project: http://www.hartmath.org Riding the Java wave: http://www.jsurfer.org ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Klaus Hartlage Newsgroups: comp.lang.python Subject: cmsg cancel <3C2F68B2.2000101 at t-online.de> Control: cancel <3C2F68B2.2000101 at t-online.de> Date: Mon, 31 Dec 2001 03:37:08 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774114 27193 211.57.49.2 (31 Dec 2001 04:48:34 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:48:34 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jeff at ccvcorp.com Fri Dec 21 13:50:43 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Fri, 21 Dec 2001 10:50:43 -0800 Subject: Bug in % string formatting? References: <9vtiev$no8$1@peabody.colorado.edu> <871yhp7guv.fsf@ifm.uni-kiel.de> <9vtk6h$ojk$1@peabody.colorado.edu> <3C225BBC.2D06CB8@alcyone.com> Message-ID: <3C238483.1E68D4C3@ccvcorp.com> Michael Hudson wrote: > > > The reason is because % is also the modulo division operator. > > Which is in turn a reason for not overloading operators too much. > Anyone ever done this: > > cout << var ? "true" : "false"; > > in C++? It was *years* before I realised why that didn't work... There's a reason that I tend to throw in lots of extra parenthesis. :) (I don't know the precedence in the above case, but I would've thrown the ?: clause in parens just on general principles.) Besides, even when I know that the operator precedence works right without parens, it makes the intent a little more clear in most cases, by visually grouping subexpressions together. Well, at least until you get so many subexpressions that it starts looking like Lisp.... ;) Jeff Shannon Technician/Programmer Credit International From donn at u.washington.edu Fri Dec 28 14:31:08 2001 From: donn at u.washington.edu (Donn Cave) Date: 28 Dec 2001 19:31:08 GMT Subject: REPOST: Re: imaplib : password with accented chars in login commands References: Message-ID: <1$--$$_----_---_$$@news.noc.cabal.int> Quoth Samuel Krempp : | when I try using "?" as a password in the login command, the imaplib | command raises exceptions. | | import imaplib | M=imaplib.IMAP4('imap.free.fr') | M.login("toto", "bla?bla") | | imaplib.error: LOGIN command error: BAD ['Missing required argument to | LOGIN'] | | It's quite a problem, since I wished I could use any french character | in my passwords, | But I am not sure whether this is a bug in imaplib or a 'feature' of | the IMAP protocol, because the documentation | http://www.python.org/doc/current/lib/imap4-objects.html | says something I don't fully understand, | about always quoting string used as password in the login command. | | Is this a bug, or am I doing something wrong ? Some individual IMAP4 commands support an optional CHARSET modifier, but in general the character set is assumed to be ASCII, which doesn't include that character. It's a feature of the protocol. That's how it looks to me, anyway. Donn Cave, donn at u.washington.edu ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Donn Cave Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:19:49 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775108 27193 211.57.49.2 (31 Dec 2001 05:05:08 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:05:08 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jkraska at san.rr.com Fri Dec 28 17:26:55 2001 From: jkraska at san.rr.com (Courageous) Date: Fri, 28 Dec 2001 22:26:55 GMT Subject: Python on the desktop References: <94e3fce8.0112210053.2568529d@posting.google.com> <3C238618.9F54E5CA@attbi.com> Message-ID: On Fri, 28 Dec 2001 13:17:01 -0800, Cliff Wells wrote: >On Sun, 23 Dec 2001 07:11:36 GMT >Courageous wrote: > >> Indeed VC kills me some days. Surely thou understoodeth the >> sardonic aspect of my message. > >Sorry, the xmas spirit must have desensitized my irony detector =) I was responding as could only someone who's actually been exposed in detail to Microsoft's hegemoney. Um. I feel that I need to point out that my misspelling above is deliberate. C// From cliechti at gmx.net Fri Dec 28 21:47:57 2001 From: cliechti at gmx.net (Chris Liechti) Date: 29 Dec 2001 03:47:57 +0100 Subject: [Q] how to use IDLE in linux References: Message-ID: "Young-Jin Lee" wrote in news:vA3X7.5252$tg4.66909 at vixen.cso.uiuc.edu: > Hi, I have problem using IDLE in Linux. I installed Python 2.2 and > tried to launch IDLE, but it didn't work. > I read the on-line document for IDLE and it says that I needed to just > type "idle", but it didn't work for me. > What am I supposed to do to use IDLE in Linux? > TIA. > > YJ tell us more about the error message you get. is the command "idle" not recognized or is it a python error complaining about missing tkinter? -- Chris From mwh at python.net Thu Dec 20 05:45:24 2001 From: mwh at python.net (Michael Hudson) Date: Thu, 20 Dec 2001 10:45:24 GMT Subject: stackless python References: <9vpjds$due$1@usc.edu> <9vrsnu$e6n$1@usc.edu> Message-ID: "John DeWeese" writes: > Bill Tate wrote: > > What do you want to know? As you see development on stackless seems > > largely to be stalled, but I believe there are plenty of people still > > using it. That wasn't Bill, that was me. Cheers, M. From eljqds at westoleyourmoney.com Thu Dec 6 23:44:01 2001 From: eljqds at westoleyourmoney.com (eljqds at westoleyourmoney.com) Date: Fri, 07 Dec 2001 04:44:01 GMT Subject: BREAKING NEWS ON PAYPAL SCAM!!!!! 7170 Message-ID: IF YOU HAVE A PAYPAL ACCOUNT YOU MAY WANT TO CLOSE IT AFTER YOU READ THIS BREAKING NEWS FROM ZDNET, CNN AND NEWYORK TIMES! CLICK HERE: http://www.paypalwarning.com/Default.htm oiptxhxewi From n64fan2017 at aol.com Mon Dec 3 21:24:12 2001 From: n64fan2017 at aol.com (N64fan2017) Date: 04 Dec 2001 02:24:12 GMT Subject: A pretty dumb newbie question Message-ID: <20011203212412.12737.00000727@mb-cs.aol.com> How would you calculate square root? I've tried x**1/2 Which doesn't work Anbody? From jadestar at idiom.com Sat Dec 29 10:52:06 2001 From: jadestar at idiom.com (James T. Dennis) Date: 29 Dec 2001 15:52:06 GMT Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> <7xlmfxvbx7.fsf@ruckus.brouhaha.com> <3dbsgt7f0e.fsf@ute.mems-exchange.org> <7xheqkr05q.fsf@ruckus.brouhaha.com> Message-ID: Paul Rubin wrote: > "Fredrik Lundh" writes: >>> Not bugs per se unless perfect backward compatibility was >>> an overriding concern. >> it isn't. > It's a bug if something is gratuitously, unnecessarily incompatible, > like "rand" disappearing. What was the reason for that? While that topic has come up: I find whrandom to be an unsightly name for accessing a set of functions which is so commonly accessed by novice students. What was wrong with must calling it rand or random? Is it pure pedantry? From laz at netg.se Wed Dec 5 12:18:13 2001 From: laz at netg.se (Fredrik Juhlin) Date: Wed, 5 Dec 2001 17:18:13 +0000 (UTC) Subject: PyInline problem References: <9uljcb$8ap$1@newsg4.svr.pol.co.uk> Message-ID: <9ulksl$f0o$1@endevour.netg.se> Duncan Smith wrote: : Can anybody tell me why this won't build? : int myfunc(int a) { ^ : if(n < 0){ ^ Because you are using different variable names, perhaps? : exit(1); : } : return a * (a+1); : } obIHaveNeverUsedPyInlineDisclaimer //FJ From tbryan at python.net Mon Dec 3 22:29:56 2001 From: tbryan at python.net (Tom Bryan) Date: Tue, 04 Dec 2001 03:29:56 GMT Subject: Distutils bdist_rpm missing licence option? References: Message-ID: Michael Hudson wrote: > Tom Bryan writes: > >> I'm using Distutils-1.0.2 with Python-1.5.2. I'm trying to build an RPM >> for PyUnit. Here's my .cfg file > A wild guess, but could you put the licence option somewhere global to > distutils rather than specific to bdist_rpm? Thanks. That put me onto the right track. It looks like the setup.cfg file can only override options specific to the individual setup targets, such as bdist_rpm. Some options can only be specified during the call to the setup function itself. I think that the Distutils docs might state this fact, but it is a subtle point that seems easy to miss. This design decision seems wise since the author probably doesn't want packagers to override options like "licence". I finally noticed that the chart that lists the "licence" option states "Distutils setup script option" while the options on the following page of my hardcopy are in a separate chart that staties "bdist_rpm option". The fact that the charts printed out on separate pages probably didn't help. Next time, I'll stick to the online docs. :-) here-we-go-a-packaging-ly y'rs, ---Tom From wpmelcher at snet.net Sun Dec 16 18:05:51 2001 From: wpmelcher at snet.net (Bill Melcher) Date: Sun, 16 Dec 2001 23:05:51 GMT Subject: Take 2: PEP draft for expression embedding References: <9vj0eq$593$2@peabody.colorado.edu> Message-ID: > > Sorry for being lazy, but since you've already done the search homework, > would you mind pointing to Frederik's post on i()? I've never seen it and I'm > quite intrigued. > There is a reason why you havn't seen it, you havn't written it yet! :-) I found this on www.google.com the groups tab then Advanced groups search. Unfortunately google anounces that they no longer archive comp.lang.xxxx PEP: XXXX Title: String interpolation with backquotes Author: oren at hishome.net (Oren Tirosh) Created: 2-Dec-2001 Abstract This document proposes a string interpolation feature for Python to allow easier string formatting. The suggested syntax change is the introduction of a new 'i' prefix for strings that triggers the special interpretation of the backquote "`" character within a string. Example: i"X=`x`, Y=`calc_y(x)`." Message 25 in thread From: Fredrik Lundh (fredrik at pythonware.com) Subject: Re: Draft PEP: string interpolation with backquotes Newsgroups: comp.lang.python View this article only Date: 2001-12-04 07:43:12 PST Oren Tirosh wrote: > As for the issue of interpolation with backticks being equivalent to str() > rather than repr() - I believe most people won't even notice. anyone who proposes to use backticks extensively in a programming language should be forced to travel around the world for a couple of months, trying out different keyboards. besides, the following is only a few characters longer than your suggested notation (and probably fewer keypresses on my key- board), works with all existing Python versions, and also with all existing syntax-aware tools: i('X=', x, ', Y=', calc_y(x), '.') coding the "i" function is left as an exercise for the interpolating reader. -- Cheers, Bill TANSTAAFL! From drew_csillag at geocities.com Fri Dec 21 09:20:01 2001 From: drew_csillag at geocities.com (Drew Csillag) Date: Fri, 21 Dec 2001 09:20:01 -0500 Subject: Tar-like module? In-Reply-To: <20011221022407.GA22502@home.com>; from scott@fenton.baltimore.md.us on Thu, Dec 20, 2001 at 09:24:07PM -0500 References: <20011221022407.GA22502@home.com> Message-ID: <20011221092001.A1152@localhost.localdomain> On Thu, Dec 20, 2001 at 09:24:07PM -0500, Scott Fenton wrote: > This may be an idiotic question, but is there a module > to read tar files in python? I googled around and > couldn't find anything, and the Python Std Library docs > didn't have anything. Any help would be nice. As far as I know there isn't, but I've written the following module which I've been using. This (or something like it) should probably be in the standard library as this question comes up often enough. Guido...Hint... Hint... Cheers, Drew """Module for reading tar files""" import string import struct def _checksum(ck, contents): sum = 0L for i in contents: sum += 0xFFL & ord(i) for i in contents[148:156]: #treat checksum bytes as spaces sum -= 0xFFL & ord(i) sum += ord(' ') return sum == ck def _cvtnulloctal(f, k=None): zi = f.find('\0') if zi > -1: f = f[:zi] try: return string.atoi(f, 8) except: return 0 def _tarstr(f): zi = f.find('\0') if zi > -1: f = f[:zi] return f def _tf(name, *args): print name def readTar(fileObj, tarEater=_tf): """Read through the contents of a tar archive fileObj is a file (or file-like) object tarEater is a callable object which takes the following arguments: name, contents, size, mode, uid, gid, mtime typeflag, linkname, uname, gname, devmaj, devmin """ while 1: header = fileObj.read(512) if len(header) != 512: raise EOFError, 'Unexpected end of tar stream' (name, mode, uid, gid, size, mtime, cksum, typeflag, linkname, ustar_p, ustar_vsn, uname, gname, devmaj, devmin, prefix) = struct.unpack( '100s8s8s8s12s12s8s1s100s6s6s32s32s8s8s155s', header[:504]) name, linkname, uname, gname, prefix = map(_tarstr, ( name, linkname, uname, gname, prefix)) mode, uid, gid, size, mtime, cksum, devmaj, devmin = map( _cvtnulloctal, (mode, uid, gid, size, mtime, cksum, devmaj, devmin)) if name: try: typeflag = { '': 'regular', '0': 'regular', '\0': 'regular', '1': 'link', '2': 'symbolic link', '3': 'character special', '4': 'block special', '5': 'directory', '6': 'fifo', '7': 'reserved', }[typeflag] except: raise KeyError, 'unknown file type in tar %X <%s> ' % (ord(typeflag), name) blocks_to_read = size / 512 if size - (blocks_to_read * 512): blocks_to_read += 1 contents = fileObj.read(blocks_to_read * 512) contents = contents[:size] if prefix: name = prefix + name if name: ecount = 0 else: ecount += 1 if ecount == 2: break if name: #null name fields are normal in tar files, so have to check #here you would do whatever you wanted with the information #in: name, linkname, uname, gname, mode, uid,gid,size,mtime,devmaj #devmin, contents if not _checksum(cksum, header): raise ValueError, "checksum error -- %s" % name tarEater(name, contents, size, mode, uid, gid, mtime, typeflag, linkname, uname, gname, devmaj, devmin) if __name__ == '__main__': import sys if sys.argv[1][-2:] == 'gz': import gzip readTar(gzip.GzipFile(sys.argv[1])) else: readTar(open(sys.argv[1])) From jkraska at san.rr.com Tue Dec 11 02:11:06 2001 From: jkraska at san.rr.com (Courageous) Date: Tue, 11 Dec 2001 07:11:06 GMT Subject: questions about of writing python scripts References: Message-ID: <00cb1use1enskedt8qnqee64mvnsmonoht@4ax.com> >Just because Python doesn't _force_ type checking doesn't mean it >isn't possible. Quite true. For example, it's not only possible but also fairly easy to create objects which, through use of metadata, ascertain the validity of assigning specific name-value pairs with specific types to an instance of a particular object. I'd be surprised if something like that isn't already out there. C// From robin at jessikat.fsnet.co.uk Wed Dec 12 05:26:08 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Wed, 12 Dec 2001 10:26:08 +0000 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C100BB2.6446E896@cosc.canterbury.ac.nz> <7da8d8f8.0112070206.49e1bef4@posting.google.com> <3C114F6D.D1E2D291@attbi.com> <3C1441D6.A648257F@cosc.canterbury.ac.nz> Message-ID: In article , Harald Hanche-Olsen writes .... >No, no, no. I never meant to advocate a TimeOfDay class without >reference to the date. If you need to specify a time, you need the >date to go with it, or the time is useless. So there should be a Date >or Calendar class that merely understands dates and calendars, with no >reference to time of day. And there should be a Time class, which >specifies a time by giving both the date (from the former class) and a >time of day. (Complete with time zone information.) All I'm saying >is that the first module needs to be nailed down dead solid before >you even start tackling the second. > I agree with this approach, but would beg the implementors of the Date class to allow for the possibility of different sequencing. For example I have modified NormalDate to get a subclass of NormalDate that does business dates (ie misses out Sat/Sun), but that also has a sequence representation (scalar value) that is gapless. With a BD corresponding to a Monday subtracting 1 gives a BD of the preceding Friday. There are also many other useful date 'frequencies' eg weekly, monthly, quarterly yearly etc etc. -- Robin Becker From dgrisby at uk.research.att.com Mon Dec 17 13:35:26 2001 From: dgrisby at uk.research.att.com (Duncan Grisby) Date: 17 Dec 2001 18:35:26 GMT Subject: python and SOAP?? References: Message-ID: <9vldte$hn7$1@pea.uk.research.att.com> In article , Steve Holden wrote: >"John Thingstad" wrote ... >> I feel the need to spesify that SOAP is a protocol created to send Object >transcripts over the HTTP protocol. >> CORBA however existes for objects to communicate over the lLAN. >> CORBA (or for that matter DCOM) must be fast as it is created to allow a >cluster of objects distributed over multiple machines to exchange date. > >I am not a CORBA expert, but I don't see anything in the protocols that >wouldn't work over the wide area, and I believe it has been used in this >way. Indeed. CORBA works fine in the wide area. See this, for example http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81254 To export the public server on spud.uk.research.att.com, I just had to convince our sysadmins to open the right port on the firewall. >> SOAP works as a much higher level of abstartion. Say communication >> with a bank. Further CORBA will usually be blocked from internet >> accesss. SOAP using HTTP protocol will not. > >Indeed, although given that firewalls are normally installed precisely to >PREVENT the kind of thing you can do with SOAP one wonders how long this >state of affairs is likely to last. I have alsways felt that this aspect of >SOAP's justification was pretty bogus. I think so too. Tunnelling everything through a port that's normally used for "safe" things like web servers is not a proper, secure, solution. This is a good discussion of using HTTP for other protocols: http://www.ietf.org/internet-drafts/draft-moore-using-http-01.txt The main problem with CORBA and firewalls is actually not in convincing the powers-that-be to open a port for the server, it's that you often want to use callback objects, where the server opens a connection back to the client. CORBA has solved this problem to an extent with bi-directional connections, where the same TCP connection used for the outgoing call is used for the callback. That can only work if the client keeps its connection open, of course, so it's not a complete solution. SOAP (and XML-RPC, etc) avoids this problem by not supporting callback objects at all. That can hardly be seen as an advantage. Cheers, Duncan. -- -- Duncan Grisby \ Research Engineer -- -- AT&T Laboratories Cambridge -- -- http://www.uk.research.att.com/~dpg1 -- From aleax at aleax.it Fri Dec 28 06:22:49 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 12:22:49 +0100 Subject: base64.decodestring gives binascii.error References: <3C2C03CB.7030000@pacific-shores.com> Message-ID: "Erik Myllymaki" wrote in message news:3C2C03CB.7030000 at pacific-shores.com... > should base64.decodestring give a binascii.error if it encounters > special chars like '_' and '!' ? Makes sense to me; after all, such characters should never be in a string produced by base64, so the data must have been damaged in transit -- raising an exceptions seems appropriate. Alex From paul at prescod.net Fri Dec 28 23:16:01 2001 From: paul at prescod.net (Paul Prescod) Date: Fri, 28 Dec 2001 23:16:01 -0500 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> <3C2D1833.1D481943@earthlink.net> Message-ID: <3C2D4381.D795F71F@prescod.net> Ron Stephens wrote: > >... > > Does anyone know how old PHP is? I'd really like to know. I have not been aware of PHP for much > more than two years, but then I wasn't paying any attention before that. When was PHP "launched"? > > How did it grow so fast? Can the Python community learn anything from this phenomenon? Can we even > incorporate some of the good points from PHP for web programming into Python, or Python add-on > "products"? PHP is a language absolutely optimized to solve a particular problem. PHP's inventor does not try to claim that it is the best programming language. Rather he claims that it is the programming language that is completely optimized for solving one and only one problem: dynamic web pages. What can Python learn from PHP? A killer app is killer. It's the fastest route to popularity. On the other hand, it is also the fastest route to oblivion. TCL had two killer apps: Expect and Tk. In the early days, its developers were quite open about the fact that it wasn't designed for "complex algorithms or data structures". PHP developers often say the same sorts of things about PHP. If PHP's killer app ever goes away, or another language solves the same problem more easily, then I would expect PHP to go away with it. That won't happen to Python. One can easily make the case that every one of today's popular language had a killer app or problem and came along at just the right time to solve it. C was the programming language of the freely available Unix operating system. Perl was the scripting language for it (when enough cycles became available that the existing ones started to look anemic). VB was the language behind a revolutionary GUI builder. Java was the applet language and then migrated to being the servlet language. When one of Python's killer apps takes over the universe (Zope, Pygame, Alice, Mojonation whatever), Python will take over the universe. Paul Prescod From drew at level3.net Mon Dec 3 17:10:30 2001 From: drew at level3.net (Drew Fisher) Date: 03 Dec 2001 15:10:30 -0700 Subject: Displaying multiple results in a list In-Reply-To: <741f261e.0112031331.75c2e1c6@posting.google.com> References: <741f261e.0112031331.75c2e1c6@posting.google.com> Message-ID: <1007417430.13834.0.camel@spaz.level3.com> > Wanted to know if there was a way to specify ranges in a list such as: > > newlist = ["1", "2", "3", "4", "5", "6"] > > print newlist[1..3] #ie: print newlist[1], newlist[2], newlist[3] > > Can something like this be done? > > /russ > -- Sure. Just use the ":" character to seperate the start / stop index: newlist = [1,2,3,4,5,6,7] print newlist [start:stop] e.g.: >>> newlist = [1,2,3,4,5,6,7] >>> print a[1:5] [2, 3, 4, 5] Hope this helps. Drew From dhhnews0 at hotmail.com Sat Dec 8 14:25:45 2001 From: dhhnews0 at hotmail.com (Dan Howard) Date: Sat, 08 Dec 2001 19:25:45 GMT Subject: finance programs References: <3c115665.31764675@127.0.0.1> Message-ID: The follwing book uses the development a finacial package as the basis for learning Python - It is Mark Hammond's book "Python Programming on Win32" - just excellent and provides a good overview of Python tools "(Five Fresh) Fish" wrote in message news:3c115665.31764675 at 127.0.0.1... > On Fri, 7 Dec 2001 15:12:46 -0600, Lewis Bergman > wrote: > > >Hello, > > > >I am working my way through the tutorial before working on a finance package. > > > >I have scoured the site and found little in relation to finance and python. > >The mail list mentioned on python.org is all but dead. I did find a couple of > >apps at the vault but no response has yet come from my inquires to them (over > >a week ago). > > > >Are there any fnance packages being worked on that anyone knows about? Maybe > >something that I can at least get ideas from? > > > >Thanks for the time. > > http://quantlib.org/ may be useful to you. > > If you're doing a general stock market analysis package, I'm interested. From phd at phd.pp.ru Mon Dec 10 04:11:11 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Mon, 10 Dec 2001 12:11:11 +0300 Subject: A common GUI define like rebol VID? In-Reply-To: <20011210120337.E18573@phd.pp.ru>; from phd@phd.pp.ru on Mon, Dec 10, 2001 at 12:03:37PM +0300 References: <9v12k6$ak9$1@mail.cn99.com> <20011210120337.E18573@phd.pp.ru> Message-ID: <20011210121111.F18573@phd.pp.ru> On Mon, Dec 10, 2001 at 12:03:37PM +0300, Oleg Broytmann wrote: > > I don't understand why not python define a common GUI like REBOL VID ? Oops! Followup to myself :) See also pyui.sf.net and anygui.sf.net! None of which is "common", of course. Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From starx at pacbell.net Tue Dec 4 01:51:31 2001 From: starx at pacbell.net (Philip Swartzleonard) Date: 4 Dec 2001 06:51:31 GMT Subject: Do 2.2 and 2.1.1coexist well? References: Message-ID: Tim Peters || Mon 03 Dec 2001 11:32:37a: >> ... >> File associations is no problem - people who enjoy such things can >> have great fun arranging trick ways to send a .py file to various >> different python.exe's (adding various shell commands, and/or >> associating .py with something that reads the first line of the >> file for the name of the executable as in UNIX...) >> ... >> But Python itself seems to use the registry, for example it appears >> that that's where it reads PYTHONPATH from. > > It's complicated. You can read the comments at the start of > PC\getpathp.c, and I know of know way to summarize that usefully. In > fact, Python on Windows normally never reads the registry for anything, > not even for PYTHONPATH. You can verify that by changing the > PYTHONPATH in your registry, and then noting that sys.path doesn't > change as a result. The PYTHONPATH in the registry is a backup in case > all other attempts to locate Python's home directory fail (which can > happen if, e.g., Python components are invoked via COM by some other > app). (OTOH, it could be the rules have changed since the ancient > version of Python you're still torturing yourself with .) Hm, it would probably be sufficient to make an additonal registry entry for .py21 (or whatever) files, and have that decide it. Similar to the .pyw association. This way, you could change the files that don't work under the new version, and just ren *.x *.y when there is no longer a need. It would help if there weren't many files that needed this :) Re: Registry Pythonpath... SOMEWHERE there needs to be a giant sign that says DO NOT BOTHER WITH THE REGISTRY PATH AS IT WILL NOT HAVE AN EFFECT and save some of us lots of confusion :) (A faq entry 'why does changing the registy not effect python under windows' or similar... unless i missed one??) -- Philip Sw "Starweaver" [rasx] :: From joonas at olen.to Thu Dec 27 16:14:47 2001 From: joonas at olen.to (Joonas Paalasmaa) Date: Thu, 27 Dec 2001 23:14:47 +0200 Subject: Finding out that Python is in interactive mode in sitecustomize.py Message-ID: <3C2B8F47.4CEACF6E@olen.to> How can I find out that Python is started in interactive mode in sitecustomize.py ? The need for that information is, that I want that certain customizations take place only at interactive mode. From greg at cosc.canterbury.ac.nz Sun Dec 9 23:01:43 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Mon, 10 Dec 2001 17:01:43 +1300 Subject: Tab-key = Indent Correctly, != Insert Whatever (Was: Re: Deprecate tabs for indenting) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BD39F.D43D4FF7@mega-nerd.com> <3c0be454$1@207.229.64.20> <3C0BE5D5.4386B359@mega-nerd.com> <3C0EACD6.B2191A44@cosc.canterbury.ac.nz> Message-ID: <3C1433A7.19A9F449@cosc.canterbury.ac.nz> "J?rgen A. Erhard" wrote: > > And that's what I'm thinking when I press it (not: insert a tab now, > but indent this correctly). That's what I'm thinking when I press tab in BBEdit, too. It just happens to implement it differently. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From wurmy at earthlink.net Thu Dec 6 21:02:51 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Fri, 07 Dec 2001 02:02:51 GMT Subject: Python - string to hexbytes conversion - HELP! References: <3C0F9EB3.2574208E@snakefarm.org> Message-ID: <3C102153.52B16049@earthlink.net> Carsten Gaebler wrote: > >>> import binascii > >>> binascii.unhexlify("01234567") > '\x01#Eg' OK, this one has been puzzling me for a while... why are the functions in binascii called 'hexlify' and 'unhexlify'? Why not 'hexify'? Where does the L come from? --Hans From peoter_veliki at hotmail.com Sun Dec 2 19:30:04 2001 From: peoter_veliki at hotmail.com (Peoter Veliki) Date: Sun, 2 Dec 2001 16:30:04 -0800 Subject: splitting using '\' as a delimiter References: <200112030021.fB30LCM01808@mail.swissonline.ch> Message-ID: So the string.split and the re.split swap the order of the arguments??!! What was the logic behind this decision? > > I have strings like this: > > string = 'value\key' > > that I would like to split. If I try splitting the string like this: > > alias = string.split('\\',string) > > I get: > > alias = ['\'] > > > change the order of arguments: > >>> string.split('value\\key','\\') > ['value', 'key'] > > or: > > >>> 'value\\key'.split("\\") > ['value', 'key'] > From tdelaney at avaya.com Mon Dec 17 18:08:10 2001 From: tdelaney at avaya.com (Delaney, Timothy) Date: Tue, 18 Dec 2001 10:08:10 +1100 Subject: do not know what is wrong python under win2k Message-ID: > >>> python spam.py -i eggs -o bacon I don't have the book, so I don't know, but if it says to do the above, the book is broken. I will assume you are on Windows. >>> is the python prompt. It means you are already in python. What you want is to call the line from the OS prompt (on Windows, the DOS prompt). So your line should actually look something like: C:\>python spam.py -i eggs -o bacon ^^^^ Note the prompt! It has a drive letter in it (this will be different on other platforms). For other FAQs ... http://www.python.org/doc/FAQ.html. The above question *really* needs to be added to the FAQ (PSF members!) Tim Delaney From sholden at holdenweb.com Fri Dec 21 17:22:24 2001 From: sholden at holdenweb.com (Steve Holden) Date: Fri, 21 Dec 2001 17:22:24 -0500 Subject: Distutils question References: <9vu28t$4g9$1@peabody.colorado.edu> Message-ID: "Fernando P?rez" wrote ... > Steve Holden wrote: > > > > Erm, Fernando means, of course, "...bug those folks a bit". At least, I hope > > he does. Otherwise see the recent post under "Huge dicts..." > > thanks for the correction. You know, us foreigners... > > Anyway, I looked up the 'huge dict' posts and didn't see anything distutils > related. What did you have in mind? > This: "Chris Perkins" wrote in message news:KCuU7.1242$l6f.461 at news1.bloor.is... > Please! This sort of filth is not welcome in this group. Find somewhere else > to... > Oh, wait - that's a "t". Sorry. Never mind. > > ;-) > > btw, the recent postings to the distutils mailing list seem to point to > improvements, and the current docs (on the web, not the ones from python 2.1) > are indeed better. So I might wait out for 2.2 to come out before complaining > too loudly. > > I really hope distutils fully matures, it seems very nice but yesterday > trying to do things outside of the very narrowly defined options of stetup() > felt like a huge PITA. Maybe I'm just dumb. > I quite like distutils myself, but the documentation is badly in need of existing (not really fair, the stuff there is has the content of a book in about fifteen pages - what I really mena is stuff people like me can understand :-) regards Steve -- http://www.holdenweb.com/ From rsc at plan9.bell-labs.com Sun Dec 16 15:50:16 2001 From: rsc at plan9.bell-labs.com (Russ Cox) Date: Sun, 16 Dec 2001 15:50:16 -0500 Subject: Idiomatic portable way to strip line endings? (fwd) Message-ID: As has already been pointed out, section 7.19.2 of the ANSI C99 standard mandates that stdio FILEs opened in text mode are sequences of lines, each of which is terminated with a newline character. I believe this was the case for the C89 standard too. If you open in binary mode then you have to deal with the differing line-ending conventions on various systems. If you open in text mode, you should always get a single \n (\012); nothing more, nothing less. Russ From sholden at holdenweb.com Wed Dec 5 08:35:59 2001 From: sholden at holdenweb.com (Steve Holden) Date: Wed, 5 Dec 2001 08:35:59 -0500 Subject: reading character in word References: <69e00d8d.0112040959.1e3f7541@posting.google.com> Message-ID: "sebastien" wrote ... > Hi, > > Maybe have you encountered my problem : I do not manage to read > accentuated characters such as ??? ... from a microsoft word > application using win32com.client. > > Here is the programm that I used : > > from win32com.client import constants, Dispatch > > word= Dispatch('Word.Application') > mondoc=word.Documents.Open(r"c:\test.doc") > nombre_caracteres=mondoc.Characters.Count > for numero_caractere in range (1,int(nombre_caracteres)+1): > caractere=mondoc.Characters.Item(numero_caractere) > try: > print caractere > except: > print("cannot read character") > pass > The problem here is a lack of information: you are catching all errors, then not printing out enough information to see what the exact error is! I suspect it will be complaining about characters with ordinal values greater than 127 -- the print statement notoriously fails to handle these. > > Everything is fine as soon as I do not use characters with coma accent > such as ? ? ? in the document... > > > I also tried on my PC to do : > > test_input=raw_input("entrer phrase avec accents : ") > print str(test_input) > for char in test_input: > print char,ord(char) > > after enterring word using the ???..there is no problem printing the > correct letters (for exemple ?t?). > > There maybe some option in Word that I should set ?? > > I hope that someone will have some leads ... You need to do a search on Google for something like "Python print Unicode string" to get advice on conversion to an appropriate encoding before you print. If this isn't the problem, then remove the try/except and post the exact message you see. regards Steve -- http://www.holdenweb.com/ From peter.milliken at gtech.com Mon Dec 3 23:09:05 2001 From: peter.milliken at gtech.com (Peter Milliken) Date: Tue, 4 Dec 2001 15:09:05 +1100 Subject: Python evangelists unite! References: Message-ID: <9uhia9$b3m7@news1.gtech.com> "Robert Folkerts" wrote in message news:abec4aa1.0111301459.e2a1313 at posting.google.com... > tanzer at swing.co.at (Christian Tanzer) wrote in message news:... > > "Peter Milliken" wrote: > > > > > I use Python as a good, quick and dirty hacking language. For real (rea > > d > > > production) stuff that I expect a customer to run or will require more > > than > > > a single person working for a couple of hours, I look elsewhere :-). > > > > Like what? What about languages such as Oberon, Modula-2/3, Smalltalk, Java, Pascal, Ada plus many others. > > > > > They could have been more productive with other languages that provide > > > better support for generic software engineering principles/standards. > > > > What other languages? What principles/standards? > > Perhaps this is a reference to generic programming, as exemplified by > the C++ Standard Template Library. In Python, you don't have data > types and you don't have the same level of control that you have in > C++ to declare const's that allow a complier to better optimze code. > If your client needs to get the most out of each clock cycle, I would > choose C++ over Python. > No, I didn't mean 'generic' in that sense :-). I was refering more to the concepts of information hiding, programming via 'contract', pre/post conditions, types and type checking, compile time checking i.e. mispell a variable in Python and spend ages looking for it! :-) run-time checking etc etc (I could think up others, but these will do for the time being :-)). Many of these principles are mentioned in various portions of the Python news list as "desirable" features of the language i.e. I think I remember something in the 2.2 changes where the author states that the pre/post condition feature could now feasably be implemented. PyChecker is another example of someone's desire to 'improve' Python - Lint did the same thing for C/C++ :-) All add-ons to attempt to correct "deficiencies" in the language :-) So you have to ask yourself why don't people look for a language that incorporate these features into the language by way of the compiler etc? :-) > However, my first choice would be to use C++ 'under' Python. There > are some great examples of using Python and C++ together: > sip and the boost python libraries allow C++ and python to co-exist > nicely > Qt & PyQt are a great example of this synthesis. (Play with > theKompany's BlackAdder, I found it a rush to write Python that > inherits & oeverides behavior defined in C++.) > > > In summary, I feel that Python and C/C++ go together like branches and > roots. Attacking one only harms both. No disagreement in the general sense of combining Python with another language - I am not a fan of C++ (which is C with some OO thrown in for good measure and C is nothing more than high level assembler :-)). I have considered something similar myself but using a different language to C++. The concept of combination is a good one (as witnessed by your examples), match the strengths of the language in question with the problem. There is no "one" language that would suit all situations (otherwise I wouldn't be a professed Python user! :-)). It is just interesting that some can become "one-eyed" towards their favourite language, thinking that it can solved all problems (probably solve the problem of world hunger as well! :-)) similarly to when one mentions editors, now mine is.......... :-) Peter From tjiit at yahoo.com Tue Dec 25 20:47:25 2001 From: tjiit at yahoo.com (tjiit) Date: Wed, 26 Dec 2001 02:47:25 +0100 Subject: strange Tkinter problem Message-ID: I have an application using a Tkinter GUI which starts a network connection if you click on a button. The strange thing is that the GUI freezes and the connection is established. Does this mean that Tkinter executes the functions bound do an event and then returns when the function has ended? I thought it would to kinda multi-threading so it could handle large events and keep interactive while doing it. Can anyone give me a (some) hints? - tjiit From gh_pythonlist at gmx.de Thu Dec 20 02:27:54 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Thu, 20 Dec 2001 08:27:54 +0100 Subject: how to get window performance data using python In-Reply-To: References: Message-ID: <20011220072753.GA5419@lilith.hqd-internal> Le 20/12/01 ? 13:36, Torpedo ?crivit: > i need to get windows performance data from registory > how to write this program , can anyone give an example program? > very thanks for your help! Minor nitpick: the registry isn't involved here. You need to download and install the win32all package downloadable from ActiveState, one or two clicks away from "ActivePython". If you're using the Python flavour from ActiveState (ActivePython) it's already included. The needed module is called win32pdhquery. And this might be useful: http://www.python.org/windows/win32/win32pdhquery_tutorial.html HTH, Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From wurmy at earthlink.net Sat Dec 1 15:23:27 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Sat, 01 Dec 2001 20:23:27 GMT Subject: variable scoping across imports? References: <7b408077.0112010826.47a6a758@posting.google.com> Message-ID: <3C093C3F.10AB6FF0@earthlink.net> Roy Mathew wrote: > > Dear Pythoneers, > > I have what seems to be a vexing problem. > In its simplest form, here are 2 files > > # ------ file x.py ------------------------------------------------ > z0 = None > import y > > def set(): > global z0 > z0 = 33 > > if __name__=='__main__': > y.show() > set() > y.show() > > # ------ file y.py ------------------------------------------------ > import x > > def show(): > print x.z0 > > # ----------------------------------------------------------------- > Now, I would expect that running "python x.py" would produce > None > 33 > but instead, it produces > None > None > > I have read the rules on variable scoping pretty carefully, I think. > Are the circular imports confusing python. (BTW, I am using > "ActivePython 2.1, build 210 ActiveState"). > > What am I missing? Let's see... you start x.py... x imports y... y imports x again... at that moment x.z0 is None. Now y has a copy of x's namespace with z0 == None. This is, however, not the same as the global namespace you're currently in. set() changes z0 to 33, but it does *not* affect the x module that was imported by y. So I'm afraid you'll have to think of a different construction. HTH, --Hans From tony at lsl.co.uk Wed Dec 12 07:34:19 2001 From: tony at lsl.co.uk (Tony J Ibbs (Tibs)) Date: Wed, 12 Dec 2001 12:34:19 -0000 Subject: pypasax (was Deprecate tabs for indenting) In-Reply-To: Message-ID: <015e01c18309$51e85710$545aa8c0@lslp862.int.lsl.co.uk> I [1]_ wrote: > 2. Wonder if he'd been using pypasax_ > (one of my favourite "it's so silly it must > be useful" projects). and in response, Alexandre Fayolle wrote: > Well, as the author of pypasax, I can answer this one. > He's not been using it to produce the sample. ...snip, snip... > Now, I didn't code pypasax just for bragging around. The goal > is to be able to easily generate an XML document from a set > of python modules. followed by a nice explanation of the things they're actually using it for. In fact, I think pypasax is terribly neat - lateral thinking applied to SAX use, for a start (i.e., even if it *didn't* have a useful use, it would still be A Wonderful Thing). My personal interest is, of course, because I'm using the Python "compiler" module (a standard tool in Python 2.2, yeh!) to produce DPS trees [2]_, and these can be trivially [3]_ used to produce XML - although, again, at a differing level of detail than in pypasax (and, in particular, probably not directly reflecting the program structure). But this means that when I came across pypasax I did consider whether I should be using *it* instead of what I'm currently doing... Convergence of ideas is a wonderful thing (even when they don't quite). .. [1] Hmm. As to naming. "Tony J Ibbs" is what my birth certificate would have one believe (well, it expands the "J", of course), and "Tibs" is what I'm commonly called by friends and even sometimes family. I answer equally to either, sometimes without noticing which was used... .. [2] A DPS tree is the internal datastructure used by the DPS/reST tools, which "as everyone knows" is the current Doc-SIG project - find out more at http://docstring.sourceforge.net/. .. [3] For a decently simple value of trivial. -- Tony J Ibbs (Tibs) http://www.tibsnjoan.co.uk/ Marked up with reStructuredText: http://structuredtext.sf.net/ (well, essentially - we haven't formally defined an email format yet...) My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.) From Bruce at EckelObjects.com Tue Dec 11 15:41:03 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Tue, 11 Dec 2001 12:41:03 -0800 Subject: staticmethod and __call__ In-Reply-To: <3C1089FC.617D6D7B@chello.nl> References: <3C1089FC.617D6D7B@chello.nl> Message-ID: <200112111241030400.012F2081@mail.rdc1.sdca.home.com> Actually, I can simplify this in one sentence: if you can make __call__ a static method, then how do you create objects of that class? Obvious once I think about it -- it would make the normal constructor syntax vanish. *********** REPLY SEPARATOR *********** On 12/7/01 at 9:20 AM Roeland Rengelink wrote: >Hi, > >The reason this doesn't work is that ItemGenerator() never looks for a >static attribute __call__ in its own definition. __call__ is used to >define the meaning of instance(). Or, put differently, obj(*args, >**kwargs) is equivalent to obj.__class__.__call__(obj, *args, **kwargs). >Now, the __class__ of a class is its metaclass. Hence, ItemGenerator() >looks for the __call__ method in its metaclass. > >So, what's the metaclass of ItemGenerator? Well, unfortunately for >classic (pre-2.2) classes that's not really obvious. Unless you've used >the Don Beaudry hook (you don't wanna know) to roll your own metaclass, >you can't point to an object and say that's the metaclass of >ItemGenerator. For new style classes (derived from object or one of the >other build-ins), the answer is given by the call type(ItemGenerator), >which turns out to be 'type'. That is 'type' is the metaclass of all >build in types (including itself). Since the type of a new style >instance is its class, this means (a.o.) that in Python 2.2 >obj(*args, **kwargs) is simply equivalent to >type(obj).__call__(obj, *args, **kwargs) > >Python 2.2 also introduces staticmethods. This has led some of us to try >to do the same thing you do here. Namely use staticmethod to try to >override the metaclass method. However, the general rule is that >staticmethod can't be used to force an override for methods defined in >the metaclass. I (now) think this is a good thing. Why? Well consider >exactly this example. The meaning of obj() is now very straightforward. > >obj() => type(obj).__call__(obj) > >If we allowed staticmethod to override, it would become something like > >if (isinstance(type(obj), type) and > hasattr(obj, '__call__') and > isinstance(obj.__call__, staticmethod)): > return obj.__call__() >else: > return type(obj).__call__(obj) > >So, what use are staticmethods? > >I think Guido resisted introducing static methods for a long time with >an argument that goes something like: > >"Classes are for generating instances and defining their behaviour. If >you just want a namespace, use modules (or dictionaries)." > >I.e. somethink like > >--- items.py >import random >rgen = random.Random() > >class Item: > __init__(self, val): > self.val = val > def f(self): > print 'An item with value', self.val > >items = [Item('a'), Item('b'), Item('c')] > >def ItemGenerator(): > return rgen.choice(items) >--- > >--- use_it.py --- >import items >myitems = [items.ItemGenerator() for i in range(5)] >for i in myitems: > i.f() >--- > >I have the feeling the argument against static methods still applies in >most cases, probably augmented with: > >"... and if you really, really want do _that_, use metaclasses" > >Hope this helps, > >Roeland > >Bruce Eckel wrote: >> >> I seem to have trouble getting __call__ to behave as a static >> method: >> >> class Item: >> def f(): print 'An Item' >> >> Item.a = 'a' >> Item.b = 'b' >> Item.c = 'c' >> >> class ItemGenerator: >> import random >> rgen = random.Random() >> items = [j for j in vars(Item).values() if isinstance(j, Item)] >> def __call__(): >> return ItemGenerator.rgen.choice(ItemGenerator.items) >> __call__ = staticmethod(__call__) >> >> items = [ItemGenerator() for i in range(5)] >> for i in items: >> i.f() >> > >-- >r.b.rigilink at chello.nl > >"Half of what I say is nonsense. Unfortunately I don't know which half" >-- >http://mail.python.org/mailman/listinfo/python-list Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From quinn at krone.ugcs.caltech.edu Mon Dec 3 00:20:12 2001 From: quinn at krone.ugcs.caltech.edu (Quinn Dunkan) Date: 3 Dec 2001 05:20:12 GMT Subject: A modest indentation proposal References: Message-ID: On Sat, 1 Dec 2001 16:28:26 -0800 (PST), brueckd at tbye.com wrote: >On 1 Dec 2001, Kragen Sitaker wrote: > >> I'm interested to hear what you find to be common causes of problems >> when you're programming in Python. > >Here's some long-winded ones off the top of my head: >- I've yet to find a really good way to organize modules and functions >I've written and know I'll want to use again later. If there's something >annonying or missing in Python then usually a small function or module >will fix that, but then I end up littering my home and work computers with >various copies of different versions of that same thing, where some are >accessed by being in the same directory as whatever program I'm working >on, others by making sure the Python path includes some dump-all >directory, and others by modifying the Python path at runtime. Maybe the >solution is sort of a private CPAN-like thing, but I've never gotten >around to working on it. I have a 'local' package, with various sub-modules. Yes, versioning is a problem. I edit a local copy of the package, and have a script that runs the unit tests, increments a 'version' file, and copies my local copy to the system library directory. The unit tests hopefully catch any changes that could break existing code. The question of where to put them arises for dynamic libraries in any language. If they're truly global, site-packages works, otherwise I hard code sys.path.insert(0, '/home/dir/lib/py'). Playing games with symlinks might be wise if you don't trust your home dir to stay in the same place, but I can't think of any better solutions under unix. Under plan9 the problem is nicely solved by unioning $home/lib/python onto /sys/lib/python but that doesn't help the unix people. >- Too often I fail to use neat Python idioms, instead relying on using C, >C++, Java, etc. techniques in Python. I'm anxious to read anyone's books >on Python "patterns" or programming "gems" as they represent potentially >untapped power. Hmm, can't think of whether I do this or not, but I'm no expert. I do know there are a lot of clever dynamic things you can do in python, but with the exception of a few gettattr()s and setattr()s I've almost always regretted using them. For example, I'm often tempted to use __getattr__ for delegation or lazy evaluation or plain old getters/setters. But (IMO) language flaws make __getattr__ and __setattr__ very hard to use, because of their interaction with all the __magic__ attributes. And then you throw in built-in types that don't have the magic attributes in the first place even though they support the operations (len() for instance). You can seriously mess up your day by having __del__ and __getattr__ within 15 feet of each other. __del__ is understandably dangerous magic, but the other two are so useful I'm continually tempted to use them. (minor complaint about __del__: it gets called if __init__ throws, so be careful about unlocking resources that were maybe never locked---there's no way to tell if they were or not). The latest changes in 2.2 do a lot to address this, I think. At the cost of two kinds of classes and method lookup rules and a semi smalltalk style single rooted hierarchy along with the old style len(x) str(y) because of no common ancestor. And we already have more than enough magic method names, but there are more every day, I can barely keep up with them. __all__, __dynamic__, __eq__ vs. __cmp__, __help__ __I'm__ __losing__ __my__ __mind__. Since new magic attributes seem to pop up every day, what about existing __getattr__-using code that had all the holes patched up, but is now going to explode because suddenly python wants to look up an __eq__ method where it never did before? >- I sometimes abuse dynamic types by letting function parameters take on >too large a set of meanings. One IMO beautiful example of where this works >well and is ok is in asynchat, where you tell the module to read data from >a socket until some terminator is reached. If the terminator is None, it >reads all data, if the terminator is a number, it means read that many >bytes, and if it's a string, it means read until that token is found in >the data. Unfortunately, in my own code there's rarely that level of >cohesion among the different meanings of a parameter. Hmm, try this rule of thumb: avoid type(). Distinguishing between None and a value is very handy and valid in a reference oriented language. But if you use type() only when you really mean it, you shouldn't have trouble with too-clever guess-what-you-mean functions. From tim at vegeta.ath.cx Tue Dec 4 21:54:03 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Wed, 05 Dec 2001 02:54:03 GMT Subject: Is Python suitable for some binary file editing? References: <1FD639F0.1DA46084@cns.net.au> Message-ID: David Rollo graced us by uttering: > I am considering as a beginning Python project an iterative task > involving conversion of a set of image files to an alternative format. > The file conversion is simply making the same change to a handful of > characters at a particular offset, and saving under a new filename. It > would be repeated several thousand times, looping through a hierarchical > directory structure in Windows, editing and renaming as it went. > > Does this sound like the sort of task that Python is suited to? I had > planned to do it in Java, but wondered if this might be the time to cut > teeth in Python. This not only sounds like a job better done in Python, it sounds like _fun_ to do in Python. Remember to use binary mode on Win32! HTH Tim Hammerquist -- Most people are other people. Their thoughts are someone else's opinions, their lives a mimicry, their passions a quotation. -- Oscar Wilde From skip at pobox.com Sat Dec 1 07:34:24 2001 From: skip at pobox.com (Skip Montanaro) Date: Sat, 1 Dec 2001 06:34:24 -0600 Subject: password question on startup In-Reply-To: <9uai36$796f8$1@ID-69142.news.dfncis.de> References: <9uai36$796f8$1@ID-69142.news.dfncis.de> Message-ID: <15368.52816.315880.26555@cb40507-d.mrtngv1.il.home.com> Andreas> I want that on the programm-start the user has to give user-id Andreas> and password. The password should not be seen on the screen, Andreas> only e.g. stars. The getpass.getpass routine will suppress echo altogether. Not sure how you'd get stars instead. -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From tundra at tundraware.com Wed Dec 12 16:30:03 2001 From: tundra at tundraware.com (Tim Daneliuk) Date: Wed, 12 Dec 2001 21:30:03 GMT Subject: time() returns strange message... References: <9v8gu9$44e$1@news.hccnet.nl> Message-ID: <3C17CC41.7D11B7E5@tundraware.com> Johan Barelds wrote: > > Hi all, > > I am trying to use the time() function which strange results. > My code is the following: > ========================================== > import time > print time() > ========================================== > > the result is: > ========================================== > Traceback (most recent call last): > File "./fundsalert.py", line 74, in ? > print time() > TypeError: object of type 'module' is not callable > ========================================== > > anyone any clues?? > > Thanks! > > -- > Kind Regards / Met vriendelijke groet, > > Johan Barelds, > Good-IT! BV > Strijplaan 320 > 2285 HZ Rijswijk(ZH) > Email j.barelds at good-it.com > Tel. +31(0)70-3965230 > Fax. +31(0)70-3965271 > Mob. +31(0)6-54253750 How about: time.time() Recall that the time() function is in the namespace of the time module... -- ------------------------------------------------------------------------------ Tim Daneliuk tundra at tundraware.com From phd at phd.pp.ru Sun Dec 2 08:27:14 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Sun, 2 Dec 2001 16:27:14 +0300 Subject: InterScan NT Alert In-Reply-To: ; from rnd@onego.ru on Sun, Dec 02, 2001 at 11:53:19AM +0300 References: Message-ID: <20011202162714.C27932@phd.pp.ru> On Sun, Dec 02, 2001 at 11:53:19AM +0300, Roman Suzi wrote: > Yes. It's interesting to think about it: emails with so called viruses are > just pieces of data which (usually) conform to electronic mail RFCs, > Internet standards. > > WHY DO I NEED TO KNOW some data coming to my mailbox is somehow special? Becuse these data files can destroy your precious million dollars in a second. Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From markj+0111 at cloaked.freeserve.co.uk Sun Dec 23 04:33:59 2001 From: markj+0111 at cloaked.freeserve.co.uk (MJ Ray) Date: Sun, 23 Dec 2001 09:33:59 GMT Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic References: <3218013921984060@naggum.net> <3218081134224960@naggum.net> Message-ID: Erik Naggum wrote: > Have you thought about how _necessary_ it is for you Scheme freaks to be > hostile to those who do not agree with you? E.g., where _did_ the stupid > need to attack Common Lisp now come from? So immature and vindictive! Sorry Erik. I attacked you, not Common Lisp. Or are you Common Lisp itself? > [...] so far, we have had a large number of Scheme freaks invade > Common Lisp fora to tell us how superior Scheme is, while no Common Lisp > programmers invade Scheme camps to tell you how good Common Lisp is. I can only think of one Common Lisp forum, CLiki, and it contains little about Scheme. Maybe you wish to make general Lisp fora "pure" and filled only with your One True Lisp? I've snipped the rest of your content-free post. Followups set. From weeks at vitus.scs.agilent.com Thu Dec 13 23:17:17 2001 From: weeks at vitus.scs.agilent.com (Greg Weeks) Date: Fri, 14 Dec 2001 04:17:17 +0000 (UTC) Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> Message-ID: <1008303437.718558@cswreg.cos.agilent.com> Angus Mackay (amackay at radical.ca) wrote: : what are people using? I hate to be a stick-in-the-mud, but I'm still with 1.5.2. I couldn't (with minimal effort) get the new versions to build correctly on HP-UX. And 1.5.2 is what came with my RedHat 7.2 Linux. Regards, Greg From Shourya.Sarcar at med.ge.com Sun Dec 23 20:31:43 2001 From: Shourya.Sarcar at med.ge.com (Sarcar, Shourya C (MED)) Date: Sun, 23 Dec 2001 19:31:43 -0600 Subject: Newbie question Message-ID: <75968FA028EAD311B3530090279CF80C0B2A0374@uswaumsx07medge.med.ge.com> Add to the first line #!/usr/bin/python OR Run the script as bash $ python fileTest.py Dear Allan, You are running a python cript from the BASH shell. SO bash must somehow know that a Python interpreter is to be used. In the first way, you specify the program which is to be used to run the script directly inside the script. In the second way, you give the program as an "input" to the python interpreter shourya ________________________________________________________________________ Shourya Sarcar | EEDP | Computer Technology Team, Global Software Platforms GE Medical Systems, 3200 N. Grandview Blvd., MS-WT 881, Waukesha, WI 53188 Tel:(262) 521 6295 Fax:(262) 521 6800 DC: *320 6295 -----Original Message----- From: Peak Allan [mailto:apeak_2000 at yahoo.com] Sent: Sunday, December 23, 2001 5:33 PM To: python-list at python.org Subject: Newbie question I copied this code from one of the tutorials on the python.org website, but when I tried to run it, I got an error. # Program FileTest out_file = open("test.txt", "w") out_file.write("This crap is going to out file\n") out_file.close() in_file = open("test.txt", "r") text = in_file.read() in_file.close() print text bash-2.05$ ./fileTest.py ./fileTest.py: line 3: syntax error near unexpected token `open("' ./fileTest.py: line 3: `out_file = open("test.txt", "w")' Can someone please tell me what I did wrong? Also, are the tutorials at python.org a good way to learn Python? If not, are there any other good online resources? __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list From peter at engcorp.com Mon Dec 17 20:30:19 2001 From: peter at engcorp.com (Peter Hansen) Date: Mon, 17 Dec 2001 20:30:19 -0500 Subject: do not know what is wrong python under win2k References: <3C1E752E.8864E2E9@htp-tel.de> <5KuT7.15581$PA.12409@atlpnn01.usenetserver.com> <3C1E7E22.D6169237@htp-tel.de> Message-ID: <3C1E9C2B.38E9D6EF@engcorp.com> Courageous wrote: > > >This was the problem - i always thought i had to type this in in the > >open interpreter shell. > > You can get the interpreter to interpret a python file by importing it, > ala: > > >>>> import spam.py Correction, "import spam" (no extension inside Python). From sandysj at juno.com Thu Dec 20 16:47:01 2001 From: sandysj at juno.com (Jeff Sandys) Date: Thu, 20 Dec 2001 21:47:01 GMT Subject: Where is time module? Message-ID: <3C225C55.1DD68DB6@juno.com> I can't import the time module or find it anywhere in the Python-2.1.1.tgz distribution. Thanks, Jeff Sandys From laurent.pointal at laposte.net Tue Dec 25 16:24:20 2001 From: laurent.pointal at laposte.net (Laurent Pointal) Date: 25 Dec 2001 21:24:20 GMT Subject: f(n=4) works; bug or feature? References: Message-ID: "Sean 'Shaleh' Perry" wrote in news:mailman.1009170148.18924.python-list at python.org: ... And with variable number of named arguments... >>> def f(**kargs) : ... print kargs ... >>> f(a=3,b=4,s="Coucou") {'b': 4, 's': 'Coucou', 'a': 3} A+ Laurent. From kragen at pobox.com Sat Dec 1 06:58:40 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 01 Dec 2001 06:58:40 -0500 Subject: Mass mailing module for Python References: <3c0632ee$0$25408$edfadb0f@dspool01.news.tele.dk> Message-ID: <83snavrw27.fsf@panacea.canonical.org> "Max M" writes: > Without having tried it I guess that using a regular mailserver and then > just sending tons of mails from that, one at a time, wont work either. > Though it would be very easy. Here I am thinking about bouncing mail and > unavailable mailservers, but I could be wrong. So you think it might be easier to write your own mail server from scratch in Python than to set up existing mailserver software to be reliable? I think you might be wrong, but I haven't done what you're proposing to do. If I were, though, I'd probably use qmail or Postfix, probably Postfix, and I'd probably run my mail generator on the mail server instead of talking to it over SMTP. I bet I could get it running in an afternoon if I had physical access to the right hardware or remote access to a machine with Debian 2.2 installed. From MarkH at ActiveState.com Fri Dec 7 01:03:50 2001 From: MarkH at ActiveState.com (Mark Hammond) Date: Fri, 07 Dec 2001 06:03:50 GMT Subject: COM Registration Attributes References: Message-ID: <3C105C56.7080909@ActiveState.com> Bill Bell wrote: > Gordon McMillan wrote: > >>Bill Bell wrote: >> >>>"Python Programming on Win32" mentions that '_reg_options_' is a >>>"dictionary of additional keys to be written to the registry for the >>>COM object". >>> >>>Has anyone an example or two, since I've been unable to find any? >>> >>class MyCOMServer: >> __reg_options_ = {'mykey':'myvalue'} >> ... >> >>When registered, there will be a key 'mykey' sibling to >>'InProcServer32' with a default value of 'myvalue'. I don't know if it >>will handle other types, or anything more complex. >> > > Thanks, Gordon. I just prototyped a simple COM that needs to > declare itself safe for Internet Explorer. Looks like I need to continue > to do that in the good old-fashioned way, with 'RegOpenKey', etc. > Would seem more elegant to be able to use '_reg_options_'. A patch to allow _reg_options_ to do this sort of thing (assuming it did not break what it does now) would be welcome :) Mark. From jkraska at san.rr.com Mon Dec 3 12:04:41 2001 From: jkraska at san.rr.com (Courageous) Date: Mon, 03 Dec 2001 17:04:41 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> Message-ID: >Perhaps you might want to put some kind of processing step into your >revision control procedures or tools. I think I raised this issue >before on comp.lang.python but some people think it's more interesting >to get religious about tabs vs. spaces instead. I've considered that on many occasions; one such step might be to simply REJECT a commit of a .py file with tabs in it. C// From dalke at dalkescientific.com Fri Dec 14 22:27:36 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Fri, 14 Dec 2001 20:27:36 -0700 Subject: Unsung Python modules References: <3dsnad226b.fsf@ute.mems-exchange.org> Message-ID: <9vefun$qj2$1@slb3.atl.mindspring.net> phil hunt: >I quite like the SPARK parsing framework. Seconded! I also like mxTextTools. (Why yes, I do do a lot of parsing -- why do you ask?) Andrew From marklists at mceahern.com Fri Dec 28 01:12:36 2001 From: marklists at mceahern.com (Mark McEahern) Date: Thu, 27 Dec 2001 22:12:36 -0800 Subject: New Array proposal (So that it will actually be read) In-Reply-To: <40dbad98.0112272113.40a21ab7@posting.google.com> Message-ID: > I think that an array sould have natural dimension support, > instead of : > > List = [[4,4,4], > [3,3,3]] > > Just to define it, we should do this: > > List|A,B,C| I don't understand. You want to change the language's syntax for declaring a list? That seems like a rather hefty change. Btw, you may want to check out Python 2.2 since it allows you to subclass built-in types like the list. You may be able to do whatever it is you're trying to do on your own without requesting arbitrary and inelegant changes to the language's syntax. Cheers, // mark From Remove_This_malex at viking.tagancha.org Fri Dec 14 10:43:29 2001 From: Remove_This_malex at viking.tagancha.org (Oleksandr Moskalenko) Date: Fri, 14 Dec 2001 15:43:29 +0000 (UTC) Subject: which book? References: Message-ID: <9vd6n0$ha8$1@mozo.cc.purdue.edu> On Fri, 14 Dec 2001, DeepBlue unleashed unto the World: > Learning Python by Lutz and Ascher and > Python Essential Reference 2nd Ed by Beazley > > At a more later stage: > Programming Python 2nd Edition by Lutz > > For web application and Python, check amazon.com or bn.com and search for > Python. > DeepBlue And such a search would come up with the following PUBLISHED books: 1) An impossible to find book by Guido van Rossum and 2) "Web Programming in Python: Techniques for Integrating Linux, Apache and MySQL", which doesn't have a single review and a bunch of them are already sold used. I would be very cautious with a book like that. I couldn't find any other published book on the web programming with Python subject unfortunately. Alex. From morten at thingamy.net Sat Dec 15 09:55:43 2001 From: morten at thingamy.net (Morten W. Petersen) Date: 15 Dec 2001 06:55:43 -0800 Subject: Issues with threads Message-ID: <88ad4fa1.0112150655.d96d6bc@posting.google.com> Hi, I'm trying to implement a check-website-availability-in-n-seconds script, and figured it was a good oppurtunity to play with threading in Python. I've implemented two modules: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/warp-framework/warp_framework/tools/fork.py?rev=1.1&content-type=text/vnd.viewcvs-markup http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/warp-framework/warp_framework/tools/website_check.py?rev=1.4&content-type=text/vnd.viewcvs-markup Where a test is run every time the website_check script is run. The test is rigged so that it will fail every time (and leave the thread running), however, even though the thread is set to be daemonic, the python interpreter doesn't always exit, it may hang after an arbitrary number of calls: morten at debian:~/programming/python/projects/warp_framework/tools$ python website_check.py (0, None) finished morten at debian:~/programming/python/projects/warp_framework/tools$ python website_check.py (0, None) finished morten at debian:~/programming/python/projects/warp_framework/tools$ python website_check.py (0, None) finished morten at debian:~/programming/python/projects/warp_framework/tools$ python website_check.py (0, None) finished morten at debian:~/programming/python/projects/warp_framework/tools$ python website_check.py (0, None) finished morten at debian:~/programming/python/projects/warp_framework/tools$ python website_check.py (0, None) finished morten at debian:~/programming/python/projects/warp_framework/tools$ python website_check.py (0, None) finished morten at debian:~/programming/python/projects/warp_framework/tools$ python website_check.py (0, None) finished morten at debian:~/programming/python/projects/warp_framework/tools$ python website_check.py (0, None) finished Here Ctrl-C is needed to exit the interpreter. morten at debian:~/programming/python/projects/warp_framework/tools$ python website_check.py (0, None) finished morten at debian:~/programming/python/projects/warp_framework/tools$ python website_check.py (0, None) finished morten at debian:~/programming/python/projects/warp_framework/tools$ python website_check.py (0, None) finished Here Ctrl-C is again needed to exit the interpreter. I've noticed that 1 or more expressions after the check_url_time (seemingly) makes the interpreter exit more often that without expressions after the call. Any ideas what might be causing the interpreter to 'not exit cleanly' ? Thanks, Morten From Bruce at EckelObjects.com Sun Dec 9 15:03:46 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Sun, 09 Dec 2001 12:03:46 -0800 Subject: "Synchronized" in python In-Reply-To: <3C0FB873.9894C834@google.com> References: <3C0FA98E.4339D7A0@google.com> <200112060942010180.00AD31AE@mail.rdc1.sdca.home.com> <3C0FB873.9894C834@google.com> Message-ID: <200112091203460780.0126B0F4@mail.rdc1.sdca.home.com> Peter: I think I've gotten all the kinks out of the design except two. I've attached the current incarnation of the files, including Synchronization.py and TestSynchronization.py. The two kinks are: 1) I can't figure out how to prevent multiple synchronization of a method, as in the example of 'm' in the test code. I tried attaching an attribute to the function 'f' that is returned by synchronized() and then hunting for it in synchronize(), but the attribute doesn't seem to hang around. 2) is there any clever way to effect a synchronized *clause* inside a method, rather than synchronizing the whole method? *********** REPLY SEPARATOR *********** On 12/6/01 at 10:26 AM Peter Norvig wrote: >Or how about this: > >def Synchronize(klass, names=None): > """Synchronize methods in the given class. > Only synchronize the methods whose names are given, or all methods > if names=None (the default).""" > if type(names) = type(''): names = names.split() > for (name, val) in klass.__dict__.items(): > if callable(val) and (names == None or name in names): > klass.__dict__[name] = synchronize(val) > ># use like this: >Synchronize(MyClass) >Synchronize(SomeClass, "method1 method2 method3") > > >Bruce Eckel wrote: >> >> Interesting. >> It turns out that threading.RLock is the right one to use, as >> thread.allocate_lock() doesn't allow synchronized methods to call >> each other, like you can in Java. >> >> I couldn't tell from this, is it possible to syncronize on a >> method-by-method basis? >> >> *********** REPLY SEPARATOR *********** >> >> On 12/6/01 at 9:23 AM Peter Norvig wrote: >> >> >How about this, mostly copied from Guido's article, with minor >> changes: >> > >> >import types, thread >> > >> >class SynchronizedMetaclass: >> > def __init__(self, name, bases, namespace): >> > """Create a new class.""" >> > self.__name__ = name >> > self.__bases__ = bases >> > self.__namespace__ = namespace >> > def __call__(self): >> > """Create a new instance.""" >> > return Instance(self) >> > >> >class Instance: >> > def __init__(self, klass): >> > self.mutex = thread.allocate_lock() >> > self.__klass__ = klass >> > def __getattr__(self, name): >> > try: >> > value = self.__klass__.__namespace__[name] >> > except KeyError: >> > raise AttributeError, name >> > if type(value) is not types.FunctionType: >> > return value >> > return BoundMethod(value, self) >> > >> >class BoundMethod: >> > def __init__(self, function, instance): >> > self.function = function >> > self.instance = instance >> > def __call__(self, *args): >> > self.instance.mutex.acquire(); print 'acquired' ## debugging >> > result = None >> > try: >> > result = apply(self.function, (self.instance,) + args) >> > finally: >> > self.instance.mutex.release(); print 'released' >> ##debugging >> > return result >> > >> > >> >Synchronized = SynchronizedMetaclass('Synchronized', (), {}) >> > >> >class My(Synchronized): >> > def method1(self, a): >> > self.a = a >> > def method2(self): >> > return self.a >> > >> >m = My() >> > >> >print 'm.method1(42)', m.method1(42) >> >print 'm.method2()', m.method2() >> > >> >Tim Peters wrote: >> >> >> >> Bruce, I'm afraid that's not a good emulation. Much better than >> >> >> >> def xxx(...): >> >> self.mutex.acquire() >> >> yadda >> >> self.mutex.release() >> >> >> >> is >> >> >> >> def xxx(...): >> >> self.mutex.acquire() >> >> try: >> >> yadda >> >> finally: >> >> self.mutex.release() >> >> >> >> which is, alas, even more noxious by hand. Key side question: >> are you >> >sure >> >> you want mutex semantics here? A more popular alternative is to >> use a >> >> threading.RLock (a reentrant lock, so that Observable's >> synchronized >> >methods >> >> can call each other freely without deadlocking (or even more >> manual >> >pain)). >> >> >> >> There's no easy relief. I can't make time to go into the >> details now, so >> >> ask on comp.lang.python if you're really curious: metaclasses >> can be >> >used >> >> to automate this. This should be much simpler in 2.2 than in >> previous >> >> releases, as 2.2 introduces some seriously usable Python-level >> metaclass >> >> machinery. The flavor of what you need before 2.2 can be found >> in the >> >> Demo/metaclasses subdirectory of your Python tree; in >> particular, >> >Synch.py >> >> there is an example of a metaclass for adding synchronized >> methods. >> >> >> >> Unfortunately, nobody has had time to update the examples in >> that >> >directory >> >> for 2.2. The pre-2.2 metaclass hook is notoriously difficult to >> >understand. >> >> Guido's old essay on the topic >> >> >> >> http://www.python.org/doc/essays/metaclasses/ >> >> >> >> is still quoted often, but more in frustration than admiration >> . >> >> >> >> technically-accurate-yet-almost-entirely-unrevealing-ly y'rs - >> tim >> >> >> >> > -----Original Message----- >> >> > From: Bruce Eckel [mailto:Bruce at EckelObjects.com] >> >> > Sent: Wednesday, December 05, 2001 9:19 PM >> >> > To: Peter Norvig; tim.one at home.com >> >> > Subject: "Synchronized" in python >> >> > >> >> > >> >> > Do you know of a clever way to emulate Java's "synchronized" >> in >> >> > Python? Right now I have: >> >> > >> >> > import thread >> >> > >> >> > class Observable: >> >> > def __init__(self) { >> >> > self.obs = [] >> >> > self.changed = 0; >> >> > self.mutex = thread.allocate_lock() >> >> > def addObserver(self, observer): >> >> > self.mutex.acquire() >> >> > if observer not in obs: >> >> > obs.append(observer) >> >> > self.mutex.release() >> >> > def deleteObserver(self, observer): >> >> > self.mutex.acquire() >> >> > del obs[observer] >> >> > self.mutex.release() >> >> > >> >> > etc. >> >> > >> >> > I'm wondering if there's some better way than reproducing all >> those >> >> > "self.mutex.acquire()" and "self.mutex.release()" statements >> for >> >> > each synchronized method. >> >> > >> >> > >> >> > Most current information can be found at: >> >> > http://www.mindview.net/Etc/notes.html >> >> > =================== >> >> > Bruce Eckel http://www.BruceEckel.com >> >> > Contains free electronic books: "Thinking in Java 2e" & >> "Thinking >> >> > in C++ 2e" >> >> > Please subscribe to my free newsletter -- just send any email >> to: >> >> > join-eckel-oo-programming at earth.lyris.net >> >> > My schedule can be found at: >> >> > http://www.mindview.net/Calendar >> >> > =================== >> > >> >-- >> >___________________________________________________________________ >> __ >> >Peter Norvig, Director of Machine Learning, Google, >> http://google.com >> >pnorvig at google.com, Voice:650-330-0100 x1248, Fax:650-618-1499 >> >> Most current information can be found at: >> http://www.mindview.net/Etc/notes.html >> =================== >> Bruce Eckel http://www.BruceEckel.com >> Contains free electronic books: "Thinking in Java 2e" & "Thinking >> in C++ 2e" >> Please subscribe to my free newsletter -- just send any email to: >> join-eckel-oo-programming at earth.lyris.net >> My schedule can be found at: >> http://www.mindview.net/Calendar >> =================== > >-- >___________________________________________________________________ __ >Peter Norvig, Director of Machine Learning, Google, http://google.com >pnorvig at google.com, Voice:650-330-0100 x1248, Fax:650-618-1499 Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== -------------- next part -------------- A non-text attachment was scrubbed... Name: Synchronization.zip Type: application/x-zip-compressed Size: 1222 bytes Desc: not available URL: From bosahv at netscapenospam.net Sun Dec 23 07:47:55 2001 From: bosahv at netscapenospam.net (Bo Vandenberg) Date: Sun, 23 Dec 2001 12:47:55 GMT Subject: OT: Good Comparison Java vs C# Message-ID: <%nkV7.79180$pa1.26605581@news3.rdc1.on.home.com> I know this isn't Python but I think it is good multi language comparison. There is a good summary of Java to C# at Kuro5hin.org http://www.kuro5hin.org/story/2001/11/18/152437/24 I liked the style of the article. From tdelaney at avaya.com Wed Dec 19 17:30:45 2001 From: tdelaney at avaya.com (Delaney, Timothy) Date: Thu, 20 Dec 2001 09:30:45 +1100 Subject: Why is Complex number notation the way it is? Message-ID: > From: joshyotty at hotmail.com [mailto:joshyotty at hotmail.com] > > I've been coding Python for about a day now, and I can't 'see' why a > complex number like 2+3i is represented as 2+3j in Python. > > Well, um, why? Because there are two representations for complex numbers, depending on whether you're a mathematician or a physicist. Mathematicians use 'i', physicists (and engineers I think) use 'j'. 'j' is more easily distinguished from the surrounding characters (such a '1') because it dips below the baseline. Besides, so many people seem to write phyton that there is an obvious link to the word "physics" ... :) You may find the following links useful (although your question does not appear to be in there ...). http://www.python.org/ http://www.python.org/cgi-bin/faqw.py Tim Delaney From zope at thewebsons.com Mon Dec 17 09:42:19 2001 From: zope at thewebsons.com (Ben Ocean) Date: Mon, 17 Dec 2001 06:42:19 -0800 Subject: Compiling Python with Tkinter In-Reply-To: References: Message-ID: <5.1.0.14.0.20011217063927.00a4e4f0@thewebsons.com> At 10:40 AM 12/17/01 +0100, you wrote: That doesn't really answer the question: if you don't have X, you >don't need Tkinter, either - not even if you use PIL. Well, screw it all, then. I was able to import the appropriate PIL libraries and that's all I wanted. Maybe I'll dink with tkinter/X11 when I have time for fun. Thanks! BenO From danielk at aracnet.com Wed Dec 26 12:45:22 2001 From: danielk at aracnet.com (Daniel Klein) Date: Wed, 26 Dec 2001 09:45:22 -0800 Subject: REPOST: Where to post Jython questions? Message-ID: <0$--$$-$$$$%__$_-$@news.noc.cabal.int> Is the the proper place to post questions/conversations for Jython? If not, please advise. Thanks, Daniel Klein ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Daniel Klein Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:02:26 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009776158 27193 211.57.49.2 (31 Dec 2001 05:22:38 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:22:38 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From ballabio at mac.com Wed Dec 12 06:43:34 2001 From: ballabio at mac.com (Luigi Ballabio) Date: Wed, 12 Dec 2001 11:43:34 +0000 Subject: Designing for Inheritance In-Reply-To: <9v78pb+8579@eGroups.com> Message-ID: <5.1.0.14.0.20011212112451.00a7a050@mail.mac.com> At 09:42 AM 12/12/01 +0000, nspies.geo wrote: >Hi all, >The problem is thus: how do I design the base class so that it will >create an extracted object of the correct type, even if it's been >inherited? It may well be that the inherited class needs to wrap the >base class function, but I do not wish to re-write the function in >every base class. > >Here it is in code. > >class BaseAlignment: > def extractx(self, x): > extraction = BaseAlignment() > extraction = self.data[0:x] > > return extraction You have a problem here. Python does not have the copy semantics of C, i.e., you are not even returning a BaseAlignment here. What happens is: extraction = BaseAlignment() # here a temporary object of class # BaseAlignment is created. The # reference "extraction" points to it. extraction = self.data[0:x] # here the reference "extraction" is relinked # to the slice returned from self.data. # The temporary BaseAlignment() has no more # refs pointing to it and is garbage-collected. # The previous statement had no effect at all # and could be removed! return extraction # here you return the slice (a list or a tuple # depending on the type of self.data) In short, the above is perfectly equivalent to class BaseAlignment: def extractx(self,x): return self.data[0:x] If I interpret right what you want, you might try this instead: class BaseAlignment: def __init__(self,data): # initialize the data with the passed list self.data = data def extractx(self,x): # self.__class__ returns the right class, i.e., the right constructor # we use it to return an object of the right type initialized with # the desired data return self.__class__(self.data[0:x]) class InheritedAlignment(BaseAlignment): # do not define the constructor---it will be inherited def extractx(self,x): obj = BaseAlignment.extractx(self,x) obj.message = "Hello world" return obj This is what happens in Python 2.1.1: >>> b = BaseAlignment([1,2,3,4]) >>> extr = b.extractx(2) >>> extr.__class__ >>> extr.data [1, 2] >>> d = InheritedAlignment([1,2,3,4]) >>> extr2 = d.extractx(2) >>> extr2.__class__ >>> extr2.data [1, 2] >>> extr2.message 'Hello world' >>> Hope this helped, Luigi From fb at ultranet.com Mon Dec 17 13:35:11 2001 From: fb at ultranet.com (Fahri Basegmez) Date: Mon, 17 Dec 2001 13:35:11 -0500 Subject: Looping in Python References: <9vl8os$gcs$1@bob.news.rcn.net> Message-ID: <9vle69$7gi$1@bob.news.rcn.net> If you change the default values as loop(start=0, stop=sys.maxint, step=1): To have an endless loop just type loop(): print "no more while 1:" "basegmez" wrote in message news:9vl8os$gcs$1 at bob.news.rcn.net... > If everything is an object in Python then why not: > > Syntax: > > loop(start=0, stop, step=1): > (loop.count and loop.value automagically generated by Python, > loop count starts from 1 and incremented by 1, > loop value starts from start value and incremented by step value, > stop value is a long integer) > > if condition: > break > elif anothercondition: > continue > your_statements_and_what_have_you_here > > Example 1: > Input: > loop(-4,4,2): > print loop.count, loop.value > > Output: > 1 -4 > 2 -2 > 3 0 > 4 2 > > Example 2: > Input: > loop(4): > print loop.count, loop.value > > Output: > 1 0 > 2 1 > 3 2 > 4 3 > > If you feel like pushing it, "loop.start", "loop.stop" and "loop.step" may > be added. > If it could implement floating point step values, it would be even better > but I am not sure if this would be feasible. > I realized that there have been some lengthy (to put it mildly) discussions > of loop structures, if this is already proposed and rejected, just ignore > it. If not, someone may be able to come up with better alternatives to > "loop.count" and "loop.value" even the "loop" keyword. This was the most > Pythonic way I could come up with. > > Regards, > > Fahri > > > > > > > From timr at probo.com Sun Dec 30 17:28:16 2001 From: timr at probo.com (Tim Roberts) Date: Sun, 30 Dec 2001 14:28:16 -0800 Subject: Python and Ruby: a comparison References: <3C2B9A61.EE1618DB@earthlink.net> <2WpX7.1145$0s5.714029@news20> <3C2E6876.4CBF45D4@geneva-link.ch> Message-ID: <465v2u4lv3illoviq19nhdf1r2vcknbakn@4ax.com> Boris Borcic wrote: >Conrad Schneiker wrote: > >> So my question is: at such a presently entirely hypothetical future >> juncture, is there any practical and desirable middle ground for a common >> single successor language to the current generations of Python and Ruby? > >What would be fun is to have library interoperability completed >with interlingual source-to-source conversion from adequately >constrained style... premitting more or less, to use one's language >superficial idioms to mean corresponding idioms in the other >language. Oddly enough, I believe that is almost exactly what Bill Gates believes he has created with .NET and the common language runtime. -- - Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From tatebll at aol.com Sun Dec 30 10:55:05 2001 From: tatebll at aol.com (Bill Tate) Date: 30 Dec 2001 07:55:05 -0800 Subject: Zope Documentation (was RE: Python Popularity: Questions and Comments) References: <3C2E55A6.D873E301@engcorp.com> Message-ID: Peter Hansen wrote in message news:<3C2E55A6.D873E301 at engcorp.com>... > Bill Tate wrote: > > > > I understand the "zen" thing, > > If you say that, then you don't really understand it. ;-) > > > but it's not something that business > > people are going to care about when they making a decision about > > whether to use it or not. > > As a business person, I take mild exception to that. I'd rather > have "zen" from Zope than "marketing" from Microsoft. I guess I prefer to see things in the concrete and simple terms rather abstract pieces of marketing bunk like the following from I suspect a soon to be ex-dot.com (perhaps symptomatic you might say of the "business" gibberish these past 3 years). Try not to laugh to hard: "Xxxxxx is the world's first company dedicated to using the science of experience strategy, design, and technology to create extraordinary results for our clients. Our entire team is committed to transforming our clients' businesses through the creation of multi-channel experiences that inspire and strengthen dynamic connections among people, businesses, channels, and communities." Seems pretty clear to me - sign me up!!! :>) From marka at sundance.com Thu Dec 13 06:01:56 2001 From: marka at sundance.com (Mark Ainsworth) Date: Thu, 13 Dec 2001 11:01:56 +0000 Subject: integrating Python, ASP and XML Message-ID: <3C188AA4.1040400@sundance.com> Are there any tutorials/docs on how to integrate ASP, Python, and XML. I have Python as my scripting language and it is working fine. Now I want to access XML formatted data, and use the Python ASP scripts to fill in my HTML pages. Any help would be appreciated. Thanks. Mark A. From DaveP at dpawson.freeserve.co.uk Thu Dec 6 12:39:06 2001 From: DaveP at dpawson.freeserve.co.uk (Dave Pawson) Date: 6 Dec 2001 17:39:06 GMT Subject: mp3info and python References: Message-ID: After a little off list support from Brett, here's a way to use the python solution. thanks Brett. daveP f = open(fil) m = mp3info.mp3info(f.read()) h = m.id3 #for i in h.keys(): # print i, h[i] entry = os.stat(fil) size = entry[stat.ST_SIZE] br = int(h['bitrate']) print "File size is :",size, " Bitrate = ", br dur = (size) / (br * 1000 / 8) print dur hrs = dur / 3600 mins = (dur % 3600) / 60 secs = (dur % 3600) % 60 print "dur= ",hrs,":",mins ,":", secs m.free_file() f.close() sys.exit() From aleax at aleax.it Mon Dec 31 07:28:29 2001 From: aleax at aleax.it (Alex Martelli) Date: Mon, 31 Dec 2001 12:28:29 GMT Subject: waterfall (was Re: REPOST: Re: Book "python programming patterns". anybody read this??) References: <2$--$$_----___%_$$@news.noc.cabal.int> Message-ID: Peter Milliken wrote: ... > that *all* the people involved in the project can't be brought around to > the concept/idea that you should sit down and plan the project step by > step and not proceed to the next until the previous is complete i.e. sit This is also known as the "waterfall model" of software development. It just doesn't work, as many decades of industry experience have amply shown. Therefore, if some people "can't be brought around to the concept/idea", there may be some excellent reasons for that; e.g., the people who resist this horrid idea may have some relevant experience, or have read some good book on the subject, or just plain have some common sense and on-target intuition. First of all, development needs to proceed in far smaller increments than "a whole application system", as implied by: > down with the customer, analyise the requires - protype if necessary, but > get them nailed down and worked out until the customer is happy that he > knows what he wants!. Second, it's imperative to have continuous "feedback loops" from each stage back to previous ones. Domain analysis is fed back from requirement analysis. Both are fed back from architectural design. The latter absolutely needs feedback from subsystem design. And so on, and so forth. > Then the programmer should sit down and use the analsysis to > generate a design (documentation! ugh, how many programmers want to spend > their life doing documentation! - there is always some excuse not too! :-) The world is chock full of software projects which have generated far more "documentation" than useful code. Paperwork in out-of-control amounts is trivially easy to generate, compared to _working_ code _that does what's actually needed_. The "waterfall model" is responsible for more useless reams of empty words being generated than any other software development model, I believe. Being a budding author, as well as an established developer, I wouldn't mind "spending my life doing documentation" IF I evaluated that the end-product of my efforts would be more useful that way. When I write, I have to carefully weigh the amount of English text I produce versus examples, snippets, exercises, for example. Just as, when I code, I have to weigh similar considerations. The goals are somewhat different, but not by all that much (Knuth's theory of "Literate Programming" makes them almost coincide: writing a software system is just the same as writing a publishable paper about the workings of that software system -- you write just one document, with the two things suitably intertwined and fed-back, then process it with different post-processors to generate either a, say, runnable Pascal program source or a printable TeX markup source). "No battle plan survives contact with the enemy", and no "pure" software design survives contact with the hardware. Unless you have structured mechanisms in place for feeding the lessons of lower-level experiences back to the more abstract layers, you're going to lose the battle (not deliver good and useful working code) or win it in ways that have really very little to do with the written-down "abstractions". The "central planning" pipedreams of unmourned "real-socialist" economies provide another good example of this phenomenon. > understand it! :-)). But most programmers want to cut code - nothing else Assuming this assertion of yours, then the only good software development methodologies will be those that take it into account and work with it: i.e., any methodology that assumes otherwise is a monumental disaster. Waterfall, for example. Analogy: "most workers want to make money -- nothing else". This isn't really true (just as your assertion isn't), but, if it were, what would follow? Obviously, that the only sensible economic systems are those that take this into account and work with it. In other words, from Marx's materialistic assumption (that making money is the only motivator), there follows that centralized planning (and socialism in general) is unworkable, and the only viable economics approaches are those which leverage people's greed for money into a constructive system (Smith's "invisible hand" -- ""It is not from the benevolence of the butcher, the brewer, or the baker, that we expect our dinner, but from their regard to their own interest."). Similarly, then, if it's true that writing code (actually: good, working, _useful_ code) is a programmer's key motivator, then the only viable methodologies will be those that leverage this into a constructive system. "Agile Programming" (particularly in the "Extreme Programming" flavor) does give code its rightfully central place among all artifacts of software development. If you don't, then you're pandering to the *bureaucrat*'s motivations: the key thing is writing huge formalized reports, producing paperwork for its own sake; that anything 'useful' must come out of the process is maybe an unfortunate necessity, but the dream system would produce nothing but paperwork, paperwork about the paperwork, and so on. (The "Yes, Minister" episode "The Compassionate Society" is a good caricature of this: most doctors want to cure the sick, nothing else, but the real bureaucrat knows that a "well-working" hospital is one with 500 paper pushers pushing "documentation"... the fact that no funds were left to hire any doctors, or admit any patient, is a mere minutia). Curing people _effectively_ requires producing a small but essential paperwork trail (with *second* priority to actually making sick people better, please notice); so does coding effectively -- producing code that actually does useful stuff -- a small but essential paperwork trail needs to be there (with *second* priority). In both cases, the key use of the paperwork is *future* "maintenance". But the patient had better be alive (the software system working), or else perfect paperwork about it can only serve to make bureaucrats happy. So, for example, coding *TESTS* is one of the best ways to express a component's specifications: it's concise and unambiguous in a way that human language never evolved to be. Turn the urge-to-code into "test-first development" (both design, and coding) and your system's quality is poised to take a huge jump upwards. Involve the customer in the tests, given that _their_ motivation is to have a system that works to solve their actual problems, and another jump up in usefulness awaits. Less paperwork, more code -- code that is more likely to solve the real problems and ensure that they are indeed solidly and reliably solved -- THAT is what's worth dreaming of (or, worth doing something about: that's not as hard as all that, since _many_ developers share such dreams, and now that Agile Programming is finally getting decent exposure, it's not all that hard to sell to customers, either!). If you want waterfalls, try Niagara -- rather pretty place. Just leave them out of software development, PLEASE. Alex From gmuller at worldonline.nl Tue Dec 4 13:44:51 2001 From: gmuller at worldonline.nl (GerritM) Date: Tue, 4 Dec 2001 19:44:51 +0100 Subject: Psyco at SourceForge References: Message-ID: <9uj5nj$ss8$1@nereid.worldonline.nl> "Armin Rigo" schreef in bericht news:Pine.OSF.3.96.1011204172638.18805C-100000 at aster2.ulb.ac.be... > Hello everybody, > > I have opened a "Psyco" project at SourceForge: > > http://sourceforge.net/projects/psyco/ > > I suggest that people interested in Psyco post a welcome and start > discussion in the mailing list that I am currently opening there. This > will allow me to stop (mis)using python-dev at python.org and this newsgroup > for all minor announces. > <...snip...> I appreciated your announcements and discussions here, which absolutely is no _mis_use! > > Thanks, > > Armin Rigo. > have fun with extending Psyco, Gerrit -- www.extra.research.philips.com/natlab/sysarch From jkraska at san.rr.com Sun Dec 30 13:29:44 2001 From: jkraska at san.rr.com (Courageous) Date: Sun, 30 Dec 2001 18:29:44 GMT Subject: REPOST: Re: Is learning Python "extraordinary"? References: <3C2DC53F.31010.D9D6B0A@localhost> of "Sat, 29 Dec 2001 13:29:35 PST." <3C2DC53F.31010.D9D6B0A@localhost> Message-ID: <1$--$$_----___-$$$@news.noc.cabal.int> >Whatever you do, after you have written your letter, pack your ego >down to size so you can go back to being a humble learner. The world >is full of traps for young people who have more ego than is good for >them, and it would be a shame to trigger a bunch of them because you >wanted to write the perfect letter to impress MIT. Ego is always healthy, it's narcissism which will strike you down. C// ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Courageous Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:55:53 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774128 27193 211.57.49.2 (31 Dec 2001 04:48:48 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:48:48 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From syang at xplantechnology.com Wed Dec 5 19:05:56 2001 From: syang at xplantechnology.com (Scott Yang) Date: 5 Dec 2001 16:05:56 -0800 Subject: license key validation - encryption/decryption References: <9ujgam$a1e$1@news1.xs4all.nl> <9ulhm1$mmk$1@dahlia.singnet.com.sg> Message-ID: <89f46af4.0112051605.cbd8393@posting.google.com> ngps at madcap.dyndns.org (Ng Pheng Siong) wrote in message news:<9ulhm1$mmk$1 at dahlia.singnet.com.sg>... > > The next problem is where to store the hash. > The hash is part of the signature. You sign your "feature set descriptor" > with your private key. Install the signature with the application. However, you still have to store the signature of your key pair somewhere in the application. And as long as it is stored on the user side, there is a potential being discovered and cracked. > > Which doesn't help at all if both keys are available to the potential > > cracker. > Your private key is not installed with the application. Indeed, it should > be kept very securely. Only the public key is installed, to verify the signature. > > Such schemes won't stop determined pirates, though. They only keep honest > people honest. Exactly! There are always loop-holes even in the most hardened anti-piracy schemes. Sometimes knowing your potential user base might help. Knowing that most of them are actually quite computer-illiterate, it does give you some peace of mind :) -- Scott Yang PGP: 0xF9DCFA8C Xplan Technology Pty Ltd. Software Architect. From sab at NOSPAM.freeuk.com Sat Dec 29 13:25:34 2001 From: sab at NOSPAM.freeuk.com (G. Willoughby) Date: Sat, 29 Dec 2001 18:25:34 -0000 Subject: REPOST: Correct use of Classes? Message-ID: <0$--$$_----___%%%$@news.noc.cabal.int> Hi, Can someone please point me to any docs on the net that deal with correct useage of classes in python. I have been coding with python now for nearly a year but i haven't really touched on using classes, I know how to code them but i need a little guidance for when to use them in the real world. Thanks, G. Willoughby ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "G. Willoughby" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:21:44 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774632 27193 211.57.49.2 (31 Dec 2001 04:57:12 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:57:12 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From tdelaney at avaya.com Wed Dec 5 20:31:48 2001 From: tdelaney at avaya.com (Delaney, Timothy) Date: Thu, 6 Dec 2001 12:31:48 +1100 Subject: PEP 276 Simple Iterator for ints (fwd) Message-ID: > From: Marcin 'Qrczak' Kowalczyk [mailto:qrczak at knm.org.pl] > > Mon, 3 Dec 2001 19:27:46 +1100, Delaney, Timothy > pisze: > > >> I.e. it's translated to 'while' rather than to 'for i in range'. > > > > Definitely not. The name receiving the value from the iterator > > There is no requirement to implement this as using an iterator. There is such a reqirement. All for loops from 2.2 on use iterators. > I meant translating > > for 0 <= i < 10: > print i > > into > > i = 0 > while i < 10: > print i > i += 1 > > There is no iterator here. This would not work with either the old or the new semantics of for loops. It would mean that you would have for loops which in this one particular case behaved differently to all other cases. That would classify as a severe wart. Tim Delaney From chrishbarker at attbi.com Tue Dec 18 15:20:55 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Tue, 18 Dec 2001 12:20:55 -0800 Subject: Idiomatic portable way to strip line endings? References: <3C1E56AA.B7A3C9C9@attbi.com> Message-ID: <3C1FA526.6F693AB1@attbi.com> Guido van Rossum wrote: > > I know Guido, Jack Jansen and I had some discussion about it, and I > > think Jack put a little work into it, but I'm not sure where it > > sits. > > http://sourceforge.net/tracker/index.php?func=detail&aid=476814&group_id=5470&atid=305470 This looks Great! I'll have to test it out! Thanks, Jack -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From rnd at onego.ru Fri Dec 28 08:05:06 2001 From: rnd at onego.ru (Roman Suzi) Date: Fri, 28 Dec 2001 16:05:06 +0300 (MSK) Subject: is this a bug or what? In-Reply-To: Message-ID: On Thu, 27 Dec 2001, I.J. wrote: > >>> M=[[0]*3]*3 > >>> M > [[0, 0, 0], [0, 0, 0], [0, 0, 0]] > >>> M[1][1]=1 > >>> M > [[0, 1, 0], [0, 1, 0], [0, 1, 0]] > > Is this new age math? No. Look at the entry 4.50 in Python FAQ http://www.python.org/cgi-bin/faqw.py?req=show&file=faq04.050.htp Sincerely yours, Roman A.Suzi -- - Petrozavodsk - Karelia - Russia - mailto:rnd at onego.ru - From stephen at stephencox.org Thu Dec 27 01:06:40 2001 From: stephen at stephencox.org (stephen cox) Date: Thu, 27 Dec 2001 06:06:40 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <0$--$$-$$$$%_%$-$$@news.noc.cabal.int> Being new to the Python world I look at it a bit differently. Python is HOT. With Active State's Python for Visual Studio coming up I think Python will be even bigger. Whenever I mention Python or that I plan to attend the Python conference in Feb my friends and follow programmers eyes roll and they wish they had the time. Or a project that they could use to learn and use Python. -- Stephen Cox web.net geek for non-profits, political campaigns, and a few socially conscious businesses. stephen at stephencox.org ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "stephen cox" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:09:20 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775907 27193 211.57.49.2 (31 Dec 2001 05:18:27 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:18:27 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From tim.one at home.com Wed Dec 5 21:00:57 2001 From: tim.one at home.com (Tim Peters) Date: Wed, 5 Dec 2001 21:00:57 -0500 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) In-Reply-To: <20011205192505.B1704@node0.opengeometry.ca> Message-ID: [William Park] > One solution that has been proposed long ago (and many time since) is > end-block keywords like shell. Let's see. for i in range(10): if i % 2 == 0: print i, i**2 shell shell Yup, that works. I'll add from __future__ import shell to 2.2 if it will stop this discussion . From robin at jessikat.fsnet.co.uk Mon Dec 10 13:50:58 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Mon, 10 Dec 2001 18:50:58 +0000 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C0FBAA8.F1A44304@attbi.com> <3C100EFF.6EEA6C7A@cosc.canterbury.ac.nz> <3C1438B0.B1C6D749@cosc.canterbury.ac.nz> <3C14F821.DEE44D5@attbi.com> Message-ID: In article <3C14F821.DEE44D5 at attbi.com>, Chris Barker writes ..... >By the way, the only technical objection I have heard to the mxDateTime >module is that it take 32 bytes (or maybe more) per DateTime object. Is >this a problem for the kind of applications you all forsee using such a >package for? .... yes; for the sort of financial applications that use a lot of accurate to the second datetimes an 8 byte quantity would be entirely sufficient and since it uses only float ops (already in the pythonxx.dll) won't require more than python code. -- Robin Becker From mkelly2002NOSPAM at earthlink.net Mon Dec 24 19:19:52 2001 From: mkelly2002NOSPAM at earthlink.net (Michael Kelly) Date: Tue, 25 Dec 2001 00:19:52 GMT Subject: Looping constructs References: <3c25d37e_9@news.newsgroups.com> <3c26fefc$1_10@news.newsgroups.com> Message-ID: <0ehf2uoemspjnb7p9svjqvjhiu35d08uvo@4ax.com> On Mon, 24 Dec 2001 11:10:50 +0100, "Janos Blazi" wrote: >I think Perl is a wonderful language. When I had to chose between Perl and >Python I chose Python and I have not regretted my choice yet. But I could be >happy with Perl as well. I think we should not make an issue of religion of >choosing the right programming language. I don't do religious wars. It was a joke. Trouble is, as soon as religious programming fervor kicks in, there ain't no sensa' 'uma'. :) I did Perl for a while myself, but I don't use it often enough to remember how to do anything with it. It's fine if you get into it and stay there, but for the occassional dabbler it's too cryptic. Mike -- "I don't want to belong to any club that would have me as a member." -- Groucho Marx From idoerg at cc.huji.ac.il Sat Dec 29 07:39:44 2001 From: idoerg at cc.huji.ac.il (Iddo) Date: 29 Dec 2001 04:39:44 -0800 Subject: long lines in HTML attachments References: <7a256ac1.0112270203.77efb6f2@posting.google.com> Message-ID: <7a256ac1.0112290439.677e909@posting.google.com> "Gillou" wrote in message news:... > Encode your mail body with quoted printable encoding (see doc of module > "quopri"). This way, the recipient's mail client is supposed to re-built the > lines broken by quoted-printable encodings. > I tested this successfully with OE5, Netscape messenger and StarOffice Mail. > Thanks Gilles. Using quopri did the trick :-) Iddo > Don't forget to add this header to your mail: > > "Content-Transfer-Encoding: quoted-printable" > > Or download Python 2.2 that has a new "email" standard package that handles > email messages (parse and marshal/serialize) as Python objects (easier to > handle than playing with the various packages you may need for handling > emails). > Heard that this package is available separately and may work with older > Python versions but I have no URL for this (Google for this). > > HTH > > --Gilles > > "Iddo" a ?crit dans le message news: > 7a256ac1.0112270203.77efb6f2 at posting.google.com... > > Hi, > > > > I am trying to use smtplib and mimecntl to email an attached html > > document. The trouble is that the html document contains some very > > long physical lines (500 chars). It is important that those lines be > > preserved as such, since I use
 formatting in the htdoc. Some
> > mail clients (e.g. Pine 4.40) truncate or insert a linefeed in those
> > lines, creating a mess. Any way of attaching my long-lined files and
> > getting them through intact? Following is a code snippet of what I do.
> > Any help would be appreciated.
> >
> > Thanks,
> >
> > Iddo
>


From ssthapa at classes.cs.uchicago.edu  Tue Dec 18 12:13:41 2001
From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa)
Date: Tue, 18 Dec 2001 17:13:41 GMT
Subject: lost interest?
References: <20011208001123.A5989@casa.parque> 
Message-ID: 

Sean Reifschneider  wrote:
>The problem is largely related to a lack of critical mass.  Nobody uses it
>because nobody uses it.  This was my opinion in March of 2000 at Python 9
>when I showed off my working prototype of a client and server CPAN-like
>system, and it would still seem to be the case.
>

    I definitely agree with this.  I think a big part of it is that initially
there is very little software in the repository so people don't make an effort
to test/debug the client since they don't perceive any immediate benefit to
doing so.

>I demonstrated it at Python 9, and then we got together in the cataloging
>SIG to speak about packaging further.  Active State promised to open up
>their tool, which doesn't seem to have happened.  I expressed the idea that
>I thought packages should, as much as possible, be handled using the native
>system packaging format (using RPMs and .debs, for example), and the idea
>of needing critical mass.  We also talked about making a python-specific
>packaging system, which had some benefits and some drawbacks.

    I really think that unless there a strong push to get a decent repository
set up any solutions are going to flounder.  I also agree that integrating
with the native packaging system (rpm, deb, etc) is very important but
currently distutils only supports windows and rpm installers.  I saw some
activity recently on the distutils-sig on getting a bdist_deb target in
distutils but I don't think much came of it.

>So, is it that the people who want it aren't the people who can make it
>happen?  Are the people who want it to happen not motivated enough to
>actually do something about it?  Is it just not really that interesting of
>a problem?
>
>I wish I had an answer there.
>
>So, currently the system I built is gathering dust.  I've set up resources
>for Suchandra to host his code.  I hope it goes better.

    I've seen some feedback and some activity however I wish there were more
responses one way or another.  

>So, if you want to see it happen, I'd have these words of advice:  Get
>Involved.  Get some packages uploaded, use it, advocate it...

    Definitely, if nothing else test it out and submit a report of failures
or successes.  If module authors were to submit or give the location of
their modules it would definitely help the packages available for 
download work significantly.    

-- 
----------------------------------------------------------------------------
	   		              |
Suchandra Thapa                       | "There are only two kinds of math . 
s-thapa-11 at NOSPAMalumni.uchicago.edu  | books. Those you cannot read beyond 
			              | the first sentence, and those you 
			              | can not read beyond the first page."
			              |                     -C.N. Yang
----------------------------------------------------------------------------


From h.jehadalwan at student.kun.nl  Sun Dec 23 11:47:14 2001
From: h.jehadalwan at student.kun.nl (husam)
Date: Sun, 23 Dec 2001 17:47:14 +0100
Subject: Search the difference: Why this function defenition does'nt   work?
References: 
Message-ID: <3C260A92.5030907@student.kun.nl>

Roman Suzi wrote:

> On Sun, 23 Dec 2001, husam wrote:
> 
> 
>>But when I adjust the code to this:
>>
>>sum=['c']
>>
>>it still does not work, despite the fact that sum is not an undefined
>>object, right?
>>
> 
> Probably this is what is slightly more compact approach to your
> problem of making sum of numbers:
> 
> 
>>>>f = lambda *args: reduce(lambda x, y: x+y, args, 0)
>>>>f(1,2,3)
>>>>
> 6
> 
> As for slices vs. indices, it is clear that
> 
> a[0] is not a[:0]
> 
> because a[0] is an element and a[:0] is a subsequence.
> 
> I am not sure why do you need to change fun2, but
> this is what will work:
> 
> def fun2 (*args):
>         sum = args and args[0] or 0
>         for next in args[1:]:
>                 sum = sum + next
>         return sum
> 
> In any case, it is impossible to make universal summing function without
> specifying the zero-len case.
> 
> 
> Sincerely yours, Roman Suzi
> 


I'm not trying to add string to a list of integeres. What I wanted to do 
is to add each argument of func2('a','b','c') to sum=['e']. Since sum is 
a list of chars, and the arguments are accessable as a sequence, one 
would expect that the addition operation would be correct. On the 
interactive shell, it is a trivial operation. But, only when i use it in 
the function defenition i get problems. Adding 'a' to ['b'] does not 
work, but adding list('a') to ['b'] it does, so, i thought that this 
might help my code, but converting the args to a list did not helpe 
either . I really didn't get yet!






From aleax at aleax.it  Fri Dec 28 11:42:47 2001
From: aleax at aleax.it (Alex Martelli)
Date: Fri, 28 Dec 2001 17:42:47 +0100
Subject: REPOST: Re: base64.decodestring gives binascii.error
References: <3C2C03CB.7030000@pacific-shores.com>  <3C2C9D79.9050501@pacific-shores.com>
Message-ID: <5$--$$_----_---%%$@news.noc.cabal.int>

"Erik Myllymaki"  wrote in message
news:3C2C9D79.9050501 at pacific-shores.com...
> The '_' and '!' were in the original string that was then encoded, not
> in the resulting encoded string.

Then, it's clearly a bug in the base64 module you're using.  I
don't see it here:

>>> x=base64.encodestring('oh_my!')
>>> x
'b2hfbXkh\n'
>>> base64.decodestring(x)
'oh_my!'
>>>


[original context was -- oh those hateful add-in-front habits!:

> >>should base64.decodestring give a binascii.error if it encounters
> >>special chars like '_' and '!' ?
> >
> > Makes sense to me; after all, such characters should never be
> > in a string produced by base64, so the data must have been
> > damaged in transit -- raising an exceptions seems appropriate.

]


Alex

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.tele.dk!small.news.tele.dk!134.75.7.11!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: "Alex Martelli" 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 02:09:17 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775207 27193 211.57.49.2 (31 Dec 2001 05:06:47 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:06:47 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From lull at acm.org  Mon Dec 31 16:11:08 2001
From: lull at acm.org (John Lull)
Date: 31 Dec 2001 15:11:08 -0600
Subject: Basic threading questions
References:  
Message-ID: 

"Jason Orendorff"  wrote (with possible deletions):

> No.  Most block nicely.  If you find one that doesn't,
> it's (almost certainly) a bug.

So the note in the thread module documentation is pretty much obsolete?

> This page starts with a very technical discussion:
> http://www.python.org/doc/current/api/threads.html

This was pretty clear.  For my needs, then, it appears that the thread safety of
various operations boils down to whether they are effectively atomic (i.e.
atomic so far as other threads running under the same copy of the Python
interpreter are concerned).

I would assume that all built-in functions, and all methods of all built-in
types, are implemented as C functions rather than compiling to sequences of
interpreter byte-codes.  They should therefore be effectively atomic if they
don't use blocking system services. Is that a good assumption?

Which built-in operations are blocking should be pretty obvious from either the
documentation or the basic nature of the operation. Are there any non-obvious
blocking built-in operations?


Thanks *very* much for your swift response to my earlier query.

Regards,
John



From jpt.d at rogers.com  Sun Dec 30 22:40:22 2001
From: jpt.d at rogers.com (Jeffrey Drake)
Date: Mon, 31 Dec 2001 03:40:22 GMT
Subject: Python Popularity, python at sourceforge
References:   <3C2FBA84.490E5D7E@chello.nl>
Message-ID: <3c2fdce9.28535902@nntp>

I believe your statistic draw the wrong conclusion as well.

>From what I saw you don't make any notice to what the languages are
commonly used for.

(this list maybe wrong, or a little off)
PHP is primarily a web language.
Java is primarily used for user interfaces on websites and gui.
Perl is both web language and console, but usually not gui interface.
C++ and C are completely general in their scope, however usually
	aren't used for web

Python is also quite general, save the purpose of including it in
	other programs (like inside C/C++ programs)

As said before Ruby is growing popularity, I believe it is also
general.

Lua isn't mentioned either, its purpose is almost exclusively for
	inclusion in programs

If your statistics were based on types of usage, they may mean more

Regards,
Jeffrey Drake


From jcromwell at ciena.com  Tue Dec  4 15:06:05 2001
From: jcromwell at ciena.com (Cromwell, Jeremy)
Date: Tue, 4 Dec 2001 12:06:05 -0800 
Subject: more fun with PEP 276    
Message-ID: 

Oops, the rowcount example already worked with what James wrote.  My
addition is for supporting sequence index spanning.

-----Original Message-----
From: Cromwell, Jeremy 
Sent: Tuesday, December 04, 2001 11:57 AM
To: python-list at python.org
Subject: RE: more fun with PEP 276 


James,
You left out the best part! By adding a little snippet to all the div
routines, you can solve the original problem (having an index that spans a
list.)

  try: 
    other = len(other)
  except: 
    pass

Now you can write:

    for i in span/table.rowcount:
        for j in span/table.colcount:
            print table.value(i,j)


Thanks to your hard work, we can play with this implementation and come up
with some new ideas (maybe we'll even come up with a good one!)

For example by adding different operators:
  __lshift__, __rrshift__  = __div__, __rdiv__
  __rshift__, __rlshift__  = __floordiv__, __rfloordiv__
and setting:
  __ = span # in the spirit of ...

then

>>> list(3>>__>>9)
[4, 5, 6, 7, 8, 9]
>>> list(3>>__<<9)
[4, 5, 6, 7, 8]
>>> list(3<<__<<9)
[3, 4, 5, 6, 7, 8]
>>> list(3<<__>>9)
[3, 4, 5, 6, 7, 8, 9]

which allows

    for i in __<< table.rowcount:
        for j in __<< table.colcount:
            print table.value(i,j)

Jeremy Cromwell
#############################################
"Heaven goes by favor, If it went by merit, you would stay out and your
dog would go in."
--Mark Twain


-----Original Message-----
From: James_Althoff at i2.com [mailto:James_Althoff at i2.com]
Sent: Monday, December 03, 2001 4:04 PM
To: python-list at python.org
Subject: more fun with PEP 276 



It is readily apparent from the PEP 276 thread that while the author has
tried his best to do the tedious, dirty work of showing the modest benefits
of the modest proposal actually contained in PEP 276 many of those
contributing to the thread, OTOH, have been having quite a jolly good time
offering suggestions for wholesale changes in the area of for-loops,
integer sequences, lists, iterators, etc.  Is there any compelling reason
why everyone else should be having all the fun?  I think not.

And so, without further adieu, here comes "yet another proposal for
changing the heck out of for-loops".

The thinking goes as follows.

Let's start with Greg Ewing's recent suggestion of writing for-loops as:

    for -5 <= i <= 5:
        print i

The nice thing about the above is the apparent clarity of intent.  And the
fact that all combinations of open and closed intervals are handled nicely.
On the down side we observe that this construct requires new syntax, that
it doesn't work outside of the context of a for-loop (in fact, it is a
relational expression outside the context of a for-loop), and that there is
no apparent mechanism for having a step size other than 1 (or -1).

Now I, for one, happen to like the "for i in iterator:" construct (with
emphasis on the *in*).  Also, others have seemed to show fondness for the
Haskell-like style of:

    [0,1 ... 10]

(using the suggested existing Python ellipsis notation, i.e., "...").

So what if we turn things around a little and say:

    for i in -5 <= ... <= 5:
        print i

One little hitch is that Python only supports the ellipsis literal, "...",
in slice notation.  So this would require syntax changes.  We really prefer
*not* to ask for such, right?

So for now, what if we just used a builtin object, let's call it "span"
(spam's more-respected cousin ;-).

span represents something that knows how to create an iterator for a "span
of numbers" between a given one and another.

So we would now write:

    for i in -5 <= span <= 5:
        print i

We can make span an instance of a class and then note that "<=", ">=", etc.
are operators that we can implement using the magic methods __le__, __ge__,
etc.

Unfortunately, this won't work very well because of a couple of things.
The comparison magic methods don't have left and right versions the way
arithmetic operators do.  So we can't really distinguish increasing
sequences from decreasing sequences like we would want.  Worse is that

    -5 <= span <= 5

turns into "(-5 <= span) and (span <= 5)" instead of "(-5 <= span) <= 5)".
And we have no control over this.  Finally, "-5 <= span <= 5" when used in
an "if" statement should do something boolean and not something
iterator-ish to be consistent with relational expressions in general.

So creating a class that redefines the relational operators doesn't work
out quite as well as one would hope in this situation.

But, if we were willing to be somewhat flexible and non-perfectionistic, we
could try a slight variation on all of this.

Given that some have suggested using [xxx], [xxx), (xxx] as ways of
indicating various combinations of open and closed intervals (to the dismay
of others), the following might not be such a traumatic stretch.

Suppose we use "/" to indicate an open interval and "//" to indicate a
closed interval as in, for example:

    -3 // ... // 3  # closed-closed: -3, -2, -1, 0, 1, 2, 3

    -3 // ... / 3  # closed-open: -3, -2, -1, 0, 1, 2

    -3 / ... // 3  # open-closed: -2, -1, 0, 1, 2, 3

    -3 / ... / 3  # open-open: -2, -1, 0, 1, 2

etc.

Let's continue using "span", though, instead of "..." so that we don't
require syntax changes.

Note that "//" and "/" are operators with corresponding magic methods (in
Python 2.2).  Further note that they each have left and right versions.

We now create a class, IteratorBounds that holds the start value, stop
value, step value, and "open/closed" status for the left and right sides of
an enumeration of numbers.  We make a default instance of IteratorBounds
named "span" with the following default values:

stop == 0
start == 0
step == 1
left == 'closed'
right == 'closed'

Using the example implementation included at the end of this message, we
can write things like:

Python 2.2b1 (#25, Oct 19 2001, 11:44:52) [MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

>>> for i in -5 // span // 5:  # closed-closed
...     print i,
...
-5 -4 -3 -2 -1 0 1 2 3 4 5
>>>

>>> for i in -5 / span / 5:  # open-open
...     print i,
...
-4 -3 -2 -1 0 1 2 3 4
>>>

>>> for i in -5 // span / 5:  # closed-open
...     print i,
...
-5 -4 -3 -2 -1 0 1 2 3 4
>>>

>>> for i in -5 / span // 5:  # open-closed
...     print i,
...
-4 -3 -2 -1 0 1 2 3 4 5
>>>


We can handle descending intervals as well as ascending (specified by
reversing the order) as in:

>>> for i in 5 // span // -5:  # descending closed-closed
...     print i,
...
5 4 3 2 1 0 -1 -2 -3 -4 -5
>>>


We can do shortcuts as in:

>>> for i in span // 5:
...     print i,
...
0 1 2 3 4 5
>>>

>>> for i in -5 // span:
...     print i,
...
-5 -4 -3 -2 -1 0
>>>


We can also change the step size (using several techniques) as in:

>>> for i in 0 // span(step=2) // 20:
...     print i,
...
0 2 4 6 8 10 12 14 16 18 20
>>>

>>> for i in 0 // span.by(2) // 20:
...     print i,
...
0 2 4 6 8 10 12 14 16 18 20
>>>


Returning to the motivating example of PEP 276, we can easily index
structures as in:

>>> mylist = [0,1,2,3,4,5,6,7,8,9]
>>>
>>> for i in span / len(mylist):
...     print mylist[i],
...
0 1 2 3 4 5 6 7 8 9
>>>

or for those that like to be more explicit:

>>> for i in 0 // span / len(mylist):
...     print mylist[i],
...
0 1 2 3 4 5 6 7 8 9
>>>

Other indexing examples:

>>> for i in len(mylist) / span // 0:  # access in reverse order
...     print mylist[i],
...
9 8 7 6 5 4 3 2 1 0
>>>

>>> for i in len(mylist) / span:  # reverse order short form
...     print mylist[i],
...
9 8 7 6 5 4 3 2 1 0
>>>

>>> for i in span(step=2) / len(mylist):  # access every other item
...     print mylist[i],
...
0 2 4 6 8
>>>

>>> for i in span(step=3) / len(mylist):  # every third item
...     print mylist[i],
...
0 3 6 9
>>>


But wait, there's more ...

This mechanism works outside of for-loops equally well.

>>>
>>> list(0 // span // 9)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>>
>>> list(span // 9)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>>
>>> list(-5 // span // 5)
[-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]
>>>
>>> list(-5 / span / 5)
[-4, -3, -2, -1, 0, 1, 2, 3, 4]
>>>
>>> list(5 // span // -5)
[5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5]
>>>
>>> list(5 / span / -5)
[4, 3, 2, 1, 0, -1, -2, -3, -4]
>>>
>>> list(0 // span(step=2) // 20)
[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
>>>
>>> list(20 / span(step=3) / 0)
[17, 14, 11, 8, 5, 2]
>>>
>>> i = 3
>>> i in 0 // span // 5
1
>>> i in -5 // span // 0
0
>>>


And, if you order now, we'll throw in:

>>>
>>> [1,2,3] + 10 // span // 15 + [21,22,23]
[1, 2, 3, 10, 11, 12, 13, 14, 15, 21, 22, 23]
>>>


But wait, there's even *more*.

>>>
>>> list('a' // span // 'j')
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
>>>
>>> list('a' // span(step=2) // 'z')
['a', 'c', 'e', 'g', 'i', 'k', 'm', 'o', 'q', 's', 'u', 'w', 'y']
>>>
>>> list('z' // span // 'a')
['z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm', 'l',
'k', 'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a']
>>>


The (claimed) advantages with this scheme include:
- no syntax changes required (!!!)
- handles all combinations of closed/open intervals
- handles descending as well as ascending intervals
- allows step size to be specified
- reuses the "i in iterator" paradigm of existing for-loops
- supports shortcuts for the common case of indexing from 0 to len-1
- works outside of for-loops ("in" statement, list & tuple functions)
- no confusion with or overloading of list or tuple syntax
- no list versus iterator confusion
- is reasonably transparent (once you get used to it ;-)
- is straightforward to implement

On the down side:
- not as immediately transparent as "-5 <= i <= 5"

Anyway, another nice advantage is that you can take the example
implementation below and play with it before finalizing your opinion (which
I hope you will do :-).  Note, the iterator in the example implementation
uses a 2.2 generator, so you need 2.2.  (Or you could implement a separate
iterator class and try it in 2.1).

Now, that *was* fun, wasn't it.  

Jim

====================================

from __future__ import generators

import operator


class IteratorBounds:

    stopOpDict = {
        (1,0):operator.__lt__,  # step positive, rightside open
        (1,1):operator.__le__,  # step positive, rightside closed
        (0,0):operator.__gt__,  # step negative, leftside open
        (0,1):operator.__ge__   # step negative, leftside closed
        }

    def __init__(self,stop=0,start=0,step=1,left='closed',right='closed'):
        self.stop = stop
        self.start = start
        self.step = step
        self.left = left    # 'closed' or 'open'
        self.right = right  # 'closed' or 'open'

    def __call__(self,stop=0,start=0,step=1,left='closed',right='closed'):
        return IteratorBounds(
            stop=stop,
            start=start,
            step=step,
            left=left,
            right=right)

    def __iter__(self):
        start,stop = self.calcStartStop()
        if start is None:
            raise StopIteration
            return
        step = self.step
        if ((stop > start and step < 0) or
            (stop < start and step > 0)):
            step = -step
        i = start
        if self.left == 'open':
            i = self.calcNext(i,step)
            if i is None:
                raise StopIteration
                return
        stopOp = self.stopOpDict[(step >= 0),(self.right == 'closed')]
        while 1:
            if not stopOp(i,stop):
                break
            yield i
            i = self.calcNext(i,step)
            if i is None:
                break
        raise StopIteration

    def calcStartStop(self):
        start = self.start
        stop = self.stop
        if isinstance(start,str) and not isinstance(stop,str):
            try:
                stop = chr(stop)
            except:
                return None,None
        elif isinstance(stop,str) and not isinstance(start,str):
            try:
                start = chr(start)
            except:
                return None,None
        return start,stop

    def calcNext(self,obj,step):
        if isinstance(obj,str):
            try:
                return chr(ord(obj)+step)
            except:
                return
        return obj + step

    def __div__(self,other):
        '''Return an IteratorBounds that is open on the RHS at other'''
        result = IteratorBounds(
            stop=other,
            start=self.start,
            step=self.step,
            left=self.left,
            right='open')
        return result

    def __floordiv__(self,other):
        '''Return an IteratorBounds that is closed on the RHS at other'''
        result = IteratorBounds(
            stop=other,
            start=self.start,
            step=self.step,
            left=self.left,
            right='closed')
        return result

    def __rdiv__(self,other):
        '''Return an IteratorBounds that is open on the LHS at other'''
        result = IteratorBounds(
            stop=self.stop,
            start=other,
            step=self.step,
            left='open',
            right=self.right)
        return result

    def __rfloordiv__(self,other):
        '''Return an IteratorBounds that is closed on the LHS at other'''
        result = IteratorBounds(
            stop=self.stop,
            start=other,
            step=self.step,
            left='closed',
            right=self.right)
        return result

    def __pow__(self,other):
        '''Return an IteratorBounds with step set to other'''
        if not isinstance(other,int):
            raise TypeError
        result = IteratorBounds(
            stop=self.stop,
            start=self.start,
            step=other,
            left=self.left,
            right=self.right)
        return result

    def by(self,step):
        '''Return an IteratorBounds with step set to step'''
        if not isinstance(step,int):
            raise TypeError
        result = IteratorBounds(
            stop=self.stop,
            start=self.start,
            step = step,
            left = self.left,
            right = self.right)
        return result

    def __add__(self,other):
        '''Create a list on self and add to other'''
        if isinstance(other,list):
            return list(self) + other
        raise TypeError

    def __radd__(self,other):
        '''Create a list on self and add to other'''
        if isinstance(other,list):
            return  other + list(self)
        raise TypeError


span = IteratorBounds()  # Default instance


#$ Testing

def test(testItem):
    result = list(eval(testItem[0])) == testItem[1]
    print testItem[0], '   passed:', result

def runtests():
    testList = [
        ('-5 // span // 5', [-5,-4,-3,-2,-1,0,1,2,3,4,5]),
        ('-5 / span / 5', [-4,-3,-2,-1,0,1,2,3,4]),
        ('-5 // span / 5', [-5,-4,-3,-2,-1,0,1,2,3,4]),
        ('-5 / span // 5', [-4,-3,-2,-1,0,1,2,3,4,5]),
        ('5 // span // -5', [5,4,3,2,1,0,-1,-2,-3,-4,-5]),
        ('5 / span / -5', [4,3,2,1,0,-1,-2,-3,-4]),
        ('5 // span / -5', [5,4,3,2,1,0,-1,-2,-3,-4]),
        ('5 / span // -5', [4,3,2,1,0,-1,-2,-3,-4,-5]),
        ('-5 // span.by(2) // 5', [-5,-3,-1,1,3,5]),
        ('-5 // span(step=2) // 5', [-5,-3,-1,1,3,5]),
        ('-5 // span **2 // 5', [-5,-3,-1,1,3,5]),
        ('5 // span.by(-2) // -5', [5,3,1,-1,-3,-5]),
        ('5 // span(step=-2) // -5', [5,3,1,-1,-3,-5]),
        ('5 // span **-2 // -5', [5,3,1,-1,-3,-5]),
        ('span // 5', [0,1,2,3,4,5]),
        ('span / 5', [0,1,2,3,4]),
        ('-5 // span', [-5,-4,-3,-2,-1,0]),
        ('-5 / span', [-4,-3,-2,-1,0]),
        ("'a' // span // 'd'", ['a','b','c','d']),
        ("'a' / span / 'd'", ['b','c']),
        ("'z' // span // 'w'", ['z','y','x','w']),
        ("'z' / span / 'w'", ['y','x']),
        ("'a' // span.by(2) // 'j'", ['a','c','e','g','i']),
        ("'z' / span.by(2) / 'p'", ['x','v','t','r'])
        ]
    for testItem in testList:
        test(testItem)



-- 
http://mail.python.org/mailman/listinfo/python-list



From db3l at fitlinxx.com  Fri Dec  7 22:49:50 2001
From: db3l at fitlinxx.com (David Bolen)
Date: 07 Dec 2001 22:49:50 -0500
Subject: Monitoring the windows clipboard
References: <48dbc3f6.0112071800.7f7fd0b9@posting.google.com>
Message-ID: 

toflatpy2 at oaktown.org (toflat) writes:

> Hey there, newbie guy here again, with you guessed it, another newbie
> question...
> 
> I have this shareware app that works with text files and has an
> "Automatic paste" feature. When this feature is activated it
> automatically pastes any text that is copied to the windows clipboard
> to whatever file is active in the program. So it has a way of
> monitoring the windows clipboard and pasting the contents to a new
> line in the file whenever something new is added to the clipboard. It
> seems to be pretty instantaneous (i get a little system 'beep').
> 
> Is there a way I can get Python to do the same thing? 

There is a way for a program to register itself as a "clipboard
viewer" (with the SetClipboardViewer call) which requires a Window
(can be hidden) and message queue to process messages, one of which is
the WM_DRAWCLIPBOARD message that is sent whenever the clipboard
changes.

I'm not sure that there's any other way to get notified, but
presumably your shareware app could be doing this and then taking any
text data from the clipboard in response to the message, rather than
displaying it.

Presumably you could do something similar using the win32clipboard
module, which does wrap the necessary functions, along with win32gui
which you'd need to create a window and process the message loop.
When you receive the change notification you can use the functions in
win32clipboard to retrieve the data.

There's a clipboard demo in the demos directory beneath win32 that
gets installed with the win32all package - it only does direct access
to the clipboard (no monitoring) but might help with the latter part.
There are other demos in the pythonwin/pywin/demos subdirectory off of
your Python installation (also installed with win32all) that cover
some of the basic window operations.

I haven't written code interacting with the clipboard myself at this
point, but hopefully this can get you started in the right direction.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/


From kragen at pobox.com  Sat Dec  1 04:53:21 2001
From: kragen at pobox.com (Kragen Sitaker)
Date: 01 Dec 2001 04:53:21 -0500
Subject: Scientific Libraries in Python
References:  <375ad208.0111261037.5a591853@posting.google.com> 
Message-ID: <83k7w7tgfi.fsf@panacea.canonical.org>

Travis Oliphant  writes:
> > As regards the MayaVi license, MayaVi was developed for the community
> > so I didn't want someone to take the MayaVi codebase, use it for their
> > own purposes and not give back anything in terms of code to the
> > community.  That is why I chose the GPL.  However, the GPL does force
> > everyone else who links to it to be GPL.  I guess LGPL might also work
> > but I really don't know.  I'll try to give it some thought.  Anyway, I
> > am not sure you want to put all packages into one huge super package.
> > It would be a nightmare to package/distribute!  I'd really pity the
> > person who'd have to maintain such a beast.
> 
> The LGPL does what it seems like you want you want (doesn't allow people
> to take your particular code, alter it slightly and make it proprietary),
> but it also allows people to release a larger application which only links
> to your code under a non-GPL license.

Right.  Their only obligation would be to let people drop in newer
versions of MayaVi.  So, for example, Mathematica or IDL could add
MayaVi as a plotting option if you released it under the LGPL.

> My understanding is that if you keep the GPL, then folks could build an
> interface, but they could not distribute mayavi with the interface under
> anything but the GPL.

Right.

> That's why I much prefer the LGPL to the GPL for tools which could be
> "hooked together."

And it's why some other people much prefer the GPL to the LGPL for
those same tools.

> Enthought is also interested in distributing an "everything included"
> distribution which contains many of the above packages you mentioned, but
> to distribute such a beast which all worked together dynamically, my
> understanding is that none of the included packages could be GPL (LGPL
> would be O.K.)

That is only the case if some of the included packages are proprietary
or under a GPL-incompatible free-software license.  Does Enthought
want to include proprietary software in their distribution?



From nhodgson at bigpond.net.au  Wed Dec 19 00:28:39 2001
From: nhodgson at bigpond.net.au (Neil Hodgson)
Date: Wed, 19 Dec 2001 05:28:39 GMT
Subject: EM_GETLINE,Win32gui, address of buffer
References: <0TST7.436$Cw3.49740@newsread2.prod.itd.earthlink.net>
Message-ID: 

Mark_Pryor:
> When I use the message, EM_GETLINE, the lParam calls for
> an address of a string buffer. How do I prepare this buffer in Python?

   Use the array module to create a buffer of a reasonable size and then
find its address as the first element of the tuple returned by the
buffer_info method.

>>> import array
>>> b = array.array('c', 'x'*1000)
>>> b.buffer_info()
(15080104, 1000)
>>>

   Ensure that the buffer object's life outlives your use of the address.

   Neil





From usenet at thinkspot.net  Sat Dec 29 20:24:19 2001
From: usenet at thinkspot.net (Sheila King)
Date: Sat, 29 Dec 2001 17:24:19 -0800
Subject: REPOST: Re: Is learning Python "extraordinary"?
References:  <3C2E5706.5880983E@engcorp.com>
Message-ID: <7$--$$_----___%$%$@news.noc.cabal.int>

On Sat, 29 Dec 2001 18:51:34 -0500, Peter Hansen  wrote
in comp.lang.python in article <3C2E5706.5880983E at engcorp.com>:

> I'm afraid not.  All the developers I've hired in the last
> two years took about a week to become productive with Python
> after being exposed to it for the first time.  Of course,
> maybe they're *all* extraordinary!

And these developers you hired were high school students applying for
admission to college?

I think that you're answering with the wrong comparison group as your
background sample. Certainly I'd expect any professional developer to be
able to pick up Python in a week. But, among the set of all students
applying for university admission, how many of them have taught themselves
Python? I think this is an important distinction.

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Sheila King 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 03:12:43 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774661 27193 211.57.49.2 (31 Dec 2001 04:57:41 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:57:41 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From donn at u.washington.edu  Wed Dec 19 12:26:18 2001
From: donn at u.washington.edu (Donn Cave)
Date: 19 Dec 2001 17:26:18 GMT
Subject: Python as RedHat/SysV service
References: <9voavb$rpj$1@nntp2-cm.news.eni.net> <9voe89$119q$1@nntp6.u.washington.edu> <9vqd6v$auu$1@nntp2-cm.news.eni.net>
Message-ID: <9vqijq$18ic$1@nntp6.u.washington.edu>

Quoth "Stuart D. Gathman" :
...
| Many RedHat service put pid files in /var/run.  The "standard method" for
| starting the service (a shell function named 'daemon') does not report the
| pid, so the init.d script cannot write the pid file.  However, the
| service runs as 'mail' (it is a milter), and /var/run is writable only by
| root (as it should be), so the service can't create the pid file either.
| Should I create an empty pid file in the script, then fill in the pid in
| the service?
|
| I am getting the impression that I should ignore the standard shell
| functions for init.d . . .

(It's a "milter" - m(ail f)ilter?  Cool, I will amaze my colleagues
with my hipness when I use this term!)

If you're in control of the script, I think it would be excusable under
the circumstances to write the pid file elsewhere, assuming there is some
place in the filesystem where that's allowed.

I don't know what Redhat's stuff looks like specifically, but to the
extent you can make your application fit in, that seems like a good
thing to me in principle.  System startup is not the place to be original.
I'm talking about common init.d type setups, though (which you'll find
today even on NetBSD).  I have to admit I would draw the line with AIX,
which I see you mention in another post.

	Donn Cave, donn at u.washington.edu


From fgeiger at datec.at  Mon Dec  3 03:06:15 2001
From: fgeiger at datec.at (F. GEIGER)
Date: Mon, 3 Dec 2001 09:06:15 +0100
Subject: AW: Are there any PEPs for typed arguments?
In-Reply-To: <007601c17b64$af4e12c0$445d4540@Dell2>
Message-ID: 

> I think that a better question is why are you adding these asserts in
> the first place?

Call it a strange habit, but I like to catch bugs as early as possible.
Sure, some way down the code such errors will show up. But then you have to
figure out where and how it was introduced. For that you likely will use
assertions...

> Are you claiming that "meth" would not work correctly if I passed a
> small long for "a" or that I could not use a instance that supports
> __getitem__ (that always returns a length 1 string), __len__ and a few
> other string methods for "b"?

Okay, okay. So take this one:

def meth(mine, yours):
   assert isinstance(mine, MyClass)
   assert isinstance(yours, YourClass)
   
   return

meth(YourClass(), MyClass()) # Wrong order of args


Another thought: If I document my code, I often do it like so:

'''
[String] = object.meth(mine: MyClass, yours: YourClass)
'''

This already says it all. I do not need to write "mine is of type MyClass
and you should assure that this is fullfilled" or something like that. I
also do not have to write in a Windows-like manner "myclassMine is of type
you guess by its prefix, it's of type MyClass".

So now I have to implement it. To assure requirements and promises as
documented I have to convert

object.meth(mine: MyClass, yours: YourClass)

into

def object.meth(mine, yours):
   assert isinstance(mine, MyClass)
   assert isinstance(yours, YourClass)

I do this over and over again. An interpreter could do this once, when it
compiles my sources to byte-code. Again: No static type checking, only
convert some notion into assertions. No big deal. Simply a method to catch
bugs already in a first shot, even before writing and executing test beds.


Cheers
Franz


P.S.: It was not my intention to start a new "type-system thread". OTOH I
did not know that there's already that much stuff discussed on topics like
this. There's even a SIG existing for this (as an other poster pointed out)!


> -----Ursprungliche Nachricht-----
> Von: Brian Quinlan [mailto:brian at sweetapp.com]
> Gesendet: Sonntag, 02. Dezember 2001 20:08
> An: 'F. GEIGER'
> Cc: python-list at python.org
> Betreff: RE: Are there any PEPs for typed arguments?
>
>
> F. GEIGER wrote:
> > Are there any ideas to promote these lines
> >
> > def meth(a, b, c, d):
> >    assert type(a) == IntType
> >    assert type(b) == StringType
> >    assert isinstance(c, MyClass)
> >     
> >    return
> >
> > into something like this:
> >
> > def meth(a: IntType, b: StringType, c: MyClass, d):
> >    
> >    return
> >
> > in a future version of Python?
>
> I think that a better question is why are you adding these asserts in
> the first place?
>
> Are you claiming that "meth" would not work correctly if I passed a
> small long for "a" or that I could not use a instance that supports
> __getitem__ (that always returns a length 1 string), __len__ and a few
> other string methods for "b"?
>
> So why restrict the use of compatible types?
>
> Cheers,
> Brian
>
>




From rdsteph at earthlink.net  Fri Dec 28 19:43:58 2001
From: rdsteph at earthlink.net (Ron Stephens)
Date: Sat, 29 Dec 2001 00:43:58 GMT
Subject: REPOST: Re: Python Popularity: Questions and Comments
References: <3C2A9D33.67FEC261@earthlink.net>  <3C2B9E04.9957801F@earthlink.net>  
Message-ID: <0$--$$_----_-%$%%$@news.noc.cabal.int>

Do the recetnly published books on Zope help at all to alleviate the problem
of inadequate documentation of Zope?

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Ron Stephens 
Newsgroups: comp.lang.python
Subject: cmsg cancel <3C2D1251.C8A25110 at earthlink.net>
Control: cancel <3C2D1251.C8A25110 at earthlink.net>
Date: Mon, 31 Dec 2001 02:03:20 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774949 27193 211.57.49.2 (31 Dec 2001 05:02:29 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:02:29 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From store_li at sina.com  Mon Dec 17 08:08:36 2001
From: store_li at sina.com (Kick)
Date: Mon, 17 Dec 2001 21:08:36 +0800
Subject: mySQL
References: 
Message-ID: <9vkqru$g4vr0$1@ID-12869.news.dfncis.de>

There is no build in support. But you can get python-mysql-module or mxODBC
in SourceForge.
"Preben"  wrote in message
news:Qx_S7.4$Vj5.471 at nreader1.kpnqwest.net...
> Is there any built-in modules for connecting databases
> such as mySQL?
>
> Or do I have to make them myself?
>
>




From wex at flarg.com  Wed Dec 26 10:51:41 2001
From: wex at flarg.com (Daniel Wexler)
Date: Wed, 26 Dec 2001 15:51:41 GMT
Subject: Offer to purchase Wexler.com
Message-ID: 

Mr. Wexler,

I see that you are the administrative contact for the domain
name wexler.com, and that the domain is currently not being
used.  I am also a Wexler and I am interested in using that
domain name for my personal homepage.  Currently I use
www.flarg.com, but I would prefer to use wexler.com for
obvious reasons.

I would be happy to cover the costs you have spent to maintain
the domain name over the past few years in exchange for
ownership of the domain.  If you are interested in selling the
domain name for, say, $100, please let me know.


Thank you,

Daniel Wexler
wex at flarg.com
http://www.flarg.com




From rdsteph at earthlink.net  Fri Dec 28 20:17:10 2001
From: rdsteph at earthlink.net (Ron Stephens)
Date: Sat, 29 Dec 2001 01:17:10 GMT
Subject: Python Popularity: Questions and Comments
References: <3C2A9D33.67FEC261@earthlink.net> <3C2B7276.88339BE7@earthlink.net> 
Message-ID: <3C2D1A0C.DF930726@earthlink.net>

Alex Martelli wrote:

....Hmmm, I think it's all my fault ...(snip-snip)..I basically turned
off the Python newsgroup (and other netnews) to concentrate on other
activity...(snip-snip).....Some day or other, I'll be back with my exaggerated
posting volume... just
got a few books & projects to complete first......

I noticed. It's sure good to read your posts again, Alex ;-)))))

Looking forward to "Python in a Nutshell" and the "Python Cookbook",  but
missing intelligent posts and exponentially rising graph-lines for
comp.lang.python usage in the meantime'ly yours,

Ron Stephens
http://www.awaretek.com/plf.html



> "Hans Nowak"  wrote in message
> news:3C2B7276.88339BE7 at earthlink.net...
> > Ron Stephens wrote:
>     ...
> > > Sourceforge projects, about 1300 to 80). By the way, Just van Rossum's
> > > http://starship.python.net/~just/comp.lang.python/ graph of Python
> > > newsgroup coverage seems to show a slight decline from over 6000 per
> > > month in late-middle 2001 to the current 3500 or so I see on here. Mr.
> > > van Rossum said he may not be able to update these any more due to some
> > > Yahoo change; anyway, am I interpreting these numbers and trends
> > > accurately? Will the Python newsgroup usage turn upwards again? Does it
> > > matter?
>
> Hmmm, I think it's all my fault -- in late-middle 2001 I basically turned
> off the Python newsgroup (and other netnews) to concentrate on other
> activity
> (all Python-related).  And, these days, less and less often do I find myself
> somewhere with a newsreader and no other applicable tools (but it still
> happens from time to time, e.g. today).
>
> Some day or other, I'll be back with my exaggerated posting volume... just
> got a few books & projects to complete first...
>
> Alex






From aahz at panix.com  Tue Dec 25 23:06:58 2001
From: aahz at panix.com (Aahz Maruch)
Date: 25 Dec 2001 20:06:58 -0800
Subject: Check in for an instance of a class
References: <59f8895f.0112251925.26c43cc@posting.google.com>
Message-ID: 

In article <59f8895f.0112251925.26c43cc at posting.google.com>,
Ben Graham  wrote:
>
> I need to check whether an instance of a particular class exists, in
>its __init__(...). Assuming that the module containing the class may
>or may not be imported, what are the my options? (As far as possible,
>I would like to contain the test in the class completely). And, yes, I
>need a pre-2.2 solution.

Just use a class variable:

class C:
    InstanceCreated = None
    
    def __init__(self):
        if C.InstanceCreated is None:
            ...
            C.InstanceCreated = 1
        else:
            ...
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

Tenth Virtual Anniversary: 6 days and counting


From amberdelton at email.msn.com  Sun Dec  2 18:21:05 2001
From: amberdelton at email.msn.com (amberdelton)
Date: Sun, 2 Dec 2001 16:21:05 -0700
Subject: Very new to this
Message-ID: <#k0oOh4eBHA.1192@cpimsnntpa03>

Is there a way that i can get a script that is write for a x amont of
seconds?




From store_li at sina.com  Fri Dec 21 02:12:40 2001
From: store_li at sina.com (Kick)
Date: Fri, 21 Dec 2001 15:12:40 +0800
Subject: It's Tk's fault
References: <9vp5bv$gvfps$1@ID-12869.news.dfncis.de>  <9vrji0$hbcov$1@ID-12869.news.dfncis.de> 
Message-ID: <9vungu$hqp9s$1@ID-12869.news.dfncis.de>

I have tried but it doesn't work. Python don't know the name of that encode
method.
"Kirill Simonov"  wrote in message
news:mailman.1008842364.24839.python-list at python.org...
> On Thu, Dec 20, 2001 at 10:46:37AM +0800, Kick wrote:
> > My string is a ordinary 'string' type according to the result of Print
> > type(variable)
>
> Try to convert data to unicode before using it:
>
>     data = unicode(data, 'gb2312')
>
> Maybe, you need to download additional codecs from
> "http://sourceforge.net/projects/python-codecs/".
>
>
> Kirill
>
>




From erik at naggum.net  Sat Dec 22 08:58:58 2001
From: erik at naggum.net (Erik Naggum)
Date: Sat, 22 Dec 2001 13:58:58 GMT
Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic
References:    <3218013921984060@naggum.net> <87vgeze7g4.fsf@yc5.so-net.ne.jp>
Message-ID: <3218018336124724@naggum.net>

* Erik Naggum
> Look, Tengwar is more widely used than Scheme these days.

* Hirotaka Yamamoto
| Prove it by examples, please.

  I am glad you asked.  The Lord of the Rings: The Fellowship of the Ring,
  has premiered recently all over the world.  Tengwar is a writing system
  devised by J.R.R.Tolkien in this monumental work.  Millions of people all
  over the world have taken a renewed interest in his works, including his
  new languages and writing systems, because of this movie.  I venture a
  guess that more people were fluent in Tengwar than in Scheme before this
  movie was announced, as well, but I am certain that the number has
  exceeded Scheme fluency because of the movie.  I certainly reread LotR
  and took up my old calligraphic Tengwar skills in joyful anticipation of
  the movie, and I did not reread RnRS nor take up my old Scheme skills in
  anticipation of, um, anything.  Q.E.D.

  Note: Despite the fictitious "please", I consider the brevity, style, and
  substance of your request to communicate hostility.  Requests for proof
  or references are never constructive on USENET, just mere tactics in a
  rhetorical game.  I have responded with ridicule.  Please be pleased with
  the results.  Thank you and goodbye.
  
///
-- 
  The past is not more important than the future, despite what your culture
  has taught you.  Your future observations, conclusions, and beliefs are
  more important to you than those in your past ever will be.  The world is
  changing so fast the balance between the past and the future has shifted.


From JasonHarper at pobox.com  Mon Dec 17 10:31:24 2001
From: JasonHarper at pobox.com (Jason Harper)
Date: Mon, 17 Dec 2001 08:31:24 -0700
Subject: Wrap C function which takes variable lengthed parameters?
References:  <6p5j1u0oag2ofkam8o7fig5dvkfc2392hk@4ax.com> <3C19990E.BE0F3FA@alcyone.com> <3C19AC0B.7ABD04DF@xs4all.nl> <3C1D767D.7BBE45EC@cosc.canterbury.ac.nz>
Message-ID: <3C1E0E6B.9F0C2A18@pobox.com>

Greg Ewing wrote:
> You can construct a wrapper that will handle up to
> some maximum number of parameters, by exploiting the
> fact that a varargs function doesn't care if you pass
> it more parameters than it's expecting -- it will just
> ignore the rest.

I'm not sure if that's 100% true - I have used a compiler (fortunately
long dead), which claimed to be fully ANSI compliant, that absolutely
required that a varargs function consume exactly as many args as were
passed to it or it would crash on return.
	Jason Harper


From grahamd at dscpl.com.au  Thu Dec 20 21:00:50 2001
From: grahamd at dscpl.com.au (Graham Dumpleton)
Date: 20 Dec 2001 18:00:50 -0800
Subject: question soap and classes
References: 
Message-ID: 

"Scott Hathaway"  wrote in message news:...
> I want to create a soap server that will expose many classes and then acces
> them as follows:
> 
> client:
> 
> import SOAP
> if SOAP.Config.SSLserver:
>  from M2Crypto import SSL
> SOAP.Config.debug = 1
> SOAP.Config.BuildWithNoType = 1
> SOAP.Config.BuildWithNoNamespacePrefix = 1
> s = SOAP.SOAPProxy("http://localhost:8800")
> u1 = s.classA.Login('joe','smith')
> u2 = s.classB.Logout('joe','smith')
>
> ...
>
> This does not allow me to access separate classes.  Can anyone tell me the
> best way to do what I want?

Looking at the source code you have:

    def registerObject(self, object, namespace = ''):
        if namespace == '': namespace = self.namespace
        self.objmap[namespace] = object

And then when it tries to dispatch things:

                    else: # Now look at registered objects
                        # Check for nested attributes. This works even if
                        # there are none, because the split will return
                        # [method]
                        f = self.server.objmap[ns]
                        l = method.split(".")
                        for i in l:
                            f = getattr(f, i)

Ie., it looks like the only way you can distinguish objects is by registering
them against different namespaces. If this is the case you wouldn't be able
to use the client calling sequence you are using as you would need have separate
proxy objects for each remote object, each with a different namespace being
specified.

Anyway, this is a guess based on looking at the code only.

Personally, I don't like how namespaces are used in this way. I prefer a
model whereby different objects are registered against distinct URLs. Using
namespaces like this though has come about as most systems only have one URL
entry point and thus object identification has had to be piggy backed on
using other means.

If you are interested in alternative SOAP frameworks for Python you might
have a look at OSE. In particular have a look at the examples:

  http://ose.sourceforge.net/example-programs/transient-client.py
  http://ose.sourceforge.net/example-programs/transient-service.py

These don't actually use SOAP but an XML-RPC like protocol, but it is a one
or two line change in each to have it use SOAP or XML-RPC instead. In the
example it shows dynamic creation of new objects against distinct URLs but
they could just as easily be set up in advance. Setting up static objects
or services is actually the norm and you can find a mumber of other examples
on the web site of that.

The main OSE site is:

  http://ose.sourceforge.net


From aleax at aleax.it  Fri Dec 28 07:42:49 2001
From: aleax at aleax.it (Alex Martelli)
Date: Fri, 28 Dec 2001 13:42:49 +0100
Subject: REPOST: Re: Python Popularity: Questions and Comments
References: <3C2A9D33.67FEC261@earthlink.net> <3C2B7276.88339BE7@earthlink.net>
Message-ID: <7$--$$_--__-%$-_-$@news.noc.cabal.int>

"Hans Nowak"  wrote in message
news:3C2B7276.88339BE7 at earthlink.net...
> Ron Stephens wrote:
    ...
> > Sourceforge projects, about 1300 to 80). By the way, Just van Rossum's
> > http://starship.python.net/~just/comp.lang.python/ graph of Python
> > newsgroup coverage seems to show a slight decline from over 6000 per
> > month in late-middle 2001 to the current 3500 or so I see on here. Mr.
> > van Rossum said he may not be able to update these any more due to some
> > Yahoo change; anyway, am I interpreting these numbers and trends
> > accurately? Will the Python newsgroup usage turn upwards again? Does it
> > matter?

Hmmm, I think it's all my fault -- in late-middle 2001 I basically turned
off the Python newsgroup (and other netnews) to concentrate on other
activity
(all Python-related).  And, these days, less and less often do I find myself
somewhere with a newsreader and no other applicable tools (but it still
happens from time to time, e.g. today).

Some day or other, I'll be back with my exaggerated posting volume... just
got a few books & projects to complete first...


Alex

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!feeder.qis.net!nntp.abs.net!howland.erols.net!dc1.nntp.concentric.net!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail
Message-ID: 
Control: cancel 
Subject: cmsg cancel 
From: "Alex Martelli" 
Newsgroups: comp.lang.python
X-No-Archive: yes
Lines: 2
NNTP-Posting-Host: wonenara.ozemail.com.au
X-Trace: ozemail.com.au 1009643015 203.108.164.177 (Sun, 30 Dec 2001 03:23:35 EST)
NNTP-Posting-Date: Sun, 30 Dec 2001 03:23:35 EST
Organization: OzEmail Ltd, Australia
Distribution: world
Date: Sat, 29 Dec 2001 12:38:35 GMT

This message was cancelled from within Mozilla.


From amurphy at megapathdsl.net  Sat Dec  8 20:12:10 2001
From: amurphy at megapathdsl.net (Alex)
Date: 8 Dec 2001 17:12:10 -0800
Subject: urllib and httplib wan to use my modem instead of the ethernet
Message-ID: <70ccd34d.0112081712.e70df5d@posting.google.com>

I am just learning python and have been playing with urllib and
httplib.
 
I have used the sample code on the python.org page but I had a problem
because python insists to dial out with __my modem_ to get the url
address resolved.  I am also connected directly to the internet via
DSL - Ethernet connection - but Python doesn't want to try that
connection which is on all the time. ( I have deleted all modem
connection icons so now it doesn't try to call with the modem but it
still can not fine the internet to resolve the IP address of the URL
target)
 
do I have to configure python to use that ethernet interface card
somehow?
 
in a previous posting, someone answered another newbie question with
the snippet below. This code also fails for me (results in the
"except" condition)
 
import urllib
url="http:\\www.org.python\index.htm"

try:
    f = urllib.urlopen(url)
    print f.read()
except IOError:
    print "Could not open " + url

with the httplib sample code off of the pytho.org site it also fails
with an IOERRO message error 7 'getaddrinfo failed' message - I  think
this is because Python can't find the internet connection on my Windo$
box.
 
Any help much appreciated.
best regards and thanks for any help you might be willing to give,

Alex


From pri at magnus.dk  Mon Dec 17 03:05:16 2001
From: pri at magnus.dk (Peter Ring)
Date: Mon, 17 Dec 2001 09:05:16 +0100
Subject: Idiomatic portable way to strip line endings? (fwd)
References: 
Message-ID: <3c1da747$0$94397$edfadb0f@dspool01.news.tele.dk>

Except that files do respect operating system boundaries, the most common
cases being LF-style files appearing in Win32 applications and CR/LF-style
files appearing in *nix applications. In general, it's plain silly to
convert end-of-records just because files are moved around or opened
(through a file system) by a process with another run-time library. Some
operating systems (e.g., VMS) might require a record format conversion for
at least some files, but it's not really the general case.

Kind regards
Peter Ring

"Russ Cox"  wrote in message
news:mailman.1008535879.30802.python-list at python.org...
> As has already been pointed out, section 7.19.2 of
> the ANSI C99 standard mandates that stdio FILEs
> opened in text mode are sequences of lines, each
> of which is terminated with a newline character.
> I believe this was the case for the C89 standard too.
>
> If you open in binary mode then you have to deal
> with the differing line-ending conventions on
> various systems.  If you open in text mode, you
> should always get a single \n (\012); nothing more,
> nothing less.
>
> Russ
>
>




From peter at engcorp.com  Mon Dec 10 23:56:10 2001
From: peter at engcorp.com (Peter Hansen)
Date: Mon, 10 Dec 2001 23:56:10 -0500
Subject: How to change IP Address by Python program on Win Platform
References: <9v2aqb$mbt$1@ih292.ea.unisys.com>  <9v2fh1$pa9$1@ih292.ea.unisys.com> 
Message-ID: <3C1591EA.2E57F1CD@engcorp.com>

Gerhard H?ring wrote:
> 
> Le 10/12/01 ? 16:05, Joel Quinet ?crivit:
> > [about changing IP address from Python]
> > Windows Platform and more generally NT and 2K
> > Sorry for that.
> 
> IIRC you cannot change the IP address on NT without rebooting. A common
> solution is to create several hardware profiles with different network
> settings (IP address, gateway, ...), then select the appropriate
> hardware profile when booting.
> 
> I'm certain it's possible to change the IP address programmatically on
> Windows NT 5.x, but as as far as I can see, the relevant API functions
> aren't exposed to ActiveState's win32 extensions, yet.

If I recall correctly, and believe me I may not :-), I think
I've successfully changed the IP address on a WinNT machine
*without* rebooting.  It may simply be that I changed the
routing tables with 'route add' and such, which could easily
be wrapped with Python, but I somehow remember actually
having changed the IP address too.  I no longer have an
NT machine handy to test on (thank god :-), but is it
possible that if you change the network settings and simply
ignore the request to reboot, that an address change is
actually accepted immediately?

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com


From DeepBleu at DeepBleu.org  Fri Dec 28 09:15:39 2001
From: DeepBleu at DeepBleu.org (DeepBleu)
Date: Fri, 28 Dec 2001 08:15:39 -0600
Subject: REPOST: Re: A new forum is up! Q: what means nntp
References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B5E9F.FF1C2CC@bellatlantic.net>   <3C2B941D.B1E45AA5@htp-tel.de>
Message-ID: <0$--$$_-----$%_$$$@news.noc.cabal.int>

Tom
NNTP is an internet protocol like SMTP, POP3 and HTTP for communication.
Also, it is the oldest one and it used to be the most instructive before AOL
hit the scene along with the 'gold rush' :)
Ask your ISP if they offer NNTP support through their own server.  Then you
can get an NNTP viewer/reader/poster/archiver/etc.... (On Windows, Outlook
Express acts also as a newsgroup reader.  Another good program is Agent.
Check www.stroud.com for the latest programs under the NNTP section).
Having done that you can choose/subscribe in your favourite newsgroups (like
comp.lang.python).
NNTP and newsgroups offer fantastic archiving mechanisms that no web forum
can ever aspire to in the present time.
Hope this helps.
DeepBleu

"Tom Karas"  wrote in message
news:3C2B941D.B1E45AA5 at htp-tel.de...
> Hello out there.
>
> > >It depends on how you view this 'forum.'  As far as I am concerned,
> > >**nothing** beats NNTP newsgroups viewed in a dedicated NNTP viewer.
>
> What means nntp ?
>
>
> Just my 2 cent question
>
> Best regards
> Tom Karas
>
> --
> The early bird catches the worm.   Trust the computer industry to
> shorten the term
> If you want something else for     "Year 2000" to Y2K. It was this kind
> of thinking
> breakfast, get up later.           that got us in trouble in the first
> place. Adrian Tyvand

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: "DeepBleu" 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 03:59:36 GMT
Organization: The World's Usenet -- http://www.Supernews.com
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775388 27193 211.57.49.2 (31 Dec 2001 05:09:48 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:09:48 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From jkraska at san.rr.com  Fri Dec 28 17:26:55 2001
From: jkraska at san.rr.com (Courageous)
Date: Fri, 28 Dec 2001 22:26:55 GMT
Subject: REPOST: Re: Python on the desktop
References: <94e3fce8.0112210053.2568529d@posting.google.com> <3C238618.9F54E5CA@attbi.com>      
Message-ID: <3$--$$_----_----$$@news.noc.cabal.int>

On Fri, 28 Dec 2001 13:17:01 -0800, Cliff Wells  wrote:

>On Sun, 23 Dec 2001 07:11:36 GMT
>Courageous  wrote:
>
>> Indeed VC kills me some days. Surely thou understoodeth the
>> sardonic aspect of my message.
>
>Sorry, the xmas spirit must have desensitized my irony detector =)

I was responding as could only someone who's actually been exposed
in detail to Microsoft's hegemoney.



Um. I feel that I need to point out that my misspelling above is
deliberate.



C//

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!skynet.be!skynet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fr.clara.net!heighliner.fr.clara.net!news.tele.dk!small.news.tele.dk!134.75.7.11!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Courageous 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 02:13:19 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775014 27193 211.57.49.2 (31 Dec 2001 05:03:34 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:03:34 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From jason at jorendorff.com  Tue Dec 11 14:18:12 2001
From: jason at jorendorff.com (Jason Orendorff)
Date: Tue, 11 Dec 2001 13:18:12 -0600
Subject: Signal handling and threads problem
In-Reply-To: 
Message-ID: 

alwyns at prism.co.za (Alwyn Schoeman) wrote:
> I'm experiencing the problem that on Solaris the main thread doesn't
> seem to get the signal.
> 
> I've compiled Python with:   --with-signal-module and --with-threads.
> The signal in question is SIGINT.
> 
> Now from the source code it appears that it is hacked to work by the
> module checking whether
> the pid that receives the signal is that of the main thread or not.
> This do not seem to work.  I wonder
> if it has anything to do with the fact that as far as I know the
> threads have the same pid as the
> main program on Solaris (not sure about this).
> 
> Anyone shed any light on this please?
> 
> Thank you
> Alwyn Schoeman

Actually, it is *not* checking pid's.  It's checking the value
returned by PyThread_get_thread_ident(), which is, on Solaris,
simply thr_self().  It's a thread ID, not a process ID.

The way Python is currently intended to work, I think,
all signal handlers execute (asynchronously) in the main thread.
Even if you send a signal explicitly to a different thread,
Python simply stores the signal somewhere, and the main thread
grabs it and handles it as soon as it can after that.

If the main thread is currently busy (for example, if it's
blocked on input), then it does *not* get automatically
interrupted.  It waits until it's done before executing the
signal handler.  (Not sure how this works on Solaris.)

Admittedly this is weird.

In addition to the above, I believe Python handles SIGINT
by default.  But you should be able to override it.

Anyway, your post seems to suggest that you know all this
and the program seems to be ignoring SIGINT completely. (?)

Can you give a minimal example of Python code that uses SIGINT
and threads, that doesn't work for you?

-- 
Jason Orendorff    http://www.jorendorff.com/



From dale at riverhall.NOTHANKS.co.uk  Sun Dec 23 05:58:33 2001
From: dale at riverhall.NOTHANKS.co.uk (Dale Strickland-Clark)
Date: Sun, 23 Dec 2001 10:58:33 +0000
Subject: SnoPy 0.1 - SNOBOL pattern matching for Python
References: 
Message-ID: 

Don Rozenberg  wrote:

>This is the first release of SnoPy, a Python extension build on 
>GNAT.SPITBOL.PATTERNS which provides many features of SNOBOL pattern matching 
>to the Python developer.  It is released under the GPL.  The home site for 
>SnoPy is http://snopy.sourceforge.net.  There is an extensive users guide 
>including a SNOBOL pattern matching tutorial.
>
>SNOBOL was a text processing language without equal that was developed at 
>Bell Labs in the 1960's.  It has nearly died out but I am offering this 
>extension as an alternative to regular expressions.  In many respects, SNOBOL 
>pattern matching is much more powerful yet easier to learn than regular 
>expressions. 
>
>

SnoPy 0.1 - SNOBOL pattern >matching extension for Python. (22-Dec-01) > > Wow! That's interesting. Snobol was one of the first languages I learned and I loved it. I still have some Snobol4 books by Griswold on my shelves here. But having just checked the links, I see it's Linux only :-(. -- Dale Strickland-Clark Riverhall Systems Ltd From infotechsys.wayne at verizon.net Mon Dec 17 22:17:20 2001 From: infotechsys.wayne at verizon.net (infotechsys.wayne at verizon.net) Date: Mon, 17 Dec 2001 22:17:20 -0500 Subject: DOM - some pointers Message-ID: <3C1EB540.9030100@verizon.net> Hi, Could someone point me to some documentation that show how to use HTML ,Dom and Python together. I did a google search, but the only thing I find is DOM, XML and Python. Thanks Much. Wayne From mac at dgp.toronto.edu Tue Dec 4 14:02:15 2001 From: mac at dgp.toronto.edu (Maciej Kalisiak) Date: Tue, 04 Dec 2001 19:02:15 GMT Subject: "print 0.1==0.1" -> TypeError; what did I do? References: <87pu5vqxvv.fsf@dgp.toronto.edu> <87bshf7yb1.fsf@dgp.toronto.edu> <3C0D0000.2090208@shinners.org> Message-ID: <87667majwo.fsf@dgp.toronto.edu> Pete Shinners writes: > >> hasattr(None, "spam") > >> > > therefore, the exception being raised by your function is being > overwritten by another exception, then all the exceptions are > cleared. Ahhhh... and here I was thinking that there was something magical about None and "spam"... :) -- Maciej Kalisiak|mac@] dgp.toronto.edu|www.] "I like work ... I can sit and watch it for hours." dgp.toronto.edu/~mac] From syt at gemini.logilab.fr Tue Dec 18 05:11:49 2001 From: syt at gemini.logilab.fr (Sylvain Thenault) Date: Tue, 18 Dec 2001 10:11:49 +0000 (UTC) Subject: implementing a timer? References: <9vn0gv$ll6$1@colo.mobo-it.nl> Message-ID: On Tue, 18 Dec 2001 10:56:44 +0100, waalp wrote: >I'm trying to make a script that will check if i have mail every let's say >10 minutes.So i tought let's use something like a timer. But i can't find >any documentation on how to implement something like this. > >I'm a beginner so it could be that i haven't looked in the right places. >Could somebody please help? see method "sleep" in the module "time" -- Sylvain Thenault LOGILAB http://www.logilab.org From syver-en+usenet at online.no Sat Dec 22 03:09:55 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 22 Dec 2001 09:09:55 +0100 Subject: Fate of win32all? References: <7876a8ea.0112212116.2ebabc23@posting.google.com> <3C242A7F.2060805@skippinet.com.au> Message-ID: Mark Hammond writes: > Nope. The win32all license remains unchanged. See the license.txt > files in the distribution. Basically *anyone* is free to do whatever > they choose with the package, including building their own > distribution. ActiveState have no special rights over this at all. > > Specifically, I fully intend releasing new win32all > packages. ActiveState did have me working very hard on Komodo, but no > longer ;) I am leaving for a Christmas break, but intend getting a > win32all out by the new year - if not, just a few days after. That is very reassuring to hear. win32all rules for everyone working on the windows platform. Sorry to hear about the current developments Mark. Maybe you could get O'Reilly to sponsor an update for 2.2 to your and Andy Robinsons excellent python book? Merry Christmas. -- Vennlig hilsen Syver Enstad From jkraska at san.rr.com Fri Dec 7 01:56:38 2001 From: jkraska at san.rr.com (Courageous) Date: Fri, 07 Dec 2001 06:56:38 GMT Subject: Why doesn't this work? References: Message-ID: On Thu, 6 Dec 2001 23:23:42 -0500, "Tim Peters" wrote: >[Courageous] >You didn't say what you expected, so how should we know ? >x = [1, 2, 3] >y = x.append(4) > >instead. "How come got 4 stuffed at the end of x too?" I suppose you're right. I just hadn't been coding Python very much recently and forgot about append returning None. In other environments, I've noticed a tendency for mutators to return what was mutated. I've been recently coding in Lisp; append and remove are list operations there with behavior which is different in a less-than-desireable way. I'm always making small errors like this, moving from one language to the next. Jumping back and forth between C++ and Java is usually the most mind-bending. C// From aleax at aleax.it Fri Dec 28 11:38:42 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 17:38:42 +0100 Subject: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> Message-ID: "Cameron Laird" wrote in message news:E6BE2136ABF306B9.F6485048E0D07105.E913F194464E51CC at lp.airnews.net... ... > >based on UUCP, as I recall) well before the Internet was officially > >inaugurated (1983, wasn't it?). ... > I don't know what you mean by the "official inauguration" > of the 'Net. ftp://ftp.isi.edu/in-notes/museum/ARPANET_News.mail Pretty early on, in this document (part dated July 1980): """The ARPANET Network Control Program (NCP) will be replaced by two DOD protocols, the DOD Standard Transmission Control Protocol (TCP) and the Internet Protocol (IP). ARPANET FTP and TELNET protocols will also be updated and standardized. Planning for this transition is still under development.""" A TCP-only experiment (no NCP) was (much later) announced for October 1, 1982. At the same time you see the announcement: """ SMTP MUST BE IMPLEMENTED BY 1 JAN 1983 SMTP will become the official network mail protocol. All hosts with mail service should plan on implementing SMTP by 1 Jan. 1983 for sending and receiving network mail. SMTP is completely separate from FTP, and is handled by a distinct server. This is quite different in detail from the current mail-handling procedures. Questions about """ SMTP was clearly SPECIFIED earlier, but Jan 1, 1983, was when it came into effect (note the mention that SMTP is separate from FTP: earlier, mail was handled by an FTP extension; and this was still "current mail-handling procedure" in late 1982, as we see). On Dec 22, 1982, we then read: """ The Defense Data Network Program Management Office (DDN-PMO) is committed to the implementation of TCP/IP and related protocols effective 1 Jan 1983. Starting 00:01 (est) 1 Jan 1983 use of NCP will not be permitted unless specific exception is granted by the DDN-PMO """ The transition was made on Jan 1 1983, as planned, with TACs supporting old NTP until Feb 1 1983. University of Delaware relayed mail between TCP and NTP hosts in the meantime (a few hosts were only due to switch in May). MILNET was announced (split from ARPANET) in March 1983. Although the rest was still called "Experimental ARPANET", given that it had switched to Internet Protocol and was now separated from the Military part, it seems reasonable to me to consider 1983 as the year of the official inauguration of the Internet, no? Alex From claird at starbase.neosoft.com Fri Dec 28 08:59:26 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 28 Dec 2001 07:59:26 -0600 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <1$--$$_----_-_$%$$@news.noc.cabal.int> In article , Patrick wrote: . . . >They DO ask what compilers and linkers we use! They even >make suggestions! We make very customized software. >Some customers write parts of their own code through >'user exits'. > > > > There are times when this is an advantage for Python, for it is a FAR superior "extension language" to Java and C. While many aspects of software engineering are best seen at this point as matters of taste, Python's superiority in this regard is, I argue, a matter of objective record. That's no guarantee of customer acceptance, of course. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!newspeer.cwnet.com!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: claird at starbase.neosoft.com (Cameron Laird) Newsgroups: comp.lang.python Subject: cmsg cancel <889C110F5BBBFAFD.A03B35C232EA2760.70B0892CB9479323 at lp.airnews.net> Control: cancel <889C110F5BBBFAFD.A03B35C232EA2760.70B0892CB9479323 at lp.airnews.net> Date: Mon, 31 Dec 2001 02:06:09 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775415 27193 211.57.49.2 (31 Dec 2001 05:10:15 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:10:15 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From phd at phd.pp.ru Tue Dec 11 11:59:48 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Tue, 11 Dec 2001 19:59:48 +0300 Subject: lost interest? In-Reply-To: <3dzo4pputt.fsf@ute.mems-exchange.org>; from akuchlin@mems-exchange.org on Tue, Dec 11, 2001 at 11:47:42AM -0500 References: <20011208001123.A5989@casa.parque> <3C14FEBD.AD52B516@attbi.com> <3dzo4pputt.fsf@ute.mems-exchange.org> Message-ID: <20011211195948.A24106@phd.pp.ru> On Tue, Dec 11, 2001 at 11:47:42AM -0500, Andrew Kuchling wrote: > Also, those of us using Debian already have dependency information for > Python modules through apt. It's not much fun to do a lot of work > implementing a parallel Python solution that will still be less > functional, as apt will also handle dependencies on non-Python > software or libraries, a difficult task for a Python-only system. > Switching to Debian has neatly killed my urge to work on a catalog. Debian is definitely great, but unfortunately there other system, not so apt. Some poor souls even use a GUI that was erroneously presented to them as an OS :( Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From syver-en+usenet at online.no Sat Dec 29 10:03:16 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 29 Dec 2001 16:03:16 +0100 Subject: SSL Sockets in Windows References: Message-ID: Gerhard H?ring writes: > Le 28/12/01 ? 07:18, Syver Enstad ?crivit: > > > > Hi Al, I'm not exactly an expert on SSL :-). I know it's what goes > on > > > behind the scenes when my browser uses an https url and > communication > > > is encrypted and whatnot. > > > > Do you have (or can you refer me to) a quick > > example to check that SSL is indeed working on Python? > > You can check pretty easily if your Python is compiled with SSL > support: > > > 'ssl' in dir(socket) Yes, returns true (1) > If so, you should be able to fetch a HTML page with the urllib module: > > > print urllib.urlopen("https://www.sf.net/").read() Yes, this fetches the front page of sourceforge, which says that I'm not logged in. What would happen if I didn't have SSL installed. You see I compiled up a new version of _socket.pyd with VC++ 6 and this time I specified that SSL shouldn't be compiled in. 'ssl' in dir(socket) still returns true, and the download goes without a hitch too. I haven't checked with a packet sniffer though. > reduce(lambda x,y:x+y,map(lambda > x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) Cute, and true. -- Vennlig hilsen Syver Enstad From Bruce at EckelObjects.com Mon Dec 31 11:47:15 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Mon, 31 Dec 2001 08:47:15 -0800 Subject: Two languages, too similar, competing in the same space. In-Reply-To: <3C2BA7B8.35286DE3@earthlink.net> References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> Message-ID: <200112310847150600.006D9689@mail.rdc1.sdca.home.com> Note that my FAQ to which this refers http://www.mindview.net/Etc/FAQ.html#Ruby is more of an explanation of why I don't have an interest in writing a book on Ruby (I was getting a lot of questions on this). Often, I have to eat my words in the future, but right now Ruby doesn't give me the right feeling, something upon which I rely heavily in decision-making. On the other hand, I think competition is good, and I've found that learning multiple languages is tremendously useful, even if I don't end up using the other language. Learning Perl, for example, is what lead me to Python. > Bruce Eckles said that, if a language can't give dramatic productivity >improvements over a predecessor language, that it does not justify one's >switching. 10% improvements are not nearly enough, he said. Now, we can >argue until the cows come home whether or not Ruby gives *any* improvements >at all over Python; I suspect it is a matter of taste. But now that Ruby is >out there, it absorbs enormous mind share, and development time to recreate >libraries etc., which are already available in Python, thus hurting >Python. Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From sdm7g at Virginia.EDU Mon Dec 10 16:50:48 2001 From: sdm7g at Virginia.EDU (Steven Majewski) Date: Mon, 10 Dec 2001 16:50:48 -0500 (EST) Subject: Creating a "package" using C extensions? In-Reply-To: Message-ID: On Sun, 9 Dec 2001, Courageous wrote: > This is liveable, but somewhat painful for me. Let me tell > you why. I am currently translating the back end of a system > originally written in Python to a hybridized C++/Python > implementation with a C++ core. The heart of the system has > a very high invocation frequency, so it makes sense to put > that into C++. However, I need to make the prior interface > to the Python programmer the same as it was before. So what > I am doing is, for every module in the prior package, creating > a C++ equivalent. > > That's a lot of .dlls, if you know what I mean. > > Perhaps I'll break down and write a makefile. Doing a couple > dozen .dlls in VC 6.0 is a bit of a pain. > > It's too bad there's not a way to create a package-level .dll > which responds to Python in such a way as to offer up its > internal modules, but all from within a single .dll. That would > be cool. Before Jack fixed up the current Carbon modules for MacOSX Python, I had problems building them as separate shared libraries because they had so many shared routines between them ( for example, a lot of other toolbox modules use Mac Resources, so they use routines in Resmodule, but directly, not by importing the module. ). My temporary solution was to build ALL of the Carbon toolbox modules into a single Carbonmodule.so . Using this macro: #define ADD_MODULE(x) if (-1 == \ PyModule_AddObject( m, (x), PyImport_ImportModule((x)))) return NULL for each submodule I had (for an example, for the Win module) the lines: initWin() ADD_MODULE("Win") This put everything into a single shared library. You could then do, for example: from Carbon import Win or, once you have done an initial: import Carbon all of the submodules are added to sys.modules, so you could also do: import Win This was intentional, so that once Carbon had been imported, (perhaps in site.py ) old scripts that used the latter import would still work. I don't think it followed the package semantics entirely -- I don't think you could do: import Carbon.Win (I'm not entirely sure -- since Jack came up with a better scheme I don't have that code nearby any longer. It's been archived. ) But if you want to avoid having a whole big bunch of DLL, you could do something similar. -- Steve Majewski From quinn at hurl.ugcs.caltech.edu Sat Dec 1 06:02:26 2001 From: quinn at hurl.ugcs.caltech.edu (Quinn Dunkan) Date: 1 Dec 2001 11:02:26 GMT Subject: A modest indentation proposal References: Message-ID: On Fri, 30 Nov 2001 23:25:34 -0800, Erann Gat wrote: >In article , >quinn at chunder.ugcs.caltech.edu (Quinn Dunkan) wrote: > >> If you want the OFMPM, it's basically like pindent.py. > >So I wasn't actually aware of the existence of pindent.py. Can it be >easily rolled into an emacs mode? No idea, since I don't use emacs. It's just a standard stdin-stdout filter, and I'd be real surprised if emacs can't handle that. >> If that's not enough, and you think there needs to be a fundamental change to >> the language syntax, > >No, I'm not asking for a fundamental change to the language syntax. I'm >asking for the functionality of pindent.py to be packaged up as an emacs >mode, and for the parser to warn me when there's a discrepancy between the >indentation that pindent.py would produce and what's actually in the >file. I'm also asking that "# end for" be spelled ";". That's all. Ok, that shouldn't be hard. From a casual glance, it looks like you could inherit from pindent.PythonIndenter and override endprog to match whatever you want, such as a lone semicolon. You'll probably have to do a little more since it wants to find a matching closing keyword (e.g. "end if" or "end for"). pindent will make noise on stderr about unmatched blocks, so it should be easy to get emacs to tell you about problems. There's no need to ask when you can go ahead and do it, asking just stirs up a lot of emotional sentiment. >> Did you manage to convince the lispers that the compilers should support an >> optional ()-less infix syntax to make your boss happy? They'd probably say >> "so write a read macro" :) > >It turns out that what made the bosses unhappy about Lisp was not the >syntax but the fact that no one uses it. And before you protest and tell >me that it's not true that no one uses Lisp, yes, I *know* it's not true. >I also know that indentation is not much of a problem in practice. But if what you're concerned about is the Boss' half-baked opinions, then why the wacky semicolon syntax? You can mention that the python block delimeters are even stricter than C's, since they must match the opening delimeter. Show 'em some marked up "# end this" "# end that" code. If that makes them happy your problem is solved. If you think it's too much typing, consider how much typing you're saving by not having to use C++. Or go modify pindent. Up to you. You could never write any closing delimeters but put pindent on as a cvs checkin filter (or saving filter for emacs) and you won't have to type anything! From fperez528 at yahoo.com Mon Dec 10 13:13:45 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Tue, 11 Dec 2001 17:41:45 +2328 Subject: Getting at an item in a list of tupples References: <9v66mi$17mi$1@newshost.nmt.edu> <9v68qp$da5j6$1@ID-11957.news.dfncis.de> Message-ID: <9v695t$blv$1@peabody.colorado.edu> Emile van Sebille wrote: >>>> a > [(1, 2.0, '3'), (11, 12.0, '13'), (21, 22.0, '23')] >>>> max([i[1] for i in a]) > Nice. I just sent in a solution using map(), but this does look more readable (and may be quicker, since it doesn't require calling a selection lambda()). Note to self: must get used to using list comprehensions more. Cheers, f. From PowerBall at cn-starnet.com Sun Dec 9 13:13:10 2001 From: PowerBall at cn-starnet.com (welcome) Date: Sun, 9 Dec 2001 12:13:10 -0600 Subject: Great Site! Message-ID: To be removed from this list simply reply with remove in the subject line. Dear Webmaster, Okay you have a great web site? Submitted to all of the search engines? Even hired some college kid to "promote" you to all of the FFA boards that nobody ever reads? If so I guess that you monthly site traffic is probably in the region of 10 to 100 visitors if you are lucky and you are feeling rather depressed - right? Well we have the definitive answer - we positively guarantee you high quality, genuine traffic to your web site. We make just one 100% guaranteed and solid promise to you - "WE WILL GET PEOPLE LOOKING AT YOUR WEB SITE WITHIN A MONTH - AND IF WE DON'T GET THE AMOUNT OF VISITORS TO YOU THAT WE PROMISE YOU CAN HAVE YOUR MONEY BACK - period" Take a few seconds to see what you get from TrafficFusion.Com The Ultimate Traffic Source ! http://www.trafficfusion.com This the one and only package of it's kind you will never find a more complete source to drive traffic to your web site and it is only being offered for a limited time! Here's What You'll Get: 1,000 Guaranteed Visitors every month for one full year! ($19.95 Value every Month!) 5,000 FREE Banner Impressions Guaranteed every month for one full year! ($24.95 Value every Month!) $500 in FREE Keywords on a Major Search Engine! (That's 50,000 targeted visitors) Free Submission of your Press Release to over 2,500 Media Sources Nationwide every month for one full year! (That's $249 Value!) E-Mail over 1,000,000 Opt-in subscribers daily! Spam Free! (That's a $199 monthly Value) That's a yearly Value of Over $3500 Yours for less than you pay for hosting every month!! You'll Also Get "Guaranteed Hits Secrets Exposed" This package shows you how to generate up to 1,000 hits per hour anytime you want to (and even shows you how to make that 1,000 hits equal even more!). You will have Full Resale Rights to resell the "Guaranteed Hits Secrets Exposed" for any price you choose! (This sells daily on eBay for $199) You'll Also Get: Instant Access To To 1,000's of Resources! Free multi-submission to 100,000's of sites; Instantly! 1000's of FREE reports, ebooks, tutorials and more! Dozens of FREE traffic building tools! Huge collection of home-based internet business links and resources! FREE software including submission utilities, FREE ebook compiler software, meta-tag optimization tools, etc.! Links to over 10,000 FREE ad sites including search engines, classifieds, ffa pages, etc.! FREE webmaster services such as link and html checkers, keyword utilities, doorway page generators, color and graphics tools, etc. FREE web graphics for your website including logo templates, borders & backgrounds, buttons, ebook graphics ,etc. Plus much more! http://www.trafficfusion.com If you are serious about the success of your site give us a shot! There will never be another opportunity to get such a complete promotional package! This is not a quick fix! We will deliver traffic to your site month after month! This is a Full 1 Year membership in our program! We are the traffic professionals! Thanks http://www.trafficfusion.com From chrishbarker at attbi.com Thu Dec 20 17:30:49 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Thu, 20 Dec 2001 14:30:49 -0800 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> <7x1yhqbefg.fsf@ruckus.brouhaha.com> Message-ID: <3C226699.1E1FB03C@attbi.com> Paul Rubin wrote: > > Fernando P?rez writes: > > All the scripts for which this is an issue are distributed by them, as part > > of their own system setup. So they can point every script which explicitly > > needs 1.5 to use it. > > > > They cause their users a fair amount of annoyance and I have yet to > > see a solid technical reason to justify it. Frankly the only thing RedHat did differently than every other OS distributer is use Python for a lot of their adminstation stuff. I have NEVER seen a python script distibuted that used anything other than "python" as the name of the executable in the #! line. > IMO the annoyance was caused by the needless incompatibility between > Python 1.5.x and 2.x.x. I half agree. I think trying to keep Python continuously backward compatible would be a mistake: I really like a lot of the changes/improvements. THe mistake is that there is no way to deal with version incompatability in Python itself. No way to tag code as requiring a given version etc. If it were the "standard" for everyone to call Python 2.* "python2" then there would be no problem with any of RedHat's stuff, or any other old scripts. > The redhat people had a product to ship on a > deadline; yes they could have updated all those scripts and QA'd them > again, but at the expense of either a schedule slip or resources being > directed away from something else. Instead, they stuck with what > worked. Maybe they'll update the scripts in a future Redhat release. Hopefully they will. RedHat could certainly distribute both 1.5 and 2.2 in the future, and change all the #! lines to python1.5. I hope they do, but frankly, I don't think they should have to. I think it is up to the Python developers to make this easy. This will only get worse as new versions come out...we really do need to do something about it. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From webmaster at xmlnet.org Wed Dec 19 09:43:29 2001 From: webmaster at xmlnet.org (rainer knappe) Date: 19 Dec 2001 16:43:29 +0200 Subject: [zope] looking for product for managing literature Message-ID: <3c20b5a4@netnews.web.de> I am looking for a zope-product which helps me managing all kinds of literature. I?m sure there MUST be one availanble on the net - but I can?t find. Can anyone help? Thanks in advance, Rainer -- __________________________________________________________ News suchen, lesen, schreiben mit http://newsgroups.web.de From dpetrac at yahoo.com Tue Dec 4 11:22:59 2001 From: dpetrac at yahoo.com (Danijel) Date: Tue, 4 Dec 2001 17:22:59 +0100 Subject: Moving problem Message-ID: <9uit4c$jd1$1@sunce.iskon.hr> I wish to create one user button somewhere on Frame/window. When clicked is, window should moves with mouse, until mouse is clicked again. I've tryed catch mouse events and some other stuff, but I can get good result. Is there a way to call standard Windows WindowMove (or something like that) on mouse button? Tnx, Danijel Win2000, wxPython From dh2 at andrew.cmu.edu Fri Dec 7 17:04:42 2001 From: dh2 at andrew.cmu.edu (Daniel Hennessy) Date: Fri, 07 Dec 2001 17:04:42 -0500 Subject: Question: PIL and 16-bit TIFFs Message-ID: <2722335446.1007744682@[192.168.1.101]> Does anyone know how to convince the Python Image Library (v. 1.1) to read in 16-bit integer-intensity TIFF image files? When I put the PIL Image module in debug mode, it spits out my files' format key as (1, 1, (16,), ()). I've tried to hack TiffImagePlugin.py to read this format (by adding the line (1, 1, (16,), ()): ("L", "L;16") to the OPEN_INFO dictionary), but the best I can do is get it to read in every pixel as intensity 2. I think I've got the mode variable right, but the "rawmode" variable has me confused. Any advice is welcome: mail dh2+ at andrew.cmu.edu. From emwoj at poczta.onet.pl Tue Dec 25 05:26:23 2001 From: emwoj at poczta.onet.pl (emwoj) Date: Tue, 25 Dec 2001 11:26:23 +0100 Subject: national characters Message-ID: Please help me! How can I use polish characters (cp1250) in Idle under Windows emwoj From careye at spamcop.net Sun Dec 30 03:46:02 2001 From: careye at spamcop.net (Carey Evans) Date: 30 Dec 2001 21:46:02 +1300 Subject: REPOST: Re: Finding out that Python is in interactive mode in sitecustomize.py References: <3C2B8F47.4CEACF6E@olen.to> <87g05wgq84.fsf@psyche.dnsalias.org> <11aed8f9.0112281443.afbc668@posting.google.com> Message-ID: <5$--$$_----__%$-_$@news.noc.cabal.int> joonas at olen.to (Joonas Paalasmaa) writes: > For some reason it doesn't work in sitecustomize.py . > When these lines are to sitecustomize.py and Python is started in > interactive mode, Python prints "In non-interactive mode". [...] Looking closer, it looks like sys.ps1 is set up just before the interactive loop is started, but after sitecustomize.py is imported. Given this, the easiest solution looks like the PYTHONSTARTUP environment variable. The file this points to is only executed for an interactive session. You could set this for all users in a global shell startup file, or just set it from sitecustomize.py: import os os.environ['PYTHONSTARTUP'] = '/path/to/interactive_startup.py' -- Carey Evans http://home.clear.net.nz/pages/c.evans/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Carey Evans Newsgroups: comp.lang.python Subject: cmsg cancel <87k7v5ksdx.fsf at psyche.dnsalias.org> Control: cancel <87k7v5ksdx.fsf at psyche.dnsalias.org> Date: Mon, 31 Dec 2001 02:42:05 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774308 27193 211.57.49.2 (31 Dec 2001 04:51:48 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:51:48 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From ffa-list at chchpoly.ac.nz Wed Dec 26 20:25:59 2001 From: ffa-list at chchpoly.ac.nz (ffa-list at chchpoly.ac.nz) Date: Wednesday, 26 Dec 2001 19:25:59 -0600 Subject: NEW: Subscribe To Newsletter Message-ID: <26120119.2559@ozonebooks.com> NEW: Subscribe To Newsletter WEB SITE: OZONEBOOKS.COM - The World of New Generation Downloadable eContent GENERAL DESCRIPTION: www.ozonebooks.com and its eContent Providers brings you many different Articles, Manuals, Books and simple collections of Interesting and valuable Information. No special devices are needed to download and read our eContent! NEWSLETTERS: Every time we publish and release a new title, you can automatically receive an email informing you about this event. Also from time to time, we provide special offers and discounts to our email database of Newsletter subscribers only. You can FREELY subscribe yourself to any of the following list: # Business Discover titles covering a wide range of principles and strategies to polish and improve your skills for current and future success in all your business enterprises. # Computers & Internet Follow the latest news in computing, from technical advancements to industry growth. # Cooking, Food & Wine Serve up your insatiable appetite for creating that perfect dinner or dinner party by reading these great titles. # Educational The door to educational material, which will help improve your learning, self-esteem and success is now open. # Fiction & Literature Titles that will let you escape far away from it all. # Gay & Lesbian A list dedicated to gender premise with a specialization in gay and lesbian culture. # Health, Mind & Body Obtain the knowledge to help you reach and fulfil a healthier life and lifestyle by supplying your mind and body with suggested titles. # Home & Garden A collection of titles with ideas and improvements for your home and garden. # Medical Intelligent information, resources and continuing medical education at your fingertips. # Miscellaneous A diverse collection of interesting and informative material. # Mystery, Thrillers & Fantasy Entice and excite your brain and imagination with these fantastic titles. # Religion & Spirituality Discover the meaning through resources that present ideas about Religion & Spirituality. # Russian Discover numerous and varied titles written in the Russian language from Russian and International Authors. # Sports Read a variety of sports material and information. # Travel Plan that next holiday through our worldwide travel and tourism information. HOW TO SUBSCRIBE To sign up for any of our free newsletters, simply visit this web page at http://www.ozconsultants.com/e-books/news_server select the newsletters of your choice and click the "Subscribe" button. YOUR PRIVACY: Our email database is an absolutely private emailing list, which will never be sold or disclosed for any reason whatsoever. From andreas at mtg.co.at Mon Dec 3 04:53:26 2001 From: andreas at mtg.co.at (Andreas Kostyrka) Date: Mon, 3 Dec 2001 10:53:26 +0100 Subject: a long shot -> sending output to a browser question In-Reply-To: <20011203122550.C2490@phd.pp.ru> References: <28d73ad6.0112011316.25e17eb2@posting.google.com> <39510D193FE46F2C.E86A8069386D11D6.8E418F956E3B5E03@lp.airnews.net> <20011203122550.C2490@phd.pp.ru> Message-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am Montag, 3. Dezember 2001 10:25 schrieb Oleg Broytmann: > On Sun, Dec 02, 2001 at 09:27:20PM -0600, Cameron Laird wrote: > > "Multipart" is another answer. Netscape browsers > > (but no others, ever?) arguably conformed to standards > > It is called "server push", and many browsers support it. Even M$IE had > support for server push, but lost it not so long ago. Well, basically I've discovered following classes (the association is out of my memory, meaning check it): VERY BAD: Basically this crashes or buffers to much of the page (to make it useful for my chat client). Mac browsers tend to this, newer IEs seem also to buffer the page. These clients you should catch and use a "refresh" technique. BAD: Cases where a browser that should be able to connect and stream text/html refuses to: Proxies, transparent proxies, firewalls, etc. on the way to the server. These usually can be caught by using a timeout for the stream. If the browser doesn't execute some Javascript in time, one basically forces a "refresh" mode. GOOD: All is ok. Still some gotchya's: Depending upon browser you cannot have to many streams open, additionally the "spinning icon" of the browser usually doesn't stop spinning, which might confuse the user. So it boils down to one trivial thing: - -) Test it with all kinds of acceptable browsers. - -) Provide a way to force "refresh" replacement mode. Andreas - -- Andreas Kostyrka; Raiffeisenstr. 16/9; 2320 Zw?lfaxing Tel: +43/676/4091256; Fax: +43/1/7065299 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8C0ulHJdudm4KnO0RAmohAKChP8fNOFt7iLPV6+AGKa9MsguD8QCfQ4pZ 66xLsuuqO8j1RIbda5To/ME= =3VU4 -----END PGP SIGNATURE----- From logiplexsoftware at earthlink.net Sat Dec 8 18:27:17 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Sat, 8 Dec 2001 15:27:17 -0800 Subject: Tinker vs wxPython ?- Opinions/Views In-Reply-To: <87elm62luf.fsf@speeder.org> References: <3ReQ7.21098$2Fd.14596@news1.bloor.is> <87elm62luf.fsf@speeder.org> Message-ID: <01120815271700.02522@logiplex1.logiplex.net> On Friday 07 December 2001 23:48, Roman Milner wrote: > Tkinter Pros: > > Very easy to learn > Excellent documentation (a whole book, plus some excellent web sites) > Very stable > Portable > > Tkinter Cons: > > Small lame selection of widgets (no notebook, no tree, no paned > windows. You can get some of these with PMW but it is slow and hasn't > been updated in a long time) > Slow. > It doesn't seem like Tk has been improved in the last several years - > it seems like new widgets will never get added. > > wxPython Pros: > > Fast > Great widget selection > Portable > > wxPython Cons: > Lame documentation (You basically get the wxWindows C++ API reference > and a bunch of python examples.) > Difficult to learn (IMO the wxPython API is much harder on the brain > than Tkinter) > Less stable than Tkinter (it has been my experience that I have more > crashes with wxPython than TKinter) I agree with most of these points. I started with Tkinter/PMW, and they are very easy to learn, but as with many toolkits that have a short learning curve, you soon find yourself writing horribly complex code to get around their limitations. Starting with Tkinter is fine, just expect to switch to another toolkit when you start hitting your head against its limitations. I switched to wxPython some time ago, and while it's not perfect, it is an excellent toolkit and really not too difficult to learn. I haven't experienced any stability issues with it - that is not to say there aren't bugs (I've encountered my fair share) - just that an application that is working won't suddenly crash for some unknown reason. As far as the documentation, while it is true that there isn't much Python-specific information, if you can mentally translate a C++ prototype into Python, you're on your way. Additionally, wxPython comes with an excellent demo that allows you to see most of the features of the toolkit and how to use them. -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From eldo at nethere.com Fri Dec 28 17:07:58 2001 From: eldo at nethere.com (Frank W. Jackson) Date: Fri, 28 Dec 2001 14:07:58 -0800 Subject: Running a script in windows References: Message-ID: <3C2CED3E.2000207@nethere.com> You might run this by. Right-click the script icon (or associated shortcut) then click **Properties** from the popup menu, then select the **Program** tab and make sure that the **Close on exit** checkbox is UNCHECKED. Jonathan Gardner wrote: > I know this comes up a lot, but I can't seem to find the answer in the > archives. (If the answer is RTFM, please let me know where.) > > I don't have a windows box on my desk. A friend of mine does, but I can't get > to it. He is trying to run a program I wrote, but the error message is coming > up too fast for him to catch it. How can you keep that error message window > around longer in Win2K? (BTW, let's pretend he doesn't know how to use the > DOS prompt.) > > Jonathan Regards Frank From claird at starbase.neosoft.com Fri Dec 28 12:06:44 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 28 Dec 2001 11:06:44 -0600 Subject: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> Message-ID: <2419401F9FA44C22.520DBCE4218C0223.5487885783B69E22@lp.airnews.net> In article , Cameron Laird I approximated: > . > . > . >RFC 765 FILE TRANSFER PROTOCOL June 1980 >RFC 821 SIMPLE MAIL TRANSFER PROTOCOL August 1982 >RFC 854 TELNET PROTOCOL SPECIFICATION May 1983 >RFC 850 Standard for Interchange of USENET Messages June 1983 >RFC 977 Network News Transfer Protocol February 1986 . . . Oops; substitute the earlier RFC 788 SIMPLE MAIL TRANSFER PROTOCOL November 1981 -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From cmkleffner at gmx.de Tue Dec 4 07:36:48 2001 From: cmkleffner at gmx.de (cmkl) Date: 4 Dec 2001 04:36:48 -0800 Subject: How to compare text? References: Message-ID: <3b091a1c.0112040436.40ac160f@posting.google.com> what about using the standard module 'difflib' with all it's helpers? This module uses a very smart and fast algorithm for comparing sequences and evaluating differences. - The difflib method 'ndiff' is an easy wrapper to a UNIX-diff like function to compare lists of strings. - others are the classes Differ and SequenceMatcher Maybe that's overkilled for a simple purpose, but its worth to take a look. Carl "Guenter Kruschina" wrote in message news:... > From: "A" > To: tutor at python.org, activepython at listserv.ActiveState.com, > python-list at python.org > Subject: How to compare text? > Send reply to: printers at sendme.cz > Priority: normal > Date sent: Mon, 3 Dec 2001 11:06:04 +0100 > > > > > Hello, > > How can I compare of one parragraph of text with another > > paragraph?Each paragraph can have about 100 words. > > For example I have the first paragraph > > > > I want to be very good at Python programming. Better than in Perl. > > > > THe second paragraph might look loke this: > > > > She works all day long to master Perl. > > > > All that I need is to find out if any of word from the second is in the > > first paragraph. For the example above I should find out word > > > > Perl > > > > > > What is the best and quickest way? > > Thank you for help. > > Ladislav > > > > > > _______________________________________________ > > ActivePython mailing list > > ActivePython at listserv.ActiveState.com > > http://listserv.ActiveState.com/mailman/listinfo/activepython > > > > > Hallo Ladislav, I have written a small progam, which will work as you expe= > ct. I > hope so. I think this is a fast way to compare two paragraphs. > > wbg > G=FCnter > > > > -- From hungjunglu at yahoo.com Sat Dec 1 19:07:13 2001 From: hungjunglu at yahoo.com (Hung Jung Lu) Date: 1 Dec 2001 16:07:13 -0800 Subject: which is best for a singleton, module or class? References: <9sbd8i$680$1@wanadoo.fr> <3C005692.173907B3@engcorp.com> <3C03275E.2C4D8149@engcorp.com> <3C045C07.BA7B3FE6@engcorp.com> <3C05AE56.E2261313@engcorp.com> <3c05b472$1@207.229.64.20> <3C05C9C3.ADC96FB5@engcorp.com> <8ef9bea6.0111290932.4afa618a@posting.google.com> <83elmftfbt.fsf@panacea.canonical.org> Message-ID: <8ef9bea6.0112011607.464fcd9f@posting.google.com> Kragen Sitaker wrote in message news:<83elmftfbt.fsf at panacea.canonical.org>... > hungjunglu at yahoo.com (Hung Jung Lu) writes: > > You can simply put your object into the __builtins__ namespace: > Please don't do that, except as a joke. Programs have bugs enough > without obnoxious people deliberately making them harder to > understand. Joke? :) It's not a joke. Zope Corporation (the same *obnoxious* people that hired Guido, ha!) uses it. Experienced Python programmers do use this device, sparingly, but they do use it, in real life. Hung Jung From syver-en+usenet at online.no Sat Dec 29 18:23:21 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 30 Dec 2001 00:23:21 +0100 Subject: REPOST: Re: SSL Sockets in Windows References: Message-ID: <6$--$$_----__-%-$$@news.noc.cabal.int> Syver Enstad writes: > Gerhard H?ring writes: > > You seem to still have SSL compiled in. Be sure to replace your > > _socket.pyd with the one without SSL. Using "python -v" helps > tracking > > > > > down which module really is loaded. > > Ah the -v switch, I forgot about that one. I'll look some more into > it. Ouch, I had the ssl version of _socket.py lying in the python dir. (Insert foot in mouth). Thank you for the -v switch again. -- Vennlig hilsen Syver Enstad ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!newspeer.cwnet.com!enews.sgi.com!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Syver Enstad Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:04:14 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774496 27193 211.57.49.2 (31 Dec 2001 04:54:56 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:54:56 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From store_li at sina.com Wed Dec 12 22:27:12 2001 From: store_li at sina.com (Kick) Date: Thu, 13 Dec 2001 11:27:12 +0800 Subject: Which widget can read BMP file Message-ID: <9v979p$dtuud$1@ID-12869.news.dfncis.de> It seems that BitmapImage class can only read ppm file, and Photoimage class recognize gif file not bmp file. Is it true? If so, what class or widget allow me working with bmp file? Thank you! From mal at lemburg.com Thu Dec 20 17:12:12 2001 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu, 20 Dec 2001 23:12:12 +0100 Subject: testing mx.DateTime fails on import (Py 2.1.1) References: <1008772673.955709@lix-049dz-008.inside.impress.com> Message-ID: <3C22623C.B4733FAE@lemburg.com> wtr wrote: > > C:\Python21>testDT.py > Traceback (most recent call last): > File "C:\Python21\testDT.py", line 3, in ? > from mx.DateTime import * > <-------my import > File "C:\Python21\mx\DateTime\__init__.py", line 40, in ? > class modinit: > File "C:\Python21\mx\DateTime\__init__.py", line 50, in modinit > _DT) > File "C:\Python22\lib\copy_reg.py", line 16, in pickle > raise TypeError("copy_reg is not intended for use with classes") > TypeError: copy_reg is not intended for use with classes > ------------------------------------------------------------------- > > The directory structure is C:\Python21\mx\DateTime\mxDateTime, > which was generated at installation of the mx package. > > Can anybody help? Try upgrading to the lastest version. It supports Python 2.2. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From jjl at pobox.com Mon Dec 17 13:17:20 2001 From: jjl at pobox.com (John J. Lee) Date: Mon, 17 Dec 2001 18:17:20 +0000 Subject: WYSIWYG text Editor in python? In-Reply-To: <3C1DDCAC.C477A0A6@cicei.ulpgc.es> References: <3C1DDCAC.C477A0A6@cicei.ulpgc.es> Message-ID: On 17 Dec 2001, Enrique wrote: [...] > different task, automating text reports. For this task I > need a MS-Word-like text editor able to render on screen > text in bold, italics, underline, greek symbols and > super/subscripts. I work with MS-Windows. > > I have a prototype of the application using > wxWindows/wxPython and wxHTMLWindow to render the text (text > input is done with explicit HTML markup tags, which is not > optimal for users). Hoewever I have found that wxHTMLWindow > do not render tags, neither sub and > superscripts. So I am looking for other solutions. > > I have two options in mind: > > a) Looking for an existing Python application/module for a > WYSIWYG text Editor or similar. I have searched the > Parnassus without success. Are any of you aware of such a > beast? Perhaps this is an annoying answer, but PyQt has a trivial-to-use text editor widget. I don't recall if Qt 2 can do bold / italic, etc, but I'm almost certain Qt 3 does (with html or xml internally, IIRC). The interface for selecting text attributes such as bold or subscript would be up to you, of course. PyQt is stupidly easy to use :) > b) Using MS-Word as the editor. Currently I am using COM to [...] > need to run Word in a MODAL way, (or OLE I don't know, this [...] I guess this is a wxPython question. John From ngreco at softhome.net Mon Dec 17 14:59:27 2001 From: ngreco at softhome.net (Nahuel Greco) Date: Mon, 17 Dec 2001 16:59:27 -0300 Subject: WYSIWYG text Editor in python? In-Reply-To: <9vlgpe$o8v$1@news1.xs4all.nl> References: <3C1DDCAC.C477A0A6@cicei.ulpgc.es> <9vlgpe$o8v$1@news1.xs4all.nl> Message-ID: <20011217165927.3eb1c0e8.ngreco@softhome.net> On 17 Dec 2001 19:24:30 GMT boud at rempt.xs4all.nl (Boudewijn Rempt) wrote: > > On the other hand, I'm currently working on a text editor written > almost entirely in Python (all editing and redisplay), with the goal > of finally having a real interlinear text editor. I think it can > be done -- but it's nowhere yet. > > You know about scintilla / scite ? http://www.scintilla.org/ - Nahuel Greco Web Development - Open Source - - http://www.codelarvs.com.ar Game Programming - Research - - Freelance coding / sysadmin Networking. The answer is 42. - From fgranger at alussinan.org Fri Dec 14 11:58:18 2001 From: fgranger at alussinan.org (=?ISO-8859-1?Q?Fran=E7ois_Granger?=) Date: Fri, 14 Dec 2001 17:58:18 +0100 Subject: Deprecate tabs for indenting References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BD39F.D43D4FF7@mega-nerd.com> <3c0be454$1@207.229.64.20> <3C0BE5D5.4386B359@mega-nerd.com> Message-ID: <1f4es6m.1lwiy7w124o4q4N%fgranger@alussinan.org> Erik de Castro Lopo wrote: > Peter Bismuti wrote: > > > > So much for cooler heads prevailing....(deep sigh). > > Maybe my post was not the best way to deal with this matter. > > However, the people who like me prefer using tabs (and nothing but tabs) for > indentation need to speak up. tab is the only proper way to indent a piece of code. -- Rien n'a besoin d'?tre taill?. Mais tout PEUT se tailler, m?me les conif?res. Tout d?pend de ce qu'on appelle "taille"... - Pierre From loewis at informatik.hu-berlin.de Fri Dec 21 11:40:52 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 21 Dec 2001 17:40:52 +0100 Subject: compile() question References: <2bbda179.0112141529.49f816ce@posting.google.com> Message-ID: afabbro at indoctrination.com (afabbro) writes: > exec ( 'volume.' + field + ' = "' + value + '"' ) > > which means the exec'd python code is something like: > > volume.barcode = 'T00123' > > So far, so good. exec is not good. What's wrong with setattr(volume, field, value) HTH, Martin From teyc at bigfoot.com Thu Dec 27 05:48:21 2001 From: teyc at bigfoot.com (Chui Tey) Date: Thu, 27 Dec 2001 20:48:21 +1000 Subject: REPOST: Re: A new message board is up References: <40dbad98.0112262232.1868734e@posting.google.com> Message-ID: <7$--$$-$$$$%_%__-$@news.noc.cabal.int> Well, I guess this sounds the death knell of c.l.py. Chui Andrew Nguyen wrote in message news:40dbad98.0112262232.1868734e at posting.google.com... > A new message board (that doesn't have the Usenet delay) is up! > Xutilla is the admin. it is at > http://pub19.ezboard.com/fthepythonmessageboard95602frm1 > > Hope to see you! ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Chui Tey" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:50:18 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775817 27193 211.57.49.2 (31 Dec 2001 05:16:57 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:16:57 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From robin at jessikat.fsnet.co.uk Wed Dec 5 11:27:06 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Wed, 5 Dec 2001 16:27:06 +0000 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <23891c90.0112040300.77f64f8e@posting.google.com> <23891c90.0112050738.60ed8b25@posting.google.com> Message-ID: <5wovbKAarkD8Ew1F@jessikat.demon.co.uk> In article <23891c90.0112050738.60ed8b25 at posting.google.com>, Paul Boddie writes >Steve Lamb wrote in message news:eleute.dmiyu.org>... >> OR... are you going to admit that you were >> purposely misrepresenting what you fully knew what a tab represented in this >> context just to get a rise out of me? > >Yes. I hope you enjoyed it as much as I did. :-) > >Paul > >P.S. Actually, I'm much more serious about the whole indentation thing >in other forums, but you wading into this debate as you did really >invited some irreverence. The reason why these 'simple' threads get so much attention and heat is that the majority of people can understand the issues. The board of directors passes the ?multi-million factory rebuild in ten minutes, but spends an hour worrying about the workers' bike shed. This and emac vs vi are among the most interesting issues :) -- Robin Becker From fredrik at pythonware.com Mon Dec 3 18:47:04 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon, 03 Dec 2001 23:47:04 GMT Subject: Python evangelists unite! References: <3C07884E.75E18DF7@engcorp.com> <9ue2o2$b344@news1.gtech.com> <3C0B08F3.C9CDE885@engcorp.com> Message-ID: > Or did you have some other point I missed? don't feed the troll. From christophertavares at earthlink.net Sun Dec 2 05:22:28 2001 From: christophertavares at earthlink.net (Chris Tavares) Date: Sun, 02 Dec 2001 10:22:28 GMT Subject: How is sys.path initialized without a PYTHONPATH? References: Message-ID: "A. Keyton Weissinger" wrote in message news:mailman.1007269381.20507.python-list at python.org... > I am using ActiveState's ActivePython 2.1. I do NOT have a PYTHONPATH > environment variable set on my machine. When I fire up the interpreter > shell, and do the following: > > >>> import sys > >>> print sys.path > > I get the following: > > ['', 'C:\\Python21\\Pythonwin', 'C:\\Python21\\win32', > 'C:\\Python21\\win32\\Lib', 'C:\\Python21', 'C:\\Python21\\DLLs', > 'C:\\Python21\\lib', 'C:\\Python21\\lib\\plat-win', > 'C:\\Python21\\lib\\lib-tk', 'C:\\Python21\\Numeric', 'C:\\Python21\\PPM'] > > Where is the list being generated since I have no PYTHONPATH variable? Can I > configure this somehow to include more places (without having to append() to > the sys.path in the interpreter shell)? > > Thank you... > > Keyton > Look in the registry, under HKEY_LOCAL_MACHINE\Software\Python\PythonCore\2.1\PythonPath. Each key below this point adds directories to the pythonpath. Just add a new key with whatever name you want, and set the default value to the semicolon separated list of directories. -Chris From touch at btamail.net.cn Thu Dec 20 00:36:42 2001 From: touch at btamail.net.cn (Torpedo) Date: Thu, 20 Dec 2001 13:36:42 +0800 Subject: how to get window performance data using python Message-ID: i need to get windows performance data from registory how to write this program , can anyone give an example program? very thanks for your help! Torpedo 2001-12-20 touch at btamail.net.cn From grey at despair.dmiyu.org Fri Dec 28 15:36:04 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Fri, 28 Dec 2001 20:36:04 -0000 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2C8A86.50C74E60@earthlink.net> <3C2CBA56.17FE536C@earthlink.net> Message-ID: On Fri, 28 Dec 2001 18:36:09 GMT, Hans Nowak wrote: > Fair enough, but did you buy those recently? The original remark > was about the slowest computers one could get today... > Ah well, that's what I get for buying mine at K-mart... ;-) All were aquired one manner or another in the past year. :) -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From infinitystwin.SPAM at IS.BAD.yahoo.com Tue Dec 4 17:13:22 2001 From: infinitystwin.SPAM at IS.BAD.yahoo.com (Greg Krohn) Date: Tue, 4 Dec 2001 16:13:22 -0600 Subject: Making a string raw References: <59333ea6.0112041014.7908e9ab@posting.google.com> Message-ID: <3c0d499c$0$79557$6e49188b@news.goldengate.net> "Rune Nesheim" wrote in message news:59333ea6.0112041014.7908e9ab at posting.google.com... > Could any of you lot tell me how to convert a string stored in > avariable to a raw string? > > I know I create a raw string this way: > > spam = R'hello' > > But if I don't know what the string is going to contain, for example > if I fetch from a Tkinter text-box to the variable 'eggs' and want to > convert 'eggs' into a raw string. If those other posters misinterpereted your question and you have a string with embedded newlines, backslashes, etc. and you want them represented as \n, \\, etc., try this: >>> spam = 'spam\tand\\eggs' >>> print spam spam and\eggs >>> spam = `spam` >>> print spam 'spam\tand\\eggs' I don't know the name of that character, but it's right above Tab on my keyboard. HTH, greg From store_li at sina.com Sat Dec 22 22:15:09 2001 From: store_li at sina.com (Kick) Date: Sun, 23 Dec 2001 11:15:09 +0800 Subject: How can I display unicode in Tk widget References: <9vkqm7$fqo83$1@ID-12869.news.dfncis.de> <9vnou6$gpvgr$1@ID-12869.news.dfncis.de> <9vunds$hiile$1@ID-12869.news.dfncis.de> Message-ID: Ok! My little is as follow, ------------------------------------------------------ import odbc from Tkinter import * h=odbc.odbc("SQLite") u=h.cursor() u.execute("select * from tbl2") q=u.fetchone() f=q[0] print type(f) print type(q[0]) root=Tk() g=Label(root,text=f) e=Text(root) e.insert(END,q[0]) g.pack() e.pack() root.mainloop() ---------------------------------------------------------------- The labe widget g and e can't display my chinese char retrived from sqlite database. Could someone help me? Pls! Rick "Martin von Loewis" wrote in message news:j41yhoo5n1.fsf at informatik.hu-berlin.de... > "Kick" writes: > > > Would You like tell me what could I do? > > No. Not at all. Not with the kind of information that you are providing. > > Please post a small snippet of source code you are trying to run, and > report what software version you are using, and what the snippet does > when run on your system. Perhaps *then* somebody has grounds to make > valuable suggestions. > > Regards, > Martin > From jason at jorendorff.com Fri Dec 14 11:52:15 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Fri, 14 Dec 2001 10:52:15 -0600 Subject: Connection reset by peer Message-ID: Edward wrote: > udpCliSock=socket(AF_INET,SOCK_DGRAM) > data=raw_input('>') > udpCliSock.sendto(data,ADDR) > print udpCliSock.getsockname() > data, addr = udpCliSock.recvfrom(BUFSIZ) Hmm. It is definitely weird to get ECONNRESET back from a non-connection-oriented socket. Well, here's my guess at what's happening. * Client sends a UDP packet; this gets sent to the server over the network. * Server IP layer receives the packet. * Server IP layer provides a copy of the packet to the server, since the server is listening on a raw socket. * Server IP layer then notices that there is no UDP socket there, on the server, bound to the specified port. * Server IP layer therefore generates an ICMP "Port Unreachable" error packet and sends it back to the client. * Client IP layer receives the error packet and sets a flag on the udpCliSock saying "hey, you got an error" * The next time you call udpCliSock.recvfrom(), the error gets reported. This is just a guess though. If the guess is correct, then you can make this work by creating a udpServerSock on the server; you can set it to nonblocking, occasionally do udpServerSock.recvfrom() on it, and discard the results. Good luck. -- Jason Orendorff http://www.jorendorff.com/ From tundra at tundraware.com Mon Dec 10 18:10:08 2001 From: tundra at tundraware.com (Tim Daneliuk) Date: Mon, 10 Dec 2001 23:10:08 GMT Subject: Populating a list References: <32c382ad.0112091404.6cfe4a56@posting.google.com> Message-ID: <3C154077.CA89133B@tundraware.com> mlorfeld wrote: > > I am new to python (about 72 hours into learning), and am having > problems with reading a file (sate abbreviations) with one item per > line and populating each line into a list. The problem is that each > item ends with \012 after each state ie WI\012. > > Here is the code that I am using: > > f=open('/home/mlorfeld/states.txt', 'r+') > states=f.readlines()#populates a list from file > f.close > print states I think the following works portably so you do not have to fiddle w/ EOL conventions: f=open("xxx.txt") x=f.read().splitlines() f.close() x is now populated with the content of the line regardless of how it ends (or at least this works on a FreeBSD system using a WinDoze text file). As someone else pointed out here, the [:-1] idiom has the problem that it may truncate the last character of the file if the last line does not end with the unwanted character. Similarly, chopping trailing whitespace is semantically very different than handling differing EOL conventions (though it may work on text files, there may be applications where the embedded trailing whitespace may be important, say if a pagefeed is embedded at the end of a line...). In general, this is system level stuff that ought to be handled by the system and/or language whenever possible, not the program logic... -- ------------------------------------------------------------------------------ Tim Daneliuk tundra at tundraware.com From jkraska at san.rr.com Sat Dec 29 17:23:03 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 29 Dec 2001 22:23:03 GMT Subject: Is learning Python "extraordinary"? References: Message-ID: >I am a high school senior, and like many others, I am applying >to college. I am applying to MIT (as well as many other schools). >MIT describes what they are looking for as students who do or have >done "extraordinary things". *shrug* Given the apathy of the vast majority of high school students, any amount of self-initiative is in itself an extraordinary thing. As a high school student, if you were authoring Python extensions, now that would be genuinely extraordinary. For that matter, contributing to the IT community in any way as a high school student is remarkable. Don't be afraid to stroke your own rhubarb, as it were, on a college admissions test. You don't get points for modesty and a self-deprecating nature on that type of thing. Trust me on this. Brag. C// From hanche at math.ntnu.no Tue Dec 11 16:30:07 2001 From: hanche at math.ntnu.no (Harald Hanche-Olsen) Date: 11 Dec 2001 22:30:07 +0100 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C100BB2.6446E896@cosc.canterbury.ac.nz> <7da8d8f8.0112070206.49e1bef4@posting.google.com> <3C114F6D.D1E2D291@attbi.com> <3C1441D6.A648257F@cosc.canterbury.ac.nz> Message-ID: + Greg Ewing : | People are very used to the idea of a date and a time | of day going together and specifying a point in time. | Having separate Date and TimeOfDay classes may be a | good idea, but many people are going to be disappointed | if there isn't also a DateTime class that blends | them smoothly together somehow. No, no, no. I never meant to advocate a TimeOfDay class without reference to the date. If you need to specify a time, you need the date to go with it, or the time is useless. So there should be a Date or Calendar class that merely understands dates and calendars, with no reference to time of day. And there should be a Time class, which specifies a time by giving both the date (from the former class) and a time of day. (Complete with time zone information.) All I'm saying is that the first module needs to be nailed down dead solid before you even start tackling the second. -- * Harald Hanche-Olsen - Yes it works in practice - but does it work in theory? From Dave at PragmaticProgrammer.com Thu Dec 27 17:34:38 2001 From: Dave at PragmaticProgrammer.com (Dave Thomas) Date: Thu, 27 Dec 2001 22:34:38 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: Ron Stephens writes: > 1. Ruby is an especially interesting competitor to Python. I have been > monitoring the Ruby newsgroup, and it shows incredible growth and > vitality. Furthermore, Ruby is aimed right at the heart of Python's > niche. Ruby and Python grew up largely in parallel. Matz was aware of Python, but as far as I know didn't use many of Python's ideas when designing the Ruby language. It would be wrong to characterize Ruby as "aiming for Python" in that regard. The Ruby community is not particularly out to steal folks from the Python world: it's quite happy collecting new users from all over the place. My guess is we'll see more converts from Perl than from Python, and that by a large margin. In the past, I've made statements that Ruby could be bigger than Python in terms of number of active developers. I still believe that could happen. However, I don't see that happening at the expense of the Python community, which I suspect will remain strong and vibrant for many years. Instead, Ruby will attract folks from outside the Python world. Ruby and Python differ in philosophy and _feel_. Some folks like one, some the other. I don't see it as competition. I see it as choice. Dave From Bruce at EckelObjects.com Sat Dec 8 21:11:21 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Sat, 08 Dec 2001 18:11:21 -0800 Subject: py2exe question In-Reply-To: References: Message-ID: <200112081811210290.025A2E1B@mail.rdc1.sdca.home.com> Not exactly sure, but you might try something based on this: import sys sys.path += ['../util'] *********** REPLY SEPARATOR *********** On 12/9/01 at 2:59 AM Syver Enstad wrote: >At first py2exe seems to work very nicely on a couple of test projects >I've run it on. Thanks, and I particularely like that it integrates >with the distutils which also are cool. Now all we lack is a kind of >cpan that have ALL the modules and the newest ones at >that. ActiveStates PPM is nice but the modules there are too few and >many are old. > >My question on py2exe is: Is it possible to make an exe that searches >the normal sys.path for modules that doesn't exist in the exefile >itself? > >When I create a barebones py2exe exe by --excluding all modules I get >import error because py2exe overrides the import mechanism in python >to only search in the py2exe file itself, at least that's how I have >understood it. Does anybody have any tips for accomlishing this? > > >-- > >Vennlig hilsen > >Syver Enstad >-- >http://mail.python.org/mailman/listinfo/python-list Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From mwh at python.net Sat Dec 29 14:16:59 2001 From: mwh at python.net (Michael Hudson) Date: Sat, 29 Dec 2001 19:16:59 GMT Subject: REPOST: Re: pty.spawn() and friends References: Message-ID: <7$--$$_----___-$-$@news.noc.cabal.int> "James T. Dennis" writes: > So naturally I tried to implement the simplext expect script > (autopasswd) as a Python script using the pty.spawn() function. Dunno what that does, but I've been able to do things using os.forkpty directly, and not going near the pty module. This makes your code less portable, but at least I could get it to work. Cheers, M. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.wirehub.nl!news-out.nuthinbutnews.com!propagator2-austin!propagator!feed2.newsfeeds.com!newsfeeds.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Michael Hudson Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:39:47 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774615 27193 211.57.49.2 (31 Dec 2001 04:56:55 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:56:55 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From daves_spam_dodging_account at yahoo.com Fri Dec 28 14:09:50 2001 From: daves_spam_dodging_account at yahoo.com (David Brady) Date: Fri, 28 Dec 2001 11:09:50 -0800 (PST) Subject: ETA for Win32all under Python 2.2? Message-ID: <20011228190951.19771.qmail@web21103.mail.yahoo.com> GAAAAAH! It doesn't exist yet! I want to say something bitter, like "Python is dead to me," but saying "Python 2.2 is as yet unborn to me" just comes off wobbly and obtuse. Mark, I recall a poster I had in the mid-80's that had definitions of various computer terms on it. It had the following definition: CHAINING: Method of attaching programmers to their desks to increase output. Is Win32all for 2.2 done yet? If you write back to say no, I'll be forced to beat you for fiddling with e-mail when you should be writing code... :-) Ah, but seriously. Great package. So great that I really can't afford to move to Python 2.2 until Win32all supports it... so, if threats don't work, I'll resort to bribes and then to begging. Tell me where you want the cookies sent. :-) Any idea of an ETA? So-anxiously-awaiting-Win32all-that-I'm-copying-Mark's-sig-style ly, -dB P.S. There's a longstanding rule in my family: you're not allowed to complain about anything you could fix yourself. I'd offer to help, but "a beating" was the funnier of the two threats. :-) ===== David Brady daves_spam_dodging_account at yahoo.com I'm feeling very surreal today... or *AM* I? __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com From joshm at taconic.net Wed Dec 26 20:00:14 2001 From: joshm at taconic.net (Joshua Muskovitz) Date: Wed, 26 Dec 2001 20:00:14 -0500 Subject: references for shifting from Py1.5.2 to Py2.2? References: <3c2a5cd1_2@corp.newsgroups.com> Message-ID: <3c2a70a1$1_1@corp.newsgroups.com> Thanks, both suggestions are just what I was looking for. :-) -- josh -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- From buzzard at urubu.freeserve.co.uk Wed Dec 5 18:04:33 2001 From: buzzard at urubu.freeserve.co.uk (Duncan Smith) Date: Wed, 5 Dec 2001 23:04:33 -0000 Subject: PyInline problem References: <9uljcb$8ap$1@newsg4.svr.pol.co.uk> <9ulksl$f0o$1@endevour.netg.se> <9ulr4i$bb9$1@newsg3.svr.pol.co.uk> <9um2m4$3pb$1@nntp9.atl.mindspring.net> Message-ID: <9um97d$kvs$1@newsg3.svr.pol.co.uk> "Andrew Dalke" wrote in message news:9um2m4$3pb$1 at nntp9.atl.mindspring.net... > Duncan Smith: > >The following does not build. > > > >import PyInline > > > >m = PyInline.build(code=""" > > #include > > #include > ^^^^^ stdlib? > Yes, sorry again. I keep posting stuff that won't build for some obvious reason. I have tried building it without the include files and failed. But then I have closed Python, opened it up, tried again, and it's built. I have built it with #include , but have always failed when I also have #include . I'll get there in the end, I just hate the trial and error / close Python/open Python routine. Just like many moons ago, before I discovered reload(module).:-) Duncan > Andrew > dalke at dalkescientific.com > > > From wurmy at earthlink.net Fri Dec 28 13:36:09 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Fri, 28 Dec 2001 18:36:09 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2C8A86.50C74E60@earthlink.net> Message-ID: <1$--$$_----_-%$$%$@news.noc.cabal.int> Steve Lamb wrote: > > On Fri, 28 Dec 2001 15:12:20 GMT, Hans Nowak wrote: > > Hey, you guys, stop dissing my box like that! >=) > > (900 MHz, bought last month...) > > Hey, I'm allowed. > > Winbox for games: 667mhz, 512Mb RAM. > Linux server/workstation: 450Mhz, 384Mb RAM (although I can drop another 450 > in) > Linux Laptop: 667Mhz, 128Mb RAM. > > You trump me on all three. Fair enough, but did you buy those recently? The original remark was about the slowest computers one could get today... Ah well, that's what I get for buying mine at K-mart... ;-) --Hans ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Hans Nowak Newsgroups: comp.lang.python Subject: cmsg cancel <3C2CBA56.17FE536C at earthlink.net> Control: cancel <3C2CBA56.17FE536C at earthlink.net> Date: Mon, 31 Dec 2001 01:50:25 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775145 27193 211.57.49.2 (31 Dec 2001 05:05:45 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:05:45 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jkraska at san.rr.com Sun Dec 9 12:21:45 2001 From: jkraska at san.rr.com (Courageous) Date: Sun, 09 Dec 2001 17:21:45 GMT Subject: Calling a generator multiple times References: Message-ID: >Nobody (rational) expects that. A BDFL Pronouncement is called for >precisely in those areas where extended debate has proved that consensus >will never be reached. The choices then are eternal paralysis, or, if Guido >wants something enough, he breaks the deadlock by Decree and life moves on. This is fair enough, and I can live with it. It's not like generators are all that hard, or anything. And it's not that I think that the current _behavior_ of generators is wrong; rather, I'm flummoxed as to the leaving of the syntax as it is, as it leads to surprises. The syntax as is predicts other behavior to me. For example, when I wrote my first generator, I knew _conceptually_ exactly what to expect based on my prior use of stackless continuations, continuations in lisp, cooperative multi-threading environments I've written, and esoteric and ill-advised :) use of setjmp and longjmp in the past. However, what threw me was the behavior on the first invocation. Since I was defining a method, I expected that when called the first time the code prior to first yield would execute. That's not what happened. The code executed on the first next. I can see perfectly well why it went the other way, but I certainly hope you can see how I would state that code appearing in a function definition probably ought to execute when the function is apparently called or someone is going to be surprised. And they will be. I guarantee it. I'm willing to bet that almost every single new user of generators is going to encountered this and have the same experience of surprise. Will this _baffle_ anyone? Hell, no. It's not that hard to say "what the fuck!?", read the manual a little more carefully, and come to an understanding. It's not a _difficult_ concept to grasp, just an unexpected one. C// From ajs at ix.netcom.com Sat Dec 15 10:15:56 2001 From: ajs at ix.netcom.com (Arthur Siegel) Date: Sat, 15 Dec 2001 10:15:56 -0500 Subject: Unsung Python modules Message-ID: <001001c1857b$862185a0$a9e1fea9@carol> >>>Andrew Kuchling wrote: > >What's your favorite unsung module? jason writes - > ...I suppose I can claim Numeric as my favorite module. >With Numeric I can use python for Real Work. Who needs Mathematica? Who >cares about Matlab? I have python+numeric+gnuplot. My focus being on Python as an educational tool (my own education, first off) I would second Jason's sentiments on Numeric. A math education in a box. And despite my disagreement with their team on core Python language design issues, I am a VPython lover. I experience it as native Python brought into the visual realm. Which is its intent, realized. Art From dsavitsk at e-coli.net Tue Dec 4 14:13:33 2001 From: dsavitsk at e-coli.net (dsavitsk) Date: Tue, 04 Dec 2001 19:13:33 GMT Subject: Using Pythonwin as ASP editor References: <1007492220.13392.0.nnrp-07.c1c3e1d9@news.demon.co.uk> Message-ID: i had a similar question about a month ago or so. search the archives for an explanation on how to edit the PythonWin source to customize it for .asp editing -- then give up unless it is a big problem. ;-) it was beyond my skill, anyhow. -d "Paul Brian" wrote in message news:1007492220.13392.0.nnrp-07.c1c3e1d9 at news.demon.co.uk... > Dear all, > > I am using Pythonwin as an editor for occasional ASP pages (I know I know, > but I am trying to cut down). > > Unfortunately something in its default formatting of text makes it underline > in squiggly red and green all the Python code encapsualted in <% %> > > Does anyone know how to stop it doing that - the formatting tool under > "Edit/options" just does not seem to have the right options and I have only > ever glanced at Scintilla and have no idea where the config files for it are > in Pythonwin. The docs do not seem to point it out. > > I expect I am just missing something very obvious, but would be grateful for > any how to on making it format how I like. > > Cheers > > P Brian > > > From phr-n2001d at nightsong.com Thu Dec 20 00:49:54 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 19 Dec 2001 21:49:54 -0800 Subject: Newbie Programming References: <84fd22ef.0112192032.14c75f8a@posting.google.com> Message-ID: <7xwuziv3st.fsf@ruckus.brouhaha.com> manutd8611 at softhome.net (Evan Roman) writes: > I have just begun programming in Python a couple months ago. While i > feel like i am doing OK, i don't think im getting any better. The > problem is i can't think of anything to program... I think I have most > of the fundamentals down, but i can't think of any ways to use them. > I was just wondering if there was some website that gives ideas of > little projects to do so that one could sharpen his programming > skills. Thanx in advance for all the help. Think of some other area that interests you--photography, flying, music, or whatever. Then think of some programs you'd like to have, that are related to that subject. Then write the programs. From chrishbarker at attbi.com Fri Dec 7 13:20:23 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Fri, 07 Dec 2001 10:20:23 -0800 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C100BB2.6446E896@cosc.canterbury.ac.nz> <7da8d8f8.0112070206.49e1bef4@posting.google.com> Message-ID: <3C110867.5263E6E6@attbi.com> sebastien wrote: > Here my feeling about them. good summary. > CB>I use mxDateTime frequently, and it is a fabulous package. (...) > CB>It makes a whole lot more sense to me to put in a trimmed-down > CB>version that to re-invent this particular wheel. > OB>Just a day ago the question was raised (by me) in zope list. The > answer > OB>was: both Guido and Marc-Andre said "no". It is a matter of > support. Who > OB>will support the module in the std python lib? This is exactly the same problem you would have with ANY addition to the standard lib. If you (or anyone else) writes a brand new nifty Date/Time module, it will only get included in the standard lib if the issue of how it is going to be maintained is resolved. So: Is mxDateTime written in a way that it would be harder to maintain than your proposed new package? Are there other technical issues with mxDateTime that make it unsuitable for the standard lib? If the answer to these is no..you might just as well fork mxDateTime, and take resposibility for maintaining it in the standard lib. While the license appears to allow it, I probably wouldn't do it without Marc-Andre's blessing, but those are political and interpersonal issues, not technical ones. > I didn't saw other reasons than support costs There may be other reasons... let's hear them! I know I've been happy with it, but I've never had the need for femtoseconds. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From qrczak at knm.org.pl Mon Dec 3 05:04:46 2001 From: qrczak at knm.org.pl (Marcin 'Qrczak' Kowalczyk) Date: Mon, 3 Dec 2001 10:04:46 +0000 (UTC) Subject: more on "Is this considered black magic?" References: <3C0B441C.8000608@vscht.cz> Message-ID: Mon, 03 Dec 2001 10:21:32 +0100, Beda Kosata pisze: > map( lambda o: o.method( args), objects) > > The solution is not very error prone, but when you know what you have in > your list it works just fine. As a side effect you also get list of results. If you don't need the results, a 'for' loop is more straightforward: for i in objects: o.method(args) -- __("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ QRCZAK From eppstein at ics.uci.edu Mon Dec 10 14:41:30 2001 From: eppstein at ics.uci.edu (David Eppstein) Date: Mon, 10 Dec 2001 11:41:30 -0800 Subject: PEP 276 Simple Iterator for ints (fwd) References: <9uomtp$e1cbj$1@fido.engr.sgi.com> <9up46o$e2ost$1@fido.engr.sgi.com> <3C150188.C31AC4B8@ccvcorp.com> Message-ID: In article <3C150188.C31AC4B8 at ccvcorp.com>, Jeff Shannon wrote: > (I still strongly dislike the proposed notation, though.... Maybe > it's a style thing--I'd usually much rather have a clear function call > than clever operator tricks.) The two objections I have to the current "clear function call" (range and friends) are first, you can't understand it unless you crack that manual and have it tell you what the arguments mean and what the difference is between range and xrange, which is no good for writing code that non-Python-literate programmers can quickly and easily understand, and second, even for Pythonists, it doesn't lead to clear code unless what you need is half-open-on-the-right intervals with integer bounds, which only cover some of the uses of range. For example, suppose you want to loop over the set of integers i satisfying x <= i < y (the usual half-open interval), but you need them in reverse order, and x and y may be non-integer. As far as I can tell, the "one right way" of doing this is import math for i in range(int(math.ceil(y-1)),int(math.ceil(x-1)),-1): ... Despite having some idea how range works I checked this in the interpreter and had to correct multiple mistakes: forgot the "math.", misspelled "ceil" as "ceiling", and incorrectly used floor(x+1) instead of ceil(x-1) in the second argument. And there's still a possible bug when integer unification comes around and makes long an acceptable argument for a range. This is a "clear function call" compared to for y > i >= x: ... ? -- David Eppstein UC Irvine Dept. of Information & Computer Science eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/ From Bruce at EckelObjects.com Thu Dec 6 14:49:54 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Thu, 06 Dec 2001 11:49:54 -0800 Subject: Class equivalence? Message-ID: <200112061149540390.01224BA2@mail.rdc1.sdca.home.com> >>> class Flower: pass >>> class Daisy(Flower): pass >>> Daisy is Flower 0 What am I missing here? Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From jkraska at san.rr.com Thu Dec 6 14:58:23 2001 From: jkraska at san.rr.com (Courageous) Date: Thu, 06 Dec 2001 19:58:23 GMT Subject: Is it possible to kill a thread ? References: <9unnfb$6fp$1@wanadoo.fr> <3C0FCD72.A5FA167C@ccvcorp.com> Message-ID: >Create a threading.Event object, and pass it to the thread at startup. When >you want to close the application, set the event, and then join() the thread. >In the thread, you periodically check the event. When the event becomes set, >then the thread terminates itself. At that point, your main thread returns >from join() and you can finish shutting down. This is good advice. Not only that, but it's advice practiced by many. It's generally considered bad form to kill a foreign thread. One generally asks it to die nicely. If you think about it, this is the "object oriented way of doing things". Presumably only the thread in question really knows how to clean up after itself properly. C// From aahz at panix.com Sat Dec 22 10:42:32 2001 From: aahz at panix.com (Aahz Maruch) Date: 22 Dec 2001 07:42:32 -0800 Subject: Platform-independent GUID creation? References: <9vtn13$aq9$1@panix3.panix.com> Message-ID: In article , Irmen de Jong wrote: >Aahz wrote: >> >> The problem is that the DCE/OSF GUID standard specifies using the MAC >> address of the network card as part of a GUID. There isn't a portable >> way to get that, unfortunately. > >I've crafted my own Guid function, and it is used heavily in Pyro >(pyro.sourceforge.net). It uses the machine's IP address instead of >the MAC address, and adds the Pid and some other stuff (timestamp, >random number). > >I don't know the DCE standard, but I do think that my routine is >fairly "safe", so to speak. At least it is portable across all Python >implementations, but the machine needs to have an IP address. A >physical MAC address is not requiered, so it should work nicely on >modem-only machines. Nice try. (That's partly serious, partly sarcasm.) It probably works for limited applications, but it's definitely not a guaranteed GUID. One of the big problems with your method is that the widespread adoption of NAT combined with excessive use of "private" IP addresses means that there's a lot of IP address duplication out there. Perhaps once IPv6 becomes the global standard, your method will be sufficient. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 9 days and counting From ungrzr2 at ubatxbat.pbz Fri Dec 14 03:42:46 2001 From: ungrzr2 at ubatxbat.pbz ({-- Rot13 - Hateme) Date: 14 Dec 2001 08:42:46 GMT Subject: Wrap C function which takes variable lengthed parameters? References: <6p5j1u0oag2ofkam8o7fig5dvkfc2392hk@4ax.com> <3C19990E.BE0F3FA@alcyone.com> <3C19AC0B.7ABD04DF@xs4all.nl> <1gbj1u8pm1t63ao6bjq98jlh66glf78fnu@4ax.com> Message-ID: Courageous wrote in news:1gbj1u8pm1t63ao6bjq98jlh66glf78fnu at 4ax.com: > Speaking of the problem, it might help the O.P. to post some more > details of the larger problem to see if there is an additional way > of achieving what is desired. He might also consider posting to > comp.lang.c and not posting anything to do with Python. Python > neither helps nor hinders, it's just its own layer in C. > thank for the helps. I want to wrap the following functions where the variable length arguements are 'char* label, XPIONTER *value' pairs which can be get/set with the calls. The argument list is NULL terminated. =============================================== char *IMGetIMValues(XIMS ims,...) char *IMSetIMValues(XIMS ims,...) ims specifies the input method service. ... specifies the variable length argument list to set IMValues. IMSetIMValues registers one or more IMValues, which are specified by a variable length argument list programming interface, with the XIMS structure. Note that IMOpenIM is also used to set all IMValues, and some IMValues must be set when IMOpenIM is called. IMSetIMValues returns NULL if it succeeds to set all the IMValues, otherwise, it returns the name of the first argument whose value could not be registered. ============================================= I was thinking to pass a dictionary to the wrapper function and the wrapper function will call IMSetIMValues() accordingly. Since I cannot construct a va_list at the runtime, I don't know how to call the IMSetIMValues(). From jorjun at mac.com Sat Dec 15 06:49:17 2001 From: jorjun at mac.com (jorjun) Date: Sat, 15 Dec 2001 11:49:17 +0000 (UTC) Subject: Games Made w/ Python References: <9v9gss$5hr$1@nntp9.atl.mindspring.net> <3C18F716.5010803@shinners.org> Message-ID: <3C1B38A7.5020806@mac.com> Is Mac OS X support possible? Pete Shinners wrote: >> Is Python an appropriate language for game programming? > > > it's awesome for game programming. you can check out my pygame package > at http://www.pygame.org. it uses the SDL library, so your game will run > on just about any platform. there's also a projects page so you can see > what other folks have been up to for creating python games. > http://www.pygame.org/projects > From danyelf at acm.org Sun Dec 9 17:38:36 2001 From: danyelf at acm.org (Danyel Fisher) Date: Sun, 9 Dec 2001 14:38:36 -0800 Subject: join vs instances References: Message-ID: <9v0p5b$qf5$1@news.service.uci.edu> > I'd be curious to know when this (.data vs. builtin) matters. You'll > either be writing code in the scope in which the UserString was > instianted (which means, you'll know when to use .data and when not > to), or perhaps, writing a function which requires a string arg, in > which case you still don't have to care. You just call that func with > foo.data if the string arg is a UserString. But Robin could be calling a function which takes an argument, and carries it around. Because UserString supports things like '+', there's reason to let it slip: def process1( arg ): # works return arg + "truth" def process2( arg ): # breaks return ''.join( [arg, "truth" ] a[1] = 'Foo' a[2] = UserString( 'bar' ) z1 = map( process1, a ) z2 = map( process2, a ) > Of course it's expected that you can't get away with simply referring to > the instance directly and expecting a string to pop out, but can you > give an example of a gotcha with a UserString vs. builtin (that is to say, > a scenario where you the difference between the two will make it > impossible for you to write code that won't break)? It wouldn't be impossible to tell, but it would be annoying to have to test. Danyel From Mitch.Chapman at bioreason.com Thu Dec 6 15:30:43 2001 From: Mitch.Chapman at bioreason.com (Mitch Chapman) Date: Thu, 06 Dec 2001 13:30:43 -0700 Subject: Calling a generator multiple times References: Message-ID: <3C0FD573.B1EB891E@bioreason.com> Bruce Eckel wrote: > > I'm trying to create a clever way to call a generator multiple > times, but the only thing I've been able to come up with is: > > import random > rgen = random.Random() > def itemGenerator(dummy): > return rgen.choice(['one', 'two', 'three', 'four']) > > print map(itemGenerator, [None]* 25) > > This works, but it requires the 'dummy' argument which seems > inelegant. I'll bet someone has a better idea... If you're using a recent Python release (>= 2.1?) you could use list comprehensions: def itemGenerator(): return rgen.choice(['one', 'two', 'three', 'four']) print [itemGenerator() for i in range(25)] -- Mitch Chapman Mitch.Chapman at bioreason.com From jpt.d at rogers.com Sun Dec 30 22:24:49 2001 From: jpt.d at rogers.com (Jeffrey Drake) Date: Mon, 31 Dec 2001 03:24:49 GMT Subject: Is learning Python "extraordinary"? References: <3C2E5706.5880983E@engcorp.com> <3C2EAD4D.77564075@engcorp.com> Message-ID: <3c2fd9a9.27704196@nntp> When I was done highschool I knew something like 15 to 20 languages (this includes markup languages) with at least a passing. There were very few people around me that knew an more than 2 (from the programming courses). In college I didn't learn much new except for java in the first year. Mostly the teachers that were teaching things I already knew even got some aspects of it wrong. Unusual is the right word. Regards, jptd On Sat, 29 Dec 2001 22:02:57 -0800, Sheila King wrote: >On Sun, 30 Dec 2001 00:59:41 -0500, Peter Hansen wrote >in comp.lang.python in article <3C2EAD4D.77564075 at engcorp.com>: > >> It is still my opinion that a bright person who has learned >> several computer languages can learn Python enough to start >> working on non-trivial tasks with not much more than a week >> of learning, but that opinion is based solely on observation >> of a dozen perhaps quite bright people doing just that. > >I agree with the above assessment. Still, it is unusual, in the least to >find high school students that know 3+ programming languages. (Well, maybe >not in the heart of the Silicon Valley.) > >Anyhow, I think Jesse has probably decided by now, that it is certainly >worth mentioning in his essay. ;) > >-- >Sheila King >http://www.thinkspot.net/sheila/ >http://www.k12groups.org/ > From hanche at math.ntnu.no Fri Dec 7 17:30:35 2001 From: hanche at math.ntnu.no (Harald Hanche-Olsen) Date: 07 Dec 2001 23:30:35 +0100 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C100BB2.6446E896@cosc.canterbury.ac.nz> <7da8d8f8.0112070206.49e1bef4@posting.google.com> Message-ID: + s.keim at laposte.net (sebastien): | KS>It might be useful to express the time in TAI rather than GMT, | KS>although that distinction ceases to be meaningful outside of modern | KS>times. | Could you give me more explanations? I suppose that what is called | GMT in computer litteracy is in fact TAI. No. TAI is French for International Atomic Time, which is a simple, linear time scale based on the best efforts of the time keepers of various countries to build, maintain, operate and synchronise the best clocks they can manage to make. The spinning Earth is a very poor clock in comparison, so one also keeps a clock called UTC (French for Coordinated Universal Time) which always differs from TAI by a whole number of seconds. When the "rotating Earth clock" (UT1, really, but let's not get technical here) becomes something like 3/4 of a second off from UTC, a leap second is added to UTC. UTC is the time that is often called GMT, though the latter name is strictly speaking not correct anymore. Before atomic clocks, BTW, there was ephemeris time, which played the same role as TAI does today. It was based on astronomical observations of the moon and planets, whose orbits are predictable to a far greater extent than the rotational state of our planet. There are some problems with using a seconds count as the basis for calendrical calculations. A big one is that nobody knows when leap seconds will happen in the future. So you might schedule an event for the time 2038-01-19 03:14:08 UTC, but you cannot know how many seconds that is from now, or (equivalently, given that you know when "now" is) what it will be in TAI. You might choose to go the way of most unixes do and pretend that leap seconds don't exist, but that is of course problematic in case you do care about them. I think that keeping calendrical calculations and time issues strictly separate is a good idea myself. I would even go so far as to suggest a completely separate module just for dates and calendars. The advantage is that you can deal with that without even getting into the mess of leap seconds, time zones and daylight saving time. Leave that for another module. An advantage of this scheme is that a date module has at least a chance of becoming simple enough to become a part of python. I will make no such assertions about time. doing-one-can-of-worms-at-a-time-ly y'rs, -- * Harald Hanche-Olsen - Yes it works in practice - but does it work in theory? From loewis at informatik.hu-berlin.de Fri Dec 21 17:26:13 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 21 Dec 2001 23:26:13 +0100 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> <7xlmfxvbx7.fsf@ruckus.brouhaha.com> <3dbsgt7f0e.fsf@ute.mems-exchange.org> <7xheqkr05q.fsf@ruckus.brouhaha.com> Message-ID: Paul Rubin writes: > It's a bug if something is gratuitously, unnecessarily incompatible, > like "rand" disappearing. What was the reason for that? rand didn't disappear. It is in lib-old. Furthermore, random is available since Python 1.0.2 (1994), rand was moved to lib-old in 1.5.1 (1998); I'd say four years are enough time to migrate. Plus, if you don't want to migrate, you can either add lib-old to sys.path, or you can use an older Python version (although it is hard these days to get a pre-built Python 1.4 binary). There is a good reason to deprecate rand, and all other modules with duplicate functionality: it is confusing to new users if they see different ways to achieve the same thing. You have to judge the advantage to new users (of having a single interface) to the needs of older users (of not breaking their scripts). Regards, Martin From ajs at ix.netcom.com Sun Dec 2 15:37:46 2001 From: ajs at ix.netcom.com (Arthur Siegel) Date: Sun, 2 Dec 2001 15:37:46 -0500 Subject: More assignment/copy novice confusion Message-ID: <000f01c17b71$37532000$77213841@ArtSiegel> Laurent Pointal >"Arthur Siegel" wrote in >news:mailman.1007306883.27068.python-list at p...: >> Given a class: >> >>>>> class p: >> def __init__(self,a): >> self.a=a > But - > >>>> m=p([1,2,3]) >>>> r=p([]) >Here r and m reference two **different** objects of class p, with their own >attributes. >Try "r is m", and it will reply 0. >>>> r.a=m.a >Here m.a and r.a, which are attributes of different objects, reference the >same list. >>>> m.a=[1,2,4] >And now m.a reference another list. So indeed if I do m.a[2]=4 instead ofm.a =[1,2,4] then>>>> m.a > [1, 2, 4] >>>> r.a > [1, 2, 4]All of this is far from obvious, but of course doesin the end make perfect sense.Art -------------- next part -------------- An HTML attachment was scrubbed... URL: From karthik_guru at rediffmail.com Mon Dec 31 11:52:16 2001 From: karthik_guru at rediffmail.com (karthik_tamu) Date: Mon, 31 Dec 2001 16:52:16 -0000 Subject: does python support overloaded methods?(py newbie) Message-ID: wanted to confirm this. Overloading method names(with parameters belonging to different types) is possible in python??. from what i can see it should not be possible. so if i have some currency conversion code like this: class Currency: pass class Dollar(Currency): pass class Euro(Currency): pass class CalculateRupeeEquivalent: def calculate(currency): //type checking of curency here? //i don't like it with lots of ifs and else. so alternative is... class CalculateRupeeEquivalentForDollar(CalculateRupeeEquivalent): def calculate(currency): //return equivalent class CalculateRupeeEquivalentForEuro(CalculateRupeeEquivalent): def calculate(currency): //return equivalent if __name__ == '__main__': calc = a.GetCalculator() curr = a.GetCurrency() calc.calculate(curr) ?? i read a nice article today http://www.cyberdyne-object-sys.com/oofaq2/DynamicDispatch.htm does python support dynamic dispatch then? thanks, karthik. From gh_pythonlist at gmx.de Mon Dec 3 21:51:53 2001 From: gh_pythonlist at gmx.de (Gerhard =?unknown-8bit?Q?H=E4ring?=) Date: Tue, 4 Dec 2001 03:51:53 +0100 Subject: A pretty dumb newbie question In-Reply-To: <20011203212412.12737.00000727@mb-cs.aol.com> References: <20011203212412.12737.00000727@mb-cs.aol.com> Message-ID: <20011204025153.GA6734@lilith.hqd-internal> On Tue, Dec 04, 2001 at 02:24:12AM +0000, N64fan2017 wrote: > How would you calculate square root? I've tried > x**1/2 > Which doesn't work As already proposed, you can use the sqrt function from the math module. The real problem you're experiencing is that almost all programming languages won't give you a floating point number from the expression 1/2 but an integer instead. You'll get a floating point number when at least one of the numbers involved is a floating point number, so: 1.0/2 1/2.0 1.0/2.0 will all return the floating point number 0.5. Beware that on a computer, some floating point numbers aren't accurate. So, generally, don't compare floating point numbers with ==. The Python FAQ has an entry on floating point numbers. One other issue you touched is operator precendence. This is another reason why x**1/2 won't work as expected: the "**" operator has higher precendence than the "/" operator. So you'd have to use brackets, like in 2**(1.0/2). Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From maxm at mxm.dk Tue Dec 25 07:21:24 2001 From: maxm at mxm.dk (maxm) Date: Tue, 25 Dec 2001 13:21:24 +0100 Subject: vi or emacs for editing Python on Linux? References: Message-ID: Thank you everyone. Thats one of the most civilized discussions I have ever seen of editors :-) It didn't make me all certains as to what I should do. But it gave me a rather balanced view I think. Being a person that practically lives in my editor all day I think I will give Emacs a go, and then learn enough Wim to get by with. As one of you said there are some people that starts their editor in the morning and then close it when they go home. I am more like "Start it at a new job, and stop it when I quit" So probably Emacs is more my cup of tea. Also I like tools with a lot of depht, and don't mind using some time to learn them. I do use Vim occasionally for the odd sysadmin work, but I spend far more time editing multiple source programs so startup time is not really that important. But again thanks a lot for all of the well-argumented and thoughtout posts. I will give it a go and see how it pans out. warm regards Max M. And merry Newtonmass From mcherm at destiny.com Mon Dec 17 11:11:10 2001 From: mcherm at destiny.com (Michael Chermside) Date: Mon, 17 Dec 2001 11:11:10 -0500 Subject: Preserving program structure Message-ID: <3C1E191E.8060102@destiny.com> > A problem that just about everything except SciTE (Scintilla) > has is that it may color code the program, but it only prints in > black and white (if it will print at all). Check out my favorite, CodeWright (windows only) found at http://www.starbase.com -- Michael Chermside From daves_spam_dodging_account at yahoo.com Wed Dec 26 11:14:58 2001 From: daves_spam_dodging_account at yahoo.com (David Brady) Date: Wed, 26 Dec 2001 08:14:58 -0800 (PST) Subject: Range of characters? Message-ID: <20011226161458.10544.qmail@web21108.mail.yahoo.com> Hello, I want to iterate over a range of characters, and though I have a solution, it "feels wrong"... I think (I hope, anyway) that I'm getting along well enough with Python that I can tell when I've strayed from the Pythonic Way. What's the best way to do this? Suppose, for example, that we want to generate every possible name for Python and it's clones, Aython, Bython, Cython, etc. Here is the code I would write to do it: for c in range(ord('A'), ord('Z')+1): print "%sython" % chr(c) It seems to me that flipping back and forth between ord and chr, and especially the ord('Z')+1 have a hackish smell to them. Is there a better way? Thank you, -dB ===== David Brady daves_spam_dodging_account at yahoo.com I'm feeling very surreal today... or *AM* I? __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com From shulmang at colorado.edu Thu Dec 27 18:21:06 2001 From: shulmang at colorado.edu (Garett Shulman) Date: Thu, 27 Dec 2001 23:21:06 GMT Subject: module path Message-ID: I would like to store my modules and scripts in a folder other than the python folder. Does anyone have any suggestions as to what I need to do in order to be able to import the scipts in the interpreter? Is there a path that the interpreter searches which I could modify? From gh_pythonlist at gmx.de Fri Dec 7 13:23:29 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Fri, 7 Dec 2001 19:23:29 +0100 Subject: SSL Sockets in Windows In-Reply-To: References: Message-ID: <20011207182328.GA1014@lilith.hqd-internal> Le 07/12/01 ? 11:49, Michael Abbott ?crivit: > I'm running Python 2.1 on Windows NT, and I'd like to use socket SSL. I > see that socket.py and socketmodule.c both contain support for SSL sockets, > but this does not appear to be compiled into my distribution. The closest thing I know of is _socket.pyd compiled with SSL support for Python 2.0, from Robin Dunn's page: http://alldunn.com/python/ Useful only if you can downgrade to Python 2.0. Beware that SSL on Python 2.1 has some nasty bugs, especially on Windows. The good news is that all known problems should be fixed in Python 2.2. Alternatively: m2crypto (http://www.post1.com/home/ngps/m2/) has a win32 build for Python 2.1. I haven't tried it on win32, though. But generally, it should be a pretty mature Python/SSL package. > Is this a problem with my distribution of Python, or is there some > fundamental reason why SSL support isn't actually enabled? Perhaps political reasons, or lazyness, or lack of stability. Dunno. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From keyton at weissinger.org Thu Dec 27 01:09:19 2001 From: keyton at weissinger.org (A. Keyton Weissinger) Date: Thu, 27 Dec 2001 01:09:19 -0500 Subject: Python Popularity: Questions and Comments In-Reply-To: <3C2A9D33.67FEC261@earthlink.net> Message-ID: Interesting. I thought I was the only one considering these very same issues. A wee bit of background. I am a manager/developer for a group of J2EE coders working with WebLogic/Oracle. I have espoused Python for some time and have been recently introducing several scripts here and there to help us get more done faster. These Python scripts have all been of the "infrastructure" variety and have not been production-keep-the-lights-on-code. OK. Here is the question I keep asking myself: If Python is as cool/easy/powerful/etc as I think it is (and scream from the rooftops at any opportunity), why do we not see it taking hold in a commercial sense? Yes, I know. Many of you will tell me all about either (1) that so-and-so installer (specifically RedHat) is all about Python; and that (2) XYZ company uses Python you think, but doesn't want to share their commercial advantage or some such. And I will say, "Um yes. But you're missing my point." If it is as "X" as we all say/know/feel-in-our-hearts that it is, why is there so very little real commercial appeal? Why are there not industrial strength application servers being based on Python? Why are there not big public companies trying to sell products that improve upon Python in all its Python-ness? Why is company X not moving all their dreck VB/COBOL/PL/1/etc code onto Python instead of investing the huge amount of money/time/resources into moving it to Java? Is it perhaps that Python will never be up to that challenge? Does Python not stack up against Java? Or have we open source dudes and dudettes simply dropped the ball and have not yelled loudly enough? Unknown. OK. At this point, I will get probably 3-10 messages public or private saying that Python does not attempt to answer the same niche. That's crap. We all say how powerful it is. Heck. We all know how powerful it is. We all know that if we want to build a little server tester script we pull out Python just as quickly as we do when we need to think about doing the Next Big App (TM). The only difference is that only the server tester script gets written and kept. The Python-based Next Big App gets thrown away or is never written at all. Why should I have to settle on using Python only for prototypes? Or scripts? Or pseudo-code-to-be-converted-into-Java? Python needs to be made (and proclaimed) "real." Otherwise, instead of "batteries included" we all need to start saying "it's an easier scripting language than Perl" because that's all it will ever be. Java started with applets. Some dismissed it as cute at best. It is now one of the very few non-M$ players on the commercial block that presents a modern approach in business system development. I've not perused Ruby. Frankly I've mentally set it in the same bin as CURL (yes, I know they are completely different -- the bin has the label, "Interesting."). But nothing I've seen wows me. Nothing I've seen has shown me that it will help me get a real live 1000+ concurrent user business system off the ground. Nothing. And let's face it folks. That is what the overwhelming majority of the industry decision makers are going to need to see to get them off VB or Java or whatever. As for ActiveState's move to lay off Mark Hammond, I have three things to say: 1) Shame on ActiveState. Stupid move. I will take my $0 elsewhere, thank you very much. 2) Shame on us. Why haven't we as the Python community asked Mark to make his work part of SourceForge, rolled up our sleeves and worked on it? Has no one ever heard of the "hit by a bus problem?" Yikes. 3) Folks may loathe M$ or not, but without someone like ActiveState pushing support for Python, Python will get little play in that very large arena of M$-specific development. Have you met the "average professional developer" lately? He/She is a Visual Basic "guru" of 3-5 (whopping) years experience. He calls open source "share ware" and states emphatically the following: "Why would I mess with THAT stuff? None of those open source cowboys code to 'Microsoft' standards." Does that make your blood boil? Mine too. But guess what? That guy will be there in a few more years. He will have been promoted because he got (an admittedly crappy) product out the door. And then he will spread VB across the world. Oh wait. That's already happened. Python will either grow into a real live alternative to industrial strength languages like Java or it will continue to be an esoteric language that I hesitate before putting on my resume. Damn it. I don't know about you guys, but that pisses me off. Python is cool -- WAY cooler/more-useful/powerful/etc than VB. Let's take it out for a real drive in the open ocean. If it's not ready for that, let's make it ready for that. Do I have the know-how to dive into the Python source code and begin to address the real serious threading-in-real-world-situations, optimizations, and memory consumption issues? No. But I am willing to learn... I will always use Python where it makes sense to use. I just wish it made sense to use it in so many other places... And I think it can....someday. Keyton P.S. Please limit your flames to either tell me (1) this will never happen and here's why or (2) how I can help make it happen.... > -----Original Message----- > From: python-list-admin at python.org > [mailto:python-list-admin at python.org]On Behalf Of Ron Stephens > Sent: Wednesday, December 26, 2001 10:59 PM > To: python-list at python.org > Subject: Python Popularity: Questions and Comments > > > OK, so its between the holidays and the newsgroup is quiet, so maybe I > dare waste a little bandwidth with that most useless (but fun) > commodity: gossip. > > How is Python doing popularity wise? After such a meteoric growth > thought the nineties, and a spectacular climax in 2000 and early 2001, > is Python leveling out, going dot.bust, or still not yet at the knee of > the software world's most spectacular growth curve? > > I'd be interested in some comments and observations and opinions from > others. Meanwhile, here are a few of my own: > > Python, while fabulously successful, is at an interesting point in its > growth curve. It will be difficult to maintain the extremely high rate > of growth exhibited so far; new contenders are possible problems; and > the recessionary economy could also negatively impact Python's growth. > > 1. Ruby is an especially interesting competitor to Python. I have been > monitoring the Ruby newsgroup, and it shows incredible growth and > vitality. Furthermore, Ruby is aimed right at the heart of Python's > niche. > > If we view Microsoft's Visual Studio, especially Visual Studio.net's C# > and VB, as the official 800 lb. gorilla of software development; and if > we view Java as the 400 lb. gorilla pretender to the throne; and if we > view Borland's Delphi and Kylix as no more than a smart leader of a > chimp; then everything else is the pack of open source chimps. > > The open source world is still led by PERL, but PERL is truly more of a > text processing, web CGI, scripting specialist; not so much of a direct > threat to Python. PHP is a server side scripting specialist. Even > JavaScript is strong in its narrow niche of client side web scripting. > Lisp and Scheme dominate thier academic world. But Python aims to be > much more than these; Python aims to be a powerful general purpose > programming language, in addition to being a very easy to learn and easy > to use scripting language. And who can say that Python does not succeed > very well in all of the above? > > But Ruby is also a more general purpose, object oriented, relatively > easy to read, language. Ruby folks include those who like its more > Perl-like syntax, but Ruby's core converts believe that its pure, > absolute object oriented nature exceeds those of Python and make it more > worthy to long term success. They seem to see Ruby as a more modern, > up-to-date version of Python. They see Python as a compromise between > object oriented and procedural programming. > > Be that as it may, I suspect that much of Ruby's momentum is simply due > to its newness; all things new are seen as sexy in this world of ours. > But nonetheless, Ruby has the following going for it. > > a. Usage on the Ruby newsgroup is growing much faster than on > comp.lang.python in the last year that I have been observing it. A year > ago, Python got typically three times as many posts per day as Ruby. > Now, its more like a 4:3 ratio, with Python getting say, 4000 per month, > and Ruby 3000. At this rate, Ruby could pass Python is afew months, by > this measure! (Rest assured, Ptyhonis fdoing much better if mesured by > Sourceforge projects, about 1300 to 80). By the way, Just van Rossum's > http://starship.python.net/~just/comp.lang.python/ graph of Python > newsgroup coverage seems to show a slight decline from over 6000 per > month in late-middle 2001 to the current 3500 or so I see on here. Mr. > van Rossum said he may not be able to update these any more due to some > Yahoo change; anyway, am I interpreting these numbers and trends > accurately? Will the Python newsgroup usage turn upwards again? Does it > matter? > > b. Ruby is getting alot of favorable press, and new books are coming out > now. First, Pickaxe , now, Matz' own Ruby in a Nutshell and several > others soon to be or already here. > > c. Ruby actually seems to be a nice language to me. Its object oriented > features seem well thought out and yet its still easy to comprehend. I > will never leave Python behind, but will others? I see quite a few > former Pythonistas posting glowing reviews on comp.lang.ruby, but not as > many as I see former Perl aficionados. > > d. Ruby has some smart and aggressive coders doing libraries, > extensions, Java version etc. etc. etc., tehy are agressive and > motivated; tehy think they will see world domination ;-))) > > Ruby also has some problems I see: > > a. Its windows version seems to have lots of problems. Specifically, > threading doesn't work well at all on Windows, but that's not the only > problem. Ruby on Windows is slow and somewhat buggy; seems to need a > re-write and Matz is engaged in an extensive re-write. Who knows how > successful? > > b. Ruby has no where near the libraries Python has, since Ruby is so > much newer. But itime never stands still.... > > What so you all think of Ruby, and its impact on Python? > > 2. The economy is hurting Python's open source development model. It was > bad enough when the core Python coders were jerked around by Be Open; > now I am very sad to hear of Mark Hammond's not being with ActiveState > anymore? Without Mark Hommond's win32 work, Python would be a mere shell > of its current self. A person who has given so much to the Python > community as Mr. Hammond, deserves much better. How can an open source > community like Python help reward its hard working heroes like Mr. > Hammond? Will Guido and his team be next to suffer yet again? If > ActiveState can't support Python development, much less a true > Python.Net, who can? Will Zope survive financially? We should care. Why > doesn't someone form a company to market a first class Zope based ISP > service? The Zope folks saids they need such a thing to help promote > Zope. If it could not be profitable, is Python and all open source > development a mere flash in the pan? Without Mark Hammond, Python > windows based development would fall into the sloughs of despond just > like Ruby? > > I hope not. > > 3. Third, Python faces the laws of large numbers. It is exceedingly hard > to continue a growth spurt past a certain point. Maybe were at that > point, maybe not. But ask yourself this; Two years from now, will you > see more Python success stories, more growth, or a leveling out? Five > years from Now? > > Ten years from now, will Python still be Relevant? Oh, I know that > Python will still be being used, and the community will still exist, but > will it really be a thing that seems to Matter, like it does now. > > I like to Look on the brighter side of life, but I also like to win a > few Spanish Civil Wars. > > What do you guys think???? > > Ron Stephens > http://www.awaretek.com/plf.html Python City > > -- > http://mail.python.org/mailman/listinfo/python-list > > From marklists at mceahern.com Fri Dec 21 13:51:37 2001 From: marklists at mceahern.com (Mark McEahern) Date: Fri, 21 Dec 2001 10:51:37 -0800 Subject: getting strings from the shell commands In-Reply-To: <75968FA028EAD311B3530090279CF80C0B29FEE5@uswaumsx07medge.med.ge.com> Message-ID: > I want to do something in python LIKE > > os.system("./myscript") but how can i get the out put into a [list of] > strings try os.popen* f = os.popen(command) lines = f.readlines() print '\n'.join(lines) f.close() // mark From just at letterror.com Sat Dec 8 06:50:42 2001 From: just at letterror.com (Just van Rossum) Date: Sat, 08 Dec 2001 12:50:42 +0100 Subject: Calling a generator multiple times References: <0gn21usqeasqa1bp4sveh0vjagtmbmfpof@4ax.com> Message-ID: <3C11FE92.1218662@letterror.com> Oren Tirosh wrote: > > On Sat, Dec 08, 2001 at 12:30:25AM +0000, Courageous wrote: > > > > >A generator is a function or method that -- by virtue of using the yield > > >statement -- > > > > I understand how it works, intuitively. My objection is not that > > I don't understand it, but rather that a lone keyword appearing > > in the content of the method definition actually changes what is > > being defined. That's just plain wrong. > > I agree. It should be immediately apparent that a generator function is > not a regular instance of the 'function' type. [ ... ] "That's just plain wrong" "It should be immediately apparent that..." If it _was_ "plain wrong" it wouldn't be the way it is. I mentioned the archives of python-iterators list before, but I think the PEP is a better reference: http://python.sourceforge.net/peps/pep-0255.html Just From ykingma at accessforall.nl Thu Dec 20 13:43:30 2001 From: ykingma at accessforall.nl (Ype Kingma) Date: Thu, 20 Dec 2001 19:43:30 +0100 Subject: threading.py -> winthreading.c : Call for benchmark code References: Message-ID: <3C22314F.693A2C02@accessforall.nl> Jason, You might like this: http://www.bagley.org/~doug/shootout/bench/prodcons/ Have fun, Ype P.S. In jython I would recommend: http://g.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html Jason Orendorff wrote: > > Everyone, > > I am reimplementing parts of threading.py in non-portable > Win32-only C. Lock and RLock are already working. Tests show: > winthreading.Lock is about 25% faster than threading.Lock. > winthreading.RLock is about 26 times as fast as threading.Lock! > > But I'm not sure these numbers translate into real-world gains. > So: I'm looking for Python code that shows how these objects > (Lock, RLock, Condition, Semaphore, Event) are used in the wild. > > If you're interested in a 26x faster RLock, please send me > real-world Python code that could benefit. > > Thanks in advance, > Jason Orendorff > > [Technical note: I discovered something neat. Everything I do, > or check, or set, or increment in C code is protected by the global > interpreter lock. This eliminates a lot of the complexity of writing > good threading code, because I don't have to worry about doing > anything atomically! I can avoid functions like InterlockedIncrement() > and InterlockedExchange(). The resulting code is clearer and faster.] From tim at vegeta.ath.cx Thu Dec 27 14:07:17 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Thu, 27 Dec 2001 19:07:17 GMT Subject: age of new pythonistas [was: The Editor Poll results are in!] References: <60c49aa9.0112202148.7218555b@posting.google.com> Message-ID: Fran?ois Pinard graced us by uttering: > Even if I prefer Python to Perl, I would never even think that Perl > is not well designed. When I was using Perl, as a user (not as > a reader of books about it :-), I found that Perl allowed me to > quickly write my code, it was full of good ideas, and I felt the > language quite fulfilled its promises. > > On the other hand, Perl was probably not designed according to my > own tastes, and it is true that Python fits my tastes much better; > the gained comfort alone is the source of some proficiency. But > not sharing my tastes does not make something necessarily bad. And > besides, wandering around a bit with an opened mind allows someone > to improve its culture and to evolve his tastes. Thank you. I could not have said this better (or more diplomatically) myself, as I'm also an avid Perl hacker and tend to get defensive. Nor can I help my bias. Perl and Python both have very different personalities, but it's these differences that make them both equally valuable. Tim Hammerquist -- NOBODY EXPECTS THE SPANISH INQUISITION! From peter at engcorp.com Mon Dec 24 01:39:39 2001 From: peter at engcorp.com (Peter Hansen) Date: Mon, 24 Dec 2001 01:39:39 -0500 Subject: f(n=4) works; bug or feature? References: <3C26B3DA.4000102@erols.com> Message-ID: <3C26CDAB.D6F4058@engcorp.com> "Edward C. Jones" wrote: > > In Python 2.2, the following code prints a "4". > > def fun(n): > print n > > fun(n=4) > > Bug or feature? Or correct behavior? You are calling the method with a keyword argument as described in the Language Reference such as at http://www.python.org/doc/current/ref/calls.html . -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From claird at starbase.neosoft.com Thu Dec 27 21:30:42 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 27 Dec 2001 20:30:42 -0600 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: In article , RPM1 wrote: . . . >"full technical support" > >That's what gets thrown in my face whenever I mention Python. >(And I mention it a lot). The company I work for writes point >of sale software in C and VB, because "there's support" and >"customers won't pay for something made with freeware." > >I think if Python wants to get "bigger" or more acceptable, >it needs marketing. The guy with the bag of money needs >to say, "Oh yeah, Python, I've heard of that." Customers >ask us if we have a Java 'solution', they don't ask if we >have a Python 'solution'. That's got to change if Python >'wants' to grow more, (I don't know that it does). > > It seems to me, (with my limited experience), that the >most dedicated audience Python has is the scientific >community. I would start there. Get some big chemical, >pharmaceutical, or biological corporations to use Python, >(by catering to their needs), and then they will in turn >support the language when they see the wonderful end >product. Then people like me can say to my boss, "look >Dow, Johnson & Johnson, and ADM all use Python >heavily, so there's nothing to be afraid of." . . . Companies like Dow, J&J, and ADM *do* use Python. I'm rather grouchy on this subject. My experience is that organizations that start talk about "full technical support" are resistant to any factual content. It doesn't matter how much we demonstrate Python's technical superiority to them, nor how many times Python has proven itself capable/reli- able/efficient/...; it makes them uncomfortable, and no rational discussion affects their comfort. I say, "it's an optimized solution. Yes, it has Java segments." That's usually enough for the people who just want buzzwords. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From jamescalthoff at yahoo.com Sun Dec 16 21:16:19 2001 From: jamescalthoff at yahoo.com (James Althoff) Date: Sun, 16 Dec 2001 18:16:19 -0800 (PST) Subject: PEP 276 and future iteration PEPs Message-ID: <20011217021619.14178.qmail@web20002.mail.yahoo.com> Thanks for your feedback. I agree that the explicit index variable has some nice advantages. I'll try to get some more PEP work going in early January (I'm on vacation for a little while. :-). Jim =================================== Alexis Layton wrote: I also am in favor of the simple proposal submitted in PEP 276. For future iteration PEPs, I think I would be more comfortable with explicit specification of the index variable(s), as in for i in 0 <= i < 5 as opposed to infering the loop variable as in for 0 <= i < 5 But I would rather we had a broader class of integer generator syntax such as the much malinged [0 ... 5], especially if it can properly describe non-terminating generators. (or is that iterators? It's not really an iterator until you put it in a loop...). __________________________________________________ Do You Yahoo!? Check out Yahoo! Shopping and Yahoo! Auctions for all of your unique holiday gifts! Buy at http://shopping.yahoo.com or bid at http://auctions.yahoo.com From LLoeffler at home.com Sun Dec 2 15:40:22 2001 From: LLoeffler at home.com (Luke) Date: Sun, 02 Dec 2001 14:40:22 -0600 Subject: intercepting method call References: Message-ID: <3C0A91B6.2020807@home.com> check this out http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/91192 From ulf.magnusson at ubm-computing.com Sun Dec 30 03:21:29 2001 From: ulf.magnusson at ubm-computing.com (Ulf Magnusson) Date: Sun, 30 Dec 2001 08:21:29 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <4VlX7.6657$l93.1694996@newsb.telia.net> <3C2E6D60.81031B00@earthlink.net> Message-ID: <8$--$$_----____$-$@news.noc.cabal.int> "Ron Stephens" wrote > You are probably aware of the Stackless Python project, I don't know off hand > where its web site is, and it's not a compiler I don't think, but a different > implementation of a Python interpreter that is a little faster in program > execution (a lot faster ??). I checked it out, they are located at http://www.stackless.com/ but the project seems a little out of date, according to their homepage the last update occured 2001-05-14 and the last supported version is Python 2.0 Regarding the speed, they clain on their homepage: "8-10% faster executable on Win32" > I know it's not what you are after exactly, but I guess if you want speed of > execution, it could be of interest. Thanks, all information is appreciated! But I guess I am looking for a "real" compiler. > I bet someday someone or some group creates an "optimized" compiler for Python, > but I hear it would be an enormously difficult and complex job. My guess is > that, if Python becomes popular *enough*, then someone will find the difficulty > worth tackling. Yes, I certainly hope so. > On another related tangent, I hope someday someone makes a .Net implementation > of Python. Mark Hammond, who was I think involved in ActiveState's prototype > effort to do just that, has stated how difficult a job it is. But again, if > Python becomes popular enough then someone may do it. > > One last aside, I keep seeing news about Mono, there was a nice > interview/article in, I think Linux Journal recently by Miguel de Icaza (sp?) > and it sounds like they are making real progress. I wonder, would a Python.Mono > be just as difficult as a Python.net (I guess it would). Would a Python.mono and > a Python.net be do-able as a joint project? > > Wouldn't a Python.Mono be nice ;-)))) I guess you are referring to: http://www.go-mono.com/rationale.html otherwise, do educate me... A .NET python will truly be an interesting product, apparently you can download a Visual Python beta (I think) for the VS .NET BETA 2 environment at ActiveState. /U. Magnusson ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Ulf Magnusson" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:50:42 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774316 27193 211.57.49.2 (31 Dec 2001 04:51:56 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:51:56 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From mwh at python.net Sat Dec 29 10:18:29 2001 From: mwh at python.net (Michael Hudson) Date: Sat, 29 Dec 2001 15:18:29 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <32c382ad.0112272324.4c78689b@posting.google.com> <3C2C88A6.9D13A3D6@earthlink.net> <3C2CD7EB.F90E6C9@earthlink.net> Message-ID: <8$--$$_----___-$-$@news.noc.cabal.int> Hans Nowak writes: > Yes, I've been checking out some old binaries, and strip was available > as early as 1.4. (Don't know about any older versions.) It's present in revision 1.1 in CVS from 1990; tags suggest this was before the release of version 0.9.8; I'd be surpsried to find it wasn't in the original version posted to alt.sources. Cheers, M. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Michael Hudson Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:57:54 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774736 27193 211.57.49.2 (31 Dec 2001 04:58:56 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:58:56 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jeff at ccvcorp.com Thu Dec 27 14:11:09 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Thu, 27 Dec 2001 11:11:09 -0800 Subject: A new message board is up References: <40dbad98.0112262232.1868734e@posting.google.com> Message-ID: <3C2B724D.E4D31E24@ccvcorp.com> Andrew Dalke wrote: > Andrew Nguyen wrote: > >A new message board (that doesn't have the Usenet delay) is up! > > >Also, usenet SUXXOR (sucks) because itttt issss soooo > >cunfuseeeng... Why not switch to an EZBoard? Why have maling > >lists that are too confusing? I for one say that we create a > > NEW forum! > > But it does require a login, registration, including address, > income(!), and marital status(!!) information, and a 300 line > license agreement. Since it's a web based system there's also > a lack of good search system, no way to add your own filters, > no support for off-line reading, killing a thread, archive > messages, or all those other features Usenet readers have > accumulated over time. I don't think it can scale up to > several hundred messages a day, like c.l.py has. I agree, Andrew. As a frequent contributor to another EZBoard group (focused on a local community), I can say that for certain things, the features that EZBoard has are great. For our local community group, I wouldn't want to use Usenet. But, by the same token, there are things for which Usenet is better. (And how on earth is Usenet confusing? Maybe it's just a matter of using a crappy newsreader--Outlook Express, perhaps?) I wouldn't want to read this Python group on EZBoard. One should match the tool to the situation, and however pretty and shiny a tool EZBoard might be, its features do not make it the most suited for an open programming-language forum. EZBoard *can* handle several hundred messages daily, but it can get to be a bit slow at times, especially since it tends to include a moderate amount of graphics. Also, EZboard is commercial--it's supported by popup ads. A community can buy freedom from ads, at a rate that's determined by the traffic on that board--I'd estimate several thousand dollars per year, at the traffic rate of c.l.py. I don't want to see ads while reading c.l.py, nor do I think it's reasonable to expect members to donate money. To be honest, I don't think it's reasonable to require "membership" (however easily gained) to post in a programming forum. For these reasons and others (like sheer disgust at the thought of anyone using "l33t sp34k" in anything other than total parody), I won't be participating in this Python EZBoard. Jeff Shannon Technician/Programmer Credit International From gmcm at hypernet.com Thu Dec 27 08:33:23 2001 From: gmcm at hypernet.com (Gordon McMillan) Date: 27 Dec 2001 13:33:23 GMT Subject: REPOST: Re: Book "python programming patterns". anybody read this?? References: Message-ID: <7$--$$_----_%-%_$$@news.noc.cabal.int> Peter Milliken wrote: > No Gordon, that's a ridiculous assumption! > > Who said the code was bad? Not I! >From the first reply to my first post: >> it's probably not very good code. And you (apparently) agreed. > Your original email implied that you > had to put some amount of study into understanding the examples - there > was an implication that the examples where not straight forward and > therefore required some considerable time and effort on your part to > understand what was going on. Yes. > Nobody has tried to equate this with "bad code", just bad coding > practice (in our opinion - well, Roy's and mine :-)) - a very different > thing. I fail to discern the distinction, particularly as stated above. > Perhaps if you take objection to our comments you should perhaps > clarify and quantify your comments on just how much effort was required > to understand the examples? and why? i.e. if the book is more > "algorithmic" in nature then perhaps you cannot get away from examples > that do take some considerable study effort - if this is the case then > perhaps you should provide that clarification/caveat on your comment. Already did so. From my second post: >> The hardest thing to follow was his (highly efficient) >> implementation of an algorithm for computing whether one set >> is a subset of another. So it's not for people who don't >> like low-level stuff. > Otherwise I'll have to stick with my decision (unless I stood in the > book store and read the book! :-)). I have no objection to your decision. All three posts I've made have said that the book is not for everyone. I just don't want you (plural) to chase off people who could get something from the book. Save your money. Just don't slur the book based on an unfounded inference. -- Gordon http://www.mcmillan-inc.com/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Gordon McMillan Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:45:33 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775791 27193 211.57.49.2 (31 Dec 2001 05:16:31 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:16:31 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From rnd at onego.ru Mon Dec 3 01:16:30 2001 From: rnd at onego.ru (Roman Suzi) Date: Mon, 3 Dec 2001 09:16:30 +0300 (MSK) Subject: =?KOI8-R?B?UmU6IPrB0NXTyyB3eFB5dGhvbiDQz8QgTGludXg=?= In-Reply-To: <200112030242.EAA90559@service.megastyle.com> Message-ID: On Mon, 3 Dec 2001, Oleg Ponomarev wrote: > VB>>> ??????????? ? ???? ???? ????? ?????? ????? ??????? ?????? ?????? ???, > VB>>> ??????? ?????? ?? ??? ?????? ;) > > OP>> ???????? ????????? ?? rpm, ????????? ... > > VB> ?? ?????? ?????? > > VB> ws:~$ rpm -qa | grep wx > VB> wxGTK-devel-2.3.1-1 > VB> wxGTK-2.3.1-1 > VB> wxGTK-gl-2.3.1-1 > VB> wxPython-2.3.1-1 > > ???????, ???????? ??? ?? rpm - ?????? ???????? ??? ?????? :) > ?? ??? ?????? ????? ???????? ....(????? ??????????? ????)..... - ??? ??????? > ??????? ???? ???? ?? ????? wxPython ??? ??????? ????-???? ???????? ??????? > ???? ?????? ????????: > $ python demo.py > Segmentation fault > $ > ? ??? :((( > ? ??? ???? ?????? ? ???????? ?????? Python? ldd /usr/bin/python ldd /usr/lib/python2.1/lib-dynload/....so Sincerely yours, Roman A.Suzi -- - Petrozavodsk - Karelia - Russia - mailto:rnd at onego.ru - From wurmy at earthlink.net Sat Dec 29 03:26:20 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Sat, 29 Dec 2001 08:26:20 GMT Subject: REPOST: Re: posting the code - further to odd problem References: Message-ID: <6$--$$_----_-%$_$$@news.noc.cabal.int> Dave Harrison wrote: > However the packet class code is as follows : > > import string > pdic = {} > > class Packet: > def __init__(self, info): > self.buildDic(info) > > def buildDic(self, info): > for item in info: > split = string.split(item,"=") > if (len(split) > 1): > pdic[split[0]] = split[1] > > def getVal(self, key): > if pdic.has_key(key): > result = pdic[key] > else: > result = '' > return result It puzzles me how you can do for pac in paclist: print pac.getVal() (as quoted from your previous post) and not get an error, since getVal takes a key as its argument. Which leads me to suspect that this wasn't actual code. :-) Anyway, I don't know what kind of items Packet takes (I got it to work with a list of strings like "a=1" etc), so I cannot do much there. However, I do notice that all packet instances share the same dictionary (pdic). Maybe this has something to do with it? Packet has no attributes, so I wonder where it takes its value from. --Hans ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp.gblx.net!feeder.qis.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Hans Nowak Newsgroups: comp.lang.python Subject: cmsg cancel <3C2D7CDB.4E3CC449 at earthlink.net> Control: cancel <3C2D7CDB.4E3CC449 at earthlink.net> Date: Mon, 31 Dec 2001 02:25:32 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774804 27193 211.57.49.2 (31 Dec 2001 05:00:04 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:00:04 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From mertz at gnosis.cx Tue Dec 18 19:04:58 2001 From: mertz at gnosis.cx (Dr. David Mertz) Date: Tue, 18 Dec 2001 19:04:58 -0500 Subject: PythonWare: Anyone using for real projects? Message-ID: bernhard at intevation.de (Bernhard Reiter) wrote: > http://www.webreview.com/2001/07_20/developers/index02.shtml |First: The reviewer makes the mistake to equal "proprietory" |software with "commercial" software. In fact Free Software can be |commercial. As said reviewer, I have to protest that I make no such mistake. I wrote exactly what I meant, and used all the words accurately. Reiter is, of course, correct that Free Software can be commercial. The short review doesn't say anything about that one way or the other, because those issues simply were not topical. In practice--despite legal technicalities of licenses that certain "enthusiasts" like to observe--if some software is Free, I'm going to be able to obtain it without paying money. But it might well be worth paying the money either because of support that comes with that or out of principled support for the developers. In the above review, I don't mention Free Software at all. I *do* contrast PythonWorks with the *free* Idle, PythonWin and MacPython. That's not a comment on the license terms of the latter three; as Reiter should recognize, the lower case says that you don't pay money for the latter ones. For Webreview, that's exactly the contrast most readers are worried about. The site just isn't one that has a lot of interest in discussing freedom... and I write articles because I get paid money for doing so (although I subsequently make the articles Free, and obtainable from my own website). When I write for places where readers worry about the political principles of licenses, I mention those; when I don't, I don't. Yours, David... From greg at cosc.canterbury.ac.nz Mon Dec 17 00:19:20 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Mon, 17 Dec 2001 18:19:20 +1300 Subject: How to kill Zombie process? References: Message-ID: <3C1D8058.18837490@cosc.canterbury.ac.nz> > ?????? wrote: > > When I use ret=os.fork(),it will create a parent process and child > process,when child process exists,it will creaet a Zombie process,How > to kill it in parent's process? A zombie process stays around until its parent process either waits for it using the wait() system call or one of its variants, or exits. In a server process such as you seem to be implementing, you need to do this asynchronously, which is a bit tricky to get right. Briefly, you need to: * Install a signal handler to catch the SIGCHLD signal, which is sent whenever one of your child processes exits. * In your signal handler, loop calling os.waitpid() with the appropriate options to wait for any child process, and not to block (see the Unix man page for waitpid(2) for details). Keep calling waitpid() until it returns indicating that there was no child process ready to be waited for. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From clspence at one.net Thu Dec 20 13:33:10 2001 From: clspence at one.net (Chris Spencer) Date: 20 Dec 2001 12:33:10 -0600 Subject: Python DDE printing HELP! Message-ID: <3ab42u0ja3ssd02d3fnmi652u9fenqupde@4ax.com> I've looked all over and can't find an example of using DDE in Python to print a document using a Microsoft Application. I know it's possible, but the DDE documentation in the Pythonwin is VERY inadequate (virtually nonexistant). Help! Chris. From yfjohans at NOSPAMTHANKYOUMAM-siving.hia.no Sun Dec 2 16:04:24 2001 From: yfjohans at NOSPAMTHANKYOUMAM-siving.hia.no (Yngve F. Johansen) Date: Sun, 02 Dec 2001 22:04:24 +0100 Subject: Python, PyQT and QSpinBox References: <9ubnie$34b$1@snipp.uninett.no> <9uco14$3cb$1@news1.xs4all.nl> <9udb9l$g9h$1@snipp.uninett.no> <9ue14o$5fn$1@news1.xs4all.nl> Message-ID: <9ue50l$mgn$1@snipp.uninett.no> Boudewijn Rempt wrote: >> I'm not to familiar with the signal-slot mechanism, and it could be that >> I have to do something with this? I don't have a single connect() >> statement defined relating to the QSpinBox widget. > > In this case you don't need signals and slots, since you're not > combining two objects. If you don't feel familiar with PyQt, you > might like to start reading the second part of my book on PyQt, > which gives quite a detailed explanation of the concept: > > http://www.opendocs.org I didn't think I had to connect the widget to it self, but as quite a newbie I couldn't be quite sure. Nice to get some affirmation. I've read big parts of your brilliant book already. It was the reason I decided to try GUI programming in the first place. Quite wierd this problem, I downloaded the new PyQT today, to no avail. I've searched both dejanews.com and a lot of searchengines and mail-lists, but noone mentions this problem. I'll just have to try more :-) Thanks alot for your help, and for making your book available online, it was the only decent source of information relating to PyQT I could find. Sincerly, Yngve From avisser at cumberland.edu Mon Dec 10 17:06:34 2001 From: avisser at cumberland.edu (Anton) Date: 10 Dec 2001 14:06:34 -0800 Subject: Can't import from mx.ODBC References: <8f8ffe67.0112101027.24a3dcaf@posting.google.com> Message-ID: sjoshi at ingr.com (Sunit Joshi) wrote in message news:<8f8ffe67.0112101027.24a3dcaf at posting.google.com>... > Hello > I'm trying to imort from mx.ODCB.Windows but I keep getting an error > saying "ImportError: No module named mx.ODBC.Windows". I checked the > sys.path and I do have the following: 'C:\\Python21\\mx\\ODBC' > > Could someone please tell me what is wrong here..?? > > thanks > Sunit > sjoshi at ingr.com Make sure you have installed the mx base package? Get it from here: http://www.lemburg.com/files/python/ From shalehperry at attbi.com Sat Dec 8 13:43:15 2001 From: shalehperry at attbi.com (Sean 'Shaleh' Perry) Date: Sat, 08 Dec 2001 10:43:15 -0800 (PST) Subject: Need help with regular expression In-Reply-To: <20011208133230.A5441@newcreature.org> Message-ID: On 08-Dec-2001 Ben Logan wrote: > Well at least I'm not the only one... > > I don't have the money to go buy the book, and I checked my libraries, > but they don't have it. I also searched the web for useful info, but > found none. > > Since I've got an ever-increasing bruise on my head, could you (or > anyone) tell me how it's done? :) > Bookstores are just libraries that want dues (-: This has been discussed numerous times on this and the -tutor list, so dig through the archives for a good response. From crennert at pbmplus.com Mon Dec 17 14:49:19 2001 From: crennert at pbmplus.com (Chris Rennert) Date: 17 Dec 2001 11:49:19 -0800 Subject: if __name__ == "__main__" Message-ID: Hello, Could someone please fill me in on how the if __name__ == "__main__ thing works. I am reading through some tutorials and I never really get a clear definitive answer on that. Is this like main() in C? Any help would be greatly appreciated. From erno-news at erno.iki.fi Sun Dec 9 12:10:51 2001 From: erno-news at erno.iki.fi (Erno Kuusela) Date: 09 Dec 2001 19:10:51 +0200 Subject: Calling a generator multiple times References: <0gn21usqeasqa1bp4sveh0vjagtmbmfpof@4ax.com> <3C11FE92.1218662@letterror.com> <3C127F1D.DD609D4D@xs4all.nl> <46051ugbk2aeaqeq4sb2aslurf4t22o70b@4ax.com> <3C1289D5.98BE76B4@xs4all.nl> Message-ID: In article , Courageous writes: | Those who say "work with this some, you'll get used to it" are | far from the point. Python is not supposed to be an environment | where you "get used to it". very well said! i so wish the powers that be keep this in mind. -- erno From jkraska at san.rr.com Sun Dec 30 00:32:14 2001 From: jkraska at san.rr.com (Courageous) Date: Sun, 30 Dec 2001 05:32:14 GMT Subject: REPOST: Re: Is learning Python "extraordinary"? References: <3C2DC53F.31010.D9D6B0A@localhost> Message-ID: <9$--$$_----__%%$$$@news.noc.cabal.int> >It shows intellectual curiosity and self-motivation, two things any >admissions board smiles on. However, for MIT, you should make clear that >your studies have convinced you Python is merely a bad implementation of >Scheme . :) A good alternative to sucking up is contrariness, where if you say something the opposite of what they believe, this convinces them that you must be intelligent, because only intelligent people are iconoclasts. C// ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Courageous Newsgroups: comp.lang.python Subject: cmsg cancel <9e9t2ucvm4dgcfcg53k7h1a0pe7612kmf2 at 4ax.com> Control: cancel <9e9t2ucvm4dgcfcg53k7h1a0pe7612kmf2 at 4ax.com> Date: Mon, 31 Dec 2001 03:44:16 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774379 27193 211.57.49.2 (31 Dec 2001 04:52:59 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:52:59 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From grey at despair.dmiyu.org Mon Dec 3 18:46:35 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Mon, 03 Dec 2001 23:46:35 -0000 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BD39F.D43D4FF7@mega-nerd.com> <3c0be454$1@207.229.64.20> <3C0BE5D5.4386B359@mega-nerd.com> <3c0bf170$1@207.229.64.20> Message-ID: On Tue, 4 Dec 2001 01:36:49 -0800, Peter Bismuti wrote: > I'm on your side. After following this thread I am more convinced that tabs > are a better approach as it allows for a separation of style and content. > Each person can view their file with whatever indentation width they prefer > (style) without altering the contents of the file (content). How many times to I have to point out that style and content cannot be separated? -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From paul at boddie.net Mon Dec 3 06:53:55 2001 From: paul at boddie.net (Paul Boddie) Date: 3 Dec 2001 03:53:55 -0800 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> Message-ID: <23891c90.0112030353.1406b494@posting.google.com> Courageous wrote in message news:<0pvl0ug52ug206qkpne2sjrinb2e8qsvam at 4ax.com>... > > I see this in other programming languages all the time, where someone > comes along with a different tab notion than mine, edits the file, and > then commits it. This creates horribly formatted files where the > indentation levels of lines of code throughout the file. Perhaps you might want to put some kind of processing step into your revision control procedures or tools. I think I raised this issue before on comp.lang.python but some people think it's more interesting to get religious about tabs vs. spaces instead. Personally, I use tabs for my own code because I have a UNIX background and the only decent editors available on the systems I used treated tabs properly. Subsequently, I've had the need to use spaces for indentation, and decent editors will let you configure this and even try and make the navigational behaviour workable too - where editors treat indentation spaces as a collection of characters that have to be navigated past individually, then the editing experience starts to get irritating. As most people are aware, tabs were intended for indentation purposes in human-readable documents, whereas spaces are just word separators. As a side-effect of the implementation of spaces, they can also be used for indentation and text justification, but that doesn't mean that they should be used for such purposes. Indeed, using spaces in such a way in word processing or desktop publishing is a habit which will inevitably get you into trouble, but the unfortunate thing is that most word processors won't guide the user into avoiding this kind of mistake. It would be interesting to see word processors accept just one space between words, for example, as a means of discouragement. Sadly, we just have to live with spaces in their unintended role, but I think that rather than wasting time inventing urban legends, folklore and "reasons" why one is better than the other, we should be talking about practical measures that projects can use to avoid tab/space mixing and other text-based nightmares (DOS text vs. UNIX text, for example). Paul From cjw at sympatico.ca Fri Dec 28 20:06:17 2001 From: cjw at sympatico.ca (Colin J. Williams) Date: Fri, 28 Dec 2001 20:06:17 -0500 Subject: [ANNOUNCE] Microsoft HTML Help of Python 2.2 Docs] References: <3C2BC221.4F5DB23C@sympatico.ca> Message-ID: <3C2D1709.426782CE@sympatico.ca> An HTML attachment was scrubbed... URL: From dalke at dalkescientific.com Sun Dec 23 05:54:45 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Sun, 23 Dec 2001 03:54:45 -0700 Subject: Why is Complex number notation the way it is? References: <23302360.0112142245.59089e4f@posting.google.com> <3C21173A.8E02D0A0@cosc.canterbury.ac.nz> Message-ID: Steven Feil: > ... Hmmm.. I can't tell if this is meant as a joke or not. Something must be wrong with my discriminator. I'll treat it as real, but bear in mind that the poster could have been exaggerating this viewpoint for fun. >I was schooled as a Physicists dammit!! >The imaginary number is i!!! So was I. Guess it doesn't bother me as much. It's like the statement "scale everything so c = h/ = 1" -- I just stick a "Let j = i" at the beginning and go from there. Or maybe it's because I think of the complex plane, so I'm already using x-hat and y-hat in my head... I know, that's why I'm not as good at thinking about quaternions. [this could be a joke on the frustration many beginning students have when they have to switch notation systems between different domains] >Electric current ALWAYS flows from Positive TO Negative. > charge carrier may flow from negative to positive, such as e- and > Cl- but Na+ flows from positive to negative. If you don't believe > that Na+ and Cl- can flow, try taking a bath in salt water and throw > in a toaster. So if you're at SLAC, and you have a packet of electrons going from one end to the other, you'll still insist that current is flowing the other way? Even if you can watch the chunk of current as it moves down the beamline? What if it's anti-electrons? SLAC doesn't do it, but what about (anti-)protons? In chemistry they talk about proton transport -- [H+]. That threw me off until they politely explained that the proton was always attached to something, so it was never a raw proton. It wasn't even the same proton. [comment about the bathwater could also be a subtle jibe on some people's lack of chemistry knowledge] >IE=P is ALWAYS true, even with AC and a phase factor > Because instantaneous current times instantaneous voltage is equal > to instantaneous power! (in physics everything is instantaneous) This is why the post has to be a joke. Nothing is instantaneous in physics -- special relativity. Maybe the post is a joke on the single-minded hubris of some physicists? Or maybe I'm really wrong on the physics and I need to turn in my degree? Andrew dalke at dalkescientific.com From orna27 at netvision.net.il Thu Dec 20 01:36:55 2001 From: orna27 at netvision.net.il (Orna Berlinsky) Date: Thu, 20 Dec 2001 08:36:55 +0200 Subject: Importing modules for cgi's References: <3C218270.C331131E@yahoo.com> Message-ID: <003201c18920$b8c63200$3193003e@rashome> Hi I'm not so sure I understand what is the problem , but some weeks ago , as a python novice I encountered similar problems (cgi etc.) . This is the solution that was best suited to me : Shell script that updates the PROXY and calls the python script : #!/bin/sh echo "Content-Type: text/html" echo "" export QUERY_STRING http_proxy="http://aaa.bbb.ccc.dd.ee:8080" export http_proxy /users/my_cgi_path.cgi >&2 /dev/null & and the python script : #!/usr/local/bin/python """Test my interface""" import string , sys , cgi sys.path.insert(0 , "my_path/python") import myModuls def go(): # have the cgi module parse the data for you... form = cgi.FieldStorage() # get the values of the fields # run the python program if __name__=="__main__": go() I hope my answer assist you . Good luck Amit ----- Original Message ----- From: "Daniel" Newsgroups: comp.lang.python To: Sent: Thursday, December 20, 2001 8:17 AM Subject: Importing modules for cgi's > Hi, > I installed a database api module in python and added the path to my > PYTHONPATH. In order for my cgi to work, though, I have to invoke my cgi > from a shell script that first sets the PYTHONPATH so the module will be > foud when the cgi runs. Is there a simpler way? I'd prefer not having to > have the shell script. Is there a way for python to always know about my > module without using PYTHONPATH? > > Another thing I tried that doesn't work is modifying sys.path at the > start of the cgi script. It seems that this has to be set (via the shell > script) before the cgi script starts. > > Thanks, > Daniel > > -- > http://mail.python.org/mailman/listinfo/python-list > From qrczak at knm.org.pl Mon Dec 10 04:41:21 2001 From: qrczak at knm.org.pl (Marcin 'Qrczak' Kowalczyk) Date: Mon, 10 Dec 2001 09:41:21 +0000 (UTC) Subject: Populating a list References: <32c382ad.0112091404.6cfe4a56@posting.google.com> <9v0ph70g4v@enews1.newsguy.com> Message-ID: Sun, 9 Dec 2001 23:44:55 +0100, Alex Martelli pisze: > states = [ line[:-1] for line in f.readlines() ] It will have undesirable effect when the last line of the file doesn't end with '\n'. -- __("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ QRCZAK From mwh at python.net Wed Dec 26 05:27:18 2001 From: mwh at python.net (Michael Hudson) Date: Wed, 26 Dec 2001 10:27:18 GMT Subject: Can't exit python with ^D under certain circumstances References: Message-ID: "wealthychef" writes: > Hi, this is weird to me, don't know how to fix. > On my local python installation on machine A in a normal shell, ^ > D works to exit Python as expected. On machine B on the > console, ^D also works fine, but if I ssh to machine B from > machine A and try to exit Python with ^D, Python does not exit, > instead I get the following strange error message: Sounds like you have wierd out terminal issues. Does the $TERM environment variable match reality? Cheeers, M. From kragen at pobox.com Fri Dec 21 07:02:10 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 21 Dec 2001 07:02:10 -0500 Subject: Python on the desktop References: <94e3fce8.0112210053.2568529d@posting.google.com> Message-ID: <831yhoaiil.fsf@panacea.canonical.org> sarat_venugopal at yahoo.com (Sarat Venugopal) writes: > 1. If python is to permeate the realm of commercial desktop (in > whatever scope), we need the ability to convert it into a native > executable(I have taken a look at some of the limited solutions > available from individuals). I read somewhere, it may never be > possible in Python. Can anyone throw light on this? > Most commercial applications wouldn't want to expose the source code > or even leave it as byte-code(Note: ActiveState has announced a > compiler for Perl) There are even a lot of noncommercial applications written by people who don't want to expose the source code. (And, of course, commercial applications written by people who do.) There are folks working on native-code compilers for Python for a variety of reasons. Ping made a list in (I think) May listing the Python compilers, which is at http://www.python.org/sigs/compiler-sig/dev-day-notes.txt. It lists CPython (the normal Python), JPython (which generates Java bytecodes which can be compiled into native code), Python2C, and Vyper/Viper. Unfortunately, it looks like only Jython remains standing among the possibly-native-code compilers. > 2. Absence of a standard GUI, which really fits the major platforms. > For a lanuage like Python, this is really a handicap. Would I do it in > Tkinter on Windows? No way. You don't like the way it looks, or what? > 3. Does the community see Python as a full-fledged programming > language? Yes. From nika at kassube.de Sun Dec 30 08:14:07 2001 From: nika at kassube.de (Nils Kassube) Date: 30 Dec 2001 14:14:07 +0100 Subject: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> <3C2E498B.6DC757E0@stroeder.com> Message-ID: <87itaorgtc.fsf@kursk.kassube.de> Cliff Wells writes: > My sentiments exactly: C is excellent as the equivalent of a modern > assembly language. Usually an assembly language is well defined. From fpm at u.washington.edu Mon Dec 3 19:45:06 2001 From: fpm at u.washington.edu (Frank Miles) Date: 4 Dec 2001 00:45:06 GMT Subject: Python, Glade and portability? References: <9ug2da$dqd$1@hermes.shef.ac.uk> Message-ID: <9uh6ai$mcc$1@nntp6.u.washington.edu> In article <9ug2da$dqd$1 at hermes.shef.ac.uk>, wrote: >Hi, > I have written some Python software in the past for my own >consumption in Linux. Now, there is a need to use that softare in other >"lesser" :-) OS, and I have been asked to port it to windows. > >I had written the software using Glade and python (and several Python >extensions), and I now realise that I'd need to re-write the GUI to >accomodate for windows. While this is easy enough to do (I'd just have >to re-write the UI module, probably using wxwindows or somesuch), I'd >rather not spend time on it, and I was wondering whether anyone knows of >an easier solution that might translate the XML produced by glade to >something which is useable in Windows. > > Any help appreciated, > Jose > >-- >Jos? L G?mez Dans PhD student >Tel: +44 114 222 5582 Radar & Communications Group >FAX; +44 870 132 2990 Department of Electronic Engineering > University of Sheffield UK Is there some reason why the Windows ports of libglade et al. won't work for you? (Granted, getting all the right pieces to work together can be a challenge)... -frank -- From michael.williams at st-annes.oxford.ac.uk Tue Dec 4 17:11:13 2001 From: michael.williams at st-annes.oxford.ac.uk (Michael Williams) Date: Tue, 04 Dec 2001 22:11:13 +0000 Subject: Using *just* the IDLE editor References: <3C0C4FE1.5B218CE0@st-annes.oxford.ac.uk> <3C0CC18B.6060103@olen.to> Message-ID: <3C0D4A01.470880CE@st-annes.oxford.ac.uk> Joonas Paalasmaa wrote: > > I'd like to set up (or strip out components or rewrite, but hopefully > > it won't be that complex) IDLE so that when I start it up with > > > > $ idle > > > > I just get the IDLE editor and not the interactive shell. > > Use idlefork. > > http://idlefork.sourceforge.net/ That does exactly what I'm after. Thanks. Is there a short answer to the difference between the two versions of IDLE as to how one launches the shell and one an editor? I managed to get the vanilla idle launching an editor and not the shell by editing idle.py (comment out the Shell calls and add in a EditorWindow() test) but this gave some warnings (it did work though). For various political reasons (I would have trouble convincing people to use stuff which is a nominally more buggy fork) I wouldn't mind getting this worked out in the normal IDLE - perhaps it should be done by a simple command line argument? Anyway, I've joined idle-dev and will take the discussion there as its probably pushing the boundaries of on topic here. -- Michael From christophertavares at earthlink.net Mon Dec 24 14:02:22 2001 From: christophertavares at earthlink.net (Chris Tavares) Date: Mon, 24 Dec 2001 19:02:22 GMT Subject: C++ throw causes abort in extension? References: <20011224.123518.378096161.2956@localhost.localdomain> Message-ID: <2ZKV7.13654$PO5.2163087@newsread1.prod.itd.earthlink.net> "Robert Nikander" wrote in message news:20011224.123518.378096161.2956 at localhost.localdomain... > Hi everyone, > I am trying to use C++ in my Python extension, but any throwing of > exceptions cause the program to 'abort.' > > I put this code in my init module function; and below you see what happens > when I try to import... > > cout << "about to throw in initrobs" << endl; > try { > throw 100; > } > catch (...) { > cout << "Caught ..." << endl; > } > > Python 2.2c1 (#1, Dec 18 2001, 11:04:07) [GCC 3.0.2] on linux2 Type > "help", "copyright", "credits" or "license" for more information. > >>> import robs > about to throw in initrobs > Aborted > [rob at ibooker py_ext2]$ > > I tested exceptions apart from Python and they are working fine on my system > normally. So is there something wrong with throwning an exception when > your C++ code was called by C code? I also tried downloading CXX and it > aborts foir the same reasons, so maybe this is something with GCC 3.02? > > Thanks for any help, > Rob Typically, this sort of problem arises when mixing C++ and C. I'm not a GCC expert (I do most of my programming on Windows, actually) so take what I'm saying with a grain of salt, but... A C++ application needs to do more setup at start time than a C app, including initializing exception handling. When you use a dynamically loaded extension module written in C++, the caller (the Python interpreter) is a C application, so the setup of exception handling wasn't done. Therefore, when you call throw, some data structure it was expecting wasn't there, and things go boom. In the Windows world, the solution is to compile main with a C++ compiler, not a C compiler. No clue what to do under GCC/Linux, though. -Chris From hamish_lawson at yahoo.co.uk Sun Dec 16 18:42:55 2001 From: hamish_lawson at yahoo.co.uk (Hamish Lawson) Date: 16 Dec 2001 15:42:55 -0800 Subject: /usr/bin/env: python: No such file or directory References: Message-ID: <915a998f.0112161542.2ab07235@posting.google.com> > When trying to run a script, I get the following message: > > /usr/bin/env: python: No such file or directory Though perhaps not the case here, I'll just mention a problem that is worth being aware of when transferring a script from a Windows/DOS system to Unix. If the difference in line-ending conventions hasn't been taken care of (such as by using ASCII mode during FTP transfer), then the spurious ^M in the script's #! line can trip up the shell or the env command, since it will be trying to run the program python^M. Hamish Lawson From wurmy at earthlink.net Fri Dec 28 15:42:22 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Fri, 28 Dec 2001 20:42:22 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <32c382ad.0112272324.4c78689b@posting.google.com> <3C2C88A6.9D13A3D6@earthlink.net> Message-ID: <3C2CD7EB.F90E6C9@earthlink.net> Steve Lamb wrote: > > On Fri, 28 Dec 2001 15:04:12 GMT, Hans Nowak wrote: > > > > I'm pretty sure 1.5.2 had strip already... > > > > According to the Beazley book it did. Yes, I've been checking out some old binaries, and strip was available as early as 1.4. (Don't know about any older versions.) Ah, those were the days... The One True Python had everything you needed and no bloat. ;-) --Hans From bit_bucket5 at hotmail.com Tue Dec 11 13:51:53 2001 From: bit_bucket5 at hotmail.com (Chris) Date: 11 Dec 2001 10:51:53 -0800 Subject: CGI form repost from browser--how to prevent? Message-ID: I'm writing a Python cgi script that does some inserts into a mysql database based on data in an html form submitted by a user. Is there any way to prevent the browser from reposting the data from the form when the user hits refresh in the browser after they have submitted the form? When this happens, the script receives the same cgi form data and performs the same inserts on the database. I think maybe this can be prevented by storing some state info with cookies?? Not sure (have never used cookies). Any ideas on an easy way to prevent this? Many Thanks. -Chris From phr-n2001d at nightsong.com Fri Dec 21 10:18:42 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 21 Dec 2001 07:18:42 -0800 Subject: marshalling data structures between perl <-> php <-> python References: <5.1.0.14.2.20011221164328.031b3b50@202.95.131.154> Message-ID: <7x6670lhyl.fsf@ruckus.brouhaha.com> Skip Montanaro writes: > Dunno about "common", but there is a Python version of marshal that Guido > wrote for JPython. You could translate that to Perl and PHP. I have a copy > lying about if you need it. Marshal is an awful format for long ints in languages other than python. It uses Python's weird internal representation for them which has to be munged mightly for other languages. Most applications don't use long ints though, so this may not be an issue much of the time. From justin at iago.org Sat Dec 15 14:56:10 2001 From: justin at iago.org (Justin Sheehy) Date: Sat, 15 Dec 2001 14:56:10 -0500 Subject: Unsung Python modules In-Reply-To: (Michael Hudson's message of "Sat, 15 Dec 2001 13:33:03 GMT") References: <3dsnad226b.fsf@ute.mems-exchange.org> <15386.18916.707282.784261@beluga.mojam.com> Message-ID: Michael Hudson writes: >> One reason that a lot of people might not think of this is that it's >> not needed if you're using Python's interactive mode in an emacs >> inferior shell buffer alongside Python-mode. > > Can you get completion in python-mode? Or multi-line editing? Not in the same way that you can from readline. I get completion via emacs' dynamic abbrevs, which are wonderful but complete mainly based on the contents of current buffers. For completion of names in my own code or code that I have loaded into another buffer somewhere, this works beautifully. I haven't needed multi-line editing exactly, since I'm already inside an editor. If I want to redo an earlier action slightly differently, I just type or modify it in an editor buffer and have python-mode evaluate that block. I certainly wouldn't argue that readline is useless. However, python-mode provides different yet strongly overlapping functionality and thus a python-mode user is much less likely to feel the need for readline behavior. -Justin From ssthapa at classes.cs.uchicago.edu Wed Dec 12 01:14:48 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Wed, 12 Dec 2001 06:14:48 GMT Subject: lost interest? References: <20011208001123.A5989@casa.parque> <3C14FEBD.AD52B516@attbi.com> <3dzo4pputt.fsf@ute.mems-exchange.org> <3C16501E.D817323D@attbi.com> <3du1uxpma1.fsf@ute.mems-exchange.org> <3C166E95.62B357AA@attbi.com> Message-ID: Chris Barker wrote: >I know I had never heard of it, and still can't find it (the sourceforge >page seems to be dead). You can find a current source on ftp.community.tummy.com in /pub/python-packages. >My experience when I posted a proposal was that almost everyone that did >comment was all gung ho about their own personal vision of the nifty >it-dowloads-and-installs-itself system, and no one wanted to do the work >of just getting all the packages together. It seems no one wants to >start small. With the lastest version of ciphon, there are a couple of utilies to make file easier for packagers. One lets distributers generates specification files easily. The other takes a bunch of specification files and tar balls and generates a package with information about all the packages and a populated directory structure that can be dropped onto an anonymous server. >Will all things open source, this is going to take one person who puts >in the time to put together something truly usefull, and then they may >get some support. I hope I'll have the time someday, and if not me, >someone else. I'm convinced it is needed. Currently I think ciphon has most of cpan's functionality. It will automatically update the server and package lists, handles dependencies, and it'll even generate rpms of packages and install them (provided the package supports the distutils bdist_rpm target). -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From jmsun at bioeng.ucsd.edu Tue Dec 11 18:47:28 2001 From: jmsun at bioeng.ucsd.edu (Jeffrey) Date: 11 Dec 2001 15:47:28 -0800 Subject: Tkinter Text and Overline Message-ID: <3daa1aa8.0112111547.5462abfd@posting.google.com> Hi Everyone, Does anyone know how I can insert text in Tkinter Text widget, with an overline? Thanks, Jeff From lynn at garlic.com Fri Dec 28 14:21:58 2001 From: lynn at garlic.com (Anne & Lynn Wheeler) Date: Fri, 28 Dec 2001 19:21:58 GMT Subject: REPOST: Re: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> Message-ID: <9$--$$_-----$%_$$$@news.noc.cabal.int> claird at starbase.neosoft.com (Cameron Laird) writes: > RFC 765 FILE TRANSFER PROTOCOL June 1980 > RFC 821 SIMPLE MAIL TRANSFER PROTOCOL August 1982 > RFC 854 TELNET PROTOCOL SPECIFICATION May 1983 > RFC 850 Standard for Interchange of USENET Messages June 1983 > RFC 977 Network News Transfer Protocol February 1986 765 is the latest standard .... there is a trail of previous RFCs that were replaced by the latest ... going back to 354 - File Transfer Protocol, Bhushan A., 1972/07/08 (29pp) (.txt=58074) (Obsoleted by 542) (Updated by 385, 454, 683) (Obsoletes 264, 265) precursor to 821 788 - Simple Mail Transfer Protocol, Postel J., 1981/11/01 (62pp) (.txt=109001) (Obsoleted by 821) (Obsoletes 780) precursor to 854 764 - Telnet Protocol specification, Postel J., 1980/06/01 (15pp) (.txt=40005) (Obsoleted by 854) no precursor listed to 850 not precursor listed to 977 random ref: http://www.garlic.com/~lynn/rfcietff.htm jan 1, 1983 was the "cut-over" from IMPs and NCP to IP. There were about 250 nodes that were part of the 1/1/83 cutover. Note however, there were interconnects of ARPANET (IMPs and NCP) by locations with TeleNET (GTE) and "PhoneNet" (dial-in) for things like SMTP mail (aka "offline" processing ... dial-up, download, hang-up ... somewhat akin to uucp strategy using "phonenet"). random ref: http://www.garlic.com/~lynn/internet.htm#0 misc. RFC referens: rfc60 ... A simplified NCP Protocol rfc215 .. NCP, ICP, and TELNET: rfc381 .. TWO PROPOSED CHANGES TO THE IMP-HOST PROTOCOL rfc394 .. TWO PROPOSED CHANGES TO THE IMP-HOST PROTOCOL rfc550 .. NIC NCP Experiment rfc618 .. A Few Observations on NCP Statistics rfc660 .. SOME CHANGES TO THE IMP AND THE IMP/HOST INTERFACE rfc687 .. IMP/Host and Host/IMP Protocol Change rfc704 .. IMP/Host and Host/IMP Protocol Change rfc773 .. COMMENTS ON NCP/TCP MAIL SERVICE TRANSITION STRATEGY rfc801 .. NCP/TCP TRANSITION PLAN -- Anne & Lynn Wheeler | lynn at garlic.com - http://www.garlic.com/~lynn/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.tele.dk!small.news.tele.dk!134.75.7.11!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Anne & Lynn Wheeler Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:40:40 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775118 27193 211.57.49.2 (31 Dec 2001 05:05:18 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:05:18 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From mhammond at skippinet.com.au Sun Dec 16 08:24:11 2001 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun, 16 Dec 2001 13:24:11 GMT Subject: How to get currently active window on Win32? References: Message-ID: <3C1CA120.8020808@skippinet.com.au> David Brady wrote: Wolfgang answered the first: > Second question, it looks like PyCWnd supports all of > the MFC functionality that I could want (including > GetTopWindow, ahem) but I can't figure out how to get > at a PyCWnd object. How can I call these MFC > functions... or do I have to create a Win32 PyCWnd > dialog in order to call from it? You can call win32ui.CreateWindowFromHandle() if you just have the handle. Otherwise you must create it. > Third, is it possible to call GetWindowPlacement and > SetWindowPlacement from Python? I'd like to write a > script that manipulates the positions of my open > windows. the win32ui window objects have these functions. See the docs. > Fourth (and last, phew!), is there a way to find out a > window's class? FindWindow, for example, will look > for a caption or a window class; it's more accurate to > look for window classes (especially when you have six Maybe FindWindowEx? I haven't got MSDN handy, but work out how to do it from the MSDN/SDK documentation, and then do it in Python :) Mark. From amerikosus at yahoo.com Sun Dec 9 09:45:04 2001 From: amerikosus at yahoo.com (Andrew) Date: Sun, 9 Dec 2001 15:45:04 +0100 (MET) Subject: python-list, how much? Message-ID: My name is Andrew. I am an erotic photographer and I love young Russian girls that's why I made this site for you. I was impressed when browseing the photos. Cool site Many russian lolitas. ( http://lola-tron.tc ) its only exclusive photos of Russian lolitas. Over 2000 fresh photos. High quality photos. All girls that you will meet here are REAL. Yes, I mean real Russian amateur teen girls. I don't buy pictures from content provider, I make it myself. What it means to you? You can write a letter, ask question and even meet every girl you see here! Everything is possible here!! For unsubsribe go to: http:///www.autoremove.com From freebird317 at hotmail.com Thu Dec 27 19:04:11 2001 From: freebird317 at hotmail.com (~Jason~) Date: Fri, 28 Dec 2001 00:04:11 GMT Subject: REPOST: tcl??? Message-ID: <9$--$$_----__-_$_$@news.noc.cabal.int> I am playing around with Python and it is telling me that to activate tcl type tclch80. I do this and I get an error. I think may be it is because either I am typing in the wrong version or I do not have it? Am I right and if so how do I correct it? And if I am wrong, how do I fix it? What it wants me to do is type [% put "Hello World"] and I do that and I get an error, why? -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If GOD be for us, who can be against us? ~ Romans 8:31~ Jason Lehman freebird317 at hotmail.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newsengine.sol.net!news-feed.riddles.org.uk!sn-xit-03!supernews.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "~Jason~" Newsgroups: comp.lang.python Subject: cmsg cancel <%FOW7.8662$7p6.139123 at rwcrnsc51.ops.asp.att.net> Control: cancel <%FOW7.8662$7p6.139123 at rwcrnsc51.ops.asp.att.net> Date: Mon, 31 Dec 2001 04:24:45 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775488 27193 211.57.49.2 (31 Dec 2001 05:11:28 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:11:28 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From dmallwitz at cox.rr.com Tue Dec 11 01:44:56 2001 From: dmallwitz at cox.rr.com (David Mallwitz) Date: Tue, 11 Dec 2001 01:44:56 -0500 Subject: banging head against sys.stdin and tkinter on win32 Message-ID: <3c15a9e3$1_2@goliath.newsgroups.com> thump thump thump A few weeks ago I decided to try to become more proficient in Python by writing a plain vanilla GUI app that interfaces with a serial port. Turns out to have been pretty straightforward and everything is now at least working, if not working the way I want it to. The program is a single Tkinter text widget in its own thread to display everything that is read from the serial port, another thread to read from that port, and one more thread to continuously read input from the user. I don't need to process any input from the user, just send it straight to the device attached to the serial port. So far no problem. I've been using a while 1 loop and msvcrt to poll for any keystrokes, but this keeps a console window open and all commands must be typed in that window. I'd like to 86 the console and just have all input/output done on the display window (I'm familiar with the .pyw filename trick, won't work, msvcrt need that console window to function). This is where the headbanging thing happens. I've tried wrapping the window in a class and defining a read method in order to redirect sys.stdin - no joy, msvcrt just wants to use a console window no matter what. I used an Entry widget for a while, but the number of bind statements was prohibitively long, and would all need to be changed if I tried to communicate with a different type of device. Input and raw_input don't really apply here since I need to work on a character by character basis and not wait for \n to terminate a string. Am I even on the right track here? I'll gladly RTFM if someone will point me to where an appropriate FM is. For that matter, where is the source code for msvcrt? There is no file with that name in my Python path (or anywhere else), yet I have to import it as a module. Best, Dave -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- From mwh at python.net Thu Dec 6 10:30:39 2001 From: mwh at python.net (Michael Hudson) Date: Thu, 6 Dec 2001 15:30:39 GMT Subject: getting the name of a variable References: Message-ID: sandskyfly at hotmail.com (Sandy Norton) writes: > When I'm debugging I'm always sticking stuff like "print 'x:', x" in > my code. So is there a handy function that will print a variable > name and value such that: > > >>> def print_var_name_and_value(var): > "prints variable name : value" > > > >>> variable = 'me var' > >>> print_var_name_and_value(variable) > variable : me var Not really. Hit google groups for more info. Some highlights: a gross implementation attempt by me: http://groups.google.com/groups?selm=m38zytnexz.fsf%40atrus.jesus.cam.ac.uk a nice explanation of why this not really possible by /F: http://groups.google.com/groups?selm=3a03261b_1%40corp.newsfeeds.com Cheers, M. -- : exploding like a turd Never had that happen to me, I have to admit. They do that often in your world? -- Eric The Read & Dave Brown, asr From loewis at informatik.hu-berlin.de Tue Dec 18 10:51:25 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 18 Dec 2001 16:51:25 +0100 Subject: DOM - some pointers References: Message-ID: "infotechsys.wayne at verizon.net" writes: > Could someone point me to some documentation that show how to use > HTML ,Dom and Python together. I did a google search, but the only > thing I find is DOM, XML and Python. In PyXML, you can use xml.dom.ext.reader.HtmlLib.FromHtml{,File,Url,Stream} to create a DOM tree; then you can use the standard DOM API to process the tree. HTH, Martin From ldwhitley at charter.net Thu Dec 20 16:58:06 2001 From: ldwhitley at charter.net (ldwhitley at charter.net) Date: Thu, 20 Dec 2001 15:58:06 -0600 Subject: mime decoding Message-ID: While on Christmas vacation I decided to play around with nntp. I've had good success with nntplib and am able to fetch messages from the server without a problem. If the message contains a uuencoded file I can use the python uu.decode() function to decode and store it to disk quickly and simply. However, I've spent most of the afternoon looking at mimetools, rf822, quopri, and mimify and still don't have a good idea of how to proceed for mime messages. Any suggestions would be welcome (please include a short example, if possible). Larry From emile at fenx.com Sun Dec 30 21:00:49 2001 From: emile at fenx.com (Emile van Sebille) Date: Sun, 30 Dec 2001 18:00:49 -0800 Subject: Origin of ly y'rs signature style References: Message-ID: "Michael Hudson" wrote in message news:lkg05s8jo2.fsf at elios.maths.bris.ac.uk... > "Emile van Sebille" writes: > > > I know I've read a good article or post on the origin and adoption > > of the "xx-xx-xx ly y'rs" signoffs brought to the python group by > > Tim Peters. After some searching this morning I couldn't relocate > > that article/post. Does anyone have a link to it? > > There's something about it in AMK's python quotes collection: > > http://www.amk.ca/quotations/python-quotes/index.html > > and there may be something in the Tim Peters shrine: > > http://www.python.org/tim_one/ > Thanks. That got me to this thread, which may have been what I was thinking of. http://groups.google.com/groups?threadm=3dvh4jz0m9.fsf%40amarok.cnri.reston. va.us -- Emile van Sebille emile at fenx.com --------- From gerson.kurz at t-online.de Sat Dec 29 11:16:03 2001 From: gerson.kurz at t-online.de (Gerson Kurz) Date: Sat, 29 Dec 2001 16:16:03 GMT Subject: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> Message-ID: <3c2deb81.11823921@news.t-online.de> On Sat, 29 Dec 2001 19:56:48 +0300, Oleg Broytmann wrote: > Ok, let me call you oldfashioned. Errno chcecking is good in local >context: > > file = open(...) > if not file: report_error() > >But is not so easy to pass errno to upper context. To explain what I mean >I am writing a pice of code using exceptions: > >def top(): > try: > upper() > except IOError: > report_error() > >def upper(): > data4 = lower() > process(data4) > >def lower(): > file = open(...) > retunr file.read(4) > >Now please rewrite the code without exceptions, using errno checking. def top(): if not upper(): return report_error("upper failed()") def upper(): data = lower() if data: process(data) return 1 def lower(): file = open(...) if file: return file.read() report_error("lower failed()") So ? After all, C doesn't need it, and I think few C programmers would call this feature the "most missing", or? From dsavitsk at e-coli.net Sat Dec 8 18:01:34 2001 From: dsavitsk at e-coli.net (dsavitsk) Date: Sat, 08 Dec 2001 23:01:34 GMT Subject: Python and MS SQL server 7.0 References: <9uu5rr$8ed$1@news.worldonline.be> Message-ID: COM is fully supported, so OLEDB, ADO, or whatever MS is trying to sell now should work just fine. -d "ph wuidart" wrote in message news:9uu5rr$8ed$1 at news.worldonline.be... > Hello, > > I am beginner to Python and Tkinter.I interested to have module to connect > MS SQL server 7.0 with Python (not ODBC) > > Thank you for your help. > > ph.w at caramail.com > > > From roy at panix.com Sun Dec 30 11:14:36 2001 From: roy at panix.com (Roy Smith) Date: Sun, 30 Dec 2001 11:14:36 -0500 Subject: REPOST: Re: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> <3C2E498B.6DC757E0@stroeder.com> <3C2E6A51.589E7F1D@earthlink.net> <3C2F2920.89841C81@stroeder.com> Message-ID: <9$--$$_----__-%$-$@news.noc.cabal.int> Michael Stroder wrote: > Seriously, I'm sick of all the security announcements regarding > buffer overflows and such. Not to speak of memory leaks. That's > stone age. On the other hand, a language like Python has its own set of potential security holes. I guess the classic would be some variation on exec(readline()) or eval(readline()). Sure, you're never supposed to write anything like that, but people do it (exactly the same can be said of not checking for buffer overflows in C). If I was a bad guy looking to hack into machines by spoofing servers written in python, I'd throw: os.popen ('echo owned::0:0:YouAreOwned:/:/bin/sh >> /etc/passwd') at every open port I could find and see what happened. Do it to enough machines and you might strike gold eventually. Would you suggest we eliminate eval() and exec() from the language? Maybe taintPython? :-) It's also possible to write memory leaks in python. Consider something like: packetLog = [] while 1: request = getPacketFromSocket() packetLog.append (request) doStuffWithPacket (request) It's pretty dumb to write something like that, but it certainly is a memory leak. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Roy Smith Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:00:24 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774193 27193 211.57.49.2 (31 Dec 2001 04:49:53 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:49:53 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jkraska at san.rr.com Sat Dec 29 16:19:17 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 29 Dec 2001 21:19:17 GMT Subject: Who needs exceptions References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> Message-ID: <1hcs2uogfn6u2s83m33r5a62i1l2mtqt4l@4ax.com> >It also makes more experienced programmers more productive, even if >they never use it (IMHO) as errors below the level of the program >being written never go unhandled *and* unreported, as in C. Indeed. Exceptions fit well with Python, in part because they allow the programmer to write more syntactically compact code than they would if they had to use an alternative. C// From oren-py-l at hishome.net Sat Dec 15 10:38:18 2001 From: oren-py-l at hishome.net (Oren Tirosh) Date: Sat, 15 Dec 2001 10:38:18 -0500 Subject: Take 2: PEP draft for expression embedding Message-ID: <20011215103818.A76724@hishome.net> This new draft should address all the technical issues people here have raised in reponses to my previous draft. This form of string formatting is now called 'expression embedding', not 'string interpolation'. I hope this change of terminology will help highlight the fact that this is not a cosmetic change: embedded expressions are real compiled expressions, not characters in a format string. PEP: XXX Title: Expression embedding Author: oren at hishome.net (Oren Tirosh) Status: Draft Type: Standards Track Created: 15-Dec-2001 Version: 0.2 Abstract This document proposes an expression embedding feature for easier string formatting. The suggested syntax change is the introduction of a new 'e' prefix for strings. Python expressions may be embedded within an e-string, surrounded by backquotes. Example: print e"X=`x`, Y=`calc_y(x)`." Unlike the string interpolation in some other languages and the proposed syntax in PEP 215[1] an expression embedded within a string is not a sequence of characters in the string - it is a real expression. It is syntax-checked at compile time and bytecode is generated for it in the compiled module. Specification A new character prefix "e" is defined for strings. This prefix precedes the "u" and "r" prefixes, if present. Capital "E" is also acceptable. Within an e-string any expressions enclosed in backquotes are evaluated, converted to strings using the equivalent of the str() function and embedded in-place into the e-string. Any valid Python expression may be embedded. To use a literal backquote anywhere within the e-string or embedded expression it must be preceded by a backslash. Discussion A similar proposal for embedding expressions with backquotes was made by Marnix Klooster in a python-list posting [2]. Marnix noted that this is the way it is done in Python's ancestor ABC from which it inherits many features and design decisions. This proposal did not include any mehod to identify strings containing embedded expressions such as the "e" prefix. There is no runtime parsing or runtime compilation of expressions. This results in more efficient execution compared to any form of string formatting which uses eval(). Embedded strings should be fully compatible with proposed future extensions such as optional static typing. Whenever an out-of-band character is used there is the problem of what to do when the programmer wants to literally use that character. The solution here is consistent with the way quotes or any other special characters are embedded in a string: using a backslash escape. Ascaping issues are solved in only one place - the tokenizer. There is no need for one escaping mechanism during compilation with one type of escape character and a different form of escaping at runtime for format strings. There should never be a need for multiple escapes of the backquote character even when an embedded expression contains strings with embedded expressions since the nesting of embedded expressions is at the parser level. In some cases it is useful to create a format template in one place in the program and perform the actual formatting elsewhere. In Python this may be done by passing a format string as an argument and performing the actual formatting later using the % operator. This is actually a form of functional programming. The format string is treated as a function and the '%' formatting operator is equivalent to the apply() built-in function which applies a tuple of arguments to a function. With expression embedding this type of format template may be created using a lambda function whose body is a single e-string. Unlike format strings, e-string lambdas have the flexibility to pass arguments by position or by name, use default values, variable argument lists, reference global names, take advantage of lexical closures and, of course, contain any expression. Implementation notes Most of the logic of expression embedding is in the tokenizer. The example above is broken down into the following tokens: - EMBSTART - NAME <`, Y=`> - EMBCONT - NAME <(> - LPAR - NAME <)> - RPAR <`."> - EMBEND An EMBSTART token instructs the compiler to start a tuple. An EMBCONT is similar to a comma separating items in a tuple and the EMBEND token terminates the tuple. The code generated by this form of formatting may use a new formatting implementation or simply reuse the existing '%' operator implementation as a backend. In this case the EMBSTART, EMBCONT, and EMBEND tokens are concatenated together, any "%" characters in the resulting string are replaced with "%%", the now-empty backquotes "``" are replaced with "%s". Finally, the "%" operator is applied to the resulting string and the tuple. Correctly generating EMBCONT and EMBEND tokens requires some stateful logic in the tokenizer. If the EMBSTART token started with a single quote an EMBCONT and EMBEND may not contain any unescaped single quotes and EMBEND ends with a single quote. Similar rules apply to e-strings with double quotes, triple single quotes and triple double quotes. State 0: Default state. A backquote is BACKQUOTE token. State 1: backquote starts an EMBCONT or EMBEND that ends with ' State 2: backquote starts an EMBCONT or EMBEND that ends with " State 3: backquote starts an EMBCONT or EMBEND that ends with ''' State 4: backquote starts an EMBCONT or EMBEND that ends with """ Reference implementation A reference implementation in the form of a preprocessor for Python sources files is available at: http://www.tothink.com/python/embedpp This preprocessor is based on a modified version of Ka-Ping Yee's tokenize.py module. This implementation does not fully implement backquote escaping. Security Run-time parsing of strings opens many potential security holes. This form of formatting should be secure against this class of attacks. References [1] PEP 215, String Interpolation (Ka-Ping Yee) http://www.python.org/peps/pep-0215.html [2] 1996/11/07 python-list posting (Marnix Klooster) http://groups.google.com/groups?group=comp.lang.python &selm=328195a1.1211700%40news.worldonline.nl Copyright This document is in the public domain. From kragen at pobox.com Sat Dec 1 06:41:04 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 01 Dec 2001 06:41:04 -0500 Subject: A modest indentation proposal References: Message-ID: <831yiftbfz.fsf@panacea.canonical.org> gat at jpl.nasa.gov (Erann Gat) writes: > Yes, of course it's a nit-pick issue. These arguments are not entirely > rational (though I actually do believe this argument has some merit, not > that that matters). These things have as much to do with fashion and > ass-covering than with technical arguments. What languages do "they" find > acceptable? C++. Java is starting to make some inroads, but it's still a > hard sell. C++ for mission-critical applications? What's next --- assembler? TECO? :) I guess that makes the point that the arguments are not entirely rational pretty thoroughly. Are the C++ programmers the ones that cut and paste large blocks of code in mission-critical programs? pindent.py is in the standard Python distribution. It provides exactly what you're asking for: an augmented, backward-compatible representation for Python programs with unambiguous block closers (in this case, comments that look like Ada), and a tool to fix broken indentation using the block closers, to add the block closers to existing programs, and to strip them out from existing programs. Unfortunately, it doesn't seem to be widely used, and it has documented bugs on unusual programs. I think if you're looking for redundant expressions and compile-time consistency checking, Python is not presently the best choice. From aleax at aleax.it Fri Dec 28 06:27:35 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 12:27:35 +0100 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: "Steve Lamb" wrote in message news:slrna2nhfo.nme.grey at teleute.dmiyu.org... > On Thu, 27 Dec 2001 17:48:13 +0000, phil hunt > wrote: > > Python runs quickly on my 300 MHz box, which is 3 times slower > > than the slowest PC you can buy today. It can only get more popular. > > Well, if you take the measure of just pure Mhz.... 4 times slower. ;) FIVE or more. 1.5 GHz desktop machines are hardly news these days. Alex From mertz at gnosis.cx Mon Dec 31 17:52:28 2001 From: mertz at gnosis.cx (Lulu of the Lotus-Eaters) Date: Mon, 31 Dec 2001 17:52:28 -0500 Subject: Python Script In-Reply-To: References: Message-ID: |I have found a python script I wish to use |I use OpenBSD 3.0, which of these |packages do I need to install to get it to run. The |header line is #!/usr/bin/env python2 | | python-2.1.1-threads.tgz | python-2.1.1-tk-threads.tgz | python-2.1.1-tk.tgz | python-2.1.1.tgz | python-tools-2.1.1.tgz One can't tell what you need to install based on what you describe. You'll certainly need the base Python (and I'm not sure whether that OpenBSD distribution will call the executable 'python' or 'python2'; you might need to create a link and/or change the header of the script). Which other packages you'll need depends on which 'import XXXX' or 'from XXXX import YYYY' lines occur in the script. Usually, but not always, these sort of lines occur near the top of the script. These are Python's way of requiring library functions (potentially including some in the other packages you mention, or in packages you do not mention). On the plus side, if running fails, Python gives pretty good traceback messages that give you a quick idea about which imports failed. A few incremental installs should work things out if you want to install the minimum necessary. Yours, Lulu... -- mertz@ _/_/_/_/_/_/_/ THIS MESSAGE WAS BROUGHT TO YOU BY:_/_/_/_/ v i gnosis _/_/ Postmodern Enterprises _/_/ s r .cx _/_/ MAKERS OF CHAOS.... _/_/ i u _/_/_/_/_/ LOOK FOR IT IN A NEIGHBORHOOD NEAR YOU_/_/_/_/_/ g s From robin at jessikat.fsnet.co.uk Mon Dec 24 04:27:11 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Mon, 24 Dec 2001 09:27:11 +0000 Subject: Properties fun with 2.2 References: Message-ID: In article , Mike C. Fletcher writes >For a long time I've wanted a way to define properties for Python >classes that have all the automated checking you'd expect from >properties (in order to automatically create GUIs): ..... >class SimpleProperty( property ): > def __init__( self, name, documentation = "" ): > property.__init__( self, self.getValue, self.setValue, >self.delValue, >documentation ) > self.name = name > def getValue( self, client ): > return client.__dict__[ self.name ] > def setValue( self, client, value ): > client.__dict__[ self.name ] = value > def delValue( self, client ): > del client.__dict__[ self.name ] > >class X( object ): > first = SimpleProperty( 'first', 'testing documentation' ) > ..... very nice. I wondered if this stuff would be easy and it seems it can be. One of the things I need is a collection of properties ie a property P with its own attributes (probably properties themselves) which can be accessed as P[0] ie a thing similar to P, but allowed individual values where these differ from the aggregate. I wonder whether this is more easily done in 2.2. It's quite hard in 2.1. -- Robin Becker From neal at metaslash.com Fri Dec 7 13:04:07 2001 From: neal at metaslash.com (Neal Norwitz) Date: Fri, 07 Dec 2001 13:04:07 -0500 Subject: strict python? References: <3C1060E4.756F33B2@earthlink.net> <3C107172.6866DC18@alcyone.com> <9ups92$ers$1@peabody.colorado.edu> <3C10776C.8BB710EF@alcyone.com> <9upu2a$g4v$1@peabody.colorado.edu> Message-ID: <3C110497.6B9F6BAF@metaslash.com> Fernando P?rez wrote: > While on the topic of pychecker, I've been a bit disappointed. Not > meaning to demerit the developers, I'm sure it's been a ton of hard > work, but when I've used it I tend to get way too many spurious > warnings and very little substance. Well, maybe I just don't know how > to use it well, I really haven't looked at it in detail. Have you tried a recent version? Also have you changed the default behaviour to match your preferences/coding style (or used --errors to report only likely errors). There have been various bugs in the past which led to spurious warnings; however, if problems aren't reported, they aren't likely to be fixed. If you are having problems, I'd be interested to know. Neal From quinn at groat.ugcs.caltech.edu Wed Dec 19 21:14:33 2001 From: quinn at groat.ugcs.caltech.edu (Quinn Dunkan) Date: 20 Dec 2001 02:14:33 GMT Subject: /usr/bin/env: python: No such file or directory References: <9vivft$593$1@peabody.colorado.edu> <171220010818339518%jwbaxter@spamcop.net> <9vnvue$m5d$1@peabody.colorado.edu> Message-ID: On Tue, 18 Dec 2001 20:24:02 GMT, Michael Hudson wrote: >Fernando P?rez writes: > >> It is NOT practical to expect users to write their scripts using >> #!/usr/bin/env python2, simply because that's a weird, redhat only >> default that breaks everywhere else. And what of code they download? >> Now they have to manually inspect every script they get from the web >> to replace python->python2? That's plain moronic. > >No, those scripts should use distutils, which will get it right when >it installs them. > >$ python2 setup.py install --prefix=$HOME > >Everyone should use distutils. All the time. It seems to me like a move from "install with cp" to "install with this complicated system that gropes around your system, mangles the files, etc. and then does cp" is a step backwards. I don't know how much time I've wasted fighting with too-clever install scripts, broken Makefile-mazes that want to rebuild the world every time, GNU configure picking broken settings, setup.py deciding to start using 'gcc -shared' to make shared objects on SunOS when only 'gcc -G' works and what do you edit to change that, and programs which generate perl scripts which generate imakefiles which generate makefiles which generate shell scripts which sed out a bunch of magic tokens in configuration files, which then breaks, etc. etc. when all I really needed was 'cc -c *.c -o program; cp program /usr/local/bin'. Now, of course, this ideal is naive in a world of 13 flavors of unix misimplementing broken POSIX functions in different ways and compilers with two pages of command line flags and mazes of shared libraries. But that's the C world. The way I see it, people should use distutils when they have to, but use plain /bin/cp when they can. I mean no disrespect to the distutils developers, I'm sure it's quite handy when you want to build dynamically loaded C extensions that rely on a few random shared libraries that may or may not have the right functions and who knows where the system is hiding them, etc. Besides, what if distutils goes and changes all your shebangs to python2 but your python scripts are network mounted? From emile at fenx.com Sat Dec 29 10:04:35 2001 From: emile at fenx.com (Emile van Sebille) Date: Sat, 29 Dec 2001 07:04:35 -0800 Subject: REPOST: Re: need help with class of arrays which have attibutes References: <3C2D3C2C.C9EF5AFE@pythonemproject.com> Message-ID: <9$--$$_----___$-_$@news.noc.cabal.int> "Rob" wrote in message news:3C2D3C2C.C9EF5AFE at pythonemproject.com... > > Hi Emile, I've been reading the books and experimenting with different > kinds of classes, but it just doesn't seem possible to use an array as a > basis for a number of class attributes. For example, > wire=conductor (i.e. class) wire[1].x1=30 wire[2].x2=40 etc. Rob. import Numeric class Test: def __init__(self): self.attrs = Numeric.zeros(10) def __repr__(self): return repr(self.attrs) t1 = Test() t1.attrs[2] = 1 t2 = Test() t2.attrs[2] = 2 print t1 print t2 HTH, -- Emile van Sebille emile at fenx.com --------- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Emile van Sebille" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:11:42 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774744 27193 211.57.49.2 (31 Dec 2001 04:59:04 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:59:04 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From greg at cosc.canterbury.ac.nz Wed Dec 5 00:25:42 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Wed, 05 Dec 2001 18:25:42 +1300 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <3C0BE492.5DACEA18@mega-nerd.com> <3C0C55A8.EAD03FD5@cosc.canterbury.ac.nz> Message-ID: <3C0DAFD6.7183E99E@cosc.canterbury.ac.nz> Steve Lamb wrote: > > Mixing tabs and spaces? You just suggested mixing tabs and spaces. No, I didn't -- not for block indentation, which is where it matters. > Thank you for finally seeing reason and maybe now you'll > understand why tabs are NOT to be used. If it's all the same to you, I think I'll continue to use tabs for indentation and spaces for cosmetics on the Mac, which works perfectly well with the editors I use there, even though I should apparently be "understanding" that it won't. :-) -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From ws at mystrobl.de Wed Dec 26 04:31:06 2001 From: ws at mystrobl.de (Wolfgang Strobl) Date: Wed, 26 Dec 2001 10:31:06 +0100 Subject: urllib checks IE settings for proxy but ignores useful 'ProxyOverride' key References: <13dc97b8.0112252045.36a0697@posting.google.com> Message-ID: On 25 Dec 2001 20:45:24 -0800, abulka at netspace.net.au (Andy Bulka) wrote : >It seems that urllib.py has the smarts to look up the proxy settings >in the windows registry settings that you control via the IE browser. >It checks the keys 'ProxyEnable' and 'ProxyServer' (to get the actual >proxy host/port value). > >But urllib.py does NOT have the smarts to check the key >'ProxyOverride' which has a range of tcp ip addresses to NOT use >proxies on, as well as whether to bypass proxies for local addresses >(the value of the key 'ProxyOverride' contains '' if this >option is turned on). > >Surely this is an important omission and should be introduced into the >next version of python? Well, after adding ProxyOverride support myself, a few weeks ago, I noticed that a similar fix could have been found in the CVS repository, already, since August :-) It has been added in 1.129. See http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/python/dist/src/Lib/urllib.py.diff?r1=1.128&r2=1.129 resp. http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/python/dist/src/Lib/urllib.py -- Wir danken f?r die Beachtung aller Sicherheitsbestimmungen From ben at wblogan.net Sat Dec 8 16:24:55 2001 From: ben at wblogan.net (Ben Logan) Date: Sat, 8 Dec 2001 16:24:55 -0500 Subject: help with regular expression In-Reply-To: ; from jason@jorendorff.com on Sat, Dec 08, 2001 at 12:36:29PM -0600 References: Message-ID: <20011208162455.A27993@newcreature.org> Thanks, that worked. I did modify it so that the >> can be anywhere within quotes, not just by themselves. Next, I'll have to take into account whether or not the quote is a backslash-escaped one. I think I can work through that one, but I'll yell if I can't. ;) Regards, Ben On Sat, Dec 08, 2001 at 12:36:29PM -0600, Jason Orendorff wrote: > > I am writing a program in which I need to search an arbitrary string > > and return the part between a certain opening sequence, and a closing > > sequence. [...] I want to be able to "escape" the ending > > sequence with either double quotes (">>") or single quotes ('>>'). > > r"""<<(('>>'|">>"|>(?!>)|[^>])*)>>""" > > See http://www.python.org/doc/current/lib/re-syntax.html > for the meaning of (?!>). > -- Ben Logan: ben at wblogan dot net OpenPGP Key KeyID: A1ADD1F0 From pete at shinners.org Sat Dec 15 06:58:49 2001 From: pete at shinners.org (Pete Shinners) Date: Sat, 15 Dec 2001 11:58:49 GMT Subject: Games Made w/ Python References: <9v9gss$5hr$1@nntp9.atl.mindspring.net> <3C18F716.5010803@shinners.org> <3C1B38A7.5020806@mac.com> Message-ID: <3C1B3C84.2060404@shinners.org> jorjun wrote: > Is Mac OS X support possible? pygame _should_ work fine on osx, since all the dependencies run there. the only thing holding it back is getting distutils to compile on osx. pygame uses distutils for the install, which has been very good on unix and windows platforms. unfortunately macos and osx support aren't really "there yet". i believe i've heard python-2.2 is supposed to release with a much friendlier osx distutils. actually, when i say all the dependencies work on osx, that isn't quite true. some of the sdl libraries like SDL_image can't properly compile to a shared library on osx. this is supposedly already fixed though, and waiting for the next release. i'm hoping in a month or two we'll have everything in place for full osx support. From shriek at gmx.co.uk Sun Dec 23 02:13:18 2001 From: shriek at gmx.co.uk (Stephen) Date: 22 Dec 2001 23:13:18 -0800 Subject: MySQLdb "Illegal instruction" error. Message-ID: <97ae44ee.0112222313.1d1c71d6@posting.google.com> Just installed MySQL-python-0.9.1-1py2.i386.rpm on Redhat7.2. It seemed to install without problem but as soon as I tried to use it with Python, it crashed bring down the Python interpreter. >>> import MySQLdb >>> d = MySQLdb.connect("", "test", "", "") Illegal instruction I can confirm that the MySQL database 'test' can be accessed by anybody on localhost (as well as any other host) using the mysql client. So, I think it must be MySQLdb on my system. Has everybody else had no problems whatsoever with MySQLdb RPM ? Any guesses what could be the matter, or else I'll have to roll back to MySQLmodule and Python1.5.2 since it's pretty urgent :( that's assuming anybody else is still working or online at this time of year. Stephen. From jgardn at alumni.washington.edu Mon Dec 3 19:56:31 2001 From: jgardn at alumni.washington.edu (Jonathan Gardner) Date: Tue, 4 Dec 2001 09:56:31 +0900 Subject: Linux Kernel Design and Why Python is Rad In-Reply-To: <9ugc0h$n9t$1@slb1.atl.mindspring.net> References: <9ugc0h$n9t$1@slb1.atl.mindspring.net> Message-ID: <200112040103.fB413jJ00379@my.knctv.co.kr> The following is a lot of wind. Just read the article at kerneltrap.org, you'll probably enjoy hearing it from the horse's mouth rather than my own interpretation. On Tuesday 04 December 2001 02:14 am, Andrew Dalke wrote: > Jonathan Gardner: > > Linus Torvalds on design: "Nothing successful has every been > > designed. It has evolved." > > > > Everyone else: "No wait a minute, that's not what this book > > says! And that's not what my teacher said!" > > Now, which books say that? "Rapid Development" is very > explicit that all the design models, even the classic > waterfall design, have a way to back up from mistakes. > It might be slower than other development models, but > it's even useful in some cases, like writing the Nth > iteration of a salary accounting package where all the > requirements and dependencies are well known. > "Code Complete", and other great classics of Computer Black Magic (I refuse to call it a science yet...) emphasized that you had to spend something like 4 times as much time designing than coding, with that factor increasing for larger projects. it also emphasized strict testing procedures and stricter coding standards and such. There was (and still is!) this idea that before you touch the keyboard with a line of code, you should have everything figured out one way or another. The sad truth is that no one knows what they are doing, not even Linus, not even Bill Gates. You have to go out and implement it before you can decide whether it was worth doing. "Rapid Development" (if what I understand is true, not having bought the tome yet) emphasizes small design steps, quick implementation, and solid evaluation. This is more along the lines of evolution. The one thing that Linus stressed that I understand RD misses is the idea of trying many things out simultaneously. On the Kernel Project, you have several independent teams, some of which are working on similar parts of the Kernel. They are all writing code, sometimes making their own forks, and overall what you get is a community effort to try all these things out, and you as the user get the cream of the crop. For instance, the VM discussion they had a while ago. Well, some guys (I know it wasn't just one, and there may have been several more attempts) just up and went and wrote a new VM machine. Linus decided to pick the one that he thought worked the best. However, the old VM machine is still alive in the ac fork. > Coming from the other side, all designs have been built > from knowledge gained in previous work. "Evolved" in > its most precise sense means "changed over time." > (NOT "improved over time".) So by definition I agree > that everything successful has been evolved. Then > again, so has everything unsuccessful. > > > Conclusion: this argument is based on a false dichotomy. > Design helps minimize the chance of being unsuccessful, > and goes hand-in-hand with the evolution of software. > Maybe you should read the posts at kerneltrap before you are so sure about this. Sun is dying precisely because of strict design. They only have one "species" and that is a very specialized one that can only survive in odd situations. Their species cannot adapt because they cannot try out many different things at once. Microsoft built their species by trial and error. They completely overhauled the kernel and structure of windows how many times? While they satisfy many people, they cannot satisfy all people. The Linux Kernel however, has the ability to try many things at once. Some of the results are good, and some are bad. You throw out the bad (or rework them) and you try to figure out why the good is so good. Then you do it all again. What you end up with is satisfying everyone with a superior product because you have actually tried out several things at once. Design is not totally useless - it is uselful for small projects or small changes, but it can easily get out of hand and become a burden not worth its weight if it is used for large projects or large schemes. Linus never designed anything for the kernel on a large scale - he claims he can barely understand what it does himself, so how can he be expected to say where it is going or what it should be able to do? And if he were to offer such a statement, what are the chances of him being right? So design becomes pointless at a certain point. Jonathan > Andrew > dalke at dalkescientific.com From preben_er_t0ff at hotmail.com Tue Dec 11 16:02:42 2001 From: preben_er_t0ff at hotmail.com (Preben) Date: Tue, 11 Dec 2001 21:02:42 GMT Subject: input Message-ID: How do I make a unbufferedinput from the user? (So they don't have to hit enter to send) Is it possible to make it so that you don't see what you're typing.. e.g. to logins? or maybe replacing the output with * ?? From akuchlin at mems-exchange.org Tue Dec 11 11:47:42 2001 From: akuchlin at mems-exchange.org (Andrew Kuchling) Date: 11 Dec 2001 11:47:42 -0500 Subject: lost interest? References: <20011208001123.A5989@casa.parque> <3C14FEBD.AD52B516@attbi.com> Message-ID: <3dzo4pputt.fsf@ute.mems-exchange.org> Skip Montanaro writes: > CPAN is marvelous. The way the Perl and Python communities operate, it > fills a niche perfectly in the Perl world, but I think would be a bit of a > solution looking for a problem in the Python world. Also, those of us using Debian already have dependency information for Python modules through apt. It's not much fun to do a lot of work implementing a parallel Python solution that will still be less functional, as apt will also handle dependencies on non-Python software or libraries, a difficult task for a Python-only system. Switching to Debian has neatly killed my urge to work on a catalog. --amk (www.amk.ca) The cheeseboard is the world, and the pieces the phenomena of the universe, as my old friend Huxley used to say. Cheeseboard? -- The Doctor, in "Logopolis" From kragen at pobox.com Sat Dec 1 18:40:51 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 01 Dec 2001 18:40:51 -0500 Subject: Whatever happened to String Interpolation? References: <9u6dbn$nsj$1@peabody.colorado.edu> <9u6kft$5b$1@peabody.colorado.edu> <9ubecn$ped$1@peabody.colorado.edu> Message-ID: <837ks6se4c.fsf@panacea.canonical.org> Skip Montanaro writes: > (or something else similar) which isn't all that readable either. You just > happen to want to embed literal %-signs in your strings. Please correct me > if I'm wrong, but changing the character that introduces a value to be > interpolated just moves the problem around a bit. I don't think it solves > anything. Ping's PEP has some advantages over %-syntax; in the common case of interpolating a variable, you need only type $var, rather than %(var)s, and in the less-common case of wanting to interpolate an expression evaluated in the current namespace, you can do that too, still with one less noise character than the % syntax allows. (I have a module that lets you evaluate arbitrary expressions with the % syntax, and I've heard other people have written them too.) In short, if %s and $s are equally frequently desired literal characters, the syntax is less noisy, which I think is important, given the importance of the task. I don't have any idea which one is more common, myself. From chris.gonnerman at newcenturycomputers.net Sun Dec 2 18:57:36 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Sun, 2 Dec 2001 17:57:36 -0600 Subject: Newbie : Installing Python locally in acct on shared server References: <3C0A3F04.3090206@lophty.com> <3C0A5717.1040508@lophty.com> Message-ID: <00de01c17b8d$3473e420$0101010a@local> ----- Original Message ----- From: "brian donovan" > Hi Chris, > > Yes, the below should work, but it doesn't. :( I just did the steps as > outlined below and I'm getting the same bizarre result as previously. A > helloworld script composed of a few print statements and ointed at my > install executes without a hitch, but importing a module causes a "500 > Internal Server Error". :/ Ah, so. You need to look at the apache error log (httpd.error_log) to see what the problem is. Please report back with the error log message, and we'll be happy to help. From michael at stroeder.com Sat Dec 29 09:08:19 2001 From: michael at stroeder.com (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Sat, 29 Dec 2001 15:08:19 +0100 Subject: CGI form repost from browser--how to prevent? References: Message-ID: <3C2DCE53.AF5477E3@stroeder.com> Andreas Kostyrka wrote: > > On Tue, Dec 11, 2001 at 10:51:53AM -0800, Chris wrote: > > I'm writing a Python cgi script that does some inserts into a mysql > > database based on data in an html form submitted by a user. Is there > > any way to prevent the browser from reposting the data from the form > > when the user hits refresh in the browser after they have submitted > > the form? When this happens, the script receives the same cgi form > > data and performs the same inserts on the database. I think maybe > > this can be prevented by storing some state info with cookies?? Not > > sure (have never used cookies). Any ideas on an easy way to prevent > > this? > Make it a POST Method. This way a standard conforming browser has to ask > permission from the user to repost the data. Which doesn't prevent the user from hitting the button "Yes, resend form". BTW: Chris already said "to prevent the browser from reposting". If it's crucial for the data integrity the server-side CGI-BIN part has to cross-check the input against existing data. There's no general solution without knowing details about the data model. Also the [Back] button and "Open Link in New window" are things to consider. Ciao, Michael. From garry at sage.att.com Tue Dec 4 15:16:50 2001 From: garry at sage.att.com (Garry Hodgson) Date: Tue, 4 Dec 2001 20:16:50 GMT Subject: enough with the spaces and tabs, already Message-ID: <3C0D2F32.A67702BC@sage.att.com> would you people *please* get a life? yeesh! -- Garry Hodgson Let my inspiration flow Senior Hacker in token rhyme suggesting rhythm Software Innovation Services that will not forsake me AT&T Labs 'til my tale is told and done. garry at sage.att.com From donn at u.washington.edu Tue Dec 11 14:50:48 2001 From: donn at u.washington.edu (Donn Cave) Date: 11 Dec 2001 19:50:48 GMT Subject: reference counting for garbage collection References: <1008011593.29363.0.nnrp-10.c1c3e1d9@news.demon.co.uk> Message-ID: <9v5o2o$mfo$1@nntp6.u.washington.edu> Quoth pinard at iro.umontreal.ca (=?iso-8859-1?q?Fran=E7ois?= Pinard): ... | In the meantime, I much prefer the elegance of concision, | and beg to consider this good style. :-) I couldn't have said it better. Donn Cave, donn at u.washington.edu From yuvale at radware.com Sun Dec 30 11:00:54 2001 From: yuvale at radware.com (yuval) Date: 30 Dec 2001 08:00:54 -0800 Subject: Tkinter gui for the winnt subst command Message-ID: <11f1fe5.0112300800.680cb872@posting.google.com> I need to map and remap (cmd.exe subst ...) certain directories on my computer very often. Therefore I wrote a Tkinter gui which upon button press performs essentially cmd.exe /c subst ... with various arguments. I tried several approaches (os.popen, os.system,spawnv) for running the command. Unfortunately with all these approaches it takes the command a very, very long time (~30 seconds) to complete. I am running Python 2.1. Does anybody know where the problem lies and how to solve it? From rburnham at cri-inc.com Fri Dec 14 10:35:12 2001 From: rburnham at cri-inc.com (Roger Burnham) Date: Fri, 14 Dec 2001 15:35:12 GMT Subject: [help] Driving Visual Studio From Python References: <3C0332D0.8C7BC844@eds.com> Message-ID: <3c1a1adf.5899743@news-server.socal.rr.com> Michael, This might get you started: ---------------------file MakeVCProjs.py--------------------- import sys import win32ui import win32com from win32com.client import gencache import string projects = { r'00 C:\DevSrc\Python\Cri\CRILicenseDLL\CRILicenseDLL.dsw': ('CRILicenseDLL',), r'01 C:\DevSrc\CRI\ColorEditToolRes\ColorEditToolRes.dsw': ('ColorEditToolRes',), r'03 C:\DevSrc\CRI\FPAssistantRes\FPAssistantRes.dsw': ('FPAssistantRes',), r'04 C:\DevSrc\CRI\LCCalibRes\LCCalibRes.dsw': ('LCCalibRes',), r'04 C:\DevSrc\CRI\LCDiodeCalibRes\LCDiodeCalibRes.dsw': ('LCDiodeCalibRes',), #...many elided... } def DoBuild(app, workSpace, projectList, configSuffix, force): if app is None: app = win32com.client.Dispatch('MSDev.Application') app.Visible = 1 docs = app.Documents docs.CloseAll print 'Open workspace', workSpace docs.Open(workSpace, 'Auto', 1) tailLen = len(configSuffix) for projectName in projectList: print ' looking for', projectName, '...', projects = app.Projects for project in projects: projFound = 0 if str(project.Name) == projectName: projFound = 1 print print ' looking for config', configSuffix, '...', for config in project.Configurations: confFound = 0 name = str(config.Name) if name[-tailLen:] == configSuffix: confFound = 1 print if force: print ' Forcing build ', name, '...' app.ReBuildAll(config) else: print ' Updating build ', name, '...' app.Build(config) if app.Errors > 0: win32ui.MessageBox('Error building %s' % name) raise SystemExit break if not confFound: print '-- NOT Found' break if not projFound: print '-- NOT Found' def main(config='Release', force=0): mod = gencache.GetModuleForProgID('MSDev.Application') if mod is None: win32ui.MessageBox('''Could not import MSDev.Application: You probably need to run the COM makepy utility to regenerate the VC++ Shared Objects (6.0) interface''') raise ImportError app = win32com.client.Dispatch('MSDev.Application') app.Visible = 1 projectList = projects.keys() projectList.sort() for workSpaceID in projectList: num, workSpace = string.split(workSpaceID) DoBuild(app, workSpace, projects[workSpaceID], config, force) if __name__ == '__main__': import sys config = 'Release' force = 0 for arg in sys.argv[1:]: if arg in ('Release', 'Debug'): config = arg if arg in ('Force',): force = 1 main(config, force) ---------------------file MakeVCProjs.py--------------------- On Tue, 27 Nov 2001 01:29:36 -0500, Michael Schneider wrote: >This is a multi-part message in MIME format. >--------------4A98C5CDD83E4669F72F9746 >Content-Type: text/plain; charset=us-ascii >Content-Transfer-Encoding: 7bit > >Hello All, > >I am an old unix developer finally moving to Windows Visual C++. I have >been using python on Unix since 96, >and have been really happy with python as a scripting/tools language. > >I need to drive visual studio to create projects, add configurations, >and add files to projects. > >The COM extensions make it look like it is possible to do this, but I >am having trouble getting >it going. > >I have ran makepy and added the visual studio type libs. > >I copied the following code from a post > >----------------------------------------- >import win32com.client >app = win32com.client.Dispatch( 'MSDev.Application') > >wnd = app.ActiveWindow >if wnd.Type == 'Text': > print wnd.Selection >app = None >------------------------------------------ > >This prints on the selected test. > >I can't seem to get the syntax to obtain and print out project >properties, or to add a project > > >Could someone help my out by giving me the python code to try to get >this to go, I am missing something >very basic here. > >Thanks >Mike > >PS. I added the MSDEV links to the visual studio docs >++++++++++++++++++ >DeveStudio Link to add project > >http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcug98/html/vcrefaddprojectmethod.asp > >Link to Visual Studio Application Object > >http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcug98/html/_asug_application_object.asp > >--------------4A98C5CDD83E4669F72F9746 >Content-Type: text/x-vcard; charset=us-ascii; > name="Michael.L.Schneider.vcf" >Content-Transfer-Encoding: 7bit >Content-Description: Card for Michael Schneider >Content-Disposition: attachment; > filename="Michael.L.Schneider.vcf" > >begin:vcard >n:Schneider;Michael >tel;work:513-576-2935 >x-mozilla-html:FALSE >adr:;;;;;; >version:2.1 >email;internet:Michael.L.Schneider at eds.com >fn:Michael L Schneider >end:vcard > >--------------4A98C5CDD83E4669F72F9746-- > Roger Burnham rburnham at blennylips.com From roymath at yahoo.com Sun Dec 2 16:09:29 2001 From: roymath at yahoo.com (Roy Mathew) Date: 2 Dec 2001 13:09:29 -0800 Subject: variable scoping across imports? References: <7b408077.0112010826.47a6a758@posting.google.com> <3C093C3F.10AB6FF0@earthlink.net> <83adx2sela.fsf@panacea.canonical.org> Message-ID: <7b408077.0112021309.364bccb1@posting.google.com> "Fredrik Lundh" wrote in message > more here: > ... > http://effbot.org/guides/import-confusion.htm > > Folks, Thanks for the responses; Fredrik Lundh's response was the most helpful. From the URL resource he references, I realized that there are actually 3 imports going on, and not just 2 as one would initially assume. They are: "x.py" as __main__ "x.py" as x "y.py" as y Hence, there really are 2 "z0" variables alive; one belonging to the __main__ namespace and the other belonging to the "x" namespace. Thanks for the nice clear explanation, Fredrik. By rearranging things thus, I am able to get what I expected. Incidentally the whole motivation for this scheme was to simulate "class" variables - ie: have "z0" act as a static variable. # ------ file x.py ------------------------------------------------ z0 = None import y def set(): global z0 z0 = 33 # ------ file y.py ------------------------------------------------ import x def show(): print x.z0 # ------ file z.py ------------------------------------------------ import x, y y.show() x.set() y.show() # ----------------------------------------------------------------- Now, running "python z.py" yields what I had wanted. Thanks, Roy Mathew. From rpm1deletethis at frontiernet.net Sat Dec 8 17:10:42 2001 From: rpm1deletethis at frontiernet.net (RPM1) Date: Sat, 8 Dec 2001 17:10:42 -0500 Subject: It's hard to find documentation References: Message-ID: "Bruce Eckel" wrote in message news:mailman.1007846893.21886.python-list at python.org... > Here's an example. In the Python FAQ, there's a reference (no URL) > to a document: > 5.1. Can I create my own functions in C? > Yes, you can create built-in modules containing functions, > variables, exceptions and even new types in C. This is explained in > the document "Extending and Embedding the Python Interpreter" (the > LaTeX file Doc/ext.tex). Also read the chapter on dynamic loading. > > So let's try to find "Extending and Embedding the Python > Interpreter". Using 'search,' using 'advanced search,' nothing > comes up with that title. Maybe it doesn't exist. Who knows. I have > this struggle a lot when hunting for python information. Hmm, all I have to do on windows is click on: start->programs->python 2.1->python manuals then click on "Extending and Embedding" From usenet at thinkspot.net Sat Dec 29 16:57:00 2001 From: usenet at thinkspot.net (Sheila King) Date: Sat, 29 Dec 2001 13:57:00 -0800 Subject: REPOST: Re: Was that to inpolite? Re: Call for a small program References: <3C2BAEF3.CC34B8DD@htp-tel.de> <3C2E0D55.9EC9B67F@htp-tel.de> Message-ID: <8$--$$_----___$-_$@news.noc.cabal.int> On Sat, 29 Dec 2001 19:37:09 +0100, Tom Karas wrote in comp.lang.python in article <3C2E0D55.9EC9B67F at htp-tel.de>: > > A few quick questions: > > Was my "Call" to inpolite? > > Was it the wrong place / newsgroup to ask? I cannot find the post you are referring to. It did not appear on any of the three news servers from which I retrieve this newsgroup. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Sheila King Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:07:38 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774541 27193 211.57.49.2 (31 Dec 2001 04:55:41 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:55:41 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From tim.one at home.com Sun Dec 2 03:57:12 2001 From: tim.one at home.com (Tim Peters) Date: Sun, 2 Dec 2001 03:57:12 -0500 Subject: Do 2.2 and 2.1.1coexist well? In-Reply-To: Message-ID: [Ron Turner] > Is it safe to install and run both 2.2 and 2.1.1 on the same machine? I > realize that the directory structures are nicely separated, but I am not > certain whether there may be DLLs or other files that would cause > contention or loss of state. We don't seek to launch simultaneous > sessions. We just need to maintain the two installations, if possible. You're apparently running on Windows. Whether it's "safe" depends entirely on what you do. For example, due to the way Windows works, file extensions (like .py and .pyw) can be associated with only one executable, so if you're relying on stuff like "start program.py" working from a DOS box, it will pick up whichever version of Python you installed most recently. I personally never use the registry for anything related to Python (including file extensions -- I never rely on them), and have at least half a dozen versions of Python installed on my Windows box. No problem. > Related: Does the "Non-Administrative Install" option (under Advanced > Options in the 2.2 Wise Install Wizard) offer a straightforward way to > ensure the separation described above? That directs the DLLs to > be installed within the 2.2's own directory structure. The Windows Python DLLs for 2.2 and 2.1.1 have different names, so there's no conflict there. Depending on user privilege and OS, it may not be *possible* to install the Python DLL into a system directory, and the Non-Admin install option is more aimed at that. Non-Admin install also writes registry info under HKEY_CURRENT_USER instead of HKEY_LOCAL_MACHINE, which is again partly an issue of privilege, but also on Win2K is a way for each user on a machine to have their own file associations (a new feature in Win2K; can't be done under earlier OSes). From hgg9140 at seanet.com Fri Dec 28 16:09:31 2001 From: hgg9140 at seanet.com (Harry George) Date: 28 Dec 2001 13:09:31 -0800 Subject: REPOST: ANN: mkpythonproj 1.4 Message-ID: <6$--$$_----__-$%_$@news.noc.cabal.int> mkpythonproj generates full GNU-style projects, with setup,py, unittest-style tests, pydoc-compliant modules, and additional documentation. Individual modules can also be generated (e.g., after a project has been started). The structure of the modules is driven by templates. See: http://www.seanet.com/~hgg9140/comp/mkpythonproj-1.4/doc/index.html Download from: http://www.seanet.com/~hgg9140/comp/ Recent changes: 2001-12-28: v1.4 - Converted basic documentation to GNU style text files (CHANGES, README, etc.). 2001-10-30: v1.3 - Seperated "BODY" template, so other bodies can be used. - Provide for alternative #!commands -- Harry George hgg9140 at seanet.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.cwix.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Harry George Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:42:00 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774278 27193 211.57.49.2 (31 Dec 2001 04:51:18 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:51:18 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From phd at phd.pp.ru Sat Dec 8 07:37:23 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Sat, 8 Dec 2001 15:37:23 +0300 Subject: python log() function In-Reply-To: <9ut07m$qni$1@plutonium.btinternet.com>; from Duxbuz@bbtinternet.com on Sat, Dec 08, 2001 at 12:16:15PM -0000 References: <9ut07m$qni$1@plutonium.btinternet.com> Message-ID: <20011208153723.A25544@phd.pp.ru> On Sat, Dec 08, 2001 at 12:16:15PM -0000, Ian wrote: > Hello I am new to python and am trying to use it to work out a sum > log(20/7) / log(2) > which gives result > 1.0 > > I am expecting to get 1.51 as a result, and using different langs such as > perl or php, I get the desired result of 1.51 > > It seems to me that python only goes to a certain decimal place, not as much > as the other compilers, can this be altered in anyway? phd at phd 1 >> python Python 2.1.1 (#1, Aug 8 2001, 19:17:29) [GCC 2.95.2 20000220 (Debian GNU/Linux)] on linux2 Type "copyright", "credits" or "license" for more information. >>> 20/7 2 This is integer division. So you've calculted log(2)/log(2) :) Use floting point division: 20.0/7. phd at phd 3 >> python Python 2.1.1 (#1, Aug 8 2001, 19:17:29) [GCC 2.95.2 20000220 (Debian GNU/Linux)] on linux2 Type "copyright", "credits" or "license" for more information. >>> from math import log >>> log(20.0/7)/log(2) 1.5145731728297582 Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From dsavitsk at e-coli.net Wed Dec 5 12:49:46 2001 From: dsavitsk at e-coli.net (dsavitsk) Date: Wed, 05 Dec 2001 17:49:46 GMT Subject: COMServer graphical output References: Message-ID: <_6tP7.5693$Rw2.4095674@newssrv26.news.prodigy.com> It doesn't seem that this is a COM question at all? The COM server should get the data from Access, do whatever to the data, then return it as per normal. If the data is being changed in transit try pickling it first. The server itself shouldn't have a GUI. It should just be an object like any other. In fact, if the server is written in Python, and the client is written in Python, and both are on the same computer (i.e. not DCOM), using COM is probably not the best idea. The server should be a COM client as well as a Python server, but this won't alter its doing work on the graphic and returning it to a client. -doug "Jens Gelhaar" wrote in message news:efc75b6a.0112050218.3b957d9a at posting.google.com... > Hi, > > has some one a hint for me, how to create an graphical output from a > COMServer. To be more specific, I would like to create an COMServer, > which receives some data from ACCESS and return an chart (PIDDLE-GIF) > to be shown on the form. But I did not find anything usefull about > this subject, how to transfer binary data or an image thru the COM > Interface. > > Thanks Jens From jgardn at alumni.washington.edu Sun Dec 23 06:19:56 2001 From: jgardn at alumni.washington.edu (Jonathan Gardner) Date: Sun, 23 Dec 2001 20:19:56 +0900 Subject: vi or emacs for editing Python on Linux? In-Reply-To: References: Message-ID: <200112231119.fBNBJAJ02753@my.knctv.co.kr> On Saturday 22 December 2001 07:25 am, maxm wrote: > > I know this is close to religion. But are there any rational reasons to use > one instead of the other for Python? > Not really. The major difference now is where the keys are on the keyboard. With emacs, you usually end up using ctrl-x something, but with Vim, you have to get used to different states. As for the missing functionality in Vim, you still have it - it's just in other programs in the unix environment. So you probably won't be as effective with Vim unless you are in a unix environment (basically anything but windows.) Bottom line: You have to spend at least a week using both editors before you can make a good decision. Using either one is a serious undertaking. They aren't designed for casual [l]users. They are designed for people who are serious about programming and serious about doing it as effectively as possible. Whatever you choose, spend a lot of time learning it and committing stuff to memory and such. Jonathan From tim at vegeta.ath.cx Tue Dec 18 13:07:58 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Tue, 18 Dec 2001 18:07:58 GMT Subject: Python equivalent to @lines = 'command'; References: <9vnut1$lck$1@peabody.colorado.edu> Message-ID: Fernando P?rez graced us by uttering: [ snip ] > could anyone comment on the benefits/differences between the > popen() approach and using > output = commands.getoutput(cmd) ? > > Or is getoutput() just a popen() call with another name? According to my Python docs, the commands module is *nix-specific, while os.popen() is notably cross-platform. Tim Hammerquist -- How dare the government intervene to stifle innovation in the computer industry! That's Microsoft's job, dammit! From tjreedy at home.com Thu Dec 20 09:06:15 2001 From: tjreedy at home.com (Terry Reedy) Date: Thu, 20 Dec 2001 14:06:15 GMT Subject: Comunicating through COM ports References: Message-ID: Comunicating through COM portsIn C, as I remember, one uses "COM1:", "LPT:" (notice colon) etc as filename in regular open function. Believe same in Python since passes thru to C function. If not, someone will correct me. Then write as usual. Terry J. Reedy "Alves, Carlos Alberto - Coelce" wrote in message news:mailman.1008852145.28654.python-list at python.org... Anybody could give me an example code of how connect/comunicate through COM ports (i.e. COM1, COM2). I'm under windows 98 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkraska at san.rr.com Fri Dec 14 23:04:20 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 15 Dec 2001 04:04:20 GMT Subject: Wrap C function which takes variable lengthed parameters? References: <6p5j1u0oag2ofkam8o7fig5dvkfc2392hk@4ax.com> <3C19990E.BE0F3FA@alcyone.com> <3C19AC0B.7ABD04DF@xs4all.nl> <1gbj1u8pm1t63ao6bjq98jlh66glf78fnu@4ax.com> Message-ID: >And I really hope python will provide some way to ease >the wrapping on varargs functions some day. But it is >hard. It's a C problem, not a Python problem. Since Python itself is coded in C, there will never be any easy, portable solution to what you describe. Obviously this could be handled by writing machine-specific inline assembly, however I'm not convinced the value gained is worth the downside. C?/ From lynn at garlic.com Fri Dec 28 20:28:38 2001 From: lynn at garlic.com (Anne & Lynn Wheeler) Date: Sat, 29 Dec 2001 01:28:38 GMT Subject: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> Message-ID: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) writes: > Actually I believe rfc765 and rfc959 (FTP protocol) is superceded by > rfc1123 which outlines and corrects the specifications for the ftp, telnet, > smtp, and dns protocols. In particular interest to me, rfc1123 indicates that > pasv responses in the ftp protocol don't have to have the format of > 227 (h1,h2,h3,h4,p1,p2). This was something that the python ftplib assumed until > the 2.2 release and which caused problems with anonftpd. reference: http://www.garlic.com/~lynn/rfcietff.htm & click on RFCs that are also "Standards (STD)" and scroll down to STD-9 Note that most fields are "clickable" for instance FTP brings up: FTP - (Stan) - File Transfer Protocol [port:21] 959 (STD-9) - File Transfer Protocol 1415 - FTP-FTAM Gateway Specification clicking on the ".txt" field will retrieve the actual RFC. Clicking on various RFC nos &/or STD references will bring up the appropriate information. Various processes also do cross-checking of released rfc status as well as information released in new STD1s for consistency. The "Obsoleted" section use to appear as "Section 6.10" in earlier STD1s. ============================= STD-9 959 (Stan) - File Transfer Protocol (FTP) 959 is the "standard" 959 S File Transfer Protocol, Postel J., Reynolds J., 1985/10/01 (69pp) (.txt=147316) (STD-9) (Updated by 2228, 2640, 2773) (Obsoletes 765) (Ref'ed By 2389) (FTP) 959 has current updates 2228, 2640, & 2773 ... and is also ref'ed by 2389 2259 PS File Transfer Protocol, Postel J., Reynolds J., 1985/10/01 (69pp) (.txt=147316) (STD-9) (Updated by 2228, 2640, 2773) (Obsoletes 765) (Ref'ed By 2389) (FTP) 2259 is currently in proposed standard state 2640 PS Internationalization of the File Transfer Protocol, Curtin B., 1999/07/28 (27pp) (.txt=57204) (Updates 959) 2640 is currently in proposed standard state 2773 E Encryption using KEA and SKIPJACK, Housley R., Nace W., Yee P., 2000/02/14 (9pp) (.txt=20008) (Updates 959) 2773 is experimental 2389 PS Feature negotiation mechanism for the File Transfer Protocol, Elz R., Hethmon P., 1998/08/21 (9pp) (.txt=18536) (See Also 959) and 2389 is proposed standard state ... but doesn't update 959 but refers to it. ========================= ... also STD-3 STD-3 1122 (Stan) - Requirements for Internet hosts - communication layers 1123 (Stan) - Requirements for Internet hosts - application and support 1123 S Requirements for Internet hosts - application and support, Braden R., 1989/10/01 (98pp) (.txt=239721) (STD-3) (Updated by 2181, 2821) ... 1123 is standard but doesn't directly update FTP or 959 ... but does list requirements for Internet hosts - application and support, which is also updated by 2181 PS Clarifications to the DNS Specification, Bush R., Elz R., 1997/07/31 (15pp) (.txt=36989) (Updated by 2535) (Updates 1034, 1035, 1123) (DNS-CLAR) 2181 is proposed standard status 2821 PS Simple Mail Transfer Protocol, Klensin J., 2001/04/24 (79pp) (.txt=192504) (Obsoletes 821, 974, 1869) (Updates 1123) (SMTP) ==================== from 1123: 4. FILE TRANSFER 4.1 FILE TRANSFER PROTOCOL -- FTP 4.1.1 INTRODUCTION The File Transfer Protocol FTP is the primary Internet standard for file transfer. The current specification is contained in RFC-959 [FTP:1]. FTP uses separate simultaneous TCP connections for control and for data transfer. The FTP protocol includes many features, some of which are not commonly implemented. However, for every feature in FTP, there exists at least one implementation. The minimum implementation defined in RFC-959 was too small, so a somewhat larger minimum implementation is defined here. Internet users have been unnecessarily burdened for years by deficient FTP implementations. Protocol implementors have suffered from the erroneous opinion that implementing FTP ought to be a small and trivial task. This is wrong, because FTP has a user interface, because it has to deal (correctly) with the whole variety of communication and operating system errors that may occur, and because it has to handle the great diversity of real file systems in the world. -- Anne & Lynn Wheeler | lynn at garlic.com - http://www.garlic.com/~lynn/ From jwbaxter at spamcop.net Sat Dec 29 11:47:33 2001 From: jwbaxter at spamcop.net (John W. Baxter) Date: Sat, 29 Dec 2001 08:47:33 -0800 Subject: REPOST: Re: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> <7xlmfxvbx7.fsf@ruckus.brouhaha.com> <3dbsgt7f0e.fsf@ute.mems-exchange.org> <7xheqkr05q.fsf@ruckus.brouhaha.com> Message-ID: <4$--$$_----_%--_-$@news.noc.cabal.int> In article , Emile van Sebille wrote: > "James T. Dennis" wrote in message > news:a0kor6$2o7u$2 at news.idiom.com... > > Paul Rubin wrote: > > > "Fredrik Lundh" writes: > > >>> Not bugs per se unless perfect backward compatibility was > > >>> an overriding concern. > > > > >> it isn't. > > > > > It's a bug if something is gratuitously, unnecessarily incompatible, > > > like "rand" disappearing. What was the reason for that? > > > > While that topic has come up: I find whrandom to be an unsightly > > name for accessing a set of functions which is so commonly accessed > > by novice students. What was wrong with must calling it rand or > > random? Is it pure pedantry? > > whrandom now exists for backwards compatibility purposes and is scheduled > for deprecation (is this a word? ;-) See the Python Library Reference, 5.6 random and 5.7 whrandom. >From the description of the whrandom module: "This module implements a Wichmann-Hill pseudo-random number generator..." I'm sure (without checking) that Google can find you exhausting (er, exhaustive) details about what that means. So the wh in the name stands for Wichmann-Hill. IIRC, in early days, the module was offered as an improvement over the existing random number module. Now, the random module does Wichmann-Hill, and the old whrandom name can be retired to the dustbin of history (nice phrase, glad I invented it ;-)). Something named rand would likely be based on the C library rand() function...others can tell you why that's not very interesting these days. --John ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "John W. Baxter" Newsgroups: comp.lang.python Subject: cmsg cancel <291220010847335691%jwbaxter at spamcop.net> Control: cancel <291220010847335691%jwbaxter at spamcop.net> Date: Mon, 31 Dec 2001 04:35:47 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774693 27193 211.57.49.2 (31 Dec 2001 04:58:13 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:58:13 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From lac at strakt.com Mon Dec 10 09:03:49 2001 From: lac at strakt.com (Laura Creighton) Date: Mon, 10 Dec 2001 15:03:49 +0100 Subject: pep proposal : A date object for the standard library In-Reply-To: Message from Greg Ewing of "Mon, 10 Dec 2001 17:25:03 +1300." <3C14391F.510EB54C@cosc.canterbury.ac.nz> References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <9uq2km$d0g$1@news.btv.ibm.com> <3C14391F.510EB54C@cosc.canterbury.ac.nz> Message-ID: <200112101403.fBAE3nua031455@ratthing-b246.strakt.com> > Peter Mayne wrote: > > > > 00:00 o'clock, November > > 17, 1858. This is the Smithsonian base date and time for the astronomical > > calendar. > > All right, so does anyone know why the Smithsonian > chose this date? Does it correspond to any important > celestial occurrence, or event in the history of > astronomy? > > -- > Greg Ewing, Computer Science Dept, University of Canterbury, > Christchurch, New Zealand > To get my email address, please visit my web page: > http://www.cosc.canterbury.ac.nz/~greg No. Its Uglier than that. http://www.kgb.com/dcl/199111.txt Laura From fdrake at acm.org Wed Dec 5 00:49:19 2001 From: fdrake at acm.org (Fred L. Drake) Date: Wed, 5 Dec 2001 00:49:19 -0500 (EST) Subject: [development doc updates] Message-ID: <20011205054919.A1E7B28698@beowolf.digicool.com> The development version of the documentation has been updated: http://python.sourceforge.net/devel-docs/ A wide variety of minor additions and clarifications. From tommy at trance-formation.org Fri Dec 28 16:17:53 2001 From: tommy at trance-formation.org (tommy at trance-formation.org) Date: Fri, 28 Dec 2001 21:17:53 GMT Subject: Trance-Formation of America: Epilogue Message-ID: <2351260364450573211@195.238.3.180> The safety and serenity of Alaska provided an atmosphere conducive to deprogramming, despite the pandemonium that ensued. Mark Phillips was the first man who not only did not abuse us, but cared for our welfare and well being. His patient, gentle manner was therapeutic, while his propensity for handling weapons and apparent intellect kept us safe against all odds. Through his noble actions, Mark taught Kelly and me that the world of human interaction in which we had existed for so long was contrary to most human behavior. We learned that goodness does exist on this Earth, and that there were those in Washington, D.C. who refused to tolerate the mind-control atrocities they witnessed us and others enduring. As my eyes opened and I woke up to reality, I became enraged. Enraged for the traumas inflicted on my daughter. Enraged for a lifetime of abuse at the hands of our country's so called "leaders". Enraged that the American public had no idea as to who and what was/is running their country. Mark helped me refocus my rage in a productive direction when he told me, "The best revenge is total recovery." I began recovering at the rate of 18 hours a day through intensive therapy destined to restore my memory and, ultimately, my mind. I learned the ins and outs of my own mind and recovered my memories in a journal. The stack of journals grew as over a decade of White House/ Pentagon-level abuse flooded my mind and intruded on my thoughts. Pictures from my past flashed across my mind as neuron pathways opened in my brain. I was regaining access to my own mind and control over my future by recovering my memory of my past. Best of all, I was falling deeply in love with Mark Phillips. Why wouldn't I fall in love? He rescued my daughter and me from certain demise, restored my free will, and was helping me recover in total safety, and was the polar opposite of my abusers. He treated me with love, respect, and thoughtful consideration . Equally as important, Mark proved to be an ideal father figure to Kelly. He provided here with unconditional love and deep understanding. Through him, Kelly caught a glimpse of how kind men could be--and how good life could be. I had long since ceased to know that such a man even existed. The love factor in my recovery is considerable. Not only did Mark Phillips save my life, but now I had a reason to live it! The love we share kept me going at times--like when Kelly was institutionalized in 1989 for homicidal/suicidal behavior. The loving relationship that Mark shared with Kelly during our short year together as a family was sufficient to arm here with the strength to survive her ensuing ordeal as a victim of the so-called mental health and criminal justice system. Kelly, now 15, remains a political prisoner in the custody of the State of Tennessee where she is denied qualified therapy for the MK-Ultra Project Monarch Mind-Control abuses she endured. The state of Tennessee, under the politically powerful influence of Kelly's abusers, is in violation of numerous laws and basic civil rights in their determined efforts to keep Kelly from qualified therapy and the family she loves. While many of those in positions to make a difference in Kelly's case operate on a "Need to Know" basis rather than deliberately conspire with the bad guys, a closer look into Kelly's case history should raise serious questions in their minds. Questions like; "What could a child have to do with the so called "National Security" of our country?" The Juvenile court judge presiding over Kelly's case closed the doors to the media and onlookers for "reasons of National Security" while gross and blatant violations of laws and rights ensued. For over three long years, Kelly and I have been denied our right to an unbiased attorney while court-appointed advocates and so-called "guardians" join forces with attorneys paid off by me pedophile father. My own court-appointed attorney, who doubles for the Juvenile Court judge when he takes a day off, has yet to represent my interest. My interest is in Kelly's well being and future-- and if she will have a future at all. While Kelly is still amnesic with regard to most of her past, she is deliberately denied therapeutical access to her past, due to who and what she will recall. I am denied access to Kelly for fear she would be triggered into remembering by my mere presence. As for my deliberately "triggering" Kelly to remember what she was supposed to forget, as her abusers fear, it has been my experience that recovery must come from the inside out. Not from outside input. I want no less for Kelly that the piece/peace of mind I have gained through qualified rehabilitation. Which raises the questions: Why has the Juvenile court prohibited us from saying the name "George Bush?" Why is the "Wizard of Oz" a taboo subject for Kelly while the State of Tennessee provides her with Stephen King horror novels? Why are Kelly and I forbidden by the court to say the words "President," "politics," New World Order", and "mind-control"?. In an attempt by state employees to "normalize" our relationship, Kelly and I are forbidden to discuss the past, my immediate efforts to affect her dire and desperate situation, or future plans as a family. Most appalling and unjust in Kelly's view is the State of Tennessee's refusal to allow her any contact whatsoever with Mark Phillips. While I am hindered from having private conversations with my daughter due to court ordered supervisions and censorship, Kelly is denied the right to even wave to Mark across the parking lot. Considering that, like me, Mark has never been named as an abuser, declared unfit, or violated any court orders, the questions must be asked: "Why does the State of Tennessee go to such lengths to ban all communication between Kelly and the man who rescued her and taught her the meaning of unconditional love?" Kelly has asked these questions for years to no avail. The State of Tennessee refuses to even acknowledge her request for"an unbiased attorney who will represent her interests instead of those of the state". Kelly's pleas for an attorney to represent her go no farther than the deaf ears of the assigned state social worker "managing" her case. This social worker is operating on a "Need to Know" basis that has no basis, and she "Needs to Know" that she, along with the State of Tennessee, will be held accountable in the event that Kelly hurts someone or herself. Kelly's frustrations have mounted beyond her ability to cope. I applaud Kelly for her determined but weakened efforts to stay in control of her own mind despite being denied qualified rehabilitation for the devastating results of Project Monarch Mind-Control abuses. Kelly's daily attempts to accomplish the impossible by psychoLOGICALLY managing her psychiatric disorder is proportionate to her high intellect and willful determination. But it is not enough to fend off the Psychological Warfare that has been waged against her through CIA Damage Containment practices designed to keep her contained in amnesic silence. She needs help. She needs a collective voice. Kelly can be helped through public outcry and through abolishment of the 1947 National Security Act (and 1984 Reagan Amendment to same) that has destroyed the true security of our once great nation. You can write the State of Tennessee demanding to know why Kelly is being denied her right to qualified rehabilitation. Thank you. - Cathy O'Brien Every submitted comment of encouragement will be greatly appreciated! -- http://www.trance-formation.org/ http://www.trance-formation.com/ Trance-Formation of America: Project Monarch (excerpt #1) http://www.trance-formation.com/book_excerpts/monarch.htm http://howardk.moonfall.com/msgid.cgi?ID=100925768100 http://groups.google.com/groups?selm=EC8F5BAE.8523C14B%40trance-formation.com&output=gplain http://howardk.moonfall.com/msgid.cgi?STYPE=msgid&MSGI=%3CEC8F5BAE.8523C14B at trance-formation.com%3E >From Dorothy to Tinker-Belle (excerpt #2) http://www.trance-formation.com/book_excerpts/dorothy.htm http://howardk.moonfall.com/msgid.cgi?ID=100925953900 http://groups.google.com/groups?selm=1175735356578104241520878%40news.clara.net&output=gplain http://howardk.moonfall.com/msgid.cgi?STYPE=msgid&MSGI=%3C62371BB7.8BC522F0 at news.clara.net%3E The Most Dangerous Game (excerpt #3) http://www.trance-formation.com/book_excerpts/game.htm http://howardk.moonfall.com/msgid.cgi?ID=100930112200 http://groups.google.com/groups?selm=MPG.3f72db4fab9e%40166.82.1.9&output=gplain http://howardk.moonfall.com/msgid.cgi?STYPE=msgid&MSGI=%3CMPG.3f72db4fab9e at 166.82.1.9%3E You Are What You Read (excerpt #4) http://www.trance-formation.com/book_excerpts/read.htm http://howardk.moonfall.com/msgid.cgi?ID=100933907900 http://groups.google.com/groups?selm=1ef3ad%245oz%241%40168.95.195.16&output=gplain http://howardk.moonfall.com/msgid.cgi?STYPE=msgid&MSGI=%3C1ef3ad%245oz%241 at 168.95.195.16%3E The Most Dangerous Game: Revisited (excerpt #5) http://www.trance-formation.com/book_excerpts/regame.htm http://howardk.moonfall.com/msgid.cgi?ID=100949997400 http://groups.google.com/groups?selm=e138c973.25b3142c%40trance-formation.org&output=gplain http://howardk.moonfall.com/msgid.cgi?STYPE=msgid&MSGI=%3Ce138c973.25b3142c at trance-formation.org%3E Clinton Coke Lines (excerpt #6) http://www.trance-formation.com/book_excerpts/cokelines.htm http://howardk.moonfall.com/msgid.cgi?ID=100950207100 http://groups.google.com/groups?selm=311e7c95.f10eeeaa%40trance-formation.org&output=gplain http://howardk.moonfall.com/msgid.cgi?STYPE=msgid&MSGI=%3C311e7c95.f10eeeaa at trance-formation.org%3E -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From matt at lorfeld.com Mon Dec 24 03:12:28 2001 From: matt at lorfeld.com (mlorfeld) Date: 24 Dec 2001 00:12:28 -0800 Subject: Web Collaboration Message-ID: <32c382ad.0112240012.462d9daa@posting.google.com> I am involved with a project that is developing a web based collaboration tool. Currently we are using web-embedded voice over IP for classroom and other purposes (http://www.cu-hearme.com). To better communicate we would like to enable everyone involved to be able to Cobrowse. By cobrowse I mean when one person enters a url (in a frame for instance) everyone in that collaboration session would be pushed the same web page. I have looked at java implementations (coldbeans java servlets) as well as integrated collaborations tools (www.blackboard.com). These however don't quite fit the niche we are looking for. I have also looked at Zope, yet as I'm posting this, I am still just browsing through the documentation so I don't know if it is even the right way to look. Another approach to this that I've been tinkering with is using a python cgi script to call from an sql database the most recent url posted. I desprately need another perspective, as I have a gut instinct I'm approaching this the wrong way. I believe that python would be the best developement language as it lends itself nicely for rapid developement. Any suggestions directions would be greatly appreciated. Thanks, Matt Lorfeld From pinard at iro.umontreal.ca Tue Dec 11 12:01:48 2001 From: pinard at iro.umontreal.ca (=?iso-8859-1?q?Fran=E7ois?= Pinard) Date: 11 Dec 2001 12:01:48 -0500 Subject: reference counting for garbage collection In-Reply-To: References: <1008011593.29363.0.nnrp-10.c1c3e1d9@news.demon.co.uk> Message-ID: [Gareth McCaughan] > It's arguably bad style to rely on objects going away as > soon as they're no longer referenced, because if Python > switches over completely to a "real" GC some time in the > future then it will stop being true. Arguably, yes! :-) :-) As Alex pointed out, Jython does not use reference counting. A good while ago, Tim Peters gave me confidence on the fact that Python is not going to stop using reference counting, so it is reliable. I did try both styles, and definitely for me, Python allows for much cleaner and legible code. Writing for Jython requires a more verbose style, and the added noise often goes against clarity. Jython is close enough to Python so people may chose to either write for both at once, at the price of often being less clean, or else, to later revise code from Python to Jython if the need of Java specificities ever arises; that should be rather easy, and I'll surely much welcome Jython availability then. In the meantime, I much prefer the elegance of concision, and beg to consider this good style. :-) -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From nas at python.ca Fri Dec 7 09:52:37 2001 From: nas at python.ca (Neil Schemenauer) Date: Fri, 7 Dec 2001 06:52:37 -0800 Subject: list comprehensions to effect visitors In-Reply-To: <200112061849350910.02A297C8@mail.rdc1.sdca.home.com>; from Bruce@EckelObjects.com on Thu, Dec 06, 2001 at 06:49:35PM -0800 References: <3C0FD573.B1EB891E@bioreason.com> <200112061337430460.01850546@mail.rdc1.sdca.home.com> <3C0FF014.CE683AA4@bioreason.com> <200112061849350910.02A297C8@mail.rdc1.sdca.home.com> Message-ID: <20011207065237.A26213@glacier.arctrix.com> Bruce Eckel wrote: > import random > rgen = random.Random() > flwrs = [Gladiolus(),Runuculus(),Chrysanthemum()] > flowers = [rgen.choice(flwrs) for i in range(10)] > bee = Bee() > fly = Fly() > worm = Worm() > [(f.pollinate(bee), f.pollinate(fly), f.eat(worm)) for f in > flowers] Since you are not using the list produced by the last line it's probably clearer to use a for loop: for f in flowers: f.pollinate(bee) f.pollinate(fly) f.eat(worm) Listcomps are cool but don't go overboard. :-) Neil From tim at vegeta.ath.cx Thu Dec 27 03:47:14 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Thu, 27 Dec 2001 08:47:14 GMT Subject: The Python community needs a lighter heart to it. References: <40dbad98.0112261431.3e928cf2@posting.google.com> Message-ID: Andrew Nguyen graced us by uttering: > The python community is a bunch of people who can't take a joke. > (Or at least make one:)) The hell you say! > Also, usenet SUXXOR (sucks) because itttt issss > soooo cunfuseeeng... u r 2 l337 4 m3. (but at least you translated for us lamerz) The mailing list would be an obvious choice for someone who can't wrap his head 'round a newsgroup. Honestly, complaining about usenet with a mailing list available is like complaining about Linux with AOL available. (hint, hint) > Why not switch to an EZBoard? Why have maling lists that are too > confusing? You sure this isn't an EZBoard advert? Besides, how many maling lists are you a part of? Are you maled frequently? (couldn't resist) > I for one say that we create a NEW forum! All in favor? ... Motion declined. Next order of business? > I bet you, that if we put a link on the python homepage with a link > to an EZBoard, python would be Much more popular. The most exciting > topic I have seen to date is 'Fun with Classess in Python 2.2'. Whoa, hold it right there! I _totally_ forgot that this was all some kind of popularity contest. We should throw a Pythonista dance! [ Meanwhile, at the 1st Annual EZBoard ] [ Dance, trouble is brewing... ] "Hey." "Hey." "Nice class you got there." "Thanks. Hacked it up last week." "Mind if I inherit from it sometime?" "Um, sure." . . . "Did you hear the DJ play 'YMCA'?" "Yeah, right after 'Lady in Red'." "This isn't as cool as the EZBoard (TM) post said it would be." "No it isn't. All the women went to the usenet party." "Bummer." "Yeah." =) Your boredom is not cause per se to change the society at large. Tim Hammerquist -- In fond remembrance of (and good riddance to) Jeff K. From ungrzr2 at ubatxbat.pbz Fri Dec 14 22:49:33 2001 From: ungrzr2 at ubatxbat.pbz ({-- Rot13 - Hateme) Date: 15 Dec 2001 03:49:33 GMT Subject: Wrap C function which takes variable lengthed parameters? References: <6p5j1u0oag2ofkam8o7fig5dvkfc2392hk@4ax.com> <3C19990E.BE0F3FA@alcyone.com> <3C19AC0B.7ABD04DF@xs4all.nl> <1gbj1u8pm1t63ao6bjq98jlh66glf78fnu@4ax.com> Message-ID: "{-- Rot13 - Hateme" wrote in news:Xns91785CD91CF46YouAreNotMeYouKnow at 218.102.23.34: > > I try to find a standard way to build a va_list at runtime. > Or maybe there some way for python C API which can pass me > a va_list from python code(not really feasible, I think.) After some more searching, it seems impossible to create a va_list or call a varidic function at runtime in C. So there is no easy way to write python wrappers for functions which takes variable length arguments. A possible way is to use the libffi from redhat http://sources.redhat.com/libffi/ http://sources.redhat.com/cgi-bin/cvsweb.cgi/libffi/README?rev=1.8 &content-type=text/x-cvsweb-markup&cvsroot=libffi and create a cif(call interface) dynamically. Then call the function with the cif. Though in the README, it said libffi does not support varargs functions yet. I take that it means the number of arguments have to be known at the time the cif is created. I have no actually test the libffi route, hopefully it might work with my case. Thank for everyone that helped. And I really hope python will provide some way to ease the wrapping on varargs functions some day. But it is hard. From peter at engcorp.com Thu Dec 6 20:47:32 2001 From: peter at engcorp.com (Peter Hansen) Date: Thu, 06 Dec 2001 20:47:32 -0500 Subject: Python - string to hexbytes conversion - HELP! References: <3C0F9EB3.2574208E@snakefarm.org> Message-ID: <3C101FB4.85900BFA@engcorp.com> Carsten Gaebler wrote: > > me wrote: > > > if I do a read and get a='1234567' > > I need an equivalent string to be > > b=Chr(0x01)+chr(0x23)+chr(x045)+chr(0x67) > > >>> import binascii > >>> binascii.unhexlify("01234567") > '\x01#Eg' Other than the requirement that an *even* number of digits be present (to ensure no partial bytes) this one pretty much closes the discussion, doesn't it? :-) -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From feldt at ce.chalmers.se Fri Dec 7 22:01:13 2001 From: feldt at ce.chalmers.se (Robert Feldt) Date: Sat, 8 Dec 2001 04:01:13 +0100 Subject: Most popular Python modules/extensions? Message-ID: Hi, Are there any stats on the most popular/downloaded Python extensions/modules? Any info relating to this appreciated. Regards, Robert Feldt feldt at ce.chalmers.se From fperez528 at yahoo.com Mon Dec 17 07:27:20 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Tue, 18 Dec 2001 11:55:20 +2328 Subject: WYSIWYG text Editor in python? References: <3C1DDCAC.C477A0A6@cicei.ulpgc.es> Message-ID: <9vo3ib$oho$1@peabody.colorado.edu> Enrique wrote: > Hi, > I am a biochemist using computer programming mainly for > data analysis, and a Python fan. Now I have faced a > different task, automating text reports. For this task I > need a MS-Word-like text editor able to render on screen > text in bold, italics, underline, greek symbols and > super/subscripts. I work with MS-Windows. > unless your formatting needs are fairly simple, this is the kind of problem that can only be solved *correctly* using latex. You don't give many details so it's hard to tell exactly what you're after, but maybe auto-generating the latex might be a good solution for you. If you also need to edit it, you can always use lyx as a user-friendly front end (it runs in windows, though I've never tried it). hope this helps, f From Dave at PragmaticProgrammer.com Thu Dec 27 18:28:12 2001 From: Dave at PragmaticProgrammer.com (Dave Thomas) Date: Thu, 27 Dec 2001 23:28:12 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA4D3.5F0BC994@earthlink.net> Message-ID: <0$--$$_-----$$_$_$@news.noc.cabal.int> Ron Stephens writes: > Thus, while I admire Ruby, I suspect that it divides the pool of > developers who might otherwise be all in the Python *camp*. >From personal experience, I have to disagree. I tried many times to like Python. I used it on projects and for personal work, but it never clicked. I couldn't tell you why, and I know it isn't a failing of the language. It's just that Python and my brain have some kind of impedance mismatch. When I tried Ruby, I fell in love within an hour, so much so that I was driven to write a book about it. This isn't a "Ruby is better than Python" response. It's just an observation. Ruby and Python are different, and I suspect there is a substantial body of developers out there who, like me, have a preference for one over the other. I don't believe that Ruby is raiding the Python camp. I believe that Ruby is attracting people to OO scripting who would not otherwise be doing it. Regards Dave ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Dave Thomas Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:02:52 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775500 27193 211.57.49.2 (31 Dec 2001 05:11:40 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:11:40 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From marc at verinet.com Wed Dec 5 23:50:06 2001 From: marc at verinet.com (Marc Poulin) Date: Wed, 05 Dec 2001 21:50:06 -0700 Subject: Newbie - Exporting Excel Spreadsheet References: <673dc1dc.0112051334.370c75f2@posting.google.com> Message-ID: You might want to look at this: http://www.python.org/windows/win32com/ (I guess I'm a little surprised that you are using ODBC and SQL to retrieve data from a spreadsheet.) Marc In article <673dc1dc.0112051334.370c75f2 at posting.google.com>, "James Fugard" wrote: > TIA for any help that I may get. I have a small project that I'm trying > to do in Python...and I'm a hack at best! Here is what I'm trying to do. > Call and capture a row in an Excel spreadsheet and then use manipulate > the data in the cell of the various columns. > > Here is what I've been able to get some far: > > # Call all used modules > import os,win32api,glob,odbc,dbi,time # Make the database connection > using the system DNS MyConnection = odbc.odbc('Client_Data_Log') > MyCursor = MyConnection.cursor() > MyCursor.execute('SELECT * FROM "Client Data Log$"') # the sheet name > print MyCursor.fetchall() > > This will give me everything + a bunch of dbi time stuff. If someone > could tell me where to find info on calling a particular cell or a piece > of sample code to follow(like G12 for example) that would be great. > Thanks again. James From jamescalthoff at yahoo.com Thu Dec 13 15:01:10 2001 From: jamescalthoff at yahoo.com (James Althoff) Date: Thu, 13 Dec 2001 12:01:10 -0800 (PST) Subject: PEP 276 Message-ID: <20011213200110.80011.qmail@web20004.mail.yahoo.com> Reposted after omitting subject line -- sorry :-( Michael Chermside wrote: >Yeah. Is there a way to express my support for the >limited and >well-reasoned proposal that is in PEP 276 itself >without commiting >myself at all on the broad flurry of OTHER proposals >folks have made here? Absolutely! In fact, you just did (thanks :-). I am going to update PEP 276 based on all the recent discussions. But it will stay focused on its current theme of just adding an iterator to class int. If I have time, I will try to put the other suggestions into a separate PEP (unless someone else would rather take the lead) since they all address the broader issue of dealing with intervals in a general way. Jim __________________________________________________ Do You Yahoo!? Check out Yahoo! Shopping and Yahoo! Auctions for all of your unique holiday gifts! Buy at http://shopping.yahoo.com or bid at http://auctions.yahoo.com From philh at comuno.freeserve.co.uk Sun Dec 2 21:11:14 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Mon, 3 Dec 2001 02:11:14 +0000 Subject: a comment about PEPs Message-ID: Whenever I have a peek at c.l.p, there are usually several threads going suggesting improvements to the langauge. Why is this? IMO Python is very good as it is, and any major changes that added compexity to it (which most changes would do) are against the spirit of the language. -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From sjmachin at lexicon.net Fri Dec 28 16:18:25 2001 From: sjmachin at lexicon.net (John Machin) Date: 28 Dec 2001 13:18:25 -0800 Subject: REPOST: import path, script path (was Re: module path) References: Message-ID: <3$--$$_-----$$$_$$@news.noc.cabal.int> "Alex Martelli" wrote in message news:... > "Garett Shulman" wrote in message > news:n1an2u4rvau9f86r5dcl895lokb05354pr at 4ax.com... > > I would like to store my modules and scripts in a folder other than > > the python folder. Does anyone have any suggestions as to what I need > > to do in order to be able to import the scipts in the interpreter? Is > > there a path that the interpreter searches which I could modify? > [snipped: Alex's answer re first part of the OP's question -- path to follow when import mymodule ] 1. I note that (for win32) since Python 2.2, \lib\site-packages appears as the last entry of sys.path (and this is the default location where distutils unloads the truck when you say >python setup.py install). 2. Can somebody please help with the OP's implicit but not quite asked 2nd part of question: How to set up the path to follow when prompt> python myscript.py The answers are no doubt OS-specific; help for the Windows NT family would be personally appreciated. For example, having to do this is a pain: prompt>python %pythonbin%\Tools\Scripts\ndiff.py Cheers & TIA, John ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.wirehub.nl!newspeer.monmouth.com!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: sjmachin at lexicon.net (John Machin) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:25:05 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775051 27193 211.57.49.2 (31 Dec 2001 05:04:11 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:04:11 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From matt at mondoinfo.com Mon Dec 3 12:52:39 2001 From: matt at mondoinfo.com (Matthew Dixon Cowles) Date: Mon, 03 Dec 2001 17:52:39 GMT Subject: Win98 PySol/Python Problems II References: Message-ID: On Mon, 03 Dec 2001 15:42:42 GMT, Bill Melcher wrote: Dear Bill, >Hi Guys, Hi! >Python - So I get the book and try a little simple stuff. Whoops! Nobody expects the Spanish Inquisition! >PythonWin 2.1.1 (#20, Jul 26 2001, 11:38:51) [MSC 32 bit (Intel)] on win32. >Portions Copyright 1994-2001 Mark Hammond (MarkH at ActiveState.com) - see >'Help/About PythonWin' for further copyright information. >>>> import os >>>> os.environ.keys() >['TMP', 'INCLUDE', 'PATH', 'BKOFFICE', 'INETSDK', 'TEMP', 'WINBOOTDIR', >'BASEMAKE', 'MSSDK', 'BLASTER', 'LIB', 'COMSPEC', 'PROMPT', 'CMDLINE', >'MSTOOLS', 'WINDIR', 'DXSDKROOT'] >>>> os.environ.keys('PATH') >Traceback (most recent call last): > File "", line 1, in ? >TypeError: keys() takes exactly 1 argument (2 given) >>>> os.environ.keys['PATH'] >Traceback (most recent call last): > File "", line 1, in ? >TypeError: unsubscriptable object >>>> os.environ is a dictionary. That is, a thing that's subscriptable by strings and various other things. As with all dictionaries in Python, the subscripting is done with square brackets: >>> os.environ["HOME"] '/home/matt' The subscripts are generally called keys and the things returned are generally called values in Python. This dictionary has strings for both its values and its keys but dictionaries aren't limited to using strings. When you create a dictionary from scratch in your program, the syntax uses curly brackets rather than square ones. (I don't know the reason for the inconsistency and it quickly stopped bothering me.) Here's an example: >>> d={"a":2} >>> d["a"] 2 >>> d["b"]=3 >>> d {'b': 3, 'a': 2} Sometimes it's useful to know what keys have been assigned to. You can do that with a dictionary's keys() method: >>> d.keys() ['b', 'a'] Note that the keys aren't returned in a dictionary, it's a list. There's an analogous method for a dictionary's values: >>> d.values() [3, 2] So what you really wanted in the first place is probably something like: >>> os.environ["PATH"] Here's the explanation for the odd error message you got. In Python, functions can be passed around and stored in variables: >>> def a(): ... print "wibble" ... >>> a() wibble >>> b=a >>> b() wibble If I can call a by saying a(), then a is the name for the relevant code. The same thing is true for methods. dict.keys() gets me the dict's keys, and dict.keys is the code that does it: >>> d.keys() ['b', 'a'] >>> d.keys Up above you wanted to subscript the dict but subscripted the keys method so Python complained that it couldn't subscript the code. Regards, Matt From altis at semi-retired.com Sun Dec 9 20:45:38 2001 From: altis at semi-retired.com (Kevin Altis) Date: Sun, 9 Dec 2001 17:45:38 -0800 Subject: Tinker vs wxPython ?- Opinions/Views References: <3ReQ7.21098$2Fd.14596@news1.bloor.is> Message-ID: You should at least look at PythonCard. http://pythoncard.sourceforge.net/ There are over twenty sample programs that you can use to get started, some screenshots are at: http://pythoncard.sourceforge.net/samples.html PythonCard sits on top of wxPython (version 2.3.1 or higher), so you have to install wxPython to develop with PythonCard. You can build Windows EXE files using py2exe, so users of your program won't need Python or wxPython or PythonCard if they are using Windows. One of the samples is a rudimentary layout editor. ka "Dan Howard" wrote in message news:3ReQ7.21098$2Fd.14596 at news1.bloor.is... > I'm a newbie at Python and about to create my first set of GUI appliactions. > I would like to run them on Windows and Linux ( and possibly MAC). > I'm trying now to decide whether to use Tinker or wxPthyon. > Would appleciate views, opinions and experiences... > Thanks - Dan > > From jgardn at alumni.washington.edu Sun Dec 2 23:36:35 2001 From: jgardn at alumni.washington.edu (Jonathan Gardner) Date: Mon, 3 Dec 2001 13:36:35 +0900 Subject: Linux Kernel Design and Why Python is Rad Message-ID: <200112030444.fB34iCJ13215@my.knctv.co.kr> Check out this link: http://kerneltrap.org/article.php?sid=398 Linus Torvalds on design: "Nothing successful has every been designed. It has evolved." Everyone else: "No wait a minute, that's not what this book says! And that's not what my teacher said!" If you are making something very complicated, it will end up working if you don't try to kill it with design. Rather, you should implement small changes, see what works, and take the best results and work from there. Rinse and repeat. Therefore, you will want to use a self-documenting language that is easy to modify. Something where you can try out many different changes quickly, and see what works best. Or better yet, where many people can try out their own changes and see what works for them. Hence, Python is rad. Jonathan From aahz at panix.com Thu Dec 27 16:57:55 2001 From: aahz at panix.com (Aahz Maruch) Date: 27 Dec 2001 13:57:55 -0800 Subject: REPOST: Re: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B941D.B1E45AA5@htp-tel.de> Message-ID: <8$--$$_----_--_-_$@news.noc.cabal.int> In article <3C2B941D.B1E45AA5 at htp-tel.de>, Tom Karas wrote: > >What means nntp ? It's a protocol for transferring netnews articles, the way HTTP is a protocol for transferring HTML documents. For more information, poke around Google. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 4 days and counting ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newsengine.sol.net!uwm.edu!newsfeed.cs.wisc.edu!enews.sgi.com!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: aahz at panix.com (Aahz Maruch) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:30:35 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775569 27193 211.57.49.2 (31 Dec 2001 05:12:49 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:12:49 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From fredrik at pythonware.com Sun Dec 30 12:36:04 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sun, 30 Dec 2001 17:36:04 GMT Subject: Zope Documentation (was RE: Python Popularity: Questions and Comments) References: <3C2E55A6.D873E301@engcorp.com> Message-ID: <8gIX7.7072$l93.1790214@newsb.telia.net> Bill Tate wrote: > "Xxxxxx is the world's first company dedicated to using the science > of experience strategy, design, and technology to create extraordinary > results for our clients." interestingly enough, a google search for the above phrase gave two very similar hits: Xxxxxx is the world's first company dedicated to using the science of experience strategy, design, and technology to create extraordinary results for our clients. Yyyyyy is the world's first company dedicated to using the science of experience strategy, management, and technologies to create extraordinary results for our clients. design or management, that's the question... From calves at coelce.com.br Thu Dec 13 08:51:47 2001 From: calves at coelce.com.br (Alves, Carlos Alberto - Coelce) Date: Thu, 13 Dec 2001 10:51:47 -0300 Subject: capturing output of os.system() into a list? Message-ID: <29A97D00F387D411AC7900902770E14803036CF8@LCOEEXC01> If you're under Windows, use: import os os.popne('dir').readlines() I think.... > -----Original Message----- > From: Richard Jones [mailto:richard at bizarsoftware.com.au] > Sent: Wednesday, December 12, 2001 10:31 PM > To: Ron; python-list at python.org > Subject: Re: capturing output of os.system() into a list? > > > On Thursday 13 December 2001 12:06 pm, Ron wrote: > > Is there a built-in method of doing this? I can write a function > > to do it, but would rather use the standard method. > > something like: > > >>> import os > >>> os.popen('ls').readlines() > ['addDataManager.dtml\n', 'addExtDataContainer.dtml\n', > 'addIdManager.dtml\n', 'CHANGES.txt\n', 'common.py\n', > 'common.pyc\n', > 'dtml\n', 'help\n', '__init__.py\n', '__init__.pyc\n', > 'LowConflictConnection.py\n', 'LowConflictConnection.pyc\n', > 'manageDataManager.dtml\n', 'manageExtDataContainer.dtml\n', > 'manageIdManager.dtml\n', 'manageImpExpSessionData.dtml\n', > 'manageIntDataContainer.dtml\n', 'manageSessionData.dtml\n', > 'othertests\n', > 'README.txt\n', 'SessionDataContainer.py\n', > 'SessionDataContainer.pyc\n', > 'SessionDataManager.py\n', 'SessionDataManager.pyc\n', > 'SessionData.py\n', > 'SessionData.pyc\n', 'SessionIdManager.py\n', > 'SessionIdManager.pyc\n', > 'SessioningInterfaces.py\n', 'SessioningInterfaces.pyc\n', > 'SessioningPermissions.py\n', 'SessioningPermissions.pyc\n', > 'SessionStorage.py\n', 'SessionStorage.pyc\n', 'tests\n', > 'TODO.txt\n', > 'VERSION.txt\n', 'www\n'] > >>> > > > Richard > > -- > http://mail.python.org/mailman/listinfo/python-list > -------------- next part -------------- An HTML attachment was scrubbed... URL: From db3l at fitlinxx.com Mon Dec 10 16:55:08 2001 From: db3l at fitlinxx.com (David Bolen) Date: 10 Dec 2001 16:55:08 -0500 Subject: FW: Win32all documentation? References: Message-ID: David Brady writes: > Um... yes, though I may be splitting hairs. I've got > a pretty solid grasp of Python in general, and I've > been programming Windows in C/C++ for nearly 10 years. > The part I don't understand clearly is win32all > *itself*. I know *how* to enumerate windows in C; I > just don't know how to get there from Python. Hmm, if you've been programming Windows in C/C++ for that long, you may just be working too hard to try to find something unique about the "Python" solution. :-) The win32all package is a thin wrapper over the Win32 API. So your answer to the question of how to do it in Python would be the same (almost identical) to how to do it in C/C++. The documentation included with win32all will highlight any slight differences in the wrapping of a single function, and there are some general conventions (e.g., "out" parameters in a Win32 API are returned as part of a result tuple) that you'll get used to quickly. So, given that you know how to enumerate Windows in C (e.g., using EnumWindows), that's how you do it in Python with win32all - in this case by using win32gui.EnumWindows, which has the same function signature as the Win32 API version (callback and application value) except that the win32all docs will note that the callback is a normal Python function, and the application value can be any Python object (not just an integer value as in the Win32 API). But that's what it means to be a "thin" wrapper - there's pretty much a one to one correspondence between wrapper functions in the win32all modules and the underlying API. It's not a completely exhaustive wrapping, but a large percentage of the API is wrapped. For those cases where they aren't, sometimes the calldll package (a lower level interface) can be used instead, or if you can find a system COM object, then you can use a COM interface instead. > Over the weekend I walked through the entire win32all > installation and found a lot of demos, many of which > appear to be most illuminating. But they still only > shine points of light in a dark corner, and I want to > turn on the Big Light Overhead. If there were > win32all documentation somewhere, something at least > as complete as the documentation like the Python > module dox > (http://www.python.org/doc/current/modindex.html), I > would be in fat city. There isn't, but that's largely because it would just be redundant with the Win32 API documentation. (Although I'm sure any contributions to the existing win32all documentation would be welcome) > I own Mark's book, and I've read most of it. While it > is excellent, it doesn't provide a reference so much > as a lot more in-depth examples. For example, filling > out and printing a Microsoft Word template document > using win32com is demonstrated, but no further data is > forthcoming on what *else* you can do with MS Word > from win32com. Like, for example, how to open Word to > a blank document and create and format a documnt from > scratch. But that's not something that win32all needs to document, because Microsoft already provides extensive documentation for the Word object model, including online help files (which you can optionally install right from the Word/Office installation CD - VBAWRD9.CHM or VBAWD10.CHM depending on version). win32com is just a COM interface from Python - what you can do over it is anything you can do over a COM exported interface in general. In this case, your question is really 90% Word related (its object model) and maybe 10% Python (how to talk to any old COM object). BTW, this is precisely an area where I also wanted the "Big Light Overhead" when I first ventured into it a while back. What I found out was that the big light was immersing myself in the MS Office object model for a bit, since Python was really just a user of the establishment for this bit of work. The office developer object model is something you can choose to install with a local MSDN installation (it's under the Office Developer Documentation topic). It's also available on the web - I'm not sure how to create a direct shortcut, but if you start at the MSDN library (http://msdn.microsoft.com/library) and then navigate down through "Office Solutions Development", "Microsoft Office Developer" and then "Microsoft Office 2000 (or XP) Developer" you'll find the object model guide, which will include Word among the other applications. There are probably books written on the subject too (doubtless those kinds whose authors seem to get paid by weight). > If I could just see all the methods, objects > and classes of win32all, I could probably figure out > how to hook up the rest of the stuff I need. But you're not asking for methods, objects and classes of _win32all_ here, you're asking for methods, objects and classes of _MS Word_, which is going to be documented over with Word. This is no different than asking how to automate Word from VBScript, or VB for that matter. Those languages have mechanisms to access COM objects, but they don't document all the objects they can reach - that's up to each object to do on its own. The object model is common to all languages, Python included. > Forgive me if I'm sounding whiny. I'm beating my head > against a brick wall here, and I'm willing to admit > it's my head's fault... if someone will just show me > the door in the wall to walk through. In defense of > my head, however, the wallbuilder and doormaker might > consider marking the door more clearly. (Unless > they're sickos who enjoy this sort of thing. :-) I hope this is helping to clarify things somewhat, but I'm willing to help you keep trying to break through to clarity :-) It seems like you may be thinking a little too deeply about the Python support. If instead you treat the win32all package modules as interfaces into the existing Windows support (whether direct Win32 API or COM objects) and then use the common documentation for the facilities being accessed, you might have an easier time using the Python-specific documentation just to highlight Python-unique aspects. > I know from MSDN, for example, how to enumerate all > the windows in the system and how to get and change > the caption of a window. For this portion of our > program, I am asking how to do it from Python. If > there isn't a "win32.enumeratewindows" method, then > how can I call the windows API functions FindWindow() > and EnumWindows()? I do not see them listed when I do > a dir(win32api): (...) > ...I infer from my reading that the win32api functions > of Python are considered fairly complete, so I'm > willing to assume that these functions are missing > because I'm looking in the wrong place, or that > they're implemented in a more Python-friendly way > altogether and using the api in this case is a poor > choice. If someone would please show me how these > ruby slippers worked, I'm sure I could go home.... Ah, this might be one of the roots of your problem. The win32all package is a collection of modules - win32api is but one of about a dozen. The online help will show them all in the module list, and you can use the index to search by function. They're divided to avoid having to load everything into every application, and after working with it for a little while, you'll find it pretty easy to pick which module a function is likely in. In your case, FindWindow/Ex() and EnumWindows() are in the win32gui module. There's also two modules (win32ui and win32uiole) that are part of the "Pythonwin" directory (not win32) which have their own documentation file. > So, 3 things: > - How to find an application running in the system, > preferrably by window class, and activate one of its > child windows, which may be positioned randomly on the > screen. There may be multiple instances of the window > class running, I'd like to be able to inspect them to > be able to pick the correct one. > - How to send mouse actions to a window. > - How to capture a screenshot of a window. Note that while you could probably build something for this, would you also be willing to just use a dedicated test tool for the process? Personally, I tend to use something like AutoIt, and just run it from beneath my Python script (either as a standalone executable, or via its COM interface) if I need scripting over and above the interactive work. I can't be as specific as I'd like on building it in Python since I haven't needed to do this specific operations myself (neither in Python nor C/C++). It doesn't look like the SendInput() API function is wrapped (although maybe you could fake it with SendMessage()) so that would make it tricky, although as others have pointed out you could invoke a WSH object (via win32com) to use SendKeys(). But I've also found in the past that properly scripting (simulating a user) your way through something often gets tricky and a good standalone utility can help out a lot. As for capturing the screenshot, there are the standard DC and bitmap (e.g., BitBlt) functions in win32ui which should be able to do what you want. E.g., grab a DC for the desktop or window you are interested in, and then BitBlt its contents to an in-memory bitmap. While I haven't tried it, I would expect that the PIL package might be helpful past that point in terms of manipulating the bitmap, storing it or whatever. > 2. Whenever I install or reinstall an operating > system, I have about 20 different applications that > have to be installed and have their registration codes > entered. The process AFTER the OS is installed takes > about four hours. I'd like a script that launches > their installers, clicks through their install > interfaces, and types in my user and registration info > automatically. In this way, I could fire up a new > machine, launch the script, and let it install and > register my software, rebooting as necessary. Once > that's done, I usually reorganize the Programs folder > inside the Start Menu so that I can more easily > navigate it by keyboard (for example, renaming the > 4,219,376 applications whose names start with > "Microsoft" so that hitting "O" launches Office and > "W" launches Word. This also seems doable with a dedicated user simulation tool such as AutoIt directly, at least other than the reboot part, since that complicates things. Renaming of the folders is probably easiest by just renaming the various files in the filesystem. For an internal installation tool we have (which is in Python) we manage across the reboot using the standard autologon and autorun Windows keys to restart our application, and we keep persistent state in a pickled file to resume following the reboot. So you could do something like that and just use an AutoIt-like tool for the actual operations. > Three things, again: > 1 - Finding the start menu folder so the script can > put itself there to continue running after each > reboot. Well, either that or just use the autologon and autorun keys so that it executes automatically when the system restarts. > 2 - Launching an app and then monitoring it, waiting > for it to die. If it's an executable, you can launch it with os.system() or os.startfile() in Python >= 2.0. The former wouldn't return until the command had completed so that could be an implicit monitor (put into a separate thread if you wanted to keep working while waiting). > 3 - Walking through the start menu shortcuts and > renaming them. If it's en-masse, you might actually be best served with filesystem operations at that level. I'm not positive if there's a guaranteed way to locate the shortcut files that is system-independent (e.g., they're located differently under NT than Win9x) although others may have a suggestion on that front. But once you know the location, normal os functions to enumerate the directory (e.g., os.listdir()) and rename files (os.rename()) may be all you need. > -dB > P.S. Bonus question. How can I change the desktop > background image in Win32 from Python? Thanks again! > P.P.S. No disrespect is intended towards Hammond & > Robinson, their book, or their documentation as > presented on the ActiveState site. I'm having > difficulty, yes, but I'm grateful I've got as much > information as I do. Hmm, that's another thing I haven't had to do myself (even in C/C++) but if you have a hint as to what you'd do in C/C++ I might guess at a Python approach. A quick MSDN search seems to point to SystemParametersInfo() with SPI_SETDESKTOPWALLPAPER which doesn't seem to be wrapped in a win32all module, but which you could probably use the calldll package to call. I'm not entirely sure how it interacts with an ActiveX desktop though? -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l at fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/ From wex at flarg.com Fri Dec 21 20:29:34 2001 From: wex at flarg.com (Daniel Wexler) Date: Sat, 22 Dec 2001 01:29:34 GMT Subject: distutils problem with interdependent modules References: Message-ID: "Martin von Loewis" wrote in message news:j4vgf0cicv.fsf at informatik.hu-berlin.de... > "Daniel Wexler" writes: > > > C1, C2 - two pure C libraries (i.e.. not Python extensions) > > P1, P2 - two C extension modules > > > > C2 requires functions in C1 > > P1 requires functions in C2 > > P2 requires functions in P1 and C1 > > Please don't do that. On Unix, P2 cannot see any symbols from > P1. Never mis-use an extension module as a shared library. Perhaps I don't understand you clearly. This system does work just fine under Linux and Windows. Under Linux the linker can export all non-static symbols. Under Windows, yes, you do need to explicitly export symbols using one of three methods, but it also works just fine. I can understand a philosophical argument that you shouldn't use an extension as a shared library, but the truth is that it is a shared library, and I don't see why I can't use it as one. It works just fine. Perhaps you are suggesting that I separate out the Python glue code that is used to make what is normally just a C shared library into a Python C extension module? I could do that easily, but that would just result in two DSOs, one for my C shared lib and another for the Python C extension. I can see how that would solve the problem I posted, but the solution is cumbersome. Personally, I'd rather just rename the python C extensions as libfoo.so rather than split them up just for distutils. Dan From zope at thewebsons.com Sun Dec 16 17:48:53 2001 From: zope at thewebsons.com (Ben Ocean) Date: Sun, 16 Dec 2001 14:48:53 -0800 Subject: Compiling Python with Tkinter In-Reply-To: References: Message-ID: <5.1.0.14.0.20011216144444.00a3e160@thewebsons.com> At 11:04 PM 12/16/01 +0100, you wrote: >Ben Ocean writes: > > > In file included from ./Modules/_tkinter.c:45: > > /opt/tcltk/include/tk.h:83:29: X11/Xlib.h: No such file or directory > > > > This file does *not* exist, anywhere: > > > > #find / -name "Xlib.h" > > #find / -name "X11*" > > /usr/bin/X11 > > /usr/lib/X11 > > /usr/X11R6 > > /usr/X11R6/lib/X11 > > /var/cache/man/X11R6 > > /etc/X11 > >X11/Xlib.h is supposed to be in the same location that has the X >libraries, typically /usr/include/X11, or /usr/X11R6/include/X11. If >you really don't have the headers, you most likely cannot compile >_tkinter. I do not have headers. I presume I could, and should, build the X libraries. >Since you still did not mention what system you are using, it is hard >to suggest a procedure for installing the headers. Sorry. RH71. > > I never use XWindows, so I'm wondering if it's even installed properly, or > > if I really need it for Tkinter. Your advice? > >What do you mean, you don't use it? Don't you use any kind of grapical >interface (web browsers, and the like)? Or are you merely not >developing applications for X11? I don't use a GUI on my Linux box: I prefer the command line. I do serve Web pages. I don't even know what X11 is used for so I don't guess I develop any apps for it. Kragen Sitaker writes: > What do you want Tkinter for if you don't use X Windows? I'm building PIL into my python to use the libraries. Note: I work in the Zope environment. Thanks for your help! BenO From paul at boddie.net Mon Dec 17 08:57:40 2001 From: paul at boddie.net (Paul Boddie) Date: 17 Dec 2001 07:57:40 -0600 Subject: Dr. Dobb's Python-URL! - weekly Python news and links (Dec 17) Message-ID: QOTW: "I'm ready to bet a good lunch at Bologna's best restaurant, wine included, that dependencies will become much more common, i.e., that reuse will indeed have been encouraged." Alex Martelli [on CPAN, Python and dependencies] "Release candidate 1" brings the final release of Python 2.2 one step closer. http://groups.google.com/groups?th=ca492fd6f83f8427 It may have seemed stupid to ask how a Python program can be distributed stand-alone, but how often does jythonc get mentioned in response? http://groups.google.com/groups?th=40655c77b2331e34 Some time ago, Paul Tchistopolskii regarded Zope as being the Windows 3.0 of the Web. That may seem harsh, but there haven't been many protests - perhaps he has a point... http://www.pault.com/pault/zope/zope.html Comparing like with like, now, and a more straightforward comparison has to be between the Apache components mod_python and mod_snake. If you want to do CGI-like things, but faster, a few suggestions are offered. http://groups.google.com/groups?th=feacc6d11cc98af1 Alexandre Fayolle inadvertently rises to the challenge of last week's "Python-URL!" with a summary of interesting XML modules. http://groups.google.com/groups?selm=slrna1ci7t.9tl.alf%40sagittarius.logilab.fr And on the subject of "Python as XML", whatever happened to Xython? http://sourceforge.net/projects/xython/ Mygale seems to make the "Python-URL!" editor's job redundant... or easier? http://www.awaretek.com/nowak/mygale.html Talking of vaults, whatever happened to the Python CPAN? http://groups.google.com/groups?th=2ab22a9d10d675a3 Well, Suchandra Thapa exposes ciphon to beta testing. http://groups.google.com/groups?th=add05b3ce874d380 And remember the Software Carpentry project? Well, here's the first release of SCons - the build/make tool of that project. http://groups.google.com/groups?selm=mailman.1008305779.12195.python-list%40python.org Meanwhile, here's an SMTP server written in Python. Just in case you ever needed one. http://www.hare.demon.co.uk/pysmtp.html Wanted: speakers for a Python event in the United Kingdom. http://groups.google.com/groups?selm=mailman.1008168137.12533.python-list%40python.or ======================================================================== Everything you want is probably one or two clicks away in these pages: Python.org's Python Language Website is the traditional center of Pythonia http://www.python.org Notice especially the master FAQ http://www.python.org/doc/FAQ.html PythonWare complements the digest you're reading with the daily python url http://www.pythonware.com/daily comp.lang.python.announce announces new Python software. Be sure to scan this newly-revitalized newsgroup at least weekly. http://groups.google.com/groups?oi=djq&as_ugroup=comp.lang.python.announce Michael Hudson continued Andrew Kuchling's marvelous tradition of summarizing action on the python-dev mailing list once every other week, into July 2001. Any volunteers to re-start this valuable series? http://starship.python.net/crew/mwh/summaries/ http://www.amk.ca/python/dev The Vaults of Parnassus ambitiously collect Python resources http://www.vex.net/~x/parnassus/ Much of Python's real work takes place on Special-Interest Group mailing lists http://www.python.org/sigs/ The Python Software Foundation has replaced the Python Consortium as an independent nexus of activity http://www.python.org/psf/ Cetus does much of the same http://www.cetus-links.de/oo_python.html Python FAQTS http://python.faqts.com/ The old Python "To-Do List" now lives principally in a SourceForge reincarnation. http://sourceforge.net/tracker/?atid=355470&group_id=5470&func=browse http://python.sourceforge.net/peps/pep-0042.html Python Journal is at work on its second issue http://www.pythonjournal.com Links2Go is a new semi-automated link collection; it's impressive what AI can generate http://www.links2go.com/search?search=python Tenth International Python Conference http://www.python10.org Archive probing tricks of the trade: http://groups.google.com/groups?oi=djq&as_ugroup=comp.lang.python&num=100 http://groups.google.com/groups?meta=site%3Dgroups%26group%3Dcomp.lang.python.* Previous - (U)se the (R)esource, (L)uke! - messages are listed here: http://www.ddj.com/topics/pythonurl/ http://purl.org/thecliff/python/url.html (dormant) or http://groups.google.com/groups?oi=djq&as_q=+Python-URL!&as_ugroup=comp.lang.python Suggestions/corrections for next week's posting are always welcome. [http://www.egroups.com/list/python-url-leads/ is hibernating. Just e-mail us ideas directly.] To receive a new issue of this posting in e-mail each Monday morning, ask to subscribe. Mention "Python-URL!". -- The Python-URL! Team-- Dr. Dobb's Journal (http://www.ddj.com) is pleased to participate in and sponsor the "Python-URL!" project. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From jkraska at san.rr.com Sat Dec 29 21:27:04 2001 From: jkraska at san.rr.com (Courageous) Date: Sun, 30 Dec 2001 02:27:04 GMT Subject: Is learning Python "extraordinary"? References: <3C2E5706.5880983E@engcorp.com> Message-ID: >I think that you're answering with the wrong comparison group as your >background sample. Certainly I'd expect any professional developer to be >able to pick up Python in a week. But, among the set of all students >applying for university admission, how many of them have taught themselves >Python? I think this is an important distinction. When I was in highschool, those individuals who self-taught themselves computer programming languages were of the rare breed who were destined to later be technical wizards in their field. Passionately caring about something above and beyond what you're made to do and having the initiative to carry it out is a remarkable thing at any age; in a young mind, it is spectacular. Usenet urban legendry would have it that those who hang out in computer programming language groups are generally taken from the top 1% of their peers. While I can't speak to the degree of this truth, I am certain in the pit of my belly that it is true in spirit. Consider it well, C// From stefan1werner at hotmail.com Tue Dec 25 01:49:59 2001 From: stefan1werner at hotmail.com (Stefan Werner) Date: Tue, 25 Dec 2001 06:49:59 GMT Subject: Three misc questions Message-ID: <3C282187.1090002@hotmail.com> Hi, I have three questions: 1. Is there a possibility to read PICT files with Python 1.5.2 on MacOS 9? PIL unfortunately cannot open them. 2. Is there a way for IPC between two Python environments? E.g. Blender and Poser have both a Python scripting engine, and I'd like to experiment and link them both together. Is there a way I can send messages or other data packages between both environments besides using shared files? 3. Does anyone know of a library that implements 3D vector math algorithms like constructing/deconstructing transformation matrices, conversion of quaternions/matrices/euler angles, coordinate space conversion, etc? Would be great if it worked with Python 1.5.2, so I could use it without modificaion with Poser. Thanks, Stefan From wurmy at earthlink.net Thu Dec 13 22:49:35 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Fri, 14 Dec 2001 03:49:35 GMT Subject: Python beginner: Downloading a pdf file from a web server on VMS. References: <3c1964a5.352410439@129.180.1.4> Message-ID: <3C1976E3.905990E6@earthlink.net> DoggyKennel wrote: > Basically I want to download a pdf file from a web server and print > it. So I would need a http class that is given a URL and can return > whatever is returned from that URL. Does such a class exist? Would > such a class return the docuemnt as a file handle. See the urllib module. Opening an URL is easy as opening a regular file: uf = urllib.urlopen("http://bla.org/bla.html") data = uf.read(1000) # read 1000 bytes # etc... So, yes, urllib.urlopen returns a file-like object, that can be used for reading. > The second part of this is that I would like to do this under VMS. I > am hoping that if a "http" class as I have described above exists and > that it would be built on top of a socket class and could be ported to > any python environment that has a socket class. And that a socket > class is a part of standard python and has been ported to any > environment that python has been ported to. Is that right? I beleive > python has been ported to VMS? > Any advice on how to search for this info would also be appreciated. Python has been ported to VMS, see: http://www.python.org/download/download_other.html I don't use VMS myself, so I don't know how recent this port is. But sockets and urllib have been around for a long time, so that shouldn't really be a problem... assuming this Python port supports them. > I would also be interested in any introduction to Python. I have > looked for this before and the consenus seems to be the tutorials > referenced in python.org. I didn't really find much else. Is there > anything else? There's http://diveintopython.org, but I'm not sure if that's a tutorial or more advanced. See http://www.google.com/search?hl=en&q=python+tutorial for more. Regards, --Hans From chironsw at swbell.net Fri Dec 14 14:26:10 2001 From: chironsw at swbell.net (Greg Goodman) Date: Fri, 14 Dec 2001 19:26:10 GMT Subject: Model View Presenter GUI pattern? References: <20011213172833.0bfac3c7.gry@ll.mit.edu> Message-ID: <3C1A5468.7FD44ED2@swbell.net> george young wrote: > > Is anyone using the Model View Presenter GUI framework/pattern in python? > I've been reading bits about it, and it sounds quite attractive. Sure; I use it almost anytime I model a system and want to provide the user the ability to view or manipulate the model. Currently, I'm building an integrated design and analysis environment (IDAE?) for an engineering company that designs oil rigs. One collection of classes models the rig. A parallel set of (operator) classes provides edit dialogs that allow the user to edit individual components; another set of (operator) classes represent the components of the model as nodes in a tree/browser view; yet a third set of (operator) classes provides a manipulable (click-and-drag) graphic view of the rig components. Currently, I don't have a pure viewer class, but I'll build one if/when we get around to implementing a simulation of rig behavior. Regards, Greg Goodman From maxm at mxm.dk Sun Dec 16 05:45:33 2001 From: maxm at mxm.dk (maxm) Date: Sun, 16 Dec 2001 11:45:33 +0100 Subject: mySQL References: Message-ID: You will find a list of database related material at: http://www.python.org/topics/database/ regards Max M From: "Preben" > Is there any built-in modules for connecting databases > such as mySQL? > > Or do I have to make them myself? From keyton at weissinger.org Sun Dec 23 22:29:28 2001 From: keyton at weissinger.org (A. Keyton Weissinger) Date: Sun, 23 Dec 2001 22:29:28 -0500 Subject: O'Reilly's Python and XML In-Reply-To: <75968FA028EAD311B3530090279CF80C0B2A0374@uswaumsx07medge.med.ge.com> Message-ID: Hi Team, I just snagged a copy of _Python and XML_, a new release from O'Reilly. Excellent book. Pulls together quite a range of XML tips and tricks. There are a couple places where you will want more, but that is pretty much always the case... The writing is good and the editing is sound. Though I've not tried all the code, the code I have tried works. Anyone have any word on PyXML for Python 2.2? When will it be released, etc? Keyton P.S. For those cynics out there, I would report that this is book is good even if I WASN'T an O'Reilly author.... ;-) From laurent.pointal at laposte.net Sat Dec 1 12:55:14 2001 From: laurent.pointal at laposte.net (Laurent Pointal) Date: 01 Dec 2001 17:55:14 GMT Subject: Opening a file in shared mode Message-ID: The question is in the title... Working on a log system, no problem to open a file and write in. But I would like to be able to open that file for reading in other processes (ex. do a tail -f on the file, or open it with an editor). I tried low level access via os module, but no option to specify a shared mode. With newsgroup search, I found posts about lock files implementation for shared resources among several process, but no opening mode for shared file. If anybody have a solution... thanks. Platform: Win2K Python: 2.1 A+ Laurent. From jason at jorendorff.com Sun Dec 16 05:53:05 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Sun, 16 Dec 2001 04:53:05 -0600 Subject: "XXX undetected error" in python_d.exe In-Reply-To: Message-ID: Tim wrote: > It's best not to think too hard about what those rules imply when a > destructor gets called by magic ... Oh. I thought Python would automatically squelch exceptions in destructors, so you didn't have to check after every DECREF. (?) -- Jason Orendorff http://www.jorendorff.com/ From s328940 at student.uq.edu.au Thu Dec 6 09:59:24 2001 From: s328940 at student.uq.edu.au (Alejandro Dubrovsky) Date: Fri, 07 Dec 2001 00:59:24 +1000 Subject: pygtk 0.6.8 crashes on everything Message-ID: <3c0f909e.0@mercury.planet.net.au> I have had pygtk installed for a while, and i've never noticed this before about a month ago, so i'm assuming that originally it all worked fine. Now, anything i try to do with pygtk segfaults. details: linux 2.4.x (the x changes too frequently), glibc-2.2.4 with corresponding linuxthreads (0.9 i think), gcc-3.0.2, python 2.1.1, gtk+ and glib-1.2.10. I've recompiled python, glib, gtk, and pygtk again. no luck. eg, when trying to run pygtk/examples/test/testgtk.py, the following backtrace is produced by gdb (the backtraces all look very similar): (gdb) bt #0 0x400e70bb in chunk_free () from /lib/libc.so.6 #1 0x400e705b in free () from /lib/libc.so.6 #2 0x401f0906 in PyGtk_dealloc () from /usr/local/lib/python2.1/site-packages/_gtkmodule.so #3 0x8090c3a in dict_dealloc (mp=0x819d2cc) at Objects/dictobject.c:637 #4 0x80812e0 in instance_dealloc (inst=0x81a0ecc) at Objects/classobject.c:585 #5 0x80580aa in eval_code2 (co=0x401bc360, globals=0x401a053c, locals=0x0, args=0x81b88fc, argcount=0, kws=0x81b88fc, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:1674 #6 0x8059efd in fast_function (func=0x81a195c, pp_stack=0xbffff754, n=0, na=0, nk=0) at Python/ceval.c:3022 #7 0x80582c9 in eval_code2 (co=0x401bc3a0, globals=0x401a053c, locals=0x0, args=0x80daee4, argcount=0, kws=0x80daee4, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:1972 #8 0x8059efd in fast_function (func=0x81a1994, pp_stack=0xbffff854, n=0, na=0, nk=0) at Python/ceval.c:3022 #9 0x80582c9 in eval_code2 (co=0x401bc3e0, globals=0x401a053c, locals=0x401a053c, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:1972 #10 0x80555e5 in PyEval_EvalCode (co=0x401bc3e0, globals=0x401a053c, locals=0x401a053c) at Python/ceval.c:341 #11 0x806f3eb in run_node (n=0x80d2648, filename=0xbffffb22 "testgtk.py", globals=0x401a053c, locals=0x401a053c, flags=0xbffff948) at Python/pythonrun.c:1045 #12 0x806e675 in PyRun_SimpleFileExFlags (fp=0x80d1780, filename=0xbffffb22 "testgtk.py", closeit=1, flags=0xbffff948) at Python/pythonrun.c:665 #13 0x8051faa in Py_Main (argc=2, argv=0xbffff9e4) at Modules/main.c:320 #14 0x8051b69 in main (argc=2, argv=0xbffff9e4) at Modules/python.c:10 #15 0x4008f691 in __libc_start_main () from /lib/libc.so.6 Anyone have any ideas? Thank you, Alejandro Dubrovsky From tiberius at ms28.hinet.net Tue Dec 18 09:01:10 2001 From: tiberius at ms28.hinet.net (Tiberius Teng) Date: 18 Dec 2001 06:01:10 -0800 Subject: Strange behavior of weak references (weakref module) Message-ID: <6c92a8bc.0112180601.2ac4a6f0@posting.google.com> I found this behavior (bug?) when I want to create weak reference to a instance method. It's hard to describe (using my poor English writing ability), so I just attach the way to reproduce the situation. And notice that the id() of a instance method reference changes after each function call! ActivePython 2.1.1, build 212 (ActiveState) Python 2.1.1 (#20, Jul 26 2001, 11:38:51) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. >>> from weakref import * >>> class A: ... def test(self): ... return 3+4 ... >>> ref(A.test) >>> a=A.test >>> ref(a) >>> a=A() >>> ref(a.test) >>> b=a.test >>> ref(b) >>> id(b) 9549988 >>> a.test() 7 >>> b=a.test >>> id(b) 3860004 From LLoeffler at home.com Wed Dec 5 01:13:24 2001 From: LLoeffler at home.com (Luke) Date: Wed, 05 Dec 2001 00:13:24 -0600 Subject: ANN: Simple Newsgroup Searchterm Monitor (attached) References: <3c13ba77.19343935@127.0.0.1> Message-ID: <3C0DBB04.5070102@home.com> Why are you sending attachments to a non binaries newsgroup, and why did you send it so many times? If you want anyone to see your code, put it on a server somewhere and give a link. For all we know it could be infected, and furthermore, many newsreaders like mine scramble the file. From tim at vegeta.ath.cx Thu Dec 27 02:57:20 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Thu, 27 Dec 2001 07:57:20 GMT Subject: Python2.2 in Linux RH7.2 - Newbie References: Message-ID: Ahimsa Consulting graced us by uttering: > I am dealing with a double whammy here: I am new to both Python and > Linux. I have been able to call Python up in the Linux console > in interactive mode i.e. '>>>'. I don't seem able to call up > tkinter. Now I am probably doing something incorrectly. If someone > could be kind enough to walk me through this process in baby steps > bearing in mind my newbie status. Without knowing what you're _actually_ doing, since you didn't tell us, but here goes: First, you don't mention which OS you used _before_ linux, so I'm going to make a wild guess and say Windows. Windows is notable in many things, one of which being that it is less case-sensitive than some other operating systems. Linux _is_ case-sensitive and will be less forgiving (or not at all) if you type, say, 'import tkinter' at the '>>>' prompt, instead of 'Tkinter', which should load the Tkinter module if available. In any case, here is a sample Tkinter session from my local installation. If it works, your Tkinter works. [tim at vegeta ~/vault/box]$ python Python 2.2 (#1, Dec 22 2001, 22:09:44) [GCC 2.95.3 19991030 (prerelease)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from Tkinter import * >>> root = Tk() >>> Label(root, text="Tkinter is working").pack() >>> Button(root, text="Close", command=root.quit).pack() >>> root.mainloop() >>> (After you click the "Close" button, you should be returned to the '>>>' prompt.) HTH Tim Hammerquist -- M-x induce-carpal-tunnel-syndrome -- Greg Bacon From stani at wish.net Thu Dec 6 10:56:02 2001 From: stani at wish.net (Stani Michiels) Date: Thu, 6 Dec 2001 16:56:02 +0100 Subject: Total newbie: errors compiling PIL with VC6++ Message-ID: <1007655247.498935@news.l3.wish.net> Hi, I'm new to python as well as C++. I tried to compile the pil files to a dll and it didn't work. What I did was, I started a new C++ project in Visual Studio 6 as a Win32 Dynamic-Library. I included all the .c and .h files I could find in the source code from pil. (Of course without coretest.c and except.c) Unfortunately, I got the errors beneath. What went wrong? (I even undefined jpeg, mpeg and zlib.) Or is there someone having a dsw project file or already the binary dll. I'm using Windows XP. I want to install pyOpengl, which requires pil, no? Thanks, Stani --------------------Configuration: VC6 - Win32 Debug-------------------- Compiling... Dib.c c:\program files\microsoft visual studio\vc98\include\basetsd.h(33) : error C2632: 'int' followed by 'int' is illegal c:\program files\microsoft visual studio\vc98\include\basetsd.h(33) : error C2059: syntax error : ',' c:\program files\microsoft visual studio\vc98\include\basetsd.h(41) : warning C4114: same type qualifier used more than once c:\program files\microsoft visual studio\vc98\include\basetsd.h(41) : error C2632: 'int' followed by 'int' is illegal c:\program files\microsoft visual studio\vc98\include\basetsd.h(41) : error C2059: syntax error : ',' path.c d:\python21\modules\pil\vc6\path.c(29) : fatal error C1083: Cannot open include file: 'Python.h': No such file or directory _imaging.c d:\python21\modules\pil\vc6\_imaging.c(56) : fatal error C1083: Cannot open include file: 'Python.h': No such file or directory _imagingtk.c d:\python21\modules\pil\vc6\_imagingtk.c(17) : fatal error C1083: Cannot open include file: 'Python.h': No such file or directory decode.c d:\python21\modules\pil\vc6\decode.c(32) : fatal error C1083: Cannot open include file: 'Python.h': No such file or directory display.c d:\python21\modules\pil\vc6\display.c(20) : fatal error C1083: Cannot open include file: 'Python.h': No such file or directory encode.c d:\python21\modules\pil\vc6\encode.c(26) : fatal error C1083: Cannot open include file: 'Python.h': No such file or directory map.c d:\python21\modules\pil\vc6\map.c(20) : fatal error C1083: Cannot open include file: 'Python.h': No such file or directory outline.c d:\python21\modules\pil\vc6\outline.c(22) : fatal error C1083: Cannot open include file: 'Python.h': No such file or directory _sanemodule.c d:\python21\modules\pil\vc6\sane\_sanemodule.c(24) : fatal error C1083: Cannot open include file: 'Python.h': No such file or directory tkImaging.c d:\python21\modules\pil\vc6\tk\tkimaging.c(43) : fatal error C1083: Cannot open include file: 'tk.h': No such file or directory Error executing cl.exe. VC6.dll - 14 error(s), 1 warning(s) From ssthapa at classes.cs.uchicago.edu Sat Dec 1 17:14:18 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Sat, 01 Dec 2001 22:14:18 GMT Subject: PHP vs. Python/comp.lang.php? References: <9tia10$43o$1@dahlia.singnet.com.sg> <3bfcce0b$0$89809$edfadb0f@dspool01.news.tele.dk> <20011129.151831.971899228.1845@hp.com> <83vgfru4la.fsf@panacea.canonical.org> <83itbqsrz7.fsf@panacea.canonical.org> Message-ID: Kragen Sitaker wrote: >> By templating features, I was refering to a way to separate the html >> and code into separate files, one for the html with tags indicating where >> to substitute values and one for the code. This is primarily so that >> the web designers/graphic artists can fiddle around with the look and feel >> without having to know php or python. Likewise, the developers can write >> the code without having to worry about the appearance. > >Doesn't PHP let you call routines defined in another file? That sounds >to me like exactly what you're asking for. And Python certainly lets >you %-interpolate into strings read from another file. > >Of course, neither of these really answer when you have blocks of HTML >that repeat under programmatic control, unless they're in a third >file; but I can't think of a reasonable solution to that. It's not quite so difficult. Create a template class that is initialized with a template file and that lets you control substitutions and loops. For example, the template files for the class I wrote in php look like this: <!-- PHP_TITLE -->
Name Address
Then in the code you would do something like this: $template = new Template('foo.template'); $template->replaceVariable('TITLE', $title); $template->findLoop(1); while($i < 10) { $template->startLoop(1); $template->replaceLoopVariable('NAME', $name[$i]); $template->replaceLoopVariable('ADDRESS', $address[$i]); $template->writeLoop(1); } $template->endLoop(1); $template->printTemplate() There is no need to have a third file for loops, and it lets me separate the html and code very cleanly. The .php files have almost no html in them. The class in php is just 81 lines and it wouldn't be very difficult to write this in python. Getting back to the topic, php and python don't really have facilities to do similar things in the standard library without writing your own code. Thus the fact that php makes you mix code and html isn't a valid point of comparision since you need to do the same in python. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From tatebll at aol.com Fri Dec 28 13:37:11 2001 From: tatebll at aol.com (Bill Tate) Date: 28 Dec 2001 10:37:11 -0800 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: <0$--$$_-----$$$-$$@news.noc.cabal.int> Roy Smith wrote in message news:... > tatebll at aol.com (Bill Tate) wrote: > > This past spring, I spent a full month pouring over Zope in detail. I > > pulled every example product I could find that I thought would be > > relative to the purpose of setting up a commercial-based application. > > I downloaded the tutorial and the draft zope book. I pulled down > > every bit of documentation I could find for developers. In so many > > cases, I found whatever documentation was available that key aspects > > of the implementation took the "assumed facts-already-in-evidence" > > approach; omitting key details that would were critical to improving > > my understanding of using Zope. > > Unfortunately, I have to agree. I've looked at Zope a few times, because > the hype sounded really cool (as all good hype should). But, every time I > ever tried to understand it to the level of, "OK, so how do I actually > write an application using this", I was stumped. I dunno maybe, I'm missing something here? Here's the latest usage figures for PHP - which has been around for how long now???? PHP: 7,095,691 Domains, 1,046,426 IP Addresses Source: Netcraft What's wrong with this picture???? ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!zeus.visi.com!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: tatebll at aol.com (Bill Tate) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:00:49 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775141 27193 211.57.49.2 (31 Dec 2001 05:05:41 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:05:41 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From phd at phd.pp.ru Mon Dec 10 08:54:17 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Mon, 10 Dec 2001 16:54:17 +0300 Subject: two questions - sockets / c functions In-Reply-To: <3c14bc2c$1_2@news7.fast.net>; from david@wmol.com on Mon, Dec 10, 2001 at 08:53:07AM -0500 References: <3c14bc2c$1_2@news7.fast.net> Message-ID: <20011210165417.P18573@phd.pp.ru> On Mon, Dec 10, 2001 at 08:53:07AM -0500, David Hill wrote: > I am learning python, and I like what I see so far. Welcome! > Is it possible to use sockets with python, so that I may write client/server > code? If so, where can I find more information? http://www.mcmillan-inc.com/sock1.html http://py-howto.sourceforge.net/sockets/sockets.html http://www.python.org/doc/current/lib/module-socket.html > Is it possible to use c functions within python? For example, openbsd has a > function arc4random(). How could I use this in python? http://www.python.org/doc/current/ext/ext.html http://www.swig.org/ http://www.mcmillan-inc.com/scxx.html http://CXX.sourceforge.net/ http://www.boost.org/libs/python/doc/index.html Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From bsturk at news.rcn.com Tue Dec 4 01:09:21 2001 From: bsturk at news.rcn.com (Brian Sturk) Date: 4 Dec 2001 06:09:21 GMT Subject: pty controlling app References: Message-ID: > > Well, my copy of bash2 prints its version and exits when invoked as > > $ bash2 --version > > Changing --version to -i and putting in a few more judicious > time.sleep()s, your code seemed to work. The output is a bit messy > but that's because I have a fancy $PS1. > > Cheers, > M. I think I accidentally mailed you my last post instead of putting it up here. Sorry bout that... I found an example indirectly that seems to fix the issue, now I just need to get select() into the picture. Just for posterity's sake I'm posting the code that eliminated the "echoing" of the commands I was sending. if pid == 0: attrs = tty.tcgetattr(1) attrs[3] = attrs[3] & ~tty.ICANON & ~tty.ECHO attrs[6][tty.VMIN] = 1 attrs[6][tty.VTIME] = 0 tty.tcsetattr(1, tty.TCSANOW, attrs) Thanks again -- .-----------------------------------------------------,-------. | Brian M. Sturk - http://www.nh.ultranet.com/~bsturk \ C/C++ | .> )\,^a__ |--------------------------| bsturk at nh.ultranet.com | Java | ( _ _)/ /-." ~ | http://www.telengard.com `---------------------------`------| `( )_ )/ | Telengard Technologies Inc. - NT/*nix UI & device drivers | _<_s_<_s '-------------------------------------------------------------' From scott_hathaway at riskvision.com Wed Dec 5 08:03:27 2001 From: scott_hathaway at riskvision.com (Scott Hathaway) Date: Wed, 5 Dec 2001 07:03:27 -0600 Subject: Arrgh (re: ANN: Simple Newsgroup Searchterm Monitor) References: <3c20bba2.19642734@127.0.0.1> Message-ID: I am interested. Thanks, Scott "(Five Fresh) Fish" wrote in message news:3c20bba2.19642734 at 127.0.0.1... > Bugger me, I've never attached a file before, and have no idea why Agent > sent umpteen copies (other than that, obviously, I was doing something > completely wrong.) > > Apo's if there's a half-dozen of my messages. I sent out cancel messages, > so hopefully they won't get to propagate very far. Grrr. > > The script scans a list of newsgroups, searching the subject and header for > search terms. Very simple search, no regex support as yet, but nonetheless > handy for monitoring an industry-specific newsgroup for mention of, say, > your company name. > > Anyone who wants it, follow-up this message and I'll *email* it to you. > I'm giving up on using Agent to post a zipfile. :-) > From wurmy at earthlink.net Wed Dec 26 19:42:26 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Thu, 27 Dec 2001 00:42:26 GMT Subject: re.match oddity References: Message-ID: <3C2A6D23.AD1807D9@earthlink.net> Issac wrote: > > A curious thing is happening in my c2py.py script (below). > The resulting files contain little ^M's (when viewed with the Windows > version of gvim 6.0 but not when viewed with notepad.exe) at the ends > of the lines. When I remove the lines > > line_is_lone_left_curly = re.match(r'^\s*{\s*((//.*)|(/\*.*\*/))?$', line) > if line_is_lone_left_curly: > pylines[-1] = pylines[-1][:-1] + ':\n' > continue > > the ^M's go away. Does anyone know why? I'm using Python 2.1.1 > on Cygwin with Windows 2000. Not sure it has anything to do with re.match. Most likely it's caused by the line that appends ':\n'. This is probably written to file as '\r\n' (CR/LF) (in Windows). I suspect that some other lines only have '\n' (LF) as a line separator, otherwise gvim would not show them; it usually detects the line ending and displays the text accordingly. The solution is to make sure that your lines have either a Windows or a Unix line ending, but not a mix. Use os.linesep when in doubt. --Hans From jkraska at san.rr.com Fri Dec 21 13:42:57 2001 From: jkraska at san.rr.com (Courageous) Date: Fri, 21 Dec 2001 18:42:57 GMT Subject: Python on the desktop References: <94e3fce8.0112210053.2568529d@posting.google.com> <3C238618.9F54E5CA@attbi.com> Message-ID: >Does C++ have a standard GUI?? Well, in effect, yes. Since the vast majority of all platforms are x86 windows platforms, and the vast majority of C++ developers use Visual C++, it would follow that the standard GUI for C++ is MFC. :) :) :) C// From jason at jorendorff.com Fri Dec 21 02:12:35 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Fri, 21 Dec 2001 01:12:35 -0600 Subject: threading module oddness In-Reply-To: <9vtqpi$n2l$1@panix3.panix.com> Message-ID: > >2. Principle of least surprise. I think a guy who's done some > > thread programming on Linux before, would likely expect Condition > > to behave as though it had a pthread cond object inside -- on > > Linux anyway. ("Surely they're not duplicating kernel-level > > features in Python...") I'm no guru, but I'm guessing this > > assumption could lead to the occasional subtle bug. > > Possibly. But any other way of working would likely be detrimental to > Python's cross-platform capabilities. Perhaps. (#2 isn't a very good argument besides. On Win32 at least, the APIs provided by the OS can be slow. They're all kernel calls. Anything you can get to run mostly in user-space is much faster.) > Also, it's my experience that 90% of the time that people think they want > to use any thread synchronization primitives other than RLock() and > Queue.Queue(), they're wrong. Hmmm. You are probably right. ## Jason Orendorff http://www.jorendorff.com/ From nhodgson at bigpond.net.au Mon Dec 17 16:00:29 2001 From: nhodgson at bigpond.net.au (Neil Hodgson) Date: Mon, 17 Dec 2001 21:00:29 GMT Subject: WYSIWYG text Editor in python? References: <3C1DDCAC.C477A0A6@cicei.ulpgc.es> Message-ID: Enrique > ... need a MS-Word-like text editor RichEdit is built into windows and is fairly capable - WordPad is a very simple use of RichEdit. [This URL will need unwrapping] http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/riche dit_94xg.asp > able to render on screen text in bold, [OK] > italics, [OK] > underline, [OK] > greek symbols [OK] and > super/subscripts. [Available in recent versions as CFM_SUBSCRIPT / CFM_SUPERSCRIPT but not exposed in WordPad]. > I work with MS-Windows. RichEdit was previously used as the editor for Python source code within PythonWin until Mark and I replaced it with Scintilla. Scintilla is better than RichEdit for source code but worse for documents. In a quick search I couldn't find a Python demonstration of RichEdit. Neil From roman at speeder.org Sat Dec 8 02:48:56 2001 From: roman at speeder.org (Roman Milner) Date: Sat, 08 Dec 2001 01:48:56 -0600 Subject: Tinker vs wxPython ?- Opinions/Views References: <3ReQ7.21098$2Fd.14596@news1.bloor.is> Message-ID: <87elm62luf.fsf@speeder.org> Well, I've been looking at these recently and here is my opinion: Tkinter Pros: Very easy to learn Excellent documentation (a whole book, plus some excellent web sites) Very stable Portable Tkinter Cons: Small lame selection of widgets (no notebook, no tree, no paned windows. You can get some of these with PMW but it is slow and hasn't been updated in a long time) Slow. It doesn't seem like Tk has been improved in the last several years - it seems like new widgets will never get added. wxPython Pros: Fast Great widget selection Portable wxPython Cons: Lame documentation (You basically get the wxWindows C++ API reference and a bunch of python examples.) Difficult to learn (IMO the wxPython API is much harder on the brain than Tkinter) Less stable than Tkinter (it has been my experience that I have more crashes with wxPython than TKinter) So, IMO all of this leaves the state of python GUI development pretty low. I've more or less decided to stick with TKinter because of how easy it is and the docs. But if your developing a large app with a complicated UI TKinter's simplicity starts to fall on its face because you have to start developing your own widgets. If you are devloping a commercial app you might want to check out the QT bindings. (It costs money on Windows.) Maybe anygui (http://anygui.sourceforge.net/) will solve all of this soon. ^Roman >>>>> "DH" == Dan Howard writes: DH> I'm a newbie at Python and about to create my first set of GUI DH> appliactions. I would like to run them on Windows and Linux ( DH> and possibly MAC). I'm trying now to decide whether to use DH> Tinker or wxPthyon. Would appleciate views, opinions and DH> experiences... Thanks - Dan From rdsteph at earthlink.net Fri Dec 28 19:42:54 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sat, 29 Dec 2001 00:42:54 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: <3C2D1210.2E30B9C9@earthlink.net> Hmm that's really a shame. Surely someone , somehow, could do a better job of documenting Zope. I hope the managers of Digital Creations are aware of the problem; this is certainly not the first time I've heard of it, although your description was most telling. From aahz at panix.com Mon Dec 24 10:25:44 2001 From: aahz at panix.com (Aahz Maruch) Date: 24 Dec 2001 07:25:44 -0800 Subject: os.fork() References: <3C26FD03.4050301@beth.uniforum.org.za> Message-ID: In article <3C26FD03.4050301 at beth.uniforum.org.za>, mixo wrote: > >What does 'os.fork' return? Read the on-line docs, Python Library Reference, section 6.1.5 Process Management. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 7 days and counting From qrczak at knm.org.pl Sun Dec 9 08:23:26 2001 From: qrczak at knm.org.pl (Marcin 'Qrczak' Kowalczyk) Date: Sun, 9 Dec 2001 13:23:26 +0000 (UTC) Subject: Draft PEP: string interpolation with backquotes References: <20011202080626.A76724@hishome.net> <20011202170805.A36879@hishome.net> <200112032307.fB3N78327930@bigboy.bizarsoftware.com.au> Message-ID: Tue, 04 Dec 2001 15:23:16 GMT, Fredrik Lundh pisze: > i('X=', x, ', Y=', calc_y(x), '.') It could be nice to have str() working like this instead. It's backwards compatible with current 0- and 1-argument cases. Except it doesn't work with unicode() which uses positional arguments for other things (encoding) :-( Mandating that they are keyword arguments would break compatibility. -- __("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ QRCZAK From wtri at wtresearch.de Wed Dec 19 10:46:21 2001 From: wtri at wtresearch.de (wtr) Date: Wed, 19 Dec 2001 16:46:21 +0100 Subject: testing mx.DateTime fails on import (Py 2.1.1) Message-ID: <1008772673.955709@lix-049dz-008.inside.impress.com> C:\Python21>testDT.py Traceback (most recent call last): File "C:\Python21\testDT.py", line 3, in ? from mx.DateTime import * <-------my import File "C:\Python21\mx\DateTime\__init__.py", line 40, in ? class modinit: File "C:\Python21\mx\DateTime\__init__.py", line 50, in modinit _DT) File "C:\Python22\lib\copy_reg.py", line 16, in pickle raise TypeError("copy_reg is not intended for use with classes") TypeError: copy_reg is not intended for use with classes ------------------------------------------------------------------- The directory structure is C:\Python21\mx\DateTime\mxDateTime, which was generated at installation of the mx package. Can anybody help? Thanks, wolfgang teschner From db3l at fitlinxx.com Tue Dec 11 01:01:45 2001 From: db3l at fitlinxx.com (David Bolen) Date: 11 Dec 2001 01:01:45 -0500 Subject: FW: Strange behaviour of __del__ References: Message-ID: pzw1 at hotmail.com (Peter Wang) writes: > the __del__ method is only called when the reference count of an > object reaches 0. in your example, "a" is actually still referenced > when you reach the interpreter prompt after the exception is thrown, > because the traceback object contains the stack frame, which in turn > references "a". (check out > http://www.python.org/doc/current/ref/customization.html, read the > bold "Programmer's Note") so, when you manually execute "del a", that > decreases the refcount to 0 and that in turn causes "a" to be deleted. > > the NameError exception after that is confusing, i don't know why it's > doing that. probably the destructor itself throwing an exception. I think you're mostly on the right track except for the part about del actually being responsible for the decrement of the reference count. The object itself is definitely being kept alive by a reference in the traceback (via the 'self' local in one of the traceback frames), which will keep the object alive while the "last" traceback is held by Python. E.g.: >>> a = Script1.A(1) Traceback (innermost last): File "", line 1, in ? File "Script1.py", line 5, in __init__ raise RuntimeError RuntimeError >>> print sys.last_traceback.tb_next.tb_frame.f_locals {'self': , 'a': 1} But there is never a binding to 'a' in the interpreted namespace. I expect what's happening is that as the interpreter prepares to execute the next statement (e.g., the "del a") it clears the stored traceback information to prepare for the next command. It is this operation that invokes the __del__ method (and prints the output) indirectly, and not the actual command entered. Then, when the command is actually executed, the interpreter correctly claims that there is no "a" via the NameError. It's just the sequence of output that makes it look like it's in response to the del. I'm not sure of precisely when the traceback is cleared (and it seems to be somewhat Python version specific), but for example, the same thing can happen even if the next command isn't del: >>> a = Script1.A(1) Traceback (innermost last): File "", line 1, in ? File "Script1.py", line 5, in __init__ raise RuntimeError RuntimeError >>> print a In __del__()... Traceback (innermost last): File "", line 1, in ? NameError: a -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l at fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/ From ajs at ix.netcom.com Mon Dec 24 18:17:57 2001 From: ajs at ix.netcom.com (Arthur Siegel) Date: Mon, 24 Dec 2001 18:17:57 -0500 Subject: [Visualpython-users] New Windows VPython References: <4191569856.1009213917@HYPERON.REM.CMU.EDU> Message-ID: <000601c18cd1$3b05e4a0$3d60f6d1@ArtSiegel> ----- Original Message ----- From: "Bruce Sherwood" To: Sent: Monday, December 24, 2001 5:11 PM Subject: [Visualpython-users] New Windows VPython > At vpython.org is a new VPython for Windows that patches gaps in the > Numeric module used in some VPython demo programs (and automatically > imported by Visual). The update makes division of Numeric arrays work > properly in the presence of "from __future__ import division". The patches > to Numeric have been submitted to the keepers of the Numeric project. > > Bruce Sherwood > Bruce - I am in the strange position of being a vocal advocate of VPython, and a vocal critic of the decision on the division operator, at least to the extent it was made to accommodate VPython and similar projects. And precisely, as I stated at the time of the wars, because Numeric is the dog and VPython the tail when it comes to handling numerics, and as I stated at the time, the change is inconsistent, or at least inelegantly consistent, with Numeric typing, and, as I stated at the time of the wars, the change could be expected to lead to a deeper level of confusion and more insidious bugs if folks try to use VPython without being aware of the Numeric typing and coercian rules - to which the divison change is, almost by intent, an open invitation. And I inflamed an already difficult relationship with Guido and others in the community as a result of my position, or at least its vehemence, and my method of communciating my position. There was no VPython fork of Python as Guido had apparently thought, but as of today, apparently there *is* a VPython fork of Numeric. That a project of mine, that is dear to me, is dependent on VPython and so - at least temporarily, a fork of Numeric, is - I think you might be able to understand - quite upsetting. Art From cliechti at gmx.net Fri Dec 28 08:27:49 2001 From: cliechti at gmx.net (Chris Liechti) Date: 28 Dec 2001 14:27:49 +0100 Subject: REPOST: Re: is this a bug or what? References: Message-ID: <1$--$$_--___$_%_%$@news.noc.cabal.int> [posted and mailed] "I.J." wrote in news:a0dv4v$bnh$1 at cer.yubc.net: >>>> M=[[0]*3]*3 >>>> M > [[0, 0, 0], [0, 0, 0], [0, 0, 0]] >>>> M[1][1]=1 >>>> M > [[0, 1, 0], [0, 1, 0], [0, 1, 0]] > > Is this new age math? no your multiplying the reference to one list [0,0,0]. all three sublists are the same object. it works well with strings, numbers and tuples because these are immutable an when you change someting a new object is generated. e.g. l = [0]*4 l[2] = 1 a list like in your example can nicly be created by list comprehesions: M = [ [0]*3 for i in range(3) ] -- Chris ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail Message-ID: Control: cancel Subject: cmsg cancel From: Chris Liechti Newsgroups: comp.lang.python X-No-Archive: yes Lines: 2 NNTP-Posting-Host: wonenara.ozemail.com.au X-Trace: ozemail.com.au 1009643019 203.108.164.177 (Sun, 30 Dec 2001 03:23:39 EST) NNTP-Posting-Date: Sun, 30 Dec 2001 03:23:39 EST Organization: OzEmail Ltd, Australia Distribution: world Date: Sat, 29 Dec 2001 14:27:59 GMT This message was cancelled from within Mozilla. From tismer at tismer.com Mon Dec 31 11:32:39 2001 From: tismer at tismer.com (Christian Tismer) Date: Mon, 31 Dec 2001 17:32:39 +0100 Subject: stackless python References: <9vpjds$due$1@usc.edu> <1008824522.772261@yabetcha.sttl.drizzle.com> <7x3d1r1k9j.fsf@ruckus.brouhaha.com> Message-ID: <3C309327.60407@tismer.com> Paul Rubin wrote: > Christian Tismer writes: > The thing I don't fully understand is that several Scheme > implementations are both smaller and faster than Python. I've been > wondering for a while whether it's time to graft a Python parser onto > a Scheme compiler/evaluator. I don't understand this fully, either. For sure, Scheme has got much more manpower than Python, since so many university projects have been supporting Scheme. Many Scheme constructs are compiled into machine code, which Python doesn't try yet. And most of computation time is not spent in Python's evaluator (which can of course be dramatically sped up as Py2C has shown), but in the implementation of all the many objects. The Python C library is highly optimized, but it is a library, and therefore there are many calls for every object, which cannot be optimized away, easily. BTW Sam Rushing did some work towards a Scheme-based Python a while ago. > The limitations of "simple generators" > also seem kind of artificial--maybe Stackless for 2.2 can support > calling a generator from multiple places. Sure, Stackless generators are not limited. They are first class objects which can be used everywhere. Just think of ICON's co-expressions. ciao - chris -- Christian Tismer :^) Mission Impossible 5oftware : Have a break! Take a ride on Python's Kaunstr. 26 : *Starship* http://starship.python.net/ 14163 Berlin : PGP key -> http://wwwkeys.pgp.net/ PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF where do you want to jump today? http://www.stackless.com/ From andy47 at halfcooked.com Tue Dec 18 19:17:23 2001 From: andy47 at halfcooked.com (Andy Todd) Date: 19 Dec 2001 00:17:23 GMT Subject: ANN: ciphon 0.3.4 References: Message-ID: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) wrote in : > > I've uploaded a new version of ciphon to sourceforge.net and to >anonymous ftp at ftp.community.tummy.com. The recent changes to ciphon >are: > >Ciphon now supports distutils so it can be updated from within itself. >Packages that ciphon installs are now recorded so that they won't have >to > be downloaded again if they are a dependency. >RPM should now work for modules that support the bdist_rpm option of >distutils > >There were a few other minor changes but these are the biggest ones. > For those who wan't to access this via SourceForge the URL is; http://sourceforge.net/projects/pythonsiphon/ Although that is showing 0.3.1 as the current release; http://sourceforge.net/project/showfiles.php?group_id=20509&release_id=6610 0 Which appears to supercede 0.3.4. Suchandra, should we be going to tummy.com or SourceForge? Oh, and the 'Home Page' link at SF doesn't work either, it redirects to http://ciphon.sourceforge.net/ which gives me a big 'Not Found'. Regards, Andy -- Content free posts a speciality From nhodgson at bigpond.net.au Thu Dec 27 18:53:27 2001 From: nhodgson at bigpond.net.au (Neil Hodgson) Date: Thu, 27 Dec 2001 23:53:27 GMT Subject: Two languages, too similar, competing in the same space. References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> Message-ID: Ron Stephens: > Bruce Eckles said that, if a language can't give dramatic productivity > improvements over a predecessor language, that it does not justify one's > switching. 10% improvements are not nearly enough, he said. Most people are not switching to Ruby from Python but from languages like Perl and C++, and Ruby is more than 10% better than those languages. I'll be quite happy if Ruby does achieve 'world-domination' and am forced to use as it is a much better language than most. Neil From bmcyitz at freebox.com Wed Dec 19 10:42:31 2001 From: bmcyitz at freebox.com (Yitz) Date: 19 Dec 2001 07:42:31 -0800 Subject: Tkinter+ backspace characters (and an re.sub problem) References: <3c202041$1_6@goliath.newsgroups.com> Message-ID: "David Mallwitz" wrote in message news:<3c202041$1_6 at goliath.newsgroups.com>... >The Tkinter Text widget doesn't understand... '\x08' as the > backspace character... > a solution... doing a > regexp sub on the string before sending it to the text widget. That seemed > like a good idea... I agree. > >>>string = 'all work and no play makes Jack\x08\x08\x08\x08Dave a dull boy' > >>>a = re.compile('.\x08') Watch out - the "." will also match \x08. > >>> a.sub('', string) ###fails - would have thought there should be 3 > '\x08's left, or none at all You need to say string = a.sub('', string). You can't get all of the backspaces at once; you will need a loop. Here is one way: a = re.compile('[^\x08]\x08')n = 1 while n: (string, n) = a.subn('', string) string = re.sub('^\x08+', '', string) Hope this helps, Yitz From issac at myfirstlink.net Thu Dec 27 00:39:55 2001 From: issac at myfirstlink.net (Issac) Date: Wed, 26 Dec 2001 23:39:55 -0600 Subject: custom split function References: Message-ID: <002901c18e98$ea767710$6401a8c0@mojave> Is this a binary file? What would be the criteria for splitting the characters? Issac ----- Original Message ----- From: "I.J." Newsgroups: comp.lang.python To: Sent: Monday, December 24, 2001 10:29 PM Subject: custom split function > Hi > Is there a way to spit file content into list of individual > bytes/characters. > I know it could be done with substring manipulation but I hope there is more > direct way. > Bye > > > -- > http://mail.python.org/mailman/listinfo/python-list --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.310 / Virus Database: 171 - Release Date: 12/19/2001 From danielk at aracnet.com Thu Dec 27 11:08:19 2001 From: danielk at aracnet.com (Daniel Klein) Date: Thu, 27 Dec 2001 08:08:19 -0800 Subject: REPOST: Re: Where to post Jython questions? References: Message-ID: <6$--$$_----_%-$__$@news.noc.cabal.int> On 27 Dec 2001 01:38:24 +0100, Martin von Loewis wrote: >Oleg Broytmann writes: > >> On Wed, Dec 26, 2001 at 09:45:22AM -0800, Daniel Klein wrote: >> > Is the the proper place to post questions/conversations for Jython? If >> > not, please advise. >> >> http://www.jython.org/, Resources, Mailing Lists. > >Nevertheless, I think questions on Jython are welcome, here, too. Some >may turn out to be Python questions proper. > >Regards, >Martin Ok then... The question is: Is there a Jython equivelant of '.pythonrc' (or '.idlerc') to automatically load modules on startup? Dan ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Daniel Klein Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:30:05 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775728 27193 211.57.49.2 (31 Dec 2001 05:15:28 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:15:28 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From sasoft at gmx.de Mon Dec 3 13:13:28 2001 From: sasoft at gmx.de (cruciatuz) Date: Mon, 3 Dec 2001 13:13:28 -0500 Subject: age of new pythonistas [was: The Editor Poll results are in!] Message-ID: <20011203131328.B1508@blackscarab> On Mon, Dec 03, 2001 at 04:48:46AM +0000, David Lees wrote: > Same here, 51, wrote first program 38 years ago. Discovered Python > close to a year ago, but have programmed in it sporatically(sp.). Great > language. I just reply because i decided to lower the average "python-user-age" ;) I am 18. A few uninteresting things about me (clever people should skip that): Python is one of my hobbies and i don't earn money with it (i'm still going to school). Python is great if i want to code little snippets of code which will do interesting things for me. that's my case, python is great for most other (bigger) projects as well (zope, etc.). I came to python because i hated Java and C++ and Delphi and Basic because of their weaknesses. As a beginner you're directly confronted with theses weaknesses! Then i did something in Perl, which was cool. But ... you know what Perl is like: sometimes it's like Perl is making fun of you. It was like Perl would say: "haha, you'll never learn all about me and you'll forget after one week what this code is was used for" I discovered python: and it was a language like i'd have designed it myself. I really like everything about it. am not a skilled coder, i have to admit. but i'd like to learn programming in a professional way to earn money with it. i hope i can do this with python, because i am idealistic about python and idealistic about computers as well :) -- Stefan Antoni ---------------------------- Mon Dez 3 12:59:18 EST 2001 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 240 bytes Desc: not available URL: From israelrt at antispam.optushome.com.au Sat Dec 22 23:38:01 2001 From: israelrt at antispam.optushome.com.au (israel r t) Date: Sun, 23 Dec 2001 15:38:01 +1100 Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic References: <3218013921984060@naggum.net> <3218018853244911@naggum.net> <92592u85pq0t8hvhklgq5jjojiuldtv7dr@4ax.com> <3218030326803537@naggum.net> Message-ID: On Sat, 22 Dec 2001 17:18:50 GMT, Erik Naggum wrote: . . { much spectacularly irrelevant , incoherent and grammatically challenged psychotic ravings by Eroc Nogumshoe deleted } > blamed on those attacked. History is indeed repeating itself. No, the No Gum is repeating himself. From mixo at beth.uniforum.org.za Mon Dec 3 03:34:53 2001 From: mixo at beth.uniforum.org.za (mixo) Date: Mon, 03 Dec 2001 10:34:53 +0200 Subject: termios Message-ID: <3C0B392D.3080801@beth.uniforum.org.za> Here is the situation : I want to connect to device that connected on a serial port (ttySx - linux speak). My problem : all the functions in 'termios' require a file descriptor. Is there a way open 'ttySx' and get a file descriptor? For instance will, fd = open ('/dev/ttyS0') actually work? From fredrik at pythonware.com Sat Dec 1 20:30:29 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sun, 02 Dec 2001 01:30:29 GMT Subject: which is best for a singleton, module or class? References: <9sbd8i$680$1@wanadoo.fr> <3C005692.173907B3@engcorp.com> <3C03275E.2C4D8149@engcorp.com> <3C045C07.BA7B3FE6@engcorp.com> <3C05AE56.E2261313@engcorp.com> <3c05b472$1@207.229.64.20> <3C05C9C3.ADC96FB5@engcorp.com> <8ef9bea6.0111290932.4afa618a@posting.google.com> <83elmftfbt.fsf@panacea.canonical.org> <8ef9bea6.0112011607.464fcd9f@posting.google.com> Message-ID: Hung Jung Lu wrote: > > > Please don't do that, except as a joke. Programs have bugs enough > > without obnoxious people deliberately making them harder to > > understand > > Joke? :) It's not a joke. Zope Corporation (the same *obnoxious* > people that hired Guido, ha!) uses it. and you think Zope is easy to understand? (or was that a joke? ;-) From chris.gonnerman at newcenturycomputers.net Wed Dec 26 08:53:47 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Wed, 26 Dec 2001 07:53:47 -0600 Subject: /usr/bin/env: python: No such file or directory References: <9vivft$593$1@peabody.colorado.edu> <171220010818339518%jwbaxter@spamcop.net> <9vnvue$m5d$1@peabody.colorado.edu> <9vo6ng$mhs$1@nntp6.u.washington.edu> Message-ID: <004a01c18e14$d67b9d00$0101010a@local> ----- Original Message ----- From: "Trond Eivind Glomsr?d" > nbecker at fred.net writes: > > > The correct solution is for Redhat to put: > > #!/usr/bin/python1.5 > > The scripts don't depend on Python 1.5 - they depend on having > certain modules available, with the same functionality as they > were developed on. True, but irrelevant. If Red Hat did as nbecker at fred.net suggested, this would solve the problem with incompatible Python installs, assuming only that the system admin did not remove the 1.5 stuff before installing 2.x. The fact that the statement #!/usr/bin/python1.5 at the top of the script does not SAY "certain modules" must be available does not change the fact that it would work fine. Another option would be to put #!/usr/bin/redhat-python at the top of the script (creating the correct link in the process) to make the purpose more transparent. From ngps at madcap.dyndns.org Wed Dec 5 11:23:29 2001 From: ngps at madcap.dyndns.org (Ng Pheng Siong) Date: 5 Dec 2001 16:23:29 GMT Subject: license key validation - encryption/decryption References: <9ujgam$a1e$1@news1.xs4all.nl> Message-ID: <9ulhm1$mmk$1@dahlia.singnet.com.sg> According to Gerhard H?ring : > On Tue, Dec 04, 2001 at 10:48:05PM +0100, Irmen de Jong wrote: > > > How do i validate it at the customer site that the > > > "key" installed is valid? > > > > You're looking for a secure hash of your license file, to protect the > > contents of the file from tampering. The sha module can do this for > > you. > > The next problem is where to store the hash. The hash is part of the signature. You sign your "feature set descriptor" with your private key. Install the signature with the application. > Which doesn't help at all if both keys are available to the potential > cracker. Your private key is not installed with the application. Indeed, it should be kept very securely. Only the public key is installed, to verify the signature. Such schemes won't stop determined pirates, though. They only keep honest people honest. -- Ng Pheng Siong * http://www.post1.com/home/ngps From res0ne7x at verizon.net Tue Dec 11 12:44:50 2001 From: res0ne7x at verizon.net (Gary Herron) Date: Tue, 11 Dec 2001 09:44:50 -0800 Subject: Some stupid questions In-Reply-To: <9v5ea4$d1ek8$1@ID-119882.news.dfncis.de> References: <9v5ea4$d1ek8$1@ID-119882.news.dfncis.de> Message-ID: <200112111744.fBBHilY25323@out006pub.verizon.net> On Tuesday 11 December 2001 09:04 am, Another rookie wrote: > Hi I'm an old fart and a newbie. So I hope you'll bear with me and answer a > few basic questions for me. Feel free as patronizing as you want. > > I've just downloaded the latest version of Python 2.2, and have started > learning to program from the web tutorials. If I stick with it ...... > > ... Will I be able to compile my progs as executables, so that they can run > on anybodies machine, whether or not they have a version of Python > installed? > > ... If not, does jpython or jython allow me to compile my progs as java > apps, so that they will run on any machine with java? (These questions are not stupid, because, in fact, the process of "freezing" a program is neither easy nor obvious. The packages for doing so have been evolving for years now, and are getting quite sophisticated.) Yes to all the above questions. We call it "freezing" a program and there are several way to do it. Gordon McMillan's Installer: I've used earlier versions with nice results. Version 5, just recently announced, looks even better, apperently working on both Window and Linux http://www.mcmillan-inc.com/install5_ann.html Thomas Heller's py2exe: Works well for creating Windows executables, but has no Linux support. http://starship.python.net/crew/theller/py2exe/ The Jython package has "jythonc" which compiles a Python program to Java and can zip it and dependencies into a jar file. I've used it to build applets which run in web browsers. Python is still distributed with a freeze.py, a much older package for freezing a program. Its functionality is far surpassed by the above packages. Gary Herron From mwh at python.net Fri Dec 7 11:13:46 2001 From: mwh at python.net (Michael Hudson) Date: Fri, 7 Dec 2001 11:13:46 -0500 (EST) Subject: cmd module documentation lying? In-Reply-To: <9uqp2j+pdea@eGroups.com> Message-ID: [I'm sending this back to the list, 'cause it might be helpful to others] On Fri, 7 Dec 2001, pwang99c wrote: > Michael, > > I'd love to contribute documentation, but i don't know how. There is > a good bit of information on python.org/doc, but it could be fixed up > a little and an example might not hurt. I would gladly do those. There's http://python.sourceforge.net/devel-docs/about.html but that's not too helpful, and http://python.sourceforge.net/devel-docs/doc/doc.html which is probably a bit overwhelming. Do you speak TeX at all? The Python docs are in LaTeX, and are part of the source documentation or CVS. If you can do TeX, then great; send patches as described in http://www.python.org/patches/ If you can't, but can find the relavent sections of the docs and can supply words, then you can still submit a patch with little or no markup -- I think Fred's got quite good at adding markup to verbiage by now :) > oh, and i've submitted a bug report to David Beazley on his book. Goody. Cheers, M. From fperez528 at yahoo.com Sat Dec 15 08:47:27 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Sun, 16 Dec 2001 13:15:27 +2328 Subject: /usr/bin/env: python: No such file or directory References: Message-ID: <9vivft$593$1@peabody.colorado.edu> ddidierd78 wrote: > Hi, > > I am running redhat 7.2 and installed the following: > > python2.2-2.2b1-2.i386.rpm > python2.2-devel-2.2b1-2.i386.rpm > python2.2-tools-2.2b1-2.i386.rpm > > When trying to run a script, I get the following message: > > /usr/bin/env: python: No such file or directory > > additionally the only thing relating to python in /usr/bin is the file > python2.2 > > > Thanks for any help, > Dan the problem is Rhat installs python1.5 as python and python2.x as python2. So you need to symlink python2.x to python in /usr/bin. cheers, f From laurent.pointal at laposte.net Sat Dec 1 13:33:13 2001 From: laurent.pointal at laposte.net (Laurent Pointal) Date: 01 Dec 2001 18:33:13 GMT Subject: Opening a file in shared mode References: Message-ID: Laurent Pointal wrote in news:Xns916AC11D81707laurentpointalwanafr at 213.228.0.33: > The question is in the title... ... > If anybody have a solution... thanks. "Andreas Jung" give me the key. It works nice opening with "w" or "a" and using Gnu-Win32 tail command... but fail for the editor I use - so the problem is not in Python. Thanks. A+ Laurent. From tuttledon at mailandnews.com Fri Dec 7 18:04:18 2001 From: tuttledon at mailandnews.com (Don Tuttle) Date: Fri, 07 Dec 2001 23:04:18 GMT Subject: Lists of attributes References: Message-ID: eh.. that should be NO registry involved for the PythonWare Python Distributions. From idoerg at cc.huji.ac.il Sat Dec 29 07:39:44 2001 From: idoerg at cc.huji.ac.il (Iddo) Date: 29 Dec 2001 04:39:44 -0800 Subject: REPOST: Re: long lines in HTML attachments References: <7a256ac1.0112270203.77efb6f2@posting.google.com> Message-ID: <2$--$$_----_-_$$$$@news.noc.cabal.int> "Gillou" wrote in message news:... > Encode your mail body with quoted printable encoding (see doc of module > "quopri"). This way, the recipient's mail client is supposed to re-built the > lines broken by quoted-printable encodings. > I tested this successfully with OE5, Netscape messenger and StarOffice Mail. > Thanks Gilles. Using quopri did the trick :-) Iddo > Don't forget to add this header to your mail: > > "Content-Transfer-Encoding: quoted-printable" > > Or download Python 2.2 that has a new "email" standard package that handles > email messages (parse and marshal/serialize) as Python objects (easier to > handle than playing with the various packages you may need for handling > emails). > Heard that this package is available separately and may work with older > Python versions but I have no URL for this (Google for this). > > HTH > > --Gilles > > "Iddo" a ?crit dans le message news: > 7a256ac1.0112270203.77efb6f2 at posting.google.com... > > Hi, > > > > I am trying to use smtplib and mimecntl to email an attached html > > document. The trouble is that the html document contains some very > > long physical lines (500 chars). It is important that those lines be > > preserved as such, since I use

 formatting in the htdoc. Some
> > mail clients (e.g. Pine 4.40) truncate or insert a linefeed in those
> > lines, creating a mess. Any way of attaching my long-lined files and
> > getting them through intact? Following is a code snippet of what I do.
> > Any help would be appreciated.
> >
> > Thanks,
> >
> > Iddo
>

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: idoerg at cc.huji.ac.il (Iddo)
Newsgroups: comp.lang.python
Subject: cmsg cancel <7a256ac1.0112290439.677e909 at posting.google.com>
Control: cancel <7a256ac1.0112290439.677e909 at posting.google.com>
Date: Mon, 31 Dec 2001 04:19:09 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774784 27193 211.57.49.2 (31 Dec 2001 04:59:44 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:59:44 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From jkraska at san.rr.com  Fri Dec  7 13:25:50 2001
From: jkraska at san.rr.com (Courageous)
Date: Fri, 07 Dec 2001 18:25:50 GMT
Subject: Calling a generator multiple times
References: <200112061113290670.0100F457@mail.rdc1.sdca.home.com>     <3C110807.5B739EAA@letterror.com>
Message-ID: <63221us0j1tl0jbjkmeoocj09gmomvjj16@4ax.com>

>You really need to dig into the python-iterators list archives.
>This has been discussed over and over and over. It's really
>not as bad as you think. You need to reset your brain, play
>with generators a bit more. It becomes really natural after
>a while.

I don't have any personal problem with understanding them;
I've worked extensively with stackless prior to this. There's
no problem.

What I have a problem with is the inconsistency between the
apparent definition and the result. Not even continuations
behave this way.

C//



From rockvz at yahoo.com  Tue Dec  4 00:25:16 2001
From: rockvz at yahoo.com (Rock VZ)
Date: Mon, 3 Dec 2001 21:25:16 -0800 (PST)
Subject: license key validation - encryption/decryption
Message-ID: <20011204052516.69444.qmail@web13509.mail.yahoo.com>

Hi,

I have a requirement to write a license file in XML.
The xml file will typically consist of a feature name
a "license key" to enable/disable the feature.

How do i generate this "encrypted license key" for
different features for different customers?

How do i validate it at the customer site that the
"key" installed is valid?

For example:
i can have 10 features for the product and each
feature has a encrypted key to enable the feature.

(I would be using python for coding the above.)

thanks
Rock


=====


__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com



From nspies.geo at yahoo.com  Wed Dec 12 04:42:03 2001
From: nspies.geo at yahoo.com (nspies.geo)
Date: Wed, 12 Dec 2001 09:42:03 -0000
Subject: Designing for Inheritance
Message-ID: <9v78pb+8579@eGroups.com>

Hi all,
I'm in the process of writing a fairly complex data-storage class,
where one of the main functions needed is pulling parts of the data
out intact.  Most of the time, these parts, extracted from the class,
should also be returned as objects of the same class.

The problem comes when I wish to add some functionality to the class:
there are likely an infinite number of ways to refer to the same data,
so I, and others, will likely be creating numerous base classes that
take a different approach.

The problem is thus: how do I design the base class so that it will
create an extracted object of the correct type, even if it's been
inherited?  It may well be that the inherited class needs to wrap the
base class function, but I do not wish to re-write the function in
every base class.

Here it is in code.


--

class BaseAlignment:
   def extractx(self, x):
      extraction = BaseAlignment()
      extraction = self.data[0:x]

      return extraction

class InheritedAlignment(BaseAlignment):
   def extractx(self, x):
      BaseAlignment.extractx(self, x)

      #do something more here...

      return extraction

--

The problem is that the return value of extractx from
InheritedAlignment is a BaseAlignment....  When the inherited function
attempts to add the inherited data to the extraction, it'll fail quite
miserably.

The only solution that I can think of is to create a copy of self and
modify that, but that smacks a bit of inelegance -- and probably is
asking for too many problems.

Any hints?

Thanks,

Noah
nspies at geocities.com




From lac at strakt.com  Wed Dec  5 11:03:50 2001
From: lac at strakt.com (Laura Creighton)
Date: Wed, 05 Dec 2001 17:03:50 +0100
Subject: COM servers from within a Python service (on Win2k) 
In-Reply-To: Message from Duncan Booth  
   of "Wed, 05 Dec 2001 15:49:14 GMT."  
References:   <83y9kiouf2.fsf@panacea.canonical.org>    
Message-ID: <200112051603.fB5G3oua019418@ratthing-b246.strakt.com>

Please make a recipe of it and post it to the Activestate Cookbook.
The only hard thing about that is logging in the first time.

Laura Creighton



From kirill at xyz.donetsk.ua  Wed Dec 19 12:29:32 2001
From: kirill at xyz.donetsk.ua (Kirill Simonov)
Date: Wed, 19 Dec 2001 19:29:32 +0200
Subject: It's Tk's fault
In-Reply-To: <9vp5bv$gvfps$1@ID-12869.news.dfncis.de>; from store_li@sina.com on Wed, Dec 19, 2001 at 12:31:20PM +0800
References: <9vp5bv$gvfps$1@ID-12869.news.dfncis.de>
Message-ID: <20011219192932.A698@xyz.donetsk.ua>

On Wed, Dec 19, 2001 at 12:31:20PM +0800, Kick wrote:
> I have done some experiment:
> 
> Using the same code to retrieve data from database:
> 
> 1. Display data using console by print clause
> 2. Display data using HTML using gb2312 encoding.
> 3. Display data using wxPython
> 4. Display data using Tk

Is your data a unicode string or a regular string?
In other words, what does "print type(data)" show?

> Only tk display a wrong char. I know Tk is easy to use and modify. So is
> there any one who can help me to display Chinese code correctly in Tk
> widget?


Kirill




From cmbchris at mac.com  Wed Dec 26 23:10:02 2001
From: cmbchris at mac.com (Chris Dutton)
Date: Wed, 26 Dec 2001 23:10:02 -0500
Subject: Range of characters?
References:  <3C2A074D.8214E5E0@earthlink.net>
Message-ID: 

in article 3C2A074D.8214E5E0 at earthlink.net, Mari Mcdade at
wurmy at earthlink.net wrote on 12/26/01 12:27 PM:

> You don't need the string module, really, but using the literal
> string "ABCDEFGHIJKLMNOPQRSTUVWXYZ" seemed a bit ugly. ;-)

Well, this is even less ugly then.

from string import uppercase as u
for c in u: 
    print "%sython" % c

or, in my new love, Ruby...

for c in "A".."Z"
    puts "%sython" % c
end



From chrishbarker at attbi.com  Mon Dec 10 13:33:02 2001
From: chrishbarker at attbi.com (Chris Barker)
Date: Mon, 10 Dec 2001 10:33:02 -0800
Subject: Creating a "package" using C extensions?
References: <4bo41u8de4r4njcchh4g3mcuvdhqohhu39@4ax.com>   
Message-ID: <3C14FFDE.97DA740A@attbi.com>

Courageous wrote:

> It's too bad there's not a way to create a package-level .dll
> which responds to Python in such a way as to offer up its
> internal modules, but all from within a single .dll. That would
> be cool.


Gordon McMillan wrote:
> So implement .c as your extension module, and arrange
> for it to have module1, module2 etc. as attributes. Probably a
> dozen or two lines of perfectly kosher code in init.

IF you figure out how to do this, I'd love to see an example. It owuld
be prettyhandy for me as well. Maybe even a cookbook entry?

-Chris


-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at attbi.net                ---           ---           ---
                                     ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------


From johnroth at ameritech.net  Wed Dec 19 00:52:31 2001
From: johnroth at ameritech.net (John Roth)
Date: Tue, 18 Dec 2001 21:52:31 -0800
Subject: Dictionaries as records
References: 
Message-ID: 

"Bill Wilkinson"  wrote in message
news:QKQT7.27703$t07.3920324 at twister.midsouth.rr.com...
> I have been happily using a list of dictionaries to hold  table data
for
> years.
> For the first time, this method is proving less than efficient because
of
> the amount
> of memory overhead the dictionaries produce.  I have a file with 200K
> records and
> 16 fields.  This file is parsed and each row is put into a dictionary
and
> the dictionary is
> added to a list.  The raw file is only about 50mb.
>
> I was shocked to see that my memory use jumped to 500MB!   When I
delete the
> list the memory is returned to the system, so I know that the memory
is
> being used in the dictionaries.

Your records seem to average around 250 bytes, so that's about 16
characters per field. Object overhead for each object is roughly the
same as this (it might be larger, I haven't looked at the headers
recently.)

> What strikes me as odd is that I can create a list of 200K
dictionaries with
> test data (a copy of the same record over and over) and the amount of
memory
> used is only half.

The problem with this is that you may be reusing the same object in your
test. It's real easy to do unless you take precautions to insure that
you get
unique objects. If that turns out to be the case, then you've got a
solid
250K overhead for dictionaries. This actually seems reasonable; your
50M of data would expand to around 100M when the object headers
are added, and you would get the same amount for the keys unless you
made sure that you reused the same objects.

> Having read many of the articles on this newsgroup about how
dictionaries
> are sized, I am aware of some of the memory issues involved with using
a
> great number of dictionaries as I am.
>
> Can someone who has faced this issue and found a workaround please
fill me
> in. I know one can use a list of lists or a list of tuples, but had
rather
> stick to the dictionaries because of some library issues.
>
> Thanks in advance,
>
> Bill

John Roth
>
>




From mail at andreas-penzel.de  Mon Dec  3 13:17:43 2001
From: mail at andreas-penzel.de (Andreas Penzel)
Date: Mon, 3 Dec 2001 19:17:43 +0100
Subject: number of values in a list
References: <9uebug$81d1i$1@ID-69142.news.dfncis.de>
Message-ID: <9ugfkn$8ejog$1@ID-69142.news.dfncis.de>

Thanks, that?s it.

- Andreas




From greg at cosc.canterbury.ac.nz  Thu Dec  6 18:22:47 2001
From: greg at cosc.canterbury.ac.nz (Greg Ewing)
Date: Fri, 07 Dec 2001 12:22:47 +1300
Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)
References:  <9umok1$btd$1@nntp1-cm.news.eni.net>
Message-ID: <3C0FFDC7.D0868E57@cosc.canterbury.ac.nz>

"Stuart D. Gathman" wrote:
> 
> Provided that all tabs precede all spaces in the leading indentation, and
> that the tab expansion value is sufficiently large (>= 4 in the above
> example)

That comment illustrates that there is still a
relationship that must hold between tab and space
widths. It's a looser one than we have now,
but I think it's still too potentially confusing.
Best to define tabs and spaces as completely
incommensurate, and ban mixing them altogether.

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg


From dalke at dalkescientific.com  Thu Dec 27 05:15:21 2001
From: dalke at dalkescientific.com (Andrew Dalke)
Date: Thu, 27 Dec 2001 03:15:21 -0700
Subject: A new message board is up
References: <40dbad98.0112262232.1868734e@posting.google.com>
Message-ID: 

Andrew Nguyen wrote:
>A new message board (that doesn't have the Usenet delay) is up!

>Also, usenet SUXXOR (sucks) because itttt issss soooo
>cunfuseeeng... Why not switch to an EZBoard? Why have maling
>lists that are too confusing?  I for one say that we create a
> NEW forum!

But it does require a login, registration, including address,
income(!), and marital status(!!) information, and a 300 line
license agreement.  Since it's a web based system there's also
a lack of good search system, no way to add your own filters,
no support for off-line reading, killing a thread, archive
messages, or all those other features Usenet readers have
accumulated over time.  I don't think it can scale up to
several hundred messages a day, like c.l.py has.

Finally, it's a highly moderated list, and the moderator has
the ability to not only kill a thread but can apparently decide
who can and cannot particiate.

I'll stick with a bit of delay.  But then, I started reading
usenet on a CDC Cyber machine in '89, so what do I know of
these new-fanged gee-haws.  :)

                    Andrew
                    dalke at dalkescientific.com





From nika at kassube.de  Sat Dec 29 14:33:30 2001
From: nika at kassube.de (Nils Kassube)
Date: 29 Dec 2001 20:33:30 +0100
Subject: REPOST: Re: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.)
References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de>  <3c2deb81.11823921@news.t-online.de>
Message-ID: <7$--$$_----__%$__$@news.noc.cabal.int>

gerson.kurz at t-online.de (Gerson Kurz) writes:

[Error checking without exceptions]

Okay, now think about how useful your approach is if you call more than
one function and there is more than one possible way of things going
wrong. Do you really want to maintain error codes this way and give 'em 
to the function calling your function? 

> So ? After all, C doesn't need it, and I think few C programmers would
> call this feature the "most missing", or? 

C and programmers who like C should die a slow and painful death for
holding back the computer industry for two decades.  

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Nils Kassube 
Newsgroups: comp.lang.python
Subject: cmsg cancel <871yhd7red.fsf at kursk.kassube.de>
Control: cancel <871yhd7red.fsf at kursk.kassube.de>
Date: Mon, 31 Dec 2001 03:44:31 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774602 27193 211.57.49.2 (31 Dec 2001 04:56:42 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:56:42 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From tjiit at yahoo.com  Wed Dec 26 13:37:12 2001
From: tjiit at yahoo.com (tjiit)
Date: Wed, 26 Dec 2001 19:37:12 +0100
Subject: REPOST: Re: strange Tkinter problem
References:  <3C297E61.70701@home.com>  
Message-ID: <6$--$$-$$$$%_%__%$@news.noc.cabal.int>

snip!
[ how to use threads and solve my problem ]

I implemented this already before my 1st post. I just wondered that
Tkinter first executes the network code and returns afterwards instead
doing these 2 things simultanous. I had a complete false understanding
how such GUI things work. 
Thank you for your advice!

   - tjiit

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!news.tele.dk!small.news.tele.dk!134.75.7.11!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: tjiit 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 04:13:15 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009776138 27193 211.57.49.2 (31 Dec 2001 05:22:18 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:22:18 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From woodsplitter at rocketmail.com  Fri Dec  7 08:59:37 2001
From: woodsplitter at rocketmail.com (stalin)
Date: 7 Dec 2001 05:59:37 -0800
Subject: Total newbie: errors compiling PIL with VC6++
References: <1007655247.498935@news.l3.wish.net>
Message-ID: <7876a8ea.0112070559.53ecbb4@posting.google.com>

[Stani Michiels tries to compile PIL on WinXP, then wonders if there
are binaries available]

WinXP should support binaries compiled for Win32 in general.  You
didn't say which version of Python you're using, but there are PIL
Win32 binaries for Pythons 2.1.1 and 2.2b1 at the PIL home page:

http://www.pythonware.com/products/pil/index.htm

The provided installers are very simplistic; they always install to
C:\py21.  You can transfer the crucial files from C:\py21 to a stock
Python installation by:
- copying the .pyd files to Python's DLLs directory
- placing the PIL directory from C:\py21 on your PYTHONPATH. 
PYTHONPATH is an environment variable similar to the Windows PATH
variable you might be familiar with, but for the purpose of Python
module import resolution--equivalent to Java's CLASSPATH.

Alternatively, you could just use Pythonware's Python distribution,
which includes PIL.

http://www.pythonware.com/products/python/index.htm

If you choose this route, make sure you're actually calling the
Pythonware distribution's python.exe after you install it, rather than
your previous distribution's python.exe.  The Pythonware distro has a
goal of peaceful coexistance with other distros, so it won't install
its python.exe as the default, or otherwise mess with the registry. 
You, as a newbie, might be better off having no more than one
distribution installed on your system to avoid confusion (and
Pythonware's distro might be the right one in this case).


From DaveP at dpawsonNOSPam.freeserve.co.uk  Sun Dec 30 02:47:17 2001
From: DaveP at dpawsonNOSPam.freeserve.co.uk (Dave Pawson)
Date: 30 Dec 2001 07:47:17 GMT
Subject: REPOST: Re: Reg-Ex and lambda optimization
References: 
Message-ID: <3$--$$_----__%--%$@news.noc.cabal.int>

"MikeCrowe"  wrote in
news:mailman.1009670854.26405.python-list at python.org: 

> Hi folks,
> 
> New to Python, and had this question.  I couldn't figure out how to
> read a directory and filter the results by what I wanted.  I basically
> wanted to read: 
>     dir\db*.*

Daft name, great module though,
look for glob() in your documentation.

 Unsure how I found it with a name like that,
but boy does it do the business! Keep the re package
for file contents, and scour the documentation.

HTH DaveP

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Dave Pawson 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 02:16:27 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774327 27193 211.57.49.2 (31 Dec 2001 04:52:07 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:52:07 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From robin at jessikat.fsnet.co.uk  Sat Dec 15 11:47:41 2001
From: robin at jessikat.fsnet.co.uk (Robin Becker)
Date: Sat, 15 Dec 2001 16:47:41 +0000
Subject: default webbrowser
Message-ID: 

I'm trying to use the webbrowser module, but don't seem to have a
'default' webbrowser set up somehow. Any win32 experts know what I have
to do to get win2k to use netscape as a default browser?
-- 
Robin Becker


From fastconnexion at hotmail.com  Sat Dec  8 20:01:44 2001
From: fastconnexion at hotmail.com (FastConnexion)
Date: Sun, 09 Dec 2001 01:01:44 GMT
Subject: Keystone VB6 - 18 cd's - all levels 1 to 17 for 60$us for the rest
 on year 2001
Message-ID: 

Keystone VB6 - 18 cd's - all levels 1 to 17 for 60$us for the rest on year 2001






From johngrayson at home.com  Wed Dec  5 06:54:47 2001
From: johngrayson at home.com (johngrayson42)
Date: Wed, 05 Dec 2001 11:54:47 -0000
Subject: Tk callback at certain time point?
Message-ID: <9ul1u7+mon6@eGroups.com>

Use after...

from Tkinter import *

def printEnd(wid):
    wid.configure(text="Done!!!")
    wid.after(2000, wid.quit)

root = Tk()
widget = Label(root, text="wait please...")
widget.pack()
widget.after(10000, printEnd, widget)
widget.mainloop()

      John




From hfoffani at yahoo.com  Wed Dec  5 06:46:30 2001
From: hfoffani at yahoo.com (Hernan M. Foffani)
Date: Wed, 5 Dec 2001 12:46:30 +0100
Subject: Using *just* the IDLE editor
References: <3C0C4FE1.5B218CE0@st-annes.oxford.ac.uk> <3C0CC18B.6060103@olen.to> <3C0D4A01.470880CE@st-annes.oxford.ac.uk>
Message-ID: <20011205092429.411$UG@news.newsreader.com>

"Michael Williams" escribi?
> Joonas Paalasmaa wrote:
> >
> > Use idlefork.
> >
> > http://idlefork.sourceforge.net/
>
> That does exactly what I'm after. Thanks.
>
> Is there a short answer to the difference between the two versions of
> IDLE as to how one launches the shell and one an editor?

Well the short answer seems to be that one of the original author of
idlefork just want it that way. He/She didn't like the previous behaviour.
By the way, one of the original author of Idle apparently couldn't get
used to this new behaviour and, if my memory and my ears didn't betrayed
me, I recall to have listened his voice from the outfar imploring:
"please, gimme my shell baaack!" but I can be wrong...
:-)

The thing is that there are different users. I know for sure that this
is being considering and this problem will be addressed if it's not
already done, at least in idlefork's CVS.

Regards,
-Hernan






From matt at lorfeld.com  Fri Dec 28 02:24:17 2001
From: matt at lorfeld.com (mlorfeld)
Date: 27 Dec 2001 23:24:17 -0800
Subject: REPOST: Re: Python Popularity: Questions and Comments
References: <3C2A9D33.67FEC261@earthlink.net>
Message-ID: <2$--$$_--_$$$_-_%$@news.noc.cabal.int>

> How is Python doing popularity wise? 
I'd have to say that with most developers that have tried it it is
very popular (ok so that wasn't too specific).  I heard that ILAM
(Industrial Light and Magic) basically standardized on Python for
their projects (most notably Star Wars Ep. 1&2)

>From a programmer's perspective (albiet a young soon-to-be CS grad) I
like Python's flexibility.  I like how it is OO, yet at the same time
has many procedural characteristics.  I also haven't quite been sold
on the data-centric model that C++/Java implement, granted that does
mean you have to do some extra type-checking.  I also like the fact
that it is an evolving language, with from what I can see, a great
bazaar style approach: In its 1.5.2 iteration, Python was intriguing,
yet it lacked some essential things (such as a Perlesque chomp), then
I took a look at 2.x and the strip function was implemented - saving
me a great deal of repetition in programming.

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newsengine.sol.net!137.192.100.17.MISMATCH!upp1.onvoy!msc1.onvoy!ply1.onvoy!onvoy.com!newspeer.cwnet.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail
Message-ID: 
Control: cancel <32c382ad.0112272324.4c78689b at posting.google.com>
Subject: cmsg cancel <32c382ad.0112272324.4c78689b at posting.google.com>
From: matt at lorfeld.com (mlorfeld)
Newsgroups: comp.lang.python
X-No-Archive: yes
Lines: 2
NNTP-Posting-Host: wonenara.ozemail.com.au
X-Trace: ozemail.com.au 1009643086 203.108.164.177 (Sun, 30 Dec 2001 03:24:46 EST)
NNTP-Posting-Date: Sun, 30 Dec 2001 03:24:46 EST
Organization: OzEmail Ltd, Australia
Distribution: world
Date: Sat, 29 Dec 2001 15:06:44 GMT

This message was cancelled from within Mozilla.


From loewis at informatik.hu-berlin.de  Fri Dec 28 18:15:59 2001
From: loewis at informatik.hu-berlin.de (Martin von Loewis)
Date: 29 Dec 2001 00:15:59 +0100
Subject: REPOST: Re: pth files - can they prepend to sys.path?
References:   
Message-ID: <8$--$$_-----$$%__$@news.noc.cabal.int>

"Skip Montanaro"  writes:

> You are one sly dog, Martin... ;-)

I added the import facility to .pth files, so I should know how to use
it :-) Turns out I didn't ... Due to what I would consider a bug in
that facility, adding a line

import sys;sys.path.insert(0,"/tmp")

also has the desired affect, without requiring a helper module
(originally, the plan was that import lines only contain a single
import statement; that constraint is not enforced).

Regards,
Martin

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Martin von Loewis 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 04:32:11 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774992 27193 211.57.49.2 (31 Dec 2001 05:03:12 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:03:12 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From jdhunter at nitace.bsd.uchicago.edu  Mon Dec  3 19:27:27 2001
From: jdhunter at nitace.bsd.uchicago.edu (John Hunter)
Date: Mon, 03 Dec 2001 18:27:27 -0600
Subject: httplib request is slow on read()
Message-ID: 

I am using httplib to make a direct GET request, and then dumping the
data to file with 

of = open('temp.dat', 'w')
f = h.getfile()
data = f.read()
of.write( h.getfile().read() )

where h is the httplib object.

The read() part is really slow.  When I request the same data from my
browser, it loads very quickly, which suggests to me that there may be
a faster way to get this data into the file.

I don't know if read() is waiting for some end of file that is
delayed... or what...

Any suggestions?

Thanks,
John Hunter


From wurmy at earthlink.net  Fri Dec 21 21:36:18 2001
From: wurmy at earthlink.net (Hans Nowak)
Date: Sat, 22 Dec 2001 02:36:18 GMT
Subject: Deleting variables referenced in nested scope
References: 
Message-ID: <3C23F041.709393B2@earthlink.net>

Jesse W wrote:
> 
>         As I was playing arround with the new nested scopeing rules in
> Python 2.2a2, I got a SyntaxError I did not understand.  Here is the
> code:
> 
> def foo():
>     x=5
>     add=lambda a:x+a
>     del x
> 
> When I ran this, I got this error:
> 
> SyntaxError: can not delete variable 'x' referenced in nested scope
> 
> What is this error?  Why is it here?  What does it mean?

What it says: you are trying to delete a variable (x) that
is referenced in a nested scope, in this case, within the
lambda. Python functions (including lambdas) use dynamic
lookup for variables; IOW, when you call this function,
it will try to look for variable x, which lives in function
foo's namespace. If you delete it, as you are trying to do,
it won't be able to find it anymore. Hence the error.

At least, that's what I think. ;-)

--Hans


From drollo at cns.net.au  Fri Dec  7 18:17:58 2001
From: drollo at cns.net.au (David Rollo)
Date: Fri, 07 Dec 2001 23:17:58 GMT
Subject: Is Python suitable for some binary file editing?
References: <1FD639F0.1DA46084@cns.net.au>
Message-ID: <3C114E77.14180DAE@cns.net.au>

Thanks to all for these very helpful comments and advice.


David Rollo


From tim.one at home.com  Sun Dec  9 12:09:11 2001
From: tim.one at home.com (Tim Peters)
Date: Sun, 9 Dec 2001 12:09:11 -0500
Subject: Does 'super' exist?
In-Reply-To: <200112090716450170.001FDEEA@mail.rdc1.sdca.home.com>
Message-ID: 

[Bruce Eckel]
> Thanks. Looks like the syntax for calling the base-class B's
> constructor would then be:
> super(B, self).__init__()
> I see the value of super() for MI but I was thinking I might get a
> free ride in the form of less typing for SI base-class calls. Oh
> well.

You may someday, but not in 2.2.  The new 2.2 class features, from super()
to staticmethod(), are spelled in a very Lispish way.  Guido is keen to add
nicer syntax for some (perhaps all) of them, but in later releases.  For SI,
you can get less typing today by doing, e.g.,

    B.__init__(self)

Another idea is in

    http://aspn.activestate.com/ASPN/Mail/Message/248323




From tim at vegeta.ath.cx  Sun Dec 16 11:22:43 2001
From: tim at vegeta.ath.cx (Tim Hammerquist)
Date: Sun, 16 Dec 2001 16:22:43 GMT
Subject: Idiomatic portable way to strip line endings?
References:  
Message-ID: 

Ulf Magnusson  graced us by uttering:
>> In general, I can use:
>>
>>     line = line[:-1]
>> or
>>     del line[-1:]
> 
> There is an easy way to print them without the newline
> print "hello world",
> 
> Use a comma attached at the end, this ofcourse doesn't modify the
> string (strings are unmutable) but it fixes the print output.

I think you misunderstood my question.

Suppose:

    s = "a string\n"

I want:

    s == "a string"

OTOH, when I write filters, yours is the exact idiom I use.

> the string module also supports the following
> rstrip, strip, lstrip
> which removes whitespaces (on the right side, the whole string, left side)

This breaks on strings like:

Start:      " string bookended by whitespace \n"
Target:     " string bookended by whitespace "

w/ .rstrip: " string bookended by whitespace"
w/ .strip:  "string bookended by whitespace"

Often the (l|r)?strip methods work fine, but sometimes I need to
preserve " " and "\t" in the string.

Thanks for you help, tho.  =)

Tim Hammerquist
-- 
Microsoft's biggest and most dangerous  contribution to the software
industry may be the degree to which it has lowered user expectations.


From stuart at bmsi.com  Wed Dec 19 11:04:41 2001
From: stuart at bmsi.com (Stuart D. Gathman)
Date: Wed, 19 Dec 2001 11:04:41 -0500
Subject: Python as RedHat/SysV service
References: <9voavb$rpj$1@nntp2-cm.news.eni.net> <9voe89$119q$1@nntp6.u.washington.edu>
Message-ID: <9vqdqq$bc2$1@nntp2-cm.news.eni.net>

On Tue, 18 Dec 2001 16:59:37 -0500, Donn Cave wrote:

> Quoth "Stuart D. Gathman" : 
>> I have a system service written in python.  On RedHat systems, this
>> service is conveniently installed and started by placing a script in
>> /etc/rc.d/init.d to start,stop,reload, etc the service. 

> As you noticed, that "standard method" isn't a very good one!  What
> about other services that run under their own name but fork, like sshd?

It occurs to me that the init.d scripts can be python scripts just as easily
as shell scripts.  If the service is written in Python, this guarrantees
that python is available to run the script also.  However, it seems that
the shell methods are somewhat lacking, so it could be useful for other
services as well.

I will try to make a general purpose Python based init.d module - any
recommendations are welcome (especially if it has already been done).

I will call the python module with service interface functions 'service.py'.


From khartlage at t-online.de  Sun Dec 30 14:19:14 2001
From: khartlage at t-online.de (Klaus Hartlage)
Date: Sun, 30 Dec 2001 20:19:14 +0100
Subject: Call for a small program - willing to give a bonus
References: <3C2F2186.52BF5D0C@htp-tel.de>
Message-ID: <3C2F68B2.2000101@t-online.de>

Tom Karas wrote:

> Hello out there.
> .....



> 
> Hello out there,
>  who wants to practice his skills and make the start of a language
> learn
> software.

....
> Later the program should also be able to play sound. I heard, 
> this could be difficult with python !?
> 
> So maybe Java would be a better bet ? 
> 
> I am even willing to pay a little for the solution that fits some basic
> needs,
> but because i am a student this will be more like a little bonus.


Suggestion:

Write to a shareware/freeware author and ask him to add the 

required functionality!?


Example for a Java program:

http://www.jlearnit.com/
( "JlearnIt is a multilingual dictionary sorted by categories that helps 
you to learn the vocabulary of another language progressively" )



-- 
Klaus Hartlage
Math java project:  http://www.hartmath.org
Riding the Java wave: http://www.jsurfer.org



From pj at sgi.com  Mon Dec 10 16:59:26 2001
From: pj at sgi.com (Paul Jackson)
Date: 10 Dec 2001 21:59:26 GMT
Subject: PEP 276 Simple Iterator for ints (fwd)
References:   <9up46o$e2ost$1@fido.engr.sgi.com> 
Message-ID: <9v3b7u$f0ato$1@fido.engr.sgi.com>

David Eppstein  wrote:
|>
|> In article <9up46o$e2ost$1 at fido.engr.sgi.com>, pj at sgi.com (Paul Jackson) 
|> wrote:
|> 
|> > Ok - so you choose to go down that fork in the decision tree:
|> > 
|> >     The problem I have with this then is that it results
|> >     in the comparison operators <, <=, ..., >, >= sometimes
|> >     requiring a list of assignable expressions on one or the
|> >     other side, as opposed to their current usage, which
|> >     requires comparable expressions on both sides.
|> > 
|> >     This sort of subtle, context sensitive syntax change
|> >     feels weird and unsettling to me.
|> 
|> And you're not equally unsettled by the identical behavior of "in"?

I take it you are comparing the use of 'in' in the two
contexts:
    if x in s:
and
    for x in s:

In the first case, x is compared with each element of s,
and in the second case x is assigned each element of s.

Ok - fair enough.

But I still don't like it.

Let me try this tack -- pray tell how does one verbalize
(read out loud or subverbally) the line:

    for 0 <= i < 10:

Imagine, say, you and a colleague were brainstorming over
something on the telephone, and you happened to want to say
something equivalent in meaning to this.  If it were me, I
would not say:

    "for zero less-than-or-equal i less-than ten"

Not in a million years.  I would say something like one of:

    say i ranges from zero to ten
    for each i between zero and ten
    let i take on a value between zero and ten
    take i in the range zero to ten
    take i between zero and ten
    given that i is between zero and ten
    (I might say 'nine', not 'ten', depending on the listener ...)

or one of sundry other variations, each one of which I'd wager
would _not_ have the name of the variable 'i' occurring after
the 'zero', but before the 'ten'.

In short, I claim that, even though the notation is visually
appealing, it is not verbally appealing.  It looks ok, but
sounds bogus.  You wouldn't read it out loud, to someone who
wasn't within view of it, as it is written, if you were more
focused on conveying meaning than being literal.

So ... how do you read this construct out loud?

-- 

                          I won't rest till it's the best ...
			  Manager, Linux Scalability
                          Paul Jackson  1.650.933.1373


From PJGANS at CSBSJU.EDU  Sun Dec 16 17:10:48 2001
From: PJGANS at CSBSJU.EDU (Gans, Paul J)
Date: Sun, 16 Dec 2001 16:10:48 -0600
Subject: I need some help, Please!!!!!
Message-ID: <1D3A2AC005645642A3CDB7F91A8D2D64755D94@stumail.ad.csbsju.edu>

I am a beginning programmer trying to learn python on my own.  I tried
to create my own phone book using a dictionary to do so and I am having
some problems.  The phone book I was creating I wanted to be able to add
someone to it, find someone in the phone book, delete someone, and
change someone's entry.  I also only wanted to use the fields Nick name,
full name, phone number, address, and e-mail.  If you could give me any
hints or suggestions it would be greatly appreciated.  Thank you very
much.
Sincerely,
Paul Gans
pjgans at csbsju.edu
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 

From jason at jorendorff.com  Wed Dec 19 17:15:49 2001
From: jason at jorendorff.com (Jason Orendorff)
Date: Wed, 19 Dec 2001 16:15:49 -0600
Subject: quick eval question
In-Reply-To: <4c7395cb.0112150728.2275ad75@posting.google.com>
Message-ID: 

> # now i want a 'path component'
> ePath ="['OUTLOOK']['CREATEDATE']"
>
> # i can't seem to put the dict and path together
> print elements+ePath
> #print elements eval(ePath)
> #print eval(elements eval(ePath))
>
> hope this makes sense,

Yep, it makes sense.  But you don't want to use eval for this.
It's slow and you're likely to make mistakes with it.  Try something
like this instead:

  name = 'OUTLOOK'
  print elements[name]

Once you understand that, try this one:

  def follow_path(object, path):
      result = object
      for name in path.split():
          result = result[name]
      return result

  path = "OUTLOOK CREATEDATE"
  print follow_path(elements, path)

## Jason Orendorff    http://www.jorendorff.com/



From mkelly2002NOSPAM at earthlink.net  Sun Dec  2 00:52:23 2001
From: mkelly2002NOSPAM at earthlink.net (Michael Kelly)
Date: Sun, 02 Dec 2001 05:52:23 GMT
Subject: Any 'CallDll' and 'npstruct' examples around?
Message-ID: <92gj0u4f12q0e1qqent07paht5auo5us10@4ax.com>

I installed calldll and npstruct and was wondering if anyone knew
some links to examples making Win32 Api calls on the net??
>From just looking at the modules I can't quite figure how to
set up to make calls that use structs, esp. nested ones.  
If any of the source accompanied an article that would be
especially cool.

TIA


Mike

--

"I don't want to belong to any club that would have me as a member."
    -- Groucho Marx


From clspence at one.net  Tue Dec  4 12:48:17 2001
From: clspence at one.net (Chris Spencer)
Date: 4 Dec 2001 11:48:17 -0600
Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)
References:    <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com>  <3C0BD39F.D43D4FF7@mega-nerd.com>  <3c0be454$1@207.229.64.20> <3C0BE5D5.4386B359@mega-nerd.com> <3c0bf170$1@207.229.64.20> 
Message-ID: <2g2q0us3pdsl91hkbv3gj39nbfhnjke70s@4ax.com>

	How many times do people have to point out that you're wrong?

	In my development group, we had people who used spaces while coding
Python, and we had people using tabs.  What we noticed was that in terms of
uniformity of look, the "spacers" inevitably always chose different amounts of
spaces for indentation (one used 2 spaces, another used 3).  In terms of
maintainability it was a nightmare.  And it looks damned ugly.
	When we standardized on the "tabber" method, everything just magically
lined up in the editor.  The spacers defined their tabs to be 2 or 3 spaces in
width so it was comfortable to look at (I choose 8 spaces of width), but all of
the code looked the SAME instead of the crazy mixture we had before.

	Maybe if you only code for yourself you can have total uniformity of
coding style amongst all of your projects.  When you're dealing with several
people on a development project, that "tabber" convention is absolutely "the
Right Thing(tm)".

Chris.


On Mon, 03 Dec 2001 23:46:35 -0000, Steve Lamb  wrote:

>On Tue, 4 Dec 2001 01:36:49 -0800, Peter Bismuti  wrote:
>> I'm on your side.  After following this thread I am more convinced that tabs
>> are a better approach as it allows for a separation of style and content.
>> Each person can view their file with whatever indentation width they prefer
>> (style) without altering the contents of the file (content).
>
>    How many times to I have to point out that style and content cannot be
>separated?



From greg at cosc.canterbury.ac.nz  Thu Dec  6 18:53:43 2001
From: greg at cosc.canterbury.ac.nz (Greg Ewing)
Date: Fri, 07 Dec 2001 12:53:43 +1300
Subject: PEP 276 Simple Iterator for ints (fwd)
References:  
Message-ID: <3C100507.DA6DB95F@cosc.canterbury.ac.nz>

David Eppstein wrote:
> 
> if "for x in list" doesn't change subsequent iterations if you
> rebind x or list within the loop body, neither should "for x <= i < y"
> or whatever similar syntax one uses. So that means, it should construct an
> iterator and then act as if it were called by "for i in iterator"

I think relying on the semantics of changing the
loop variable in a loop is a bad idea in the first
place, so the difference wouldn't worry me.

In any case, you can get the same semantics quite
easily without the need for an iterator: keep the
real loop counter in a hidden variable, and assign
it to the user's loop variable before each iteration.

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg


From tim.one at home.com  Fri Dec  7 15:47:12 2001
From: tim.one at home.com (Tim Peters)
Date: Fri, 7 Dec 2001 15:47:12 -0500
Subject: Multi-isinstance idiom (Re: Deprecate tabs for indenting (was Re:  Indenting with tabs vs spaces))
In-Reply-To: <3C1122A1.9090609@rogers.com>
Message-ID: 

[Mike C. Fletcher]
> ...
> AFAIK, list comprehensions are basically just syntactic sugar around
> regular loops, so they aren't likely any faster than a for loop.  If
> that's changed, it would be good to know.

They are just sugar, but are nevertheless faster than the for loop most sane
 people are *likely* to write (the generated code uses a bound method
object for the hidden list.append, doing the method lookup just once before
the loop begins).




From wurmy at earthlink.net  Sun Dec  2 12:17:22 2001
From: wurmy at earthlink.net (Hans Nowak)
Date: Sun, 02 Dec 2001 17:17:22 GMT
Subject: More assignment/copy novice confusion
References: 
Message-ID: <3C0A6226.BF81F146@earthlink.net>

Arthur Siegel wrote:
> 
> Given a class:
> 
> >>> class  p:
>              def __init__(self,a):
>                  self.a=a
> Then -
> 
> >>> m=p([1,2,3])
> >>> r=m
> >>> m.a=([1,2,4])
> >>> m.a
> [1, 2, 4]
> >>> r.a
> [1, 2, 4]
> 
> clear enough.
> 
> But -
> 
> >>> m=p([1,2,3])
> >>> r=p([])
> >>> r.a=m.a
> >>> m.a=[1,2,4]
> >>> m.a
> [1, 2, 4]
> >>> r.a
> [1, 2, 3]

- m is an instance of p with list [1, 2, 3].
- r is an instance of p with list [].
- r.a is bound to the same object as m.a, so they both refer to
  the same list [1, 2, 3].
- Now m.a is rebound to a new list [1, 2, 4]. Because r.a wasn't
  rebound, it still refers to [1, 2, 3].

> And -
> 
> >>> m=p([1,2,3])
> >>> r=m
> >>> r.a=m.a
> >>> m.a=[1,2,4]
> >>> m.a
> [1, 2, 4]
> >>> r.a
> [1, 2, 4]

- m is an instance of p with list [1, 2, 3].
- r is bound to the same object as m.
- r.a is bound to the same object as m.a. (Kind of redundant,
  because they already referred to the same object)
- m.a is bound to [1, 2, 4].
- Since m and r refer to the same object, querying r.a returns
  [1, 2, 4] too... the same list. This is unrelated to the
  r.a = m.a done earlier; it has everything to do with the
  r = m statement.

> But - on the theory that my confusion
> on these kinds of issues is widely shared
> among novices - I thought it worth bringing
> up for discussion, clarification.
> 
> Is anything here affected by the new style classes?

I didn't study 2.2 extensively yet, but I doubt it changes
these basic binding rules.

--Hans


From timr at probo.com  Mon Dec  3 01:56:44 2001
From: timr at probo.com (Tim Roberts)
Date: Sun, 02 Dec 2001 22:56:44 -0800
Subject: splitting using '\' as a delimiter
References:  <200112030021.fB30LCM01808@mail.swissonline.ch> 
Message-ID: <0b8m0ug185sd7reci9i863v0mia8e45hji@4ax.com>

"Peoter Veliki"  wrote:
>
>So the string.split and the re.split swap the order of the arguments??!!
>What was the logic behind this decision?

Accident, I suspect.  The string is first in string.split because the
delimiter string is optional.  If the delimiter were first, it would be
required.

You could also argue that the two have different focus.  In string.split,
the focus is on the string.  The string is being told to split itself,
based on the delimiters.  In re.split, the focus is on the regular
expression.  The re is being told to take a specific action, in this case
to split up a string.

This little inconsistency remains even with the new syntax:

   string_to_be_split.split( delimiters )
   regular_expression.split( string_to_be_split )
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.


From paul at prescod.net  Sun Dec 30 20:00:03 2001
From: paul at prescod.net (Paul Prescod)
Date: Sun, 30 Dec 2001 20:00:03 -0500
Subject: Python Popularity: Questions and Comments
References: <000b01c1907c$f898ea40$a9e1fea9@carol>
Message-ID: <3C2FB893.1C28E14A@prescod.net>

Arthur Siegel wrote:
> 
> Paul Prescod writes -
> 
> >When one of Python's killer apps takes over the universe (Zope, Pygame,
> >Alice, Mojonation whatever), Python will take over the universe.
> 
> I am confused by the discussion only to the extent that it is my
> perception that Python slower but surely *is* taking over the universe.
> Steady as we go.

I'm concerned by the historical precedents. What language have you ever
heard of that took over the universe slowly and quietly? They tend to do
it in a big bang, following some trend like Unix or the Web or mobile
computing. If there is ever a "big bang" associated with a language in
Python's class, Python could be overshadowed. For instance if PHP had
been better designed as a general purpose programming language, and had
had support from a big corporation (e.g. Sun), it might be the "default
language" in the scripting world today.

Once a default language takes hold (e.g. C) it becomes quite difficult
to convince bosses to allow us to use other languages (e.g. Eiffel, Ada,
Sather).

> Precisely because of the reasons you point to. It is wonderfully general
> purpose, with an appeal to such a wide audience needing to solve
> widely divergent problems, and coming to *their* problem with widely
> divergent backgrounds and experience.

That isn't really the way to popularity. The way is to solve the problem
that many people need to solve right now. People need to be able to tell
their bosses that they are switching language because the new langauge
is demonstrably better at solving some problem than the one the company
has standardized upon. "I need to do CGI. You cannot do CGI in C.
(cough) You have to do it in Perl. I need to use Perl."

> The only misstep I can see at this point is to skew Python's development
> in a particular direction to solve a particular problem for a particular
> segment
> of its potential audience -  whether it be the novices, biochemists,
> mathematicians
> or  web application builders.

I would also advise against this, because it is essentially impossible
to know what horse to bet on. Most languages fall into their domains,
they aren't designed for it. Java was "supposed" to be for set-top
boxes, and then for applets before it became the default server-side app
language. Nevertheless, it is clear from history that being the default
language for an up-and-coming platform or application class is a much
more surefire path to success than being a really good programming
language.

 Paul Prescod



From tomahawkkiller at earthlink.net  Fri Dec  7 18:08:14 2001
From: tomahawkkiller at earthlink.net (Timothy Collins)
Date: Fri, 07 Dec 2001 23:08:14 GMT
Subject: GUI builder
Message-ID: 

Just wondering if anyone knows where I could get my hands on a gui builder
that would work with python. I have tried "Boa Constructor" and it works,
but only to a point - if I try to open the frame build it coughs up errors
until it just stops. Any other free or nearly free visual IDE's out there?




From daves_spam_dodging_account at yahoo.com  Sat Dec 15 20:53:49 2001
From: daves_spam_dodging_account at yahoo.com (David Brady)
Date: Sat, 15 Dec 2001 17:53:49 -0800 (PST)
Subject: How to get currently active window on Win32?
Message-ID: <20011216015349.91940.qmail@web21101.mail.yahoo.com>

Hi all,

More win32all questions... is it possible to get the
handle of the window that currently has the focus? 
win32gui.GetActiveWindow() fails because I'm looking
for a window outside the process of my Python script.

Second question, it looks like PyCWnd supports all of
the MFC functionality that I could want (including
GetTopWindow, ahem) but I can't figure out how to get
at a PyCWnd object.  How can I call these MFC
functions... or do I have to create a Win32 PyCWnd
dialog in order to call from it?

Third, is it possible to call GetWindowPlacement and
SetWindowPlacement from Python?  I'd like to write a
script that manipulates the positions of my open
windows.

Fourth (and last, phew!), is there a way to find out a
window's class?  FindWindow, for example, will look
for a caption or a window class; it's more accurate to
look for window classes (especially when you have six
different apps running whose caption begins with
'Untitled') but I don't see anyway to inspect or get
window classes of running windows from within Python.

Sorry for such demanding question asking... and thank
you in advance for any help rendered.

-dB

=====
David Brady
daves_spam_dodging_account at yahoo.com
I'm feeling very surreal today... or *AM* I?

__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com



From xx758 at cam.ac.uk  Fri Dec  7 12:49:00 2001
From: xx758 at cam.ac.uk (Xiao-Qin Xia)
Date: Fri, 7 Dec 2001 17:49:00 -0000
Subject: Problem with threads and Tkinter user-generated events on Solaris
References: <9uqmm4$1lcu$1@norfair.nerim.net>
Message-ID: <9uqva2$6o0$1@pegasus.csx.cam.ac.uk>

Hi,

Did you try Python 2.0?
My Python+Tkinter thread application can run under Python 2.0, but will die
under Python 2.1.

Cheers,
Xiao-Qin Xia


"Eric Brunel"  wrote in message
news:9uqmm4$1lcu$1 at norfair.nerim.net...
> Hi all,
>
> We're writing a Python+Tkinter application and we encountered a strange
> problem when trying to generate Tkinter events from another thread than
the
> main one. Here is a short script showing the problem:
>
> ===
> from Tkinter import *
> from threading import Thread
>
> root = Tk()
>
> def f(*whatever): print 'yeah'
>
> root.bind('<>', f)
>
> def sendEvt():
>   print 'generating'
>   root.event_generate('<>', when='head')
>
> thread = 1
>
> def click():
>   if thread:
>     th = Thread(None, sendEvt)
>     th.start()
>   else:
>     sendEvt()
>
> Button(root, command=click, text='Send').pack()
> root.mainloop()
> ===
>
> Basically, clicking on the "Send" button generates an event that should be
> treated by the binding on the root widget. Depending on the value of the
> "thread" variable, the event is generated either in the main thread or in
a
> secondary thread.
>
> We tested this program with Python 2.1, Tcl/Tk 8.3 on Linux Mandrake 8.0,
> Solaris 2.7 and Windows 2000. Here is what happens:
> - when the "thread" variable is 0, the program works everywhere.
> - when the "thread" variable is 1, the program works on Linux and Windows,
> but not on Solaris: the event is generated, but never received (the
binding
> never triggers).
>
> Is this a known problem? Does anybody have a patch for Solaris correcting
> this behaviour? We already found a workaround, but it's quite ugly. And it
> would be really nice to have an application that is 100% portable between
> Windows and all Unices.
>
> Thanks a lot in advance.
>  - eric -
>




From ballsacks at xtra.co.enzed  Wed Dec  5 00:22:02 2001
From: ballsacks at xtra.co.enzed (^^@++)
Date: Wed, 05 Dec 2001 05:22:02 GMT
Subject: Newbie: searching an English dictionary for a reg exp
References: <3c09f02f.97177874@news.akl.ihug.co.nz>  <3c0b1bbe.173865154@news.akl.ihug.co.nz> 
Message-ID: <3c0daef7.342626220@news.akl.ihug.co.nz>

On Mon, 3 Dec 2001 20:57:58 -0800, "Eugene"  wrote:

>Oh, sorry about that.  "re.search" only requires that the pattern match at
>the start of the target string; it does not also require that the pattern
>match all the way to the end.  Put "$" at the end of your pattern and that
>will fix it.  (The regular expression "$" means end-of-string.*)

Thanks, I didn't know I needed the $.

>And if you just want to print the word that matched, just put
>"outfile.write( word + ' ' )" in place of what you have in your "if" block.
>Once you know the word matches, that's good enough for you, right? :)

Duh, how'd I miss that. Thanks again. Problem solved!

-Matt


From pzw1 at hotmail.com  Tue Dec 11 09:36:15 2001
From: pzw1 at hotmail.com (Peter Wang)
Date: 11 Dec 2001 06:36:15 -0800
Subject: FW: Strange behaviour of __del__
References:   
Message-ID: 

David Bolen  wrote in message news:
> I think you're mostly on the right track except for the part about del
> actually being responsible for the decrement of the reference count.
> The object itself is definitely being kept alive by a reference in the
> traceback (via the 'self' local in one of the traceback frames), which
> will keep the object alive while the "last" traceback is held by Python.

Thanks for the clarification/correction!



as always with Python, the truth is subtle and (typically) consistent,
even if the behavior is mysterious.



-peter


From adina_levin at mindspring.com  Sat Dec  1 08:31:25 2001
From: adina_levin at mindspring.com (adina_levin at mindspring.com)
Date: Sat, 1 Dec 2001 07:31:25 -0600
Subject: use of hasattr(), getattr(), __dict__, was re: Python evangelists unite!
References:  <83pu5zthl4.fsf@panacea.canonical.org>
Message-ID: <9uam4t$v23$1@nntp9.atl.mindspring.net>

What do people think is good-form use of hasattr(), getattr(), and __dict__,
as opposed to bad magic or suboptimal style?

- Adina


"Kragen Sitaker"  wrote in message And I don't like
> using hasattr() and getattr() and __dict__ except when I'm extending the
> language, doing things that can't be done without them.

>




From nospam at bigfoot.com  Thu Dec 27 11:24:42 2001
From: nospam at bigfoot.com (Gillou)
Date: Thu, 27 Dec 2001 17:24:42 +0100
Subject: REPOST: Re: long lines in HTML attachments
References: <7a256ac1.0112270203.77efb6f2@posting.google.com>
Message-ID: <8$--$$_----_%-$%-$@news.noc.cabal.int>

Encode your mail body with quoted printable encoding (see doc of module
"quopri"). This way, the recipient's mail client is supposed to re-built the
lines broken by quoted-printable encodings.
I tested this successfully with OE5, Netscape messenger and StarOffice Mail.

Don't forget to add this header to your mail:

"Content-Transfer-Encoding: quoted-printable"

Or download Python 2.2 that has a new "email" standard package that handles
email messages (parse and marshal/serialize) as Python objects (easier to
handle than playing with the various packages you may need for handling
emails).
Heard that this package is available separately and may work with older
Python versions but I have no URL for this (Google for this).

HTH

--Gilles

"Iddo"  a ?crit dans le message news:
7a256ac1.0112270203.77efb6f2 at posting.google.com...
> Hi,
>
> I am trying to use smtplib and mimecntl to email an attached html
> document. The trouble is that the html document contains some very
> long physical lines (500 chars). It is important that those lines be
> preserved as such, since I use 
 formatting in the htdoc. Some
> mail clients (e.g. Pine 4.40) truncate or insert a linefeed in those
> lines, creating a mess. Any way of attaching my long-lined files and
> getting them through intact? Following is a code snippet of what I do.
> Any help would be appreciated.
>
> Thanks,
>
> Iddo
> ---------------------------------- CUT HERE --------------------------
>
>
> def email_with_attachments(to_addr, subject, msg_string, attachment):
>     f = mimecntl.MIME_document("",type='text/plain')
>     f.write(msg_string)
>     # Create the message + attachment
>     attach = mimecntl.MIME_recoder()
>     att_file = open(attachment[1],"r")
>     att_stream = att_file.read()
>     attach.write(att_stream)
>
attach['content-type']=mimecntl.MIMEField('content-type',attachment[0],
>
> name=attachment[1])
>     attach['content-length']=mimecntl.MIMEField(
>                                    'content-length',
>                                    len(att_stream))
>     attach['content-disposition']=mimecntl.MIMEField(
>                                    'content-disposition',
>                                    'attachment',
>                                     filename=attachment[1])
>     msg = mimecntl.MIME_document((f,attach),
>                                   From='myself at myserver.org',
>                                   To=to_addr,Subject=subject)
>     # send msg using smtp
>     smtp = smtplib.SMTP('localhost')
>     smtp.sendmail('myself at myserver.org',to_addr,msg.dump())
>     smtp.quit()
> if __name__ == '__main__':
>     attach_info = ('text/html','/my/html_file.html')
>     email_with_attachments('you at youraddress','hi there',attach_info)

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: "Gillou" 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 04:22:19 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775721 27193 211.57.49.2 (31 Dec 2001 05:15:21 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:15:21 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From wurmy at earthlink.net  Sat Dec 29 02:23:05 2001
From: wurmy at earthlink.net (Hans Nowak)
Date: Sat, 29 Dec 2001 07:23:05 GMT
Subject: odd problem, most likely stupid one too :-)
References: 
Message-ID: <3C2D6DF6.64AE27FC@earthlink.net>

Dave Harrison wrote:
> 
> Ive written a class named packet, and I have a list on values that I am using to create my packets by passing the values in as I instantiate the classes I am creating.
> 
> I do the creation in a for loop,
> 
> for item in itemlist:
>         PACKET = Packet(item)
>         paclist.append(PACKET)
> 
> except that when I try to go back through and see the packets in my paclist they are all exactly the same as the final one that I store in the list.
> As in I do,
> 
> for pac in paclist:
>         print pac.getVal()
> 
> and I get exactly the same value, despite the fact that I know for sure they are different.
> 
> If I getVal as I create the packets I get the correct and unique values, but once stored I get the oddity.
> 
> Any ideas ?

Hmm... try printing the id() of every instance in paclist...
if they are the same, then you have somehow added the same
instance over and over again to the list. If not, then they
somehow all ended up with the same value, *or* getValue is
doing something wrong.

Oh yeah, and post the code of the Packet class, that might
give us some clues too. ^_^

--Hans


From jussij at zeusedit.com  Thu Dec  6 01:33:07 2001
From: jussij at zeusedit.com (Jussi Jumppanen)
Date: Thu, 06 Dec 2001 17:33:07 +1100
Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)
References:      <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com>   <3C0C8330.79D0E598@mega-nerd.com>  <23891c90.0112050750.2bed3aa8@posting.google.com> 
Message-ID: <3C0F1123.338@zeusedit.com>

Courageous wrote:

> You can do this in vim at the beginning of the document, by the way.
> E.g.,
> 
> ##-----------------------------------------------------------------
> ##  $Id: resource.py,v 1.1 2001/12/05 00:44:27 jkraska Exp $
> ##  vim: ts=8
> ##-----------------------------------------------------------------

There is also the Plain Text/Source Code (PTSC) file header that 
tries to do the same thing. For more information on PTSC go to 
the following web page:

   http://www.synchro.net/ptsc_hdr.html

Jussi Jumppanen
Author of: Zeus for Windows, Win32 (Brief, Emacs, etc) FTP Text Editor
"The C/C++, Java, HTML, Pascal, Cobol, Fortran programmer's text editor"
Home Page: http://www.zeusedit.com



From wheineman at uconect.net  Sat Dec 22 12:03:45 2001
From: wheineman at uconect.net (Willy Heineman)
Date: 22 Dec 2001 09:03:45 -0800
Subject: Comunicating through COM ports
References: 
Message-ID: 

"Alves, Carlos Alberto - Coelce"  wrote in message news:...
> Anybody could give me an example code of how connect/comunicate through COM
> ports (i.e. COM1, COM2). I'm under windows 98.
> Thanks!!!
> 
> Carlos Alberto
> COELCE/DPRON-Departamento de Projetos e Obras Norte
> Fone: 677- 2228
> e-mail: calves at coelce.com.br
> \|||/
> (o o)
> --ooo0-( )-0ooo--
> 
> 
> 
> --
Mark Hammond has done a spectacular job of encapsulating the Win32 api
functions for using the COM ports under Windows in Win32all. You'll
need the documentation from Microsoft which you can get at
msdn.microsoft.com. Try searching for things like BuildDCB and
ReadFile. The API documentation and examples should be sufficient to
use Mark's equivalents. Alternatively, you can get a swigged module of
all of the Win32 API calls I made a while back,
http://www.uconect.net/~wheineman/python/win32comm.zip . A binary for
Python 2.0 is included as well as the source which only requires
Visual C++. Hope this is useful.


From justin at iago.org  Tue Dec 11 12:28:41 2001
From: justin at iago.org (Justin Sheehy)
Date: Tue, 11 Dec 2001 12:28:41 -0500
Subject: lost interest?
In-Reply-To: <20011210211532.67032.qmail@web21106.mail.yahoo.com> (David
 Brady's message of "Mon, 10 Dec 2001 13:15:32 -0800 (PST)")
References: <20011210211532.67032.qmail@web21106.mail.yahoo.com>
Message-ID: 

David Brady  writes:

>> > I'd ask a different question from yours.  Why is
>> > it a problem that Python doesn't have an
>> > equivalent to CPAN?  "Perl has it" isn't
>> > enough.
> 
> ...because Ruby might get one?  ;-)

So?

Ruby has a few other things Python doesn't have.  Python is mature
enough that in general it doesn't have to worry about competing for
survival on the basis of a feature bullet-list.  This is especially
true for features that are solving a problem that has not been shown
to be a very big deal.

> Here's a story from my perl days.  Imagine this
> existed for Python, and then decide if you're willing
> to continue suffering without this feature.... :-)

> The problem was, half the developers on the team
> didn't know perl, and didn't want to learn it.  And of
> the 12 or so "apps" written in perl, 8 required
> modules not packaged with the ActiveState perl distro.
>  Our manager looked at the first 5 or 6 apps that we
> were using in our home office, and vetoed them unless
> we could find a way to resolve the I.T. nightmare of
> getting all the developers on the same page with a
> perl distro that could run our apps.

> Because CPAN existed, we were able to easily write an
> "autoinstaller" module.  Every time you ran one of our
> scripts, it checked the requirements, and if you were
> missing a module, it went out, got the module,
> installed it, and then resumed running.  You didn't
> even have to restart the script.  If you didn't have a
> module, you just had to wait an extra minute or two
> the first time the script ran.

So you simply package the modules along with your program, and use the
setup.py with each module to install it locally.  You may want to
provide two versions of your program distribution, one with the
support modules and one without.

There are a few third-party modules whose license might restrict this,
but in general this is a workable solution.  It also ensures that you
are using exactly the version of the module that works and has been
tested with your program.

Also, in my experience, there are generally far fewer third-party
modules needed by a large Python system than by a large Perl system.

-Justin

 




From ekock at movatis.com  Mon Dec 17 05:58:29 2001
From: ekock at movatis.com (Eike Kock)
Date: Mon, 17 Dec 2001 11:58:29 +0100
Subject: i18n and german umlauts
References: <9vf6fu$82e$05$1@news.t-online.com> 
Message-ID: <9vkik4$o5i$01$1@news.t-online.com>

Thanks to your suggestions I've got i18n working now!
Thanks!

Eike

"Martin von Loewis"  schrieb im Newsbeitrag
news:j4ofl07dbh.fsf at informatik.hu-berlin.de...
> "Eike Kock"  writes:
>
> > I just got started with Python and internationalization using the
> > gettext module, pygettext.py and msgfmt.py. Everything works fine
> > except when it comes to special characters like german umlauts. Has
> > anyone mastered this in a plattform independent way?
>
> What problem are you facing? In the original source code, you should
> only put English messages - that will ease translation, since it will
> be easier to find a translator speaking English than finding, say,
> someone who speaks German as a foreign language.
>
> In the message catalogs, use whatever encoding you like. Make sure you
> put a GNU style PO header into each translation, like
>
> msgid ""
> msgstr ""
> "Project-Id-Version: GNU grep 2.5e\n"
> "POT-Creation-Date: 2001-03-07 00:02-0500\n"
> "PO-Revision-Date: 2001-06-09 11:14+02:00\n"
> "Last-Translator: Martin von L?wis \n"
> "Language-Team: German \n"
> "MIME-Version: 1.0\n"
> "Content-Type: text/plain; charset=ISO-8859-1\n"
> "Content-Transfer-Encoding: 8-bit\n"
>
> That allows to keep track of the catalog's charset, so different
> catalogs can use different charsets.
>
> At run-time, you have two options:
>
> - get the translation from the catalog as a byte string, in the
>   encoding of the catalog. This is what gettext.gettext will do.  It
>   is the best approach if you print messages to the user's terminal,
>   since that likely uses the same encoding that the translator was
>   using.
>
> - get the translation from the catalog as a Unicode string, by
>   means of translation.ugettext (where the translation object
>   is obtained through gettext.translation(domain)). This only works
>   if the encoding of the catalog was declared in the catalog.
>   This approach is best in the following cases:
>   - you output the messages to a GUI toolkit that supports
>     Unicode (like Tkinter).
>   - you output the messages to a file with a well-known encoding
>     (like HTML). In this case, you will need to convert the Unicode
>     string to the encoding of the output file.
>   - you output the messages to a terminal, and you can find out
>     what the encoding of the terminal is (eg. through
>     locale.nl_langinfo(locale.CODESET), of Py 2.2).
>
> HTH,
> Martin
>
> P.S. Thanks for confirming that you do use pygettext.py and
> msgfmt.py. Please notice that, as an option, you could also use GNU
> gettext for these tasks - they are likely faster than the pure-Python
> versions.




From syver-en+usenet at online.no  Sun Dec 23 09:00:16 2001
From: syver-en+usenet at online.no (Syver Enstad)
Date: 23 Dec 2001 15:00:16 +0100
Subject: Leading distributed object packages for python?
Message-ID: 

I am checking out Fnorb, and Pyro, and have already used win32com. Are
these the leading distributed object packages for pyton?
-- 

Vennlig hilsen 

Syver Enstad


From fredrik at pythonware.com  Sun Dec  2 06:51:20 2001
From: fredrik at pythonware.com (Fredrik Lundh)
Date: Sun, 02 Dec 2001 11:51:20 GMT
Subject: variable scoping across imports?
References: 
Message-ID: 

Arthur Siegel wrote:
> > I don't think things work this way, actually
>
> Fredick Lundh -
>
> >assuming Hans meant to write "reference to" instead
> >of "copy of", it does work that way.
>
> Ahem.

apart from showing that you cannot be bothered to
spell my name correctly, what's your point?

exercise: explain why Hans' statement is correct even
if you interpret "copy of" as "copy of" (hint: define "x")






From johnroth at ameritech.net  Sun Dec 16 16:04:01 2001
From: johnroth at ameritech.net (John Roth)
Date: Sun, 16 Dec 2001 13:04:01 -0800
Subject: Idiomatic portable way to strip line endings?
References: 
Message-ID: 

"Jason Orendorff"  wrote in message
news:mailman.1008532640.22171.python-list at python.org...
> > I've been trying to figure out the canonical way to strip
> > the line endings from a text file.
>
> There isn't one.  Almost always, either rstrip() is sufficient,
> *or* you're doing text slinging, in which case you can leave the
> newline characters on there, do the regex stuff, and file.write()
> the lines out the same way they came in.
>
> That said, the function you want is:
>
>   def chomp(line):
>       if line.endswith('\r\n'):
>           return line[:-2]
>       elif line.endswith('\r') or line.endswith('\n'):
>           return line[:-1]
>       else:
>           return line
>
> If you're getting these strings from a text file, you could:
>
>   for unstripped_line in file:
>       for line in unstripped_line.splitlines():
>           ...process line...
>
> Why is this necessary?  Unfortunately readline() doesn't
> interpret a bare '\r' as a line ending on Windows or Unix.
> So if the file contains bare '\r's, then the above code
> will read the entire file into the unstripped_line
> variable, then break it into lines with splitlines().

Unfortunately, this won't work in all cases, either. Let's
go back to basics. If your file has the line ending convention
defined for the operation system you're running on, then
everything works nicely. If it doesn't, then you're in a
great deal of difficulty, because there are cases where
readline() and readlines() will not parse the file into
lines for you, or if they do, you get extra characters
at the end. You need to read it in without having the
system do the parse, and do it yourself.

These are two different cases, although it does come
up in practice if you're importing files from the internet.
Some browsers will fix the line endings, and some won't.
I had a lot of files with Unix line endings that I had to
convert to Windows line endings because Notepad
will not handle Unix line endings. At all.

John Roth






From tim at vegeta.ath.cx  Tue Dec 11 16:08:13 2001
From: tim at vegeta.ath.cx (Tim Hammerquist)
Date: Tue, 11 Dec 2001 21:08:13 GMT
Subject: lost interest?
References: <20011208001123.A5989@casa.parque>  <3C14FEBD.AD52B516@attbi.com>  <9v5enr079j@enews4.newsguy.com> 
Message-ID: 

Skip Montanaro  graced us by uttering:
>     Alex> If it encourages more reuse of code in module A by the author of
>     Alex> module B, I think it would be a VERY good influence "in the Python
>     Alex> world".  Why *shouldn't* the useful 3rd-party modules we use be
>     Alex> free to rely on other useful 3rd-party modules yet?!
> 
> Python authors are free to rely on any modules they like, third-party or
> otherwise.  That they don't suggests to me that there's generally fairly
> little need to do that, at least for widely used packages.

That may be true, but it just seems so hard to believe that, in so many
non-interdependent modules, no one's reinventing the wheel in the least.

OTOH, I concede that Python is simply more conducive to rational
module/object hierarchies than is perl.

Tim Hammerquist
-- 
Is that a 286 or are you just running Windows?


From mwh at python.net  Sat Dec 15 08:55:05 2001
From: mwh at python.net (Michael Hudson)
Date: Sat, 15 Dec 2001 13:55:05 GMT
Subject: "Pythonj Fatal error: UNREF invalid object
References: <38ol1uoj0nufo0tu50kvhq112p4llc6hqv@4ax.com>
Message-ID: 

Courageous  writes:

> Regarding the subject line, what semantics causes the above fatal
> error to occur, generally?

Looks like[1] it happens when internal gc structures get messed up.
Are you implementing a container that participates in gc?  Have you
got everything right?

It also might be caused by random memory scribbling, I guess.

Cheers,
M.
[1] As in I did
    $ cd /path/to/python/src
    $ grep UNREF -r .
    and looked at what I found.  Was this beyond you?

-- 
42. You can measure a programmer's perspective by noting his
    attitude on the continuing vitality of FORTRAN.
  -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html


From karthikg at aztec.soft.net  Fri Dec 21 06:24:23 2001
From: karthikg at aztec.soft.net (Karthik Gurumurthy)
Date: Fri, 21 Dec 2001 16:54:23 +0530
Subject: An hour's talk on python...Suggestions required (from a newbie)
In-Reply-To: <3C22D248.3CA5DB26@my995internet.com>
Message-ID: 

hi all,

Our company does'nt use python. many have'nt even heard of it.
hi all,

Ours is mainly a java shop.

We have lots of internal training sessions @ our place.
Anyone with a decent knowledge of a particular subject can take such
sessions.
I was planning to take an introductory session on python.

I feel irrespective of how good the language is, not many
w'd want to try it out unless and otherwise they can see lots of
supporting tools and libraries.

It has to be a 1 hour talk.
Can someone give me pointers as to how this session c'd be organized?

1. functional programming in python
2. about new features that have been included in 2.2?
3. threading as for as tools/libraries are concerned,
4. GUI : Tkinter
5. xml?? : the one which ships with standard module or something else?
6. cgi:

am kind of a newbie.
But i want to develop some interest here @ my place.
Any suggestion w'd be of great help to me.

thanks and regards,
karthik.



-----Original Message-----
From: tutor-admin at python.org [mailto:tutor-admin at python.org]On Behalf Of
Kirk Bailey
Sent: Friday, December 21, 2001 11:40 AM
To: tutor at python.org
Subject: [Tutor] rfc822.rewindbody()


OK, I confizedde... how do I properly use rewindbody()?

--
Respectfully,
             -Kirk D Bailey (C)2001
              Addme! icq #27840081
end


Within the sweep of his sword, Each man is an Ubar.

http://www.howlermonkey.net/
http://www.sacredelectron.org/

_______________________________________________
Tutor maillist  -  Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor



From dgrisby at uk.research.att.com  Wed Dec 19 06:24:33 2001
From: dgrisby at uk.research.att.com (Duncan Grisby)
Date: 19 Dec 2001 11:24:33 GMT
Subject: SOAP.py
References: <9vnpn1$t45$1@pea.uk.research.att.com> 
Message-ID: <9vptdh$2fl$1@pea.uk.research.att.com>

In article ,
 Martin von Loewis   wrote:

>In turn, .echo in the client would return with a string of just "Hello
>Duncan". Could it be that you have made further changes to your local
>installation, or that you've been picking up a wrong copy of SOAP.py?

As I posted just now, the problem is with using Python 2.2. In my
other post, I said I didn't have time to try to fix it, but it turns
out to be trivial. I've uploaded a patch to SourceForge.

Cheers,

Duncan.

-- 
 -- Duncan Grisby  \  Research Engineer  --
  -- AT&T Laboratories Cambridge          --
   -- http://www.uk.research.att.com/~dpg1 --


From barry at zope.com  Fri Dec 14 15:06:13 2001
From: barry at zope.com (Barry A. Warsaw)
Date: Fri, 14 Dec 2001 15:06:13 -0500
Subject: RELEASED Python 2.2 release candidate 1 is out!
Message-ID: <15386.23477.137871.205510@anthem.wooz.org>

Today we release Python 2.2c1, the first and hopefully only release
candidate for Python 2.2, for your extravagation, eyestrain, and
elucidation.

Our thanks to everyone who helped test Python 2.2 during its alpha and
beta phases, and to everyone who contributed patches, feedback, and
suggestions!  Barring any showstopper bugs, we plan on releasing
Python 2.2 final in one week.  Please continue to report any bugs you
find to the bug tracker:

    http://sourceforge.net/bugs/?group_id=5470

Highlights of what's new for this release are outlined below.  For a
more complete list, please see:

    http://sf.net/project/shownotes.php?release_id=65583

Andrew Kuchling is writing a gentle introduction to the most important
changes, titled "What's New in Python 2.2":

  http://www.amk.ca/python/2.2/

Guido's written his own introduction to the type/class unification at:

  http://www.python.org/2.2/descrintro.html

Enjoy,
-Barry

-------------------- snip snip --------------------
What's New in Python 2.2c1?
Release date: 14-Dec-2001

- The "delete attribute" method of descriptor objects is called
  __delete__, not __del__.

- Some subtle issues with the super built-in were fixed.

- hash() of an instance of a subclass of mutable type now properly
  raises TypeError.

- New style objects now support deleting their __dict__.

- -Qnew now works as documented in PEP 238.

- complex() now only allows the first argument to be a string
  argument.

- gc.get_referents was renamed to gc.get_referrers.

- It is no longer necessary to use --with-suffix when building on a
  case-insensitive file system (such as Mac OS X HFS+).

- In unix-Python on Mac OS X (and darwin) sys.platform is now "darwin",
  without any trailing digits.



From ssthapa at classes.cs.uchicago.edu  Wed Dec 19 16:37:24 2001
From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa)
Date: Wed, 19 Dec 2001 21:37:24 GMT
Subject: ANN: ciphon 0.3.4
References:         <20011219092711.31a8282a.gry@ll.mit.edu>         
Message-ID: 

Skip Montanaro  wrote:
>I tried creating an empty installed.xml file, but that just moved the error
>further up the food chain.  I suspect ciphon ought to handle creation of
>this file itself.

    As a quick file you can put this into installed.xml in ~/.ciphon/:




    This should let ciphon download and install packages.  The bug itself
will be fixed  in the next release.

-- 
----------------------------------------------------------------------------
	   		              |
Suchandra Thapa                       | "There are only two kinds of math . 
s-thapa-11 at NOSPAMalumni.uchicago.edu  | books. Those you cannot read beyond 
			              | the first sentence, and those you 
			              | can not read beyond the first page."
			              |                     -C.N. Yang
----------------------------------------------------------------------------


From fperez528 at yahoo.com  Mon Dec 17 06:07:44 2001
From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=)
Date: Tue, 18 Dec 2001 10:35:44 +2328
Subject: Python equivalent to @lines = 'command';
References:  
Message-ID: <9vnut1$lck$1@peabody.colorado.edu>

Kirill Miazine wrote:

> * Christer Frovik <013-139047 at telia.com> [20011218 14:09]:
>> Is is possible to spawn a command (any command not just ls)
>> and have all the lines that the command outputs stored in a list?
>> 
>> In PERL this is done quite nicely in a single statement:
>> 
>>   @files = `ls -1`;
>> 
>> and you can then iterate over @files and do whatever you want.
>> Any ideas, or should i stick with Perl for my mindless scripts?
> 
> import os
> files = os.popen("ls -1").readlines()
> 

could anyone comment on the benefits/differences between the popen() approach 
and using
        output = commands.getoutput(cmd) ?

Or is getoutput() just a popen() call with another name?

thanks,

f.


From krempp at trucs.en.trop.crans.ens-cachan.fr  Fri Dec 28 13:56:27 2001
From: krempp at trucs.en.trop.crans.ens-cachan.fr (Samuel Krempp)
Date: Fri, 28 Dec 2001 19:56:27 +0100
Subject: REPOST: imaplib : password with accented chars in login commands
Message-ID: <0$--$$_----_---_$$@news.noc.cabal.int>

when I try using "?"  as a password in the login command, the imaplib 
command raises exceptions.

import imaplib
M=imaplib.IMAP4('imap.free.fr')
M.login("toto", "bla?bla")

imaplib.error: LOGIN command error: BAD ['Missing required argument to 
LOGIN']

It's quite a problem, since I wished I could use any french character 
in my passwords,
But I am not sure whether this is a bug in imaplib or a 'feature' of 
the IMAP protocol, because the documentation
http://www.python.org/doc/current/lib/imap4-objects.html
says something I don't fully understand,
about always quoting string used as password in the login command.

Is this a bug, or am I doing something wrong ?

Regards,
-- 
Sam

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Samuel Krempp 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 05:05:12 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775128 27193 211.57.49.2 (31 Dec 2001 05:05:28 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:05:28 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From bh at intevation.de  Thu Dec  6 05:29:47 2001
From: bh at intevation.de (Bernhard Herzog)
Date: 06 Dec 2001 11:29:47 +0100
Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)
References:    <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com>  <3C0BD39F.D43D4FF7@mega-nerd.com>  <3c0be454$1@207.229.64.20> <3C0BE5D5.4386B359@mega-nerd.com>  <9umeoa$bmu$1@animus.fel.iae.nl>
Message-ID: <6qr8q8fxpg.fsf@abnoba.intevation.de>

Carel Fellinger  writes:

> alas, cut&past on an X display will not see those tabs, but only the
> spaces used to represent them at the moment:(

That's got nothing to do with X and everything with how your editor or
your terminal emulator as the case may be handles it. I can copy&paste
between e.g. different Emacs sessions just fine including tab
characters.

   Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Sketch                                 http://sketch.sourceforge.net/
MapIt!                                               http://mapit.de/


From logiplexsoftware at earthlink.net  Sat Dec 22 23:46:02 2001
From: logiplexsoftware at earthlink.net (Cliff Wells)
Date: Sat, 22 Dec 2001 20:46:02 -0800
Subject: Python on the desktop
In-Reply-To: 
References: <94e3fce8.0112210053.2568529d@posting.google.com>
	<3C238618.9F54E5CA@attbi.com>
	
	
	
Message-ID: <20011222204602.579a8fee.logiplexsoftware@earthlink.net>

On Sat, 22 Dec 2001 07:39:32 GMT
Courageous  wrote:
> Standard C++ shall not^H^H^H include a GUI toolkit nor^H^H^H and
> shall it^H^H likewise be bound to a specific operating system
> [insert:, chosen from amongst the following sensible choices:
> Windows/98, Windows/NT, Windows/ME, Windows/2000, Windows/XP, and
> Windows/CE]. Standard C++ shall not^H^H^H be limited to a specific

Sensible?  98/Me/NT????  Yikes.  After supporting these OS's in a networked environment (not to mention all my friends who call for help with their hosed 9x/Me systems) these can never be called sensible.  That said, Win2000 is pretty good and I haven't used XP enough to say either way. Unfortunately I can't say that my RedHat box makes me too happy these days, either... it must be the bane of the GUI... trade stability for "ease-of-use" =(

> hardware platform [insert: , include x86 derivitives and other
> hardware platforms as designated by the Microsoft Corporation].
> Compiler vendors will be held to strict requirements for adhering
> to the standard [insert: , except for the Microsoft Corporation,
> who shall be permitted to build a superior compiler, Visual C++,
> as they so see fit].

superior ^H^H^H^H^H^H^H^Hsuperfluously nonstandard.  An article in Windows Developers Journal prompted a flood of complaints from developers who use VC++ and were aggravated by its inconsistent implementation of the ANSI standard.   I guess if you're only writing screen savers for Windows 95 it doesn't matter much, just don't expect to buy a book on C++ and believe it will apply to VC++.  If you use the /Za switch you can't even compile windows.h - you might think /Za just disables "extensions", but in fact without it, it is sometimes not possible to compile code that strictly follows the ANSI standard!  This example is from C/C++ Users Journal:

for (int i;;)
    ;
for (int i;;)
    ;

With /Za this will compile.  Without /Za it won't.  VC++ complains that i is multiply defined (this particular "extension" may have changed since the article is from 1999).

Browse Windows Developer's Journal "Bug++ of the Month" articles sometime and then see if you still think VC++ is "superior".  Maybe it superior to something, but not C++ compilers - that would be comparing apples to oranges.

Regards,

-- 
Cliff Wells
Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308
(800) 735-0555 x308



From alf at sagittarius.logilab.fr  Thu Dec 13 09:05:40 2001
From: alf at sagittarius.logilab.fr (Alexandre Fayolle)
Date: Thu, 13 Dec 2001 14:05:40 +0000 (UTC)
Subject: unintentionaly shared attributes in two different instances
References: 
Message-ID: 

On Thu, 13 Dec 2001 15:01:50 +0100, maxm  wrote:
>I have this funny problem. When I make two objects from the class "Row" one
>of the attributes is shared another one is not.
>
>When I create the class like::
>
>class Row:
>
>    def __init__(self, title='', content=[]):

Don't use mutable primitives (lists, dictionaries or class instances) as
default value in a method or function. See ?4.7.1 in the Python tutorial:

"Important warning: The default value is evaluated only once. This makes a 
difference when the default is a mutable object such as a list or dictionary."

Cheers

Alexandre Fayolle
-- 
LOGILAB, Paris (France).
http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org
Narval, the first software agent available as free software (GPL).


From peter at engcorp.com  Fri Dec 21 19:10:22 2001
From: peter at engcorp.com (Peter Hansen)
Date: Fri, 21 Dec 2001 19:10:22 -0500
Subject: Python on the desktop
References: 
Message-ID: <3C23CF6E.CD4BF4D3@engcorp.com>

Steven Majewski wrote:
> On Fri, 21 Dec 2001, Courageous wrote:
> > Since the vast majority of all platforms
> > are x86 windows platforms, and the vast majority of C++ developers
> > use Visual C++, it would follow that the standard GUI for C++ is
> > MFC. :) :) :)
> 
> Actually, the vast majority of all platforms are embedded systems.

That would make the "standard GUI for the vast majority of platforms"
an LED and a power switch....

So why doesn't Python support LEDs and power switches?  How can it 
compete in the embedded marketplace?!?

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com


From ssthapa at classes.cs.uchicago.edu  Wed Dec 19 21:59:28 2001
From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa)
Date: Thu, 20 Dec 2001 02:59:28 GMT
Subject: Python 1.5.x vs Python 2.x.x
References: <3C180FF7.DEAEA6C6@radical.ca> <7xhequjsgl.fsf@ruckus.brouhaha.com> <9vc581$g0h$1@peabody.colorado.edu> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu>
Message-ID: 

Fernando P?rez  wrote:
>This is clumsy, and is why yesterday I wrote a detailed post on the issue 
>hoping to hear from the redhats for a reasonable  explanation. As far as I 
>can tell, their python distribution is simply broken. The problems can be 
>worked around, but it's an annoyance.

    I think it's primarily to maintain compatibility.  Although redhat
may be able to change all the references to python1.5 in their scripts, it
still leaves the possibility that scripts that worked under redhat 7.0 will
break due to the compatibility issues between python 1.5 and 2.x.


-- 
----------------------------------------------------------------------------
	   		              |
Suchandra Thapa                       | "There are only two kinds of math . 
s-thapa-11 at NOSPAMalumni.uchicago.edu  | books. Those you cannot read beyond 
			              | the first sentence, and those you 
			              | can not read beyond the first page."
			              |                     -C.N. Yang
----------------------------------------------------------------------------


From emile at fenx.com  Mon Dec 24 19:05:20 2001
From: emile at fenx.com (Emile van Sebille)
Date: Mon, 24 Dec 2001 16:05:20 -0800
Subject: State of the SysAd art (was: vi or emacs for editing Python on Linux?)
References:   <1009127729.9271.0.nnrp-12.c2de51d8@news.demon.co.uk>  <2E48C714A6E1FBA1.19DE5ADEBF7F088A.DF90F2C1E6CC9E7C@lp.airnews.net> 
Message-ID: 

"Steve Lamb"  wrote in message
news:slrna2fg14.bgv.grey at teleute.dmiyu.org...
> On 24 Dec 2001 17:43:00 -0600, Cameron Laird 
> wrote: .
> > Does this match others' experience?  I continue to
> > run into plenty of production hosts which have barely
> > been maintained for up to four years, let alone
> > outfitted with such new-fangled decorations as a
> > properly-installed ssh.
>
>      Then how are you getting onto the machine?  I hope not plain old
telnet.
> Furthermore there are other options of gettimg things onto that machine
than
> scp.  That was, of course, an example to point out that one doesn't need
to
> edit on that machine to get work done.  I have been on a machine where ssh
was
> available but scp out of it was not.
>
> cat > sift.pl
>
>     Any other questions or can we finally put the bullshit argument to
rest?
>

I still support clients running xenix, sco, hpux and aix on dial-in modem
lines running getty.  Sometimes I have to go on site because they don't have
dial-in capabilities.  The argument may be bullshit for recent installs, and
yes I'd certainly prefer they all upgraded immediately.  OTOH, vi works just
fine for all those cases where one needs to edit on the machine to get work
done.

Happy Holidays!  ;-)

--

Emile van Sebille
emile at fenx.com

---------



From bkc at Murkworks.com  Sun Dec 30 11:29:28 2001
From: bkc at Murkworks.com (Brad Clements)
Date: Sun, 30 Dec 2001 11:29:28 -0500
Subject: REPOST: Re: (Almost) command line simulation with execfile
References: <3C2CADA8.8D6BE4C@ndh.net>
Message-ID: <5$--$$_----__$-%%$@news.noc.cabal.int>

Please post internet.py

--
Brad Clements, DevNet Sysop 5
Developer Network Sysop Team






-----=  Posted via Newsfeeds.Com, Uncensored Usenet News  =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
 Check out our new Unlimited Server. No Download or Time Limits!
-----==  Over 80,000 Newsgroups - 19 Different Servers!  ==-----

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: "Brad Clements" 
Newsgroups: comp.lang.python
Subject: cmsg cancel <3c2f4182_2 at news.newsgroups.com>
Control: cancel <3c2f4182_2 at news.newsgroups.com>
Date: Mon, 31 Dec 2001 03:09:14 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774187 27193 211.57.49.2 (31 Dec 2001 04:49:47 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:49:47 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From nospam at mega-nerd.com  Tue Dec  4 03:25:23 2001
From: nospam at mega-nerd.com (Erik de Castro Lopo)
Date: Tue, 04 Dec 2001 08:25:23 GMT
Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)
References:       <3C0BE492.5DACEA18@mega-nerd.com> 
Message-ID: <3C0C8872.2A3715A4@mega-nerd.com>

Steve Lamb wrote:
> 
> On Mon, 03 Dec 2001 20:46:10 GMT, Erik de Castro Lopo 
> wrote:
> > You really ought to try using nothing but tabs for indentation and setting
> > the tab width in your editor to whatever you prefer.
> 
> > This is so easy and works **SO** well.
> 
>     Until you answer it here is the only reply you will get because I am tired
> of reiterating that it is NOT "style" and "preference".
> 
> some_dict = {'Jane':{'Age':'21', 'Dept':'0001', 'Ext':'1234'},
>              'John':{'Age':'22', 'Dept':'0010', 'Ext':'5678'},
>              'Jeff':{'Age':'23', 'Dept':'0100', 'Ext':'9009'},
>              'Jody':{'Age':'24', 'Dept':'1000', 'Ext':'8765'},
>              'Jeny':{'Age':'25', 'Dept':'0110', 'Ext':'4321'}
>             }

Easy. Tabs everywhere:

some_dict = {
	'Jane':{'Age':'21', 'Dept':'0001', 'Ext':'1234'},
	'John':{'Age':'22', 'Dept':'0010', 'Ext':'5678'},
	'Jeff':{'Age':'23', 'Dept':'0100', 'Ext':'9009'},
	'Jody':{'Age':'24', 'Dept':'1000', 'Ext':'8765'},
	'Jeny':{'Age':'25', 'Dept':'0110', 'Ext':'4321'}
	}

Beautiful!!!!

Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo  nospam at mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
"I think there is a world market for maybe five computers." 
 -- Thomas Watson, Chairman of IBM, 1943


From wurmy at earthlink.net  Fri Dec 21 21:38:48 2001
From: wurmy at earthlink.net (Hans Nowak)
Date: Sat, 22 Dec 2001 02:38:48 GMT
Subject: wxPython w/ IDLE under WinXP Pro
References: <3c23dcd2$1_2@nopics.sjc>
Message-ID: <3C23F0DA.C86B8E5C@earthlink.net>

Adonis Vargas wrote:
> 
> i am unable to use wxPython under WinXP Pro??? although the demo works just
> fine???
> 
> (using within IDLE>F5)
> everytime i attempt to load the lib i get this error:
> Traceback (innermost last)
>   File "c:\dev\python\test.py", line 2, in ?
>     from wxPython.wx import *
> SystemError: C:\Code\c1\Objects\listobject.c:88: bad argument to internal
> function
> 
> (using IDLE interactive shell)
> on the other hand if i load it in the interactive shell i get:
> Python 2.2c1 (#27, Dec 14 2001, 13:15:16) [MSC 32 bit (Intel)] on win32
> Type "copyright", "credits" or "license" for more information.
> IDLE Fork 0.8 -- press F1 for help
> >>> from wxPython.wx import *
> >>>
> 
> and it works fine when using directly with python.exe or pythonw.exe.
> 
> just wondering if there is a fix out since i use IDLE as my editor.

I'm not sure if you are supposed to use one GUI (wxPython)
from within another (Tkinter). IDLE is written in Tkinter.

> or anyone could sugguest a better/superior editor?

There's lots of editors out there. vi, emacs, ActiveState Komodo,
PythonWorks, Archaeopteryx, etc. etc. Depends on what you want.
Also see the recent vi-vs-emacs thread, and there was a similar
thread not long ago, that you might be able to find in Google
Groups.

--Hans


From aleax at aleax.it  Tue Dec 11 05:33:32 2001
From: aleax at aleax.it (Alex Martelli)
Date: Tue, 11 Dec 2001 11:33:32 +0100
Subject: a class's coupling to its bases (was Re: __init__ concerns)
References:  <3C158FAA.DA4A4BF4@alcyone.com>
Message-ID: <9v4ndu01sli@enews4.newsguy.com>

"Erik Max Francis"  wrote in message
news:3C158FAA.DA4A4BF4 at alcyone.com...
> Peter Wang wrote:
>
> > what is the proper python
> > idiom (or, failing that, the proper technique) for ensuring that a
> > subclass instance is properly initialized, especially when details of
> > the base class are unknown?
>
> I don't understand the circumstances under which the arguments to a base
> class constructor would be unknown.  You're not picking base classes at
> random, a class will require a certain base class and will be dependent
> on it.  Therefore, it will know the necessary arguments to pass to its
> constructor.
>
> Under what circumstances would you truly not know?

Case [1]: when using a framework by subclassing framework-supplied classes

You would not WANT to know, if at all feasible, because it loosens the
coupling between your code and some application framework that you're
using, when you have to inherit from some class in the application
framework.  Coupling should be held as loose as feasible (but no
looser than that...).

Classes are normally quite tightly coupled to their bases -- one of
the main downsides of inheritance.  Loosening that coupling in as far
as that's feasible is definitely NOT a bad idea.  Particularly when
the framework is subject to future releases (if you're using a "dead"
framework, whose interfaces, at least, will never change forevermore,
then you're less vulnerable to this issue).

A framework's classes often provide "template-method" design patterns
and other design characteristics that mean the main way to use the
framework is to inherit your classes from those supplied by the
framework for this purpose.  This is a common use of inheritance.

Of course, when you perform such inheritance you become coupled, to
some extent, to the design details of the classes you're inheriting
from.  Specifically, there will be some methods you need to override,
or provide anew (cfr the Command and sgmllib modules in the Python
standard library for a few examples).

However, the framework classes you're inheriting from may have many
other methods besides those you NEED to be concerned with.  If you
can avoid being coupled to the details of those OTHER methods, then
your classes will be less tightly coupled to the framework's.  One
of the methods for which it's nice to avoid tight coupling, if and
when feasible, is indeed __init__.

See:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52235
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52236
for a couple of indications on how to proceed for this purpose.

We've done mucho editing of these (and other:-) recipes in preparation
for the paper-version of the Cookbook, though a lot remains to be done
yet; the current versions are substantially enhanced.  Once the editing
tasks are done, the plan is to update the online ASPN version of the
Cookbook with the latest-and-greatest versions -- in many cases, for
example, the enhancements have to do with considering non-classic classes
of Python 2.2 and what benefits or problems they bring to several of
the recipes.  Unfortunately, the editing is so time-consuming right now
that I can't yet find the time to update the online versions (indeed, I
have even had to suspend my participation in comp.lang.python, except
for occasional bouts like right now when I find myself at a location
where I can't be working on the Cookbook...:-).


Case [2]: generic decoration

A highly Pythonic pattern (perhaps not used as much as it could/should
be, because not highly publicized) is to inherit from a class that is
not known at code-writing time.  For example:

def FubbleDecorator(baseklass, cheerp, zlung):
    class decoratedklass(baseklass):
        # wonders and marvels based on cheerp and zlung
        # e.g.:
        def __init__(self, *args, **kwds):
            baseklass.__init__(self, *args, **kwds)
            self._cheerp = cheerp
            self._zlung = zlung
        def __getattr__(self, name):
            self._cheerp.write(self._zlung%name)
            return baseklass.__getattr__(self, name)
    return decoratedklass

etc, etc.  There are examples of such idioms on the Cookbook, too.

Clearly, such functions, manipulators of generic classes that may
well want to inherit from the classes they're decorating (classes
which are unknown at code-writing time, e.g. as they'll be passed
as arguments later on) are made most useful and general by having
the loosest possible coupling to any characteristics of the classes
being decorated.  And this can take different forms, too, e.g.,
even at module level:

class MyApplicationClass(base1, WhateverNeeded(), SomethingElse()):
    # whatever extras we need, if any
    pass

again, base classes are unknown, or at least not rigidly determined,
at code-writing time; the looser the coupling you can manage, the
more general and usable your code.


Generic programming, e.g. as supported by C++ templates, displays
some of these cases, too.  In C++'s cases, all classes are known
at compile-time, BUT code-writing time is earlier, and indeed most
templates are best written with as loose a degree of coupling as
possible to their parameters, including those type parameters that
are to be used as base-classes within the template.

Indeed, behind the veil of utterly different syntax, the amount of
similarity between Python programming and generic programming (in
particular, C++ template programming) is sometimes astounding.  The
lessons learned by writing C++ templates can sometimes be applied
to programming Python, and vice versa, despite the many obvious
semantic differences (compile-time vs run-time instantiation, for
example, but also the many differences in scoping, overloading,
type-checking, and so on).


Alex





From paul at boddie.net  Wed Dec  5 10:29:28 2001
From: paul at boddie.net (Paul Boddie)
Date: 5 Dec 2001 07:29:28 -0800
Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)
References:     <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com>  <3C0BD39F.D43D4FF7@mega-nerd.com>  <23891c90.0112040239.72e92f5@posting.google.com> 
Message-ID: <23891c90.0112050729.753ceaa@posting.google.com>

Steve Lamb  wrote in message news:...
> On 4 Dec 2001 02:39:19 -0800, Paul Boddie  wrote:
> > If you have a file which uses only "hard tabs" for indentation, and
> > someone then modifies their indentation level in an editor which
> > supports "hard tabs", and that person then uses "hard tabs" to indent
> > code in that file, then there isn't a problem.
> 
>     Yes, there is.  Hard tabbers, like you, forget that not all indention,
> even for the most stout hard tabber will always be tabs.  If you haven't
> figured that out yet, you haven't been coding long enough.

My use of the word "if" did have some bearing on the meaning of the
paragraph you quoted above, but I see that you find it much more
exciting or fun to bring the debate to the level of a semi-religious
argument.

> > If, on the other hand, someone loads the file into such an editor and
> > starts slapping the space bar to indent code, then you do have a
> > problem. 
> 
>     No, I don't.  Because when the file is saved all indention is in spaces.
> Never a tab shall be written out, period.  In that manner there are no
> problems.

And my use of "such an editor" also has an influence on the meaning of
that paragraph, but I see that you aren't willing to consider
situations other than your own. Therefore any discussion on this
matter with you is fairly pointless.

>     Furthermore I am not flaming people who use hard tabs.  I am upset at
> people who are arguing for hard tabs who, for three days, blatently ignored a
> simple example which blew their argument out of the water.  I am further upset
> by blundering nits who waltz into the discussion, throw out what a tab means
> in two entirely unrelated contexts, and then things he's the flippin' mossiah!

Your oh-so-powerful argument was based on "nice" formatting of some
code whose interpretation by the Python runtime was pretty much
independent of its indentation. I'm not claiming to know what a tab
means to all people, but it seems fairly obvious to me that you
consider the definitive tab reference to be whatever tools you use - I
was just pointing out that the definition of a tab has wider
significance, and I hardly think that word processing is "entirely
unrelated" to text editing.

Paul


From donn at u.washington.edu  Wed Dec  5 16:33:15 2001
From: donn at u.washington.edu (Donn Cave)
Date: 5 Dec 2001 21:33:15 GMT
Subject: Detection of subsequent data by poll()
References: <79179cf5.0112051303.24daac96@posting.google.com>
Message-ID: <9um3qr$d20$1@nntp6.u.washington.edu>

Quoth rupe at metro.yak.net (Rupert Scammell):
| I recently wrote a program that uses the select.poll() method in order
| to
| check for incoming data on multiple listening sockets.  When I open a
| connection to one of the listening sockets (e.g. via telnet), the
| program accepts the first item of data sent (a character string with a
| trailing CRLF).  However, subsequent calls to poll() never appear to
| detect more strings sent in the same connection to this socket.  The
| file descriptors for the sockets are all correctly registered with the
| poll object.
|
| Is there a way to make poll() detect this incoming data without having
| to close and re-open a connection to the socket in question each time?
|
| Any suggestions would be appreciated!

Suggestion:  post a program that shows the problem.  Also suggest
you mention your platform.

	Donn Cave, donn at u.washington.edu


From rdsteph at earthlink.net  Mon Dec 17 19:39:23 2001
From: rdsteph at earthlink.net (Ron Stephens)
Date: Tue, 18 Dec 2001 00:39:23 GMT
Subject: Update Oreilly books?
References: 
Message-ID: <3C1E916B.510B3434@earthlink.net>

>

I have reviewed 15 Python books at http://www.awaretek.com/book.html and I
have few comments about several  others. Also included are links to Dr.
Mertz' Python book reviews at IBM Developer Works. I encourage you to *not*
take my reviews as gospel, but check out Dr. Mertz' and any other book
reviews you can find, and take it all into consideration.

FWIW, I really liked Programming Python, and I doubt it will be obsolete soon
since it's a recent publication. If you liked Learning Python, I think you
will also like Programming Python. No, it doesn't cover *everything*, but it
does cover a lot.

It is a "hands-on" kind of book, not a reference book. It takes you through a
wealth of detaield material on mnay topics, and is very heavy on actual code.

Ron Stephens



-------------- next part --------------
An HTML attachment was scrubbed...
URL: 

From jhauser at ifm.uni-kiel.de  Thu Dec 20 15:54:00 2001
From: jhauser at ifm.uni-kiel.de (Janko Hauser)
Date: 20 Dec 2001 21:54:00 +0100
Subject: Bug in % string formatting?
References: <9vtiev$no8$1@peabody.colorado.edu>
Message-ID: <871yhp7guv.fsf@ifm.uni-kiel.de>

Fernando P?rez  writes:

> print 'Explicit list construction:'
> print format_string % names['John'][:] + names['Jane'][:]
> 

Operator precedence :-), change it to 
>>> print format_string % (names['John'][:] + names['Jane'][:] )

HTH,
__Janko

-- 
  Institut fuer Meereskunde             phone: 49-431-597 3989
  Dept. Theoretical Oceanography        fax  : 49-431-565876
  Duesternbrooker Weg 20                email: jhauser at ifm.uni-kiel.de
  24105 Kiel, Germany


From sander at haldjas.folklore.ee  Sun Dec 23 14:26:16 2001
From: sander at haldjas.folklore.ee (Sander Vesik)
Date: Sun, 23 Dec 2001 19:26:16 +0000 (UTC)
Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic
References:       <1009122972.599277@haldjas.folklore.ee> 
Message-ID: <1009135573.707384@haldjas.folklore.ee>

In comp.lang.scheme Anton van Straaten  wrote:
> Sander Vesik wrote:
>>It would have been nice of you to actualy refute his claims, and not just
>>namecall.

> Except that the troll's claims are self-fulfilling.  By posting an
> essentially content-free rant under a pseudonym, he generated some annoyed
> responses.  He then used that as "evidence" in his argument:

Well... tthe original mail wasn't *THAT* bad - besides, trolls are
trolls, you don't have to feed them...

>>Anyone calling for injection of fresh ideas into the language is
>>attacked with a level of spite and religious vehemence rarely seen
>>outside of fundamentalist religious sects.

> The problem with this is, had this person posted a reasoned message about
> the issues in question, it's quite unlikely that the same kind of response
> would have been generated.

> Besides, if the troll is claiming that he's afraid to post under his real
> name because of the response it would generate, is it because he's afraid of
> a few flames?  Or is he simply unwilling to tarnish his reputation, which
> would certainly suffer if he posted messages like that first one, which was
> an amateurish call-to-arms based on a faulty premise.

> I support the idea of some movement in the standards area myself, but that
> isn't the troll's motivation, you can be sure - or if it is, he has a very
> strange way of going about it.

> Anton




-- 
	Sander

+++ Out of cheese error +++


From bsturk at news.rcn.com  Thu Dec 13 21:41:54 2001
From: bsturk at news.rcn.com (Brian Sturk)
Date: 14 Dec 2001 02:41:54 GMT
Subject: popen3 on windows and interactive subprocesses
References:  
Message-ID: 

>> I have a script that is run from within the editor vim.  It uses 
>> popen2.popen3 to run cmd.exe.  I then grab stdout and submit commands
>> to it via stdin. It works pretty well right now except for one thing.
>> When I spawn an *interactive* process, like ftp or cleartool I no longer
>> see anything on stdout after it's launched. Is this possibly because
>> the app is writing directly to the win32 console?  Any help/ideas greatly
>> appreciated.
> 
> It depends on the application.  It could be that it is writing
> directly to the console, but it could also just be that it is
> buffering its output since it is no longer talking directly to a
> console.  Interactive applications often show this quickly because
> they print a prompt, but no newline, and then wait for input.  The
> lack of newline prevents line buffering from flushing that line.
> 
> You'll see this issue even with Python itself unless you manually
> specify non-buffered with '-u' on the command line.
> I don't know of a good way under Windows to defeat this unless the
> application has such an option.  

Thanks for your help.

Just as test I tried running python -u in this environment and
got some output but it looked like garbage, I can look into that
so at least I can support running python with -u.  I'm wondering
if there are any Windows APIs I could use that would get me
the data?

> Under Unix, you can use something
> like a pty to make the application think it's actually talking to a
> terminal although doing so portably across systems can be a black art
> mastered by few (such as 'expect').

Under Unix I am using pty, and it works *much* better.  I also looked
at some of the python expect modules and they seem to be tailored
for unix.  The one that seemed to be general purpose ( at ftp.obsidian... )
didn't allow anonymous logins.  :(

--
.-----------------------------------------------------,-------.  
| Brian M. Sturk - http://www.nh.ultranet.com/~bsturk \ C/C++ |  .>   )\,^a__
|--------------------------|  bsturk at nh.ultranet.com   | Java | (  _ _)/ /-." ~
| http://www.telengard.com `---------------------------`------|  `( )_ )/
| Telengard Technologies Inc. -  NT/*nix UI & device drivers  | _<_s_<_s
'-------------------------------------------------------------'


From soppers3 at cti.ecp.fr  Mon Dec 31 03:59:59 2001
From: soppers3 at cti.ecp.fr (Stephane SOPPERA)
Date: Mon, 31 Dec 2001 09:59:59 +0100
Subject: REPOST: Re: wxBitmapFromImage function in wxPython?
References: <3C2F7BB3.577D3712@cti.ecp.fr> <3$--$$_----__-$-$$@news.noc.cabal.int>
Message-ID: <3C30290F.C20213B0@cti.ecp.fr>

> Python 2.1.1 (#1, Aug 28 2001, 19:51:39)
> [GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-85)] on linux2
> Type "copyright", "credits" or "license" for more information.
> >>> from wxPython.wx import *
> >>> wxBitmapFromImage
> 
> >>>
>
> Perhaps there is something amiss with your wxPython installation?
>

Thanks for your answer.

Yes that's it.
I'v only the version 2.2.7, not the last one.


--
Stephane SOPPERA
http://stephane.soppera.free.fr





From bob at passcal.nmt.edu  Mon Dec  3 19:04:59 2001
From: bob at passcal.nmt.edu (Bob Greschke)
Date: Mon, 3 Dec 2001 17:04:59 -0700
Subject: C extension/char array question
Message-ID: <9uh3ur$6ct$1@newshost.nmt.edu>

In C I'm doing something like

   char *Array = {"THIS", "THAT"};

in the main function, then I do something like RememberMe(Array); to a
function like

   void Remember(TheArray)
   char *TheArray[];
   {

/* RememberMe is, let's say, some sort of global (char **RememberMe)
*/
      RememberMe = TheArray;
   }

then in another library function I read in a line of text from a file
and

   for (i = 0; i < 2; i++)
   {
      if (strstr(InLine, RememberMe[i]) != (char *)NULL)
         break;
   }
   check to see if there was a match or not, blah, blah, blah

What I want to be able to do is code the list of things to look for
("THIS" and "THAT") into the Python part, and call a C extension
function that calls the C library function that does the job of
RememberMe().  I guess I'm not sure what to put "THIS" and "THAT" into
(a list?), and what format specifier to use in  PyArg_ParseTuple(), to
make sure that C is able to keep track of the addresses of the char
array elements so it can use them in the strstr() function -- if this
can be done in a straightforward manner at all.  Will I have to
'recreate' the array of strings in the extension, like with malloc()?
I've written extensions to pass floats and ints back and forth, but
not arrays of arrays.

Thanks!

Bob





From wryder at taz.cs.wcupa.edu  Mon Dec 10 16:48:20 2001
From: wryder at taz.cs.wcupa.edu (wryder at taz.cs.wcupa.edu)
Date: 10 Dec 2001 21:48:20 GMT
Subject: trouble with import odbc
Message-ID: <9v3aj4$9ke$1@news.netmar.com>

Anyone ever seen this error given the code after that:

 File "odbc.py", line 1, in ?
   import dbi, odbc, sys
 File "odbc.py", line 4, in ?
   s = odbc('postgresql/postgres/n4pk1n')
TypeError: object of type 'module' is not callable
-----------------
import dbi, odbc

s = odbc('postgresql/postgres/n4pk1n')
cur = s.cursor()
cur.execute('select * from discounts')
print cur.description
for tup in cur.description:
        print tup[0], print
while 1:
        rec = cur.fetchmany(10)
        if not rec: break
        print rec


Finding it very hard to chase stuff like this down.  What the heck does that
error message mean?  Maybe some nutrinos caused two bits on my hardrive to
swap so that the module is corrupt and isn't callable?  Whatever.  Anyway,
Thanks in advance!  wryder at taz.cs.wcupa.edu



 -----  Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web  -----
  http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
   NewsOne.Net prohibits users from posting spam.  If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse at newsone.net


From loewis at informatik.hu-berlin.de  Tue Dec 18 06:19:58 2001
From: loewis at informatik.hu-berlin.de (Martin von Loewis)
Date: 18 Dec 2001 12:19:58 +0100
Subject: How can I display unicode in Tk widget
References: <9vkqm7$fqo83$1@ID-12869.news.dfncis.de>
Message-ID: 

"Kick"  writes:

> Is there any function or something else that can make me use Unicode in Tk?

On Windows, Tcl doesn't find its encoding database, thus it cannot
find out how to convert the Unicode string for display. Setting
TCL_LIBRARY may help.

It is questionable whether this is a bug in Tcl or Python: It is a bug
in Python, for not installing Tcl libraries in a place where Tcl will
find them, and it is a bug in Tcl, for not offering an API to tell it
a different location for the codecs database.

Regards,
Martin


From debl2nonospammy at bellatlantic.net  Sat Dec 29 19:51:24 2001
From: debl2nonospammy at bellatlantic.net (David Lees)
Date: Sun, 30 Dec 2001 00:51:24 GMT
Subject: win32all-141 for Python 2.2
References: <3C2D4676.5060700@skippinet.com.au>
Message-ID: <3C2E6515.6A957604@bellatlantic.net>

Thanks for posting this.  I am having an installation problem, probably
due to other versions of Python on my Win98 box.  I have both
ActiveState 2.1.1 and the 2.2 version from the python.org site.  An
error occurs during win32all-141 installation saying that an AXScripting
Engine can not be registered.  Also something a problem with the
python21.dll.  When I start up PythonWin the interactive window says
'2.2', but the 'About' menu item says this is Activestate 2.1.212.  It
looked like the installation was going into the python.org 2.2 directory
(the installer did not have an option to change installation
directory).  

david lees

Mark Hammond wrote:
> 
> I have made a new win32all release for Python 2.2.
> 
> Hrmm - it seems I can't login to starship :(  So I have temporarily
> placed it at:
> 
> http://users.bigpond.net.au/mhammond/win32all-141.exe
> 
> The only new known issue is that "Active Debugging" will probably not
> work - using the Microsoft Debuggers when using Python in an ASP or IE
> page will fail.
> 
> I will move this to starship, including details of exactly what has
> changed, ASAP.
> 
> Mark.


From ASHISHRANJAN_V at infy.com  Tue Dec  4 04:16:45 2001
From: ASHISHRANJAN_V at infy.com (ASHISHRANJAN_V)
Date: Tue, 4 Dec 2001 14:46:45 +0530
Subject: SWIG: Wrapper over windows dll
Message-ID: 

Hello every one ,

I have written very simple wrappers over C/C++ code . I have a dll and
header files for building applications from interface provided in header
files . I would like to develop my aplication in python . In that case ,
How do I write a wrapper over this dll , since I have only the header
file but not the implementation or defnition of functions provided in
header file , which is bundled as dll .

Regards,
Ashish R V



From eric.brunel at pragmadev.com  Fri Dec  7 11:21:02 2001
From: eric.brunel at pragmadev.com (Eric Brunel)
Date: Fri, 7 Dec 2001 16:21:02 +0000
Subject: Problem with threads and Tkinter user-generated events on Solaris
Message-ID: <9uqmm4$1lcu$1@norfair.nerim.net>

Hi all,

We're writing a Python+Tkinter application and we encountered a strange 
problem when trying to generate Tkinter events from another thread than the 
main one. Here is a short script showing the problem:

===
from Tkinter import *
from threading import Thread

root = Tk()

def f(*whatever): print 'yeah'

root.bind('<>', f)

def sendEvt():
  print 'generating'
  root.event_generate('<>', when='head')

thread = 1

def click():
  if thread:
    th = Thread(None, sendEvt)
    th.start()
  else:
    sendEvt()

Button(root, command=click, text='Send').pack()
root.mainloop()
===

Basically, clicking on the "Send" button generates an event that should be 
treated by the binding on the root widget. Depending on the value of the 
"thread" variable, the event is generated either in the main thread or in a 
secondary thread.

We tested this program with Python 2.1, Tcl/Tk 8.3 on Linux Mandrake 8.0, 
Solaris 2.7 and Windows 2000. Here is what happens:
- when the "thread" variable is 0, the program works everywhere.
- when the "thread" variable is 1, the program works on Linux and Windows, 
but not on Solaris: the event is generated, but never received (the binding 
never triggers).

Is this a known problem? Does anybody have a patch for Solaris correcting 
this behaviour? We already found a workaround, but it's quite ugly. And it 
would be really nice to have an application that is 100% portable between 
Windows and all Unices.

Thanks a lot in advance.
 - eric -



From philh at comuno.freeserve.co.uk  Sun Dec 30 19:41:06 2001
From: philh at comuno.freeserve.co.uk (phil hunt)
Date: Mon, 31 Dec 2001 00:41:06 +0000
Subject: Is learning Python "extraordinary"?
References:  
Message-ID: 

On Sat, 29 Dec 2001 22:23:03 GMT, Courageous  wrote:
>
>Don't be afraid to stroke your own rhubarb,

Does it get bigger when you do that? :-)

 as it were, on a
>college admissions test. You don't get points for modesty and
>a self-deprecating nature on that type of thing. Trust me on
>this. Brag.

Absolutely. 

-- 
*** Philip Hunt *** philh at comuno.freeserve.co.uk ***



From loewis at informatik.hu-berlin.de  Thu Dec  6 05:54:59 2001
From: loewis at informatik.hu-berlin.de (Martin von Loewis)
Date: 06 Dec 2001 11:54:59 +0100
Subject: C extension/char array question
References: <9uh3ur$6ct$1@newshost.nmt.edu>  <9uj18e$13di$1@newshost.nmt.edu>
Message-ID: 

"Bob Greschke"  writes:

> What I want to do (today...I think) is create the equivalent of a C
> array of strings like
> 
>    char *Array[] = {"THIS", "THAT"};
> 
> BUT do it in Python such that it can then be passed to an extension
> wrapper function, such that it can then be passed on to a C function
> so that the called function can do something like

Python has no builtin data type that uses an array of char*
internally. It cannot, since the memory management would not be clear.

So you have two options:
1. Implement your own data type. Internally, it would use a char**.
   Externally, you would provide a sequence interface for your type,
   creating string objects on read access.

2. Use a Python list. In Python, you create it with ["THIS","THAT"]
   In C, you need to copy this list into a char*[], element for element.
   You don't do that with PyArg_ParseTuple, but with list accessor methods:

   char **result = malloc(PyList_Length(list)*sizeof(char*));
   for(int i=0;i

L.S.

Do the methods in the latest httplib module support keep-alive connections?

Thanks in advance for your help,

Erik Leunissen

-- 

Replace `fake' by `hccnet' to obtain the real e-mail adres.



From tuttledon at mailandnews.com  Sat Dec  8 11:38:33 2001
From: tuttledon at mailandnews.com (Don Tuttle)
Date: Sat, 08 Dec 2001 16:38:33 GMT
Subject: Good book for Learning Python??
References: 
Message-ID: 

> Greg
>
> I am new to the list and would like to get some input on some good
> books for learning Python?


As far as printed books go Alan Gauld's "Learn to Program Using Python" is
best if you have little or no programming background.

If that's not you, get the new book by Chris Fehily "Visual Quickstart Guide
to Python".  IMHO this is now the best book for programmers to learn how
Python works.  It's inexpensive ($21.99 US). It's short. And after you've
read it, it's still valuable as a quick reference.

But what really sets this book apart from all the rest is the massive amount
of code examples and resultant output. Each example progresses from simple
to increasingly complex.

There are now a lot of good Python books but this is one I'd call a must
have for anyone new to Python. (and maybe not so new ;-)

Don





From jkraska at san.rr.com  Fri Dec 14 03:10:46 2001
From: jkraska at san.rr.com (Courageous)
Date: Fri, 14 Dec 2001 08:10:46 GMT
Subject: "XXX undetected error" in python_d.exe
Message-ID: 

How am I supposed to interpret this error when it is printed
by the Python interpreter? What information is it telling me?
This appears to be a feature of newer (2.2?) interpreters in
debug build only.

I've seen it flag off on reads from zero memory, so I know it's
not just an ordinary internal catch. It almost seems as if the
Python interpreter is catching SIGSEGV or something like that,
only I can find no code to enable such shenanigans.

I'm having a problem with it under VC6.0, because when it throws
off, it seems to cause the interpreter to exit, even when a
serious error has occured in extension modules I am writing/
adapting. What's bizarre is that this seems inconsistent, and
I can't identify any code that would allow Python to intercept
memory faults under windows.

???

C//



From bill-bell at bill-bell.hamilton.on.ca  Wed Dec  5 07:28:45 2001
From: bill-bell at bill-bell.hamilton.on.ca (Bill Bell)
Date: Wed, 5 Dec 2001 07:28:45 -0500
Subject: COM Registration Attributes
In-Reply-To: <1007543815.337.72178.m12@yahoogroups.com>
Message-ID: <3C0DCCAD.26599.24283DE@localhost>

"Python Programming on Win32" mentions that '_reg_options_' is a 
"dictionary of additional keys to be written to the registry for the 
COM object".

Has anyone an example or two, since I've been unable to find any?

Thanks.
"It is the time that you have wasted for your rose that makes your rose so important."--St-Exupery



From setattr at yahoo.no  Thu Dec  6 05:26:14 2001
From: setattr at yahoo.no (Kjetil Jacobsen)
Date: 6 Dec 2001 02:26:14 -0800
Subject: httplib slow read
References:  <48cs0u0a88eef5sacpbo12k1qappf9kodp@4ax.com> 
Message-ID: <2a9e827c.0112060226.16a20a42@posting.google.com>

John Hunter  wrote in message news:...
> >>>>> "Toby" == Toby Dickenson  writes:
> 
>     Toby> It could well be a problem with your hand-crafted http
>     Toby> request. I suggest you go with urllib.
> 
> I needed to set some headers, like Referer and Cookie, which is why I
> went with httplib.  I sniffed port 80 to find out how what was being
> sent by my browser, and then constructed the headers from that info,
> so I think my headers were ok.  Can't say for sure.
> 
> I suppose the headers can also be set with the urlencode format of
> urllib, so this is probably the way to go; thanks for the suggestion.
> Still curious why the read is so slow with httplib, though.

another option may be to use the pycurl module which wraps the
curl library:

>>> import pycurl
>>> f = open('output','w') # file to store document in
>>> c = pycurl.init()
>>> c.setopt(pycurl.URL, 'http://www.python.org')
>>> c.setopt(pycurl.FILE, f)
>>> c.perform()

pycurl is pretty efficient and in my experience performs faster
than httplib and urllib.  in particular when you have multiple
python-threads concurrently downloading documents.

curl:  http://curl.haxx.se
pycurl: http://pycurl.sf.net/

regards,
        - kjetil


From claird at neosoft.com  Mon Dec  3 09:35:03 2001
From: claird at neosoft.com (Cameron Laird)
Date: 3 Dec 2001 08:35:03 -0600
Subject: Dr. Dobb's Python-URL! - weekly Python news and links (Dec  3)
Message-ID: 

"My ideals for a software development process are visibility,
extensibility and mobility: I want to know exactly what code is
doing, I want to be able to add new capabilities without
harming other code that depends on old behaviors, and I want to
be able to redeploy something that's known to work into other
situations where it might also be useful. I saw the industry
moving in these directions when Lisp and Smalltalk made forays
toward enterprise adoption in the early 1990s, but the pendulum
quickly swung back from these flexible tools--to get us stuck
in the immobile, brittle complexity of platform-specific C++
and Windows DLL Hell."  Peter Coffee (November 29, 2001 //
Volume 1, Issue 22)

"Python is simply the best combination of technical excellence
and eminent practicality of any programming language available
today."  Patrick K. O'Brien 

"You will want to use a self-documenting language that is easy to modify.
Something where you can try out many different changes quickly, and see
what works best. Or better yet, where many people can try out their own
changes and see what works for them.  ...  Python is rad."  Jonathon Gardner
http://groups.google.com/groups?th=c41ef1a1c97ff405

    Peter Norvig artfully addresses Infrequently Answered Questions.
	http://www.norvig.com/python-iaq.html

    The Open Source Initiative approves Python's license.
	http://www.newsforge.com/article.pl?sid=01/11/30/1221256

    It's timely to remind readers of the effbot's correction of
    common errors in importing.
	http://effbot.org/guides/import-confusion.htm

    Big-bucks Brio drops JavaScript in favor of Python.
	http://groups.google.com/groups?th=d0af1bb41e0edf7a

    Python not enough for you?  'Wish some syntactic element
    interpreted regular expressions for you?  Don't wait for a
    PEP; just write your own class to implement the behavior.
	http://groups.google.com/groups?th=ce3ae749e3f8b1a6

    Garbage collection just works, and should occupy the attention
    of few day-to-day developers.  If you must know more, though,
    Andrew Dalke and Michael Hudson start you in the right direction.
	http://groups.google.com/groups?th=8e25a97b7ed99473

    'Need bytecode assembly?  Michael Hudson's "crappy" bytecodehacks
    is all that's available until Jeremy Hylton's full-blown compiler
    becomes available.
	http://groups.google.com/groups?th=514a1af905cf4cf

    Weaklists are good for publisher/subscriber implementations, among
    others.
	http://groups.google.com/groups?th=eabf527474a168f8

    Have an interest in "small, fast secure sockets"?  Bryan Mongeau's
    CryptKit can help.  Note the esoteric considerations of Paul Rubin
    and others for specialized attacks.
	http://groups.google.com/groups?th=5751f78c7270f2b3
	http://groups.google.com/groups?th=66aaa2339c201d42


========================================================================

Everything you want is probably one or two clicks away in these pages:

    Python.org's Python Language Website is the traditional
    center of Pythonia
        http://www.python.org
    Notice especially the master FAQ
        http://www.python.org/doc/FAQ.html

    PythonWare complements the digest you're reading with the
    daily python url
         http://www.pythonware.com/daily  

    comp.lang.python.announce announces new Python software.  Be
    sure to scan this newly-revitalized newsgroup at least weekly.
        http://groups.google.com/groups?oi=djq&as_ugroup=comp.lang.python.announce

    Michael Hudson continued Andrew Kuchling's marvelous tradition
    of summarizing action on the python-dev mailing list once every
    other week, into July 2001.  Any volunteers to re-start this
    valuable series?
        http://starship.python.net/crew/mwh/summaries/
        http://www.amk.ca/python/dev

    The Vaults of Parnassus ambitiously collect Python resources
        http://www.vex.net/~x/parnassus/   

    Much of Python's real work takes place on Special-Interest Group
    mailing lists
        http://www.python.org/sigs/

    The Python Software Foundation has replaced the Python Consortium
    as an independent nexus of activity
        http://www.python.org/psf/

    Cetus does much of the same
        http://www.cetus-links.de/oo_python.html

    Python FAQTS
        http://python.faqts.com/

    The old Python "To-Do List" now lives principally in a
    SourceForge reincarnation.
	http://sourceforge.net/tracker/?atid=355470&group_id=5470&func=browse
	http://python.sourceforge.net/peps/pep-0042.html

    Python Journal is at work on its second issue
        http://www.pythonjournal.com

    Links2Go is a new semi-automated link collection; it's impressive
    what AI can generate
        http://www.links2go.com/search?search=python

    Tenth International Python Conference 
        http://www.python10.org            

    Archive probing tricks of the trade:
        http://groups.google.com/groups?oi=djq&as_ugroup=comp.lang.python&num=100
        http://groups.google.com/groups?meta=site%3Dgroups%26group%3Dcomp.lang.python.*

Previous - (U)se the (R)esource, (L)uke! - messages are listed here:
  http://www.ddj.com/topics/pythonurl/         
  http://purl.org/thecliff/python/url.html (dormant)
or
  http://groups.google.com/groups?oi=djq&as_q=+Python-URL!&as_ugroup=comp.lang.python


Suggestions/corrections for next week's posting are always welcome.
[http://www.egroups.com/list/python-url-leads/ is hibernating.  Just
e-mail us ideas directly.]

To receive a new issue of this posting in e-mail each Monday morning,
ask  to subscribe.  Mention "Python-URL!".


-- The Python-URL! Team--

Dr. Dobb's Journal (http://www.ddj.com) is pleased to participate in and
sponsor the "Python-URL!" project.
-- 

Cameron Laird 
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html


From grey at despair.dmiyu.org  Sun Dec  2 03:45:34 2001
From: grey at despair.dmiyu.org (Steve Lamb)
Date: Sun, 02 Dec 2001 08:45:34 -0000
Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)
References:     
Message-ID: 

On Sat, 01 Dec 2001 23:14:04 -0000, Lee Harr  wrote:
>
> If using tab can cause trouble when moving source files from one
> editor to another (or one person's configuration of an editor to
> another) why not just get rid of using tab for indentation
> altogether?
>

    You'll not find tabs in any code that I touch.  Literally.  I've got my
editor configured to save spaces, not tabs.


-- 
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
         ICQ: 5107343          | main connection to the switchboard of souls.
    To email: Don't despair!   |  -- Lenny Nero, Strange Days
-------------------------------+---------------------------------------------


From nhodgson at bigpond.net.au  Tue Dec  4 06:21:05 2001
From: nhodgson at bigpond.net.au (Neil Hodgson)
Date: Tue, 04 Dec 2001 11:21:05 GMT
Subject: Printing from Windows
References: <9ui1ki$lfv$1@news.netpower.no> <20011204111022.682cc9dc.use-net@schabi.de>
Message-ID: 

Markus Schaber:

> Maybe the gtk+ printing works with windows and unix in the same way.
>
> This has the disadvantage that gtk+ is not part of standard python,
> but there are some extreme powerful widgets there (including
> embedding the mozilla engine).

    AFAICT there is no printing support in GTK+. If there is I'd like to
hear about it so I can support printing in Scintilla and SciTE. There is a
gnome-print module but that is part of GNOME and GNOME is generally only
available on X/Unix.

   Neil





From alexis.layton at post.harvard.edu  Mon Dec  3 13:18:40 2001
From: alexis.layton at post.harvard.edu (Alexis Layton)
Date: Mon, 03 Dec 2001 18:18:40 GMT
Subject: Let's make Python really strict about indentation
References: <3C087F11.4030706@post.harvard.edu>
Message-ID: <3C0BC2A3.6060702@post.harvard.edu>

Alexis Layton wrote:

> I'm starting to believe the only solution to the indentation "mixups" 
> that occur
> is to have Python become really strict about indentation, yet still 
> allow a mixture
> of spaces and tabs.
> 

My previous post still does not address one common use-case (the Unix 
editor case)
where tab-stops are 8 and indentation level is 4, where the following 
sequences
arise

SSSS
T
TSSSS
TT
TTSSSS
TTT

This pattern, as well as all common ones, can be addressed by defining
(for the purposes of lexical analysis of Python) that the tab stop is 
some sufficiently
large integer, say 256. Or one can use the algorithm described in my 
earlier post
but allow a single T to be more indentation than any number of Ss.

This would allow any internally consistent file to be parsed but 
disallow ad-hoc
mixtures of identation.

Alexis Layton



From dougfort at dougfort.net  Fri Dec 21 21:48:00 2001
From: dougfort at dougfort.net (Doug Fort)
Date: 22 Dec 2001 02:48:00 GMT
Subject: SimpleXMLRPCServer use examples?
References: 
Message-ID: <20011221.214815.1799878206.31051@dougfort.net>

In article , "Lewis
Bergman"  wrote:

> Anyone know of any?

Hi Lewis,

Check out PyAgent http://pyagent.sourceforge.net. I'm afraid I haven't
been maintaining it (had to take a day job writing VC++ that's eating up
all my time) but it may serve as some simple exampes code.

______________________________________________________________________
Posted Via Uncensored-News.Com - Still Only $9.95 - http://www.uncensored-news.com
   With NINE Servers In California And Texas - The Worlds Uncensored News Source
  


From stuart at bmsi.com  Wed Dec 19 10:54:07 2001
From: stuart at bmsi.com (Stuart D. Gathman)
Date: Wed, 19 Dec 2001 10:54:07 -0500
Subject: Python as RedHat/SysV service
References: <9voavb$rpj$1@nntp2-cm.news.eni.net> <9voe89$119q$1@nntp6.u.washington.edu>
Message-ID: <9vqd6v$auu$1@nntp2-cm.news.eni.net>

On Tue, 18 Dec 2001 16:59:37 -0500, Donn Cave wrote:

>> start,stop,reload, etc the service.  The standard methods for checking
>> whether a service is running or sending it a signal rely on the process
>> name: e.g. 'inetd'.  In this case, the process name is always
>> 'python2'.
 
> As you noticed, that "standard method" isn't a very good one!  What
> about other services that run under their own name but fork, like sshd?
> 
> Many services, including sshd for example, write their process ID to a
> well known file - might be in /etc/budgie.pid, /var/run/budgie.pid,
> etc., depending mostly on the platform.  (Could be defined as
> _PATH_VARRUN in paths.h, on fairly modern platforms.)

Many RedHat service put pid files in /var/run.  The "standard method" for
starting the service (a shell function named 'daemon') does not report the
pid, so the init.d script cannot write the pid file.  However, the
service runs as 'mail' (it is a milter), and /var/run is writable only by
root (as it should be), so the service can't create the pid file either.
Should I create an empty pid file in the script, then fill in the pid in
the service?

I am getting the impression that I should ignore the standard shell
functions for init.d . . .

-- 
	      Stuart D. Gathman 
Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flamis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.


From sdm7g at Virginia.EDU  Thu Dec 20 08:39:50 2001
From: sdm7g at Virginia.EDU (Steven Majewski)
Date: Thu, 20 Dec 2001 08:39:50 -0500 (EST)
Subject: Raw sockets
In-Reply-To: <20011220080531.GA8140@strakt.com>
Message-ID: 


On Thu, 20 Dec 2001, Fredrik Juhlin wrote:

> On Thu, Dec 13, 2001 at 07:52:11PM -0800, Andrae Muys wrote:
> > Might I suggest you first check out Stevens 'TCP/IP Illustrated Vol 1'
> > as it will explain in excelent detail how traceroute is built using
> > UDP not ICMP :).
> He might have meant tracert (or whatever it's called on Win32
> systems, maybe they even call it traceroute in the newer versions) which
> IIRC uses ICMP echo requests rather than random high UDP ports.

The message Fredrik Juhlin was replying to never got to me, but I'm
guessing from what I see above that it was in reply to my post.
  What *I* meant was that, whatever type of packet you send out, you're
relying on the ICMP error returned when the TTL gets decremented to zero.
Use of UDP is optional. ICMP is required.


-- Steve




From jkraska at san.rr.com  Fri Dec 14 17:15:30 2001
From: jkraska at san.rr.com (Courageous)
Date: Fri, 14 Dec 2001 22:15:30 GMT
Subject: CPython internal design question
Message-ID: 

The various different internal structures of python use
a definition strategy like this:

typedef struct {
    PyObject_HEAD
    PyObject *im_func;        /* The callable object implementing the method */
    PyObject *im_self;        /* The instance it is bound to, or NULL */
    PyObject *im_class;       /* The class that asked for the method */
    PyObject *im_weakreflist; /* List of weak references */
} PyMethodObject;

What was the rationale behind the "im_" prefixes on all of
the structure's member variables?

C//



From tatebll at aol.com  Sun Dec 30 10:55:05 2001
From: tatebll at aol.com (Bill Tate)
Date: 30 Dec 2001 07:55:05 -0800
Subject: REPOST: Re: Zope Documentation (was RE: Python Popularity: Questions and  Comments)
References:   <3C2E55A6.D873E301@engcorp.com>
Message-ID: <3$--$$_----____$-$@news.noc.cabal.int>

Peter Hansen  wrote in message news:<3C2E55A6.D873E301 at engcorp.com>...
> Bill Tate wrote:
> > 
> > I understand the "zen" thing, 
> 
> If you say that, then you don't really understand it. ;-)
> 
> > but it's not something that business
> > people are going to care about when they making a decision about
> > whether to use it or not.
> 
> As a business person, I take mild exception to that.  I'd rather
> have "zen" from Zope than "marketing" from Microsoft.

I guess I prefer to see things in the concrete and simple terms rather
abstract pieces of marketing bunk like the following from I suspect a
soon to be ex-dot.com (perhaps symptomatic you might say of the
"business" gibberish these past 3 years).  Try not to laugh to hard:

   "Xxxxxx is the world's first company dedicated to using the science
of     experience strategy, design, and technology to create
extraordinary results    for our clients.
   
   Our entire team is committed to transforming our clients'
businesses through the creation of multi-channel experiences that
inspire and strengthen dynamic connections among people, businesses,
channels, and communities."

Seems pretty clear to me - sign me up!!! :>)

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: tatebll at aol.com (Bill Tate)
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 04:22:10 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774200 27193 211.57.49.2 (31 Dec 2001 04:50:00 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:50:00 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From loewis at informatik.hu-berlin.de  Sun Dec 16 17:04:00 2001
From: loewis at informatik.hu-berlin.de (Martin von Loewis)
Date: 16 Dec 2001 23:04:00 +0100
Subject: Compiling Python with Tkinter
References:  
Message-ID: 

Ben Ocean  writes:

> In file included from ./Modules/_tkinter.c:45:
> /opt/tcltk/include/tk.h:83:29: X11/Xlib.h: No such file or directory
> 
> This file does *not* exist, anywhere:
> 
> #find / -name "Xlib.h"
> #find / -name "X11*"
> /usr/bin/X11
> /usr/lib/X11
> /usr/X11R6
> /usr/X11R6/lib/X11
> /var/cache/man/X11R6
> /etc/X11

X11/Xlib.h is supposed to be in the same location that has the X
libraries, typically /usr/include/X11, or /usr/X11R6/include/X11. If
you really don't have the headers, you most likely cannot compile
_tkinter.

Since you still did not mention what system you are using, it is hard
to suggest a procedure for installing the headers.

> I never use XWindows, so I'm wondering if it's even installed properly, or 
> if I really need it for Tkinter. Your advice?

As an aside: "It's a window system called X, not a system called XWindows."

What do you mean, you don't use it? Don't you use any kind of grapical
interface (web browsers, and the like)? Or are you merely not
developing applications for X11?

Regards,
Martin


From bkc at Murkworks.com  Sun Dec 23 13:18:42 2001
From: bkc at Murkworks.com (Brad Clements)
Date: Sun, 23 Dec 2001 13:18:42 -0500
Subject: [OT] Teamwork in Python Development
References: <20011223.095646.1061730690.31051@dougfort.net>
Message-ID: <3c262098$1_11@news.newsgroups.com>

Hehhhh .. wow, that's wild.

--
Brad Clements, DevNet Sysop 5
Developer Network Sysop Team


"Doug Fort"  wrote in message
news:20011223.095646.1061730690.31051 at dougfort.net...
> From the January Scientific American: the picture is better in the
> printed version
>
> http://www.sciam.com/2002/0102issue/010250100.html
>
> ______________________________________________________________________
> Posted Via Uncensored-News.Com - Still Only $9.95 -
http://www.uncensored-news.com
>    With NINE Servers In California And Texas - The Worlds Uncensored News
Source
>




-----=  Posted via Newsfeeds.Com, Uncensored Usenet News  =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
 Check out our new Unlimited Server. No Download or Time Limits!
-----==  Over 80,000 Newsgroups - 19 Different Servers!  ==-----


From timr at probo.com  Sun Dec 30 16:21:43 2001
From: timr at probo.com (Tim Roberts)
Date: Sun, 30 Dec 2001 13:21:43 -0800
Subject: REPOST: Suggested tweak to base64.py
Message-ID: <6$--$$_----__-%$-$@news.noc.cabal.int>

Once in a while, I use the base64.py standard library module as a
standalone Base64 decoder.  However, there is a slight problem with this.
Most base64 attachments are encoded because they were binary files to begin
with.  The base64.py test() module writes its results to stdout, which on
Windows is a text file by default.  CR/LF and Ctrl-Z confusion ensues.

I'd like to suggest the following four lines be inserted just before the
end of base64.test():

    ...
        if o == '-t': test1(); return
+   if func == decode and sys.platform == 'win32':
+       import os
+       import msvcrt
+       msvcrt.setmode( sys.stdout.fileno(), os.O_BINARY )
    if args and args[0] != '-':
        func(open(args[0], 'rb'), sys.stdout)
    else:
        func(sys.stdin, sys.stdout)
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!hub1.nntpserver.com!news-out.spamkiller.net!propagator-la!news-in-la.newsfeeds.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Tim Roberts 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 02:31:15 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774069 27193 211.57.49.2 (31 Dec 2001 04:47:49 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:47:49 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From s.schwarzer at ndh.net  Fri Dec 28 12:36:40 2001
From: s.schwarzer at ndh.net (Stefan Schwarzer)
Date: Fri, 28 Dec 2001 18:36:40 +0100
Subject: (Almost) command line simulation with execfile
Message-ID: <3C2CADA8.8D6BE4C@ndh.net>

Hello

I'm trying to make a wrapper class to execute example scripts. For
that, I use

class Example:
    '''Provide demonstration services for Python scripts.'''

    ...

    def execute(self):
        '''Read and execute the example script.'''
        print 'Executing %s ...' % self.filename
        print
        temp_globals = globals().copy()
        temp_locals = {}
        try:
            execfile(self.filename, temp_globals, temp_locals)
        except:
            print "Ooops, there seems to be a problem ..."
            print
            traceback.print_exc(file=sys.stdout)

If it wasn't for catching exceptions in the example scripts caused by
invalid user input, I would use os.system. On the other hand, the
scripts should be simple, so I would not like to put the exception
handling stuff in (every) example script.

My problem is that the above execfile call doesn't behave similar to
os.system if I have import statements in the executed file. In this
case, I get a name error which I do not get with  python file.py
(i. e. executing the example script directly from the command line).

The output of a wrapped script with an  import urllib  statement is

-----
Executing internet.py ...

Please ensure you are connected to the internet and press [Return]:

The first 150 characters from http://www.python.org/:
Ooops, there seems to be a problem ...

Traceback (most recent call last):
  File "wrapper.py", line 80, in execute
    execfile(self.filename, temp_globals, temp_locals)
  File "internet.py", line 50, in ?
    print url_content_part(url, count)
  File "internet.py", line 12, in url_content_part
    fetched = urllib.urlopen(url)
NameError: global name 'urllib' is not defined
-----

Perhaps it's a problem with the globals dictionary? What should I
probably use instead? (Note that, in contrast to other postings I have
found with Google groups, I do _not_ want to have modified the
namespaces of my wrapper module or the class instance.)

Can somebody explain what's going on here and what I should do? :-)
Many thanks in advance!

Stefan


From syver-en+usenet at online.no  Fri Dec  7 22:19:18 2001
From: syver-en+usenet at online.no (Syver Enstad)
Date: 08 Dec 2001 04:19:18 +0100
Subject: Good book for Learning Python??
References: 
Message-ID: 

"gsmickle"  writes:

> Hello All,
> 
> I am new to the list and would like to get some input on some good
> books for learning Python?

For win32 o'reillys python programming on win32 by Hammond and
Robinson.

Another good one is Programming Python (also o'reilly)

-- 

Vennlig hilsen 

Syver Enstad


From oren-py-l at hishome.net  Mon Dec 17 09:02:34 2001
From: oren-py-l at hishome.net (Oren Tirosh)
Date: Mon, 17 Dec 2001 09:02:34 -0500
Subject: Generator function performance
Message-ID: <20011217090234.A84347@hishome.net>

At first, I thought of generator function mostly in terms of convenience:
the resulting source is shorter and more readable compared to other 
implementations.  Then I found an unexpected benefit: generators are 
also very efficient.

A function call in Python is quite expensive.  Suspending and restoring 
the state of a generator is relatively cheap in comparison.  A dataflow 
process consisting of a chain of generators each reading its upstream 
generator is very fast, especially if each generator function only uses 
builtins and functions from binary modules.  

Writing such dataflows is very convenient because you only have to focus on 
one stage at a time. Each stage may read data from its upstream iterator 
more or less often than once for each result it yields and there is no need
for intermediate rate matching buffers.

	Oren




From sreich at fit.edu  Sat Dec  8 20:06:05 2001
From: sreich at fit.edu (Stephen Reiach)
Date: Sun, 9 Dec 2001 01:06:05 +0000
Subject: ftp upload with urllib or ftplib?
Message-ID: <20011209010605.266320a5.sreich@fit.edu>


>It it possible to _upload_ a file using urllib? E.g. to post
>the file contents, the username, and the password in the 'data',
>or something?

I think what you want to use is ftplib something like this:

import ftplib
ftp = ftplib.FTP("ftp.site.com")
ftp.login("username", "password")
#for text files
filename ="somefile.txt"
ftp.storlines("STOR " + filename, open(filename))
#for binary
filename ="somefile.exe"
ftp.storbinary("STOR " + filename, open(filename, "rb"), 1024)

Stephen R



From dkuhlman at rexx.com  Fri Dec 28 14:42:02 2001
From: dkuhlman at rexx.com (Dave Kuhlman)
Date: 28 Dec 2001 13:42:02 -0600
Subject: scripting on top of structural
References: <3C2C7B6C.DB7EDC32@doc.ic.ac.uk>
Message-ID: <1009569279.849331@rexx.com>

In comp.lang.python Benjamin Tai  wrote:
> 
> Hi,
> 
> Please note that this message is posted on Python and Tcl newsgroup, and
> VTK mailing list.
> 
> When an application written in a structural language is extended with a
> scripting language, there are many improved functionalities.
> 
> 1) Packages for GUI (in C/C++ case)
> 2) Wider range of libraries, easier interprocess communication.
> 3) Expose the application to a wider range of community.
> 4) Simplified syntax, speed up prototyping.
> 5) Ready to be embedded into foreign application as scripting language
> functioned as a glue.

Also,

6. Speed of development from the scripting language _and_ speed of
execution from the underlying C/C++ code.

You might also want to look at Chapter 2, "Scripting Languages" in
the SWIG manual, available at:

    http://www.swig.org/Doc1.1/HTML/Scripting.html

  - Dave

-- 
Dave Kuhlman
dkuhlman at rexx.com


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


From emile at fenx.com  Sat Dec 29 11:06:47 2001
From: emile at fenx.com (Emile van Sebille)
Date: Sat, 29 Dec 2001 08:06:47 -0800
Subject: REPOST: Re: Python 1.5.x vs Python 2.x.x
References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu>  <9vruil$ipm$1@peabody.colorado.edu>  <7xlmfxvbx7.fsf@ruckus.brouhaha.com> <3dbsgt7f0e.fsf@ute.mems-exchange.org>   <7xheqkr05q.fsf@ruckus.brouhaha.com> 
Message-ID: <2$--$$_----___%$%$@news.noc.cabal.int>


"James T. Dennis"  wrote in message
news:a0kor6$2o7u$2 at news.idiom.com...
> Paul Rubin  wrote:
> > "Fredrik Lundh"  writes:
> >>> Not bugs per se unless perfect backward compatibility was
> >>> an overriding concern.
>
> >> it isn't.
>
> > It's a bug if something is gratuitously, unnecessarily incompatible,
> > like "rand" disappearing.  What was the reason for that?
>
>  While that topic has come up: I find whrandom to be an unsightly
>  name for accessing a set of functions which is so commonly accessed
>  by novice students.  What was wrong with must calling it rand or
>  random?  Is it pure pedantry?

whrandom now exists for backwards compatibility purposes and is scheduled
for deprecation (is this a word? ;-)

Use random.


--

Emile van Sebille
emile at fenx.com

---------

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: "Emile van Sebille" 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 03:56:15 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774707 27193 211.57.49.2 (31 Dec 2001 04:58:27 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:58:27 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From skip at pobox.com  Fri Dec 21 12:41:37 2001
From: skip at pobox.com (Skip Montanaro)
Date: Fri, 21 Dec 2001 11:41:37 -0600
Subject: FW: Comunicating through COM ports
In-Reply-To: <29A97D00F387D411AC7900902770E148032F419E@LCOEEXC01>
References: <29A97D00F387D411AC7900902770E148032F419E@LCOEEXC01>
Message-ID: <15395.29777.439578.870231@beluga.mojam.com>

    david> Python21/scripts/PythonSerial

    Carlos> Sorry, but as I said before, I'm under windows98 and I haven't
    Carlos> such directory.  Do I need to download that module from
    Carlos> anywhere?!If so, give me an URL.

If it's actually a file in the Python distribution (I'm skeptical about this
particular one) you can browse the Python source tree in CVS at

    http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/

This should allow you to pick out individual files.

If it's not part of the standard distribution, check the Vaults of
Parnassus:

    http://www.vex.net/parnassus

-- 
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)



From greg at cosc.canterbury.ac.nz  Wed Dec 19 17:39:54 2001
From: greg at cosc.canterbury.ac.nz (Greg Ewing)
Date: Thu, 20 Dec 2001 11:39:54 +1300
Subject: Why is Complex number notation the way it is?
References: <23302360.0112142245.59089e4f@posting.google.com>
Message-ID: <3C21173A.8E02D0A0@cosc.canterbury.ac.nz>

Josh Yotty wrote:
> 
> I've been coding Python for about a day now, and I can't 'see' why a
> complex number like 2+3i is represented as 2+3j in Python.

Guido was apparently thinking like an engineer at the
time. Electronic engineers use j instead of i to avoid
confusion with current.

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg


From careye at spamcop.net  Sun Dec 30 21:28:32 2001
From: careye at spamcop.net (Carey Evans)
Date: 31 Dec 2001 15:28:32 +1300
Subject: REPOST: Re: values of sys.platform? for a serial port lib
References: 
Message-ID: <0$--$$_----__%$-_$@news.noc.cabal.int>

Chris Liechti  writes:

> i'm interested in values for "sys.platform" and, if possible, the name of 
> the serial port (an how the ports are numbered ttyS0, ttyS1 etc.)
> e.g "linux2" and "/dev/ttyS%d" % port, numbering starting at zero.

Actually, my "linux2" platform has the serial ports at /dev/tts/{0,1}.
Granted, some of this may be just me delighting in finding out how
many programs break when I disable compatibility symlinks in devfs,
but it's worth remembering that even standard serial ports may be
somewhere strange.

-- 
	 Carey Evans  http://home.clear.net.nz/pages/c.evans/

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Carey Evans 
Newsgroups: comp.lang.python
Subject: cmsg cancel <87g05sktrj.fsf at psyche.dnsalias.org>
Control: cancel <87g05sktrj.fsf at psyche.dnsalias.org>
Date: Mon, 31 Dec 2001 01:42:53 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009773952 27193 211.57.49.2 (31 Dec 2001 04:45:52 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:45:52 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From peterb at cortland.com  Mon Dec  3 00:44:30 2001
From: peterb at cortland.com (Peter Bismuti)
Date: Sun, 2 Dec 2001 21:44:30 -0800
Subject: Let's make Python really strict about indentation
References: <3C087F11.4030706@post.harvard.edu> 
Message-ID: <3c0a697c$1@207.229.64.20>

> > Of course, we could always become REALLY, REALLY strict and
>  never allow a mixture.

I think not allowing a mixture of tabs and spaces for indenting is
reasonable, it is sloppy and hazardous.  Not allowing tabs at all is overly
intolerant. I hope that this thread is just a bunch of hot air and that
cooler heads will prevail.




From pedro_rodriguez at club-internet.fr  Fri Dec 14 18:44:12 2001
From: pedro_rodriguez at club-internet.fr (Pedro)
Date: Sat, 15 Dec 2001 00:44:12 +0100
Subject: Model View Presenter GUI pattern?
References: <20011213172833.0bfac3c7.gry@ll.mit.edu>
Message-ID: 

In addition to others remarks (Chris, Patrick, Boudewijn,...),
I will suggest :

- if your observable class is supposed to be receiving different 
  notifications, an explicit way of dispatch them should be provided
  otherwise your update method may turn in a suite of "if" to activate
  the proper method, so :

     def notify(self, eventName, *args, *kwargs):
        for o in self.observers:
            method = getattr(o, eventName)
            method(*args, *kwargs)


- in my case, Chris remark doesn't hold as is because there is no more
  update method, but still you will need to provide additionnal
  concepts to ease development debugging to detect connecting mismatched
  objects
  1. an observable object should explicitly express which events
     it will trigger, and their arguments
  2. an observable should only trigger events it has expressed
  3. an observer may be required to implement observable events

  (1) is expressed in widget toolkits as callback prototypes (Gtk, Tk)
  or signal concept (Qt, check Boudewijn Rempt documents on PyQt)

  I suggest adding something like this :

    class Observable:

        class ObserverInterface: pass

    ...

    def register(self, o):
        if isinstance(o, self.ObserverInterface):
            self.observers.append(o)
        else:
            raise Exception("%s does not implement %s"
                              % (o, self.ObserverInterface) )


    ...
    def notify(self, eventName, *args, *kwargs):
        if gettatr(self.ObserverInterface, eventName, None):
            for o in self.observers:
                method = getattr(o, eventName)
                method(*args, *kwargs)
        else:
            raise Exception("%s does not emit %s" % (self, eventName))


    So that an Observable class will look like:
      class MyObservable(Observable):
            def event1(x, y): pass
            def event2(t, x, y, z): raise NotImplementedError

    and an Observer for MyObservable class will look like :
      class MyObserver(MyObservable.ObserverInterface):
            def event1(...): ...
            def event2(...): ...

    This way you explicitly expose the interface of your Observable
    class (1), you check that you don't generate invalid messages (2),
    and you assert that an Observer for your Observable is meant to
    be connected to it.

    This is just a simplification. The check in the notification is
    incomplete, it could be interesting to use inheritance in 
    ObserverInterface, this will require recursing in all __bases__
    classes of self.ObserverInterface. Since this will be cost
    effective at each notification, all event names should be store
    in a dictionary at instance creation (and only once per class)
    and events should be checked against it.


I wrote an application to experiment those kind of concepts, because
having started with a simple implementation of the Observer pattern,
I had some problems while developping (incorrect connections, 
mispelled event names). 

I also decided to check that the Observer prototype for an event 
matches the one in ObserverInterface, to prevent things like :
    def event1(x): ...
where
    def event1(x,y): ...
(by prototype I mean here same number and name of arguments)

If you're interested I may put this application (another todo manager)
somewhere on the web (gtk, gnome, glade required).


>    A few mvp references for the curious:
> http://www.object-arts.com/Lib/EducationCentre4/htm/modelviewpresenter.htm
> http://www.object-arts.com/EducationCentre/Overviews/ModelViewPresenter.htm
> http://www-106.ibm.com/developerworks/library/mvp.html

Thanks, for the links, since I try see what MVC and now MVP concepts
can do to improve my framework. 
There are still things that bother me still, example :

- how do you deal with states of you application ? 
  For instance, some controllers/interactors should be disabled wether
  you selected or unselected some item on list. 
  Presenter should be the ideal place to deal with it, but in 
     http://www-106.ibm.com/developerworks/library/mvp.html
  they seem to put selection and interactors in different domains, not
  to say on different machines

- should we force a Presenter to also be a View ?

--
Pedro


From aahz at panix.com  Fri Dec 28 09:36:55 2001
From: aahz at panix.com (Aahz Maruch)
Date: 28 Dec 2001 06:36:55 -0800
Subject: A new forum is up! Q: what means nntp
References: <40dbad98.0112262238.73fc14f9@posting.google.com>  <3C2B941D.B1E45AA5@htp-tel.de> 
Message-ID: 

In article ,
DeepBleu  wrote:
>
>NNTP is an internet protocol like SMTP, POP3 and HTTP for
>communication.  Also, it is the oldest one and it used to be the most
>instructive before AOL hit the scene along with the 'gold rush' :)

Really?  NNTP is older than SMTP?  Mind telling me where you found that
little gem?
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

Tenth Virtual Anniversary: 3 days and counting


From maxm at mxm.dk  Thu Dec 13 09:01:50 2001
From: maxm at mxm.dk (maxm)
Date: Thu, 13 Dec 2001 15:01:50 +0100
Subject: unintentionaly shared attributes in two different instances
Message-ID: 

I have this funny problem. When I make two objects from the class "Row" one
of the attributes is shared another one is not.

When I create the class like::

class Row:

    def __init__(self, title='', content=[]):
        self.title   = title
        self.content = content

    def append(self,item):
        self.content.append(item)

row1 = Row('Max M')
row1.append('aa')
row1.append('bb')

row2 = Row('sdf sdf')
row2.append('cc')
row2.append('dd')

print row1.content
print row2.content

I get the output:

>>>['aa', 'bb', 'cc', 'dd']
>>>['aa', 'bb', 'cc', 'dd']

It seems that when I don't pass a list to the __init__ method, that the init
finds the attribute of the row1 object, and appends to that.

When I change the __init__ method, I can make it work correctly:

# Not working

class Row:

    def __init__(self, title='', content=[]):
        self.title   = title
        self.content = content

# Working

class Row:

    def __init__(self, title='', content=None):
        self.title   = title
        self.content = content or []

I can also make it work by passing an empty list to init like::

row1 = Row('Max M',[])
row1.append('aa')
row1.append('bb')

row2 = Row('sdf sdf',[])
row2.append('cc')
row2.append('dd')

print row1.content
print row2.content

I get the output:

>>>['aa', 'bb']
>>>['cc', 'dd']

just as I would expect.

I run the code from inside PythonWin and it can sometimes hold instances in
memory, but this is rather weird I think.

Any ideas?

regards Max M




From claird at starbase.neosoft.com  Mon Dec 31 11:36:38 2001
From: claird at starbase.neosoft.com (Cameron Laird)
Date: 31 Dec 2001 10:36:38 -0600
Subject: REPOST: Re: Python Popularity: Questions and Comments
References: <3C2A9D33.67FEC261@earthlink.net>   <2$--$$_----_-%$%%$@news.noc.cabal.int>
Message-ID: 

In article <2$--$$_----_-%$%%$@news.noc.cabal.int>,
Ron Stephens   wrote:
>Hmm, it is absolutely amazing how fast PHP got so popular, isn't it? PHP has quite a few more
>SourceForge projects than Python, as many as Perl in fact (about 2700 I believe, compared to
>Python's 1300). Also, there are more PHP books in most book stores than Python books.
>
>Does anyone know how old PHP is? I'd really like to know. I have not been aware of PHP for much
>more than two years, but then I wasn't paying any attention before that. When was PHP "launched"?
>
>How did it grow so fast? Can the Python community learn anything from this phenomenon? Can we even
>incorporate some of the good points from PHP for web programming into Python, or Python add-on
>"products"?
			.
			.
			.
Rasmus Lerdorf hacked out the first PHP in 1994.  More
information of this sort is available at  and elsewhere.

Keys to PHP's growth:
1.  The explosion of the Web.  PHP is crafted
    to make (particular styles of) Dynamic Web
    pages easy, and lots of people know that's
    what they want.
2.  No-charge, open-source licensing, ...
3.  Early adoption of PHP as an Apache project.
    This was a bit of an historic accident, and
    it remains true that PHP usage estimates
    are often inflated by counts of Apache
    installations with unused-but-present PHP
    capabilities.
-- 

Cameron Laird 
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html


From thelmagonzales99 at yahoo.com  Mon Dec 31 12:05:06 2001
From: thelmagonzales99 at yahoo.com (Thelma F. Gonzales)
Date: 31 Dec 2001 09:05:06 -0800
Subject: Triangle Trigonometry
Message-ID: 

This is an almost embarrassing question, but...

I'm trying to write a script that will calculate an unknown angle in a
triangle. I have the value for the side adjacent and the side opposite
of the angle in question, therefore I need to use the tangent
function. I understand how to determine this value in decimal units,
however I need degree units. I can reach down and pick up my trusty
calculator and hit the inverse key and then the tangent key and viola
I have my degree measurement. But, alas I do not want to use my old
calculator to measure a few thousand angles, and I cannot figure out
how to do this using the math module. Does anyone know how to invoke
the "inverse" function in python?

Perhaps one of you kind folks can help me out, for I am completely
frustrated.

Thanks,
Thelma


From rdsteph at earthlink.net  Sat Dec 29 01:24:44 2001
From: rdsteph at earthlink.net (Ron Stephens)
Date: Sat, 29 Dec 2001 06:24:44 GMT
Subject: PythonCard, ease of use, and the GUI problem/opportunity/niche
References: <3C2A9D33.67FEC261@earthlink.net>   <458b194a.0112282052.1123341@posting.google.com>
Message-ID: <3C2D620C.2E67414D@earthlink.net>

Bingo! Boy, oh, boy, do I agree with you on this. I think you hit the nail right on the head.

Building a gui now using Python, compared to using VB, really sucks. Yes, it's that bad.

Whichever reasonably easy to use language (right now I'm thinking either Python, Ruby, or a yet-to-be created
language) first gets an open source gui builder built on top of it that is as easy to learn and use as VB will
dominate the world.

It must, in my opinion, be as easy to use as VB for building simple input and output forms. That's the key. It
doesn't have to be any more powerful or anything else. Just easy. This is a crying out loud need that anyone
can see; someone will solve it, I am sure. It's too big an opportunityto be forever ignored. Unfortunately, I
am beginning to hae my doubts that it will be a Python-based solution. I sure hope I'm wrong.

The only hope that I know of right now is PythonCard, only a six month old project led by Kevin Altis. I
really admire Kevin and his team and I admire this project. I think they are ace coders (especially Kevin )
who are capable of doing what needs getting done. But I am afraid they will miss the mark, partly for the same
reason as Zope has its detractors, namely, lack of good, easy to use documentation for learning and using the
language.

Now, I know it's not fair to compare Pythoncard to Zope, as PythonCard is only six months old and pre-alpha,
for heavens sake ;-))) But when you love something, ..

I am really like a cranky old uncle that only dotes from afar on a precocious child. I have nothing to do with
PythonCard, have contributed nothing, etc. But I admire it from afar like a doting uncle.

But I haven't tried to use PythonCard in many weeks, a fact I hope to remedy this weekend. But I stopped
trying because, while I could see the brilliance of design and implementation, and potential for ease of use,
I couldn't get much farther due to lack of documentation.

What's a resource file anyway? What's an application framework? Yes I'm a clueless newbie, but that's what the
winner in this battle must do, create something as easy to learn and use as VB is for a clueless newbie. For
now, unfortunately, I find it easier to use Tkinter because I have tutorials, online documentation, and even
books. PythonCard actuall seems harder to me as it stands.

Maybe some of us could actually *help* create some documentation for PythonCard???? It's home page is at
SourceForge at http://pythoncard.sourceforge.net/

So go check it out. I really believe this is important. I'm going to try to use it this weekend. Lets discuss
it, then, OK?????

Ron Stephens
http://www.awaretek.com/plf.html



Rest Cent wrote:

> The real source of growth for both Python and Ruby are the 3M VB
> developers worldwide. Whichever can provide what it is that VB
> developers like about VB on top of what Python and Ruby natively offer
> will hit the jackpot. To me these are: (a) Visual drag-and-drop
> application builder with data aware controls, and (b) good support for
> the big databases (Oracle, Sybase, Informix). I'm going through the
> gui chapters of Mark Lutz' PP2E, and while I can see that handcrafting
> gui this way gives me a lot of control, I'm thinking I don't want to
> do this -- I'm a database application developer. I want to write a
> dynamic work order system and I have no ambition to become a system
> tool maker. And so do the 3M VB developers.
>
> VB used to be a toy language. Not too long ago no respectable company
> would use VB for their corporate systems. It did not start to become
> an enterprise solution until VB3. What happened there?
>
> VB 6 will be retired in favor of VB.NET. Personally I think that the
> direction VB has taken, towards a verbose C#, is misguided. VB should
> have evolved into something like Python or Ruby. With VB.NET, VB
> programmers will ask, "What's the point?" Might as well dive into C#.
> Or look around for something else.
>
> Hopefully by that time -- 18 months from now? -- Python and/or Ruby
> will have what it is VB programmers cannot live without.
>
> Folks, come up with (a) and (b) above, then start posting at c.l.vb.
>
>
> Paul Prescod  wrote in message news:...
> > Dave Thomas wrote:
> > >
> > > ... Instead, Ruby will attract folks from outside the
> > > Python world. Ruby and Python differ in philosophy and _feel_. Some
> > > folks like one, some the other. I don't see it as competition. I see
> > > it as choice.
> >
> > Is there really a difference? Pepsi and Coke are choices. They are also
> > in competition. They have a somewhat different taste but are more
> > similar than different. In the long run, there will come a day when
> > they've taken as much of the market share of other drinks away as they
> > will, and the primary competition will be between the two of them.
> >
> >  Paul Prescod






From msoulier at nortelnetworks.com  Thu Dec 20 09:29:40 2001
From: msoulier at nortelnetworks.com (Michael P. Soulier)
Date: 20 Dec 2001 09:29:40 -0500
Subject: problems building 2.1.1 on HP-UX 10.20
References:  
Message-ID: 

Martin von Loewis  writes:

> msoulier at nortelnetworks.com (Michael P. Soulier) writes:
> 
> That's very strange; it looks to me that Python has been
> miscompiled. Did you use gcc, by any chance?

Yes, I built it with gcc and g++, version 2.8.1. It's the same version
that I used to build versions 1.5.2 and 2.0. 

Mike

-- 
Michael P. Soulier, QX41, SKY  Tel: 613-765-4699 (ESN: 39-54699)
Optical Networks, Nortel Networks, SDE Pegasus
"...the word HACK is used as a verb to indicate a massive amount
of nerd-like effort."  -Harley Hahn, A Student's Guide to Unix


From grey at despair.dmiyu.org  Mon Dec  3 15:10:20 2001
From: grey at despair.dmiyu.org (Steve Lamb)
Date: Mon, 03 Dec 2001 20:10:20 -0000
Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)
References:          <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com>  <3C0BD39F.D43D4FF7@mega-nerd.com>
Message-ID: 

On Mon, 03 Dec 2001 19:34:25 GMT, Erik de Castro Lopo 
wrote:
> YOu people are ***NUTS***.

    Yes, we're nuts because we've had to deal with people like you.

> How hard is it to find an editor that treats tabs correctly and allows
> the tab width to be set to something other than 8?

    Quite easy, which is the problem.  Or are you ignoring my rather basic but
not uncommon example of code which gets messed up when people are able to
modify indention levels.  For me it is *NOT* a matter of preference and never
was.  I can read indention levels of 2, 4, 6 and 8 (though I rarely encounter
6) in Turbo Pascal, C, Perl, Python and HTML.  In fact in most I *prefer* two.
But when formatting matters for clarity of code I am damned glad I can see
what the original author intended and not what I preferred!

> Get a grip people.

    We have a grip, tighten yours.

-- 
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
         ICQ: 5107343          | main connection to the switchboard of souls.
    To email: Don't despair!   |  -- Lenny Nero, Strange Days
-------------------------------+---------------------------------------------


From loewis at informatik.hu-berlin.de  Fri Dec 28 18:37:56 2001
From: loewis at informatik.hu-berlin.de (Martin von Loewis)
Date: 29 Dec 2001 00:37:56 +0100
Subject: REPOST: Re: mod_python and threads
References: 
Message-ID: <1$--$$_-----$$%__$@news.noc.cabal.int>

"Achim Domma"  writes:

> I'm playing around with mod_python and I like it, but I don't understand how
> it handles multiple threads. I think apache holds a pool of threads to
> handle request, so what happens if mod_python uses only one subinterpreter
> per virtual server ? 

That depends on the Apache version, the operating system, and the
configuration. To my knowledge, on Unix, Apache 1.3 will not use
threads.

> Are request handled in a serial way or do I have to write threadsafe
> code ?

Depends too much on the system you are using to answer this question.

Regards,
Martin

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Martin von Loewis 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 04:01:18 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774980 27193 211.57.49.2 (31 Dec 2001 05:03:00 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:03:00 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From jkraska at san.rr.com  Sun Dec  2 21:29:15 2001
From: jkraska at san.rr.com (Courageous)
Date: Mon, 03 Dec 2001 02:29:15 GMT
Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)
References:        
Message-ID: 

>well I'm +1 on use of tabs. It's much better when the response time is
>long eg across the Atlantic or a heavily loaded server.

If you're noticing a difference with small things like text files,
I highly suggest you use a compressing transport protocol.

C//



From loewis at informatik.hu-berlin.de  Thu Dec  6 06:01:51 2001
From: loewis at informatik.hu-berlin.de (Martin von Loewis)
Date: 06 Dec 2001 12:01:51 +0100
Subject: minidom
References: <9uhr26$nfs$1@newsg1.svr.pol.co.uk> <3C0C7DD5.AC50A8CB@engcorp.com>  <3C0CE9DA.128BBF4A@engcorp.com>
Message-ID: 

Peter Hansen  writes:

> > That is not true. Presence of the XML declaration is not a validity
> > constraint in XML.
> 
> Is it not required in any way at all?  I always thought 
> it was.

Production 22 of XML says

  prolog    ::=    XMLDecl? Misc* (doctypedecl Misc*)?

So no, it is not required in anyway. The only reason you need it is
when you have to declare an encoding, or the standalone property.

Regards,
Martin


From davebutlerREMOVE at hotmail.com  Thu Dec 20 10:18:45 2001
From: davebutlerREMOVE at hotmail.com (Dave Butler)
Date: Thu, 20 Dec 2001 15:18:45 GMT
Subject: Python Hosting Questions
References:  
Message-ID: 

Thanks for the tip on http://www.hostforweb.com . When I inquired about
possibly upgrading Python, they went ahead and upgraded to 2.2c1!

"Ben Logan"  wrote in message
news:mailman.1008501019.10128.python-list at python.org...
> I'm not sure what all you are looking for, but we are pretty happy
> with http://www.hostforweb.com.  They don't advertise Python, but
> they've got it.  They run Redhat, too, which is nice since that's what
> I run.
>
> 
> Whatever you do, do NOT use http://www.dzones.com.  They were quick to
> take the money, but when we asked them a simple question a little
> later on, they never answered.  We waited days for some answer (they
> advertise <24 hr support) before sending in another support ticket,
> but they never said a bloomin' thing.  Nothing!
> 
>
> HostForWeb's packages start at $5/month, too.  Unfortunately, the
> Python version is 1.5.2.   I think there are only the standard modules
> installed, but you have compiler access (I was able to compile the
> gdmodule...too bad gdlib wasn't compiled with TTF support, though).
> They might consider installing Python2.x...I don't know.
>
> HTH,
> Ben
>
> On Sat, Dec 15, 2001 at 07:16:40PM +0000, Dave Butler wrote:
> > I am searching for a new hosting company because my existing host does
not
> > provides many services/technologies (like Python) that I would like to
use.
> > While I evaluate potential hosts, I am uncertain as to which questions I
> > should be asking. Perhaps CLP can help me with my list of questions as
it
> > relates to Python. Here are my Python questions for the web hosting
> > companies:
> >
> > 1) Which version of Python is installed (it seems it should be at least
2.0
> > or 2.1)
> > 2) Is Mod_python supported?
> >
> > Here are some questions I have for CLP:
> >
> > 1) Is Mod_python important if the web site will be very low volume and
> > activity? My understanding is Mod_python avoids starting a new process
for
> > each CGI execution. This may not be that important in my uses. Any other
> > reasons to require Mod_python?
> > 2) Is it important that the web host provide certain Python modules or
is it
> > just as easy to install those modules I need in my own directories and
> > access them through PYTHONPATH? Are there certain Python-related
> > technologies that must be installed by the host and cannot be installed
by
> > the user in their home directories?
> >
> > I have found a potential hosting company, http://www.hostignition.com ,
that
> > offers Python, Perl, PHP4, and JSP/Servlets for $5/month. This seems
almost
> > too good to be true. Any thoughts?
> >
> > Any other advice on this search?
> >
> > Thanks,
> >
> > Dave Butler
>
> --
> Ben Logan: ben at wblogan dot net
> OpenPGP Key KeyID: A1ADD1F0
>




From rdsteph at earthlink.net  Fri Dec 28 20:09:13 2001
From: rdsteph at earthlink.net (Ron Stephens)
Date: Sat, 29 Dec 2001 01:09:13 GMT
Subject: Python Popularity: Questions and Comments
References: <3C2A9D33.67FEC261@earthlink.net>  <3C2B9E04.9957801F@earthlink.net>   
Message-ID: <3C2D1833.1D481943@earthlink.net>

Hmm, it is absolutely amazing how fast PHP got so popular, isn't it? PHP has quite a few more
SourceForge projects than Python, as many as Perl in fact (about 2700 I believe, compared to
Python's 1300). Also, there are more PHP books in most book stores than Python books.

Does anyone know how old PHP is? I'd really like to know. I have not been aware of PHP for much
more than two years, but then I wasn't paying any attention before that. When was PHP "launched"?

How did it grow so fast? Can the Python community learn anything from this phenomenon? Can we even
incorporate some of the good points from PHP for web programming into Python, or Python add-on
"products"?

Ron Stephens
http://www.awaretek.com/plf.html



From cwc_NO at sound_NO.net  Thu Dec  6 00:14:20 2001
From: cwc_NO at sound_NO.net (Cary Coulter)
Date: Thu, 06 Dec 2001 05:14:20 GMT
Subject: AIX - Python - db2.py
Message-ID: 

 I'm running DB2 on AIX.  Using the DB2.py (v0.99) module. I'm able to
fetch some data but am having a problem.
 
Sample code:
=============================================== 
import DB2
 
conn = DB2Connection(dsn='xxx', uid='xxx', pwd='xxx')
curs = conn.cursor()

# 1
ret = curs.execute("SELECT * from TABLE")
data = curs.fetchall()

# 2
ret = curs.execute("SELECT * from TABLE WHERE ID LIKE 'abc%'")
data = curs.fetchall()

# 3
ret = curs.execute("SELECT ID, NAME from TABLE")
data = curs.fetchall()

===============================================

The first 2 select/fetchall's work.  'data' is a list of tuples
containing the row data.  Dumping curs.description shows a tuple of
tuples with all of the columns and their attributes.

The third execute/fetchall doesn't work completely.  'data' is a empty
list ([] rather than None) but curs.description contains a tuple of
tuples for the 2 columns specified.


Any idea why #3 won't work or something to look at??  I can put some
debug code in the _db2_module.c code and log stuff to disk, but first
I'm looking for something simpler than learning the low level
interface to DB2.

Thanks in advance.


Cary


From rdsteph at earthlink.net  Sat Dec 29 20:09:02 2001
From: rdsteph at earthlink.net (Ron Stephens)
Date: Sun, 30 Dec 2001 01:09:02 GMT
Subject: Who needs exceptions (was Re: Two languages, too similar, competing 
 in the same space.)
References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de>  <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> <3C2E498B.6DC757E0@stroeder.com>
Message-ID: <3C2E6A51.589E7F1D@earthlink.net>

Several folks seem to agree that
+++C and programmers who like C should die a slow and painful death for
> holding back the computer industry for two decades.+++

I am hoping that the above does not apply to fellow I've heard of named Guido
van Rossum, who, it is commonly rumored, has written some useful progrms in
"C" from time to time ;-))))





From phd at phd.pp.ru  Mon Dec  3 04:45:18 2001
From: phd at phd.pp.ru (Oleg Broytmann)
Date: Mon, 3 Dec 2001 12:45:18 +0300
Subject: about using  httplib on apache with virtual host
In-Reply-To: ; from fjiihyy@21cn.com on Mon, Dec 03, 2001 at 05:25:30PM +0800
References: 
Message-ID: <20011203124518.G2490@phd.pp.ru>

On Mon, Dec 03, 2001 at 05:25:30PM +0800, charles huang wrote:
> 	I write a program to get shtml with httplib. I found that it is ok if apache do not with virtual host,but it do not work if apache with virtual host. this is my code:
> 
> import httplib,os,string,sys
> fj_www = httplib.HTTP('www.fjii.com')
> fj_www.putrequest('GET', '/index.shtml')
> fj_www.putheader('Accept', 'text/html')
> fj_www.endheaders()
> #fj_www.send()
> errcode, errmsg, headers = fj_www.getreply()
> if (errcode!=200):
> 	print "it error!\n"
> 	sys.exit()
> www_f = fj_www.getfile()
> data = www_f.read() # Get the raw HTML
> www_f.close()
> print data
> 
> my code is error or httplib do not support virtual host?

   You forgot to notify Apache *which* of its virtual hosts you want to
touch ("Host:" header).

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.



From issac at myfirstlink.net  Fri Dec 28 20:59:58 2001
From: issac at myfirstlink.net (Issac)
Date: Fri, 28 Dec 2001 19:59:58 -0600
Subject: ANNOUNCE: netdraw.py
References: <3C2C94F7.5693.8F8A761@localhost>
Message-ID: <001e01c1900c$84f54b80$6401a8c0@mojave>



> Issac wrote:
> > Here's a networked drawing program for collaborative drawing with two
> > people.
> Wow.  I have tried various networking things, but never got any 
> of them to work.  This is cool.

Glad you like it :o).

> By the way, I make a slightly more full-featured drawing 
> program off the same base you used.(See my website address 
> below)  I think I will combine your netowrking code with my better 
> paint program.  Should be done soon... 

I have a bunch of items on the TODO for this program.  Would you like
to collaborate?

> Thank you,
> Jesse W
> http://members.loop.com/~jessw

Sure!  By the way, netdraw 0.1.0 is attached.  This one has a separate server (ndserv.py)
that allows an arbitrary number of clients to connect:

$ python ndserv.py & # server (non-graphical)
$ python ndcli.py &  # launch first client 
$ python ndcli.py &
$ python ndcli.py &

By the way, netdraw depends on threads, which are not present in cygwin's python.  
People on Windows running cygwin might want to download one of the non-cygwin versions 
of python for Windows (e.g., ActiveState) and make a symbolic link to it from /usr/bin
for convenience.  

Issac




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.310 / Virus Database: 171 - Release Date: 12/19/2001
-------------- next part --------------
A non-text attachment was scrubbed...
Name: netdraw.tgz
Type: application/x-compressed
Size: 2945 bytes
Desc: not available
URL: 

From teg at redhat.com  Tue Dec 18 15:37:08 2001
From: teg at redhat.com (Trond Eivind =?iso-8859-1?q?Glomsr=F8d?=)
Date: 18 Dec 2001 15:37:08 -0500
Subject: /usr/bin/env: python: No such file or directory
References:  <9vivft$593$1@peabody.colorado.edu> <171220010818339518%jwbaxter@spamcop.net> <9vnvue$m5d$1@peabody.colorado.edu> <9vo6ng$mhs$1@nntp6.u.washington.edu>
Message-ID: 

Donn Cave  writes:

> Quoth Fernando Prez :
> 
> | If redhat is too lazy to upgrade their code in anaconda and other
> | tools to use python2, at least they could have the courtesy of
> | putting explicitly python1.5 calls in their OWN stuff, instead of
> | forcing upon their users a broken convention.
> |
> | I normally use mandrake (had been away from redhat for years) and
> | only last week was forced to deal with redhat again. What an ugly,
> | messy excuse for a linux distribution.
> 
> Does mandrake use Python for system software?

They use perl. Somehow, that didn't surprise me ;).

> It's too bad it has to be that way.  On one hand, it's unrealistic to
> expect all developers to foresee this problem, and on the other it
> seems pretty expensive for small to medium projects - maybe Redhat can
> afford to tuck away 10Mb of their own python for their system software,
> but even for them it's probably not exactly a selling point for Python.

Well, we have pretty good control over which python we use in the
installer and in the distribution...

> Why won't Redhat upgrade their software?

Compatiblity. Programs for RHL 7 should run just fine on 7.2 as well.

When we start a new series, we will upgrade to the newest python
available at the time, port the software using python to that and
stick with this release for that series of Red Hat Linux releases.

-- 
Trond Eivind Glomsr?d
Red Hat, Inc.


From scott at fenton.baltimore.md.us  Thu Dec 20 21:24:07 2001
From: scott at fenton.baltimore.md.us (Scott Fenton)
Date: Thu, 20 Dec 2001 21:24:07 -0500
Subject: Tar-like module?
Message-ID: <20011221022407.GA22502@home.com>

This may be an idiotic question, but is there a module
to read tar files in python? I googled around and 
couldn't find anything, and the Python Std Library docs
didn't have anything. Any help would be nice.

TIA
-Scott Fenton

-- 
GPG public key fingerprint:  B6B9 9F98 848B 540D 419D  5487 6B6B 5DB9 B5A5 25FA

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d>- s: a14 C++>++++ UL++++>$ P++(++++) L+++>++++ 
E>++ W++(--) N !o K w--- !O M+(--) !V PS++(+++) PE 
Y+>++ PGP+@ t- 5- !X R- tv+>! b>+++ DI++++ !D G 
e->++++ h! r y-
------END GEEK CODE BLOCK------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
URL: 

From josephwinston at mac.com  Thu Dec 20 10:04:45 2001
From: josephwinston at mac.com (Jody Winston)
Date: Thu, 20 Dec 2001 15:04:45 GMT
Subject: Bus Error in HP-UX 11.00
References: <950ee0f0.0112172230.1d7eba3f@posting.google.com>  <950ee0f0.0112200655.4a0325be@posting.google.com>
Message-ID: 

imvenki at hotmail.com (venkatakrishnan.k) writes:

> Hai,
> I was using Python2.1 which was build from source using gcc-3.0.1
> compiler.
> I did the conventional configure, make & make install dance for my
> source.
> Whether i was right or wrong,i concluded that the problem was with my
> build.
> So i opted for a readymade binary for python for HP.
> I got a HP-ported python binary from
> 
> http://hpux.connect.org.uk/hppd/hpux/Languages/python-2.1
> 
> and i am no longer getting that "Bus Error".
> So i assumed that my conclusion was right.
> 
> But i have one more problem.
> I am actually porting my python code developed for Windows to HP.
> I use ActivePython-2.1 from www.activestate.com for Windows.
> It comes with builtin support for packages like distutils & zlib.
> But i was shocked to see that these packages are missing in my HP-UX
> binary.
> Now i am searching for a binaries for all such additional packages.
> Does anybody have the binary or i have to do the same 'configure ;make
> ; make install' activity????
> 

Python 2.2 builds and runs straight out of the box on HP using HP's
compilers.  You'll get distutils but you'll have to download zlib and
compile it then add it to Setup/Modules.



From jason at jorendorff.com  Thu Dec  6 13:07:15 2001
From: jason at jorendorff.com (Jason Orendorff)
Date: Thu, 6 Dec 2001 12:07:15 -0600
Subject: getting the name of a variable
In-Reply-To: 
Message-ID: 

Sandy Norton wrote:
> When I'm debugging I'm always sticking stuff like "print 'x:', x" 
> in my code.

Try this.

import inspect
import sys
import re

_out_re = re.compile(r"^out\s*\(\s*(.*)\s*\)$")

def out(variable):
    """ Prints variable name and value to sys.stderr. """
    frame, filename, lineno, fnname, lines, i = inspect.stack(1)[1]
    my_line = lines[i].strip()
    match = _out_re.match(my_line)
    if match:
        my_line = match.group(1)
    print >> sys.stderr, "%s: %r" % (my_line, variable)

This works by loading the source code of the caller from its
source file.  So if you call out() from the Python prompt, it fails.
Try using it in an actual program or module instead.

-- 
Cheers,
Jason Orendorff
http://www.jorendorff.com/




From neuromorphus at yahoo.com  Mon Dec 10 16:46:23 2001
From: neuromorphus at yahoo.com (neuromorphus)
Date: Mon, 10 Dec 2001 21:46:23 -0000
Subject: Client/Server problem
Message-ID: <9v3aff+4ad7@eGroups.com>

Statement 

I'm creating a client/server chat program on my Linux system. It's a
group chat like ICQ, so all messages go through the server and then
broadcasted to online users. Note: for the time being, this program
will operate in a terminal/console, so no gui. 

Problem 

The client program continuously asks for 'raw_input' from the user,and
then sends the msg to the server to be broadcasted. However, I can't
output messages to the terminal/console, if the client program is
waiting for input. What happens is that after the client types a
message. All previous output(of other users) are then flush to
that client's screen. In other words, how do i get client input and
display current messages to the client's screen without having to wait
for the clients input. NOte: this is a terminal. 

Telnet does it some kinda way(it works perfect), but i'm trying to get
my client to work the same way.




From aleax at aleax.it  Fri Dec 28 11:25:14 2001
From: aleax at aleax.it (Alex Martelli)
Date: Fri, 28 Dec 2001 17:25:14 +0100
Subject: Python Popularity: Questions and Comments
References: <3C2A9D33.67FEC261@earthlink.net>  <889C110F5BBBFAFD.A03B35C232EA2760.70B0892CB9479323@lp.airnews.net>  
Message-ID: 

"Cameron Laird"  wrote in message
news:DAB7DC5D2F730DD9.72339FF5F625AF55.12461E9D1E9E52F3 at lp.airnews.net...
> In article , Alex Martelli 
wrote:
> >"Cameron Laird"  wrote in message
> >news:889C110F5BBBFAFD.A03B35C232EA2760.70B0892CB9479323 at lp.airnews.net...
> .
> .
> .
> >Maybe, but Python could be usable as an extension language
> >even if the application was implemented otherwise, in the
> >right environments (JVM: Jython always usable where Java
> >is; Microsoft COM/Automation).
> .
> .
> .
> Yikes!  Let me make this perfectly clear:  YES,
> Python deserves consideration as an extension
> language even in applications largely implemented
> in other languages such as C and Java.  I apolo-
> gize for making that obscure, for it definitely
> was one of the points I intended to make.
>
> As usual, Alex and I agree.

Hmmm, yes, but my point was slightly "skewed" -- I was playing
devil's advocate here.  Even if the customer agrees that, yes,
Python is what they surely want to use for extending and tweaking
the application, this doesn't force you to code the application
in Python -- you may still (although you shouldn't:-) code it
in other languages (partly depending on platform issues).


Alex





From dougfort at dougfort.net  Sun Dec 23 09:56:31 2001
From: dougfort at dougfort.net (Doug Fort)
Date: 23 Dec 2001 14:56:31 GMT
Subject: [OT] Teamwork in Python Development
Message-ID: <20011223.095646.1061730690.31051@dougfort.net>

>From the January Scientific American: the picture is better in the
printed version

http://www.sciam.com/2002/0102issue/010250100.html

______________________________________________________________________
Posted Via Uncensored-News.Com - Still Only $9.95 - http://www.uncensored-news.com
   With NINE Servers In California And Texas - The Worlds Uncensored News Source
  


From clspence at one.net  Tue Dec  4 16:01:08 2001
From: clspence at one.net (Chris Spencer)
Date: 4 Dec 2001 15:01:08 -0600
Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)
References:  <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com>  <3C0BD39F.D43D4FF7@mega-nerd.com>  <3c0be454$1@207.229.64.20> <3C0BE5D5.4386B359@mega-nerd.com> <3c0bf170$1@207.229.64.20>  <2g2q0us3pdsl91hkbv3gj39nbfhnjke70s@4ax.com> 
Message-ID: 

On Tue, 04 Dec 2001 18:18:42 -0000, Steve Lamb  wrote:
>On 4 Dec 2001 11:48:17 -0600, Chris Spencer  wrote:
>> 	When we standardized on the "tabber" method, everything just magically
>>lined up in the editor.  The spacers defined their tabs to be 2 or 3 spaces
>>in width so it was comfortable to look at (I choose 8 spaces of width), but
>>all of the code looked the SAME instead of the crazy mixture we had before.
>
>    Which would have happened if you standardized on a number of spaces for
>indentation.

	Some people don't WANT to look at 8 spaces for an indent.  Or 2 or 3.
With the tab convention, you can set your tab width to be whatever you want, so
people who like looking at 8 space widths can do that, and people who like 2
space widths can do that too.
	The point you seem to miss is that not everyone has the same ideas or
comfort levels with different indentation conventions.  With tabbing, you don't
have to worry about it.  Just set it to whatever you like.

>> 	Maybe if you only code for yourself you can have total uniformity of
>> coding style amongst all of your projects.  When you're dealing with several
>> people on a development project, that "tabber" convention is absolutely "the
>> Right Thing(tm)".
>
>    Except in the example, which is not uncommon.  In fact a tabber in this
>very thread promoted mixing tabs and spaces in response to it!

	I'm not him.  And I don't agree with the example in question.  I manage
quite nicely to format data structures without resorting to spaces.

>    Tabs are the worst possible thing and no large number of people rallying
>behind it will change it to a right.  All it proves is that like any other
>foolish notion you can fool quite a few people into believing it.  

	This is a straw man argument.  Like "so, have you beaten your wife
lately?"  I refuse to get into a competition involving name calling.
	Tabs work for me and for my development group.  They don't work for you.
Guess what, we both can do our own thing.  The only difference between us is
that you want to force me to your way of thinking.  I simply don't care what you
think.  You can use spaces to your heart's content and I won't mind.  I'm not
the one forcing others to abide by my way of thinking.  Such totalitarian edicts
will only serve to drive people away from Python.
	I think you've got way too much of your ego involved in this debate.

>
>    The difference is while all the tabbers are whining on the side of
>"preference" I'm pointing out very real logistical problems which has nothing
>to do with preference.  Preference takes a back seat.  When you stop ignoring
>that you'll come to understand the problem.
> 
	I see, preference doesn't matter as long as the convention matches YOUR
preference.  To hell with everyone else, right?
	Just because you like to work a certain way does not mean that you have
become God and will decree that your *preference* is the only way to do things.
Step back from your ego.

Chris.



From curtin at ubsw.com  Mon Dec 10 15:37:33 2001
From: curtin at ubsw.com (craig curtin)
Date: 10 Dec 2001 12:37:33 -0800
Subject: server side scripting with python/exchange2000
Message-ID: <4c7395cb.0112101237.12c0cc20@posting.google.com>

hi,
is there a FAQ for setting up python scripting on an exchange 2000 server?
i'm tasked with this now and 'think' it should be a no-brainer.

thanks,

craig


From greg at cosc.canterbury.ac.nz  Mon Dec 10 00:53:57 2001
From: greg at cosc.canterbury.ac.nz (Greg Ewing)
Date: Mon, 10 Dec 2001 18:53:57 +1300
Subject: Calling a generator multiple times
References: 
Message-ID: <3C144DF5.C6E91E9B@cosc.canterbury.ac.nz>

Steven Majewski wrote:
> 
>  And when you use these generators in a for loop, they two bits of
> confusion seem to cancel each other out.

That's a nice way of putting it! Well said.

> "for i in g(10):" really
> behaves just like it's definition.   I'm guessing that this fact
> was one of the selling points for this syntax -- that if you didn't
> look under the hood and just USED them, they would not be confusing.

Unfortunately, when you *do* come to look under the
hood, there's twice as much confusion as there would
have been if the confusion had been spread around
more evenly.

So, looked at that way, Guido has chosen to put all
the confusion in one spot rather than distributing
it. :-)

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg


From littlejohn.75 at free.fr  Mon Dec 24 08:30:09 2001
From: littlejohn.75 at free.fr (Francois Petitjean)
Date: Mon, 24 Dec 2001 14:30:09 +0100
Subject: Efficient storage of floats
Message-ID: <3c272d5e$0$202$626a54ce@news.free.fr>

I have to read a number of points coordinates (npoints). Different
structures can be used to store these numbers:
1. points as a list of (x,y,z) tuples
points = []
and each time a point is read
points.append( (x,y,z) )
To use : x,y,z = points[kpt]  # very straightforward

A variant (1.b) can be to initialize the list
points = [ (0.0, 0.0, 0.0) * npoints ] or [ (0.0, 0.0, 0.0 ) ] * npoints
I don't remember the syntax.(should be the second one).

There is some overhead in using a list for storing the same type of tuples.

2. The coordinates can be stored in an array
acoords = array.array('f')
and the variant:
2.b acoords = array.array('f', [ (0.0,) *(3*npoints) ])
In the 2.a case :
acoords.append(x)
acoords.append(y)
acoords.append(z)
can be used to store a point.
or simpler (2.a2) : acoords.extend( [x,y,z] )
Similarly :
2.b1  acoords[3*kpt] = x
         acoords[3*kpt+1] = y
         acoords[3*kpt+2] = z
or
2.b2  acoords[3*kpt:3*kpt+3] = [x,y,z] # ??

Using acoords : x,y,z = acoords[3*kpt],acoords[3*kpt+1],acoords[3*kpt+2]
or simpler  x,y,z = acoords[3*kpt:3*kpt+3]

The type of contained objects (a simple float) is supposed to be stored (and
queried, checked) only one time for each evaluation of a expression with
many acoords[index] terms.

Is it possible to have a quantitative assessment of the overhead of the two
methods 1(list) or 2(array)? (overhead in memory footprint or CPU cycles).
And is it interesting to preinitialize the structure? The number of points
is typically 800*2 (for symmetry) that is say up to 8000 floats.

Regards




From loewis at informatik.hu-berlin.de  Sun Dec  2 09:17:36 2001
From: loewis at informatik.hu-berlin.de (Martin von Loewis)
Date: 02 Dec 2001 15:17:36 +0100
Subject: pygettext examples?
References:     
Message-ID: 

Joseph Santaniello  writes:

> OK, so it works now (I had my directory structure incorrect) but the only 
> way I have successfully changed languages on the fly is by using 
> os.environ['LANG'] = 'no'. 

That is the way it is supposed to work: The user shall set her LANG
environment variable, and then all programs shall print messages in
the user's preferred language. If you want it differently, expect to
write more code yourself.

> I haven't been able to figure out how to use gettext.translation()
> and install() to change the language. Is there any reason why I
> shouldn't just continue to use the os.environ method?

If you want to switch languages dynamically (and ignore the user's
LANG setting altogether) I recommend that you directly load the
translation files.

the_catalog = gettext.translation("domain",languages=["no"])

def _(msg):
  return the_catalog.gettext(msg)

Then, whenever you want to switch a language, just change the_catalog.
Alternatively, you could also do

_ = gettext.translation("domain", languages=["current-lang"]).gettext

(make sure you rebind _ in a scope so that all your modules see that
change)

Notice that gettext.translation also allows specification of the
locale directory. If you don't even want to use the
LC_MESSAGES/lang.mo directory structure, you can use

the_catalog = gettext.GNUTranslation(open(mofile))

in which case control for opening the right mofile is completely in
your hands.

HTH,
Martin


From dceicorp at yahoo.com  Wed Dec 19 23:54:41 2001
From: dceicorp at yahoo.com (McGee)
Date: 19 Dec 2001 20:54:41 -0800
Subject: Client Server GUI database application with python
Message-ID: 

To interested snakes,

We have just proved to ourselves that python is a very capable and
functional
program to implement Client Server GUI database applications on the
Linux platform.

Just from the samples and the GUI layouts, we found python to be a
very versatile application to access MySQL.

After sorting out various database management packages available for
the linux platform, we like python... It seems to be ahead of the
game.

                                                  Thanks Python.
                                                  Mcgee


From warren-postma at NOSPAM.rogers.com  Thu Dec 20 19:18:53 2001
From: warren-postma at NOSPAM.rogers.com (Warren Postma)
Date: Fri, 21 Dec 2001 00:18:53 GMT
Subject: blast from the past:  ABC.
Message-ID: 

Having noted that the programming language ABC is listed in the Open
Directory (dmoz.org), I found this article:

http://www.cwi.nl/~steven/abc/

Hmm.   Wasn't ABC one of the things that Guido worked on that eventually
lead to his developing Python?

How "Pythonic" indeed is this particular code snippet:

HOW TO RETURN words document:
      PUT {} IN collection
      FOR line in document:
	 FOR word IN split line:
	    IF word not.in collection:
	       INSERT word IN collection
      RETURN collection


Warren




From a11w at SoftHome.net  Thu Dec  6 18:37:38 2001
From: a11w at SoftHome.net (Jiba)
Date: Thu, 6 Dec 2001 18:37:38 -0500
Subject: simple, lightweight component based development in python?
References: 
Message-ID: <3c10a79e$0$24733$7a628cd7@news.club-internet.fr>

What about Pyro ?

I've never tried it but it looks great. It is pure-Python, but only Python.

http://pyro.sourceforge.net/

Jiba



From DeepBleu at DeepBleu.org  Fri Dec 28 10:46:55 2001
From: DeepBleu at DeepBleu.org (DeepBleu)
Date: Fri, 28 Dec 2001 09:46:55 -0600
Subject: REPOST: Re: A new forum is up! Q: what means nntp
References: <40dbad98.0112262238.73fc14f9@posting.google.com>  <3C2B941D.B1E45AA5@htp-tel.de>  
Message-ID: <1$--$$_-----$%_$$$@news.noc.cabal.int>

"Aahz Maruch"  wrote in message
news:a0i027$dl2$1 at panix3.panix.com...
> In article ,
> DeepBleu  wrote:
> >
> >NNTP is an internet protocol like SMTP, POP3 and HTTP for
> >communication.  Also, it is the oldest one and it used to be the most
> >instructive before AOL hit the scene along with the 'gold rush' :)
>
> Really?  NNTP is older than SMTP?  Mind telling me where you found that
> little gem?

I have a special cache of little gems somewhere around.
I meant to say "one of the oldest."  I personally do not care what is the
oldest anyway.
But thanks for the correction.
DeepBleu

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: "DeepBleu" 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 03:11:47 GMT
Organization: The World's Usenet -- http://www.Supernews.com
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775318 27193 211.57.49.2 (31 Dec 2001 05:08:38 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:08:38 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From dyoo at hkn.eecs.berkeley.edu  Fri Dec 28 02:08:42 2001
From: dyoo at hkn.eecs.berkeley.edu (Daniel Yoo)
Date: Fri, 28 Dec 2001 07:08:42 +0000 (UTC)
Subject: REPOST: Re: New Array proposal (So that it will actually be read)
References: <40dbad98.0112272113.40a21ab7@posting.google.com>
Message-ID: <5$--$$_--__-%$$-%$@news.noc.cabal.int>

Andrew Nguyen  wrote:
: I think that an array sould have natural dimension support,

Have you had a chance to look at Numeric Python yet?

    http://www.pfdubois.com/numpy/

This module provides good support for multidimensional arrays, and in
fact, supports many of the things that you're looking for.


For example:

###
a = arrayrange(9)
a.shape = (3, 3)
a[1, 1] = 42
###

should work.  The documentation has good example of Numeric Python
here:

    http://www.pfdubois.com/numpy/html2/numpy.html

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newsengine.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail
Message-ID: 
Control: cancel 
Subject: cmsg cancel 
From: Daniel Yoo 
Newsgroups: comp.lang.python
X-No-Archive: yes
Lines: 2
NNTP-Posting-Host: wonenara.ozemail.com.au
X-Trace: ozemail.com.au 1009643090 203.108.164.177 (Sun, 30 Dec 2001 03:24:50 EST)
NNTP-Posting-Date: Sun, 30 Dec 2001 03:24:50 EST
Organization: OzEmail Ltd, Australia
Distribution: world
Date: Sat, 29 Dec 2001 12:50:11 GMT

This message was cancelled from within Mozilla.


From maxm at mxm.dk  Tue Dec 18 06:21:18 2001
From: maxm at mxm.dk (maxm)
Date: Tue, 18 Dec 2001 12:21:18 +0100
Subject: lost interest?
References: <20011208001123.A5989@casa.parque> 
Message-ID: <3FFT7.5573$Q3.847787@news010.worldonline.dk>

From: "Sean Reifschneider" 


> After publicizing the implementation and the "--submit" patches to the the
> main python list and the distutils/catalog sigs, I got exactly *ONE*
> package upload.
>
> So, is it that the people who want it aren't the people who can make it
> happen?  Are the people who want it to happen not motivated enough to
> actually do something about it?  Is it just not really that interesting of
> a problem?

I guess that to kickstart a system like that, there would have to be a
source of authority blessing the use of the system. And it should be
featured prominently on the frontpage of python.org. I have used Python for
a couple of years. Have been on the list the same time, and didn't know that
the functionality existed.

A believe that a Python CPAN system has to be somehow officially sanctioned
to work.

But then that's the old problem with core language design vs. library
enhancements, and who should do what, that we see again.

regards Max M




From loewis at informatik.hu-berlin.de  Fri Dec 28 12:59:59 2001
From: loewis at informatik.hu-berlin.de (Martin von Loewis)
Date: 28 Dec 2001 18:59:59 +0100
Subject: REPOST: Re: pth files - can they prepend to sys.path?
References: 
Message-ID: <5$--$$_-----$$%__$@news.noc.cabal.int>

"Skip Montanaro"  writes:

> Is it possible to force a directory mentioned in a .pth file to be
> inserted at the beginning of sys.path instead of appended to the
> end?

By means of a dirty trick, perhaps. Put a line

import prepend_foo

into a .pth file, then add a module prepend_foo.py into the same
directory, which reads

import sys
sys.path.insert(0,"foo")

Works from Python 2.1 on.

HTH,
Martin

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Martin von Loewis 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 01:34:01 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775172 27193 211.57.49.2 (31 Dec 2001 05:06:12 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:06:12 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From zhangsc at neusoft.com  Sun Dec 16 20:38:07 2001
From: zhangsc at neusoft.com (=?gb2312?B?1cXJ2bPb?=)
Date: Mon, 17 Dec 2001 09:38:07 +0800
Subject: socket question(urgent!)
Message-ID: <021c01c1869b$7afe3ee0$4301010a@sky>

   I listen UDP package without via normally way,the reason is that my firewall don't support adverse DNS,so the head of company ask me to collecting DNS packages from LAN,and extract ip and relevant domain from them,and if given IP,then it will return IP's relevant domain.My program of serpy.py is collecting DNS message and charge return IP's domain to client.py ,So I designed my program like follows,I'm a newbie and I don't know a lot of knowledge about network programming,I'm looking forward to receiving any help letter,Thanks! My email zhangsc at neusoft.com

server.py #It works at IP address of 10.1.1.27

import socket,struct
import os
import string
os.system("ifconfig eth0 promisc")
Ethhdr='!BBBBBBBBBBBBH'
Eth_len=struct.calcsize(Ethhdr)
IPhdr='!bbhhhbbhll'
IPhdr_len=struct.calcsize(IPhdr)
UDPhdr='!HHHH'
UDPhdr_len=struct.calcsize(UDPhdr)
ipsock=socket.socket(socket.AF_INET,10,8)
while 1:
  recvpack=ipsock.recv(1024)
  if len(recvpack) <= (Eth_len+IPhdr_len+UDPhdr_len):
     continue
  data=struct.unpack(Ethhdr,recvpack[:Eth_len])
  if data[12]==53:
    #collecting DNS package,and extract IP and IP's relevant domain
    .......
  if data[12]==2048:
    ipdata=struct.unpack(IPhdr,recvpack[Eth_len:Eth_len+IPhdr_len])
    if ipdata[6]==socket.IPPROTO_UDP:
      udpdata=struct.unpack(UDPhdr,recvpack[Eth_len+IPhdr_len:Eth_len+IPhdr_len+UDPhdr_len])
      if udpdata[1]==21567 or udpdata[0]==21567:
        #I get udpaddr from IP header of 32bit source ip address,
        #and I get udpdata[0] from UDP header of 16bit source port number.
        udpaddr="%i.%i.%i.%i" % (ipdata[8]>>24 & 255,ipdata[8]>>16 & 255,\
                                ipdata[8]>>8 & 255,ipdata[8] & 255)
        addr=udpaddr,udpdata[0]
        print type(addr)
        print addr 
        #for some program design reason,I can't use data,addr=udpSerSock.recvfrom(BUFSIZ) to get addr,
        #because data,addr=udpSerSock.recvfrom(BUFSIZ) is conflict with recvpack=ipsock.recv(1024)

        udpSerSock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
        data='relevant domant is',dbs[ip]
        udpSerSock.sendto(data,addr)
        udpSerSock.close() 

client.py #It works at IP address of 10.1.1.67

from socket import *
import string
HOST='10.1.1.27'
PORT=21567
BUFSIZ=1024
ADDR=(HOST,PORT)
udpCliSock=socket(AF_INET,SOCK_DGRAM)
data=raw_input('>')
udpCliSock.sendto(data,ADDR)
print udpCliSock.getsockname()
data, addr = udpCliSock.recvfrom(BUFSIZ)
if data:
  print data
udpCliSock.close()

First,I run server.py at 10.1.1.27
$python server.py

Then I run client.py at 10.1.1.67
$python client.py
>hello

The running result of server.py:

('10.1.1.67', 1165)
$

The running result of client.py,it raise a error:
('0.0.0.0', 1165)
Traceback (most recent call last):
  File "client.py", line 11, in ?
    data, addr = udpCliSock.recvfrom(BUFSIZ)
socket.error: (104, 'Connection reset by peer')
I know that my server.py don't use normal way to return data to client.py ,but I need this way! How to correct my programs? Any ideas will be appreciated!
      Thanks.
               Edward               
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 

From gmcm at hypernet.com  Sat Dec 22 13:56:37 2001
From: gmcm at hypernet.com (Gordon McMillan)
Date: 22 Dec 2001 18:56:37 GMT
Subject: Book "python programming patterns". anybody read this??
References:   
Message-ID: 

Roy Smith wrote:

> Gordon McMillan  wrote:
>> I am a long-time Pythoneer and a very long-time programmer, and I had
>> to study many of the examples carefully before understanding how they 
>> worked. 
> 
> I havn't seen the book, but I have to wonder about the above.  Over the
> 25 or so years I've been programming, I've gradually shifted my
> priorities from elegance, cleverness, and efficiency, to simplicity and
> ease of understanding.  We do a lot of code review at work, and I'm
> always the guy at the meetings arguing for rewriting it so it's easier
> to understand. 
> 
> It seems to me that if somebody is experienced in both algorithms and
> in the particular language a program is written in still has to study
> the code carefully to figure out what it's doing, it's probably not
> very good code. 

The book is terse and dense with information. Personally, I like that. 
There's many a 800 page computer book with 20 pages of information. By the 
end of the book, the example code has implemented multi-threaded undo / redo 
- able transactions against a dbm type storage. The hardest thing to follow 
was his (highly efficient) implementation of an algorithm for computing 
whether one set is a subset of another. So it's not for people who don't 
like low-level stuff.

-- Gordon
http://www.mcmillan-inc.com/


From rdsteph at earthlink.net  Fri Dec 28 19:43:58 2001
From: rdsteph at earthlink.net (Ron Stephens)
Date: Sat, 29 Dec 2001 00:43:58 GMT
Subject: Python Popularity: Questions and Comments
References: <3C2A9D33.67FEC261@earthlink.net>  <3C2B9E04.9957801F@earthlink.net>  
Message-ID: <3C2D1251.C8A25110@earthlink.net>

Do the recetnly published books on Zope help at all to alleviate the problem
of inadequate documentation of Zope?



From loewis at informatik.hu-berlin.de  Tue Dec  4 09:34:26 2001
From: loewis at informatik.hu-berlin.de (Martin von Loewis)
Date: 04 Dec 2001 15:34:26 +0100
Subject: C extension/char array question
References: <9uh3ur$6ct$1@newshost.nmt.edu>
Message-ID: 

"Bob Greschke"  writes:

> What I want to be able to do is code the list of things to look for
> ("THIS" and "THAT") into the Python part, and call a C extension
> function that calls the C library function that does the job of
> RememberMe().  

The simplest solution is to do

PyObject *RememberMe = NULL;

PyObject *
MyMod_Remember(PyObject *self, PyObject *args)
{
  Py_XDECREF(RememberMe); // forget old value
  Py_INCREF(args);
  RememberMe = args;      // hold onto the argument tuple
  Py_INCREF(Py_None);
  return Py_None;
}

> I guess I'm not sure what to put "THIS" and "THAT" into
> (a list?), and what format specifier to use in  PyArg_ParseTuple(), to
> make sure that C is able to keep track of the addresses of the char
> array elements so it can use them in the strstr() function -- if this
> can be done in a straightforward manner at all.  

Not sure what you are asking here - if this is a question at all.

> Will I have to 'recreate' the array of strings in the extension,
> like with malloc()?

No. Just increment the refcount on the object you get, and you can
hold onto it as long as you want.

Regards,
Martin


From ws at mystrobl.de  Sun Dec 30 17:03:40 2001
From: ws at mystrobl.de (Wolfgang Strobl)
Date: Sun, 30 Dec 2001 23:03:40 +0100
Subject: REPOST: Re: Manipulating Win32 attributes; newbie question.
References: 
Message-ID: <0$--$$_----___-_$$@news.noc.cabal.int>

On Sun, 30 Dec 2001 15:10:31 -0500, Peter  wrote :

>My problem is that I need to manipulate some Win32 specific file 
>attributes. In particular, I need to temporarly turn off the read-only 
>attribute on a directory. In C I could use the Win32 API functions 
>GetFileAttributes() and SetFileAttributes() to do this. I'm not sure how 
>to get the job done with Python. I looked around in both the generic and 
>Pythonwin documentation but I didn't see anything that addressed this 
>issue.

http://groups.google.com/groups?selm=0kln0u0k2ivc3ehegq5m9lern9e9uut78r%404ax.com

http://www.google.com/search?q=pythonwin+getfileattributes

http://www.faqts.com/knowledge_base/view.phtml/aid/4706/fid/244

http://groups.google.com/groups?q=comp.lang.python+SetFileAttributes
-- 
Thank you for observing all safety precautions

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Wolfgang Strobl 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 04:14:47 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774049 27193 211.57.49.2 (31 Dec 2001 04:47:29 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:47:29 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From fperez528 at yahoo.com  Mon Dec 10 13:02:52 2001
From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=)
Date: Tue, 11 Dec 2001 17:30:52 +2328
Subject: Getting at an item in a list of tupples
References: <9v66mi$17mi$1@newshost.nmt.edu>
Message-ID: <9v68hg$b9v$1@peabody.colorado.edu>

Bob Greschke wrote:

> Here's what I've got
> 
>    a = []
>    a.append((ints, floats, strings))
>    a.append((ints, floats, strings))
>    a.append((ints, floats, strings))
>    a.append((ints, floats, strings))
>    ...
> 
> I want to do something like
> 
>    print max(of all of the floats)
>    print min(of all of the floats)
> 
> In general, how do you get at the floats (or ints, or strings)?  We
> can see doing something with map() calling a function that returns the
> second item, but isn't there something a little simpler?

Sorry, but I just fail to see what is 'not simple' about:

In [1]: a = []
In [2]: a.append((3,4.5,'hi'))
In [3]: a.append((0,8.5,'spam'))
In [4]: a.append((9,-5.3,'eggs'))
In [5]: a
Out[5]=
[(3, 4.5, 'hi'), (0, 8.5, 'spam'), (9, -5.2999999999999998, 'eggs')]

# now get your floats:
In [6]: max(map(lambda x:x[1],a))
Out[6]= 8.5

# or your ints:
In [7]: max(map(lambda x:x[0],a))
Out[7]= 9

Honestly, I don't see how to do 'simpler' than this, but I'd love to learn of 
a simpler way if someone has one.

Cheers,

f


From gat at jpl.nasa.gov  Sat Dec  1 02:40:18 2001
From: gat at jpl.nasa.gov (Erann Gat)
Date: Fri, 30 Nov 2001 23:40:18 -0800
Subject: A modest indentation proposal
References:  <3C0773C2.A12D0BAC@pacific.net.hk>    
Message-ID: 

In article ,
morpheus at here.not.there wrote:

> On Fri, 30 Nov 2001 14:06:55 -0800, Erann Gat  wrote:
> > No, it would not become "illegal" under my proposal.  Please go back and
> > re-read what I wrote, and pay particular attention to the word "optional".
> 
>     What was written:
> 
> ---- SNIP ----
> 
> 2) Parser support.  It would be enough to simply give a warning if
there                         
> is a discrepancy between the block structure defined by indentation
and                          
> that defined by the semicolon-at-end-of-line convention (i.e.
"Warning:                          
> end of block detected without trailing semicolon").  Making this
optional                        
> so that die-hard indentation fans could turn it off would also be fine.     
> 
> ---- SNIP ----
> 
>     What you said was that there would be a warning and that the /warning/
> would be optional.  You did not address the valid concern that...
> 
> if x:
>   foo();
>   bar();
>   baz();
> 
>     ...has to be parsed and under your rules foo(); is the end of the block.
> IE, if we take your proposal as it was presented, that a line that ends with a
> semicolon denotes the end of a block, the above is invalid.  If a line that
> ends with a semicolon does not denote the end of a block, your proposal is
> moot as it doesn't change a thing.

Ah, I think I understand the problem.  What I meant was that a semicolon
would designate the end of the block to the *editor*, which would use that
information together with colons to provide an auto-indent facility. 
Indentation would continue to define the canonical block structure to the
Python parser, but there would be an optional flag that would give a
warning if there was a discrepancy between what the auto-indenter would
produce and what was actually there.

Does that make it any more pallatable?

E.


From ggrp at quitte.de  Sat Dec  1 09:48:27 2001
From: ggrp at quitte.de (Tim Goetze)
Date: 1 Dec 2001 06:48:27 -0800
Subject: 'static' class properties in extension types
Message-ID: 

class C:
  const = 1

can somebody tell me if, and how I can create the equivalent of
'C.const' if C is not a Python class, but a type implemented in a C
extension module?

tia for suggestions,

tim


From loewis at informatik.hu-berlin.de  Sun Dec 23 18:59:04 2001
From: loewis at informatik.hu-berlin.de (Martin von Loewis)
Date: 24 Dec 2001 00:59:04 +0100
Subject: Extending Python classes
References: 
Message-ID: 

"Steven Feil"  writes:

> Question 1: In the document "Extending and Embedding the Python
> Interpreter", there is a chapter called "Defining new types". What is
> the difference between a "Type" and a class in python?

A class is an object whose type is . A type is an object
whose type is . Notice that it Python 2.2, "new-style"
classes are also types.

> Question 2: Is there a way to associate an instance of a class with a
> C-Language pointer?

An instance of a class is always associated with a C language pointer,
of type PyObject*.

> If these questions don't make since here is an explanation of what I
> have now and what I am trying to acomplish.....

Your questions are meaningful and have meaningful answers. Perhaps you
still wanted to ask different questions.

Regards,
Martin


From wurmy at earthlink.net  Sun Dec 30 00:36:20 2001
From: wurmy at earthlink.net (Hans Nowak)
Date: Sun, 30 Dec 2001 05:36:20 GMT
Subject: REPOST: Re: Help - command line arguments
References: 
Message-ID: <0$--$$_----__$_$-$@news.noc.cabal.int>

Steve Zatz wrote:
> 
> I am new to Python and although I am sure that the following is obvious I
> can't figure the following out or find an answer in any of the texts that I
> have access to.
> 
> My question is:  Can you run a script that takes command line arguments from
> within the Python shell or from the Python command line?
> 
> For example, something like:
> 
> test.py -a -b
> 
> runs fine from the *Windows XP* command prompt.
> 
> From the Python command line, I can do the following:
> 
> import test
> test.main()
> 
> which doesn't produce an exception but I can't figure out how to input the
> command line arguments.

You can mess around with sys.argv, but I'm not sure if that
is kosher...

>>> import sys
>>> sys.argv[0] = 'myself.py'
>>> sys.argv[1:] = '-x foo -y bla filename'.split()
>>> sys.argv
['myself.py', '-x', 'foo', '-y', 'bla', 'filename']
>>> 

If the program defines a "if __name__ == "__main__"
block, you're out of luck, though. import will not execute
the code in the block.

--Hans

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Hans Nowak 
Newsgroups: comp.lang.python
Subject: cmsg cancel <3C2EA674.F6C69FB2 at earthlink.net>
Control: cancel <3C2EA674.F6C69FB2 at earthlink.net>
Date: Mon, 31 Dec 2001 03:38:45 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774376 27193 211.57.49.2 (31 Dec 2001 04:52:56 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:52:56 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From max at alcyone.com  Sun Dec 16 14:07:43 2001
From: max at alcyone.com (Erik Max Francis)
Date: Sun, 16 Dec 2001 11:07:43 -0800
Subject: Idiomatic portable way to strip line endings?
References: 
	        <9viekc$fkp74$1@ID-11957.news.dfncis.de>
	         
Message-ID: <3C1CF0FF.91ACEE07@alcyone.com>

Skip Montanaro wrote:

> I suspect the high frequency of
> 
>     line = line[:-1]
> 
> simply means that most people haven't worried too much about their
> code
> running across multiple platforms.  I know for most of the code I've
> written
> I've never worried too much about it.

Not sure what the issue here is.  When a file is opened in text mode, as
I'd expect, looks like line endings on different platforms are
normalized to just one newline (presumably because Python is implemented
in C where this is true as well).

I just tested

	sys.stdin.readline()

and it indeed does _not_ have a trailing CR LF, just a trailing LF as
I'd expect.  So what's the issue here?

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Laws are silent in time of war.
\__/ Cicero
    Esperanto reference / http://www.alcyone.com/max/lang/esperanto/
 An Esperanto reference for English speakers.


From gat at jpl.nasa.gov  Tue Dec  4 14:40:44 2001
From: gat at jpl.nasa.gov (Erann Gat)
Date: Tue, 04 Dec 2001 11:40:44 -0800
Subject: A modest indentation proposal
References:   <3C0BBC1A.6E4154F@home.net>  <3C0BF0E8.2F9E2641@attbi.com>  <3C0D0CBF.33CF9EDF@attbi.com>
Message-ID: 

In article <3C0D0CBF.33CF9EDF at attbi.com>, Chris Barker
 wrote:

> Erann Gat wrote:
> > Ah.  Right.  My bad, I apologize.
> 
> Apology excepted:

I hope you meant "accepted."

> However, you did state that you didn't have the skills to do it
> yourself, so that implies that you want someone else to do it.

Not necessarily.  I may just have wanted some advice on whether or not
it's worth doing (which I got).  I would certainly like it if someone
helped me with this or even did it for me, but I don't expect it and I
didn't ask for it.

FWIW, if I were to ask for someone to do this work for me the request
would take the form of a job posting for a contract position.  I don't
believe in asking people to do something for nothing, and I think it's a
shame that so many people do it that people naturally assumed that I was
doing it too.

> good luck...

Thanks!

E.


From peter at engcorp.com  Mon Dec 17 19:28:23 2001
From: peter at engcorp.com (Peter Hansen)
Date: Mon, 17 Dec 2001 19:28:23 -0500
Subject: do not know what is wrong python under win2k
References: <3C1E752E.8864E2E9@htp-tel.de>
Message-ID: <3C1E8DA7.AB122321@engcorp.com>

Tom Karas wrote:
> 
>         import sys
>         print sys.argv
> 
> into a file called "spam.py" and after that i should do the following:
> 
>         >>> python spam.py -i eggs -o bacon

You are at the Python prompt as you type this... exit
with Ctrl-Z and type that at the Win2K command prompt...
(Note the >>> prompt!)

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com


From grante at visi.com  Sun Dec 16 13:20:55 2001
From: grante at visi.com (Grant Edwards)
Date: Sun, 16 Dec 2001 18:20:55 GMT
Subject: Wrap C function which takes variable lengthed parameters?
References:  <6p5j1u0oag2ofkam8o7fig5dvkfc2392hk@4ax.com> <3C19990E.BE0F3FA@alcyone.com> <3C19AC0B.7ABD04DF@xs4all.nl> <1gbj1u8pm1t63ao6bjq98jlh66glf78fnu@4ax.com>       
Message-ID: 

In article , {-- Rot13 - Hateme wrote:

>This is a C problem but this is also a Python problem.
>There are no need to wrap a C function for C program.

Yes, there is.  If a C programmer needs to call a function which takes a
va_list but needs to construct the list at runtime, then the programmer is
stuck because she needs to "wrap" the function. I've been in that spot, and
there's no easy way out.

-- 
Grant Edwards                   grante             Yow!  I'm using my X-RAY
                                  at               VISION to obtain a rare
                               visi.com            glimpse of the INNER
                                                   WORKINGS of this POTATO!!


From sholden at holdenweb.com  Fri Dec 21 07:24:58 2001
From: sholden at holdenweb.com (Steve Holden)
Date: Fri, 21 Dec 2001 07:24:58 -0500
Subject: Raw sockets
References: <2c55c8be.0112130949.761bc120@posting.google.com> <7934d084.0112131952.2ae7c239@posting.google.com> <2c55c8be.0112201246.627ab31c@posting.google.com>
Message-ID: 

"Ben Ainsworth"  wrote in message
news:2c55c8be.0112201246.627ab31c at posting.google.com...
> amuys at shortech.com.au (Andrae Muys) wrote in message
news:<7934d084.0112131952.2ae7c239 at posting.google.com>...
> > ed_play at yahoo.co.uk (Ben Ainsworth) wrote in message
news:<2c55c8be.0112130949.761bc120 at posting.google.com>...
> > > Is there a good intro to using raw sockets with python on the web? I
> > > want to try writing a variant of traceroute using tcp instead of icmp.
> > >
> >
> > Might I suggest you first check out Stevens 'TCP/IP Illustrated Vol 1'
> > as it will explain in excelent detail how traceroute is built using
> > UDP not ICMP :).
> >
> > Andrae Muys
>
> Thanks, but on Windows traceroute is all ICMP (except DNS requests).
>
Chance for me to take another snipe at Microsoft's "not invented here"
approach. Who knows why they chose to use ICMP when everybody else used UDP.

Traceroute works because the TTL field, which specifies the maximum time a
packet may live, and is always reduced by at least one when a datagram
transits from one network to another, is an IP (v4) header.

People do some strange things, though. Many networks started rejected ICMP
traffic when the "ping of death" attack came out, completely ignoring the
fact that this is a general IP attack which does not depend on the layered
protocol.

regards
  Steve
--
http://www.holdenweb.com/







From rdsteph at earthlink.net  Sat Dec 29 23:33:49 2001
From: rdsteph at earthlink.net (Ron Stephens)
Date: Sun, 30 Dec 2001 04:33:49 GMT
Subject: REPOST: Re: Python Popularity, python at sourceforge
References: 
Message-ID: <7$--$$_----__$%--$@news.noc.cabal.int>

Mr. Rengelink, I have taken the liberty of posting a copy of the statistics
you have so assiduously compiled below, on my web site at
http://www.awaretek.com/plf.html for future reference. If you would rather
they not be so presented, let me know and I'll immeditely take the page
down.

rs

Roeland Rengelink wrote:

> Hi,
>
> As was remarked earlier in this thread, a measure of Python's
> popularity, if not quality, can be obtained by looking at the number
> of sourceforge projects using Python. Below you'll find a number of
> tables comparing sourceforge projects using Python to those using
> Perl, PHP, Java, C and C++. These numbers were obtained by
> screen-scraping the sourceforge trove pages.
>
> I started this analysis expecting to find clear evidence for Python's
> - exploding popularity
> - cross-platform usability
> - ease of development
>
> Alas, the numbers are far more ambigious than I'd hoped. To summarize:
>
> 1. Python is the smallest of the 6 languages discussed here.
> 2. Python is currently growing slower than PHP and Java, but faster
>    than C and Perl.
>    - Python has only been gaining on Perl for the last 6 months
>    - the difference in growth w.r.t PHP and Java may be getting smaller
> 3. Java is more cross-platform than Python. Perl, C, C++ are less.
> 4. There is no clear evidence for Python's ease of development.
>
> The most interesting result (I think) is Python's changing role from a
> glue/scripting language to a stand-alone development language.
> Cross-language development statistics are investigated at the end of
> this post.
>
> 1. All projects
>
> The following two tables list the cumulative number and quarterly
> growth rates of sourceforge projects using Python, Perl, PHP, Java or
> C++ as one of their programming languages. Note that projects using
> more than one of these languages contribute to the numbers of each of
> those languages.
>
> The following conclusions can be drawn
> - Python is only half as big as any of the other languages.
> - The growth rate of Perl, as compared to Python, has been steadily
>   declining since ther third quarter of 2000. It has become smaller
>   than Python's growth rate in the third quarter of 2001.
> - The growth rates of PHP and Java have been much larger than
>   Python's. However, up to the third quarter of 2001 their growth rates
>   declined relative to Python.
> - Since the third quarter of 2000, C has been the slowest growing
>   language.
> - The growth rate of Python is most similar to that of C++
>
> To summarize:
>
> Early 2000 Python was the slowest growing language. Currently only PHP
> and Java are growing faster, and the gap is closing
>
> Table 1a. Cumulative number of projects
>                                                 Python=1
>          Python Perl  PHP Java    C  C++   Perl  PHP Java    C  C++
> 00-03-01     98  172   84  139  529  361    1.8  0.9  1.4  5.4  3.7
> 00-06-01    221  417  251  371 1220  882    1.9  1.1  1.7  5.5  4.0
> 00-09-01    374  785  555  756 2030 1518    2.1  1.5  2.0  5.4  4.1
> 00-12-01    528 1178  883 1257 2827 2220    2.2  1.7  2.4  5.4  4.2
> 01-03-01    701 1575 1328 1841 3706 2949    2.2  1.9  2.6  5.3  4.2
> 01-06-01    898 2020 1867 2539 4652 3806    2.2  2.1  2.8  5.2  4.2
> 01-09-01   1097 2406 2326 3164 5513 4589    2.2  2.1  2.9  5.0  4.2
> 01-12-01   1266 2690 2745 3774 6189 5285    2.1  2.2  3.0  4.9  4.2
>
> Table 1b. Quarterly growth rates
>              Percentage growth             Python=1
>           Pyth Prl PHP Jav   C C++   Perl  PHP Java    C  C++
> 00-06-01   125 142 198 166 130 144    1.1  1.6  1.3  1.0  1.1
> 00-09-01    69  88 121 103  66  72    1.3  1.7  1.5  1.0  1.0
> 00-12-01    41  50  59  66  39  46    1.2  1.4  1.6  1.0  1.1
> 01-03-01    32  33  50  46  31  32    1.0  1.5  1.4  0.9  1.0
> 01-06-01    28  28  40  37  25  29    1.0  1.4  1.3  0.9  1.0
> 01-09-01    22  19  24  24  18  20    0.9  1.1  1.1  0.8  0.9
> 01-12-01    15  11  18  19  12  15    0.8  1.2  1.3  0.8  1.0
>
> 2. Cross platform projects
>
> Python advertises itself as a cross-platform development language.
> Here, I assume that cross-platform means either OS-independent, or for
> 2 or more of the the different OS families [Unix, Win, Mac]
>
> The conclusion here is pretty much expected:
> - Python is more 'cross-platform' than Perl, C and C++, but less so
>   than Java, and comparable to PHP
>
> Table 2a Cumulative number of cross-platform projects
>                                                 Python=1
>          Python Perl  PHP Java    C  C++   Perl  PHP Java    C  C++
> 00-06-01    157  273  172  311  590  484    1.7  1.1  2.0  3.8  3.1
> 00-12-01    365  722  598 1047 1317 1159    2.0  1.6  2.9  3.6  3.2
> 01-06-01    626 1243 1298 2135 2122 1939    2.0  2.1  3.4  3.4  3.1
> 01-12-01    900 1658 1959 3198 2836 2701    1.8  2.2  3.6  3.2  3.0
>
> Table 2b Cross-platform projects as fraction of all new projects
>                                            Python=1
>           Pyth Prl PHP Jav   C C++   Perl  PHP Java    C  C++
> 00-06-01    71  65  68  83  48  54    0.9  1.0  1.2  0.7  0.8
> 00-12-01    67  59  67  83  45  50    0.9  1.0  1.2  0.7  0.7
> 01-06-01    70  61  71  84  44  49    0.9  1.0  1.2  0.6  0.7
> 01-12-01    74  61  75  86  46  51    0.8  1.0  1.2  0.6  0.7
>
> 3. Active projects
>
> Python also advertises itself for its ease of development. One could
> expect that easy projects are more active than difficult projects.
>
> The following tables list statistics for projects that have an
> activiy_ranking of more than 80 %. Since I don't know how this
> activity is measured I can't really interpret these numbers.
>
> Activity ranking is a relative measure of a projects activity, which
> is computed over all sourceforge projects. An activity ranking of 80%
> means 80% as active as the most active sourceforge project. Activity
> seemt to comprise both developer activity (checkins, bug fixes) and
> user activity (downloads, bug reports).
>
> The most notable result from these tables is probably that the numbers
> are so similiar. Hence, my tentative conclusion:
>
> - Project activity is largely independent from the choice of
>   programming language and therefore also independent of the
>   'accessability' of the language
>
> Table 3a Cumulative number of active projects
>                                                 Python=1
>          Python Perl  PHP Java    C  C++   Perl  PHP Java    C  C++
> 00-06-01     24   36   21   33  156   94    1.5  0.9  1.4  6.5  3.9
> 00-12-01     43   59   49   74  268  174    1.4  1.1  1.7  6.2  4.0
> 01-06-01     59   95   81  127  368  263    1.6  1.4  2.2  6.2  4.5
> 01-12-01     74  120  128  182  441  347    1.6  1.7  2.5  6.0  4.7
>
> Table 3b Percentage active as fraction of all projects
>                                            Python=1
>           Pyth Prl PHP Jav   C C++   Perl  PHP Java    C  C++
> 00-06-01    10   8   8   8  12  10    0.8  0.8  0.8  1.2  1.0
> 00-12-01     6   3   4   4   6   5    0.5  0.7  0.7  1.1  1.0
> 01-06-01     4   4   3   4   5   5    1.0  0.8  1.0  1.3  1.3
> 01-12-01     4   3   5   4   4   5    0.9  1.3  1.1  1.2  1.4
>
> 4 Mature projects
>
> Ease of development may also be reflected in what percentage of
> projects reaches a mature development status. The following tables
> give numbers for projects that reached a mature or production/stable
> development status.
>
> The data suggest that Perl and C project reach a mature development
> status more often than Python, PHP, Java and C++ projects.
>
> Note that development status is assessed by the project developers
> themselves
>
> Table 4a Cumulative number of mature projects
>                                                 Python=1
>          Python Perl  PHP Java    C  C++   Perl  PHP Java    C  C++
> 00-06-01     43  118   41   59  294  168    2.7  1.0  1.4  6.8  3.9
> 00-12-01     87  233  109  161  599  342    2.7  1.3  1.9  6.9  3.9
> 01-06-01    122  367  194  286  887  503    3.0  1.6  2.3  7.3  4.1
> 01-12-01    160  455  280  399 1110  644    2.8  1.8  2.5  6.9  4.0
>
> Table 4b Percentage mature as fraction of all projects started.
>                                            Python=1
>           Pyth Prl PHP Jav   C C++   Perl  PHP Java    C  C++
> 00-06-01    19  28  16  15  24  19    1.5  0.8  0.8  1.2  1.0
> 00-12-01    14  15  10  11  18  13    1.1  0.8  0.8  1.3  0.9
> 01-06-01     9  15   8   9  15  10    1.7  0.9  1.0  1.7  1.1
> 01-12-01    10  13   9   9  14   9    1.3  0.9  0.9  1.4  0.9
>
> 5. Cross language development
>
> The most interesting results are obtained when we compare projects
> that use a single language with those that use multiple languages. The
> follwing tables compare the fraction of projects that use more than
> one language, to those that only use a single language.
>
> There are many trends here.
>
> - Python, Perl, PHP and Java projects are increasingly becoming
>   single-language projects.
> - The percentage of cross-language projects in cross-platform projects
>   is lower for Python, Perl, PHP and Java, while its substantially
>   higher for C and C++ projects.
> - Of the currently active Python projects nearly all old projects
>   included other languages, while only a third of the new projects
>   does so.
> - Perl is the only language for which the fraction of multi-language
>   projects is larger for active projects.
> - For the mature Python projects there is also a large difference in
>   the fraction of cross-language projects between old and new
>   projects.
> - For all languages the percentage of mature projects that use more
>   than one language is smaller.
>
> One conclusion
>
> - Python is increasingly used a stand-alone development language,
>   especially in active and mature projects.
>
> Table 5a  Percentage of all new projects
>           Pyth Prl PHP Jav   C C++   Perl  PHP Java    C  C++
> 00-06-01    55  51  41  35  47  46    0.9  0.8  0.6  0.9  0.8
> 00-12-01    52  42  37  33  47  46    0.8  0.7  0.6  0.9  0.9
> 01-06-01    51  48  39  30  46  46    0.9  0.8  0.6  0.9  0.9
> 01-12-01    45  42  31  26  47  43    0.9  0.7  0.6  1.0  1.0
>
> Table 5b  Percentage of new cross platform projects
>           Pyth Prl PHP Jav   C C++   Perl  PHP Java    C  C++
> 00-06-01    52  47  44  32  56  51    0.9  0.8  0.6  1.1  1.0
> 00-12-01    50  40  33  30  54  50    0.8  0.7  0.6  1.1  1.0
> 01-06-01    51  43  36  27  54  52    0.8  0.7  0.5  1.1  1.0
> 01-12-01    44  39  28  24  56  48    0.9  0.7  0.6  1.3  1.1
>
> Table 5c  Percentage of active projects
>           Pyth Prl PHP Jav   C C++   Perl  PHP Java    C  C++
> 00-06-01    87  58  19  12  51  44    0.7  0.2  0.1  0.6  0.5
> 00-12-01    68  60  17  46  44  51    0.9  0.3  0.7  0.7  0.7
> 01-06-01    50  55  40  32  47  37    1.1  0.8  0.6  0.9  0.7
> 01-12-01    33  64  25  19  52  47    1.9  0.8  0.6  1.6  1.4
>
> Table 5c  Percentage of mature projects
>           Pyth Prl PHP Jav   C C++   Perl  PHP Java    C  C++
> 00-06-01    58  36  34  27  37  37    0.6  0.6  0.5  0.6  0.6
> 00-12-01    47  26  20  32  37  44    0.5  0.4  0.7  0.8  0.9
> 01-06-01    45  37  32  24  34  36    0.8  0.7  0.5  0.8  0.8
> 01-12-01    34  31  25  22  36  40    0.9  0.7  0.6  1.1  1.2
>
> Undoubtedly there's more to be gained from these numbers. But this is
> starting to look like work, so...
>
> Roeland
>
> --
> r.b.rigilink at chello.nl
>
> "Half of what I say is nonsense. Unfortunately I don't know which half"

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.gamma.ru!Gamma.RU!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Ron Stephens 
Newsgroups: comp.lang.python
Subject: cmsg cancel <3C2E9A26.81C731DB at earthlink.net>
Control: cancel <3C2E9A26.81C731DB at earthlink.net>
Date: Mon, 31 Dec 2001 02:45:36 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774402 27193 211.57.49.2 (31 Dec 2001 04:53:22 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:53:22 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From kragen at pobox.com  Wed Dec 12 14:44:25 2001
From: kragen at pobox.com (Kragen Sitaker)
Date: 12 Dec 2001 14:44:25 -0500
Subject: mod_python vs mod_snake
References:  
Message-ID: <83elm0b4va.fsf@panacea.canonical.org>

allanwind at mediaone.net (Allan M. Wind) writes:
> I like mod_snake more (in part because it claims support for Apache
> 2.x), but you might find that there are more people using mod_python
> (e.g. more community knowledge / support).  PyApache would also satisfy
> your need from how you describe your need and seem to most mature.

It sounds like you've tried all three.  Is that correct, and what was
your experience like?



From duncan at NOSPAMrcp.co.uk  Mon Dec  3 05:08:09 2001
From: duncan at NOSPAMrcp.co.uk (Duncan Booth)
Date: Mon, 3 Dec 2001 10:08:09 +0000 (UTC)
Subject: Regular expression as dictionary key?
References: <3C0B2DE9.5040308@home.com> <9ufdkn$21dk$1@agate.berkeley.edu> <3C0B408C.8030908@home.com>
Message-ID: 

Luke  wrote in news:3C0B408C.8030908 at home.com:

>  I admitedly don't know much about 
> the C implementation of dicts, but it seems there should be a way to 
> leverage the dict's arrangement for fast regex keys.
> 
I think your problem here is assuming that the dict's internal arrangement 
is in some way sorted. It uses a hash table, not a binary tree, so there is 
no obvious way that you can improve on a linear search for this kind of 
lookup.

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?


From ssthapa at classes.cs.uchicago.edu  Thu Dec 20 12:14:55 2001
From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa)
Date: Thu, 20 Dec 2001 17:14:55 GMT
Subject: ciphon 0.3.4
References:  <9vsq4f$hk6cn$1@ID-59885.news.dfncis.de>
Message-ID: 

Thomas Heller  wrote:
>How do I upload a package? Can ciphon do this?

    Currently, ciphon doesn't allow this. 

>It seems you only support gzip'd tar files or rpms. Are other formats
>planned? What about binary distributions?

    Currently, I don't think ciphon will work in windows although the
potential is there.  Similarly binary packages aren't currently supported,
I'm planning on adding binary and mac/windows support after the unix 
side is fairly stable and works properly.

>From reading the source I got the impression that ciphon mostly spawns external
>utilities. Can/should it be extended to use Python modules (gzip, zipfile,...)?

    Yes, ciphon should probably try to use the standard library as much as
possible.  I will investigate this but my main focus right now is to get
ciphon running well on unix systems and writing up a decent set of 
documents.

-- 
----------------------------------------------------------------------------
	   		              |
Suchandra Thapa                       | "There are only two kinds of math . 
s-thapa-11 at NOSPAMalumni.uchicago.edu  | books. Those you cannot read beyond 
			              | the first sentence, and those you 
			              | can not read beyond the first page."
			              |                     -C.N. Yang
----------------------------------------------------------------------------


From jkraska at san.rr.com  Sun Dec  2 23:37:44 2001
From: jkraska at san.rr.com (Courageous)
Date: Mon, 03 Dec 2001 04:37:44 GMT
Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)
References:          
Message-ID: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com>

On Sun, 2 Dec 2001 19:57:44 -0800, "Peoter Veliki"
 wrote:

>Perhaps this is besides the point of the original posting, but......
>
>With tabs, each person can set the indenting width to whatever value he/she
>likes best.  As one person pointed out, a tab is a variable.  This
>flexibility is tantamount to a "separation of style and content".  This is
>an argument *for* using tabs.

Until tabs and spaces are mixed, and then we have a living nightmare.

I see this in other programming languages all the time, where someone
comes along with a different tab notion than mine, edits the file, and
then commits it. This creates horribly formatted files where the
indentation levels of lines of code throughout the file.

But this is all academic, because the defacto and near dejure standard
for Python is 4 spaces per indentation level. Tabs are deprecated.

Insert tabs if you like. I predict you will annoy lots of other Python
programmers, when you begin to work with them.

C//



From zhangsc at neusoft.com  Thu Dec 27 04:10:57 2001
From: zhangsc at neusoft.com (=?gb2312?B?1cXJ2bPb?=)
Date: Thu, 27 Dec 2001 17:10:57 +0800
Subject: install Python2.2 question
Message-ID: <001801c18eb6$67325b30$4301010a@sky>

My computer operation system is Red Hat Linux7.0,
I install python2.2,it raise a error,How to correct?
it follows:

[root at storm /root]# rpm -i python2-2.2-2.i386.rpm
error: failed dependencies:
        libcrypto.so.2   is needed by python2-2.2-2
        libdb-3.2.so   is needed by python2-2.2-2
        libexpat.so.0   is needed by python2-2.2-2
        libreadline.so.4   is needed by python2-2.2-2
        libssl.so.2   is needed by python2-2.2-2

Thanks!
Edward
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 

From fredrik at pythonware.com  Tue Dec  4 02:29:18 2001
From: fredrik at pythonware.com (Fredrik Lundh)
Date: Tue, 04 Dec 2001 07:29:18 GMT
Subject: 2.1.1 and regexp
References:   
Message-ID: 

Dave Pawson wrote:
> Now I'm even more confused :-)
>
> Trying to use the xpath part of 4suite,
> which uses re.compile.
> A new installation, 2.1.1 with xml 0.66
> and 4suite 0.11.1, gives me an error
>
> compile is not an attribute of re.
> This works with 2.1, same versions of xml and 4suite.

do you get this deep inside the 4suite code, or is this
in your own code?

does it say:

    AttributeError: 're' module has no attribute 'compile'

or

    AttributeError: some object has no attribute 'compile'

if the latter, "re" is probably not what you think:

    import re

    # compile some regexps
    re = re.compile("...")
    re2 = re.compile("...") # oops

if the former, maybe you have your own "re" (or "sre") script
or module somewhere in the path?

adding a "print re" or even "print re.__file__" to the line before
the one that gives you the error might provide additional clues.

running the interpreter with the -v option might also help.

hope this helps!








From philh at comuno.freeserve.co.uk  Mon Dec  3 22:48:57 2001
From: philh at comuno.freeserve.co.uk (phil hunt)
Date: Tue, 4 Dec 2001 03:48:57 +0000
Subject: Draft PEP: string interpolation with backquotes
References:   <9uern5$hbk$2@peabody.colorado.edu>  <9uh67a$eoe$1@peabody.colorado.edu>
Message-ID: 

On Mon, 03 Dec 2001 17:41:54 +2328, Fernando P?rez  wrote:
>phil hunt wrote:
>
>>>>>        "x is $x, f(x) is $f(x)"
>>>>>
>>>>>This to me is readable, unambiguous and very useful.
>>>> 
>>>> To me it implies the same as:
>>>> 
>>>>    "x is %(x)s, f(x) is %(f)s(x)" % { 'x': x, 'f': f}
>>>> 
>>>No.
>> 
>> Wrong. Read what I said closely. I am right on this, beleive me.
>
>Well, no.

Er, yes.

The first four words were "*To* *me* it implies". I was telling you
what I was thinking.

So unless you can read my mind, and know better than I what I think,
I am right on this.

>> If you want Perl-like features, you can always use Perl.
>
>What's wrong in this group every time someone suggests something that 
>even remotely resembles perl there's a fanatic response to it? Cool 
>down. I've used perl a lot, and am sick of it. I don't want python to 
>become perl, but I simply keep an open mind to situations where in 
>real, everyday work, I find it lacking.

But it isn't lacking, this functionality already exists *in a 
preprocessor*.

>And I think the beauty of an open language is precisely that these 
>discussions can be had. But obviously if everytime someone suggests 
>something different (even if they are wrong) your response is to tell 
>them 'if you don't like it get out of here', progress isn't exactly 
>going to be very fast...

What happens if you take a good design like Python and add an assortment
of everyone's favourite language featurees? You get an overcomplicated
language that is hard to learn and hard to maintain programs written 
in it.

>
>> Easy:
>> 
>>    "some %s expression" % really_complex_expression()
>> 
>> What's wrong with that?
>
>Nothing, for *one* expression. What if there's 50 evaluations that 
>need to be done? As I said, *scalability* of the tool is the issue 
>here.
>
>> 
>> Anyway, having complex espressions interleaved with static text,
>> whether you do it the Perl way or the C++ way, makes the code less
>> readable, IMO.
>
>Or in certain cases, more readable. I'm not thinking of writing web 
>pages here (which I know zilch about). But I often write code which 
>analyzes  a lot of scientific data and generates text file summaries 
>of it. It's vastly clearer to be able to write:
>
>" Pos: ($i,$j,$k), Dist = $sqrt(i**2+j**2+k**2), Corr = $C[i][j][k]"

You can do this with Python *as it stands*. E.g:

   f = " Pos: ($i,$j,$k), Dist = $sqrt(i**2+j**2+k**2), Corr = $C[i][j][k]"
   print someFunction(f)

The implementation of someFunction() is left as an exercise to the
reader.



>
>than *any* of the existing alternatives in python. Here it is:
>
>In [23]: itpl(" Pos: ($i,$j,$k), Dist = $sqrt(i**2+j**2+k**2), \
>   ....: Corr = $C[i][j][k]")
>Out[23]= ' Pos: (1,2,3), Dist = 3.74165738677, Corr = 5'
>
>I read that line and I can know exactly what it's doing, what it 
>evaluates and what data it will show. And I can dig out examples 
>where things are 100 times more complicated than this.

I have *no problem* with this at all. It doesn't involve extending
the syntax of python, and incidently demonstrates that Python
already does what you want.

At the moment, when you see a quoted string in Python source code
you know it is a string literal, whose value is fixed at compile
time. Under this proposal, a quoted string will be an expression,
which will be run at run time.

>I honestly think python would be better off with the feature.

Then fork the language or write a preprocessor.

-- 
*** Philip Hunt *** philh at comuno.freeserve.co.uk ***



From djmitchell at optushome.com.au  Sun Dec 30 07:08:15 2001
From: djmitchell at optushome.com.au (djmitchell)
Date: Sun, 30 Dec 2001 23:08:15 +1100
Subject: Zope Documentation (was RE: Python Popularity: Questions and Comments)
References:  
Message-ID: <3c2f03f4$0$2592$afc38c87@news.optusnet.com.au>

Bill Tate wrote:

> I understand the "zen" thing, but it's not something that business
> people are going to care about when they making a decision about
> whether to use it or not.

Yep, exactly.  

My last boss was a "who cares what it is?  If it's open source and you 
techos recommend it, we'll give it a try" kind of guy.  If we could present 
a justification in terms of risk/benefit that looked good, he gave us his 
blessing.  I switched him from thinking development=C++/Java to Perl and 
Python, we replaced Solaris and AIX boxes with Linux, and we saved our 
employers enormous quantities of money.  When I tried to talk him into 
looking at Zope, I found there was no frame of reference I could use - no 
comparisons with J2EE or n-tier COM, which are probably about the closest 
alternatives in terms of development approach  If he was to let me take on 
some work using Zope, his problems were:
- trying to convince his superiors that this unheard-of Zope thing was 
better in some vaguely-defined way than J2EE and large COM solutions
- how to estimate the design/dev times using Zope.  At least with J2EE and 
COM there's some body of evidence out there as to how long projects take 
from conception to production.  We'd proven that Python compared to C++ 
gave something around 10:1 reduction in dev times, but Zope isn't Python
- how was Zope going to perform on hardware from vendor X.  We already had 
reasonable expectations as to how J2EE performed on specific hardware, and 
could budget our hardware purchases with some degree of confidence.  The 
Zope web site suggests "it runs fast", but there's no data at all that I 
could find to back it up

I knew I was on a loser even as I was saying something like "it's a better 
Java than Java" as I was describing Zope's platform independence.  When I 
had to resort to crap platitudes like this, even though I believe it, I 
knew nobody holding development purse strings was going to let me finish 
the spiel.

Zope seems to have an "it's better than the rest; just take our word for 
it" mentality attached to it, and solid comparisons with other tools or 
performance data just doesn't appear to be out there.  Sun took this tack 
with Java in the early days, and MS did with COM/MTS a few years ago, and 
large corporates had a belief that Sun and MS wouldn't let their customers 
down (else they'd lose market share and shareholders would get upset).  
With Zope not having a major corporation behind it, and the NASDAQ collapse 
in 2000, there's that much less blind faith available for Zope.  Even a 
small pilot or proof-of-concept implementation costs serious dollars, and 
that type of money just isn't around any more.

I'd LOVE to use Zope for something grander than my personal site holding my 
resume and pictures of my kids, but if I couldn't convince one of the most 
receptive managers I've ever had, it seems like an impossible task.  It's 
sort of like the conceptual leap that was required to embrace OO 
development several years ago; there was a large body of evidence as to how 
non-OO development worked in "best practice" scenarios, lots of project 
managers skilled in non-OO development and a general feeling of comfort 
that the old ways worked.  Why change to OO, and take on all the unknown 
development risks?

Based on the available documentation, Zope seems to need this sort of 
"death or glory" approach, and hardly anyone seems willing to take these 
risks at present.  Although I'd love to see the next Yahoo! or Amazon 
startup use Zope, there's just no way the men holding the chequebooks would 
allow it.

If anyone's got any suggestions as to how Zope can be made into less of a 
perceived business risk, I'd love to help make it happen, but it seems 
beyond me at present.


From jason at tishler.net  Tue Dec 18 21:18:06 2001
From: jason at tishler.net (Jason Tishler)
Date: Tue, 18 Dec 2001 21:18:06 -0500
Subject: Cygwin socket library status enquiry
In-Reply-To: 
References:  <20011218131502.GA2268@dothill.com>   <2JJT7.22497$PA.5674@atlpnn01.usenetserver.com>     
Message-ID: <20011219021806.GA1420@dothill.com>

On Tue, Dec 18, 2001 at 08:52:20PM +0000, Michael Hudson wrote:
> "Steve Holden"  writes:
> > I'll see what I need to omit to get it to build, and follow up if I
> > make progress.
> 
> You need to build _socket statically.

Please try the following instead:

    http://cygwin.com/ml/cygwin/2001-12/msg00894.html

and report back to the list.

Thanks,
Jason



From nospam at bigfoot.com  Tue Dec 18 18:08:01 2001
From: nospam at bigfoot.com (Gillou)
Date: Wed, 19 Dec 2001 00:08:01 +0100
Subject: SOAP public server anywhere ?
References: <9voag4$21n3$1@norfair.nerim.net> <5288516A42A65B1C.38D34784F392C1C9.37DCD55633A612A7@lp.airnews.net>
Message-ID: <9vohs5$2a0n$1@norfair.nerim.net>

Many thanks Cameron

--Gillou

"Cameron Laird"  a ?crit dans le message news:
5288516A42A65B1C.38D34784F392C1C9.37DCD55633A612A7 at lp.airnews.net...
> In article <9voag4$21n3$1 at norfair.nerim.net>,
> Gillou  wrote:
> >Hi,
> >
> >Is there some SOAP public server available somewhere for test purposes.
> >I mean something like Meerkat that provides IT news to XML-RPC clients.
> .
> .
> .
> Scores of them.  See .
>
> For other getting-started-with-SOAP help, try  http://www.onlamp.com/pub/a/python/2001/06/14/pysoap.html >.
> --
>
> Cameron Laird 
> Business:  http://www.Phaseit.net
> Personal:  http://starbase.neosoft.com/~claird/home.html




From mhammond at skippinet.com.au  Thu Dec 27 18:16:15 2001
From: mhammond at skippinet.com.au (Mark Hammond)
Date: Thu, 27 Dec 2001 23:16:15 GMT
Subject: Fate of win32all?
References: <7876a8ea.0112212116.2ebabc23@posting.google.com> 
Message-ID: <3C2BABD5.1070907@skippinet.com.au>

Thanks to everyone who replied to this thread - I really appreciate the 
supportive words.  I am very sure I will land on my feet, so there is no 
need to worry (now if someone would just tell that to my girlfriend :)

I will be here for the forseeable future, so please don't write eulogies 
for any Python related work I am involved in ;)

FWIW, it is this very community spirit that makes Python such a pleasure 
to be involved in - so that yourselves as much as me - if not for this 
spirit I would not have been here in the first place!

Thanks all!

Now-back-to-a-win32all-release ly,

Mark.



From db3l at fitlinxx.com  Wed Dec 12 00:25:36 2001
From: db3l at fitlinxx.com (David Bolen)
Date: 12 Dec 2001 00:25:36 -0500
Subject: XXX
References: 
Message-ID: 

Brian Lee  writes:

> I'm newbie at Python programming. Sometimes I read ``XXX''
> character as comments in Python source code file. Does that
> mean something special? 

It's sort of a programmer convention to highlight something that needs
further attention or follow-up.  It's used all over, but although I'm
not sure if it originated in the Unix world, but that's where I
originally encountered it the most (kernel sources, etc...).

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/


From akuchlin at mems-exchange.org  Thu Dec 20 13:21:42 2001
From: akuchlin at mems-exchange.org (Andrew Kuchling)
Date: 20 Dec 2001 13:21:42 -0500
Subject: DOM - some pointers
References:  <9voi51$fco$1@slb7.atl.mindspring.net>  <23891c90.0112200838.209adc50@posting.google.com>
Message-ID: <3dg0657nwp.fsf@ute.mems-exchange.org>

paul at boddie.net (Paul Boddie) writes:
> Still, I wouldn't mind writing a few documents about getting started
> with DOM. I feel myself that I'm still only getting started even now,
> although my experiences wouldn't have helped Mr Dalke - I tend only to
> read XML documents, not write them.

You could write a DOM section for the XML HOWTO; it lives in the PyXML
CVS tree at pyxml.sourceforge.net.

--amk



From tim at vegeta.ath.cx  Sun Dec  2 03:59:27 2001
From: tim at vegeta.ath.cx (Tim Hammerquist)
Date: Sun, 02 Dec 2001 08:59:27 GMT
Subject: Whatever happened to String Interpolation?
References: <9u6dbn$nsj$1@peabody.colorado.edu> <9uc26v$akh$1@peabody.colorado.edu>  <9uckd9$o43$1@peabody.colorado.edu>  <9ucn17$pea$1@peabody.colorado.edu>
Message-ID: 

Fernando P?rez  graced us by uttering:
> Tim Hammerquist wrote:
>> 
>>> In fact, things like 'blah %(var)s' to me look a lot less readable
>>> (and line noise like, perl-like, whatever) than 'blah $var'. Or is
>>> it that in Python there's such a rabid fear of $ as to not even
>>> admit a case where something like it may be useful?
>> 
>> It's possible.
> 
> Good! Maybe we are getting somewhere after all... :-)

Maybe. Maybe not. I'm no rabid anti-Perler.  Ask Skip and you may get a
different answer. ;)

[ snip ]
> I hate extra function calls which just clutter things out. I'm a big 
> fan of 'first level' code readability: code which in a first reading, 
> with minimal mental gymnastics, shows its intended purpose.

Ah, but with training, one can do this with Python, Lisp, and even
Perl!  I'm proof!

> Oh well. We'll see if this gets anywhere.

That _would_ be something. =)

Tim Hammerquist
-- 
Perl will never turn into APL, despite our best efforts.
    -- Larry Wall in <199911021845.KAA01167 at kiev.wall.org>


From Bill.Scherer at VerizonWireless.com  Fri Dec 14 14:25:08 2001
From: Bill.Scherer at VerizonWireless.com (Scherer, Bill)
Date: Fri, 14 Dec 2001 14:25:08 -0500 (EST)
Subject: Unsung Python modules
In-Reply-To: <3dsnad226b.fsf@ute.mems-exchange.org>
Message-ID: 

On 14 Dec 2001, Andrew Kuchling wrote:

> What's your favorite unsung module?

I think anygui will become one.  While not the interface (yet) 
for gui's of exacting detail, for the more mundane gui it's quite 
sufficient.  My first gui with it ran without change under Python 
on Linux and windows, and under Jython too.  That's so cool.


-- 
Bill.Scherer at Verizon Wireless
RHCE 807101044903581




From tim at vegeta.ath.cx  Thu Dec 27 04:17:20 2001
From: tim at vegeta.ath.cx (Tim Hammerquist)
Date: Thu, 27 Dec 2001 09:17:20 GMT
Subject: age of new pythonistas [was: The Editor Poll results are in!]
References:   <60c49aa9.0112202148.7218555b@posting.google.com>  <3C2AE63A.24D736F2@nyc.rr.com>
Message-ID: 

Kenny Tilton  graced us by uttering:
> Tim Hammerquist wrote:
> > Wait, didn't you give up on Perl before you knew it well enough
> > to make that kind of statement?
> 
> Intelligence is all about dealing with partial information.

s/Intelligence/Life/

Cheers!
Tim Hammerquist
-- 
But the price of getting what you want is getting what you once wanted.
    -- Morpheus, The Sandman


From hfoffani at yahoo.com  Sun Dec  2 08:27:24 2001
From: hfoffani at yahoo.com (Hernan M. Foffani)
Date: Sun, 2 Dec 2001 14:27:24 +0100
Subject: A modest indentation proposal
References:  <3C0773C2.A12D0BAC@pacific.net.hk>   
Message-ID: <20011202082806.400$sc@news.newsreader.com>

"Erann Gat" escribi?:
> Olaf Delgado wrote:
>
> > Here's another suggestion: legalize a semicolon on a line by
> > itself. Thus the code above would look something like this:
> >
> > biff()        # Line 0
> > for x in l:   # Line 1
> >   foo()       # Line 2
> >   baz()       # Line 3
> >   ;
> > bar()         # Line 4
>
> This would be fine with me.  (Double-semicolon on a line is
> another possibility.)

You can write a "precompile" script that substitutes a lonely
semicolon with a "pass" statement. No need to change the
current python for this.

Or am I missing something here?

-Hern?n.





From wurmy at earthlink.net  Sat Dec  1 15:14:43 2001
From: wurmy at earthlink.net (Hans Nowak)
Date: Sat, 01 Dec 2001 20:14:43 GMT
Subject: use of hasattr(), getattr(), __dict__, was re: Python evangelists 
 unite!
References:  <83pu5zthl4.fsf@panacea.canonical.org> <9uam4t$v23$1@nntp9.atl.mindspring.net>
Message-ID: <3C093A34.358ABEE6@earthlink.net>

adina_levin at mindspring.com wrote:
> 
> What do people think is good-form use of hasattr(), getattr(), and __dict__,
> as opposed to bad magic or suboptimal style?

I think there's nothing wrong with using hasattr, getattr or
setattr... __dict__ is a bit more tricky, but it still seems to
be an acceptable solution in some cases, like, for example,
preventing recursive calls in a __setattr__ method. Then again,
if, in a given situation, you can think of a solution that does
not require tinkering with attributes, it's probably better...

There. Was that vague or what? ;-)

--Hans


From loewis at informatik.hu-berlin.de  Fri Dec 28 18:29:47 2001
From: loewis at informatik.hu-berlin.de (Martin von Loewis)
Date: 29 Dec 2001 00:29:47 +0100
Subject: REPOST: Re: UML/XMI et al
References: 
Message-ID: <2$--$$_-----$$%__$@news.noc.cabal.int>

Harry George  writes:

> I'm working with several CASE tools, some of which have XMI
> interfaces.  I want to drive code in and out of them (and generate SQL
> code for several DBMS's) using python.  Anyone working in this area?

Yes, I've been looking into XMI at one time. People also use XSLT to
process XMI.

> I have already done a generator for UML/XMI DTD --> python classes, and
> MySQL and PostgreSQL SQL code generators.

Sounds interesting. Are you going to publish that code? Does that use
a custom mapping, or a general one?

Regards,
Martin

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp.gblx.net!feeder.qis.net!newspeer.monmouth.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Martin von Loewis 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 04:54:15 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774983 27193 211.57.49.2 (31 Dec 2001 05:03:03 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:03:03 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From gerson.kurz at t-online.de  Sat Dec 29 10:44:35 2001
From: gerson.kurz at t-online.de (Gerson Kurz)
Date: Sat, 29 Dec 2001 15:44:35 GMT
Subject: REPOST: Re: Two languages, too similar, competing in the same space.
References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net>
Message-ID: <0$--$$_----__$-%%$@news.noc.cabal.int>

On Thu, 27 Dec 2001 22:56:29 GMT, Ron Stephens 
wrote:

>I feel that Ruby is so similar in design, purpose, and objectives to
>Python,  that it competes directly with Python for developers' mind share.

Here are some comments on the "Features of Ruby", as advertised on
http://www.ruby-lang.org/en/whats.html. 



> Ruby has simple syntax, partially inspired by Eiffel and Ada. 
I would consider neither Eiffel nor Ada having a inspiring and simple
syntax. Eiffel is for business people who have outgrown COBOL. I think
the Python syntax is by far the cleanest syntax I've seen; and that
Ruby has *a lot* of perlisms in it. 

> Ruby has exception handling features, like Java or
> Python, to make it easy to handle errors. 
Call me oldfashioned, but I don't like exception handling - I like
if-then-else and error checking style. Exception handling is cool for
exceptions - that is: *unlikely* situations -, but it is not cool for
something as commonplace as open() failing because the file doesn't
exist.

> Ruby's operators are syntax sugar for the
> methods. You can redefine them easily. 
There was once an aprils-fool joke called "Generalizing Overloading
for C++ 2000" (See http://www.research.att.com/~bs/whitespace98.pdf).
So much for the need to redefine operators.

> Ruby is a complete, full, pure object oriented
> language: OOL. This means all data in Ruby is
> an object, not in the sense of Python or Perl,
> but in the sense of Smalltalk: no exceptions.
> Example: In Ruby, the number 1 is an instance
> of class Fixnum. 
I've always found it terrible that languages try to *force* a paradigm
onto your code. As wittness java: isn't it a joke that "everything has
to be a class" and then they introduce static member functions just to
get a main()? I like pythons pragmatic approach *much* better: You can
do OOP where you need it, and use other things when you feel like it. 

> Ruby features single inheritance only, *on purpose*.
> But Ruby knows the concept of modules (called
> Categories in Objective-C). Modules are collections
> of methods. Every class can import a module and so
> gets all its methods for free. Some of us think that
> this is a much clearer way than multiple inheritance,
> which is complex, and not used very often compared with
> single inheritance (don't count C++ here, as it has
> often no other choice due to strong type checking!). 
That reminds me of how the book "Inside OLE2" advertises COMs
non-support for multiple inheritance with the argument "you don't need
it to do OOP", while really its just forcing you to use more complex
design when simple multiple inheritance would do. I also like the way
python features add-in classes.



========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: gerson.kurz at t-online.de (Gerson Kurz)
Newsgroups: comp.lang.python
Subject: cmsg cancel <3c2de385.9780406 at news.t-online.de>
Control: cancel <3c2de385.9780406 at news.t-online.de>
Date: Mon, 31 Dec 2001 03:08:17 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774696 27193 211.57.49.2 (31 Dec 2001 04:58:16 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:58:16 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From rdsteph at earthlink.net  Wed Dec 26 22:58:52 2001
From: rdsteph at earthlink.net (Ron Stephens)
Date: Thu, 27 Dec 2001 03:58:52 GMT
Subject: REPOST: Python Popularity: Questions and Comments
Message-ID: <6$--$$-$$$$%%-$$-$@news.noc.cabal.int>

OK, so its between the holidays and the newsgroup is quiet, so maybe I
dare waste a little bandwidth with that most useless (but fun)
commodity: gossip.

How is Python doing popularity wise? After such a meteoric growth
thought the nineties, and a spectacular climax in 2000 and early 2001,
is Python leveling out, going dot.bust, or still not yet at the knee of
the software world's most spectacular growth curve?

I'd be interested in some comments and observations and opinions from
others. Meanwhile, here  are a few of my own:

Python, while fabulously successful, is at an interesting point in its
growth curve. It will be difficult to maintain the extremely high rate
of growth exhibited so far; new contenders are possible problems; and
the recessionary economy could also negatively impact Python's growth.

1. Ruby is an especially interesting competitor to Python. I have been
monitoring the Ruby newsgroup, and it shows incredible growth and
vitality. Furthermore, Ruby is aimed right at the heart of Python's
niche.

If we view Microsoft's Visual Studio, especially Visual Studio.net's C#
and VB, as the official 800 lb. gorilla of software development; and if
we view Java as the 400 lb. gorilla pretender to the throne; and if we
view Borland's Delphi and Kylix as no more than a smart leader of a
chimp; then everything else is the pack of open source chimps.

The open source world is still led by PERL, but PERL is truly more of a
text processing, web CGI, scripting specialist; not so much of a direct
threat to Python. PHP is a server side scripting specialist. Even
JavaScript is strong in its narrow niche of client side web scripting.
Lisp and Scheme dominate thier academic world. But Python aims to be
much more than these; Python aims to be a powerful general purpose
programming language, in addition to being a very easy to learn and easy
to use scripting language. And who can say that Python does not succeed
very well in all of the above?

But Ruby is also a more general purpose, object oriented, relatively
easy to read, language. Ruby folks include those who like its more
Perl-like syntax, but Ruby's core converts believe that its pure,
absolute object oriented nature exceeds those of Python and make it more
worthy to long term success. They seem to see Ruby as a more modern,
up-to-date version of Python. They see Python as a compromise between
object oriented and procedural programming.

Be that as it may, I suspect that much of Ruby's momentum is simply due
to its newness; all things new are seen as sexy in this world of ours.
But nonetheless, Ruby has the following going for it.

a. Usage on the Ruby newsgroup is growing much faster than on
comp.lang.python in the last year that I have been observing it. A year
ago, Python got typically three times as many posts per day as Ruby.
Now, its more like a 4:3 ratio, with Python getting say, 4000 per month,
and Ruby 3000. At this rate, Ruby could pass Python is  afew months, by
this measure! (Rest assured, Ptyhonis fdoing much better if mesured by
Sourceforge projects, about 1300 to 80). By the way, Just van Rossum's
http://starship.python.net/~just/comp.lang.python/ graph of Python
newsgroup coverage seems to show a slight decline from over 6000 per
month in late-middle 2001 to the current 3500 or so I see on here. Mr.
van Rossum said he may not be able to update these any more due to some
Yahoo change; anyway, am I interpreting these numbers and trends
accurately? Will the Python newsgroup usage turn upwards again? Does it
matter?

b. Ruby is getting alot of favorable press, and new books are coming out
now. First, Pickaxe , now, Matz' own Ruby in a Nutshell and several
others soon to be or already here.

c. Ruby actually seems to be a nice language to me. Its object oriented
features seem well thought out and yet its still easy to comprehend. I
will never leave Python behind, but will others? I see quite a few
former Pythonistas posting glowing reviews on comp.lang.ruby, but not as
many as I see former Perl aficionados.

d. Ruby has some smart and aggressive coders doing libraries,
extensions, Java version etc. etc. etc., tehy are agressive and
motivated; tehy think they will see world domination ;-)))

Ruby also has some problems I see:

a. Its windows version seems to have lots of problems. Specifically,
threading doesn't work well at all on Windows, but that's not the only
problem. Ruby on Windows is slow and somewhat buggy; seems to need a
re-write and Matz is engaged in an extensive re-write. Who knows how
successful?

b. Ruby has no where near the libraries Python has, since Ruby is so
much newer. But itime never stands still....

What so you all think of Ruby, and its impact on Python?

2. The economy is hurting Python's open source development model. It was
bad enough when the core Python coders were jerked around by Be Open;
now I am very sad to hear of Mark Hammond's not being with ActiveState
anymore? Without Mark Hommond's win32 work, Python would be a mere shell
of its current self. A person who has given so much to the Python
community as Mr. Hammond, deserves much better. How can an open source
community like Python help reward its hard working heroes like Mr.
Hammond? Will Guido and his team be next to suffer yet again? If
ActiveState can't support Python development, much less a true
Python.Net, who can? Will Zope survive financially? We should care. Why
doesn't someone form a company to market a first class Zope based ISP
service? The Zope folks saids they need such a thing to help promote
Zope. If it could not be profitable, is Python and all open source
development a mere flash in the pan? Without Mark Hammond, Python
windows based development would fall into the sloughs of despond just
like Ruby?

I hope not.

3. Third, Python faces the laws of large numbers. It is exceedingly hard
to continue a growth spurt past a certain point. Maybe were at that
point, maybe not. But ask yourself this; Two years from now, will you
see more Python success stories, more growth, or a leveling out? Five
years from Now?

Ten years from now, will Python still be Relevant? Oh, I know that
Python will still be being used, and the community will still exist, but
will it really be a thing that seems to Matter, like it does now.

I like to Look on the brighter side of life, but I also like to win a
few Spanish Civil Wars.

What do you guys think????

Ron Stephens
http://www.awaretek.com/plf.html Python City

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Ron Stephens 
Newsgroups: comp.lang.python
Subject: cmsg cancel <3C2A9D33.67FEC261 at earthlink.net>
Control: cancel <3C2A9D33.67FEC261 at earthlink.net>
Date: Mon, 31 Dec 2001 04:06:09 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775943 27193 211.57.49.2 (31 Dec 2001 05:19:03 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:19:03 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From niemeyer at conectiva.com  Mon Dec  3 08:02:41 2001
From: niemeyer at conectiva.com (Gustavo Niemeyer)
Date: Mon, 3 Dec 2001 11:02:41 -0200
Subject: more on "Is this considered black magic?"
In-Reply-To: <3C0B441C.8000608@vscht.cz>
References: <3C0B441C.8000608@vscht.cz>
Message-ID: <20011203110241.C1493@ibook.distro.conectiva>

[...]
> results = map( lambda o: o.method( args), objects)

What about this:

results = [o.method(args) for o in objects]

-- 
Gustavo Niemeyer

[ 2AAC 7928 0FBF 0299 5EB5  60E2 2253 B29A 6664 3A0C ]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
URL: 

From matt at avaquest.com  Sun Dec  9 22:19:07 2001
From: matt at avaquest.com (Matthew King)
Date: Sun, 09 Dec 2001 22:19:07 -0500
Subject: smtplib
References: <_YUQ7.24843$ER5.305743@rwcrnsc52>
Message-ID: <3C1429AA.2030503@avaquest.com>


Senthil Kumar wrote:

> ImportError: No module named _socket
> 
> I am not sure if this is bug or or I missed something during my python
> compilation.


I'm not sure why, but it looks like the _socket module was not built 
when you compiled python.  In 2.1.1, setup.py is supposed to get this 
right...  if you uncomment the _socket line in Modules/Setup and 
recompile I'm fairly sure things should work for you.

Maybe someone else can give the details as to why this is happening...

- matt



From matt at lorfeld.com  Fri Dec 28 02:24:17 2001
From: matt at lorfeld.com (mlorfeld)
Date: 27 Dec 2001 23:24:17 -0800
Subject: Python Popularity: Questions and Comments
References: <3C2A9D33.67FEC261@earthlink.net>
Message-ID: <32c382ad.0112272324.4c78689b@posting.google.com>

> How is Python doing popularity wise? 
I'd have to say that with most developers that have tried it it is
very popular (ok so that wasn't too specific).  I heard that ILAM
(Industrial Light and Magic) basically standardized on Python for
their projects (most notably Star Wars Ep. 1&2)

>From a programmer's perspective (albiet a young soon-to-be CS grad) I
like Python's flexibility.  I like how it is OO, yet at the same time
has many procedural characteristics.  I also haven't quite been sold
on the data-centric model that C++/Java implement, granted that does
mean you have to do some extra type-checking.  I also like the fact
that it is an evolving language, with from what I can see, a great
bazaar style approach: In its 1.5.2 iteration, Python was intriguing,
yet it lacked some essential things (such as a Perlesque chomp), then
I took a look at 2.x and the strip function was implemented - saving
me a great deal of repetition in programming.


From max at alcyone.com  Fri Dec 21 14:37:38 2001
From: max at alcyone.com (Erik Max Francis)
Date: Fri, 21 Dec 2001 11:37:38 -0800
Subject: getting strings from the shell commands
References: 
Message-ID: <3C238F82.B8F3241@alcyone.com>

"Sarcar, Shourya C (MED)" wrote:

> I want to do something in python LIKE
> 
> os.system("./myscript") but how can i get the out put into a [list of]
> strings

Use os.popen.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Laws are silent in time of war.
\__/ Cicero
    Esperanto reference / http://www.alcyone.com/max/lang/esperanto/
 An Esperanto reference for English speakers.


From fgeiger at datec.at  Thu Dec 27 07:28:16 2001
From: fgeiger at datec.at (F. GEIGER)
Date: Thu, 27 Dec 2001 13:28:16 +0100
Subject: [VPython] Why are some objects displayed and some are not?
References: <9vpgra$k68$1@newsreaderg1.core.theplanet.net> 
Message-ID: 

Thank you, Syver,

today I tried those lines on an NT 4.0 English machine and it worked. The
platform they do not work on is a Win2k *German* machine. Maybe that's the
problem.

Thanks and cheers
Franz

"Syver Enstad"  schrieb im Newsbeitrag
news:uadwfwso8.fsf at online.no...
> "F. GEIGER"  writes:
>
> > I wanted to display a pile of boxes of different sizes. So I tried the
> >
> > 2-liner of the tutorial:
> >
> > redbox=box(pos=vector(4,2,3), size=(8.,4.,6.),color=color.red)
> > greenball=sphere(pos=vector(4,7,3), radius=2, color=color.green)
> >
> > Worked: Displayed a red box with a green sphere upon it.
> >
> > Then I tried
> >
> > redbox=box(pos=vector(4,2,3), size=(8.,4.,6.),color=color.red)
> > #greenball=sphere(pos=vector(4,7,3), radius=2, color=color.green)
> >
> > Did not work: The screnn stayed black. So I seem to miss something
> > when
> >
> > displaying objects. What does the sphere do, that the box does not?
> >
> > Any hints?
>
> I just tried what you did on my machine, it works fine. (python 2.1 win2k)
>
> --
>
> Vennlig hilsen
>
> Syver Enstad




From gh_pythonlist at gmx.de  Fri Dec  7 22:34:16 2001
From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=)
Date: Sat, 8 Dec 2001 04:34:16 +0100
Subject: Most popular Python modules/extensions?
In-Reply-To: 
References: 
Message-ID: <20011208033415.GA1078@lilith.hqd-internal>

Le 08/12/01 ? 04:01, Robert Feldt ?crivit:
> Hi,
> 
> Are there any stats on the most popular/downloaded Python
> extensions/modules? Any info relating to this appreciated.

Difficult. Sourceforge has download statistics:
http://sourceforge.net/foundry/python-foundry/

I'd bet that mxDateTime, part of the mxExtensions is the single most
popular download, because it's needed by almost every database module.

Gerhard
-- 
mail:   gerhard  bigfoot  de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))



From aleax at aleax.it  Fri Dec 28 05:37:21 2001
From: aleax at aleax.it (Alex Martelli)
Date: Fri, 28 Dec 2001 11:37:21 +0100
Subject: REPOST: Re: Python Popularity: Questions and Comments
References: <3C2A9D33.67FEC261@earthlink.net>  <3C2B9E04.9957801F@earthlink.net> 
Message-ID: <9$--$$_--__-%$%--$@news.noc.cabal.int>

"RPM1"  wrote in message
news:u2nk47nvtu000c at corp.supernews.com...
    ...
> "full technical support"
>
> That's what gets thrown in my face whenever I mention Python.
> (And I mention it a lot).  The company I work for writes point
> of sale software in C and VB, because "there's support" and

VB is a commercial product.  C, like Python, is just a language,
of which exist implementations, both commercial and otherwise.

You can get many different implementations of C, and a few of
Python (the latter are typically "distributions" of the standard
implementation with packaging and support tweaks).  For several
of those implementations, you can buy technical support, "full"
(whatever THAT means) or otherwise -- this goes both for C and
Python, of course.

Firms like ActiveState (www.activestate.com) will typically be
overjoyed to sell you "full technical support" for Python on
the platforms they support.  See, for example:
http://www.activestate.com/Products/Enterprise_Solutions/Python.plex
for quite a few commercial offerings by ActiveState of Python
*Support* products/services, specifically.  I'm sure many other
purveyors of such products and services exist, and I hope relevant
URL's will be posted on this thread.

When you can get somebody to put this sort of thing in writing,
or say it in front of enough witnesses that they can't later
easily backtrack -- so that they've basically admitted that
if "there's support" then they HAVE to look at Python in depth --
you may then follow up by contacting the *SALES* organizations
of such suppliers as ActiveState.  Forget marketing: you need
hungry, aggressive *SALESPEOPLE* to ram change down the throat
of some organization that's clutching at straws to resist change.

Marketing is about product positioning on the market (features,
release timing, pricing models, etc), information flow from the
prospective-audience to the designers and vice versa, and, to a
VERY modest extent, general "public relations" and persuasion.
Don't confuse it with *SALES*, as we techies so often do -- that's
quite as bad as confusing very different tech roles, such as
software development and system administration.


> "customers won't pay for something made with freeware."

I wear Mephisto shoes, but I'm not going to claim that "customers
won't pay for software developed by somebody wearing Nike shoes".

As a non-sequitur, though, it's roughly on a par with this quote.

How will the customers know, and why should they care, what
brand of shoes (if any) the developers choose to wear?

How will the customers know, and why should they care, if (e.g)
your C++ sources were finally compiled/linked with free products
such as gcc, or for-pay ones such as commercial compilers?  The
same, obviously, goes for Python -- how will the customers know,
and why should they care, what kind of support contract YOU have
with ActiveState or other suppliers, if any?


> I think if Python wants to get "bigger" or more acceptable,
> it needs marketing.  The guy with the bag of money needs
> to say, "Oh yeah, Python, I've heard of that."  Customers

I'm not sure "Python" itself "wants" anything, just as I
doubt, say, "C", or "Java", have desires, feelings, hopes.

> ask us if we have a Java 'solution', they don't ask if we
> have a Python 'solution'.  That's got to change if Python
> 'wants' to grow more, (I don't know that it does).

Neither do I.  More to the point, this looks like a commercial
issue.  Is there money to be made by this sort of promotion,
which in turn does surely cost money?  If so, then it's more
of an issue of entrepreneurship -- get capital, start company,
invest, draw profits.  For typical Python *users*, well, if
their competition is using less-effective tools, why shouldn't
they just enjoy the resulting competitive advantage?  Production
costs aren't everything, of course, but in most endeavours they
do matter a lot to competitive positioning in the market.  In
many cases one goes to a LOT of trouble to try to have slightly
lower production costs than one's competition.  If in this case
my competition is willingly going to its own slaughter, should I
spend time and energy to reverse that?  As Clough put it, "Thou
shalt not kill, but needst not strive, officiously, to keep
alive".

Yeah, yeah, I know, this is not the prevailing ethos in Open
Source and more generally in the computer world -- we're all
missionaries out to save the world with our zeal and diligence,
particularly by ramming the "right" technologies down the
unwilling throats of everybody else.  For their own good, of
course.  Yeah, well.


>     It seems to me, (with my limited experience), that the
> most dedicated audience Python has is the scientific
> community.  I would start there.  Get some big chemical,
> pharmaceutical, or biological corporations to use Python,
> (by catering to their needs), and then they will in turn

Done, see http://www.python.org/psa/Users.html.  AlpgaGene,
Inc, NorthSide Physical Therapy, Thermo BioStar, Biosoft,
Caltech, are among the firms in this general sector who
not only use Python but are willing to be identified as
doing so on that page.

> support the language when they see the wonderful end
> product.  Then people like me can say to my boss, "look
> Dow, Johnson & Johnson, and ADM all use Python
> heavily, so there's nothing to be afraid of."

Why should such firms care about letting it be known
whether they use Python heavily, or Java, or C++, or
whatever else?  That's not their core business.  What's
in it for them?  Can you even FIND OUT what programming
languages are in fact used by the various departments
and fiefs of these large organizations?


> Maybe I'm wrong.  But it seems to me that Microsoft
> is ahead, not because of the high quality of their
> product, but because of there timing and marketing.

I think Microsoft's marketing has typically been truly
abysmal in most respects -- quite a match for the median
quality of most of their wares.  There are no doubt some
exceptions on both scores (e.g., the COM architecture,
and the .NET Framework, have some technically excellent
traits; marketing in both cases has done a horrid hash
of a job, particularly NOT managing to convey public
information about the technologies in question, and to
some extent, at least in COM's case, definitely NOT
steering product positioning according to market needs).

We'll see how their latest game-box offering fares, but
so far every one of their attempts beyond the desktop
has been substantially a failure, cross-subsidized by
profits on desktop operating systems, office apps, and
to a lesser extent other desktop apps (including games,
software development tools, etc).

This tells us nothing about marketing _technologies_
as opposed to products and services.  In that field,
Sun's very successful efforts at marketing Java may
be more instructive.  But, who has a billion dollars
available to throw at the task?  And how to they plan
to recoup the investment?  Sun has presumably judged
that opposing Microsoft's dominance has huge strategic
value for them: they don't make money directly out of
Java (not, by far, enough to make the huge marketing
investments profitable), but apparently they think
they're getting value for money through other revenue
channels.  What huge firm[s] might possibly make a
similar decision in the case of Python?  And why?


Alex

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail
Message-ID: 
Control: cancel 
Subject: cmsg cancel 
From: "Alex Martelli" 
Newsgroups: comp.lang.python
X-No-Archive: yes
Lines: 2
NNTP-Posting-Host: wonenara.ozemail.com.au
X-Trace: ozemail.com.au 1009643042 203.108.164.177 (Sun, 30 Dec 2001 03:24:02 EST)
NNTP-Posting-Date: Sun, 30 Dec 2001 03:24:02 EST
Organization: OzEmail Ltd, Australia
Distribution: world
Date: Sat, 29 Dec 2001 16:12:36 GMT

This message was cancelled from within Mozilla.


From markjunk at mceahern.com  Thu Dec 27 11:21:33 2001
From: markjunk at mceahern.com (Mark McEahern)
Date: Thu, 27 Dec 2001 16:21:33 GMT
Subject: cmp
References: 
Message-ID: 

> Perhaps then could someone explain to me how one compares classes
> useing the == operator, or indeed if this bad programming practice.

By overloading the __cmp__ method.  Don't confuse the return value of
__cmp__ with whether or not the result of the comparison is that the two
instances being compared are equal.  Examine this sample and note that
__cmp__ isn't merely used to determine equality.  It is also used to
determine sort order.

class foo:

    def __init__(self, bar):
        self.bar = bar

    def __cmp__(self, other):
        if self.bar == other.bar:
            return 0
        elif self.bar < other.bar:
            return -1
        else:
            return 1

    def __repr__(self):
        return "" % self.bar

a = foo(1)
b = foo(2)
c = foo(3)
d = foo(1)

list = [b, c, a]

print "before sorting:"
print list
print

list.sort()

print "after sorting:"
print list
print

print "a == d: %s" % (a == d)




From igorr at ifi.uio.no  Fri Dec 28 00:52:16 2001
From: igorr at ifi.uio.no (Igor V. Rafienko)
Date: 28 Dec 2001 06:52:16 +0100
Subject: try-except-finally question
References:  
Message-ID: 

[ Aahz Maruch ]

[ Thanks to everyone who answered ]

[ snip ]

> >	    except DBError:
> >	        
>           except:
>               
>               raise


Jupp, that is what I was looking for.

[ snip ]


> Note the addition of "except:" above. You need the "raise" to make
> sure the error gets re-raised (you *want* to abort if the user hits
> ^C).


Hmm... that didn't occur me. Thank you for the tip.





ivr
-- 
Partial Nudity is allowed by female users.


From cypher_dpg at yahoo.com  Thu Dec  6 22:51:28 2001
From: cypher_dpg at yahoo.com (Jeremy Jones)
Date: Thu, 6 Dec 2001 22:51:28 -0500
Subject: simple, lightweight component based development in python?
In-Reply-To: <5.1.0.14.2.20011206222835.0507af98@202.95.131.154>; from tripp81@yahoo.com on Thu, Dec 06, 2001 at 10:39:29PM +0700
References: <5.1.0.14.2.20011206222835.0507af98@202.95.131.154>
Message-ID: <20011206225128.A29607@cerberus.liberty>

* Tripp Scott (tripp81 at yahoo.com) wrote:
> is there already a lightweight component framework in python?

> lightweight. i do not see the need to interface to other 
> languages in the near future so a python-only solution will do 
> -- though the possibility of bridging to COM or CORBA would certainly be nice.

Pyro may be worth a look.  It sounds very similar to what you need.  http://pyro.sourceforge.net/

Jeremy Jones



From amberdelton at email.msn.com  Sun Dec  2 18:25:34 2001
From: amberdelton at email.msn.com (amberdelton)
Date: Sun, 2 Dec 2001 16:25:34 -0700
Subject: Very new to this
References: <#k0oOh4eBHA.1192@cpimsnntpa03>
Message-ID: <#EQGkj4eBHA.1188@cpimsnntpa03>

Sorry, it has been along day the first post was suppose to say is there a
way that i can get a script that i write to pause for a x amount of seconds?




From timo.SPAM.linna at iki.ME.fi.NOT.invalid  Tue Dec 18 12:10:19 2001
From: timo.SPAM.linna at iki.ME.fi.NOT.invalid (Timo Linna)
Date: Tue, 18 Dec 2001 17:10:19 GMT
Subject: Inheriting Python modules?
Message-ID: <%LKT7.2764$NB2.64678@news2.nokia.com>

Hi,

How should "dynamic module inheritance" be implemented with Python?

Example:

It should be possible to write: "import defaults" so that it would first
import everything from common.defaults -module and after that other stuff
from product.defaults-module. Content of both modules should be accessible
through one common (defaults) interface so that the caller wouldn't have to
know from which module the code is actually accessed.

I would NOT like to create "dummy" logical defaults-module which would
simply import both modules - things should happen automatically at runtime.

BR,
    timo





From lokie.spods at ntlworld.com  Tue Dec 25 10:43:23 2001
From: lokie.spods at ntlworld.com (lokie.spods)
Date: Tue, 25 Dec 2001 15:43:23 -0000
Subject: I used os.waitpid,but I still can't Zombie process?
References:   <1008825134.967004@yabetcha.sttl.drizzle.com>  <1009167768.180019@yabetcha.drizzle.com>
Message-ID: 

"Donn Cave"  wrote in message
news:1009167768.180019 at yabetcha.drizzle.com...
> Quoth "lokie.spods" :
> | "Donn Cave"  wrote in message
> | news:1008825134.967004 at yabetcha.sttl.drizzle.com...
> ....
> |> Hm, I think we're going in circles here - if I remember right, he was
> |> having problems with EINTR because of SIGCHLDs.  Between that and the
> |> extra problems Python has with signal handling, I personally think
SIGCHLD
> |> is a total loser for Python programs.
>
> | As all child processes will raise SIGCHLD upon exit it seems stupid to
> | ignore the oppertunity to take advantage of the signal and perform
cleanup
> | as its required, working smarter not harder. Now your point mentions
EINTR,
> | regardless of whether you write code to handle that signal, or leave it
> | unhandled some routines are going to exit anyway with EINTR. Re-reading
the
> | OP's code snippet, it looks like any IO that could exit with EINTR is in
the
> | child and out of scope of that signal anyway.
>
> SIGCHLD will abort your I/O functions with EINTR _only_ if you establish
> a SIGCHLD handler.  It's a last resort.
>
Which assumes that the calling process left SIGCHLD in its default state.
You can't make that assumption, for example I know of one shell that defines
a handler for SIGCHLD which then gets inherited by any subsequent processes.
Hence after the Christmas cheer has worn off I'll write a few example
programs to see if the Python interpreter overrides the sigaction with an
ignore setting.

> | I read your idea of signalling process completion back to the calling
> | process via a pipe with interest. It fits in with an idea I'm playing
with
> | for a threaded DNS server, the idea being that a thread signals the main
> | process to awake and deal with the results, so the main process can
> | blissfully sleep in a select call until needed. As said server is in C
not
> | Python, it'll probably be very offtopic to report on success or failure
of
> | that approach, but intuitively I expect it to work as advertised.
>
> Sure, but it's rather different than what I was talking about there.
> I don't expect the child process to actually write anything to the pipe
> or be aware in any way of its existence.  Its sole purpose is to generate
> end of file when the child exits.  Would be reliable only if certain
> details are worked out, though.
>
> Donn Cave, donn at drizzle.com
Taking OP's code snippet, I assume your idea would work something like this
(off the top of my head, so excuse mistakes).....

exc_items = []
while 1:
  ...
  new_item = os.pipe()
  ret=os.fork()
  if ret==0:
     os.close(new_item[0])
     HOST=udpaddr
     PORT=21567
     ADDR=(HOST,PORT)
     udpSerSock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
     udpSerSock.sendto(data,ADDR)
     udpSerSock.close()
     break
  os.close(new_item[1])
  exc_items.append(new_item[0])
  big_item = select.select([], [], exc_items, 0)
  for cl_items in big_item[2]:
    os.close(cl_items)
    os.waitpid(-1,os.WNOHANG);
    exc_items.remove(cl_items)

Taking the same code and applying my idea would result in something rather
like this (also off the top of my head, so excuse mistakes).

read_items = []
end_sig = os.pipe()
read_items.append(end_sig[0])
while 1:
  ...
  ret=os.fork()
  if ret==0:
     HOST=udpaddr
     PORT=21567
     ADDR=(HOST,PORT)
     udpSerSock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
     udpSerSock.sendto(data,ADDR)
     udpSerSock.close()
     os.write(end_sig[1], "\n")
     break
  big_item = select.select(read_items, [], [], 0)
  for e_items in big_item[0]:
    if e_items == end_sig[0]:
      discard = os.read(end_sig[0], 1)
      os.waitpid(-1,os.WNOHANG);

I leave it as an example to the reader, to check how many characters are
ready to be read from the FD and loop calling waitpid appropriately :-)'s

Anthony McDonald
--
Spammer's please note, all spam sent to this address immediately raises a
complaint with your network administrator.





From brian at sweetapp.com  Tue Dec 18 16:04:16 2001
From: brian at sweetapp.com (Brian Quinlan)
Date: Tue, 18 Dec 2001 13:04:16 -0800
Subject: [XML-SIG] Pyana 0.2.0 released 
In-Reply-To: <200112181927.fBIJRTZ02513@localhost.localdomain>
Message-ID: <005901c18807$8e67f210$445d4540@Dell2>

Uche Ogbuji wrote:

> -----Original Message-----
> From: uogbuji at fourthought.com [mailto:uogbuji at fourthought.com] On
Behalf
> Of Uche Ogbuji
> Sent: Tuesday, December 18, 2001 11:27 AM
> To: brian at sweetapp.com
> Cc: 'Martin v. Loewis'; xml-sig at python.org; python-list at python.org
> Subject: Re: [XML-SIG] Pyana 0.2.0 released
> 
> > This is a multi-part message in MIME format.
> >
> > ------=_NextPart_000_0036_01C1872A.6648D570
> > Content-Type: text/plain;
> > 	charset="iso-8859-1"
> > Content-Transfer-Encoding: quoted-printable
> >
> > Uche Ogbuji wrote:
> >
> > > > PIRXX is focused on providing Xerces XML services to Python. The
> > current
> > > > release of PIRXX provides SAX2 interfaces but I believe that =
> > J=FCrgen
> > is
> > > > working on DOM support.
> > > >
> > > > So, right now, Pyana is probably your best bet for
high-performance
> > XSLT
> > > > processing in Python while PIRXX offers Xerces SAX2 interfaces.
> > >=20
> > > Are you basing this on actual benchmarks?  In particular, I'd be
> > surprised
> > > if Pyana was faster overall than current CVS of 4XSLT, Since Xalan
> > isn't,
> > > as I measure it.
> >
> > I am basing this on the timings of largish transformations that I
was
> > doing around 2 months ago. Since then I haven't really compared them
and
> > I have never run any formal benchmarks.=20
> >
> > Note that one of the big problems with timing Xalan from the command
> > line is that it is very slow to load, especially on windows. I just
> > timed "import Pyana" on my PIV 1.7GHz and it took 0.74s. But the
beauty
> > of using Pyana instead of something like "popen('xalan ..." is that
the
> > load time becomes a one-time cost for the application.
> >
> > For fun, I just downloaded:
> > http://www.datapower.com/XSLTMark/download/XSLTMark_2_1_0.zip
> >
> > And wrote the attached script. I did this without expending any
effort
> > trying to understand the benchmark suite; I just test each .xml/.xsl
> > pair. Notice that all of the source/stylesheet documents are small
so
> > the advantage should go to 4suite.
> >
> > I don't want to get 4suite from CVS so why don't you get Pyana:
> 
> No.  I'm no more interested in running a benchmark between the two
than
> you are.  I have much better things to do, like actually working to
> improve 4suite.  Therefore, I know better than to make such
> unsubstantiated comments as "foo is your best bet for high-performance
> XSLT processing".

My substantiation was my personal experience a few months ago. I also
have several user testimonials stating that they are using Pyana instead
of 4suite for performance reasons. One actually sent me their timings,
which [at that time] demonstrated a 41x performance edge for Pyana.

But, since you are being so picky, I tested the latest Pyana release
(0.2.0) against the latest 4suite release (0.11.1), using the test
script that I attached in the previous e-mail*:

time to import Pyana (probably cached or something): 0.0916s
time to import 4suite (already byte-compiled): 0.9955s
Pyana:  time to execute axis: 0.0093s
4suite: time to execute axis: 0.1088s
Pyana:  time to execute bottles: 0.0165s
4suite: time to execute bottles: 0.2519s
Pyana:  time to execute brutal: 0.0139s
4suite: time to execute brutal: 0.1658s
Pyana:  time to execute chart: 0.0122s
4suite: time to execute chart: 0.1397s
Pyana:  time to execute current: 0.0067s
4suite: time to execute current: 0.0520s
Pyana:  time to execute game: 0.0095s
4suite: time to execute game: 0.1022s
Pyana:  time to execute html: 0.0065s
4suite: time to execute html: 0.0491s
Pyana:  time to execute identity: 0.0061s
4suite: time to execute identity: 0.0121s
Pyana:  time to execute inventory: 0.0091s
4suite: time to execute inventory: 0.1493s
Pyana:  time to execute metric: 0.0114s
4suite: time to execute metric: failed!
Pyana:  time to execute number: 0.0089s
4suite: time to execute number: failed!
Pyana:  time to execute oddtemplate: 0.0099s
4suite: time to execute oddtemplate: 0.0851s
Pyana:  time to execute priority: 0.0095s
4suite: time to execute priority: 0.0810s
Pyana:  time to execute products: 0.0107s
4suite: time to execute products: 0.3034s
Pyana:  time to execute queens: 0.0855s
4suite: time to execute queens: 2.3471s
Pyana:  time to execute tower: 0.1664s
4suite: time to execute tower: 6.7971s
Pyana:  time to execute trend: 0.0518s
4suite: time to execute trend: 2.6534s
Pyana:  time to execute union: 0.0056s
4suite: time to execute union: 0.0382s
Pyana:  time to execute xpath: 0.0067s
4suite: time to execute xpath: 0.1720s
Pyana:  time to execute xslbench1: 0.0158s
4suite: time to execute xslbench1: 0.1960s
Pyana  total: 0.4720s
4suite total: 14.0028s

The first 4suite failure was caused by this XPath: " . * 1000"
The second was caused by a  element. The exception
says:

XsltException: Illegal Element "decimal-format" in XSLT Namespace (see
XSLT Spec: 2.1).

I looked it up in the XSLT spec and the context seems to be appropriate.


> I'm sure we can all just get along: multiple XSLT implementations for
> Python is a Good Thing.

Agreed

Cheers,
Brian

Here is the 4suite code [please let me know if it can be optimized]:

processor = Processor()
processor.appendStylesheetUri(styleFile)
processor.runUri(sourceFile)





From loewis at informatik.hu-berlin.de  Sat Dec  8 10:31:20 2001
From: loewis at informatik.hu-berlin.de (Martin von Loewis)
Date: 08 Dec 2001 16:31:20 +0100
Subject: OK, now *this* is cool
References:   <3C112086.5F7072A9@accessforall.nl>
Message-ID: 

Ype Kingma  writes:

> P.S. Did they really make __subclasses__() a method?

Yes. Each type holds a list of weak references to its subtypes, to
avoid creating cycles. If you want a list of all subclasses, you need
to go through the weak references and find those which are still
live. The list you get will be different from what is in the type
object; the function call will remind you that some computation is
going on.

Regards,
Martin


From kevin at cazabon.com  Mon Dec 17 13:09:47 2001
From: kevin at cazabon.com (Kevin Cazabon)
Date: 17 Dec 2001 10:09:47 -0800
Subject: Compiling Python with Tkinter
References:    
Message-ID: <5a4226f0.0112171009.560233a9@posting.google.com>

It sounds like the only reason you want to compile Tk is that you need
PIL (and PIL by default needs Tcl/Tk to compile the ImageTk module).

Simple solution:  comment out the lines for ImageTk in the PIL make
file (so only _imaging.o is built).  You can easily build PIL without
Tk installed or required.  See the PIL documentation for details, its
in there somewhere.

Kevin Cazabon.


Martin von Loewis  wrote in message news:...
> Ben Ocean  writes:
> 
> > I do not have headers. I presume I could, and should, build the X
> > libraries.
> 
> Not at all. You already have X libraries installed, so you should get
> the corresponding header files.
> 
> > >Since you still did not mention what system you are using, it is hard
> > >to suggest a procedure for installing the headers.
> > 
> > Sorry. RH71.
> 
> Ok. 'rpm -i XFree86-devel-..rpm' should give you the
> header files; fill in version and arch as appropriate.
> 
> > I don't use a GUI on my Linux box: I prefer the command line. I do serve 
> > Web pages. I don't even know what X11 is used for so I don't guess I 
> > develop any apps for it.
> 
> Then you can't use Tkinter, either - it requires an X server for use
> on Linux.
> 
> >  > What do you want Tkinter for if you don't use X Windows?
> > 
> > I'm building PIL into my python to use the libraries. 
> 
> That doesn't really answer the question: if you don't have X, you
> don't need Tkinter, either - not even if you use PIL.
> 
> Regards,
> Martin


From LLewin at oreilly.com  Fri Dec 28 14:27:38 2001
From: LLewin at oreilly.com (Laura Lewin)
Date: 28 Dec 2001 11:27:38 -0800
Subject: Wine applicability (was: Python Popularity: Questions and Comments)
References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9901.998345FB@earthlink.net>   <200112281405.IAA20884@starbase.neosoft.com> 
Message-ID: 

Hi,
Just a quick note to say that O'Reilly doesn't make anyone use Word. 
You can use Word, Frame, or XML.  Alex started the Nutshell in Word so
we're sticking with it.  If it's too much of a problem, though, Alex,
we can change.  Let's talk off the list.
Laura
LLewin at oreilly.com

"Alex Martelli"  wrote in message news:...
> "Cameron Laird"  wrote in message
> news:200112281405.IAA20884 at starbase.neosoft.com...
>     ...
> > >I don't do much gaming, but I still have to use Windows (mostly in
>  win4lin
> > >under Linux) for a few needs (e.g., SOME durned webpages that I need
>  won't
> > >show correcty under any browser except Internet Explorer).  Not to
>  mention
> > >that think3 is a mostly-Windows shop, too.
> > >
> > >Linux is my preferred platform for most tasks, except that my
>  firewall/etc
> > >machine runs OpenBSD (sometimes security is more important than richness
> > >of features, support for strange hardware, and so on).
> > .
> > I'm a tiny surprised; I sincerely thought you
> > were most comfortable with Windows for COM and
> > ADO riches.
> 
> I do love COM and COM-based technologies, and for the last few years
> I've had to immerse myself almost exclusively in Windows to develop
> some of the expertise for which I was (and am) gainfully employed.  But,
> out of all the operating systems and environments I've tried (including
> also Vax/VMS, IBM mainframe OS's such as VM/SP and MVS, Apollo Domain,
> and quite a few others) Unix-like ones have always been my personal
> preference for most tasks.  I used Linux at home in '92-'95, before
> the switch to Windows for "total immersion/gain expertise" purposes,
> and this year I've been able to switch back to Linux at home (and
> OpenBSD for the firewall/etc -- now THAT is stability, solidity, and
> security; upon reviewing most all available environments, OpenBSD
> struck me as heads and shoulders above the crowd -- but, behind the
> firewall, I find Linux preferable, given typical "consumer" needs such
> as Windows emulation, viewing Realmedia files, and so on).
> 
> 
> > Alex, do you have any sense of how well "SOME
> > durned webpages ..." look when viewed with IE
> > under Wine on Linux?  Are you saying that they
> > *are* acceptable through win4lin-plus-IE?
> 
> I was unable to make Microsoft Word run perfectly under Wine, and
> that's my primary need -- Word with O'Reilly customized macros &c,
> as that's what I'm required to use for one of the books.  So, I
> did not try Wine extensively on other tasks.  I did try VMWare (a
> beta) and found it somewhat clunky, ponderous, and slow, although
> maybe that was its beta nature; anyway, I wasn't motivated to plunk
> down several hundred dollars for the final version to find out.
> 
> Then I discovered, carefully hidden on a CD of my favorite Linux
> Distribution (Mandrake 8.1 powerpack), a demo/trial version of
> NeTraverse's Win4Lin.  Half an hour after starting to try it out
> I had purchased the full unlimited license online (after trying
> to do so, without success, directly at Mandrake Store, I just got
> to NeTraverse's site, and, there, it was a snap) -- 1/4 the price
> of VMWare and more usable for my purposes.  Lots of limitations
> that may be important to some: you only get to run Windows98 on
> top of Linux, and your Windows "machine" doesn't get to see any
> strange hardware you may have (in my case, a durned Winmodem by
> Conexant, really win-only; fortunately I was later able to have
> it exchanged with a Lucent-chipset one, which does run fine under
> Linux, it appears).  But those limitations were not important for
> my own specific purposes.  All webpages show up just fine under
> IE 5.5 (haven't bothered downloading 6, I'm told it plays havoc
> with CSS handling), Word runs, and so does Visual Studio when I
> need to compile/try out something in Windows version.  I have
> occasionally used Excel, Powerpoint, the OKbridge Windows clent,
> and a few minor things -- for each of those I'd have good Linux
> side alternatives too, but, since I had win4lin already, why
> bother.  I believe the only failure was when trying to examine
> some files with the Windows Media Player.  I do get occasional
> "crashes" (of the simulated Win98 environments), but roughly as
> often as a real Win98 crashes under similar usage, so I don't
> think that's win4lin's fault.
> 
> 
> Alex


From chrishbarker at attbi.com  Thu Dec 20 16:13:44 2001
From: chrishbarker at attbi.com (Chris Barker)
Date: Thu, 20 Dec 2001 13:13:44 -0800
Subject: /usr/bin/env: python: No such file or directory
References: 
		<915a998f.0112161542.2ab07235@posting.google.com>
		<3C222B16.C1B1BC8D@attbi.com> 
Message-ID: <3C225488.AF5C93F4@attbi.com>

Cliff Wells wrote:
> On Thu, 20 Dec 2001 10:16:54 -0800
> Chris Barker  wrote:
> 
> > I suppose, if we all, as a community, start using:
> >
> > #!/use/bin/env python2.1
> >
> > Then the problem will be solved, at least on *nix...
> >
> > Then what do you do with a script that will run on either 1.5 or 2.0 or
> > 2.1 ????? and you don't know which of these might be installed?

> It seems reasonable that if your script requires a particular version of Python to append the version to the executable name (i.e. python2.1),

There are two problems here: 

1) This would only work if we all, as a community, established this
convention. So far I have only seem "python" used, for all versions...

2) It only applies to *nix. Windows and the Macintosh would need
different conventions. I think a platform independent Python based
solution is a better way to go.

>> and if your script doesn't care, then just use "python" which could be a symbolic link to the >> default python interpreter (much as redhat has it 
>> now).

The problem with what RedHat has now is that apparently some of the
scripts DO care! even though now it is not too hard to write code that
will run on version 1.5 - 2.2, eventually we will be at Python 4.*, and
you may be very hard pressed to write code that doesn't care, but you
may be able to write code that works on 2.2 - 3,5 , for instance. Also
while you may write a script now that "doesn't care", when Python 3
comes out with some new incompatability, it will then care, but the
"python" will still be there.

>>  It might be helpful if the python interpreter took a flag such as
>>  --required-version or >> --minimum-version so that a warning could
>> be printed if the script requires a version different than what is
>> available on the system.

How would the interpreter know what version was required? That's exactly
what I think we need...A way to tell the interpreter what version is
required by a script.

-Chris



-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at attbi.net                ---           ---           ---
                                     ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------


From scott_hathaway at riskvision.com  Fri Dec 21 07:56:26 2001
From: scott_hathaway at riskvision.com (Scott Hathaway)
Date: Fri, 21 Dec 2001 06:56:26 -0600
Subject: question soap and classes
References:  
Message-ID: <%8GU7.4$mo2.16599@news.uswest.net>

Thanks for the reply.  I looked at the OSE project.  I think I will just
make a wrapper class and only expose it to the world with SOAP.

:)
Scott

"Graham Dumpleton"  wrote in message
news:dc6f5c99.0112201800.4e665684 at posting.google.com...
> "Scott Hathaway"  wrote in message
news:...
> > I want to create a soap server that will expose many classes and then
acces
> > them as follows:
> >
> > client:
> >
> > import SOAP
> > if SOAP.Config.SSLserver:
> >  from M2Crypto import SSL
> > SOAP.Config.debug = 1
> > SOAP.Config.BuildWithNoType = 1
> > SOAP.Config.BuildWithNoNamespacePrefix = 1
> > s = SOAP.SOAPProxy("http://localhost:8800")
> > u1 = s.classA.Login('joe','smith')
> > u2 = s.classB.Logout('joe','smith')
> >
> > ...
> >
> > This does not allow me to access separate classes.  Can anyone tell me
the
> > best way to do what I want?
>
> Looking at the source code you have:
>
>     def registerObject(self, object, namespace = ''):
>         if namespace == '': namespace = self.namespace
>         self.objmap[namespace] = object
>
> And then when it tries to dispatch things:
>
>                     else: # Now look at registered objects
>                         # Check for nested attributes. This works even if
>                         # there are none, because the split will return
>                         # [method]
>                         f = self.server.objmap[ns]
>                         l = method.split(".")
>                         for i in l:
>                             f = getattr(f, i)
>
> Ie., it looks like the only way you can distinguish objects is by
registering
> them against different namespaces. If this is the case you wouldn't be
able
> to use the client calling sequence you are using as you would need have
separate
> proxy objects for each remote object, each with a different namespace
being
> specified.
>
> Anyway, this is a guess based on looking at the code only.
>
> Personally, I don't like how namespaces are used in this way. I prefer a
> model whereby different objects are registered against distinct URLs.
Using
> namespaces like this though has come about as most systems only have one
URL
> entry point and thus object identification has had to be piggy backed on
> using other means.
>
> If you are interested in alternative SOAP frameworks for Python you might
> have a look at OSE. In particular have a look at the examples:
>
>   http://ose.sourceforge.net/example-programs/transient-client.py
>   http://ose.sourceforge.net/example-programs/transient-service.py
>
> These don't actually use SOAP but an XML-RPC like protocol, but it is a
one
> or two line change in each to have it use SOAP or XML-RPC instead. In the
> example it shows dynamic creation of new objects against distinct URLs but
> they could just as easily be set up in advance. Setting up static objects
> or services is actually the norm and you can find a mumber of other
examples
> on the web site of that.
>
> The main OSE site is:
>
>   http://ose.sourceforge.net




From aahz at panix.com  Fri Dec 21 18:54:56 2001
From: aahz at panix.com (Aahz Maruch)
Date: 21 Dec 2001 15:54:56 -0800
Subject: Dictionaries as records
References: 
Message-ID: 

In article ,
Bill Wilkinson  wrote:
>
>I have been happily using a list of dictionaries to hold table data for
>years.  For the first time, this method is proving less than efficient
>because of the amount of memory overhead the dictionaries produce.  I
>have a file with 200K records and 16 fields.  This file is parsed and
>each row is put into a dictionary and the dictionary is added to a
>list.  The raw file is only about 50mb.
>
>I was shocked to see that my memory use jumped to 500MB!  When I delete
>the list the memory is returned to the system, so I know that the
>memory is being used in the dictionaries.
>
>What strikes me as odd is that I can create a list of 200K dictionaries
>with test data (a copy of the same record over and over) and the amount
>of memory used is only half.

My guess is that you're creating the dict keys dynamically at runtime.
Try either hardcoding the dict keys or interning the strings you're
reading in.
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

Tenth Virtual Anniversary: 10 days and counting


From benoit.cerrina at writeme.com  Fri Dec 28 11:29:12 2001
From: benoit.cerrina at writeme.com (Benoit Cerrina)
Date: Fri, 28 Dec 2001 17:29:12 +0100
Subject: REPOST: Re: Embeddability (was: Python Popularity: Questions and Comments)
References: <3C2A9D33.67FEC261@earthlink.net> <3C2BC584.53199AD5@cti.ecp.fr> <67E54B47BD89CB93.F31156BB065B59F8.45903B6CE0C1ED74@lp.airnews.net>
Message-ID: <2$--$$_----_---%%$@news.noc.cabal.int>

> Somebody built a vim with Ruby as an extension language.
Vim's source distribution comes with ruby support, it still needs to be
activated through the appropriate configure option though.
I also wrote a patch to make ruby easier to use as an extension language
for vim.  The important point though is that scripting vim in ruby is
a regular part of vim.
Benoit

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!newspeer.cwnet.com!enews.sgi.com!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: "Benoit Cerrina" 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 03:28:27 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775285 27193 211.57.49.2 (31 Dec 2001 05:08:05 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:08:05 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From grey at despair.dmiyu.org  Tue Dec  4 13:18:42 2001
From: grey at despair.dmiyu.org (Steve Lamb)
Date: Tue, 04 Dec 2001 18:18:42 -0000
Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)
References:    <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com>  <3C0BD39F.D43D4FF7@mega-nerd.com>  <3c0be454$1@207.229.64.20> <3C0BE5D5.4386B359@mega-nerd.com> <3c0bf170$1@207.229.64.20>  <2g2q0us3pdsl91hkbv3gj39nbfhnjke70s@4ax.com>
Message-ID: 

On 4 Dec 2001 11:48:17 -0600, Chris Spencer  wrote:
> 	How many times do people have to point out that you're wrong?

    2000 people rallying to the wrong point does not magicaly transform it
into a right.

> 	When we standardized on the "tabber" method, everything just magically
>lined up in the editor.  The spacers defined their tabs to be 2 or 3 spaces
>in width so it was comfortable to look at (I choose 8 spaces of width), but
>all of the code looked the SAME instead of the crazy mixture we had before.

    Which would have happened if you standardized on a number of spaces for
indentation.

> 	Maybe if you only code for yourself you can have total uniformity of
> coding style amongst all of your projects.  When you're dealing with several
> people on a development project, that "tabber" convention is absolutely "the
> Right Thing(tm)".

    Except in the example, which is not uncommon.  In fact a tabber in this
very thread promoted mixing tabs and spaces in response to it!

    Tabs are the worst possible thing and no large number of people rallying
behind it will change it to a right.  All it proves is that like any other
foolish notion you can fool quite a few people into believing it.  

    The difference is while all the tabbers are whining on the side of
"preference" I'm pointing out very real logistical problems which has nothing
to do with preference.  Preference takes a back seat.  When you stop ignoring
that you'll come to understand the problem.
 
-- 
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
         ICQ: 5107343          | main connection to the switchboard of souls.
    To email: Don't despair!   |  -- Lenny Nero, Strange Days
-------------------------------+---------------------------------------------


From sonyi at chollian.net  Tue Dec 11 02:05:16 2001
From: sonyi at chollian.net (young-il sohn)
Date: 10 Dec 2001 23:05:16 -0800
Subject: [wxPython rePOST] Can I use wxMetafile?
Message-ID: <11b62679.0112102305.b7856e2@posting.google.com>

If anyone knows about the usage of wxMetafile and wxMetaFileDC in
wxPython, please allow me to know about that. That will be a great
help to my current project. I would like to convert the drawing which
is drawn using wxPanel and several wx-classes in my application into
another application such as MS-WORD or EXCEL.

Currently I use Windows NT 4.0 and Windows 98, Python 2.1 and wxPython
2.3.1

Thanks.

Young-il Sohn


From ben at wblogan.net  Sun Dec 16 06:08:56 2001
From: ben at wblogan.net (Ben Logan)
Date: Sun, 16 Dec 2001 06:08:56 -0500
Subject: Python Hosting Questions
In-Reply-To: ; from davebutlerREMOVE@hotmail.com on Sat, Dec 15, 2001 at 07:16:40PM +0000
References: 
Message-ID: <20011216060856.A10587@newcreature.org>

I'm not sure what all you are looking for, but we are pretty happy
with http://www.hostforweb.com.  They don't advertise Python, but
they've got it.  They run Redhat, too, which is nice since that's what
I run.


Whatever you do, do NOT use http://www.dzones.com.  They were quick to
take the money, but when we asked them a simple question a little
later on, they never answered.  We waited days for some answer (they
advertise <24 hr support) before sending in another support ticket,
but they never said a bloomin' thing.  Nothing!


HostForWeb's packages start at $5/month, too.  Unfortunately, the
Python version is 1.5.2.   I think there are only the standard modules
installed, but you have compiler access (I was able to compile the
gdmodule...too bad gdlib wasn't compiled with TTF support, though).
They might consider installing Python2.x...I don't know.

HTH,
Ben

On Sat, Dec 15, 2001 at 07:16:40PM +0000, Dave Butler wrote:
> I am searching for a new hosting company because my existing host does not
> provides many services/technologies (like Python) that I would like to use.
> While I evaluate potential hosts, I am uncertain as to which questions I
> should be asking. Perhaps CLP can help me with my list of questions as it
> relates to Python. Here are my Python questions for the web hosting
> companies:
> 
> 1) Which version of Python is installed (it seems it should be at least 2.0
> or 2.1)
> 2) Is Mod_python supported?
> 
> Here are some questions I have for CLP:
> 
> 1) Is Mod_python important if the web site will be very low volume and
> activity? My understanding is Mod_python avoids starting a new process for
> each CGI execution. This may not be that important in my uses. Any other
> reasons to require Mod_python?
> 2) Is it important that the web host provide certain Python modules or is it
> just as easy to install those modules I need in my own directories and
> access them through PYTHONPATH? Are there certain Python-related
> technologies that must be installed by the host and cannot be installed by
> the user in their home directories?
> 
> I have found a potential hosting company, http://www.hostignition.com , that
> offers Python, Perl, PHP4, and JSP/Servlets for $5/month. This seems almost
> too good to be true. Any thoughts?
> 
> Any other advice on this search?
> 
> Thanks,
> 
> Dave Butler

-- 
Ben Logan: ben at wblogan dot net
OpenPGP Key KeyID: A1ADD1F0



From timcera at earthlink.net  Sun Dec 30 09:34:52 2001
From: timcera at earthlink.net (Tim Cera)
Date: 30 Dec 2001 06:34:52 -0800
Subject: Paramaterized local variable name
References: <9c3f2e9c.0112292115.6a4e22af@posting.google.com> <3C2EA509.63ACDDC9@earthlink.net>
Message-ID: <9c3f2e9c.0112300634.6e2c1ef6@posting.google.com>

Hans Nowak  wrote
> You probably want
> 
>   start = getattr(data[key][i], local_name)
> 
> Now you can set local_name to a string "name" or "rev"
> or whatever attribute of data[key][i] you want to
> access.

Works great!

THANKS!

Thanks also to Sean for the 'exec' based solution.

take care
Tim Cera


From paul at boddie.net  Tue Dec  4 06:00:16 2001
From: paul at boddie.net (Paul Boddie)
Date: 4 Dec 2001 03:00:16 -0800
Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)
References:         
Message-ID: <23891c90.0112040300.77f64f8e@posting.google.com>

Steve Lamb  wrote in message news:...
> On Sun, 2 Dec 2001 20:13:37 -0600, Jeff Hinrichs  wrote:
> > my 0.02$US:
> > Actually, spaces are the problems not tabs.  A tab is a tab, where is
> > indenting by spaces....hmm.
> 
>     No, a tab isn't a tab.

It's hard to know what you're getting at here. Is this the ultimate
form of denial? :-)

The Tab key (or whatever symbol is used on your keyboard to denote it)
is commonly used to move the cursor to a particular location, whether
it be the next field in a form, or whether it be to a particular
horizontal position in a human-readable textual document. On my
keyboard, the symbol used is an arrow pointing to a vertical line
which indicates a well-defined location.

In neither of the two examples given above does use of the Tab key
correspond to any number of spaces - one doesn't move 8 spaces to the
next field in a form, nor does one set a tabstop in a word processor
to 4cm under the illusion that 4cm now means any particular number of
spaces.

> > You should be able to configure your editor to display tabs in a width that
> > is to your liking WITHOUT mucking with the data.
> 
>     As you just said, "You should be able to configure your editor to display
> tabs..."  Oh, so a tab isn't a tab.  I like indention of 4 so my tab is 4
> spaces.  You like 8 so yours is 8 spaces.  A tab is not a tab.  A tab is a
> collection of spaces, visually.

A tab causes movement to the next defined horizontal position on the
current line. Text editors often define these positions at intervals
which are a number of spaces apart in the current font, but that does
not mean that they are in any way equivalent to spaces. Moreover,
depending on where the cursor is when the Tab key is pressed, the
horizontal movement can vary depending on the distance between the
current cursor position and the next tabstop.

>     Now, if you had read my post you would have seen where your whole "a tab
> is a tab" bubbub breaks down.  Here it is AGAIN since you missed it the first
> time.
> 
> some_dict = {'Jane':{'Age':'21', 'Dept':'0001', 'Ext':'1234'},
>              'John':{'Age':'22', 'Dept':'0010', 'Ext':'5678'},
>              'Jeff':{'Age':'23', 'Dept':'0100', 'Ext':'9009'},
>              'Jody':{'Age':'24', 'Dept':'1000', 'Ext':'8765'},
>              'Jeny':{'Age':'25', 'Dept':'0110', 'Ext':'4321'}
>             }
> 
>     With spaces that always comes out the same.  With tabs set to different
> lengths you get different results.  The only constant when it comes to
> indention is a space.  A space is a space.  A tab is not constant and
> therefore should NOT be used for indention.  Ever.

Indentation isn't at all important with respect to the correct
interpretation of the above statement (which is the real issue here),
but I've long suspected that you don't have a real argument to bring
to the table.

>     Indention isn't about preference, it is about making the code readable.
> And as the above example shows, readable code could be rendered unreadable by
> tab "preferences".

You're wasting your time making code "art" just as I could be wasting
my time explaining to you what a tab is. In short, we're both wasting
our time.

Paul


From claird at starbase.neosoft.com  Thu Dec 27 19:46:34 2001
From: claird at starbase.neosoft.com (Cameron Laird)
Date: 27 Dec 2001 18:46:34 -0600
Subject: REPOST: Re: A new forum is up! Q: what means nntp
References: <40dbad98.0112262238.73fc14f9@posting.google.com>  <3C2B941D.B1E45AA5@htp-tel.de> 
Message-ID: <5$--$$_----__-_-%$@news.noc.cabal.int>

In article , Aahz Maruch  wrote:
>In article <3C2B941D.B1E45AA5 at htp-tel.de>,
>Tom Karas   wrote:
>>
>>What means nntp ?
>
>It's a protocol for transferring netnews articles, the way HTTP is a
>protocol for transferring HTML documents.  For more information, poke
>around Google.
			.
			.
			.
Before that, let me suggest 
for its focus on "the end-user exper-
ience".
-- 

Cameron Laird 
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: claird at starbase.neosoft.com (Cameron Laird)
Newsgroups: comp.lang.python
Subject: cmsg cancel <12A9BC72F498525B.53DB158BB2A96C03.580B237ADC0BA1FF at lp.airnews.net>
Control: cancel <12A9BC72F498525B.53DB158BB2A96C03.580B237ADC0BA1FF at lp.airnews.net>
Date: Mon, 31 Dec 2001 01:53:11 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775477 27193 211.57.49.2 (31 Dec 2001 05:11:17 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:11:17 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From donn at u.washington.edu  Fri Dec 21 17:20:45 2001
From: donn at u.washington.edu (Donn Cave)
Date: 21 Dec 2001 22:20:45 GMT
Subject: Modifying environment variables
References: 
Message-ID: 

Quoth Terry Hancock :
...
| However, all this work is wasted, because after
| I leave the script, the PATH is unaffected. It
| seems that assigning values to os.environ['PATH']
| can affect subshells, but not the one I'm running
| the script from.
|
| Is there a way to get around this limitation? It
| would be a lot nicer if I could just call the
| script from the users' .cshrc file (I should've
| mentioned that they are invariably using csh or
| tcsh).

Right, it does no good to modify the environment.  You have to
write the value to output, and read it into PATH from the shell -
like  % setenv PATH `fudgepath`

	Donn Cave, donn at u.washington.edu


From keyton at weissinger.org  Fri Dec 14 08:01:00 2001
From: keyton at weissinger.org (A. Keyton Weissinger)
Date: Fri, 14 Dec 2001 08:01:00 -0500
Subject: PythonWare: Anyone using for real projects?
In-Reply-To: <3C19EC50.153B76A1@doc.ic.ac.uk>
Message-ID: 

Besides the pythonworks team, of course...

I read this review:
http://www.webreview.com/2001/07_20/developers/index02.shtml

and have stayed away. I am using the BlackAdder beta and so far am
unimpressed (though in their defense it is a beta).

I've not used ActiveState's VisualPython. I've always liked the slickness of
VStudio, but hated the handcuffs. We'll see if the .NET version is any
better.

I know Pythonware 1.3 is out. Does it address the issues in the review>? I
will do my homework on this as well, but wanted to see if anyone out there
had answered the question already...

Thank you!!!

Keyton

-----Original Message-----
From: python-list-admin at python.org
[mailto:python-list-admin at python.org]On Behalf Of Benjamin Tai
Sent: Friday, December 14, 2001 7:11 AM
To: python-list at python.org
Subject: what is self._base?


Hi,

I have come across the following statement in a constructor (Programming
Python by Mark Lutz). After extending a type in C (stacktype), it is
wrapped by a Python class (Stack).

import stacktype
class Stack:
  def __init__(self, start=None):
    self._base = start or stacktype.Stack()

However I can't find any documents/explanation for the following:

1) What is  "_base"
2) What is  "start=None"
3) Why can't I just write  "self = stacktype.Stack()"


Any help for this newbie would be appreciated.

Ben

--
http://mail.python.org/mailman/listinfo/python-list





From marco.stagno at libero.it  Wed Dec 19 16:03:24 2001
From: marco.stagno at libero.it (Marco Stagno)
Date: Wed, 19 Dec 2001 21:03:24 GMT
Subject: implementing a timer?
References: <9vn0gv$ll6$1@colo.mobo-it.nl>  
Message-ID: <5lv12u4tu9d4opbs2fh8r43hrejc19hp6t@4ax.com>

>I'm interested to see your code.

I'll send you it tomorrow (via mail)... I forgot it at the office ;)

bye ;)

                                  MAS!



From mwh at python.net  Tue Dec 25 16:32:21 2001
From: mwh at python.net (Michael Hudson)
Date: Tue, 25 Dec 2001 21:32:21 GMT
Subject: How best to check for existance of an attribute?
References: 
Message-ID: 

Roy Smith  writes:

> I've got a function which augments an object passed to it by adding a new 
> attribute.  Something like this:
> 
> def addStuff (obj):
>    obj.newAttr = "stuff"
> 
> I want it to be an error to call addStuff() more than once for a given 
> object.  The simpliest way to do this would be with something like perl's 
> defined() function:
> 
> def addStuff (obj):
>    if defined (obj.newAttr):
>       raise MultipleCallError
>    else:
>       obj.newAttr = "stuff"
> 
> What's the best way to simulate defined()?

By using hasattr?

bash-2.00$ python -c "print hasattr.__doc__"
hasattr(object, name) -> Boolean

Return whether the object has an attribute with the given name.
(This is done by calling getattr(object, name) and catching exceptions.)

> I could think of a few possibilities.  For example, either of the
> following seem like they would work:
[...]
> def addStuff (obj):
>    try:
>       obj.newAttr
>       raise MultipleCallError
>    except AttributeError:
>       obj.newAttr = "stuff"

This is more-or-less what hasattr does, but hasattr() almost certainly
expresses your intent better.

Cheers,
M.


From fredrik at pythonware.com  Thu Dec 13 04:46:46 2001
From: fredrik at pythonware.com (Fredrik Lundh)
Date: Thu, 13 Dec 2001 09:46:46 GMT
Subject: Problems using tkSimpleDialog
References: <314b29e9.0112110704.1b42edd4@posting.google.com> <9v5boc$2auh$1@norfair.nerim.net> <314b29e9.0112120139.5d613628@posting.google.com>
Message-ID: 

Simon Brunning wrote:
> Thanks Eric. That does help. Problem is, the Tkinter.Tk() thing brings
> up an empty parent window, which I don't want. Ah well, back to the
> drawing board!

quick fix: create the root window, and immediately remove it:

    root = Tkinter.Tk()
    root.withdraw()

    ... tkSimpleDialog stuff follows ...








From phd at phd.pp.ru  Sun Dec  9 05:05:00 2001
From: phd at phd.pp.ru (Oleg Broytmann)
Date: Sun, 9 Dec 2001 13:05:00 +0300
Subject: urllib and httplib wan to use my modem instead of the ethernet
In-Reply-To: <70ccd34d.0112081712.e70df5d@posting.google.com>; from amurphy@megapathdsl.net on Sat, Dec 08, 2001 at 05:12:10PM -0800
References: <70ccd34d.0112081712.e70df5d@posting.google.com>
Message-ID: <20011209130500.C11375@phd.pp.ru>

On Sat, Dec 08, 2001 at 05:12:10PM -0800, Alex wrote:
> url="http:\\www.org.python\index.htm"

   You did two errors here. First, this is wrong syntx for an URL: URLs
uses slashes /, not backslshes \. Damn M$ tricked you.
   Alose please understand that Python compiles this into a different
string, because \chr is a specil sequence in Python.

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.



From clpy at snakefarm.org  Mon Dec 10 11:06:27 2001
From: clpy at snakefarm.org (Carsten Gaebler)
Date: Mon, 10 Dec 2001 17:06:27 +0100
Subject: Can't catch SIGUSR1
References: <3C14CB36.F857A0E6@snakefarm.org> 
Message-ID: <3C14DD83.874CC6F@snakefarm.org>

Michael Hudson wrote:

> Is one Python built with threading and the other not?  I thought
> pthreads used SIGUSR1 for something.

They're both built with threading.

cg.


From browndg at fe01.math  Tue Dec 11 14:13:19 2001
From: browndg at fe01.math (dan brown)
Date: 11 Dec 2001 14:13:19 -0500
Subject: Can't successfully install 2.1.1--dies in socket module
Message-ID: 

Hi there,

I wish I were able to solve this myself, but I can't, despite searching the
Google archive for similar problems.

I'm trying to install 2.1.1 on a SunOS 5.7 workstation.  I'm in Canada,
which might explain the problem I'm having; all the previous times I've
installed Python have been in the US.

Basically, the procedure dies while trying to compile the socket module: 

...
building '_socket' extension
skipping /fsys1/u1/browndg/Python-2.1.1/Modules/socketmodule.c (build/temp.solaris-2.7-sun4u-2.1/socketmodule.o up-to-date)
gcc -shared build/temp.solaris-2.7-sun4u-2.1/socketmodule.o -L/usr/local/lib -lssl -lcrypto -o build/lib.solaris-2.7-sun4u-2.1/_socket.so
Text relocation remains                 	referenced
    against symbol		    offset	in file
                           0x4       	/usr/lib/libssl.a(ssl_ciph.o)
                           0x2c      	/usr/lib/libssl.a(ssl_ciph.o)
                           0x54      	/usr/lib/libssl.a(ssl_ciph.o)
                           0x7c      	/usr/lib/libssl.a(ssl_ciph.o)
                           0xa4      	/usr/lib/libssl.a(ssl_ciph.o)
                           0xcc      	/usr/lib/libssl.a(ssl_ciph.o)
                           0xf4      	/usr/lib/libssl.a(ssl_ciph.o)
                           0x11c     	/usr/lib/libssl.a(ssl_ciph.o)
[there follow thousands of lines of the same, some referencing other
modules instead.]

I don't know if this is because of a crypto export restriction, or what,
but it'd be a huge help if I could get this working.  Can anyone out there
supply ideas?  Thanks muchly.

-dan brown                                        
 browndg at uwaterloo.ca       
 Computer Science Dept.
 University of Waterloo


From setar at gmx.de  Fri Dec 28 11:47:05 2001
From: setar at gmx.de (Oliver Hofmann)
Date: 28 Dec 2001 08:47:05 -0800
Subject: [Q] Deepcopy with Python 2.2 ?
Message-ID: <440c5c6a.0112280847.55c92de7@posting.google.com>

'lo everyone!

I've had a few problems with copying objects lately when they 
reference each other. My understanding is that deepcopy should 
take care of that due to the memo - dictionary; this does not 
seem to be the case. 

The following code works fine if Base does _not_ inherit 
from object. If it does the result is:

RuntimeError: maximum recursion depth exceeded

Any help would be appreciated!

Thanks,

     Oliver


---8<-----
import copy

class Base(object):
    def __init__(self):
        self.parent = None
        object.__init__(self)

class Hit(Base):
    def __init__(self):
        self.hsps = []
        Base.__init__(self)
    
class HSP(Base):
    def __init__(self):
        self.data = [1, 2, 3]
        Base.__init__(self)

def main():
    a = Hit()
    b = HSP()
    c = HSP()
    d = HSP()
    a.hsps.extend([b, c, d])
    b.parent = a
    c.parent = a
    d.parent = a

    z = copy.deepcopy(a)

if __name__ == '__main__':
    main()


From phd at phd.pp.ru  Wed Dec 12 02:03:40 2001
From: phd at phd.pp.ru (Oleg Broytmann)
Date: Wed, 12 Dec 2001 10:03:40 +0300
Subject: Help newbie!
In-Reply-To: <9v60ho$5qu$1@peabody.colorado.edu>; from fperez528@yahoo.com on Tue, Dec 11, 2001 at 03:14:35PM +2328
References: <9v5t5g$sp2$1@news.hccnet.nl>  <9v60ho$5qu$1@peabody.colorado.edu>
Message-ID: <20011212100340.A30635@phd.pp.ru>

On Tue, Dec 11, 2001 at 03:14:35PM +2328, Fernando P?rez wrote:
> No need to import anything:
> new_string = 'hello'.replace('hel','hol')

>>> new_string = 'hello'.replace('hel','hol')
Traceback (innermost last):
  File "", line 1, in ?
AttributeError: 'string' object has no attribute 'replace'

   (Python 1.5.2, of course).

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.



From brian.lloyd at zope.com  Fri Dec 14 15:45:58 2001
From: brian.lloyd at zope.com (Brian Lloyd)
Date: Fri, 14 Dec 2001 15:45:58 -0500
Subject: python and SOAP??
In-Reply-To: 
Message-ID: 

> I saw at soapware.org, that there are at least 2 SOAP implementations
> for python supporting both client and server development.
> 
> one is SOAP.py in version 0.97 from Cayce Ullman and Brian Matthews. 
> and the other is a implementation from pytonware.
> 
> does anybody have experience with these modules???
> 
> the latest stable version of the pythonware module is 18 months old.
> is this project dead????
> 
> the SOAP.py seems to be under active development.
> 
> can anybody recommend me which one to choose???
> or what the differences are??

If you're interested, I've been plodding along on a comprehensive 
SOAP / Web Services package:

http://dev.zope.org/Wikis/DevSite/Projects/WebServicesForZope/

http://cvs.zope.org/Packages/WebService/

(Note that the python package is not Zope-specific in any way).

It's probably not quite ready for real-world use yet, but I thought 
I'd mention it in an effort to solicit feedback from Python folks 
interested in web services.

You should also look at ZSI (Zolera SOAP Infrastructure) at:

http://sourceforge.net/projects/pywebsvcs/



Brian Lloyd        brian at zope.com
Software Engineer  540.361.1716       
Zope Corporation   http://www.zope.com





From quickdry at users.sourceforge.net  Mon Dec 10 19:43:19 2001
From: quickdry at users.sourceforge.net (Quick Dry)
Date: Tue, 11 Dec 2001 11:43:19 +1100
Subject: run Tkinter app with no console window?
References: <9v3bhv$m4e$1@news.harvard.net>
Message-ID: <3c1554ef$0$9870$afc38c87@news.optusnet.com.au>

"Carty Castaldi"  wrote in message
news:9v3bhv$m4e$1 at news.harvard.net...
> Hi.  I am just learning python and like it quite a bit.  I have written
some
> small/useful apps with Tkinter UIs and would like to be able to run them
on
> Windows with no console window or the console window completely hidden.
Any
> help appreciated.

if you rename the top level python program to have the extension '.pyw' then
it should run without the console appearing.

If you look in the directory you have your Python interpreters you should
see 'python.exe', and also 'pythonw.exe' using this to run your script
instead of the normal interpreter won't bring up the console.

Steven




From ssthapa at classes.cs.uchicago.edu  Thu Dec 27 17:17:25 2001
From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa)
Date: Thu, 27 Dec 2001 22:17:25 GMT
Subject: ANNOUNCE: ciphon 0.3.5
Message-ID: 

    I've completed ciphon 0.3.5.  Ciphon is an utility to provide features
similar to the perl CPAN shell.  It lets you automatically download and
install python modules.

Changes:
Readline is now optional
Several bugs have been fixed (installation of rpms, errors with missing 
    the installed.xml file)
The configuration is now saved after the first start up if the ~/.ciphonrc
    file is not present
A few other bugs in installing and determining whether a package is current
    have been fixed

Ciphon is available from ftp.community.tummy.com in /pub/python-packages, 
or from sourceforge (https://sourceforge.net/projects/pythonsiphon/), or
from within ciphon itself.

There are still some problems with rpm installations due to modules
not listing all their files.  However, standard installation should
work and I have received reports of successful installations using 
standard installations.

There is also a mailing list for ciphon available at sourcefoge.  The
signup page is at 
http://lists.sourceforge.net/lists/listinfo/pythonsiphon-devel

-- 
----------------------------------------------------------------------------
	   		              |
Suchandra Thapa                       | "There are only two kinds of math . 
s-thapa-11 at NOSPAMalumni.uchicago.edu  | books. Those you cannot read beyond 
			              | the first sentence, and those you 
			              | can not read beyond the first page."
			              |                     -C.N. Yang
----------------------------------------------------------------------------


From quinn at chunder.ugcs.caltech.edu  Mon Dec  3 17:37:13 2001
From: quinn at chunder.ugcs.caltech.edu (Quinn Dunkan)
Date: 3 Dec 2001 22:37:13 GMT
Subject: A modest indentation proposal
References:   
Message-ID: 

On Mon, 3 Dec 2001 11:23:09 +0100, Andreas Kostyrka  wrote:
>> The latest changes in 2.2 do a lot to address this, I think.  At the cost
>> of two kinds of classes and method lookup rules and a semi smalltalk style
>Well, old style classes will be depracted some time in the future. Being so 
>fundamental as it is, it will take a long time.

I'd be kind of surprised if we ever get rid of classic classes.  If you think
there was a lot of noise about integer division a while back...

While premature optimization may be the root of all evil, I think maintaining
backward compatibility while trying to "fix" old mistakes is another.  You
just keep accumulating gunk.

>> Since new magic attributes seem to pop up every day, what about existing
>> __getattr__-using code that had all the holes patched up, but is now going
>> to explode because suddenly python wants to look up an __eq__ method where
>> it never did before?
>well, I personally prefer this design:
>def __getattr__(self,k):
>  # special ones we need to deal with.
>  if k=="__repr__":
>    pass
>  elif k.startswith("__"):
>    raise AttributeError,k
>  else:
>    # deal here with the "normal" stuff
>    pass

Yeah, but that won't help much for delegation, like:

def __getattr__(self, k):
    return getattr(self.__data, k)

Oh wait!  What if '__data' is a list (and we're not in 2.2 yet)?  Now we need:

def __len__(self):
    return len(self.__data)
def __delitem__(self, k):
    del self.__data[k]
... etc. ...

Or what if __getattr__ is supposed to force a lazy object?  Now they all need
to be:

def __getattr__(self, k):
    self.__force() # handle memoization etc.
    return getattr(self.__data, k)
def __len__(self):
    self.__force()
    return len(self.__data)
def __del__(self):
    pass # *don't* force!
def __cmp__(self, other):
    self.__force()
    return cmp(self.__data, other)
... etc. ...

I solved the above with:

class Lazy_attr:
    def __init__(self, attrs):
        'attrs is [(f_to_set_attr1_attr2, (attr1, attr2))]'
        self.__attrs = list(attrs)
    def __getattr__(self, attr):
        for i in range(len(self.__attrs)):
            f, attrs = self.__attrs[i]
            if attr in attrs:
                f()
                del self.__attrs[i]
                return getattr(self, attr)
        else:
            raise AttributeError(attr)

... where f() is expected to set the attribute, thus avoiding the __getattr__
overhead in subsuquent lookups.


From bkc at Murkworks.com  Mon Dec 31 10:00:26 2001
From: bkc at Murkworks.com (Brad Clements)
Date: Mon, 31 Dec 2001 10:00:26 -0500
Subject: CEPort: I Need help with compile.c bug
References: <3c2f4102_5@news.newsgroups.com> 
Message-ID: <3c307e25$1_9@news.newsgroups.com>

Okay, here's the "DUH".

compile.c converts strings to ints.. if there's an error, it converts them
to longs. I've made some changes to the CE port because there's no errno
(not exactly).. Those changes weren't complete, so int's would always be
loaded as longs because compile.c would always think there was an error.

Eventually I fixed that problem, but by then all the test .py files had been
compiled, so when I re-ran the tests, the .pyc's had long constants.

That's why deleting the .pyc's appeared to "fix" the problem. The real fix
was made a few days ago, but I couldn't see it .. Duh!

--
Brad Clements, DevNet Sysop 5
Developer Network Sysop Team


"Brad Clements"  wrote in message
news:mailman.1009748075.13711.python-list at python.org...
> Duh..
>
> Just quietly ignore this post please ...
>
>
> (fyi, helpful to delete old .pyc files from old releases.. why they're not
recompiled, I don't
> know..but seems to work now)
>
> (will now checkout the recompile issue)
>
>
> Brad Clements,                bkc at murkworks.com   (315)268-1000
> http://www.murkworks.com                          (315)268-9812 Fax
> netmeeting: ils://ils.murkworks.com               AOL-IM: BKClements
>
>




-----=  Posted via Newsfeeds.Com, Uncensored Usenet News  =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
 Check out our new Unlimited Server. No Download or Time Limits!
-----==  Over 80,000 Newsgroups - 19 Different Servers!  ==-----


From grey at despair.dmiyu.org  Fri Dec 28 15:26:51 2001
From: grey at despair.dmiyu.org (Steve Lamb)
Date: Fri, 28 Dec 2001 20:26:51 -0000
Subject: REPOST: Re: Python Popularity: Questions and Comments
References: <3C2A9D33.67FEC261@earthlink.net> <32c382ad.0112272324.4c78689b@posting.google.com> <3C2C88A6.9D13A3D6@earthlink.net>
Message-ID: <6$--$$_-----$%$__$@news.noc.cabal.int>

On Fri, 28 Dec 2001 15:04:12 GMT, Hans Nowak  wrote:
>
> I'm pretty sure 1.5.2 had strip already...
>

    According to the Beazley book it did.

-- 
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
         ICQ: 5107343          | main connection to the switchboard of souls.
    To email: Don't despair!   |  -- Lenny Nero, Strange Days
-------------------------------+---------------------------------------------

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Steve Lamb 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 05:00:41 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775087 27193 211.57.49.2 (31 Dec 2001 05:04:47 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:04:47 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From kragen at pobox.com  Sat Dec  1 04:44:33 2001
From: kragen at pobox.com (Kragen Sitaker)
Date: 01 Dec 2001 04:44:33 -0500
Subject: Scientific Libraries in Python
References:  <9t1iqq$es0$2@peabody.colorado.edu> <3BF45CAF.9983E26A@home.net>   <7a8L7.5503$_J2.576156@news1.cableinet.net>
Message-ID: <83n113tgu6.fsf@panacea.canonical.org>

bjgough at network-theory.spam.trap.co.uk (Brian Gough) writes:

> On Thu, 22 Nov 2001 01:08:06 +0530, Prabhu Ramachandran  wrote:
> >>>>>> "BG" == Brian Gough  writes:
> >    BG> The Python License is GPL-compatible, and the Python-GSL
> >    BG> wrappers are under the GPL so there's no problem in using GSL
> >    BG> with Python.
> > 
> > True but that's not exactly the problem.  SciPy is released under a
> > BSD license, so can SciPy use GSL internally?  I guess not.
> 
> Right.  Applications which use GPL-ed libraries need to be under the
> GPL if they are distributed.

If SciPy is licensed under a BSD-like license, then there is no legal
obstacle to distributing an extended version of SciPy under the GPL.
There may, however, be political obstacles to making that extended
version the new SciPy.

Personally, I'd be delighted.



From tim.one at home.com  Thu Dec 20 21:36:43 2001
From: tim.one at home.com (Tim Peters)
Date: Thu, 20 Dec 2001 21:36:43 -0500
Subject: age of new pythonistas
In-Reply-To:                 
Message-ID: 

[Bengt Richter]
> What I wonder about is the dev group, starting with Guido and Tim ;-)

[Mark Hammond]
> Guido is a few years older than me, and Tim a few years older than him :)

[Lulu of the Lotus-Eaters]
> I've wondered that myself, from time to time.

Oh, you're not the only one!  I wonder acutely at times.  Alas, while Mark did
a masterful job of deducing the relationships among our ages, it's the only
clue we've got -- until Mark reveals his own age, Guido and I are as baffled as
everyone else.  I suspect Fredrik Lundh also knows Mark's age, but you've seen
how hard it is to get a straight answer from a bot.

> In Guido's case, it seems fairly easy to ballpark (maybe just from recent
> pictures).  His resume at http://www.python.org/~guido/Resume.html provides
> some guidelines.
> ...
> Guessing the MA came right after a college degree, he was probably around 23
> in 1977.

Stuff and nonsense.  I know for a fact that Guido recently had his first child.
Given the notorious and shameful lack of self-restraint among the Dutch, *I*
figure that proves he was about 13 years old approximately 10 months ago.
Indeed, I wouldn't be surprised a bit if his son became older than him as early
as next year.

old-enough-not-to-remember-ly y'rs  - tim




From bryder at afilias.info  Thu Dec  6 10:16:50 2001
From: bryder at afilias.info (bryder at afilias.info)
Date: 6 Dec 2001 15:16:50 GMT
Subject: zope external method question...
Message-ID: <9uo252$lh8$1@news.netmar.com>

Can anyone tell me what might prevent the standard Python external methods in
Zope not to work?  Specifically, no matter what I do when I try to create the
external method in the Zope UI it tells me it can't find the module.  and,
this is in an environment where Perl unrestricted methods ARE working.

I'm thinking maybe there is a conf. file setting somewhere that turns python
external methods on or off?  Anyone have any ideas?

Email much appreciated.  I contribute to several newsgroups but I'm not
typically at this one.  Also, please let me know if there are more
appropriate newsgroups for this question.  Thanks!

-Bill Ryder
bryder at afilias.info



 -----  Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web  -----
  http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
   NewsOne.Net prohibits users from posting spam.  If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse at newsone.net


From amberdelton at email.msn.com  Sun Dec  2 22:48:33 2001
From: amberdelton at email.msn.com (amberdelton)
Date: Sun, 2 Dec 2001 20:48:33 -0700
Subject: Very new to this
References: <#k0oOh4eBHA.1192@cpimsnntpa03> <#EQGkj4eBHA.1188@cpimsnntpa03> <3C0AB92D.2010407@home.com> <#3jVur4eBHA.1404@cpimsnntpa03> <3C0AEF74.3080005@home.com>  <3C0AF54B.8070301@home.com>
Message-ID: 

Are there any good books or web sites that you could suggest for a beginner?
I have never programmed before, this is my first try at it.  Thanks for all
the help.




From nika at kassube.de  Mon Dec 24 06:42:50 2001
From: nika at kassube.de (Nils Kassube)
Date: 24 Dec 2001 12:42:50 +0100
Subject: O'Reilly's Python and XML
References: 
Message-ID: <87itawalol.fsf@kursk.kassube.de>

"A. Keyton Weissinger"  writes:
 
> I just snagged a copy of _Python and XML_, a new release from O'Reilly.
> Excellent book. Pulls together quite a range of XML tips and tricks. There

I'm still waiting for my copy from Amazon Germany. Is the book on sale
now? Or did you have to bribe someone?

Cheers,
Nils


From logiplexsoftware at earthlink.net  Sat Dec 29 17:54:30 2001
From: logiplexsoftware at earthlink.net (Cliff Wells)
Date: Sat, 29 Dec 2001 14:54:30 -0800
Subject: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.)
In-Reply-To: <871yhd7red.fsf@kursk.kassube.de>
References: <3C2A9D33.67FEC261@earthlink.net>
	<3C2BA7B8.35286DE3@earthlink.net>
	<3c2de385.9780406@news.t-online.de>
	
	<3c2deb81.11823921@news.t-online.de>
	<871yhd7red.fsf@kursk.kassube.de>
Message-ID: <20011229145430.4004b628.logiplexsoftware@earthlink.net>

On 29 Dec 2001 20:33:30 +0100
Nils Kassube  wrote:

> C and programmers who like C should die a slow and painful death for
> holding back the computer industry for two decades.  

My PC will need to be a _lot_ faster before it can run an OS written in
Python... maybe you should retarget that statement at programmers who
develop run-of-the-mill applications in C.  Like any other language, C has
places where it shines and places where it isn't really appropriate.

-- 
Cliff Wells
Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308
(800) 735-0555 x308



From jason-dated-1010187114.f93b86 at mastaler.com  Fri Dec 21 18:31:54 2001
From: jason-dated-1010187114.f93b86 at mastaler.com (Jason R. Mastaler)
Date: Fri, 21 Dec 2001 16:31:54 -0700
Subject: ANN: TMDA 0.43 - SPAM reduction system (now supports SENDMAIL)
Message-ID: 

TMDA now supports the Sendmail MTA in addition to qmail, Postfix and Exim.

  TMDA is an OSI certified Python application designed to
  significantly reduce the amount of SPAM/UCE you receive. TMDA
  combines a "whitelist" (for known/trusted senders), a "blacklist"
  (for undesired senders), and a cryptographically enhanced
  confirmation system (for unknown, but legitimate senders). TMDA
  strives to be more effectual, yet less time-consuming than
  traditional filters.

For more information including a demonstration, download locations and
installation instructions, visit the TMDA homepage:

  

Enjoy,

Jason R. Mastaler
      

TMDA 0.43 - SPAM reduction system (21-Dec-2001) From jason at jorendorff.com Wed Dec 5 17:05:13 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Wed, 5 Dec 2001 16:05:13 -0600 Subject: Python - string to hexbytes conversion - help In-Reply-To: Message-ID: "me" wrote: > I'm a newbie to Python and I am trying to convert a string of > decimal numbers - read from raw_input to a series of hexbytes def convert(src): result = '' for i in range(0, len(src), 2): slice = src[i:i+2] n = int(slice, 16) result += chr(n) return result I think this is what you want but it's hard to tell from your post. -- Jason Orendorff http://www.jorendorff.com/ From aahz at panix.com Wed Dec 26 19:07:21 2001 From: aahz at panix.com (Aahz Maruch) Date: 26 Dec 2001 16:07:21 -0800 Subject: REPOST: Re: references for shifting from Py1.5.2 to Py2.2? References: <3c2a5cd1_2@corp.newsgroups.com> Message-ID: <9$--$$-$$$$%_%__%$@news.noc.cabal.int> In article <3c2a5cd1_2 at corp.newsgroups.com>, Joshua Muskovitz wrote: > >After a long hiatus, I'm returning to the Python community. I haven't >touched Python since 1.5.2, and I'd like to climb the curve to 2.2 as >quickly as possible. What are the definitive references for making the >transition? No beginner books, please. I'm a proficient developer, and I >really understood 1.5.2 pretty well. http://www.amk.ca/python/ Read the articles on 2.0, 2.1, and 2.2. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 5 days and counting ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: aahz at panix.com (Aahz Maruch) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:11:37 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009776019 27193 211.57.49.2 (31 Dec 2001 05:20:19 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:20:19 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From aleax at aleax.it Fri Dec 28 09:58:25 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 15:58:25 +0100 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <889C110F5BBBFAFD.A03B35C232EA2760.70B0892CB9479323@lp.airnews.net> Message-ID: "Cameron Laird" wrote in message news:889C110F5BBBFAFD.A03B35C232EA2760.70B0892CB9479323 at lp.airnews.net... > In article , > Patrick wrote: ... > >They DO ask what compilers and linkers we use! They even > >make suggestions! We make very customized software. > >Some customers write parts of their own code through > >'user exits'. ... > There are times when this is an advantage for Python, > for it is a FAR superior "extension language" to Java > and C. While many aspects of software engineering are > best seen at this point as matters of taste, Python's > superiority in this regard is, I argue, a matter of > objective record. Maybe, but Python could be usable as an extension language even if the application was implemented otherwise, in the right environments (JVM: Jython always usable where Java is; Microsoft COM/Automation). > That's no guarantee of customer acceptance, of course. Yep. If you release only under Windows, and user customization is important, it would be folly not to have an excellent COM Object Model exposed: this way, customers can customize in Python, Visual Basic, Delphi, C++, or whatever else is close to their heart. If you release under the JVM, then at least both Java and Jython are usable. Other environments have other such possibilities (alas, maybe not as mature), such as Corba bindings. If you're not in the business of selling programming languages, but applications, and yet those applications are often used as platforms for customer development, then putting some effort into language independence may widen your customer appeal at not too high a price. Alex From curtin at ubsw.com Sun Dec 16 07:49:16 2001 From: curtin at ubsw.com (craig curtin) Date: 16 Dec 2001 04:49:16 -0800 Subject: quick eval question References: <4c7395cb.0112150728.2275ad75@posting.google.com> <4c7395cb.0112151408.34bd9@posting.google.com> Message-ID: <4c7395cb.0112160449.18a5df6e@posting.google.com> very sad when u follow up on your own posts 3x ;-) well, anyways here is what i learned. when u eval() you must evaluate an entire left hand side. exec() is used for executing a statement within the context of the current interpreter. i was trying to eval just the index part of the below statement ePath ="elements['OUTLOOK']['CREATEDATE']" eEval = "elements['OUTLOOK']['CREATEDATE'] = '12/10/01 17:21:23'" exec(eEval) and eval(ePath) > elements = {} > elements['OUTLOOK'] = {} > elements['OUTLOOK']['CATEGORY'] = 'DEVL_TEST' > elements['OUTLOOK']['AUTHOR'] = {} > elements['OUTLOOK']['AUTHOR']['ADDRESS'] = 'John Smith/Devl' > elements['OUTLOOK']['AUTHOR']['NAME'] = 'Engineering Division' > elements['OUTLOOK']['AUTHOR']['TYPE'] = 'SMTP' > elements['OUTLOOK']['CREATEDATE'] = '12/10/01 17:21:23' > > # now i want a 'path component' > ePath ="['OUTLOOK']['CREATEDATE']" > > # i can't seem to put the dict and path together > print elements+ePath > #print elements eval(ePath) > > #print eval(elements eval(ePath)) > > hope this makes sense, > > craig > > curtin at ubsw.com (craig curtin) wrote in message > > i'm looking to do something like this but my brain is failing... > > > > i = [1,2,3,4,5] > > j = '[2]' > > > > k = eval( i j ) > > > > ie. i want to get k = 3 ... From kragen at pobox.com Sat Dec 1 13:50:10 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 01 Dec 2001 13:50:10 -0500 Subject: Scientific Libraries in Python References: Message-ID: <83g06usrkt.fsf@panacea.canonical.org> Horatio Davis writes: > I was assuming that they'd be distributing SciPy in their distribution. > What do you mean by "political obstacles"? I mean that while it would be legal to license a modified version of SciPy under the GPL and carry further development of SciPy out under that license, people who wanted to use SciPy in proprietary software would be unhappy about such a decision. From James_Althoff at i2.com Wed Dec 5 14:43:07 2001 From: James_Althoff at i2.com (James_Althoff at i2.com) Date: Wed, 5 Dec 2001 11:43:07 -0800 Subject: more fun with PEP 276 Message-ID: Jeremy Cromwell wrote: >James, >Thanks to your hard work, we can play with this implementation and come up >with some new ideas (maybe we'll even come up with a good one!) > >For example by adding different operators: > __lshift__, __rrshift__ = __div__, __rdiv__ > __rshift__, __rlshift__ = __floordiv__, __rfloordiv__ >and setting: > __ = span # in the spirit of ... > >then > > >>> list(3>>__>>9) > [4, 5, 6, 7, 8, 9] > >>> list(3>>__<<9) > [4, 5, 6, 7, 8] > >>> list(3<<__<<9) > [3, 4, 5, 6, 7, 8] > >>> list(3<<__>>9) > [3, 4, 5, 6, 7, 8, 9] > > which allows > > for i in __<< table.rowcount: > for j in __<< table.colcount: > print table.value(i,j) > Thanks very much for the compliment and added ideas. It would be nice if there were a way to use relational operators (or something resembling them as you suggest with << and >>) instead of / and //. The magic method machinery doesn't seem to have quite enough power to enable this. But perhaps something could be done by way of enhancements to make it possible. Your suggestion of using "__" instead of span or "..." could work. I don't know how hard it would be to make "..." legal in a general expression (as in -5 / ... / 5). But "__" works out of the box. :-) Jim From issac at myfirstlink.net Wed Dec 26 17:03:25 2001 From: issac at myfirstlink.net (Issac) Date: Wed, 26 Dec 2001 16:03:25 -0600 Subject: re.match oddity Message-ID: <02df01c18e59$243f5b50$6401a8c0@mojave> A curious thing is happening in my c2py.py script (below). The resulting files contain little ^M's (when viewed with the Windows version of gvim 6.0 but not when viewed with notepad.exe) at the ends of the lines. When I remove the lines line_is_lone_left_curly = re.match(r'^\s*{\s*((//.*)|(/\*.*\*/))?$', line) if line_is_lone_left_curly: pylines[-1] = pylines[-1][:-1] + ':\n' continue the ^M's go away. Does anyone know why? I'm using Python 2.1.1 on Cygwin with Windows 2000. Issac === %< === #!/usr/bin/env python # c2py.py : partial conversion from C to Python import re, sys def c2py(pyfile, cfile): clines = cfile.readlines() pylines = [] for line in clines: # semicolons line = re.sub(r';', '', line) # curly braces line_is_lone_left_curly = re.match(r'^\s*{\s*((//.*)|(/\*.*\*/))?$', line) if line_is_lone_left_curly: pylines[-1] = pylines[-1][:-1] + ':\n' continue line = re.sub(r'{', ':', line) line = re.sub(r'}', '', line) # comments line = re.sub(r'//', '#', line) line_is_blank = re.match(r'^\s*$', line) if not line_is_blank: pylines.append(line) for line in pylines: pyfile.write(line) for cname in sys.argv[1:]: pyname = re.sub(r'\..*$', '.py', cname) print 'generating '+pyname+' from '+cname cfile = open(cname, 'r') pyfile = open(pyname, 'w') c2py(pyfile, cfile) cfile.close() pyfile.close() --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.310 / Virus Database: 171 - Release Date: 12/19/2001 From mkent at atlantic.net Sat Dec 15 16:25:28 2001 From: mkent at atlantic.net (MikeK) Date: 15 Dec 2001 13:25:28 -0800 Subject: Python CPAN beta test References: Message-ID: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) wrote in message news:... > I've gotten ciphon to the point where I tihnk it's ready for beta > testing ... I've been looking forward to something like this for some time, and of course, I was quick to download it and try it out. First, I had to get and install GNU readline, and Expat, but that was no real problem. Then, I told ciphon (or is it siphon? It's called both in various places) to use RPMs. That was a mistake. Not one package installed. But when I tried again, telling it NOT to use RPMs, everything was smooth sailing. Here's the tail end of an attempt to install egenix-mx-base using RPMs, where the error occurs. If you need more info, email me: moving build/bdist.linux-i686/rpm/SRPMS/egenix-mx-base-2.0.2-1.src.rpm -> dist moving build/bdist.linux-i686/rpm/RPMS/i686/egenix-mx-base-2.0.2-1.i686.rpm -> dist error: cannot open file egenix-mx-base.rpm: No such file or directory Error installing package: Installing package Giving up... siphon> Keep up the good work. Michael Kent mkent at atlantic.net From vvainio at karhu.tp.spt.fi Thu Dec 27 07:56:41 2001 From: vvainio at karhu.tp.spt.fi (Ville Vainio) Date: 27 Dec 2001 14:56:41 +0200 Subject: REPOST: Re: age of new pythonistas [was: The Editor Poll results are in!] References: <60c49aa9.0112202148.7218555b@posting.google.com> Message-ID: <5$--$$_----_%-%-$$@news.noc.cabal.int> Tim Hammerquist writes: > > I think Python is great because it is well designed (unlike Perl), > > Wait, didn't you give up on Perl before you knew it well enough to make > that kind of statement? One really doesn't have to know all that much about perl to make that statement - reading "Programming Perl" or some other perl book is enough. Ditto with TCL. When I see 8 backslashes in a row, I look elsewhere ;-). -- Ville Vainio - http://www.tp.spt.fi/~vvainio - ICQ #115524762 Wild geese have no intention to cast a reflection Water has no mind to assume their form ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ville Vainio Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:36:16 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775798 27193 211.57.49.2 (31 Dec 2001 05:16:38 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:16:38 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From schull at digitalgoods.com Sun Dec 9 12:30:38 2001 From: schull at digitalgoods.com (Jon Schull) Date: 9 Dec 2001 09:30:38 -0800 Subject: 11-15 new Python Books on the way! (fwd) References: <2621b014.0112081725.29ab24e8@posting.google.com> Message-ID: <2621b014.0112090930.12bcbba3@posting.google.com> "Bruce Eckel" wrote in message news:... > There's a chapter in "Thinking in Patterns" (downloadable from > http://64.78.49.204/) that might help, although it does assume you > know something about Java, sorry. Plus many people have found > "Thinking in Java" (also downloadable from the same site) to be > helpful in understanding that language. I don't feel bad tooting my > horn, since it's free, so no risk on your part. > This is good stuff and useful. Still it strikes me as an interesting opportunity (but for the lack of a magical API documentation conversion utility) that one should, in principal, be able to use Jython and all the Java libraries without learning to read Java. > *********** REPLY SEPARATOR *********** > > On 12/8/01 at 5:25 PM schull at digitalgoods.com wrote: > > >I'm pleased to hear of a specifically-Jython book. > > > >As a python programmer interested in accessing java libraries, and > as > >a NON > >-java programmer I’m “shocked and amazed” at the > >Byzantine nature of java documentation, and code. > > > >Has anyone written a “guide to jython for non-java > >programmers?”. > > > >Or might one of the java bean programming environments offer a > good > >“entry way?” > > > >Or is it hopeless to suppose that one could learn to use java > >libraries, frameworks and beans without learning to read and write > >java? > > > > > >LLewin at oreilly.com (Laura Lewin) wrote in message > >news:... > >> This is a great list! You can also add Jython Essentials, > O'Reilly, > >> Samuele Pedroni and Noel Rappin. The book is due out in March. > >> Laura > >> LLewin at oreilly.com > >> > >> > Ron Stephens wrote: > >> > |Truly a surfeit of books. But, for what it is worth, I have > listed > all I > >> > |could find out about them all at > http://www.awaretek.com/plf.html > >> > > >-- > >http://mail.python.org/mailman/listinfo/python-list > > > > Most current information can be found at: > http://www.mindview.net/Etc/notes.html > =================== > Bruce Eckel http://www.BruceEckel.com > Contains free electronic books: "Thinking in Java 2e" & "Thinking > in C++ 2e" > Please subscribe to my free newsletter -- just send any email to: > join-eckel-oo-programming at earth.lyris.net > My schedule can be found at: > http://www.mindview.net/Calendar > =================== From stuart at bmsi.com Wed Dec 19 11:09:12 2001 From: stuart at bmsi.com (Stuart D. Gathman) Date: Wed, 19 Dec 2001 11:09:12 -0500 Subject: Python as RedHat/SysV service References: <9voavb$rpj$1@nntp2-cm.news.eni.net> <9voe89$119q$1@nntp6.u.washington.edu> <9vqdqq$bc2$1@nntp2-cm.news.eni.net> Message-ID: <9vqe38$bii$1@nntp2-cm.news.eni.net> On Wed, 19 Dec 2001 11:04:41 -0500, Stuart D. Gathman wrote: > I will try to make a general purpose Python based init.d module - any > recommendations are welcome (especially if it has already been done). > > I will call the python module with service interface functions > 'service.py'. AIX has its own "System Resource Controller" for services, and Windows NT has NT services. The Python service module should provide a unified API to these system service frameworks. I am familiar with AIX, and SysV init.d is fairly simple, so I can handle those two. Does anyone know what is required for an NT service? I'll leave the implementation to someone else (since you'd have to pay us a lot to allow an NT box in the door), but I would like to have the Python framework accomodate the NT environment. -- Stuart D. Gathman Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154 "Confutatis maledictis, flamis acribus addictis" - background song for a Microsoft sponsored "Where do you want to go from here?" commercial. From loewis at informatik.hu-berlin.de Mon Dec 3 05:52:43 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 03 Dec 2001 11:52:43 +0100 Subject: forcing import without execution? References: Message-ID: "Peoter Veliki" writes: > can you import a module (make the namespace available) without actually > executing the code? Depends on what you mean "make the namespace available". If you want that a module with that name is available in sys.modules, and available in the local namespace, you can create one using the new module: >>> import new,sys >>> sys.modules['foo']=new.module("foo") >>> import foo If you want the module also to contain all the definition from the source code, you must execute it - classes and functions come into life only by being executed. I would recommend that you do not use the same module for exec'ing and importing. Instead, create a module foo that contains just the classes and functions, and one source file bar that is available for exec'ing; bar should start with from foo import * HTH, Martin From awinston at scn.org Wed Dec 5 14:18:07 2001 From: awinston at scn.org (Alan Winston) Date: Wed, 5 Dec 2001 11:18:07 -0800 Subject: XP Python? [was Re: Python evangelists unite!] References: <3C07884E.75E18DF7@engcorp.com> <9ue2o2$b344@news1.gtech.com> <3C0B08F3.C9CDE885@engcorp.com> <9ugrrt$b345@news1.gtech.com> <3C0C526A.C7CB4FD0@engcorp.com> <9uhn3i$b348@news1.gtech.com> <3C0C7ABA.10C90FD9@engcorp.com> Message-ID: <9ulrtd$uu6$1@brokaw.wa.com> > [megasnip] > ... (XP is another part, by the way, but that's a > discussion for another newsgroup. :-) ... Why wouldn't a Python-specific XP discussion be entirely appropriate and welcome in this group? Throughout this thread I have been wishing someone would mention XP in this context. In particular when there is reference to Python being suitable for lone-wolf programmers, but not for large teams. Your mention of test-first also had me mumbling "XP ..., XP ... ." I would be very, very appreciative if you could comment on your XP experiences as they specifically relate to Python, and in contrast to other languages you have production XP'ed in. Do you do full pair-programming, with shifting pairs? Alan Winston Seattle From res0ne7x at verizon.net Tue Dec 11 19:48:47 2001 From: res0ne7x at verizon.net (Gary Herron) Date: Tue, 11 Dec 2001 16:48:47 -0800 Subject: jpeg files displayed in a loop In-Reply-To: <9v5ro0$2hr$1@peabody.colorado.edu> References: <5a4226f0.0112111203.1d361fa0@posting.google.com> <9v5ro0$2hr$1@peabody.colorado.edu> Message-ID: <200112120051.fBC0px815159@smtp003pub.verizon.net> On Monday 10 December 2001 06:24 am, Fernando P?rez wrote: > Kevin Cazabon wrote: > > # ok, probably a couple minor typos, but it should be that simple. > > Well, you got me curious. Here is the code with some things corrected. This > actually runs, but it hangs at the first image. My cpu usage pegged at 100% > and I just had to kill the job, it wasn't going anywhere. Any ideas? > > > #!/usr/bin/env python > > import Tkinter > import Image, ImageTk > import os > > dir = "/usr/local/home/fperez/local/python/jpegs" > > > def showimage(): > image = files.pop() > files.append(image) > image = ImageTk.PhotoImage(Image.open(image)) #ok, do try/except > b.configure(image=image) > b.update_idletasks() > b.after(1000, showimage) > > a = Tkinter.Tk() > b = Tkinter.Label(a) > b.pack() > > files = os.listdir(dir) # ok, check them for file types... > os.chdir(dir) > while 1: > showimage() Ouch! This gives you (an attempt at) infinitely many calls to showimage, EACH of which tries to schedule yet more calls with its call to "after". Get rid of the while loop. One initial call to showimage is enough -- it will schedule further calls at the appropriate interval. P.S. How do you plan to stop the scheduling of calls to showimage. As it stands, when the "files" list is empty, you get an error (from the files.pop call). If i remember correctly, such errors are caught by Tkinter, a traceback is printed and execution is continued, so you get a non-ending sequence of error messages, one per second. You should probably test for the existance of an image before you attempt to pop and display it, and certainly before you reschedule another call to showimage. From chris.gonnerman at newcenturycomputers.net Wed Dec 19 08:59:19 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Wed, 19 Dec 2001 07:59:19 -0600 Subject: I used os.waitpid,but I still can't Zombie process? References: <00db01c1882f$adb8e2a0$4301010a@sky> Message-ID: <006e01c18895$607883e0$0101010a@local> > From: ??? > > I still want to kill Zombie process which cause by child process,so I use > os.waitpid,But I found Zombie is still exist,why? my program is follows: > ... > while 1: > ... > ret=os.fork() > if ret==0: > HOST=udpaddr > PORT=21567 > ADDR=(HOST,PORT) > udpSerSock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) > udpSerSock.sendto(data,ADDR) > udpSerSock.close() > break > os.waitpid(ret,os.WNOHANG); First, as Donn already noted, the os.WNOHANG parameter means "don't wait if the child hasn't exited." This will not result in correct operation; you MUST NOT include this parameter with the pid given if you want the zombie reaped. If you are intending to spawn multiple children who will run detached, and you don't care about them after you start them, change the os.waitpid() call to os.waitpid(-1, os.WNOHANG) (to reap any child) and ensure that it is called in a loop (which it appears to be). > Where is my program's error? How to correct my program? Any idea will be > appreciated. > Edward It appears to me, from the many questions you have asked, that you may need to spend some time with a good book on Unix/Linux system programming. Your questions are not stupid, but they are fundamental, which tells me you need to get a better grip on how this kind of program works in general. Are you a C/C++ programmer? From erlangen72 at hotmail.com Wed Dec 19 15:04:30 2001 From: erlangen72 at hotmail.com (Mark_Pryor) Date: Wed, 19 Dec 2001 20:04:30 GMT Subject: EM_GETLINE,Win32gui, address of buffer References: <0TST7.436$Cw3.49740@newsread2.prod.itd.earthlink.net> Message-ID: Hi Neil, Neil Hodgson wrote in message news:bAVT7.24607$_z.71369 at news-server.bigpond.net.au... > Mark_Pryor: > > When I use the message, EM_GETLINE, the lParam calls for > > an address of a string buffer. How do I prepare this buffer in Python? > > Use the array module to create a buffer of a reasonable size and then > find its address as the first element of the tuple returned by the > buffer_info method. > > >>> import array > >>> b = array.array('c', 'x'*1000) > >>> b.buffer_info() > (15080104, 1000) > >>> > > Ensure that the buffer object's life outlives your use of the address. > > Neil First time I have seen a buffer set up that way, thanks. As for my original goal of scraping from the UEdit edit control, well it was a bad idea in the first place. After failing over and over I ran Spy on the window to find out that the EM_GETLINE message is never used internally by UEdit. My technique could only work if the App subclassed for this message and was prepared to handle it - a silly assumption to begin with. Now I shall try to force a line select on the Caret line, then use UEdits advanced menu to shell out the text. Almost anything I want to try I have found a way to do it in Python :) cheers, Mark From peter at engcorp.com Sat Dec 29 18:43:04 2001 From: peter at engcorp.com (Peter Hansen) Date: Sat, 29 Dec 2001 18:43:04 -0500 Subject: win32all-141 for Python 2.2 References: <3C2D4676.5060700@skippinet.com.au> <3C2D49E6.39FD96BE@earthlink.net> Message-ID: <3C2E5508.7B5455C0@engcorp.com> Ron Stephens wrote: > > Thanks, Mark. I really appreciate your efforts. I also suggest that > *anyone* and everyone* using Python and Windows rush out and buy your > book, Python Programming on Win32. Do you have any other book projects in > mind? >From what I understand of how book publishing works, Mark probably makes about 10 cents on each sale. ;-) It would be better to just send him a cheque! -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From sdm7g at Virginia.EDU Wed Dec 19 19:35:13 2001 From: sdm7g at Virginia.EDU (Steven Majewski) Date: Wed, 19 Dec 2001 19:35:13 -0500 (EST) Subject: Raw sockets In-Reply-To: <2c55c8be.0112130949.761bc120@posting.google.com> Message-ID: On 13 Dec 2001, Ben Ainsworth wrote: > Is there a good intro to using raw sockets with python on the web? I > want to try writing a variant of traceroute using tcp instead of icmp. [1] If you're going to use tcp, then why do you need raw sockets? [2] Since traceroute relies on the icmp messages returned when the TTL goes to zero, I'm not sure how you could write a traceroute without icmp. [3] Raw sockets using Python are pretty much the same as raw sockets using C or any other language -- you need to manually wrap your data up in the headers that the tcp/ip layers normally wrap for you (including checksums). I think there's a 'ping' in python floating around that uses raw sockets to make icmp packets. You might search the archives. [4] Other than that, it was a good question! -- Steve From garry at sage.att.com Mon Dec 10 13:17:15 2001 From: garry at sage.att.com (Garry Hodgson) Date: Mon, 10 Dec 2001 18:17:15 GMT Subject: Python classes for reading/writing/parsing MIDI files References: <3C0F63F0.20D2B25@alum.mit.edu> <7876a8ea.0112061455.6685b313@posting.google.com> <3C111F3C.1B41508C@sage.att.com> <3C1173C8.39FD4761@alum.mit.edu> <877krv5eu3.fsf@pc714.maths.usyd.edu.au> Message-ID: <3C14FC2B.C1E7EDB2@sage.att.com> nigel at pc714.maths.usyd.edu.au wrote: > Also have a look at ... thanks! i'll check these out. -- Garry Hodgson Let my inspiration flow Senior Hacker in token rhyme suggesting rhythm Software Innovation Services that will not forsake me AT&T Labs 'til my tale is told and done. garry at sage.att.com From rune at nesheim.net Tue Dec 4 13:14:58 2001 From: rune at nesheim.net (Rune Nesheim) Date: 4 Dec 2001 10:14:58 -0800 Subject: Making a string raw Message-ID: <59333ea6.0112041014.7908e9ab@posting.google.com> Could any of you lot tell me how to convert a string stored in avariable to a raw string? I know I create a raw string this way: spam = R'hello' But if I don't know what the string is going to contain, for example if I fetch from a Tkinter text-box to the variable 'eggs' and want to convert 'eggs' into a raw string. From skip at pobox.com Tue Dec 11 13:23:29 2001 From: skip at pobox.com (Skip Montanaro) Date: Tue, 11 Dec 2001 12:23:29 -0600 Subject: lost interest? In-Reply-To: <9v5enr079j@enews4.newsguy.com> References: <20011208001123.A5989@casa.parque> <3C14FEBD.AD52B516@attbi.com> <9v5enr079j@enews4.newsguy.com> Message-ID: <15382.20257.107891.262699@12-248-41-177.client.attbi.com> >> CPAN is marvelous. The way the Perl and Python communities operate, >> it fills a niche perfectly in the Perl world, but I think would be a >> bit of a solution looking for a problem in the Python world. Alex> If it encourages more reuse of code in module A by the author of Alex> module B, I think it would be a VERY good influence "in the Python Alex> world". Why *shouldn't* the useful 3rd-party modules we use be Alex> free to rely on other useful 3rd-party modules yet?! Python authors are free to rely on any modules they like, third-party or otherwise. That they don't suggests to me that there's generally fairly little need to do that, at least for widely used packages. To make the example concrete, here are the "whatrequires" dependencies for the various python-related packages installed on my Mandrake system: *** python-devel *** no package requires python-devel *** rpm-python *** no package requires rpm-python *** python-imaging *** no package requires python-imaging *** python-docs *** no package requires python-docs *** python *** python-numeric-20.1.0-1mdk pygtk-0.6.8-7mdk rpm-python-4.0.3-0.27mdk tkinter-2.1.1-3mdk python-imaging-1.1.2-3mdk gnumeric-0.70-3mdk gif2png-2.4.2-1mdk python-devel-2.1.1-3mdk python-docs-2.1.1-3mdk *** python-numeric *** pygtk-0.6.8-7mdk *** tkinter *** python-imaging-1.1.2-3mdk pysol-4.72-2mdk The only dependency listed between two non-core packages is between gtk and numeric. (Tkinter is really a core package, and is probably only separated for convenience for people running servers that require no X capability at all.) I installed and use gtk happily without ever having installed numeric, so I conclude that either there is some optional stuff installed in Mandrake's pygtk RPM or the dependency is an error. All other listed dependencies are against the core package. Skip From jason at jorendorff.com Wed Dec 19 00:37:12 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Tue, 18 Dec 2001 23:37:12 -0600 Subject: Dictionaries as records In-Reply-To: Message-ID: > What strikes me as odd is that I can create a list of 200K > dictionaries with > test data (a copy of the same record over and over) and the > amount of memory > used is only half. This might have nothing to do with dictionary memory management. If you make 200,000 copies of { 'name': 'Jason', 'domain': 'jorendorff.com', 'age': '117' } then you'll have 200,000 dictionaries, but only 6 strings. All the dictionaries will contain pointers to the same 5 string objects. Of course when you're dealing with real data you create many different string objects. -- Jason Orendorff http://www.jorendorff.com/ From alex at netWindows.org Mon Dec 17 06:09:18 2001 From: alex at netWindows.org (Alex Russell) Date: Mon, 17 Dec 2001 06:09:18 -0500 Subject: Update Oreilly books? References: Message-ID: <9vkiln$61d$1@mozo.cc.purdue.edu> My personal opinion is that you can do better than "Programming Python". I own both editions, and like neither, which is a damn shame since it's O'Rielly, and the author isn't bad at all. It's just that the organization is a mess, there's virtually no reference material, and truly useful topics like XML are simply skipped. That said, try the New Riders books, my roommate had to get them for a class, and they're solid reference material as well as being a good instructional piece. If, however, your heart is set on buying "Programming Python", get the latest version. I don't know that waiting for 3.0 (and the associated lag with the new version of the book) will necessarily set you in any better stead. HTH, Alex -- http://www.netWindows.org http://alex.netWindows.org http://plug.purdue.org wrote in message news:mailman.1008555261.15036.python-list at python.org... > I am about to slowly transfer out of my newbie status, and I am going > to purchase a Programming Python Book (an upgrade from learning python) > and I wanted to know if anyone knows whether Oreilly will update the > book with the upcoming 2.2 release or if the 2nd edition will last till > 3.0 Python relase. > > Thank You > Dan > -- > John 11:25 "Jesus said to her, I am the resurrection and the life. He who > believes in me will live, even though he dies;" -- > http://www.tddm.org/salvation.shtml > > > From richard at bizarsoftware.com.au Wed Dec 12 17:13:18 2001 From: richard at bizarsoftware.com.au (Richard Jones) Date: Thu, 13 Dec 2001 09:13:18 +1100 Subject: zope: compilation problem, can't make ISO_8859_1_Splitter In-Reply-To: References: Message-ID: <200112122212.fBCMCck65615@bigboy.bizarsoftware.com.au> On Thursday 13 December 2001 8:52 am, Warren Postma wrote: > I ran "python wo_pcgi.py", and it got a fair ways into the building > process, and then died inside of a Makefile, with the following being the > most interesting error output: > > /usr/local/lib/python2.1/config/makesetup -m Makefile.pre -c > /usr/local/lib/python2.1/config/config.c.in Setup -n > /usr/local/lib/python2.1/config/Setup.config > /usr/local/lib/python2.1/config/Setup.local > /usr/local/lib/python2.1/config/Setup > make > make: don't know how to make ././src/ISO_8859_1_Splitter.c. Stop > > Now, there's a folder called ISO_8859_1_Splitter but there's no C file. > > The path of that folder it seems to want to think of as a C file is > ~postma/Zope-2.4.1-src/lib/python/Products/PluginIndexes/TextIndex/Splitter >/ ISO_8859_1_Splitter It would appear that your "tar" program is truncating the filenames, just like I get on OS X. Bloody annoying that. Identify the correct file that _should_ be called "ISO_8859_1_Splitter.c" and rename it. You should be able o build just fine after that. Richard ps. please don't NOSPAM your address - I don't like getting bounces and you'll find that getting bounces discourages people from send you responses. pps. the correct list for this question and others abuot Zope is zope-list - see www.zope.org for info. From fperez528 at yahoo.com Fri Dec 7 15:10:58 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Sat, 08 Dec 2001 19:38:58 +2328 Subject: It's hard to find documentation References: Message-ID: <9uuith$qb8$1@peabody.colorado.edu> Brad Bollenbach wrote: > Any argument that tries to make it look as though Python's > documentation is easily searchable is -- as far as I can tell -- > wrong. All we need now is for the right person to get lazy enough to > write a good search (either for use with the website, or -- even > better -- at your local command prompt). As already discussed, the website is absolutely useless. But at the python command prompt, just type 'from pydoc import help'. Then type one of: help function_name help 'keywords' help 'modules' help 'topics' or just plain help. The system is quite impressive. Also, don't forget the fabulous pydoc -g which runs the module doc system as a webserver on port 7464. > > If I wanted it badly enough, I would have done so already. :) Ka-Ping Yee already did. cheers, f From lists at toadmail.com Sun Dec 9 17:24:58 2001 From: lists at toadmail.com (Jeremy Whetzel) Date: 09 Dec 2001 17:24:58 -0500 Subject: Populating a list References: <32c382ad.0112091404.6cfe4a56@posting.google.com> Message-ID: <877krwxc91.fsf@toadmail.com> matt at lorfeld.com (mlorfeld) writes: > I am new to python (about 72 hours into learning), and am having > problems with reading a file (sate abbreviations) with one item per > line and populating each line into a list. The problem is that each > item ends with \012 after each state ie WI\012. > > Here is the code that I am using: > > f=open('/home/mlorfeld/states.txt', 'r+') > states=f.readlines()#populates a list from file > f.close > print states The \012 is a newline character, from what I understand. There's a couple of ways you could do this, but I personally (and there may be disagreement on this) would do it this way: states = [] f=open('/home/mlorfeld/states.txt', 'r+').readlines() for i in f: states.append(i[:-1]) print states The biggest reason why I'd do it this way is because then you don't have to worry about closing the file at the end. I'm probably showing my green behind the ears doing it this way, but hey, it's a learning experience. =0) Jeremy From mwh at python.net Mon Dec 3 06:06:00 2001 From: mwh at python.net (Michael Hudson) Date: Mon, 3 Dec 2001 11:06:00 GMT Subject: Regular expression as dictionary key? References: <3C0B2DE9.5040308@home.com> Message-ID: Luke writes: > Let's say you have a dict of words like > words = {"dogs":1,"cats":2} > > Let's say I'm given a singular form of a word and want to match it > with plurals still, but words["dog"] will obviously raise a KeyError. > > Without doing a linear substring search on every element in > words.key(), is there a way to take advantage of the dict's binary > tree layout properties (e.g. speed) like: Which "binary tree layout properties" are those? > > words["dog*"] # where dog* is a Regex > You could do />> def process(d): |.. r = {} |.. for k,v in d.items(): |.. for i in range(len(k)): |.. r[k[:i]] = v |.. return r \__ ->> words = {"dogs":1,"cats":2} ->> stems = process(words) ->> stems["dog"] 1 So you only do the linear stuff once. You could also do some stuff with regexps, I suspect. > Nonexistant syntax, I know, but you get the idea... I smell a PEP Perhaps I'll save you some bother: the chance of extending the native dict implementation to support this is zero. Cheers, M. -- C++ is a siren song. It *looks* like a HLL in which you ought to be able to write an application, but it really isn't. -- Alain Picard, comp.lang.lisp From roy at panix.com Tue Dec 25 16:19:30 2001 From: roy at panix.com (Roy Smith) Date: Tue, 25 Dec 2001 16:19:30 -0500 Subject: How best to check for existance of an attribute? Message-ID: I've got a function which augments an object passed to it by adding a new attribute. Something like this: def addStuff (obj): obj.newAttr = "stuff" I want it to be an error to call addStuff() more than once for a given object. The simpliest way to do this would be with something like perl's defined() function: def addStuff (obj): if defined (obj.newAttr): raise MultipleCallError else: obj.newAttr = "stuff" What's the best way to simulate defined()? I could think of a few possibilities. For example, either of the following seem like they would work: def addStuff (obj): if 'newAttr' in dir (obj): raise MultipleCallError else: obj.newAttr = "stuff" def addStuff (obj): try: obj.newAttr raise MultipleCallError except AttributeError: obj.newAttr = "stuff" Any reason to pick one over the other, or perhaps a third way? From robin at jessikat.fsnet.co.uk Wed Dec 12 07:39:29 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Wed, 12 Dec 2001 12:39:29 +0000 Subject: ReportLab 1.11 released Message-ID: Version 1.11 of the ReportLab toolkit released. ReportLab is now released with a BSD style license. In addition to many minor improvements and bug fixes this release allows users to specify clickable hotzones linked to associated URLs. Graph legends can now have multiline text and autosizing. Graph axes may have grid lines attached to the ticks. -- Robin Becker From Bruce at EckelObjects.com Thu Dec 6 17:03:56 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Thu, 06 Dec 2001 14:03:56 -0800 Subject: staticmethod and __call__ Message-ID: <200112061403560030.019D0518@mail.rdc1.sdca.home.com> I seem to have trouble getting __call__ to behave as a static method: class Item: def f(): print 'An Item' Item.a = 'a' Item.b = 'b' Item.c = 'c' class ItemGenerator: import random rgen = random.Random() items = [j for j in vars(Item).values() if isinstance(j, Item)] def __call__(): return ItemGenerator.rgen.choice(ItemGenerator.items) __call__ = staticmethod(__call__) items = [ItemGenerator() for i in range(5)] for i in items: i.f() Output: Traceback (most recent call last): File "test.py", line 18, in ? i.f() AttributeError: ItemGenerator instance has no attribute 'f' It doesn't seem to be making the __call__ Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From jason at jorendorff.com Mon Dec 31 13:37:32 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Mon, 31 Dec 2001 12:37:32 -0600 Subject: Optimization help needed: Search and Replace using dictionary of parameters In-Reply-To: <3C309E64.6A7E37DD@vip.fi> Message-ID: > Before I start writing code, any ideas what is the fastest way of > doing it ?: > regex- or string -functions ? Map or readlines() ? sed could be much faster (albeit less flexible) than Python for this task. Your data structure could be slow. Use nested dictionaries instead: x = { 'filename1': { 'parameter': 'value', 'parameter2': 'value', 'parameter3': 'value' }, 'filename2': { 'parameter2': 'value', 'parameter4': 'value', 'parameter6': 'value' }, 'filename3': { 'parameter5': 'value', 'parameter7': 'value', 'parameter8': 'value' }, 'filename4': { 'parameter': 'value', 'parameter3': 'value' } } As for string vs re, it depends. Just use whichever one is easier for your particular situation. But take a special look at re.sub(). def get_replacement(match): param = match.group(1) return lookup[filename][param] for line in file.xreadlines(): # Find and replace all tags that are set off in a certain way... line = re.sub(r'<<([A-Z0-9_]+)>>', get_replacement, line) out.write(line) To read lines from a file, the fastest thing is probably: # Convoluted, but speedy x = file.readlines(16000) while x: for line in x: blah_blah_blah(line) x = file.readlines(16000) But it is usually plenty fast enough to do: # Quick and obvious for line in file.xreadlines(): blah_blah_blah(line) Or: # Quick and even more obvious, but new in Python 2.2 for line in file: blah_blah_blah(line) ## Jason Orendorff http://www.jorendorff.com/ From ssthapa at classes.cs.uchicago.edu Tue Dec 18 13:31:50 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Tue, 18 Dec 2001 18:31:50 GMT Subject: lost interest? References: <20011208001123.A5989@casa.parque> <3FFT7.5573$Q3.847787@news010.worldonline.dk> <4bLT7.32$aS.11733@news010.worldonline.dk> Message-ID: maxm wrote: >Oh but that wasn't what I meant. It was more about the fact that the core >developers who can put some weight behind a package system are not involved >in it. They are happier doing core language features like object type >unifications. (Which I also look forward to ;-) ) > Yes, I suppose that's true although I thought that there some of the core developers working on distutils that might have been interested in something like this. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From tmhazel at mediaone.net Fri Dec 21 18:29:12 2001 From: tmhazel at mediaone.net (Thomas Hazel) Date: Fri, 21 Dec 2001 18:29:12 -0500 Subject: ANNOUNCE: txObject ATK 1.3.8 In-Reply-To: Message-ID: I'm please to announce the release of txObject ATK 1.3.8. In addition to fixing all known outstanding bugs, this release provides Python developers a more manageable way of building the different txObject ATK layers into the python interpreter. I have also finished method documentation (i.e __doc__) for each txObject ATK Python feature, which folks have been asking for. What is it? txObject ATK is a collection of platform-independent C++ & Python Class libraries (GPL) that provides a five-layer framework containing an Object Library, I/O and Timers, Object-Oriented Threads (Native/Home Grown), Inter-Process Communication, and Distributed Object Communication. txObject ATK can be found at either of the following sites: Official Site http://www.txobject.org SourceForge (development & bug tracking) http://txobject.sourceforge.net Enjoy, --Thomas Hazel ( thazel at txobject.org ) From tmagna at online.no Thu Dec 27 04:20:55 2001 From: tmagna at online.no (Brandvik) Date: Thu, 27 Dec 2001 10:20:55 +0100 Subject: Pascal's triangle (beginner) References: <2oqj2ucmbo2658uq1dq3v8quc6f116d8tq@4ax.com> Message-ID: On Wed, 26 Dec 2001 17:23:25 +0100, "Karl M. Syring" wrote: >Look at http://www.inetarena.com/~pdx4d/ocn/python/series.html for the >answer on this and several related questions that my come up. > >Karl M. Syring Thanks for the link. I know my question sounds like homework, but it's not (still three years until I can take computer science). Anyway, thanks again for your help. -Brandvik From lac at strakt.com Sat Dec 8 13:40:53 2001 From: lac at strakt.com (Laura Creighton) Date: Sat, 08 Dec 2001 19:40:53 +0100 Subject: Good book for Learning Python?? In-Reply-To: Your message of "Sat, 08 Dec 2001 10:34:19 PST." <20011208183419.72381.qmail@web20506.mail.yahoo.com> References: <20011208183419.72381.qmail@web20506.mail.yahoo.com> Message-ID: <200112081840.fB8Ierua027105@ratthing-b246.strakt.com> Sent back to the list, since what is the best book for database programmers to learn python with is not a question I know the answer to. But the list _does_. Laura > Dear Laura, > > I am coming from 8 years of Foxpro for DOS and Clipper > environment. I have been learning/experimenting in/with > Linux since June 1999. I have taken Unix 1 and 2 courses. > > I took a course in C and an introduction course to Java. I > am looking for a place or nitch that I can feel at home in > and maybe even find employment as well. I prefer to stay > with Linux if possible. > > I guess that about sums things up in a nut shell. I guess > my main focus is doing database programming so I can > translate my foxpro and clipper programs into Python. > > Thank you for taking the time and answer my request. > > Greg Mickle > > --- Laura Creighton wrote: > > You need to give us more information. A good book for > > somebody who > > has never programmed before and wants to learn how to > > program in > > Python is different from a Good Book for somebody who has > > 15 > > years experience programming Java, C and C++. What, in > > particular, > > do you want the book to do? > > > > Laura Creighton > > > ===== > -=*=- -=*=- -=*=- -=*=- -=*=- -=*=- -=*=- -=*=- -=*=- -=*=- > Proud to be a Volunteer (VIPS) w/Fairfax County Police Dept > See | http://www.co.fairfax.va.us/ps/police/homepage.htm > > Member of novaLUG | http://novalug.tux.org > Member of AlexLUG | http://groups.yahoo.com/group/AlexLUG > Great Article!! | http://www.unix-vs-nt.org > > __________________________________________________ > Do You Yahoo!? > Send your FREE holiday greetings online! > http://greetings.yahoo.com From aleax at aleax.it Mon Dec 17 18:49:57 2001 From: aleax at aleax.it (Alex Martelli) Date: Mon, 17 Dec 2001 23:49:57 GMT Subject: pyexpat and unicode References: Message-ID: mallum wrote: > > Nope. This still breaks, with the same error; > > import xml.parsers.expat > parser = xml.parsers.expat.ParserCreate(encoding='utf8') > > data_uni = u"\202" > data_uni.encode('utf8') > parser.Parse(data_uni) > > Is this a Bug ? Hmmm, yes, my own bug first of all: ... >> for thedata in data_uni, data, denc: >> parser = xml.parsers.expat.ParserCreate(encoding='utf8') >> print 'parsing', repr(thedata) >> parser.Parse(data, 1) >> print 'done' I was parsing data each time instead of thedata. Correcting this silly error does show problems: import sys import xml.parsers.expat parser = xml.parsers.expat.ParserCreate(encoding='utf8') data_uni = u"\202" data = "there" denc = data_uni.encode('utf8') for thedata in data_uni, data, denc: parser = xml.parsers.expat.ParserCreate(encoding='utf8') print 'parsing', repr(thedata) try: parser.Parse(thedata, 1) except: print 'oops', sys.exc_info()[0] print 'done' [alex at arthur alex]$ python a.py parsing u"\x82" oops exceptions.UnicodeError done parsing "there" done parsing "\xc2\x82" oops xml.parsers.expat.ExpatError done [alex at arthur alex]$ The first one corresponds to what you're seeing (passing unicode data tries to encode it with your default encoding, and the default's default is ansi), the second one is a string that first within the 'ansi' subset of utf-8... and I don't know what to make of the third one, which I thought would work. Alex From LLewin at oreilly.com Fri Dec 28 19:53:26 2001 From: LLewin at oreilly.com (Laura Lewin) Date: 28 Dec 2001 16:53:26 -0800 Subject: REPOST: Re: O'Reilly book production (was Re: Wine applicability) References: Message-ID: <3$--$$_----_--_-_$@news.noc.cabal.int> Right. To clarify again...O'Reilly does not make anyone use Word. Word is an option, along with Frame, XML, StarOffice, others as well. Alex happened to start his book in Word, and changing mid-stream often presents conversion challenges (I'll talk with Alex about this separately.) Hope I've clarified this matter, please feel free to email me if anyone has further questions on ORA template options. Happy Holidays everyone! Laura LLewin at oreilly.com "A. Keyton Weissinger" wrote in message news:... > I've written two books for O'Reilly, one of which has two editions out. The > Word template works very well for me. Now FrameMaker, their production > application sucks, but fortunately you rarely have to deal with that. > > Keyton > > > -----Original Message----- > > From: python-list-admin at python.org > > [mailto:python-list-admin at python.org]On Behalf Of Aahz Maruch > > Sent: Friday, December 28, 2001 12:42 PM > > To: python-list at python.org > > Subject: O'Reilly book production (was Re: Wine applicability) > > > > > > In article , > > Alex Martelli wrote: > > >"Cameron Laird" wrote in message > > >news:200112281642.KAA24897 at starbase.neosoft.com... > > >>Alex: > > >>> > > >>>that's my primary need -- Word with O'Reilly customized macros &c, > > >>>as that's what I'm required to use for one of the books. So, I > > >> > > >> O'REILLY MAKES YOU USE WORD MACROS?!??!!? > > >> I've got to talk with those boys. That strikes me as an atrocity. > > > > > >"makes" is probably an overbid. The Cookbook I'm doing in XML with a > > >custom DTD, and that's just fine - I get to use VIM:-). But for the > > >Nutshell, that wasn't an option. > > > > Really? May you explain why? (I'm still hoping to do a book with > > O'Reilly and I *really* don't want to use Word.) > > -- > > --- Aahz <*> (Copyright 2001 by aahz at pobox.com) > > > > Hugs and backrubs -- I break Rule 6 > > http://www.rahul.net/aahz/ > > Androgynous poly kinky vanilla queer het Pythonista > > > > Tenth Virtual Anniversary: 3 days and counting > > -- > > http://mail.python.org/mailman/listinfo/python-list > > > > ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: LLewin at oreilly.com (Laura Lewin) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:23:51 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774946 27193 211.57.49.2 (31 Dec 2001 05:02:26 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:02:26 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From ajs at ix.netcom.com Sun Dec 2 16:06:26 2001 From: ajs at ix.netcom.com (Arthur Siegel) Date: Sun, 2 Dec 2001 16:06:26 -0500 Subject: age of new pythonistas [was: The Editor Poll results are in!] Message-ID: <000a01c17b75$35b6ff60$7dd9d23f@ArtSiegel> >> it'd also be cool to see the relative age of new pythonistas -- I suspect >> that they're young, but this is completely unfounded. Alan Winston writes >51 here. [snip] >Now if you mean folks who will ONLY code in Python, them folks have gotta be >young. Like me. 50. Foolhardy enough to first decide to understand (as a means to some other ends) programming while in my late 40's. Don't think I would have gotten as far as I have were it not for the existence of Python. Pity I keep fighting with the guys whose great, hard work put it on the map. Art -------------- next part -------------- An HTML attachment was scrubbed... URL: From foofboy at speakeasy.net Mon Dec 3 08:06:17 2001 From: foofboy at speakeasy.net (Robert Sherwood) Date: Mon, 03 Dec 2001 08:06:17 -0500 Subject: Dictionary of classes References: Message-ID: On Sat, 01 Dec 2001 11:45:29 -0500, Robert Sherwood wrote: > Greetings, all. > > I would like to construct and use a dictionary containing object > references. I'm translating a binary file stream to an object structure, > and I'd like to use the parts of the binary stream that identify the > data as keys in a dictionary which will return an object reference which > the main program can then instantiate and populate from the data stream. > I know that it's possible to store objects as the value in a dictionary. > Has anyone seen this done in the wild. Best of all would be a pointer to > some code implementing such a feature. > > Any help would be appreciated. An example of what I'm trying is attached > below. > > Thanks, > > Robert Sherwood > > frameID = self.headerArray[:4].toString() try: > frame = objectDict[frameID]() > frame.decode(self.popFrame()) > self.frames[frame.getFrameID()] = frame > except KeyError: > frame = unknownFrame() > frame.decode(self.popFrame()) > self.frames[frame.getFrameID()] = frame > > where the objectDict looks like this. > > objectDict = { > '0001':object1, > '0002':object2, > '0003':object3, > } Okay. Got some help from a few subscribers. Thanks to everyone that responded. Apparently that code is fine, but, on reflection, it's not actually what I want to do. Turns out I want to implement a mapping object that wraps around a dictionary. I've implemented a very simple method for __getitem__, that shunts key queries to the dictionary and returns the result. Having defined the object, I now get an unsubscriptable object error whenever I try to lookup a key. Example code follows: ---------------------------- import objectDict frameID = self.headerArray[:4].toString() try: frame = objectDict[frameID]() <---Returns "unsubscriptable Object" frame.decode(self.popFrame()) self.frames[frame.getFrameID()] = frame except KeyError: frame = unknownFrame() frame.decode(self.popFrame()) self.frames[frame.getFrameID()] = frame ------------------------------ class objectDict: memberDict = { '0001':object1, '0002':object2, '0003':object3, } def __getitem__: return self.memberDict[key] From jason at jvoegele.com Mon Dec 3 15:05:34 2001 From: jason at jvoegele.com (Jason Voegele) Date: 3 Dec 2001 12:05:34 -0800 Subject: Python evangelists unite! References: <9u77i8$a5j$1@slb0.atl.mindspring.net> <91acf731.0111301017.31cd71a5@posting.google.com> <9ufdth$155$1@slb5.atl.mindspring.net> Message-ID: <91acf731.0112031205.2782a5f9@posting.google.com> "Jyrinx" wrote in message news:<9ufdth$155$1 at slb5.atl.mindspring.net>... > > For example, I'm writing a Ruby binding to the Object-Oriented > > database GOODS. Some objects are persistent, some are transient. You > > don't know at "compile time" which are which, so it's very nice for my > > binding to be able to add persistence support methods at run-time only > > to those objects that will be stored in the database. Without Ruby's > > support for adding these methods to individual objects, I'd have to > > modify the class, which would mean adding all this persistence-related > > stuff to transient objects. Ruby allows a much cleaner solution: add > > the persistence support methods only to those objects that need them. > > Under the basic premises of OO, shouldn't you just have a base class with > derived classes "persistent" and "transient," or some such? I'd think this > would make clearer your intent for the uses of the objects. The problem with this is that it defeats the idea of transparent persistence. One goal of object databases is that persistence is not limited to a subset of the class heirarchy. This goal forbids a superclass as an indicator of persistence-capability. Instead, persistence is define by reachability: if an object (any object!) is reachable from a persistent object, that object becomes persistent itself, as well as any objects reachable from that object...and so on. Some OO databases ignore this and force applications to use "Persistent" superclasses or interfaces. IMO, this is a very bad idea. Consider that you may have a million instances of a class, only one of which is persistent (by the reachability definition). If the class has to subclass a "Persistent" class, all of those million objects have to carry around the Persistence baggage, even though only one of those objects needs them. Adding the persistence baggage to individual objects as necessary provides a much simpler and scalable solution. Simpler because application developers don't have to bother with subclassing (or implementing) a Persistent class (or interface). More scalable because the persistence support is added to *only* those objects (not classes) that need it. Jason Voegele From Administrator Sat Dec 1 23:20:41 2001 From: Administrator (Administrator) Date: Sat, 1 Dec 2001 21:20:41 -0700 Subject: ScanMail Message: To Recipient virus found and action taken. Message-ID: <04ec01c17ae8$b42f3ac0$0e0fbb82@corp.es.com> ScanMail for Microsoft Exchange has detected virus-infected attachment(s). Sender = hdbiker Recipient(s) = python-list at python.org Subject = Re: Scanning Time = 12/01/2001 21:20:41 Engine/Pattern = 5.600-1011/173 Action on virus found: The attachment stuff.MP3.pif contains WORM_BADTRANS.B virus. ScanMail has Deleted it. Warning to administrator. ScanMail has detected a virus. 12/01/2001 09:20 PM TORINO stuff.MP3.pif/Deleted python-list at python.org hdbiker Re: From jason at jorendorff.com Sat Dec 15 00:39:05 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Fri, 14 Dec 2001 23:39:05 -0600 Subject: Package Question - please help. In-Reply-To: Message-ID: > from package1.subpackage1.myCode import MyClass This looks for the file package1\subpackage1\myCode.py in the directories on your path. > I've added c:\package1 to the path That would become: c:\package1\package1\subpackage1\myCode.py If you were to add C:\ to your pythonpath, it would work. Or you could move the whole directory try under C:\myproject and add C:\myproject to your pythonpath. > (by adding it in the registy -- is there an easier way?). Sure. You can use the PYTHONPATH environment variable or your Python program can modify the sys.path variable at runtime. -- Jason Orendorff http://www.jorendorff.com/ From jicondon at us.ibm.com Tue Dec 18 17:54:55 2001 From: jicondon at us.ibm.com (dW) Date: 18 Dec 2001 14:54:55 -0800 Subject: IBM article: XML-RPC as object model Message-ID: IBM developerWorks has a section called XML Matters in which the author David Mertz discusses XML implementation in Python. The following is a new article on XML-RPC and the Python xml-pickle. There are a total of 15 articles so far. Cheers, Jeff XML-RPC as object model David Mertz examines XML-RPC as a way of modeling object data, and -- in response to reader feedback -- compares XML-RPC as a means of serializing objects with the xml_pickle module discussed in his earlier columns. Code samples illustrate this comparison in detail. http://www-106.ibm.com/developerworks/xml/library/x-matters15.html?open&l=968,t=gr,p=rpc XML Matters #1 introduces the Python xml_pickle object http://www-106.ibm.com/developerworks/xml/library/xml-matters1/index.html?open&l=968,t=gr,p=rpc XML Matters #2 describes how to use Python's xml_objectify http://www-106.ibm.com/developerworks/xml/library/xml-matters2/index.html?open&l=968,t=gr,p=rpc From peter at engcorp.com Wed Dec 5 23:13:10 2001 From: peter at engcorp.com (Peter Hansen) Date: Wed, 05 Dec 2001 23:13:10 -0500 Subject: Python - string to hexbytes conversion - HELP! References: Message-ID: <3C0EF056.B290BDAB@engcorp.com> me wrote: > > I'm a newbie to Python and I am trying > to convert a string of decimal numbers - read from raw_input > to a series of hexbytes I read this as "convert a string of ASCII characters representing digits in a hexadecimal number" and assumed because of the device-control aspect it was intended to produce exactly four bytes. (In other words, I assume when you said "decimal numbers" you didn't mean it, because your example could just as well have asked to convert '123abc45' which is not just decimal numbers. In addition, there's no such thing as a hexbyte, since bytes are bytes. Calling them characters is probably more likely to be understood, but bytes is good too.) > if I do a read and get a='1234567' > I need an equivalent string to be > b=Chr(0x01)+chr(0x23)+chr(x045)+chr(0x67) > > all this is to control a device from the serial port > but I cannot seem to recall how to conver the input to my required output Try this: >>> import struct >>> struct.pack('>L', long('1234567', 16)) '\x01#Eg' >>> chr(0x1)+chr(0x23)+chr(0x45)+chr(0x67) '\x01#Eg' Note that some of the other methods posted are more general (handling arbitrary lengths of strings), but at least one would not work with values higher than 0x7fffffff because Python ints are signed. This method is also intended to ensure that the bytes are produced in the same order you indicated ("big endian") rather than being platform-dependent. -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From bcsmit1 at engr.uky.edu Mon Dec 3 15:14:22 2001 From: bcsmit1 at engr.uky.edu (Brett Smith) Date: 3 Dec 2001 12:14:22 -0800 Subject: Regular expression as dictionary key? References: <3C0B2DE9.5040308@home.com> <9ufdkn$21dk$1@agate.berkeley.edu> <3C0B408C.8030908@home.com> Message-ID: Luke wrote in message news:<3C0B408C.8030908 at home.com>... > Cool, but still a linear search. Plus it short circuits. This takes care of the latter problem, returning a RegexDict of key/value pairs if the given regexp matches more than one key. Otherwise, it returns the value of the sole match. Hmmm. Do you think that's the proper behavior? Or should a 1-match regexp also return a RegexDict? Or should a multiple-match regexp return only a list of values? This is still incomplete; a complete implementation would need a rewrite of other methods, such as haskey(). class RegexDict(UserDict): """A dictionary that supports regular expressions to get at a key. Response to a post on c.l.py.""" def __getitem__(self, key): if self.data.has_key(key): return self.data[key] regex = key if isinstance(key, StringType): regex = re.compile(key) result = RegexDict({}) for k in self.data.keys(): if regex.search(k): result[k] = self.data[k] if len(result) > 1: return result elif len(result) == 1: return result.values()[0] else: raise KeyError, key -- -- Brett Smith From kragen at pobox.com Sat Dec 1 06:14:53 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 01 Dec 2001 06:14:53 -0500 Subject: questions about of writing python scripts References: Message-ID: <834rnbtcnm.fsf@panacea.canonical.org> edwardt at trillium.com (ed) writes: > Is there a way to force the python interpretter to kind of doing > "compilation" of the python scripts, so that I do not need to > rerunning the progrma a lot of times just to find out they are errors > like varibles not defined; functions name not found, variables not > found? Compiling Python can't find these things because the semantics of Python allow them to be added after the program starts but before it runs the erroneous lines. To find these things in Python, you need a test suite. You probably need a test suite anyway to find more serious errors... From beauchjo at kai.ee.cit.ac.nz Tue Dec 18 00:16:47 2001 From: beauchjo at kai.ee.cit.ac.nz (beauchjo at kai.ee.cit.ac.nz) Date: Tue, 18 Dec 2001 06:16:47 +0100 (MET) Subject: Dear python-list New Lolitas Site For You Message-ID: Hi. Only best young girls are selected for you on this site! http://hot-sexy.cc Nothing impossible in lolitas world! If you want to unsubscribe please go to: http://www.autoremove.com From johnroth at ameritech.net Sun Dec 2 18:21:58 2001 From: johnroth at ameritech.net (John Roth) Date: Sun, 2 Dec 2001 15:21:58 -0800 Subject: Draft PEP: string interpolation with backquotes References: Message-ID: "Oren Tirosh" wrote in message news:mailman.1007298422.20078.python-list at python.org... I don't see what I could do with this that I couldn't do with the '%' operator. Someone help me out on this? John Roth From ssthapa at classes.cs.uchicago.edu Thu Dec 20 17:20:46 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Thu, 20 Dec 2001 22:20:46 GMT Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> <7xlmfxvbx7.fsf@ruckus.brouhaha.com> <3dbsgt7f0e.fsf@ute.mems-exchange.org> Message-ID: Andrew Kuchling wrote: >Paul Rubin writes: >> That's a good point. It's probably too late to start reporting the >> incompatibilities as bugs against 2.2c, though that's what they are. > >And if no one reports bugs, they can't get fixed. You could still go >ahead and report them, but unless they're real showstoppers they won't >be fixed in 2.2final, which is being wrapped up even as we speak. I >don't know if it'll be considered worth fixing them in 2.3. > >(Or is this talk of incompatibilities simply FUD from people who are >scared of upgrading?) I think Paul was referring more to changes in modules or syntax that broke previous scripts. For example, the rand module had a name change to random. Scripts that used the rand module will break with an ImportError if they are run under 2.x. I believe there were a few other things like this where things were intentionally changed but prevented backwords compatibility. Not bugs per se unless perfect backward compatibility was an overriding concern. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From fdrake at acm.org Thu Dec 27 23:59:57 2001 From: fdrake at acm.org (Fred L. Drake) Date: Thu, 27 Dec 2001 23:59:57 -0500 (EST) Subject: [development doc updates] Message-ID: <20011228045957.6E9FD286BB@beowolf.digicool.com> The development version of the documentation has been updated: http://python.sourceforge.net/maint-docs/ The "maintenance version" of the Python documentation on the Python development site at SourceForge has been updated to show the docs being developed for Python 2.2.1. From tim at vegeta.ath.cx Fri Dec 21 12:08:13 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Fri, 21 Dec 2001 17:08:13 GMT Subject: Python on the desktop References: <94e3fce8.0112210053.2568529d@posting.google.com> Message-ID: Sarat Venugopal graced us by uttering: [ snip ] > 1. If python is to permeate the realm of commercial desktop > (in whatever scope), I can't speak for our BDFL, but I don't think Python was designed for a hostile take-over of world computer systems. I thought the goal of Python (or any language, for that matter) was to _be_ useful where it _can_ be useful. Python _is_ useful on Win32 systems and _is_ used by many programmers _on_ Win32 systems. Or do you define "permeate" as a more insidious, intrusive, and/or counterproductive phenomenon? > we need the ability to convert it into a native executable (I > have taken a look at some of the limited solutions available > from individuals). I read somewhere, it may never be possible > in Python. Can anyone throw light on this? Of course Python can be compiled. Possibly not to your executable- size expectations, but the same can be said of compiling Perl. They are both far too dynamic to compile as compactly as C/C++ without loosing much of their functionality, nor was this ever the goal. > Most commercial applications wouldn't want to expose the source > code or even leave it as byte-code And most Windows users vastly overestimate the effectiveness of native binary executables. Compiling (now less than ever) does not protect your source code near as well as many users think. Most applications would be much better served by a good software license, which, while not "hiding" your source, _does_ accomplish the following: 1) makes using your source a punishable crime 2) makes an _attempt_ to decompile/disassemble your code a punishable crime. > (Note: ActiveState has announced a compiler for Perl) And ActiveState will no doubt announce a compiler for Python. > 2. Absence of a standard GUI, which really fits the major > platforms. For a lanuage like Python, this is really a > handicap. Would I do it in Tkinter on Windows? No way. Por que no? Tcl/Tk comes standard on most linux boxes (esp. if they have Python standard, and many do). It also comes with any Tkinter- enabled package for Win32 from ActiveState. I've had great success writing a Tkinter app on Windows 98, ftp'ing it to my linux box, and running it there. Tkinter has been the standard GUI for quite some time now. Personally, I'd like to see wxPython as a standard GUI, but there hasn't been enough of a call to change it from the masses. (There have, however, been quite a few people complaining about Python GUIs; this is less than helpful.) > 3. Does the community see Python as a full-fledged programming > language? Yes. [ snipped more obvious troll bait ] Tim Hammerquist -- We all know linux is great...it does infinite loops in 5 seconds. -- Linus Torvalds From beyer at incent.com Fri Dec 28 16:35:32 2001 From: beyer at incent.com (hugh) Date: 28 Dec 2001 13:35:32 -0800 Subject: Running MySQLdb under solaris and python 2.1 Message-ID: <3d504fd.0112281335.45ca330@posting.google.com> I'm trying to write a cgi script in python that accesses the mySQL database. This is made more complicated by the way my ISP forces everything run from a cgi to be under the user's home directory. I have python installed, and I have mySQLdb installed. But when I try to use it I get the following error: >>> import MySQLdb Traceback (most recent call last): File "", line 1, in ? File "/export/home/incent01/usr/local/lib/python2.1/MySQLdb/__init__.py", line 27, in ? import _mysql ImportError: ld.so.1: python: fatal: libmysqlclient.so.10: open failed: No such file or directory >>> So it's finding the MySQLdb package; it's loading the _mysql.so module; and then it's failing to link in the libmysqlclient. (right?) I've found libmysqlclient but I can't get it into the right directory so the system can link it in--usr/local/bin (where the python program is), usr/local/lib and usr/local/lib/python2.1 all don't work. Is there some magic place for it? Is there some environment variable I can set so it can be found? From zoomq at itcase.com Thu Dec 13 03:04:31 2001 From: zoomq at itcase.com (Zoom Quiet) Date: Thu, 13 Dec 2001 16:04:31 +0800 Subject: where has infomation of jython?!!! Message-ID: <9v9mmt$212o$1@news.cz.js.cn> please me why www.jython.com can not visited in chinese? "socket error" always?! -- /======================\ | Time is unimportant; | only life important! \======================/ From tim.one at home.com Tue Dec 4 19:58:25 2001 From: tim.one at home.com (Tim Peters) Date: Tue, 4 Dec 2001 19:58:25 -0500 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) In-Reply-To: <3C0D2F38.ED8F1D41@mega-nerd.com> Message-ID: [Erik de Castro Lopo] > Please explian to us rational people why that is nasty. I've lost track, but I'm pretty sure it was either because the example used tabs, or because it used spaces. moving-the-argument-along-to-its-compelling-conclusion-ly y'rs - tim From niemeyer at conectiva.com Wed Dec 5 07:41:59 2001 From: niemeyer at conectiva.com (Gustavo Niemeyer) Date: Wed, 5 Dec 2001 10:41:59 -0200 Subject: Scientific Libraries in Python In-Reply-To: <83n113tgu6.fsf@panacea.canonical.org> References: <9t1iqq$es0$2@peabody.colorado.edu> <3BF45CAF.9983E26A@home.net> <7a8L7.5503$_J2.576156@news1.cableinet.net> <83n113tgu6.fsf@panacea.canonical.org> Message-ID: <20011205104159.A1685@ibook.distro.conectiva> > If SciPy is licensed under a BSD-like license, then there is no legal > obstacle to distributing an extended version of SciPy under the GPL. > There may, however, be political obstacles to making that extended > version the new SciPy. It depends on which BSD license it's licensed under, and if it has received contributions from other developers or not. If it has received contributions and the BSD license is the old one (the one enforcing some actions when advertising the program), the author may have to ask the contributors to change the license. If it's the revised version, they are compatible. If the author has received no contributions at all, he may change the license of future versions, no matter what license it is currently under, and what license he's going to. He's the copyright holder. Many of these questions are answered in the GPL FAQ: http://www.gnu.org/licenses/gpl-faq.html -- Gustavo Niemeyer [ 2AAC 7928 0FBF 0299 5EB5 60E2 2253 B29A 6664 3A0C ] -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 240 bytes Desc: not available URL: From dale at riverhall.NOTHANKS.co.uk Fri Dec 21 04:33:13 2001 From: dale at riverhall.NOTHANKS.co.uk (Dale Strickland-Clark) Date: Fri, 21 Dec 2001 09:33:13 +0000 Subject: Win32Service and Service Manager References: <52842usq62dho41m9i4lg15l8pgfc0h8m3@4ax.com> <3C226D30.5080902@skippinet.com.au> <30152u49q8p4nj467ijnho4v7jg15vj351@4ax.com> Message-ID: David Bolen wrote: >As far as I know you can't. Dumb question though - the snap-in should >be sorting and displaying the full display name, so could you be >looking for the short name instead? > >Or perhaps you could also use the 'sc' utility from the resource kit >or something like psservice from sysinternals to lookup information >based on the same name you are using with the "net" command and see if >anything is strange in the display name. (You can also just do the >same queries from Python code calling the service functions). > >Or, any service should be defined in a key (by short name) in the >registry under HKLM\System\CurrentControlSet\Services, so you might >poke around there to locate your entry and see if anything looks amiss >with its display name. Maybe there's some strange character or >something in there that is affecting its display in the MMC. I've found it - thanks. I'm bloody sure it wasn't there earlier ;-) Sodding newbies! -- Dale Strickland-Clark Riverhall Systems Ltd From dalke at dalkescientific.com Wed Dec 5 15:59:27 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Wed, 5 Dec 2001 13:59:27 -0700 Subject: PyInline problem References: <9uljcb$8ap$1@newsg4.svr.pol.co.uk> <9ulksl$f0o$1@endevour.netg.se> <9ulr4i$bb9$1@newsg3.svr.pol.co.uk> Message-ID: <9um2m4$3pb$1@nntp9.atl.mindspring.net> Duncan Smith: >The following does not build. > >import PyInline > >m = PyInline.build(code=""" > #include > #include ^^^^^ stdlib? Andrew dalke at dalkescientific.com From tim at vegeta.ath.cx Sat Dec 1 16:24:11 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Sat, 01 Dec 2001 21:24:11 GMT Subject: Let's make Python really strict about indentation References: <3C087F11.4030706@post.harvard.edu> Message-ID: Courageous graced us by uttering: [ snip ] > While I am sure most people understood what you meant, to be > clear, you must have certainly meant that your editor "replaces > a tab, when struck, with enough spaces to get to the next tab > stop." One could always (in vi + *nix): :%!expand -t 4 Tim Hammerquist -- Debugging is easy--just carve pieces off of a block of bug till what you have left looks like a mistake. :-) -- Larry Wall in <199911241757.JAA23712 at kiev.wall.org> From andy47 at halfcooked.com Mon Dec 17 22:45:46 2001 From: andy47 at halfcooked.com (Andy Todd) Date: 18 Dec 2001 03:45:46 GMT Subject: Cygwin socket library status enquiry References: Message-ID: "Steve Holden" wrote in : >Can anyone say fairly definitively whether there are known socket >communication problems in cygwin with Python 2.1.1-2 (the latest version >ported by Jason Tishler). > >My asynchat-based web server runs fine under the native Windows 2.0 >port. When I run it under cygwin it seems to go OK for a few >interactions, but then seems to hang. The output from netstat -an seems >to me to be more than a little confusing: client-side sockets (created >to connect to the server by Internet Explorer) are shown as in a >LISTENING state. > >If the same thing happened with the native Windows implementation I >would be looking at my code, but I'm wondering whether it's a cygwin >problem. Google seems to indicate that there were socket problems with >cygwin a good while ago, but I don't see recent problem descriptions. > >Can anyone tell me what's going on? The netstat output is attached. > >regards > Steve > >Active Connections > [snip results] >-- > > >-- >http://www.holdenweb.com/ > Steve, I believe that there are still some socket problems with Cygwin, although most have been addressed by recent versions of the DLL. In particular there were problems with Win98 that have now been resolved on my installation. I don't think everything is solved with the current port of Python though. By searching the Cygwin mailing list for 'python' and 'socket'; http://cygwin.com/cgi-bin/htsearch?method=and&format=builtin- long&sort=time&config=htdig&restrict=%2Fml%2Fcygwin%2F&exclude=&words=pytho n+socket (excuse wrapping of URL) it looks like Jason is still ironing out socket problems and has been working on them as recently as a couple of days ago; http://sources.redhat.com/ml/cygwin/2001-12/msg00639.html I don't know if these are the same problems as you are encountering but HTH. Regards, Andy -- Content free posts a speciality From jwbaxter at spamcop.net Sat Dec 29 11:47:33 2001 From: jwbaxter at spamcop.net (John W. Baxter) Date: Sat, 29 Dec 2001 08:47:33 -0800 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> <7xlmfxvbx7.fsf@ruckus.brouhaha.com> <3dbsgt7f0e.fsf@ute.mems-exchange.org> <7xheqkr05q.fsf@ruckus.brouhaha.com> Message-ID: <291220010847335691%jwbaxter@spamcop.net> In article , Emile van Sebille wrote: > "James T. Dennis" wrote in message > news:a0kor6$2o7u$2 at news.idiom.com... > > Paul Rubin wrote: > > > "Fredrik Lundh" writes: > > >>> Not bugs per se unless perfect backward compatibility was > > >>> an overriding concern. > > > > >> it isn't. > > > > > It's a bug if something is gratuitously, unnecessarily incompatible, > > > like "rand" disappearing. What was the reason for that? > > > > While that topic has come up: I find whrandom to be an unsightly > > name for accessing a set of functions which is so commonly accessed > > by novice students. What was wrong with must calling it rand or > > random? Is it pure pedantry? > > whrandom now exists for backwards compatibility purposes and is scheduled > for deprecation (is this a word? ;-) See the Python Library Reference, 5.6 random and 5.7 whrandom. >From the description of the whrandom module: "This module implements a Wichmann-Hill pseudo-random number generator..." I'm sure (without checking) that Google can find you exhausting (er, exhaustive) details about what that means. So the wh in the name stands for Wichmann-Hill. IIRC, in early days, the module was offered as an improvement over the existing random number module. Now, the random module does Wichmann-Hill, and the old whrandom name can be retired to the dustbin of history (nice phrase, glad I invented it ;-)). Something named rand would likely be based on the C library rand() function...others can tell you why that's not very interesting these days. --John From peter at engcorp.com Mon Dec 3 23:34:50 2001 From: peter at engcorp.com (Peter Hansen) Date: Mon, 03 Dec 2001 23:34:50 -0500 Subject: Python evangelists unite! References: <3C07884E.75E18DF7@engcorp.com> <9ue2o2$b344@news1.gtech.com> <3C0B08F3.C9CDE885@engcorp.com> <9ugrrt$b345@news1.gtech.com> Message-ID: <3C0C526A.C7CB4FD0@engcorp.com> Peter Milliken wrote: > > Peter Hansen wrote: > > Or did you have some other point I missed? > > Yeah, I guess you missed the point. But then you're very busy making money > aren't you? :-) So perhaps we shouldn't be too critical :-) Sounds like reasonable advice... > The major point was that Python is good for some simple, single person > jobs - which you and your mate obviously do, but it is *not* good for larger > projects that involve more than one individual (IMO :-)) - this statement > has implications on the size of the job in a very direct way. 1. For the record, I've never met Dave (presumably the "your mate" in your statement above) and we do not work together. We just seem to have similar views on some of these issues. (I realize my comments might have been misleading in this regard.) 2. Here's a simple point for you to consider in relation to your claims. I'm the directory of software engineering for a wireless telecom company with 100+ people. There are fourteen developers here who are using Python (almost exclusively) for some rather large applications, ranging from factory automation through Intranet to embedded Linux stuff for industrial control. In case this isn't obvious: these are NOT one-person jobs. Several have involved eight or nine people simultaneously at their peaks. I'm happy to report from *actual experience* that your statement has *no* implications on the size of the jobs we have undertaken, direct or otherwise. And as for suitability in other ways: we have had an order of magnitude fewer reported bugs, and have productivity at least two, probably three times, higher than on any project I've worked on in the past. These numbers are largely attributable to Python, and that makes using it good business sense no matter how you look at it. > As for Python meeting *all* of the software engineering principles you ever > *learned* - well, only you can be the judge of what you did or didn't learn > :-). It certainly fails in a number of important areas that I *learned* > about software engineering :-). While I cannot speak for the grounding your school may have provided, the University of Waterloo gave me its usual solid grounding in engineering principles. Perhaps your school emphasized some areas I would consider unimportant. Or perhaps the advice that a "poor workman should not blame his tools" should apply even to those calling themselves software engineers. (If I were you, I would probably have put a smiley here.) > All you have to do is look at the Pep requests and tools such as PyChecker > to realise the deficiencies of the language. Actually, I am quite happy ignoring the PEPs, and so far have not found it necessary to integrate PyChecker into our development environment. We have done quite well without it so far (although I figure PyChecker would be of some small help and we'll probably use it eventually). Perhaps our testing processes (part of good software engineering) are adequate for the purpose. So your suggestion doesn't seem likely to reveal any significant deficiencies to me: if I haven't seen any myself, it must be because *for my purposes* there are none! > You could stick with Python as it matures ... How much more than 10 years old does a language have to be for you to call it mature? (No, that's merely a rhetorical question.) > ... and as long as you're a one man band that doesn't have to provide > long term support for something that you wrote (I mean *long* term - a 10 - > 15yr life for many products isn't uncommon - how long will your last job > survive in production?). Obviously you haven't worked at the architectural > level of any *large* projects (10's or even 100's of programmers) otherwise > you would never make the statements you do. Ignorance is bliss I guess :-) Erm, yes.... well. Our product design is intended to scale to hundreds of systems and have a lifetime of roughly ten years. I see no evidence after working on this project for two and a half years that we will not fulfill our objectives. In spite of my background in Systems Design Engineering and my professional engineering license, I suppose you may be right that I don't have what it takes to work on large projects. Luckily for me, your opinion on that matter is unlikely to raise any doubts in my mind, although I suppose you're quite welcome to express it. > In the meantime, Python seems to suit you, so enjoy! :-) I do! Thanks for the good wishes. :) -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From sdm7g at Virginia.EDU Thu Dec 20 15:27:50 2001 From: sdm7g at Virginia.EDU (Steven Majewski) Date: Thu, 20 Dec 2001 15:27:50 -0500 (EST) Subject: (semi) stackless python In-Reply-To: <9vrsnu$e6n$1@usc.edu> Message-ID: The new generators in Python2.2 implement semi-coroutines, not full coroutines: the limitation is that they always return to their caller -- they can't take an arbitrary continuation as a return target. So you can't do everything you can do in Stackless, or at least, you can't do it the same way. I'm not sure what the limitations are yet, but you might be surprised with what you CAN do. If all the generator objects yield back to the same 'driver' procedure, then you can do a sort of cooperative multithreading. In that case, you're executing the generators for their side effects -- the value returned by yield may be unimportant except perhaps as a status code. [ See also Tim Peters' post on the performance advantages of generators -- you only parse args once for many generator calls, and you keep and reuse the same stack frame. So I believe you get some of the same benefits of Stackless microthreads. ] Maybe I can find the time to post an example of what I mean. In the mean time, some previous posts on generators might give you some ideas. The ungrammatical title of that last thread above: "Nested generators is the Python equivalent of unix pipe cmds." might also suggest the solution I'm thinking of. -- Steve Majewski From slzatz at hotmail.com Sun Dec 30 11:46:48 2001 From: slzatz at hotmail.com (Steve Zatz) Date: Sun, 30 Dec 2001 16:46:48 GMT Subject: Help - command line arguments References: Message-ID: Thanks to both Hans and Emile. Setting sys.argv to the command line arguments did the trick. Thanks. From jkraska at san.rr.com Sun Dec 9 00:50:21 2001 From: jkraska at san.rr.com (Courageous) Date: Sun, 09 Dec 2001 05:50:21 GMT Subject: Calling a generator multiple times References: <0gn21usqeasqa1bp4sveh0vjagtmbmfpof@4ax.com> <3C11FE92.1218662@letterror.com> <3C127F1D.DD609D4D@xs4all.nl> <46051ugbk2aeaqeq4sb2aslurf4t22o70b@4ax.com> <3C1289D5.98BE76B4@xs4all.nl> Message-ID: >I have no idea what you mean with that last sentence. I think all >that Guido tried to say is something like "We could do A or we >could do B. Arguments either way aren't completely convincing, >so I'll just do whatever I think is best." What's so bad about >that? What's bad about that is pointing people to the PEP and expecting that it will settle a marked difference of opinion. Furthermore, I would suggest that if over time I am not alone in raising my exasperation here in comp.lang.python that the benevolent powers that be consider that for every poster there exist a hundred in agreement who don't post, and likewise that perhaps "language designer's intuition" can sometimes be clouded by the myopathy that sometimes exists in those who are very close to what it is they are passing judgement on. Those who say "work with this some, you'll get used to it" are far from the point. Python is not supposed to be an environment where you "get used to it". Unexpected variation in primary function with identical syntax is begging for trouble. The principle of least surprise is not being served. Something that was contentious enough to be discussed "1000 times" in the mailing list is certainly something you are going to be hearing more about again. C// From db3l at fitlinxx.com Thu Dec 13 22:01:56 2001 From: db3l at fitlinxx.com (David Bolen) Date: 13 Dec 2001 22:01:56 -0500 Subject: popen3 on windows and interactive subprocesses References: Message-ID: bsturk at news.rcn.com (Brian Sturk) writes: > Just as test I tried running python -u in this environment and > got some output but it looked like garbage, I can look into that > so at least I can support running python with -u. I'm wondering > if there are any Windows APIs I could use that would get me > the data? I don't think so - regardless of how you execute and connect to the process (the popen() calls under Windows eventually just call CreateProcess anyway), it's the executed application itself that is making the buffering choices based on the file handle representing stdin. So unless the application itself provides some control over this, there's very little you can do from the outside, Windows API or not. -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l at fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/ From maxm at mxm.dk Thu Dec 13 10:28:32 2001 From: maxm at mxm.dk (maxm) Date: Thu, 13 Dec 2001 16:28:32 +0100 Subject: gibman2worldonline.dk Message-ID: Jeg kan ikke komme igennem p? din icq. Jeg har sendt 117 beskeder, men du svarer ikke ... :-( Max From gmcm at hypernet.com Sat Dec 22 09:27:30 2001 From: gmcm at hypernet.com (Gordon McMillan) Date: 22 Dec 2001 14:27:30 GMT Subject: Book "python programming patterns". anybody read this?? References: Message-ID: Markus Jais wrote: > has anybody already read the book "python programming patterns" > published by prentice hall. > I thought this would be about design patterns in python > but the review at amazon says different things about this book. I was one of the tech editors. Haven't seen the final version, but what I saw was very good. It is *not* an intro book. The first couple chapters cover the grammar and basics, but only a *very* experienced programmer could learn Python from it. It's also *not* a rehash of the GOF book translated into Python. There's a fair amount on patterns in there, but from a very different perspective. (More strongly, it's not a rehash of anything - this is a very original book.) I would put the book more (but not completely) in the "algorithms" category. The example code is very sophisticated and thought-provoking (one example is continually expanded and revised). Not sure many people outside a CS dept will find the example directly useful, but if you're an experienced Pythoneer (or at least an experienced programmer with some knowledge of Python), the book will jog your brain in some new directions. (I'm not surprised by the Amazon review - I am a long-time Pythoneer and a very long-time programmer, and I had to study many of the examples carefully before understanding how they worked. But I found the experience rewarding.) -- Gordon http://www.mcmillan-inc.com/ From amberdelton at email.msn.com Sun Dec 2 18:40:09 2001 From: amberdelton at email.msn.com (amberdelton) Date: Sun, 2 Dec 2001 16:40:09 -0700 Subject: Very new to this References: <#k0oOh4eBHA.1192@cpimsnntpa03> <#EQGkj4eBHA.1188@cpimsnntpa03> <3C0AB92D.2010407@home.com> Message-ID: <#3jVur4eBHA.1404@cpimsnntpa03> thank you very much this will save me more headache. It has taken me all day just to write a simple little finacial calculator. From shalehperry at attbi.com Thu Dec 13 12:08:07 2001 From: shalehperry at attbi.com (Sean 'Shaleh' Perry) Date: Thu, 13 Dec 2001 09:08:07 -0800 (PST) Subject: Difference in formatting list and tuple values In-Reply-To: <20011213165905322.AAA289@mail.climatedata.com@SUEW2000> Message-ID: On 13-Dec-2001 Sue Giller wrote: > I am trying to format values from either a list or a tuple, and I am > getting the following odd (to me) behavior. I can format the tuple > entry using %d, but I get an error when I use the same formatting > for the same data in a list. > Why does this happen? > >>>> l = [1,2,3] # list >>>> t = (1,2,3) # tuple >>>> print "%02d" % t[:1] # format first entry in tuple ok > 01 >>>> print "%02d" % l[:1] # get error with list > Traceback (most recent call last): > File "", line 1, in ? > TypeError: an integer is required >>>> print "%02d" % tuple(t[:1]) # cast to a tuple works ok > 01 > l[:1] returns [1], not 1. The ':' is for slicing. It returns a new list (or tuple, or string) in the range specified. If you just want the first item ask for l[0]. Casting to a tuple works because the call then becomes: "%02d" % (1,) which is what the % operator expects -- a tuple of one item. From skip at pobox.com Fri Dec 14 13:50:12 2001 From: skip at pobox.com (Skip Montanaro) Date: Fri, 14 Dec 2001 12:50:12 -0600 Subject: Unsung Python modules In-Reply-To: References: <3dsnad226b.fsf@ute.mems-exchange.org> Message-ID: <15386.18916.707282.784261@beluga.mojam.com> Tim> 1) readline (optional built-in) Tim> 2) xreadlines Tim> Two similarly named but unrelated modules have made my whole life Tim> much easier. =) I agree on the readline module (don't have a lot of need to text file processing that sys.stdin.readlines() won't handle). It seems like I've travelled back to the dark ages whenever I have to use Python without readline or a "real" Bourne shell. Being able to recall a line or two from an interactive session from a few minutes before (or a few days before) makes day-to-day interaction with these tools so much easier. Readline gets slammed for being a bloated pig, but it is a highly useful bloated pig... ;-) -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From jpt.d at rogers.com Sun Dec 30 22:24:49 2001 From: jpt.d at rogers.com (Jeffrey Drake) Date: Mon, 31 Dec 2001 03:24:49 GMT Subject: REPOST: Re: Is learning Python "extraordinary"? References: <3C2E5706.5880983E@engcorp.com> <3C2EAD4D.77564075@engcorp.com> Message-ID: <6$--$$_----__$-__$@news.noc.cabal.int> When I was done highschool I knew something like 15 to 20 languages (this includes markup languages) with at least a passing. There were very few people around me that knew an more than 2 (from the programming courses). In college I didn't learn much new except for java in the first year. Mostly the teachers that were teaching things I already knew even got some aspects of it wrong. Unusual is the right word. Regards, jptd On Sat, 29 Dec 2001 22:02:57 -0800, Sheila King wrote: >On Sun, 30 Dec 2001 00:59:41 -0500, Peter Hansen wrote >in comp.lang.python in article <3C2EAD4D.77564075 at engcorp.com>: > >> It is still my opinion that a bright person who has learned >> several computer languages can learn Python enough to start >> working on non-trivial tasks with not much more than a week >> of learning, but that opinion is based solely on observation >> of a dozen perhaps quite bright people doing just that. > >I agree with the above assessment. Still, it is unusual, in the least to >find high school students that know 3+ programming languages. (Well, maybe >not in the heart of the Silicon Valley.) > >Anyhow, I think Jesse has probably decided by now, that it is certainly >worth mentioning in his essay. ;) > >-- >Sheila King >http://www.thinkspot.net/sheila/ >http://www.k12groups.org/ > ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: jpt.d at rogers.com (Jeffrey Drake) Newsgroups: comp.lang.python Subject: cmsg cancel <3c2fd9a9.27704196 at nntp> Control: cancel <3c2fd9a9.27704196 at nntp> Date: Mon, 31 Dec 2001 03:24:25 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009773942 27193 211.57.49.2 (31 Dec 2001 04:45:42 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:45:42 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From andreas at mtg.co.at Sun Dec 2 07:17:31 2001 From: andreas at mtg.co.at (Andreas Kostyrka) Date: Sun, 2 Dec 2001 13:17:31 +0100 Subject: a function like net send In-Reply-To: <9ubge7$vbg$01$1@news.t-online.com> References: <9ubge7$vbg$01$1@news.t-online.com> Message-ID: <200112021217.fB2CHZ115629@lap1.mtg.at> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am Samstag, 1. Dezember 2001 22:00 schrieb Ralf Claus: > Hello, > how can i produce a function like 'net send' (win32) > I don't want to import the os module. Why don't you want to import the os module? Basically you could try find out which Win32 API functions are used by net send, or try to replicate it on the network layer. If you do not have very important considerations, I'd stick with os.system. Andreas - -- Andreas Kostyrka; Raiffeisenstr. 16/9; 2320 Zw?lfaxing Tel: +43/676/4091256; Fax: +43/1/7065299 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8ChveHJdudm4KnO0RAgQeAKCvaPZJzCaKNYc1dq+GaS2vQNKD1gCggZG7 WwERoWhNzaH2shRw55+20+Q= =X3zh -----END PGP SIGNATURE----- From sholden at holdenweb.com Fri Dec 7 08:02:55 2001 From: sholden at holdenweb.com (Steve Holden) Date: Fri, 7 Dec 2001 08:02:55 -0500 Subject: Oracle Access References: Message-ID: "A. Keyton Weissinger" wrote in message news:mailman.1007725215.4754.python-list at python.org... > What is the best module out there for running queries (both DDL and DML) > against an Oracle 8i database? > cx_Oracle from http://www.computronix.com/utilities/ regards Steve -- www.holdenweb.com From ballsacks at xtra.co.enzed Sun Dec 2 04:31:48 2001 From: ballsacks at xtra.co.enzed (^^@++) Date: Sun, 02 Dec 2001 09:31:48 GMT Subject: Newbie: searching an English dictionary for a reg exp Message-ID: <3c09f02f.97177874@news.akl.ihug.co.nz> I want to search through the entire English language for a given regexp. So, I'll have say a 'dictionary.txt' file which contains every English word. Since I don't understand how python regexps work I'm kinda stuck. My guess is I should be doing something like: ##################################### import re import string # heres our regpattern - once I get it going I'll read # regpatterns from a file regpattern = 'abas?' # should return 'abash' and 'abase' dictionary = [] dictfile = open('dictionary.txt', 'r') line = dictfile.readline() while line != "": dictionary.append(line) line = string.strip(dictfile.readline()) reg = re.compile(regpattern) # search thru dictionary - print all matches for word in dictionary: m = reg.match(regpattern) if m: print m.group() ##################################### This doesn't word properly - so how do I print each word that matches? Have I gone about this in the correct way? Having the entire dictionary in memory could be dodgy I guess... Thanks -Matt From donn at drizzle.com Sat Dec 8 23:23:02 2001 From: donn at drizzle.com (Donn Cave) Date: Sun, 09 Dec 2001 04:23:02 -0000 Subject: Hiding stuff like passwords in source? References: <3c127bc8$0$29049$afc38c87@news.optusnet.com.au> Message-ID: <1007871781.601711@yabetcha.sttl.drizzle.com> Quoth "nobody" : | Keep your passwords in environment variables (if your OS doesn't support | them, or can't protect them from prying eyes, kill yourself immediately :). Can't protect them from prying eyes covers a lot of UNIX platforms. It's more like "don't" than "can't" - enviroment variables just aren't subject to any kind of access control, and if you think "well, they should be!", I suppose next you won't want us to be able to see your commands and parameters, etc. Systems like Kerberos, ssh, etc. use the filesystem for storage with access control. Donn Cave, donn at drizzle.com From phd at phd.pp.ru Wed Dec 26 12:46:02 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Wed, 26 Dec 2001 20:46:02 +0300 Subject: Where to post Jython questions? In-Reply-To: ; from danielk@aracnet.com on Wed, Dec 26, 2001 at 09:45:22AM -0800 References: Message-ID: <20011226204602.D15378@phd.pp.ru> On Wed, Dec 26, 2001 at 09:45:22AM -0800, Daniel Klein wrote: > Is the the proper place to post questions/conversations for Jython? If > not, please advise. http://www.jython.org/, Resources, Mailing Lists. Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From greg at cosc.canterbury.ac.nz Mon Dec 10 00:10:37 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Mon, 10 Dec 2001 18:10:37 +1300 Subject: PEP 276 Simple Iterator for ints (fwd) References: Message-ID: <3C1443CD.8BE38030@cosc.canterbury.ac.nz> James_Althoff at i2.com wrote: > > I agree with David. I think there should be an iterator But the iterator, if any, isn't going to be visible to the programmer. So this is an implementation issue, to be decided on the basis of considerations such as whether it will be faster to use one or not. (I suspect not, but the only way to find out is to try it.) -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From skip at pobox.com Sun Dec 30 14:47:11 2001 From: skip at pobox.com (Skip Montanaro) Date: Sun, 30 Dec 2001 13:47:11 -0600 Subject: Parrot aka Perl 6 info In-Reply-To: <3C2F3307.B47C9E26@earthlink.net> References: <3C2F3307.B47C9E26@earthlink.net> Message-ID: <15407.28479.118713.64183@12-248-41-177.client.attbi.com> Ron> I wonder if the Python core team is well aware of the Perl 6 Ron> efforts? Yup. A couple of the Parrot folks hang out on python-dev from time-to-time: http://mail.python.org/pipermail/python-dev/2001-December/018990.html -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From gmcm at hypernet.com Fri Dec 21 09:09:19 2001 From: gmcm at hypernet.com (Gordon McMillan) Date: 21 Dec 2001 14:09:19 GMT Subject: Is there a tool for python under Linux? References: Message-ID: =?gb2312?B?1cXJ2bPb?= wrote: > I want to know if there is a tool which can compile python's source > code into a standalone EXE file under Red Hat Linux7.0 ,for > example,compile my.py into my.exe under Linux. http://www.mcmillan-inc.com/install5_ann.html -- Gordon http://www.mcmillan-inc.com/ From spex66 at web.de Tue Dec 11 04:55:26 2001 From: spex66 at web.de (spex66) Date: Tue, 11 Dec 2001 10:55:26 +0100 Subject: PySpy 0.5 and probs with ActiveState distribution 2.1.1 Message-ID: <9v4lh8$5vd$1@news2.iabg.de> Datum:2001-08-17 10:15:14 PST TOM WROTE: T> PySpy does run-time visualization and analysis of Python software. T> T> See http://www.malcolmson.com/pyspy for more. T> Warning in advance - currently this only runs on Windows. T> I'll watch this thread for comments and feedback (thanks in advance). T> Tom I think it's an interesting approach, but I have problems when using ActivePython 2.1.1 Starting PySpy in a console and only make an 'import os'... I am in help> mode and cannot even leave it with 'quit' , ^Z or else... strange behaviour, does anybody dig into this further? I try to recompile the package but have no time (and understanding) to set up the 'pythoncore' workspace in MS VCV6... any tips or solutions? thanks Peter (=PA=) From sabren at manifestation.com Tue Dec 18 13:09:40 2001 From: sabren at manifestation.com (Michal Wallace) Date: Tue, 18 Dec 2001 13:09:40 -0500 (EST) Subject: RFC: duckbill design docs Message-ID: Hey All, I've been working on a billing system written in python. It's for subscription services and one-time bills. Anyway, I'm not quite ready to release the code, but I was wondering if anyone would mind giving feedback on the design document. (I use the docs as a focusing tool, and tend to update them fairly frequently, so they're more or less up to date) http://www.sixthdev.com/wiki.cgi/duckbill It's running MoinMoin so feel free to comment. Cheers, - Michal http://www.sabren.net/ sabren at manifestation.com ------------------------------------------------------------ Give your ideas the perfect home: http://www.cornerhost.com/ cvs - weblogs - php - linux shell - perl/python/cgi - java ------------------------------------------------------------ From qrczak at knm.org.pl Sat Dec 1 07:34:01 2001 From: qrczak at knm.org.pl (Marcin 'Qrczak' Kowalczyk) Date: Sat, 1 Dec 2001 12:34:01 +0000 (UTC) Subject: PEP 276 Simple Iterator for ints (fwd) References: <3C02E8FD.740D82FE@cosc.canterbury.ac.nz> Message-ID: Tue, 27 Nov 2001 16:36:51 -0800, David Eppstein pisze: >> Greg Ewing wrote: >> >> > While trying to think of a range syntax that looks >> > unambiguously half-open without clashing with list >> > or tuple constructors, the following blindingly >> > obvious solution occurred to me: >> > >> > for 0 <= i < 5: >> > ... >> >> +1 if it also groks "for 0 < i <= 5" and so on. > > Also +1 if it gives the reversed sequence for "for 5 > i >= 0". > > I don't much care about nice syntax for increments other than 1 and -1. I really like it. It's understandable even if somebody didn't know it. It's consistent with the meaning of '0 <= i < 5' as an expression in the same way as 'for i in s' is consistent with the 'i in s' expression. It shows which ends are included and which are excluded better than range(). It's resembles the mathematical notation used e.g. below the summation sign. It's easy to implement more efficiently than range(). It's backwards compatible. The higher bound can be omitted: 'for i >= 0'. If the body inside the loop rebinds the iteration variable (not a great idea but we must give it some meaning), it's IMHO reasonable to let it continue iteration from the new value. I.e. it's translated to 'while' rather than to 'for i in range'. -- __("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ QRCZAK From MarkH at ActiveState.com Mon Dec 3 02:09:31 2001 From: MarkH at ActiveState.com (Mark Hammond) Date: Mon, 03 Dec 2001 07:09:31 GMT Subject: Trouble with ref counts in C extension References: Message-ID: <3C0B25B1.5020606@ActiveState.com> Michel Pelletier wrote: > static PyObject * > FiclVM_pop(FiclVMObject *self, PyObject *args) > { > CELL c; > PyObject *ob; > > if (!PyArg_ParseTuple(args, ":pop")) > return NULL; > if (!stackDepth(self->ficl_vm->pStack)) > return NULL; // handle better... > > c = vmPop(self->ficl_vm); > > ob = (PyObject*)(c.p); > Py_DECREF(ob); The DECREF is not needed here. You need one DECREF to remove the reference that was consumed by the stack - but you then need one INCREF for the result of the function. The end result means that the function is reference neutral. FWIW: > if (!stackDepth(self->ficl_vm->pStack)) > return NULL; // handle better... Should be something like: if (!stackDepth(self->ficl_vm->pStack)) { PyErr_SetString(PyExc_ValueError, "Out of stack items"); return NULL; } (or any other exception value you choose) Mark. From claird at starbase.neosoft.com Mon Dec 24 12:25:26 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 24 Dec 2001 11:25:26 -0600 Subject: Embedding TCL in Python? References: <87bsgp9n1y.fsf@psyche.dnsalias.org> Message-ID: In article <87bsgp9n1y.fsf at psyche.dnsalias.org>, Carey Evans wrote: >Roy Smith writes: > >[...] > >> Second, I could start a separate TCL interpreter process, and have my >> Python program drive it with some sort of send/expect type interface. >> Possible, but ugly, and probably a real mess to code. > >I don't know if it would be *that* much of a mess. You could write a >couple of classes to hide the implementation details and keep the main >code fairly straightforward. > >> Lastly, I could just embed a TCL interpreter right in my Python process. >> This seems like it has promise, but I don't have much of a clue how to go >> about doing it. Has anybody done anything like that before? > >This is pretty much what Tkinter does, and you might be able to use it >to access your Tcl code without much development work, though I doubt >that this is supported: > >>>> import Tkinter >>>> tk = Tkinter.Tk() >>>> tk.tk.call('expr', '2 + 2') >'4' > >In any case, you should be able to get some ideas from it. > >There's also a project called Minotaur, although it doesn't seem to >have had anything happen to it recently. See: > > http://www.equi4.com/minotaur/minotaur.html . . . There are other variations, even. However, use of Tkinter.tk.eval("source myscript.tcl") should work for you immediately. Let us know if it doesn't. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From sjmachin at lexicon.net Fri Dec 28 16:18:25 2001 From: sjmachin at lexicon.net (John Machin) Date: 28 Dec 2001 13:18:25 -0800 Subject: import path, script path (was Re: module path) References: Message-ID: "Alex Martelli" wrote in message news:... > "Garett Shulman" wrote in message > news:n1an2u4rvau9f86r5dcl895lokb05354pr at 4ax.com... > > I would like to store my modules and scripts in a folder other than > > the python folder. Does anyone have any suggestions as to what I need > > to do in order to be able to import the scipts in the interpreter? Is > > there a path that the interpreter searches which I could modify? > [snipped: Alex's answer re first part of the OP's question -- path to follow when import mymodule ] 1. I note that (for win32) since Python 2.2, \lib\site-packages appears as the last entry of sys.path (and this is the default location where distutils unloads the truck when you say >python setup.py install). 2. Can somebody please help with the OP's implicit but not quite asked 2nd part of question: How to set up the path to follow when prompt> python myscript.py The answers are no doubt OS-specific; help for the Windows NT family would be personally appreciated. For example, having to do this is a pain: prompt>python %pythonbin%\Tools\Scripts\ndiff.py Cheers & TIA, John From jgardn at alumni.washington.edu Mon Dec 10 22:38:26 2001 From: jgardn at alumni.washington.edu (Jonathan Gardner) Date: Tue, 11 Dec 2001 12:38:26 +0900 Subject: Client/server chat program In-Reply-To: <9v38tp+b3d9@eGroups.com> References: <9v38tp+b3d9@eGroups.com> Message-ID: <200112110342.fBB3gkJ10144@my.knctv.co.kr> On Tuesday 11 December 2001 06:19 am, neuromorphus wrote: > Statement > > I'm creating a client/server chat program on my Linux system. It's a > group chat like ICQ, so all messages go through the server and then > broadcasted to online users. Note: for the time being, this program > will operate in a terminal/console, so no gui. > > Problem > > The client program continuously asks for 'raw_input' from the user,and > then sends the msg to the server to be broadcasted. However, I can't > output messages to the terminal/console, if the client program is > waiting for input. What happens is that after the client types a > message. All previous output(of other users) are then flush to > that client's screen. In other words, how do i get client input and > display current messages to the client's screen without having to wait > for the clients input. NOte: this is a terminal. > > Telnet does it some kinda way(it works perfect), but i'm trying to get > my client to work the same way. > You'll need to use non-blocking reads and writes. (Don't know if such a thing exists like you need it in Windows). What your program will look like is this: while 1: # Is anything ready to be read from (socket or std_in?) # if so, read it in. # Is there any pending output? (to std_out or to the socket?) # if so, write it out. Whenever your program wants to send a message to the socket or to std_out, just append it to the output string. So, for the above example, where whatever the guy types goes to the server, just take whatever is coming in on std_in and append it to the string that represents what you are sending out to the socket (and vice-versa for input from the server). Note that you may not be able to write everything out in one pass, so there may be leftovers from the last attempt to write everything. Oh well, you just have to wait until it is ready to be written to again. This will go for both the server and client. There are a number of useful pieces of code on the internet. I wrote something a long time ago that does what you need... take a look at http://sf.net/projects/simpymud/ in the CVS repository. I forget what does what, but it shouldn't be too hard to figure out. BTW, I think the server is the hard part. You already have a useful client in telnet. If you want a customized client, then work on that *after* you get the server figured out. Jonathan From bpt at tunes.org Sat Dec 8 11:13:09 2001 From: bpt at tunes.org (Brian P Templeton) Date: Sat, 08 Dec 2001 16:13:09 GMT Subject: request, info from pydoc References: Message-ID: <87adwuo0k9.fsf@tunes.org> Syver Enstad writes: > Michael Hudson writes: > >> Haven't heard of any. Would be cool, though (hint, hint :). > > Yeah, I agree, I looked briefly at the classes that implement pydoc, > and they already have a hierarchy for generating to different forms of > output. One for text and one for html, so it should definetively be > doable, let's say another subclass for texinfo. That has to be > compiled/processed in some way to make info files? > > The problem is that I don't know the first thing about texinfo and all > that stuff so I'll have to check out that first, but it sounds a bit > daunting with makeinfo and tex. I'd like to do some work on it but > I'll probably stop because there seems to be too many issues at the > time being. There is a version for java that I thought I could check > out to see how they've done it, but then I'll have learn and setup a > java environment before I can make use of it > Texinfo is not nearly as difficult to learn as plain TeX, and once you implement Texinfo support, you get both Info and TeX (thus also PostScript, DVI, and (yuck) PDF support) output. See the Texinfo manual (`C-h i m texinfo RET'), which has some examples. >> >> Cheers, >> M. > > -- > > Vennlig hilsen > > Syver Enstad hth, -- BPT /"\ ASCII Ribbon Campaign backronym for Linux: \ / No HTML or RTF in mail Linux Is Not Unix X No MS-Word in mail Meme plague ;) ---------> / \ Respect Open Standards From LLoeffler at home.com Mon Dec 17 13:23:01 2001 From: LLoeffler at home.com (Luke) Date: Mon, 17 Dec 2001 12:23:01 -0600 Subject: Update Oreilly books? References: Message-ID: <3C1E3805.6090009@home.com> I agree... Programming Python is a massive treasure trove of topics. It just covers so much. The Tkinter section is great and pretty extensive, the networking and CGI areas are good as well. Then there are the sections on system scripting and so forth. It is well rounded. My only complaint is the excessive code redundancy--they could have shaved 100-200 pages off the thing by not reprinting an entire code example when one or two lines change... L From lac at strakt.com Sat Dec 8 19:47:35 2001 From: lac at strakt.com (Laura Creighton) Date: Sun, 09 Dec 2001 01:47:35 +0100 Subject: pep proposal : A date object for the standard library In-Reply-To: Message from s.keim@laposte.net (sebastien) of "06 Dec 2001 03:46:44 PST." <7da8d8f8.0112060346.3e50092f@posting.google.com> References: <7da8d8f8.0112060346.3e50092f@posting.google.com> Message-ID: <200112090047.fB90lZua027820@ratthing-b246.strakt.com> Date has always struck me as very messy. Can't we find some other poor soul who has to maintain a date module and simply make available a python wrapper for his solution? How many tormented souls counting femtoseconds do we need? ;-) Laura Creighton From MateIn4 at hotmail.com Sun Dec 30 13:18:54 2001 From: MateIn4 at hotmail.com (Jose Vasconcellos) Date: Sun, 30 Dec 2001 18:18:54 GMT Subject: REPOST: Problems using Tix with Windows Python 2.2 Message-ID: <1$--$$_----__-%$-$@news.noc.cabal.int> I've installed Python 2.2 on Windows 98 and XP. Tried a few things and they seem to work ok. However, when I try to use Tix it fails: >>> import Tix >>> root = Tix.Tk() Traceback (most recent call last): File "", line 1, in ? NameError: name 'TixTk' is not defined Note that using Tkinter works fine. Using IDLE gives a similar error. Is python not configured properly? What to do? Jose ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.tele.dk!small.news.tele.dk!134.75.7.11!nntp.kreonet.re.kr!news.kigam.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Jose Vasconcellos Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:56:17 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774137 27193 211.57.49.2 (31 Dec 2001 04:48:57 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:48:57 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From logiplexsoftware at earthlink.net Fri Dec 21 14:26:54 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Fri, 21 Dec 2001 11:26:54 -0800 Subject: Python on the desktop In-Reply-To: <94e3fce8.0112210053.2568529d@posting.google.com> References: <94e3fce8.0112210053.2568529d@posting.google.com> Message-ID: <20011221112654.7abb7459.logiplexsoftware@earthlink.net> On 21 Dec 2001 00:53:17 -0800 sarat_venugopal at yahoo.com (Sarat Venugopal) wrote: > guess if speed is the only issue, Python should suffice for a number > of applications. A lot more than you might expect. > Most commercial applications wouldn't want to expose the source code > or even leave it as byte-code(Note: ActiveState has announced a > compiler for Perl) I am developing a commercial application in Python. I figure if someone wants to go to the trouble of decompiling the byte-code, well, that's what copyright laws are for. Even machine-binaries can be reverse-engineered (although it's more difficult), so I can't see this as being an overwhelming concern. Besides, as long as they aren't reselling it, who really cares? > 2. Absence of a standard GUI, which really fits the major platforms. > For a lanuage like Python, this is really a handicap. Would I do it in > Tkinter on Windows? No way. I guess that's why there are so many other > independent implementations out there. There is so much fragmentation > of effort here(Analogous to KDE, GNOME,...on Linux). I suggest taking a look at wxPython. It is increasing in popularity (IMHO, it's the most probable contender for a true "standard" GUI for Python) and provides a common API across several platforms. Additionally, it is based upon the native widget set of each platform so your applications look and feel like native apps. > > 3. Does the community see Python as a full-fledged programming > language? An anecdote: a colleague and I were working on a network application concurrently, taking two different approaches. He was going to implement it in C. Having heard of Python, I decided to give it a try. I downloaded it, read the standard docs and within a week had a working prototype, consisting of a multithreaded server and a basic GUI client. He had a few routines he was trying to debug. I remember Zope being projected as the killer app for > Python. Does that mean Python is going to hide behind web servers, be > yet another general/web scripting language and probably a rapid > prototyping tool? Probably to the same extent C was used only for developing operating systems. > What do you people think? This is the Python-list. We all hate Python and secretly code in C/C++. We only advocate Python in the hopes our competitors will adopt it and in doing so, destroy themselves because people using their applications will quickly realize that their first-to-market, easy-to-use, full-featured application wasn't written in a "real" programming language ;-) > "Merry Christmas!" You too. -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From Bill.Scherer at VerizonWireless.com Fri Dec 14 11:43:50 2001 From: Bill.Scherer at VerizonWireless.com (Scherer, Bill) Date: Fri, 14 Dec 2001 11:43:50 -0500 (EST) Subject: Unsung Python modules In-Reply-To: <3dsnad226b.fsf@ute.mems-exchange.org> Message-ID: On 14 Dec 2001, Andrew Kuchling wrote: > There are some Python modules that deserve to be more widely known > outside of the Python community, because they're such handy > timesavers. My list of modules that don't get enough publicity would > include: > > * Reportlab, for generating PDF files: I can't believe that people > would wrestle C code for pdflib when they could just write Python > code. I just started using Reportlab. It's absolutley fantastic. My project manager was astounded by the report quality; he said "I can't believe Python can produce a report that looks that good." > What's your favorite unsung module? Queue, and Pyxie. Queue is so handy for many tasks when multithreaded. Pyxie is the easiest way I've yet found to deal with xml, both parsing and generating. -- Bill.Scherer at Verizon Wireless RHCE 807101044903581 From loewis at informatik.hu-berlin.de Sun Dec 9 13:43:09 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 09 Dec 2001 19:43:09 +0100 Subject: __subclasses__() (was OK, now *this* is cool) References: <3C112086.5F7072A9@accessforall.nl> <3C13404D.F7A60179@accessforall.nl> Message-ID: Ype Kingma writes: > Do I understand correctly that subclass references are weak links > because a subclass may disappear (become not live) and a normal subclass > reference could then keep the subclass accessible only because the > of the existence of the normal subclass reference in the super class? Yes, but it is worse: the subclass also holds a reference to the base class (in __bases__), so you would get a cyclic reference. That means that even if both the subclass and the derived class become garbage, they would be still alive until the cyclic garbage collector finds them. > To avoid this problem (superfluous reference to subclass) weak links are > used so that the garbage collector can free the subclass when expected. If all goes well, the cyclic garbage collector won't even see the subclass. The normal reference counting should drop them as soon as the last strong reference is lost. > When a real reference is needed as a result if the __subclasses__() method > this method then checks all weak references and (atomically) > creates normal references from the ones that are still valid. Exactly. The __subclasses__ attribute could also report the list of weak references; it is primarily for convenience (I think) that it does not. Furthermore, the functional notation immediately removes the idea that you may want to assign to __subclasses__, or otherwise modify the result list (you can modify the result list, but that has no effect). > Superclass references should be normal references because they > are needed to find attributes by inheritance. Right. A superclass must stay alive as long as there are subclasses, which must stay alive as long as there are instances. > I suppose the cycles you mention are not direclty related to the former > python problem that the garbage collector could not get rid of objects > in cycles? Historically, absence of both weak references and collection of cycles would have prevented introducing the feature in Python. It turns out that strictly speaking, you need only on or the other, and that collection of cycles is more general. However, people still like the CPython property that objects normally go away once the last application reference is lost; that saves memory and computation time (since the cycles collector won't have to deal with such objects). In this specific case, weak references are they means to preserve this desirable property. Regards, Martin From eddie at holyrood.ed.ac.uk Thu Dec 20 14:01:42 2001 From: eddie at holyrood.ed.ac.uk (Eddie Corns) Date: Thu, 20 Dec 2001 19:01:42 +0000 (UTC) Subject: elegent sql building References: <1a241b9d.0112120534.cea1fa4@posting.google.com> Message-ID: <9vtcim$dnp$1@scotsman.ed.ac.uk> cmedcoff at home.com (Charles Medcoff) writes: >I recently read (parts of) "Dive Into Python" which inspired me to >write something like the following: >def buildSql(ids, engineTypes, transTypes): > return "SELECT * FROM vehicle WHERE id in (%s) AND engineType IN >(%s) AND transType IN (%s)" % \ > (",".join(["'%s'" % (id) for id in ids]), > ",".join(["'%s'" % (e ) for e in engineTypes]), > ",".join(["'%s'" % (t ) for t in transTypes])) >print buildSql(['vin1', 'vin2', 'vin3'], ['4cy', '6cy'], ['4sp', >'5sp'] ) >Now you can imagine where the inputs to buildSql might trickle down >from a user interface. This is nice; perhaps even elegent. There is >a problem with it though. What if any one of, or all of, the inputs >are empty? The code needs to figure out whether to include the >"WHERE" and the "AND"'s and where to put them. A chain of if's would >be inelegent. Is there a better solution? Suggestions appreciated. First attempt: def buildSql(ids, engineTypes, transTypes): return " WHERE ".join(filter(None,["SELECT * FROM vehicle"," AND ".join(filter(None,["%s IN (%s)" % (b,a) * max(0,min(1,len(a))) for a,b in zip([",".join(["'%s'" % i for i in x]) for x in [ids,engineTypes,transTypes]],["id","engineType","transType"])]))])) There's a fairly nasty trick in there! Second (much better) attempt: def buildSql(ids, engineTypes, transTypes): return " WHERE ".join(filter(None,["SELECT * FROM vehicle"," AND ".join([" IN ".join ([b,"(%s)"%a]) for a,b in zip([",".join(["'%s'" % i for i in x]) for x in [ids,engineTypes,transTypes]],["id","engineType","transType"]) if a])])) >>> print buildSql(['vin1', 'vin2', 'vin3'], ['4cy', '6cy'], ['4sp','5sp'] ) SELECT * FROM vehicle WHERE id IN ('vin1','vin2','vin3') AND engineType IN ('4cy','6cy') AND transType IN ('4sp','5sp') >>> print buildSql(['vin1', 'vin2', 'vin3'], ['4cy', '6cy'], [] ) SELECT * FROM vehicle WHERE id IN ('vin1','vin2','vin3') AND engineType IN ('4cy','6cy') >>> print buildSql(['vin1', 'vin2', 'vin3'], [], [] ) SELECT * FROM vehicle WHERE id IN ('vin1','vin2','vin3') >>> print buildSql([], [], [] ) SELECT * FROM vehicle >>> print buildSql([], ['4cy', '6cy'], [] ) SELECT * FROM vehicle WHERE engineType IN ('4cy','6cy') Homework exercise: fill in the blank to generalise it better :) def buildSql(table, values, names): return ... buildSql ("engines", [[1,2],[],[],[11,22]], ["id","type","size","weight"]) --> SELECT * FROM engines WHERE id IN ('1','2') AND weight IN ('11','22') At the end of the day I think using 'if' would be more sane!! Eddie From forgottengentleman_spam at yahoo.com Tue Dec 4 10:43:27 2001 From: forgottengentleman_spam at yahoo.com (forgotten gentleman) Date: 4 Dec 2001 07:43:27 -0800 Subject: Quick GC question References: Message-ID: Michael Hudson wrote: > FWIW, I doubt there's a Lisp implementation in existence with a gc > much like Python's. Yeah, I struggled a bit with that, but just let it be. :-) Thanks everyone for the answers. From peter at engcorp.com Thu Dec 27 22:55:53 2001 From: peter at engcorp.com (Peter Hansen) Date: Thu, 27 Dec 2001 22:55:53 -0500 Subject: REPOST: Re: set decimal place References: <3c291037.4684696@news.tm.net.my> <3C292938.ED322C60@bellatlantic.net> <184fbd02.0112260109.4392423@posting.google.com> <3C2A29A5.8E9FB5BE@engcorp.com> <3C2B794A.800A94E5@attbi.com> Message-ID: <2$--$$_----_-$--_$@news.noc.cabal.int> Chris Barker wrote: > > Peter Hansen wrote: > > > >>> 10.0/3 > > 3.3333333333333335 > > >>> round(10.0/3, 4) > > 3.3332999999999999 > > ^^^^^^^ > > This doesn't really solve the OP's problem. > > > The concept of "having 4 decimal places" is meaningless with > > floating point representations until you actually display the > > value as a formatted string. > > not completely. you might want to check if two values are the same to 4 > decimal places, in which case round should work just fine: > > >>> 10.0/3 == 10.00001/3 > 0 > >>> round(10.0/3,4) == round(10.00001/3,4) > 1 I don't know if this is guaranteed to work in all cases. Comparing floating point values directly is generally not a good idea, although I don't know whether this applies to rounded values, and if so how far you have to round them before it makes it safe. If it is safe, you have a valid point, but not likely what the OP wanted. -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.gamma.ru!Gamma.RU!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Peter Hansen Newsgroups: comp.lang.python Subject: cmsg cancel <3C2BED49.E54CB73E at engcorp.com> Control: cancel <3C2BED49.E54CB73E at engcorp.com> Date: Mon, 31 Dec 2001 04:09:43 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775433 27193 211.57.49.2 (31 Dec 2001 05:10:33 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:10:33 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From henrik at moskau.hmotakef.homeip.net Sat Dec 29 17:26:40 2001 From: henrik at moskau.hmotakef.homeip.net (Henrik Motakef) Date: 29 Dec 2001 22:26:40 +0000 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: <87k7v5hdcv.fsf@moskau.hmotakef.homeip.net> Paul Everitt writes: > I'm interested in hearing more about the Pet Shop example you > mentioned. Is it a canonical example that is written up somewhere > else for a different system? "The JavaTM Pet Store Demo is a sample application from the Java 2 Platform, Enterprise Edition Blue Prints (J2EETM BluePrints) program at Java Software, Sun Microsystems. It demonstrates how to use the capabilities of the J2EE 1.3 platform to develop flexible, scalable, cross-platform enterprise applications" (http://developer.java.sun.com/developer/sampsource/petstore/index.html) "Compared to the Java Pet Store, Microsoft claims that the .NET version requires one-third the lines of code (LOCs) and provides 28 times faster average response times (for 450 concurrent users), requires one-sixth the CPU-utilization, and scales much better as the number of users increases." (http://www.onjava.com/pub/a/2001/11/28/catfight.html) hth Henrik From bryan at eevolved.com Sat Dec 1 06:06:24 2001 From: bryan at eevolved.com (Bryan) Date: Sat, 1 Dec 2001 06:06:24 -0500 Subject: CryptKit 0.9: cryptsock In-Reply-To: <7xofljlfgh.fsf@ruckus.brouhaha.com> References: <7xofljlfgh.fsf@ruckus.brouhaha.com> Message-ID: On Friday 30 November 2001 11:41 pm, Paul Rubin wrote: > Bryan writes: > > > Stupid newbie question: How does cryptsock guard against a > > > man-in-the-middle attack? > > > > Good question. This version doesn't. The next version will implement > > ECPAK. I am trying to stay away from CA's for now. Any suggestions? > > CA's are for when you're trying to talk to complete strangers. If > you're trying to talk to someone you already "know", the obvious > non-CA authentication strategy is use a shared secret key. You still > want to want DH-like key agreement for the channel encryption, because > of the forward secrecy. When you say "shared secret key" do you mean that the remote and local hosts both have apriori knowledge of the symmetric key? Or are you referring to some other mutually shared token, like a password? If you meant the latter, then I agree with you completely and you should see that feature appear in the next release :) Take care, -- <=====================================> Bryan Mongeau Lead Developer, Director eEvolved Real-Time Technologies Inc. Website: http://www.eevolved.com Public key: http://eevolved.com/bcm.pk <=====================================> "Imagination is more important than knowledge."-- Einstein From h.jehadalwan at student.kun.nl Sat Dec 22 10:40:23 2001 From: h.jehadalwan at student.kun.nl (husam) Date: Sat, 22 Dec 2001 16:40:23 +0100 Subject: Search the difference: Why this function defenition does'nt work? Message-ID: <3C24A967.3070604@student.kun.nl> hi, I'm a beginner to python and try to understand some basic stuff. Hier are two function defenitions , which look the same for me, but the second one does not work. Can anybody explain why? def fun1 (*args): sum=args[0] for next in args[1:] sum=sum+next return sum print fun1('a','b','c') >>>abc def fun2 (*args): sum=args[:0] for next in args[1:] sum=sum+next return sum print fun2('a','b','c') >>> TypeError: illegal argument type for built-in operation Thanks in advance. PS: the first code is taken from Learning Python by Lutz & Ascher. The second one is the one I made to solve a small educational problem. From jessefw at loop.com Sun Dec 2 21:31:33 2001 From: jessefw at loop.com (Jesse F. W) Date: Sun, 2 Dec 2001 18:31:33 -0800 Subject: Documention suggestion (was: Copy operator) Message-ID: <3C0A7385.2827.1F40E9BC@localhost> Dear python-doc person(Fred Drake?), Please, please add a link somewhere in the documentation (Tutorial, maybe) to Fredrik Lundh's Guide to Python Objects (with his permission, of course). It is a very well written guide to the issue of objects and names and references which I think has repeatedly come up on comp.lang.python. The address is: http://w1.132.telia.com/~u13212494/guides/python-objects.htm Thank you very much, Jesse W From hanche at math.ntnu.no Sat Dec 8 07:29:20 2001 From: hanche at math.ntnu.no (Harald Hanche-Olsen) Date: 08 Dec 2001 13:29:20 +0100 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C100BB2.6446E896@cosc.canterbury.ac.nz> <7da8d8f8.0112070206.49e1bef4@posting.google.com> <3C114F6D.D1E2D291@attbi.com> Message-ID: + Chris Barker : | Harald Hanche-Olsen wrote: | I think that keeping calendrical calculations and time issues | > strictly separate is a good idea myself. I would even go so far | > as to suggest a completely separate module just for dates and | > calendars. [...] | | I disagree. A Date module that doesn't even understand hours would | have pretty limited usefulness. Not at all. Dates are important. Interest is still charged by the day, not by the hour, AFAIK. And many historical events are tied to dates more than to the hour. Similarly with project deadlines. Most of the items on my to do list, if they have a deadline associated with them at all, need to be done before a special date, not some specific hour or minute on that day. There must be loads of other examples, even if you and I can't think of them off-hand. | > An advantage of this scheme is that a date module | > has at least a chance of becoming simple enough to become a part of | > python. I will make no such assertions about time. | | It has to be both simple and useful. I think it would fail the useful | test. I tried to argue against that point above, but I would not at all suggest we should stop with the dates module: If a really good one can be made, it could be a stable foundation on which to build the time module. The latter is so tricky and full of pitfalls, you really need to have nailed down the date part firmly before you even begin the attempt. | A DateTime module that doesn't resolve any finer than seconds would | be very usefull, and I think doable. With all this leap-second | stuff, resolving finer than that just isn't worth it. Well, the leap-second stuff is per definition a visible problem at the seconds level, so you just can't avoid thinking about it. And once you know how to deal with seconds, handling sub-second timing is a totally trivial exercise, hardly worth arguing about. Even resolving hours can be hard enough, given the way politicians like to fool around with daylight saving time. Do you know how to convert 2008-10-02 14:30 CET to UTC? I certainly don't. CET is Central European time. By present rules, daylight saving time will be in effect on that date, so the time would be 2008-10-02 12:30 UTC. But if politicians change back to the older rule of ending daylight saving time on the last Sunday of September, or if they abolish daylight saving time altogether, the right answer is 2008-10-02 13:30 UTC. What should the module do if you ask it to do the conversion? It might silently assume today's rule will be in effect, it might print a warning, or it might raise an exception. Or it might ignore the problem altogether, by only allowing numeric time zones, thus abdicating the responsibility and leaving it up to the application developer. I find none of the alternatives really appealing. Just have a look at Arthur Olson's timezone library some day, and shudder. The current version of the zoneinfo files total over 8000 lines - admittedly almost half of it is comments, but this is work you just don't want to duplicate. -- * Harald Hanche-Olsen - Yes it works in practice - but does it work in theory? From phr-n2001d at nightsong.com Mon Dec 10 17:18:54 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 10 Dec 2001 14:18:54 -0800 Subject: Client/server chat program References: Message-ID: <7xpu5m3ei9.fsf@ruckus.brouhaha.com> "neuromorphus" writes: > The client program continuously asks for 'raw_input' from the user,and > then sends the msg to the server to be broadcasted. However, I can't > output messages to the terminal/console, if the client program is > waiting for input. What happens is that after the client types a > message. All previous output(of other users) are then flush to > that client's screen. In other words, how do i get client input and > display current messages to the client's screen without having to wait > for the clients input. NOte: this is a terminal. > > Telnet does it some kinda way(it works perfect), but i'm trying to get > my client to work the same way. The usual way to do this is use separate threads for reading input and displaying messages. From marco.stagnoNOSPAMTHANKS at libero.it Tue Dec 18 15:22:22 2001 From: marco.stagnoNOSPAMTHANKS at libero.it (Marco Stagno) Date: Tue, 18 Dec 2001 20:22:22 GMT Subject: implementing a timer? References: <9vn0gv$ll6$1@colo.mobo-it.nl> Message-ID: >I'm trying to make a script that will check if i have mail every let's say >10 minutes.So i tought let's use something like a timer. But i can't find >any documentation on how to implement something like this. if you are looking for something else than time.sleep (that block your program) you can build a class and use a "timer object". I did it, if you are interested in, I can send you the code. bye bye MAS! From mertz at gnosis.cx Thu Dec 27 16:25:10 2001 From: mertz at gnosis.cx (Lulu of the Lotus-Eaters) Date: Thu, 27 Dec 2001 16:25:10 -0500 Subject: Python Popularity: Questions and Comments (fwd) Message-ID: <2G5K8kKkXQhP092yn@bellatlantic.net> Justin Sheehy wrote: |A very large portion of software is never sold directly, and thus |doesn't ever get promoted in the fashion that I think you are looking for. |The software that I am talking about is developed for use internally |at a given company, either internally-developed or by contractors. >From what I have read, well over 90% of software is developed and used internally by organizations. 95% or even 98% would not seem at all absurd to me, and I have read estimates in that sort of range. Certainly, my own experience is consistent with this. Even at those companies I have worked for that sold software, as much software was developed for internal use as for sale. But the majority of contracts I have done have been on 100% internal-usage projects. Yours, Lulu... From djmitchell at optushome.com.au Fri Dec 7 21:29:35 2001 From: djmitchell at optushome.com.au (djmitchell) Date: Sat, 08 Dec 2001 13:29:35 +1100 Subject: finance programs References: Message-ID: <3c117b54$0$27197$afc38c87@news.optusnet.com.au> > Are there any fnance packages being worked on that anyone knows about? > Maybe something that I can at least get ideas from? In the book "Python Programming on Win32", one of the examples in the first few chapters is a finance package. From memory (I haven't read this part of the book for a while), it doesn't go into massive depth, but it covers the initial app design and lots of specific bits in reasonable depth. I'm pretty sure the focus of this section is using Python to write the functional parts of the app, then exposing these bits as COM objects for use by a VB-coded GUI. Again, my memory might be playing tricks. Check out the book in your local bookshop to see if it covers what you want. Good luck Dave M. From phr-n2001d at nightsong.com Mon Dec 31 13:54:53 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 31 Dec 2001 10:54:53 -0800 Subject: Client-side web scripting in Python? References: <8abfe95a.0112311037.35fb4c2@posting.google.com> Message-ID: <7x3d1r2paa.fsf@ruckus.brouhaha.com> rolffreimuth at hotmail.com (Rolf) writes: > Is there any way to do *pure* python client-side scripting? Are there > any good resources with examples of how to do it? If you mean for publishing web pages on the internet, it doesn't sound like such a great idea. I've stopped paying attention to Windoze but I believe there's a Python version (ActiveState?) that's callable as a COM object. So you'd have to download the huge interpreter to the client, and then you could call it from Javascript. You should be able to pass it the document object as an argument. From there, the python script can use the regular COM automation methods to navigate inside the document object, or it can call javascript code to manipulate the document. I've forgotten most of this stuff but basically once you get hold of the IWebBrowser2 interface you can make the browser do most anything you want. From tjiit at yahoo.com Wed Dec 26 06:37:37 2001 From: tjiit at yahoo.com (tjiit) Date: Wed, 26 Dec 2001 12:37:37 +0100 Subject: strange Tkinter problem References: <3C297E61.70701@home.com> Message-ID: On Wed, 26 Dec 2001 08:38:09 +0100, Luke wrote: > This is behavior common to pretty much all GUI's. Your callback > function triggered by a button click should run in a new thread, or > spawn a new thread in which the networking code runs. Does this mean that the GUI should do this or me? >Check out the > threading and thread modules. > From borcis at geneva-link.ch Mon Dec 24 20:23:26 2001 From: borcis at geneva-link.ch (Boris Borcic) Date: Tue, 25 Dec 2001 02:23:26 +0100 Subject: [OT] Season's Greetings References: Message-ID: <3C27D50E.DF248491@geneva-link.ch> Steve Holden wrote: > > To all those who celebrate at this time of year, before the desktop goes > down for the holidays: > > Season's Greetings and a Prosperous 2002 Thanks samewise. Fearfully symmetric, almost like a tiger, 2002, wouldn't you say ? Note that 2002 = 2 * 7 * 11 * 13, an early pqrs number - the 12th exactly : 210, 330, 390, 462, 546, 770, 858, 910, 1155, 1365, 1430, 2002 BB -- 12 ? 12 is the least natural integer symbolizing the set just by itself. Successors : 123, 1234... > > regards > Steve > -- > http://www.holdenweb.com/ From maxm at mxm.dk Sun Dec 30 11:36:03 2001 From: maxm at mxm.dk (maxm) Date: Sun, 30 Dec 2001 17:36:03 +0100 Subject: REPOST: Re: Zope Documentation (was RE: Python Popularity: Questions and Comments) References: <3C2E55A6.D873E301@engcorp.com> Message-ID: <1$--$$_----_%-_%$$@news.noc.cabal.int> "Bill Tate" wrote in message > "Xxxxxx is the world's first company dedicated to using the science > of experience strategy, design, and technology to create > extraordinary results for our clients. > > Our entire team is committed to transforming our clients' > businesses through the creation of multi-channel experiences that > inspire and strengthen dynamic connections among people, businesses, > channels, and communities." Somebody needs to read the cluetrain manifesto ;-) http://www.cluetrain.org/ regards Max M ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "maxm" Newsgroups: comp.lang.python Subject: cmsg cancel <%nHX7.5124$aS.893825 at news010.worldonline.dk> Control: cancel <%nHX7.5124$aS.893825 at news010.worldonline.dk> Date: Mon, 31 Dec 2001 04:53:48 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774184 27193 211.57.49.2 (31 Dec 2001 04:49:44 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:49:44 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From fperez528 at yahoo.com Thu Dec 20 10:18:09 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Fri, 21 Dec 2001 14:46:09 +2328 Subject: Distutils question References: <9vu28t$4g9$1@peabody.colorado.edu> Message-ID: Michael Hudson wrote: > A terrible pun. I would explain, but then I wouldn't have to shoot > you because it would have already killed you. got it. As I said, dumb foreigner... :) > >> btw, the recent postings to the distutils mailing list seem to point >> to improvements, and the current docs (on the web, not the ones from >> python 2.1) are indeed better. So I might wait out for 2.2 to come >> out before complaining too loudly. > > Feel free (hurrah!). > >> I really hope distutils fully matures, it seems very nice but >> yesterday trying to do things outside of the very narrowly defined >> options of stetup() felt like a huge PITA. Maybe I'm just dumb. > > I think that's fair enough. The code for distutils is generally quite > nice, though, so once you've got some idea how it works, sticking your > head into the source becomes an option. At least that's what I've > found (although I don't actually *use* distutils much, I just try to > close bug reports on it :). Well, 2.2 is just officially out. So I'll see if the new distutils docs are enough to soothe my aching soul, and otherwise I'll go and moan at the distutils-sig. Thanks, f. From root at [127.0.0.1] Sat Dec 8 15:44:56 2001 From: root at [127.0.0.1] (nobody) Date: Sun, 9 Dec 2001 06:44:56 +1000 Subject: Hiding stuff like passwords in source? References: Message-ID: <3c127bc8$0$29049$afc38c87@news.optusnet.com.au> Keep your passwords in environment variables (if your OS doesn't support them, or can't protect them from prying eyes, kill yourself immediately :). Add to the top of your script: USERNAME = 'guest' PASSWORD = 'guest' #any other variables that need to be easily seen by others if os.getenv('somesite_username') != None: USERNAME = os.getenv('somesite_username') if os.getenv('somesite_password') != None: PASSWORD = os.getenv('somesite_password') Anyone you send the script to can see plain as day where they have to change their username/password info, and if they're a little smarter they'll notice they can also set their environment variables. Additionally, this script will now function for all users on a multiuser system (and can therefore be world readable/executable), all they have to do is add their username/password to their profile and voila. From rdsteph at earthlink.net Sat Dec 29 20:27:08 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sun, 30 Dec 2001 01:27:08 GMT Subject: Zope Documentation (was RE: Python Popularity: Questions and Comments) References: <3C2E55A6.D873E301@engcorp.com> Message-ID: <3C2E6E87.6F8E7FE1@earthlink.net> Bill Tate wrote: > > I understand the "zen" thing, To which Peter Hansen replied >>If you say that, then you don't really understand it. ;-) I would just like to add, if you meet the Buddha on the road, Kill him... But anyway, I subscribe to the church of Tim Peters and the Zen of Python, introspectively yours, Ron Stephens From chris.perkins at inbusiness.com Sun Dec 16 16:23:31 2001 From: chris.perkins at inbusiness.com (Chris Perkins) Date: 16 Dec 2001 13:23:31 -0800 Subject: Idiomatic portable way to strip line endings? References: Message-ID: Tim Hammerquist wrote in message news:... > In general, I can use: > > line = line[:-1] > or > del line[-1:] > > to strip the last character off the line, but this only works on > operating systems that have a one-byte line separator like Unix/Linux > ('\n'). The Win32 line separator is 2-bytes ('\r\n'), so this > solution is not portable. Actually, line[:-1] works just fine on Windows, as long as you read the file in non-binary mode, because the '\r\n' line-endings are all turned into '\n' when the file is read. They're also turned back into '\r\n' when you write the file, which has the interesting effect that you can turn Unix text-files into Windows text-files like this: t = open(filename,'r').read() open(filename,'w').write(t) This is handy, but also somewhat disturbing - the file is changed by writing its contents back to it seemingly unaltered. > line.replace(os.linesep, '') > > The above works when iterating over text files, but fails if only a > final linesep should be stripped. OTOH, I've seen the non-portable: > > line = line[:-1] > > in production code. I've found that os.linesep causes more trouble than it solves when trying to write portable, file-writing code. Seemingly innocent code like this: f = open(filename,'r') f.write(os.linesep.join(['One','Two','Three'])) f.close() actually writes a file with screwed-up line-endings on Windows - '\r\r\n' to be precise (which, I have discovered, shows up single-spaced in some Windows text-editors and double-spaced in others). f.write('\n'.join(['One','Two','Three'])) ,on the other hand, does the right thing on both Windows and Linux. So unless I'm using binary mode for reading and writing files, I use '\n' and line[:-1] everywhere. It's odd that hard-coding '\n' is more portable than using os.linesep, but I've just gotten used to it. Chris Perkins From freebird317 at hotmail.com Thu Dec 27 19:55:53 2001 From: freebird317 at hotmail.com (~Jason~) Date: Fri, 28 Dec 2001 00:55:53 GMT Subject: tcl??? References: <%FOW7.8662$7p6.139123@rwcrnsc51.ops.asp.att.net> Message-ID: I am running XP; and the error I am getting when I type in "tclsh80" is [File"","line 1, in ? tclsh80 NameError: Name tclsh80' is not defined] "Cameron Laird" wrote in message news:F04033885EB8E6B4.9FC55B6D4BB76607.687DFFE1D62C3AA4 at lp.airnews.net... > In article <%FOW7.8662$7p6.139123 at rwcrnsc51.ops.asp.att.net>, > ~Jason~ wrote: > >I am playing around with Python and it is telling me that to activate tcl > >type tclch80. I do this and I get an error. I think may be it is because > >either I am typing in the wrong version or I do not have it? Am I right and > >if so how do I correct it? And if I am wrong, how do I fix it? What it > >wants me to do is type [% put "Hello World"] and I do that and I get an > >error, why? > . > . > . > I don't recognize this description--which likely > reflects more on my ignorance than your own pre- > cision. > > What operating system are you using? > > You're likely to get farther with > tclsh > rather than > tclch80 > and > puts "Hello World" > rather than > put "Hello World" > > It's likely that those in a position to answer you > will do so more swiftly and accurately when you > supply an exact error message, as opposed to, "I > get an error." Tell us which error. You might > like to read . > -- > > Cameron Laird > Business: http://www.Phaseit.net > Personal: http://starbase.neosoft.com/~claird/home.html From klopsix at poczta.onet.pl Fri Dec 28 18:13:22 2001 From: klopsix at poczta.onet.pl (Tomasz Wójcik) Date: Sat, 29 Dec 2001 00:13:22 +0100 Subject: Allegro interface for Python Message-ID: <3c2cfc94$1@news.vogel.pl> Have you found anything interesting? Is it possible???? From duncan at NOSPAMrcp.co.uk Thu Dec 13 03:45:35 2001 From: duncan at NOSPAMrcp.co.uk (Duncan Booth) Date: Thu, 13 Dec 2001 08:45:35 +0000 (UTC) Subject: more fun with PEP 276 References: Message-ID: "Tony J Ibbs (Tibs)" wrote in news:mailman.1008176597.9834.python-list at python.org: > For American English speakers, I suspect that:: > > for i in -5 through 5: > > and:: > > for i in -5 to 5: > > may work (did I get that right?), but for British English speakers those > wouldn't work terribly well (even despite the gradual merging of > languages), since that distinctive use of "through" is not common. Don't the Americans spell it 'thru'? -- Duncan Booth duncan at rcp.co.uk int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3" "\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure? From maxm at mxm.dk Sun Dec 16 15:50:43 2001 From: maxm at mxm.dk (maxm) Date: Sun, 16 Dec 2001 21:50:43 +0100 Subject: persistant options References: Message-ID: "Andrei Kulakov" wrote in message news:slrna1q0ud.pf6.sill at sill.silmarill.org... > Hello, > I'm looking for solutions or advice on persistant options / config file. > Here's an example file: > > ~/.programrc > # this option does [...] > opt1 = 3 > > When the program is run and this option's changed from inside program, > it should be written back to the config file. If you only change the options from inside the program, you could just use a simple database via "anydbm": import anydbm db = anydbm.open('c:/temp/dumbdbm_test', 'c') db['egg'] = 'eggs' db['spam'] = 'spammers' db.close() del(db) db = dumbdbm.open('c:/temp/dumbdbm_test', 'r') print db['egg'] print db['spam'] db.close() >>>eggs >>>spammers regards Max M From tim at vegeta.ath.cx Fri Dec 21 12:23:17 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Fri, 21 Dec 2001 17:23:17 GMT Subject: age of new pythonistas [was: The Editor Poll results are in!] References: <60c49aa9.0112202148.7218555b@posting.google.com> Message-ID: Dan Compton graced us by uttering: > I tried some Perl but found it to be way too much of an intimidating > mess of syntax and modules. If I'd cast Perl aside when you did, I'd have seriously sold myself short. Perl is a valuable tool, ideal for different tasks than Python, but valuable nonetheless. > I also learned Tcl and found it to be a better alternative to Perl I don't know if that was a joke, but it gave me a good laugh, FWIW. > if you know what I mean, Less and less with each sentence. > I think Python is great because it is well designed (unlike Perl), Wait, didn't you give up on Perl before you knew it well enough to make that kind of statement? > (...but I might be wrong about that due to ignorance), You might. Tim Hammerquist -- In Devon, Connecticut, it is unlawful to walk backwards after sunset. From DTSRV10-SA at dutchtone.nl Sun Dec 2 07:48:47 2001 From: DTSRV10-SA at dutchtone.nl (DTSRV10-SA at dutchtone.nl) Date: Sun, 2 Dec 2001 13:48:47 +0100 Subject: ScanMail Message: To Recipient virus found and action taken. Message-ID: <234008652B43D41188200008C71E750C02C71911@dtsrv10.dutchtone.nl> ScanMail for Microsoft Exchange has detected virus-infected attachment(s). Sender = _larakalliri at bel.gr Recipient(s) = python-list at python.org Subject = Scanning Time = 12/02/2001 13:48:46 Action on virus found: The attachment info.DOC.scr exists WORM_BADTRANS.B virus. ScanMail has Deleted it. Warning to recipient. ScanMail detected a virus in an email attachment.=========================================================== De verzonden informatie is uitsluitend bestemd voor de geadresseerde natuurlijke persoon of rechtspersoon en bevat mogelijk vertrouwelijke en/of geprivilegeerde gegevens. Met uitzondering van de geadresseerde persoon is het niet toegestaan de informatie openbaar te maken, te kopi?ren, te verspreiden of anderszins actie te ondernemen op basis van de informatie. Indien u de informatie abusievelijk heeft ontvangen, neem dan contact op met de afzender en verwijder de informatie uit alle computers. Dutchtone staat niet in voor de juiste en complete verzending van de informatie, noch is zij aansprakelijk voor de vertraagde ontvangst hiervan. The information transmitted is intended exclusively for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any disclosure, copying, distribution or other action based upon the information by persons or entities other than the intended recipient is prohibited. If you receive this information in error, please contact the sender and delete the material from any and all computers. Dutchtone does not warrant a proper and complete transmission of this information, nor does it accept liability for any delays. =========================================================== From pobrien at orbtech.com Thu Dec 20 08:24:31 2001 From: pobrien at orbtech.com (Patrick K. O'Brien) Date: Thu, 20 Dec 2001 13:24:31 GMT Subject: ANN: New Python User Group in St. Louis, MO USA Message-ID: I'm starting a new user group for Python programmers in the St. Louis, MO area of the United States. Anyone who wants to join the group can simply contact me and I'll give them all the details. I would like our first meeting to be sometime in January and anyone with an interest in Python is encouraged to join (membership is free). So if you would like to get together with other Python programmers on a regular basis, please let me know and I will add you to the mailing list. If you have any questions or suggestions, feel free to contact me directly at pobrien at orbtech.com or 314-963-3206. Thanks, Pat -- Patrick K. O'Brien Orbtech.com - Your Source For Python Development Services Phone: 314-963-3206 From claird at starbase.neosoft.com Mon Dec 24 18:43:00 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 24 Dec 2001 17:43:00 -0600 Subject: State of the SysAd art (was: vi or emacs for editing Python on Linux?) References: <1009127729.9271.0.nnrp-12.c2de51d8@news.demon.co.uk> Message-ID: <2E48C714A6E1FBA1.19DE5ADEBF7F088A.DF90F2C1E6CC9E7C@lp.airnews.net> In article , Steve Lamb wrote: . . . > *sigh* Fine,you had to bring it up. Michael, I *do* work on unix >systems scattered across the nation and my personal workspace is not on every >single one. You know what is, though? ssh. That means scp is there so when >I need to get something to/from that machine I can always scp to another >machine, edit, scp back. > > Furthermore, when it comes to programming, I would hope that a company >that has machines all over the world would have learned the joys of a CVS >server which would also fill in on the above. Edit on one machine, commit, >ssh to the machine that needs it, cvs update. . . . Does this match others' experience? I continue to run into plenty of production hosts which have barely been maintained for up to four years, let alone outfitted with such new-fangled decorations as a properly-installed ssh. Do I hang around industrial environments too much? -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From markjunk at mceahern.com Thu Dec 27 11:21:33 2001 From: markjunk at mceahern.com (Mark McEahern) Date: Thu, 27 Dec 2001 16:21:33 GMT Subject: REPOST: Re: cmp References: Message-ID: <4$--$$_----_%-$%-$@news.noc.cabal.int> > Perhaps then could someone explain to me how one compares classes > useing the == operator, or indeed if this bad programming practice. By overloading the __cmp__ method. Don't confuse the return value of __cmp__ with whether or not the result of the comparison is that the two instances being compared are equal. Examine this sample and note that __cmp__ isn't merely used to determine equality. It is also used to determine sort order. class foo: def __init__(self, bar): self.bar = bar def __cmp__(self, other): if self.bar == other.bar: return 0 elif self.bar < other.bar: return -1 else: return 1 def __repr__(self): return "" % self.bar a = foo(1) b = foo(2) c = foo(3) d = foo(1) list = [b, c, a] print "before sorting:" print list print list.sort() print "after sorting:" print list print print "a == d: %s" % (a == d) ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.berkeley.edu!ucberkeley!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Mark McEahern" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:35:07 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775718 27193 211.57.49.2 (31 Dec 2001 05:15:18 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:15:18 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From djrassoc01 at mindspring.com Sun Dec 30 00:10:53 2001 From: djrassoc01 at mindspring.com (Dr. David J. Ritchie, Sr.) Date: Sat, 29 Dec 2001 23:10:53 -0600 Subject: Python Popularity: Questions and Comments References: <3C2CBACB.FBF3C3C9@mindspring.com> <3C2D47F0.6DF7C8BE@mindspring.com> <3C2DF5FF.E332F4EE@mindspring.com> <3C2E849D.8242B65D@engcorp.com> Message-ID: <3C2EA1CC.D1F77BB4@mindspring.com> Yes, someone pointed out in private e-mail that thanks to the ability to supplant the import function one could implement the ability to import from a remote node relatively easily. The hierarchy for import of packages is the other way round compared to http://my.node.com:port/path/to/module but I suppose that could be worked out. Also, as someone asked privately one would have to decided what protocal would be used: ftp, http:, telnet: (just joking, I think). One could even invent one's own protocol "pyt://" (still joking). I would be inclined to think ftp because one is basically doing file transfers but http: would have some interesting aspects such as the ability to be importing a remote module into one's program and have the import hyperlink to some other site and then to another and so on. The security aspects would be pretty horrendous. One would sort of get driven to having the virtual machine within which this byte code executes be in a sandbox and walled off from the file system of the machine it is on and so on. Sounds like one is implementing java all over again to me (which is of course how I got started--figuring out what features you would have to add to Python to make it competitive (?) with Java) but it is an interesting sand castle to build and then tear down when the tide of reality comes in again... Peter Hansen, P.Eng. of peter at engcorp.com wrote... > The idea is sound, but for now I think really practical > only on a company intranet. Internet connectivity is > still too unreliable to make this very effective > except for strictly Internet-related applications > (i.e. those which have no intrinsic purpose when an > Internet connection is not available.) > > That said, I suppose a little local caching would provide > a reliable backup after the first invocation had succeeded. > > And none of this would be in any way difficult to implement > even now, since you can just substitute your own implementation > of __import__(). > > I hear all the comments about security though and what would you do if the machine you whose module you wanted was unavailable on the net and so on. These were the same things that were being thrown up eight-to-ten years ago at the beginning of the web. See my recent talk about "Bringing the Web To Fermilab": < http://home.fnal.gov/%7Eritchie/OTHERtasks/Bringing%20the%20Web%20to%20Fermilab.htm > for some examples. In particular, in preparing for the talk, one person told me about the initial concerns thrown up by techies about the web being something that no one would use because "what if the links weren't up?" and "what about the data just being any old thing that someone put up and therefore wasn't valid?" She said that of course all this about invalid and unreliable data was the case but in fact the response of the average human being (as opposed to the techies) was not to refuse to adopt the web but it was instead something even scarier--they opted TO BELIEVE THE INFORMATION THEY FOUND THERE. So, with that example, the lack of reliability in a remote module import scheme may not be something that kills it off. Thanks for interesting discussions from all parties who sent me e-mail or responded publically. --D. -- Dr. David J. Ritchie, Sr. djrassoc01 at mindspring.com http://home.mindspring.com/~djrassoc01/ From grey at despair.dmiyu.org Tue Dec 4 18:15:47 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Tue, 04 Dec 2001 23:15:47 -0000 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BD39F.D43D4FF7@mega-nerd.com> <3c0be454$1@207.229.64.20> <3C0BE5D5.4386B359@mega-nerd.com> <3c0bf170$1@207.229.64.20> <2g2q0us3pdsl91hkbv3gj39nbfhnjke70s@4ax.com> Message-ID: On 4 Dec 2001 15:01:08 -0600, Chris Spencer wrote: > Some people don't WANT to look at 8 spaces for an indent. Or 2 or 3. And? > With the tab convention, you can set your tab width to be whatever you want, so > people who like looking at 8 space widths can do that, and people who like 2 > space widths can do that too. Which breaks when the code is read elsewhere, C&P elsewhere, etc. Not that you've addressed that at all. > The point you seem to miss is that not everyone has the same ideas or > comfort levels with different indentation conventions. With tabbing, you don't > have to worry about it. Just set it to whatever you like. And the point you've missed is that when people can set it to whatever they like it destroys any consistancy and readability everywhere else but their term anyway. > Tabs work for me and for my development group. They don't work for you. > Guess what, we both can do our own thing. No, we cannot. For the first time we try to use anything from your end of the spectrum it all goes to crap. > I see, preference doesn't matter as long as the convention matches YOUR > preference. To hell with everyone else, right? No. In fact if the conventioned doesn't conform to my preference it is convention that matters. That might just be why Python is the only language that I program in where I set the indent level to 4 spaces instead of my normal preference of *2*. IE, bucko, the convention doesn't match my preference. Point is that tabbers keep saying that one can separate style from content where the spacers keep pointing RIGHTLY SO that there is no separation when it comes certain code constructs. What's the tabber answer to that "Well, uh, I never have a problem." Nice comeback. > Just because you like to work a certain way does not mean that you have > become God and will decree that your *preference* is the only way to do things. > Step back from your ego. It isn't my *preference*. Furthermore I am giving valid reasons why it FAILS. I'm not stating "Well, it should be this way because I like it." No, it is "It should be this way because in this case, this case and this case which are not uncommon it fails." The former is a subjective argument and baseless. The latter is an objective argument which stands up to reason. Now, are you going to address those problems or continue to scream about your *preferences* working in cases where they clearly do not? -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From loewis at informatik.hu-berlin.de Fri Dec 28 12:56:14 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 28 Dec 2001 18:56:14 +0100 Subject: base64.decodestring gives binascii.error References: <3C2C03CB.7030000@pacific-shores.com> <3C2C9D79.9050501@pacific-shores.com> Message-ID: Erik Myllymaki writes: > The '_' and '!' were in the original string that was then encoded, not > in the resulting encoded string. So why are you passing the original string to decodestring, then? Regards, Martin From rdsteph at earthlink.net Thu Dec 27 17:44:09 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Thu, 27 Dec 2001 22:44:09 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <5$--$$_----_-$-_%$@news.noc.cabal.int> Andrew Dalke wrote: (my responses are interspersed without leading blue lines ;-)) > Ron Stephens: > >How is Python doing popularity wise? > > I can tell you that it's doing well in computational chemistry. > I know several places that have switched to doing development > in Python over Perl or other VHLLs. I think it's because of > Python's readability and its easy ability to add new data types > which act like native objects. > > In structural biology it also seems to be popular. I know > of several Python projects (PyMol, VMD, MMTK, MSMS, Chimera), a > couple old ones in Tcl, none in Perl, none in Ruby. Although > I'm biased by prefering Python, so I'm sensitized to Python > projects. > > In bioinformatics, Perl is still the most popular, although > we (the Biopython project) are trying. :) > I am considerably heartened to hear of such prominent success for Python in the biological sciences. Thanks for sharing this info! > >Python, while fabulously successful, is at an interesting point in its > >growth curve. It will be difficult to maintain the extremely high rate > >of growth exhibited so far; new contenders are possible problems; and > >the recessionary economy could also negatively impact Python's growth. > > It's impossible to undergo a meteoric growth forever. Exponential > growths must turn into S-curves. So why should there be a need for > an extremely high growth rate? > > >1. Ruby is an especially interesting competitor to Python. I have been > >monitoring the Ruby newsgroup, and it shows incredible growth and > >vitality. Furthermore, Ruby is aimed right at the heart of Python's > >niche. > > I looked at Ruby last summer. I read the documentation and > followed the newsgroup for a couple months. I was able to follow > what was going on, but didn't want to see myself explaining it to > non-software developers; that is, the chemists, biologists, and > physicists who use the tools I develop. > > I don't see how it's aimed at "the heart of Python's niche" -- what > do you see as Python's niche? I see it as a language which is > usable by beginning programmers and enjoyable by experienced > developers. I don't see Ruby really fitting the first of those. I mean simply that Ruby is so much more similar to Python than any other language, that this causes the two languages to have to share the available "market" of interested developers. In other words, both Ruby and Python are very high level, object oriented, interpreted, modern, scripting languages that are also powerful enough to be used as general purpose programming languages. Neither Python nor Ruby is relegated to any single narrow niche; and both are, in my opinion, well thought-out and implemented languages and both are attractive to intelligent developers looking for ease of use, power, expressiveness, and most importantly, speed of development. I do not think you can say all of the same things about any other two languages. Thus, while I admire Ruby, I suspect that it divides the pool of developers who might otherwise be all in the Python *camp*. > > > (I don't see how '@var' obviously means "instance variable" nor > '$var' for "global variable", while Python's is much easier to > explain, since the 'self.' makes it more apparant. I like that > Python doesn't have an implicit return of the last evaluated > expression, making it easier to find them. I like that I can > say "methods inside of __s are special" as compared to Ruby where > you have to memorize that things like "to_s", "initialize", have > special meaning. I like that empty function calls still need > a () in the declaration. I don't like that Ruby promotes adding > methods to existing classes, since I think that can lead to > conflict. I think 'abs(x)' is better than 'x.abs' or 'x.abs()'. > I'm forgetful, so I don't like special syntax shortcuts, like > a = %w{ ant bee cat dog elk } > for > a = ["ant", "bee", "cat", "dog", "elk"] > (especially since it can be written > a = "ant bee cat dog elk".split() ) > I don't like that regular expressions are treated with special > syntax. I don't like having aliases, as Hash.indexes/indicies, > Array.len/size. Ohh, and Hash has three equivalents in > has_key?(key) / key?(key) / include?(key) . > > At the implementation level, I like that the C Python implementation > uses native threads rather than it's own threading package. That > lets me work with other threaded libraries more easily. I like that > the C garbage collector is built on reference counting, since I > need the guaranteed semantics more than I need lesser implementation > complexity. ) > Your points above are all well taken.. I think Python is *even easier* to learn and to use than Ruby. But Ruby aficionados might disagree with us on this point ;-))) > > >If we view Microsoft's Visual Studio, especially Visual Studio.net's C# > >and VB, as the official 800 lb. gorilla of software development; and if > >we view Java as the 400 lb. gorilla pretender to the throne; and if we > >view Borland's Delphi and Kylix as no more than a smart leader of a > >chimp; then everything else is the pack of open source chimps. > > Luckily, I work in a field where most people use unix for real > development, so solutions based on C# and VB just don't exist, and > there's a huge installed based of C and FORTRAN code. I do know one > company doing some work with Kylix under Linux. > > So I can't really comment on this paragraph. > > >The open source world is still led by PERL, but PERL is truly more of a > >text processing, web CGI, scripting specialist; not so much of a direct > >threat to Python. > > Why can't we all just get along? > We can get along and we do. I am just a curious Python hacker who follows the Ruby language out of interest. > > Seriously, in my usual environment there are half a dozen "real" > programming languages in use (C, C++, FORTRAN, Python, Perl, Tcl), > a couple times more homebrew scripting languages (related to the > different scientific packages in use), and a slew of programs > which are only accessable through the command-line. > > > Python aims to be a powerful general purpose > >programming language, in addition to being a very easy to learn and easy > >to use scripting language. And who can say that Python does not succeed > >very well in all of the above? > > Is this what you see as Python's niche? Someone in the Perl group > would say exactly the same thing, as would someone from Smalltalk, > and from Ruby, and from Tcl, and from .... > > >But Ruby is also a more general purpose, object oriented, relatively > >easy to read, language. > What do you mean by "more general purpose"? I didn't see all that > much in Ruby which was more general purpose than Python, especially > now with the closing of the type/class dichotomy. I guess the > biggest ability is being able to send a block to be evaluated. > I know Smalltalk-ers love it, but to me things like I do not mean to say that "Ruby is more general purpose than Python". I meant to indicate that Ruby is more general purpose than , say, Perl, or Tcl, or PHP, or JavaScript etc., and thus more of a direct competitor to Python , precisely *because both languages are so admirably suited to general purpose programming. ;-))) > > > 3.times do > print "Ho! " > end > > aren't as easy to explain or understand as > > for i in range(3): > print "Ho! " > > (I know, I've been contaminated by years of BASIC, PASCAL, C, > and C++, but so have my clients.) > > > Ruby folks include those who like its more > >Perl-like syntax, but Ruby's core converts believe that its pure, > >absolute object oriented nature exceeds those of Python and make it more > >worthy to long term success. > > I know there's the argument that Ruby is "pure", but I think the > whole "functions are really private members of the Object base > class" idea is a sign of impurity, done because people are used to > writing functions and not having to define a static class method > like one might have to do for Java. But I think impurity is a > good thing. So I think the call for purity to be a wrong argument. > > > They seem to see Ruby as a more modern, up-to-date version > > of Python. > > I thought most people see Ruby as a more modern version of > Perl than Python. I definitely see it as a cross between > Perl and Smalltalk, with some ideas derived from Python. > Good point. Ruby is much more like Perl in syntax than it is like Python, and Matz himself has so commented that he borrowed a lot more from Perl than Python. However, in my opinion, Ruby still *appeals* very much to folks who like Python because of its object orientated nature, as well as its clean design. A lot of folks come to Ruby from Perl for the same reasons that lots of folks come to Python from Perl, I suspect. Thus, Ruby and Python are competitors, like it or not. Heck, Bruce Eckels seemed to say "ah heck, why did someone have to go and do such a close knock-off of Python for, anyway" (Paraphrase only!!!!) Of course, Guido said that Ruby's design philosophy didn't appeal to him at all. And maybe I am beginning to understand a little of "why", Guido might feel that way, as I read through the comments on this thread. By the way, Matz exhibits nothing but respect for Guido and Python. I also like the way Matz says only complimentary things about all languages; you'll never catch him saying anything bad about Python or Perl. He even steps in on comp.lang.ruby often to chastise over-zealous followers who have the temerity to bad mouth Python. You have to admire Ruby's Japanese creator for that attitude. Also, keep in mind, Ruby is very popular in Japan, which I think is great ! > > They see Python as a compromise between object oriented and > > procedural programming. > > And that's bad because ... why? Compromise is often seen as > bad, yet the world works on it. Others replace the term > "compromise" with "synthesis" or "fusion" or "hybrid" or many > other words. The phrase "multiparadigm" is another fun one. > > >Be that as it may, I suspect that much of Ruby's momentum is simply due > >to its newness; all things new are seen as sexy in this world of ours. > >But nonetheless, Ruby has the following going for it. > > I agree with you. I also think people are willing to give Ruby > a try, because they don't want to be seen as a fuddy-duddy. > > >Now, its more like a 4:3 ratio, with Python getting say, 4000 per month, > >and Ruby 3000. At this rate, Ruby could pass Python is afew months, by > >this measure! > > How do they get any work done? I can barely follow the outlines > of most of c.l.py these days. Oh, and much of the development email > is on a pretty high-traffic mailing list, so c.l.py doesn't reflect > all the Python traffic. Then there's the various lists like for > Jython and Zope, which get some Python questions. > > Again, talking about the fields I'm in, I've been presenting > Python at computational chemisty and biology conferences for > the past three years. I keep waiting for someone to ask me > "what aout Ruby?", but as of yet no one has. > > There is one site for Ruby in bioinformatics -- bioruby.org. > That site seems to be down right now, but as I recall, the > packages they had were pretty minimal. They had a presentation > at the last Bioinformatics Open Source Conference, but it > didn't show any real advantages over the equivalent Perl. > We were pushing to get a BioRuby developer at the upcoming > Bioinformatics hackathon (promo: co-sponsored by O'Reilly and > Electric Genetics, with support from the Open Bioinformatics > Foundataion, AstraZeneca, and your's truely, Dalke Scientific > Software :) We couldn't get anyone. > Sounds very exciting. It is just such success stories about Python that I love to hear !!! ;-)) > >b. Ruby is getting alot of favorable press, and new books are coming out > >now. First, Pickaxe , now, Matz' own Ruby in a Nutshell and several > >others soon to be or already here. > > If books are a good metric, then there's also plenty of new Python > books coming out (as you know from your dozen plus reviews :). > And Perl ones. And Java ones. It's just easier to notice when > there are only a few books. > True. Three are now over 20 Python books out there ;-)) And, by one very important measurement, Python blows Ruby away with 1,302 SourceForge projects compared to only 81 for Ruby. We also blow away Lisp and Scheme on this measurement, but predictably perhaps lose to PHP and Perl, Java and of course, C and C++ (C is the number one in this category). > >c. Ruby actually seems to be a nice language to me. Its object oriented > >features seem well thought out and yet its still easy to comprehend. > > I had problems with it. I could comprehend Python's features > from the documentation. I still can't from the Ruby on-line docs. > One thing is that Ruby objects seem so heavy-weight to me. For > example, Hash has support for a built-in default object, and > for "freezing" hash. So if I wanted to make a Hash-like object, > I need to do quite a bit, I think. > > (Again, I got into Python about 6 years ago, when the dictionary > object which much lighter weight than it is now, and I learned > about the changes when the occured instead of all at once. Still, > Python's dictionary seems conceptually easier to understand and > use than Ruby's.) > >d. Ruby has some smart and aggressive coders doing libraries, > >extensions, Java version etc. etc. etc., tehy are agressive and > >motivated; tehy think they will see world domination ;-))) > > They will leanr how to sepll 'tehy'? :) > > Python, Perl, and Java also have "smart and agressive coders" etc. > For example, I've seen nothing in Perl or Ruby to match > Marc-Andre Lemburg's mxTextTools, which I use for my Martel > parser. > > >2. The economy is hurting Python's open source development model. > > It is? I guess I started when Guido worked at Stichting > Mathematisch Centrum, before CNRI, and I don't think then he could > ever work full time on Python. The recent spate of development > progress has actually worried me, since I'm not able to follow > all this new work, like __getattribute__ and __slots__ and > new-style classes. > > >Without Mark Hommond's win32 work, Python would be a mere shell > >of its current self. > > A lot of that work was when he was a contractor, before working > with ActiveState. I know PythonWin 1.5.2 has no ActiveState > copyright notice in it. > > I can't make any real statement about the people you mentioned. > I can say Python developed without a lot of dedicated resources > for it, so I'm not going to worry about it. Besides, why should > it affect Python any less than other projects? > > >3. Third, Python faces the laws of large numbers. It is exceedingly hard > >to continue a growth spurt past a certain point. Maybe were at that > >point, maybe not. But ask yourself this; Two years from now, will you > >see more Python success stories, more growth, or a leveling out? Five > >years from Now? > > So? What's the growth curve in C? Do you see more C success stories? > More growth, or a leveling out? > > I expect to have success stories of my own in the 2-5 year range. > > Frankly, for a while I was learning about better and better ways > to develop software: BASIC -> Pascal -> C -> C++, then C/C++ augmented > with Tcl, then Perl, then Python augmented by C/C++, which is > where I'm at now. I also tried out a dozen other languages, > including Prolog, APL, Lisp, and other classics, and read about > more languages, including Smalltalk and Eiffel. > > As far as I can tell, I think the basics of the Ruby/Smalltalk/ > Perl/Python/C/C++/Java/... class of languages are pretty well > understood. I don't think Ruby or any similar language can > offer anything sufficiently new enough to get many people to > change. The only new topic my limited prognositications can > make for the future is aspect oriented programming, and I don't > know enough of that to make any firm statement. > > BTW, I think what's going to happen in Python's future is > 1) refactoring browsers, like what Smalltalk has, 2) better > performance through some sort of typing, and 3) the development > of more specialized libraries for different domains. (Please > bear in mind that I'm biased by being a library and application > programmer.) > > >Ten years from now, will Python still be Relevant? Oh, I know that > >Python will still be being used, and the community will still exist, but > >will it really be a thing that seems to Matter, like it does now. > > I hope not. I want to have new tools and new ways of thinking > on programming. It's still a lot of hassle to develop new code, > and I'm a slacker in the Gen-X mold, with a short attention span. > (Okay, the length of this response belies that statement :) Still, > I want something better then Python, and I hope that in ten years > we'll at least start using it. I also hope I'll recognize it > early enough, like I did with Python. > > Mind you, Python's data model is still simple enough that it can > be ported to other systems without much effort. > > Andrew > dalke at dalkescientific.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newsengine.sol.net!137.192.100.17.MISMATCH!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2BA4D3.5F0BC994 at earthlink.net> Control: cancel <3C2BA4D3.5F0BC994 at earthlink.net> Date: Mon, 31 Dec 2001 02:30:17 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775542 27193 211.57.49.2 (31 Dec 2001 05:12:22 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:12:22 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From dmallwitz at cox.rr.com Wed Dec 19 00:12:32 2001 From: dmallwitz at cox.rr.com (David Mallwitz) Date: Wed, 19 Dec 2001 00:12:32 -0500 Subject: Tkinter+ backspace characters (and an re.sub problem) Message-ID: <3c202041$1_6@goliath.newsgroups.com> Hello group, The Tkinter Text widget doesn't understand '\b' or '\x08' as the backspace character when sent a string containing either of them. Nor does it understand '^H' as a substitute for '\b'. I've done some googling, but haven't found a solution other than doing a regexp sub on the string before sending it to the text widget. That seemed like a good idea, but I'm not able to construct the regexp in a way that will handle stacked backspace characters. Any ideas on how to tell the widget to process a backspace? Or on how to construct an RE that will match multiple '\b's? For example: >>>string = 'all work and no play makes Jack\x08\x08\x08\x08Dave a dull boy' >>> print string ###this works as you would expect it to all work and no play makes Dave a dull boy >>>root = Tk() >>>text = Text(root) >>>text.pack() >>>text.insert(END, string) ### prints 'all work and no play makes Jack||||Dave a dull boy' on the widget >>>a = re.compile('.\x08') >>> a.sub('', string) ###fails - would have thought there should be 3 '\x08's left, or none at all 'all work and no play makes Jac\x08Dave a dull boy' >>> Best, Dave -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- From James_Althoff at i2.com Wed Dec 5 14:29:39 2001 From: James_Althoff at i2.com (James_Althoff at i2.com) Date: Wed, 5 Dec 2001 11:29:39 -0800 Subject: more fun with PEP 276 Message-ID: Jeff Shannon wrote: >James_Althoff at i2.com wrote: >> The (claimed) advantages with this scheme include: >> - no syntax changes required (!!!) >> - handles all combinations of closed/open intervals >> - handles descending as well as ascending intervals >> - allows step size to be specified >> - reuses the "i in iterator" paradigm of existing for-loops >> - supports shortcuts for the common case of indexing from 0 to len-1 >> - works outside of for-loops ("in" statement, list & tuple functions) >> - no confusion with or overloading of list or tuple syntax >> - no list versus iterator confusion >> - is reasonably transparent (once you get used to it ;-) >> - is straightforward to implement >> >> On the down side: >> - not as immediately transparent as "-5 <= i <= 5" >> > >Nor is it immediately more transparent, or shorter, or in much of any other way >(that I can see) preferable to "range(10)" > >for i in 0 / span / len(mylist): >#or even.. >for i in span/len(mylist): > >versus > >for i in range(len(mylist): > >Hmmm... what's the advantage again? Seems like a lot of work for not much >difference.... To match for i in span / len(mylist): more closely you would use xrange instead of range since range actualizes the list before iterating the values (which, of course, might not matter in many cases). So the better comparison is to for i in xrange(len(mylist)): Although the above is fine, there are a couple of things one can point out: - xrange is not an ideal name for something used in such a common idiom. - a nested function is not ideal for such a common idiom. - the fact that one has the option of using either range or xrange causes enough confusion that one observes inquiries and debates from time to time (on this mailing list, for example) about best/proper usage of each. - xrange and range are both oriented to intervals that are closed on the left and open on the right. If you want to specify an interval that is open on the left and closed on the right, then you have to do extra calculations that can be error-prone, e.g., left = getLeftSide() right = getRightSide() for i in xrange(left+1,right+1): # open on left, closed on right -- not so obvious Compared to: for i in left / span // right: # open on left, closed on right Furthermore, there is no syntactic mechanism in xrange/range that visually indicates the fact that the left side is closed and the right is open. And for any other combination (e.g., open on the left, closed on the right) xrange and range aren't very obvious. And using span -- in my experience with this exercise -- didn't seem like "a lot of work". To me, at least, it seemed quite easy. So I would suggest that one key difference between span and xrange is that span has a better mechanism for specifying all combinations of "open/closed"-ness for intervals whereas xrange and range really target "closed on left / open on right" intervals (which, granted, are very common -- but not what one needs for all occasions). Jim From jpt.d at rogers.com Sun Dec 30 03:45:56 2001 From: jpt.d at rogers.com (Jeffrey Drake) Date: Sun, 30 Dec 2001 08:45:56 GMT Subject: Option Explicit: Yuck. References: <3BE4DF39.AE0A8EAA@ix.netcom.com> <3BE534B7.F0F56060@chello.nl> <3BE5F306.446480AD@ix.netcom.com> <%JlJ7.552378$j65.135625324@news4.rdc1.on.home.com> Message-ID: <3c2ed3d9.18033070@nntp> I can't agree with your statement that VB isn't object oriented. The only thing VB doesn't support is implementation inheritance. This isn't necessarily needed though to be classified as OO because it does support Interface inheritance. Regards, Jeffrey Drake > >(3) Visual Basic, at least until Visual Studio.NET is not capable of either >#1 or #2, and it remains to be seen if .NET can reverse that. (VB.net will >be the first truly Object Oriented version of VB, but will probably still >not be fully dynamic like Python.) > > > >Warren Postma > > From LLoeffler at home.com Wed Dec 26 22:01:18 2001 From: LLoeffler at home.com (Luke) Date: Wed, 26 Dec 2001 21:01:18 -0600 Subject: strange Tkinter problem References: <3C297E61.70701@home.com> Message-ID: <3C2A8EFE.4010406@home.com> No, Tkinter doesn't automatically spawn a new thread to handle a callback function. I suppose you could modify the code if you wanted to at the risk of destroying all portability. From mattsurf76 at hotmail.com Thu Dec 27 09:06:03 2001 From: mattsurf76 at hotmail.com (Matt Russell) Date: 27 Dec 2001 06:06:03 -0800 Subject: cmp Message-ID: Well, I just made myself look silly. I admit it... when I type 1==1 into the interpreter, I thought if it was true, the result is 1 - this is right. But cmp(1,1) actually returns 0 (in accordance to the docs) But why then are we given the mechanism to compare instances of classes via the __cmp__ def ? Collegues of mine have used this to return 1 (truth) if two instances are equal (instanceA==instanceB).... this obviously wasn't the intended purpose. (__cmp__ shuold return 0 if the result of cmp(a,b) is to be trusted?? Perhaps then could someone explain to me how one compares classes useing the == operator, or indeed if this bad programming practice. I hope I didn't waste too much of guido's time when I posted a bug on sourceforge :( From syring at email.com Fri Dec 28 03:22:11 2001 From: syring at email.com (Karl M. Syring) Date: Fri, 28 Dec 2001 09:22:11 +0100 Subject: REPOST: Re: Literally thousands of Pythonic online articles References: <3C2AF56C.1DDF68E7@earthlink.net> Message-ID: <9$--$$_--__-%$%$%$@news.noc.cabal.int> "Ron Stephens" schrieb > Bored with the holidays? Then maybe you should check out the list of > online Python related articles generated by Hans Nowak's Pythonic > Webcrawler at http://www.awaretek.com/plf.html Ron, your news service is quite good, but I have a complaint about your gray/red/blue color scheme. That is somewhat hard on the eyes. Karl M. Syring -- IWon acquired the rights to Excite.com through Bellevue, Wash.-based InfoSpace Inc., which bought the Web site last month for $10 million, a staggering discount from the portal's $6.7 billion sales price in 1999. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news-xfer.siscom.net!novia!novia!netnews.com!newspeer.cwnet.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail Message-ID: Control: cancel Subject: cmsg cancel From: "Karl M. Syring" Newsgroups: comp.lang.python X-No-Archive: yes Lines: 2 NNTP-Posting-Host: wonenara.ozemail.com.au X-Trace: ozemail.com.au 1009643082 203.108.164.177 (Sun, 30 Dec 2001 03:24:42 EST) NNTP-Posting-Date: Sun, 30 Dec 2001 03:24:42 EST Organization: OzEmail Ltd, Australia Distribution: world Date: Sat, 29 Dec 2001 12:34:43 GMT This message was cancelled from within Mozilla. From bsturk at news.rcn.com Tue Dec 18 23:33:19 2001 From: bsturk at news.rcn.com (Brian Sturk) Date: 19 Dec 2001 04:33:19 GMT Subject: pty/fork and SIGINT References: <1008650439.385033@yabetcha.sttl.drizzle.com> Message-ID: ooops > Works for me. I'm running BeOS right now, so that's where I tried it, > but I imagine it will work under UNIX too. > > You have a big problem there - as you recognize, with a big script and > an unusual operating environment and all, it's hard to say where it's > going wrong. You need to simplify. You can run ping behind a pty and > print out the output in a few lines of code; now use posix.kill to > deliver your signal to the ping process. Works? Hm. Run a simple > sleep process from vim, let it die naturally. That working? Kill it, > still works like you expect? Etc. Thanks for your response. I think you may have misunderstood my question. Sending the signal to ping works fine, but sending it to the parent pid, which is all I have after executing pty.fork() doesn't "forward" the signal. I should probably have been more explicit. I guess I was expecting the behavior I see when I run in an interactive shell when I sent the signal to the controlling shell. I had tried as a workaround to get a list of the running processes on the current pty (usually only the shell and another app, ie ping) and give the user a list to choose from which to send the SIGINT to. However, the fd returned from pty.fork always returns /dev/ptmx which from what I've read seems to be the "master". I'm also too new to this particular area of programming so how to use openpty() isn't obvious to me (although I'm looking). I've been reading posts in here as well as in the other programming groups and my Stevens book on Unix programming covers signals and pty very thoroughly. All have been very helpful. For the most part applications run fine within this environment, both interactive and non interactive. Control signals are one of the more exotic things I'm trying to support. On Windows however, I am using popen and cannot seem to run interactive programs at all. This, from what I've been told has to do with line buffering. > When you have a simple 20 line script that we can run and see the > same problem for ourselves, then you can hope for help. (But I bet > you'll find the problem on your own in the process.) thanks again. -- .-----------------------------------------------------,-------. | Brian M. Sturk - http://www.nh.ultranet.com/~bsturk \ C/C++ | .> )\,^a__ |--------------------------| bsturk at nh.ultranet.com | Java | ( _ _)/ /-." ~ | http://www.telengard.com `---------------------------`------| `( )_ )/ | Telengard Technologies Inc. - NT/*nix UI & device drivers | _<_s_<_s '-------------------------------------------------------------' From bellman at lysator.liu.se Thu Dec 20 20:55:05 2001 From: bellman at lysator.liu.se (Thomas Bellman) Date: Fri, 21 Dec 2001 01:55:05 +0000 (UTC) Subject: /usr/bin/env: python: No such file or directory References: <915a998f.0112161542.2ab07235@posting.google.com> <3C222B16.C1B1BC8D@attbi.com> <3C225488.AF5C93F4@attbi.com> Message-ID: <9vu4pp$8to$1@news.island.liu.se> Chris Barker wrote: > How would the interpreter know what version was required? That's exactly > what I think we need...A way to tell the interpreter what version is > required by a script. So, your script requires Python version 2.5 to run, but won't run on 2.4 or 2.6. But is that version 2.5 of the language specification, or is that version 2.5 of Guido's Python interpreter (which implements version 2.4 of the language spec)? Or is it perhaps version 2.5 of the Jython interpreter (which implements some features from version 2.6 of the language spec, but misses some features that came back in version 2.3)? Well, assume that we could resolve that. But your script also requires PIL of a version between 2.718 and 3.142; except versions 3.000 through 3.013, which inadvertently broke compatibility in some obscure corner which you were using. And it also wants to talk to an Informix database. Version 9, but version 10 won't do. Some versions of Oracle or PostgreSQL might also work well... -- Thomas Bellman, Lysator Computer Club, Link?ping University, Sweden "Adde parvum parvo magnus acervus erit" ! bellman @ lysator.liu.se (From The Mythical Man-Month) ! Make Love -- Nicht Wahr! From max at alcyone.com Fri Dec 7 03:01:48 2001 From: max at alcyone.com (Erik Max Francis) Date: Fri, 07 Dec 2001 00:01:48 -0800 Subject: strict python? References: <3C1060E4.756F33B2@earthlink.net> <3C107172.6866DC18@alcyone.com> <9ups92$ers$1@peabody.colorado.edu> Message-ID: <3C10776C.8BB710EF@alcyone.com> Fernando P?rez wrote: > I honestly don't see any reason for something like that not to be > included in python (other than perhaps 'if perl has it it can't be > good' :) Agreed. For the record, I wasn't suggesting something mandatory. As with all good warning facilities, there should be ways to circumvent them through choice of deliberate syntax. For instance, gcc has very good warning facilities even for fairly mundane stuff, but much of it is overridable with syntax. For instance, if (a = b) ... generates a warning ("Are you sure you meant assignment instead of equality?"), but using an extra layer of parentheses makes the warning go away ("I know what I'm doing, don't warn me about this"): if ((a = b)) ... Obviously that precise syntax doesn't translate into Python, it was just an example of the type of thing I'm referring to. PyChecker is a very worthwhile project that's updated regularly; is there perhaps some interest in incorporating it into the Standard library where it can be maintained internally, so that new features that are added can have appropriate warnings added as well? -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ Laws are silent in time of war. \__/ Cicero Esperanto reference / http://www.alcyone.com/max/lang/esperanto/ An Esperanto reference for English speakers. From laurent.pointal at laposte.net Sat Dec 1 13:03:51 2001 From: laurent.pointal at laposte.net (Laurent Pointal) Date: 01 Dec 2001 18:03:51 GMT Subject: Let's make Python really strict about indentation References: <3C087F11.4030706@post.harvard.edu> Message-ID: Alexis Layton wrote in news:3C087F11.4030706 at post.harvard.edu: > Of course, we could always become REALLY, REALLY strict and never allow > a mixture. Yes... its the solution I adopt, my editor (ConTEXT on Windows) is configured to replace tabs by 4 spaces and never insert tab char in my sources. This is how we do at work too. Et hop, indentation is not a problem. > Alexis Layton A+ Laurent. From CpJohnson at edgars.co.za Thu Dec 20 09:07:32 2001 From: CpJohnson at edgars.co.za (CpJohnson at edgars.co.za) Date: Thu, 20 Dec 2001 16:07:32 +0200 Subject: How to generate XML Message-ID: <42256B28.004D8719.00@JHBMAIL01.edgars.co.za> Look at xml.dom.minidom, you can create XML nodes in a tree structured DOM and then spit it out into a file. Craig Fabrizio on 2001/12/20 15:10:40 To: python-list at python.org cc: (bcc: Craig Johnson/Edgars/ZA) Subject: How to generate XML Does anybody know if there are modules to generate XML? I know there is SAX, but it is only for parsing, isn't it? Thank. Fab -- http://mail.python.org/mailman/listinfo/python-list From jason at jorendorff.com Thu Dec 13 06:26:17 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Thu, 13 Dec 2001 05:26:17 -0600 Subject: threading module oddness Message-ID: I've been kicking around in the threading.py source code. Two things: 1. In Condition, I noticed this code: class _Condition: ... def _is_owned(self): if self.__lock.acquire(0): self.__lock.release() return 0 else: return 1 According to the current documentation for the 'thread' module, the lock object should have a locked() method: def _is_owned(self): return self.__lock.locked() 2. Wow, I had no idea what was going on under the hood here. Especially Condition.wait(). Wouldn't it be better if all this stuff were implemented using the native primitives? How would a patch for that be received, assuming I could only help out with 1 or 2 platforms (pthread and NT)? (The rest could fall back on the current Python implementation for now.) -- Jason Orendorff From gat at jpl.nasa.gov Mon Dec 3 19:42:18 2001 From: gat at jpl.nasa.gov (Erann Gat) Date: Mon, 03 Dec 2001 16:42:18 -0800 Subject: A modest indentation proposal References: <3C0BBC1A.6E4154F@home.net> <3C0BF0E8.2F9E2641@attbi.com> Message-ID: In article <3C0BF0E8.2F9E2641 at attbi.com>, Chris Barker wrote: > Erann Gat wrote: > > In article <3C0BBC1A.6E4154F at home.net>, Chris Barker > > wrote: > > > > I if get this straight, you seem to think that the indentation issue is > > > the ONLY thing getting in the way of NASA adopting Python. The only > > > "show stopper" at any rate. > > > No, that is not the case. In fact, you seem to have made this up out of > > whole cloth. > > I may have misinterpretted, but: > Erann Gat wrote: > > Fortunately, in this case the > > list of nit-pick issues seems to be rather short. There's not a whole > > laundry list of issues, just this one. Unfortunately, it seems to be a > > potential show stopper. > > I wouldn't call that whole cloth, I would call it a quotation. Ah. Right. My bad, I apologize. The reason I didn't remember writing that is that I don't actually know for a fact that it's true, I just said it in order to short-circuit the argument that this issue should not be addressed because there might be a long list of additional issues waiting in the wings. There might in fact be a long list of additional issues (I don't know) but I don't think that's a valid reason to ignore this issue, but I didn't want to get into a long tangential argument about that. > > > By the way, did you suggest to the LISP community that LISP should > > > optionally use something other than all those parentheses? That seems to > > > be the main unimportant stumbling block when people used to C/C++ > > > consider LISP. > > > > Yes, as a matter of fact I did. I even implemented it (it's easy to do > > within standard Lisp), as have dozens of other people. The only reason I > > haven't implement this suggestion myself is that I don't know how. > > All you need is a pre-processor. With the tokenize module, it would be > pretty easy to write one in Python. Or use pyindent, and modify it for > your desires. Yes, learning about pyindent is one of the useful things that resulted from this discussion. Apparently, tokenize might be another. But the real missing piece for me is how to make emacs support this. I have never hacked an emacs mode. > > Yes, I suppose you could say this was a test of sorts. Indentation is not > > the only issue that meets with objections, but it is the one that is > > easiest to solve. My goal in making the suggestion that I did was as much > > to see what kind of responses it would get as to actually get the > > suggestion implemented. > > Did we pass or fail? I think we passed with flying colors, but I imagine > your criteria are different. If you wanted to find out whether you could > get the Python community to all come together and re-work Python to fit > your personal needs, the answer is no, and we could have told you that > from the beginning. > > By the way, even very good ideas that are well excepted very rarely > actually get implimented unless the driving force behind the idea writes > the code. See all the no-yet-implimented PEPs. In the free software > world, you are not going to get anything done unless you write the code, > or pay someone to write it for you. Good (and bad) ideas are a whole lot > more common than good code. > > I don't know who wrote pindent.py, but you can bet is was someone who > wanted it, not someone who did it only because someone else suggested it > might be a good idea. Well, my confidence about my recollection of what I did and didn't say has been badly shaken :-) but I'm pretty sure all I ever asked for was feedback, and not for anyone to do any work. I also believe that what I was asking for feedback on was not a major rework of Python, but a backwards-compatible extension. That was my intention at any rate. E. From fperez528 at yahoo.com Thu Dec 6 09:01:02 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Fri, 07 Dec 2001 13:29:02 +2328 Subject: strict python? References: <3C10776C.8BB710EF@alcyone.com> <9upu2a$g4v$1@peabody.colorado.edu> Message-ID: <9ur8rk$fg6$2@peabody.colorado.edu> Berthold H?llmann wrote: > Just for the record: -Wall isn't the max for gcc. There are more > warnings, not covered by the -Wall option as > > -Wfloat-equal: Warn if floating point values are used in equality > comparisons. > > and several more correct, had forgotten about those. f From sfam at mailandnews.com Fri Dec 28 12:40:25 2001 From: sfam at mailandnews.com (Kaden) Date: 28 Dec 2001 17:40:25 GMT Subject: Can't exit python with ^D under certain circumstances References: <1c1X7.79465$7l5.52086@atlpnn01.usenetserver.com> Message-ID: On Fri, 28 Dec 2001 11:33:43 -0500, Steve Holden wrote: > "wealthychef" wrote in message > news:mailman.1009322789.23019.python-list at python.org... >> Hi, this is weird to me, don't know how to fix. >> On my local python installation on machine A in a normal shell, ^ >> D works to exit Python as expected. On machine B on the >> console, ^D also works fine, but if I ssh to machine B from >> machine A and try to exit Python with ^D, Python does not exit, >> instead I get the following strange error message: >> >> >>> ^D >> File "", line 1 >> c >> ^ >> SyntaxError: invalid syntax Have you checked your TERM envariable? Try checking what it's set to while at the local console. Then ssh into the remote machine and check what that one is set to. I've got a machine here at home that sets my TERM to dumb if I ssh into it for some reason. You can imagine the kinds of problems that causes :) If this is the problem, just explicitly set it in your ~/.profile || ~/.bashrc || ~/.cshrc || whatever. Should clear it up. From octavioj at san.rr.com Mon Dec 31 13:22:49 2001 From: octavioj at san.rr.com (Octavio Jose de Franca Lima) Date: Mon, 31 Dec 2001 18:22:49 GMT Subject: mySQL References: Message-ID: <3C30AE1B.4090300@san.rr.com> If you are using ActivePython from ActiveState you can use pyppm to get the compiled binary from their site. Regards. Preben wrote: > Is there any built-in modules for connecting databases > such as mySQL? > > Or do I have to make them myself? > > > From MarkH at ActiveState.com Mon Dec 3 21:53:42 2001 From: MarkH at ActiveState.com (Mark Hammond) Date: Tue, 04 Dec 2001 02:53:42 GMT Subject: Embedding Python in C++ application: Question #1 References: <8a12e538.0112031616.674f37e8@posting.google.com> Message-ID: <3C0C3B3E.9030302@ActiveState.com> Russell Turpin wrote: > Is there something like this? Is there a better way of doing > this than just iterating on Py_BuildValue()? Am I missing > something obvious? Py_BuildValue is a convenience function. To return your own value, simply create a new Python tuple of list, and populate it manually. Return this as the result from the function. If you search a little, you should find a number of examples of this. Try, eg, the os.listdir() source. Mark. From syver-en+usenet at online.no Sat Dec 29 18:23:21 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 30 Dec 2001 00:23:21 +0100 Subject: SSL Sockets in Windows References: Message-ID: Syver Enstad writes: > Gerhard H?ring writes: > > You seem to still have SSL compiled in. Be sure to replace your > > _socket.pyd with the one without SSL. Using "python -v" helps > tracking > > > > > down which module really is loaded. > > Ah the -v switch, I forgot about that one. I'll look some more into > it. Ouch, I had the ssl version of _socket.py lying in the python dir. (Insert foot in mouth). Thank you for the -v switch again. -- Vennlig hilsen Syver Enstad From llewin at oreilly.com Mon Dec 17 16:00:31 2001 From: llewin at oreilly.com (Laura Lewin) Date: 17 Dec 2001 13:00:31 -0800 Subject: Update Oreilly books? References: Message-ID: <47d2cd7c.0112171300.3c3483e9@posting.google.com> Hi, I wanted to write to respond to the comments on ORA books. First off, thanks for writing about this. I take your comments very seriously, and try to incorporate your suggestions whenever possible. We aren't updating Programming Python right away. The author is currently working on the update to Learning Python. Please note that when we do update Programming Python again, we will make sure to put some language reference in the book, along with the tools and applications. I understand that folks are missing this, and we will meet the needs of readers. Please feel free to email me with any other comments or suggestions. Laura LLewin at oreilly.com "DeepBlue" wrote in message news:... > Dan > I truly got no idea why everyone seems willing to criticize Programming > Python. It is an excellent book. > If you have 2nd edition, you do not have to wait for another edition. > One book simply will not do it. > My plan is this: > Have Programming Python, then get the latest Python Essential Reference by > Beazley. > Now, if you need anything specilaized (Python and XML or Python and the Web > etc....) then get one. > The opinion that one book should have all there is to be about a language is > not only a myth but an insult to the language itself. > There are many books to be published soon, Holden's Python web programming, > another one on Python and XML etc...... > My ture hope is that these forthcoming books will not reinvent the wheel by > starting a multi-chapter introduction on how to use Python. > DeepBleu > > wrote in message > news:mailman.1008555261.15036.python-list at python.org... > > I am about to slowly transfer out of my newbie status, and I am going > > to purchase a Programming Python Book (an upgrade from learning python) > > and I wanted to know if anyone knows whether Oreilly will update the > > book with the upcoming 2.2 release or if the 2nd edition will last till > > 3.0 Python relase. > > > > Thank You > > Dan > > -- > > John 11:25 "Jesus said to her, I am the resurrection and the life. He who > > believes in me will live, even though he dies;" -- > > http://www.tddm.org/salvation.shtml > > > > > > From Peter.Mayne at au1.ibm.com Fri Dec 7 04:28:52 2001 From: Peter.Mayne at au1.ibm.com (Peter Mayne) Date: Fri, 7 Dec 2001 20:28:52 +1100 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> Message-ID: <9uq2km$d0g$1@news.btv.ibm.com> "phil hunt" wrote in message news:slrna100gu.ilp.philh at comuno.freeserve.co.uk... > On 6 Dec 2001 03:46:44 -0800, sebastien wrote: > > > >In this format, the integer part correspond to the number of elapsed > >days since the start of the day 1858-11-17 CE. Negatives numbers are > >allowed for date before 1858-11-17. > > Any reason why that day particularly? 17-Nov-1858 is to VMS as 1-Jan-1970 is to UNIX. >From the VAX11 Software Handbook: VAX/VMS maintains the current date and time (using a 24-hour clock) in 64-bit format. The time value is a binary number in 100-nanosecond units offset from the system base date and time, which is 00:00 o'clock, November 17, 1858. This is the Smithsonian base date and time for the astronomical calendar. All the time values passed to system services must also be in 64-bit format. A time value can be expressed as: o an absolute time which is specific date and time of day. Absolute times are always positive values. o A delta time which is a future offset (number of hours, minutes, seconds, and so on) from the current time. Delta times are always expressed as negative values. PJDM -- Peter Mayne IBM GSA (but the opinions are mine) Canberra, ACT, Australia This post is covered by Sturgeon's Law. From jason at jorendorff.com Thu Dec 13 18:03:00 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Thu, 13 Dec 2001 17:03:00 -0600 Subject: Ordered dictionaries? In-Reply-To: <20011213214515.61016.qmail@web21106.mail.yahoo.com> Message-ID: > One last Perl module that I need to replace to > complete my Python toolkit is a custom module that let > me create a dictionary whose keys were settable and > retrievable in a particular order. Essentially, this > let us have a list whose ordered elements were also > accessible by name. Sounds horrible, but you can certainly do it. :) Sample code is included below. In the Language Reference, "Special method names": http://www.python.org/doc/current/ref/specialnames.html > Has anyone done this? If not, what class operators > would I need to override to create my own class that > does this? > > Example of how it would work, assuming OrderedDict was > a working class of what I wanted: Hmm. In Perl, hashes only have string keys, correct? You could apply the same restriction to a hypothetical OrderedDict class; but note that it doesn't apply to Python dictionaries in general. Here goes: class OrderedDict: def __init__(self): self.__keydict = {} # Maps strings to integer indices self.__keys = [] # Ordered list of the keys self.__values = [] # Ordered list of the values def __setitem__(self, key, value): """ Implements self[key] = value """ if isinstance(key, str): # Assign element by name i = self.__keydict.get(key) if i is None: self.append_item(key, value) else: self.__values[i] = value elif isinstance(key, int): # Assign element by number n = len(self.__values) if -n <= key < n: self.__values[n] = value elif key < -n: raise IndexError("index: %i; len: %i" % (key, n)) else: while n < key: self.append_item(None, None) n += 1 self.append_item(None, value) else: raise TypeError("index must be an int or string") def __getitem__(self, key): """ od.__getitem__(key) <==> self[key] """ if isinstance(key, int): index = key else: index = self.__keydict[key] return self.__values[index] def __len__(self): """ od.__len__() <==> len(od) """ return len(self.__values) def __contains__(self, value): """ od.__contains__(value) <==> value in od """ return value in self.__values def append_item(self, name, value): n = len(self.__values) if name is None: name = n self.__keydict[name] = n self.__keys.append(name) self.__values.append(value) def append(self, value): self.append_item(None, value) def has_key(self, name): return self.__keydict.has_key(name) def keys(self): return self.__keys[:] def values(self): return self.__values[:] def items(self): return zip(self.__keys, self.__values) Works for me. >>> od = OrderedDict() >>> od['Alice'] = 'Anderson' >>> od['Bob'] = 'Bradley' >>> od.append('Christiansen') >>> od['Dave'] = 'Dobson' >>> od.keys() ['Alice', 'Bob', 2, 'Dave'] >>> od.values() ['Anderson', 'Bradley', 'Christiansen', 'Dobson'] >>> od[3] 'Dobson' >>> od[7] = 'Johnson' >>> od.values() ## NOTE: works differently than what you asked for, ## but makes more sense IMHO ['Anderson', 'Bradley', 'Christiansen', 'Dobson', None, None, None, 'Johnson'] >>> len(od) 8 >>> for i in range(len(od)): print od[i] (yes, this works) >>> for v in od: print v (this also works) >>> 'Anderson' in od 1 >>> 'Orendorff' in od 0 >>> od.items() [('Alice', 'Angerson'), ('Bob', 'Bradley'), (2, 'Christiansen'), ('Dave', 'Dobson'), (4, None), (5, None), (6, None), (7, 'Johnson')] Note that values() works differently, and od[30] will throw an exception instead of gracefully returning None. But this should be a good starting point and/or tutorial. You could of course go much farther with this. Implementations for the dictionary methods clear(), copy(), update(), get(), popitem(), and setdefault() are easy exercises. The list methods count(), extend(), index(), and pop() are likewise pretty easy. The list methods insert(), remove(), and sort() might be more interesting. Adding support for slices and implementing __delitem__() and __cmp__() will take some thought - and some research. The class should probably also have sensible __init__(), __repr__(), and __str__() methods. Happy hacking! -- Jason Orendorff http://www.jorendorff.com/ From jkraska at san.rr.com Tue Dec 4 01:37:03 2001 From: jkraska at san.rr.com (Courageous) Date: Tue, 04 Dec 2001 06:37:03 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> Message-ID: >I like the width of 4 spaces also, BUT I use tabs and configured my editor >to "DISPLAY" tabs as 4 characters in width. In my experience, the vast majority of people who do this inevitably end up mixing tabs and spaces. The moment you do this, you have defacto chosen an tabwidth for your viewing audience whether they like it or not. C// From Tom.Karas at htp-tel.de Mon Dec 17 18:22:10 2001 From: Tom.Karas at htp-tel.de (Tom Karas) Date: Tue, 18 Dec 2001 00:22:10 +0100 Subject: do not know what is wrong python under win2k References: <3C1E752E.8864E2E9@htp-tel.de> <5KuT7.15581$PA.12409@atlpnn01.usenetserver.com> Message-ID: <3C1E7E22.D6169237@htp-tel.de> Thanks Steve, > The line you entered into the Python interpreter should by typed to > your operating system's command interpreter (in Windows, in a command > window at the ">" prompt). This was the problem - i always thought i had to type this in in the open interpreter shell. Thanks again. From shulmang at colorado.edu Thu Dec 27 18:22:31 2001 From: shulmang at colorado.edu (Garett Shulman) Date: Thu, 27 Dec 2001 23:22:31 GMT Subject: python irc Message-ID: does anyone know of python irc servers/channels? From sdm7g at Virginia.EDU Thu Dec 20 16:10:31 2001 From: sdm7g at Virginia.EDU (Steven Majewski) Date: Thu, 20 Dec 2001 16:10:31 -0500 (EST) Subject: NOT Re: Bug in % string formatting? In-Reply-To: <9vtiev$no8$1@peabody.colorado.edu> Message-ID: On Thu, 20 Dec 2001, Fernando [ISO-8859-1] P?rez wrote: > If this is not a bug in % string formatting, I'd love to understand what is > going on. > > # but this fails. The format string is copied verbatim from above > print 'Explicit list construction:' > print format_string % names['John'][:] + names['Jane'][:] Try wrapping the addition in parends: >>> print format_string % ( names['John'][:] + names['Jane'][:]) John Doe Jane Doe Without explicit parends, you're doing the equivalent of: >>> print (format_string % names['John'][:]) + names['Jane'][:] Yes: it would make more sense if the order of operations were different, but remember -- "%" and "+" both double as arithmetic and string operators, but both cases have to share the same preecedence. -- Steve Majewski From Bruce at EckelObjects.com Sat Dec 8 21:14:21 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Sat, 08 Dec 2001 18:14:21 -0800 Subject: 11-15 new Python Books on the way! (fwd) In-Reply-To: <2621b014.0112081725.29ab24e8@posting.google.com> References: <2621b014.0112081725.29ab24e8@posting.google.com> Message-ID: <200112081814210660.025CEEA9@mail.rdc1.sdca.home.com> There's a chapter in "Thinking in Patterns" (downloadable from http://64.78.49.204/) that might help, although it does assume you know something about Java, sorry. Plus many people have found "Thinking in Java" (also downloadable from the same site) to be helpful in understanding that language. I don't feel bad tooting my horn, since it's free, so no risk on your part. *********** REPLY SEPARATOR *********** On 12/8/01 at 5:25 PM schull at digitalgoods.com wrote: >I'm pleased to hear of a specifically-Jython book. > >As a python programmer interested in accessing java libraries, and as >a NON >-java programmer I’m “shocked and amazed” at the >Byzantine nature of java documentation, and code. > >Has anyone written a “guide to jython for non-java >programmers?”. > >Or might one of the java bean programming environments offer a good >“entry way?” > >Or is it hopeless to suppose that one could learn to use java >libraries, frameworks and beans without learning to read and write >java? > > >LLewin at oreilly.com (Laura Lewin) wrote in message >news:... >> This is a great list! You can also add Jython Essentials, O'Reilly, >> Samuele Pedroni and Noel Rappin. The book is due out in March. >> Laura >> LLewin at oreilly.com >> >> > Ron Stephens wrote: >> > |Truly a surfeit of books. But, for what it is worth, I have listed >all I >> > |could find out about them all at http://www.awaretek.com/plf.html >> > >-- >http://mail.python.org/mailman/listinfo/python-list Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From peter at engcorp.com Sun Dec 9 00:37:03 2001 From: peter at engcorp.com (Peter Hansen) Date: Sun, 09 Dec 2001 00:37:03 -0500 Subject: Tinker vs wxPython ?- Opinions/Views References: <3ReQ7.21098$2Fd.14596@news1.bloor.is> <87elm62luf.fsf@speeder.org> <3C12E168.91F9129A@engcorp.com> <9uuoqt$cj9$1@slb3.atl.mindspring.net> Message-ID: <3C12F87F.C85D917E@engcorp.com> adina_levin at mindspring.com wrote: > > "Peter Hansen" wrote: > > > wxPython Cons: > > [...] > > > Difficult to learn [...] > > > Less stable than Tkinter [...] > > > > I have to disagree with these two. [...] > > Clearly this is a case of YMMV... (Note: "YMMV" = Your Mileage May Vary ;-) ) > For experienced programmers who are familiar with the basic GUI toolkit > pattern, the Wx code examples are probably pretty obvious. > > For new programmers, the Tk tutorials will explain basic concepts such as a > hierarchy of widgets, configuration with parameters, assigning callback > options, and visual layout using constraints, grid, or page positioning. This is an interesting point. I'm an experienced programmer, and oddly enough I did not find Tk very understandable at the time I tried using it. Maybe this is the key difference between the two. Tkinter is the official standard GUI for Python and is (so I hear :-) easier to learn for beginners, while other frameworks are potentially easier for experienced developers (maybe because they have strong feelings about what they want to accomplish, and Tkinter is unable to provide adequate sophistication?). > Wrote my first GUI app last weekend and struggled mightily with Wx, then > gave up -- I wasn't able to pick out the patterns from the sample code. > > Then I read through the "Programming Python" chapters on Tkinter, and was > enlightened. still-not-enlightened-but-python-helps-my-karma-ly yr's ;-) ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From just at letterror.com Fri Dec 7 12:39:22 2001 From: just at letterror.com (Just van Rossum) Date: Fri, 07 Dec 2001 18:39:22 +0100 Subject: Calling a generator multiple times References: <200112061113290670.0100F457@mail.rdc1.sdca.home.com> Message-ID: <3C110807.5B739EAA@letterror.com> Courageous wrote: > I don't think that's necessarily a bad thing, but what I feel > firmly about is that the current semantics versus syntax of > generators in python is obviously wrong. > > Just about anything would be better, up to and including the > use of additional keywords. I simply feel strongly that as > long as a generator masquerades as a method, it ought to > behave like one, and that should be its default behavior. You really need to dig into the python-iterators list archives. This has been discussed over and over and over. It's really not as bad as you think. You need to reset your brain, play with generators a bit more. It becomes really natural after a while. Just From gh_pythonlist at gmx.de Sat Dec 29 11:05:26 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Sat, 29 Dec 2001 17:05:26 +0100 Subject: SSL Sockets in Windows In-Reply-To: References: Message-ID: <20011229160523.GA1298@lilith.hqd-internal> Le 29/12/01 ? 16:03, Syver Enstad ?crivit: > Gerhard H?ring writes: > > > Le 28/12/01 ? 07:18, Syver Enstad ?crivit: > > > > > > Hi Al, I'm not exactly an expert on SSL :-). I know it's what goes > > on > > > > > behind the scenes when my browser uses an https url and > > communication > > > > > is encrypted and whatnot. > > > > > > Do you have (or can you refer me to) a quick > > > example to check that SSL is indeed working on Python? > > > > You can check pretty easily if your Python is compiled with SSL > > support: > > > > > > 'ssl' in dir(socket) > > Yes, returns true (1) > > If so, you should be able to fetch a HTML page with the urllib module: > > > > > > print urllib.urlopen("https://www.sf.net/").read() > > Yes, this fetches the front page of sourceforge, which says that I'm > not logged in. > > What would happen if I didn't have SSL installed. 'ssl' in dir(socket) will return 0, because the entire SSL stuff in socketmodule.c is #ifdef'd out. print urllib.urlopen("https://www.sf.net/").read() raises Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.1/urllib.py", line 71, in urlopen return _urlopener.open(url) File "/usr/lib/python2.1/urllib.py", line 173, in open return self.open_unknown(fullurl, data) File "/usr/lib/python2.1/urllib.py", line 185, in open_unknown raise IOError, ('url error', 'unknown url type', type) IOError: [Errno url error] unknown url type: 'https' > You see I compiled up a new version of _socket.pyd with VC++ 6 and > this time I specified that SSL shouldn't be compiled in. 'ssl' in > dir(socket) still returns true, and the download goes without a > hitch too. I haven't checked with a packet sniffer though. You seem to still have SSL compiled in. Be sure to replace your _socket.pyd with the one without SSL. Using "python -v" helps tracking down which module really is loaded. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From des.small at bristol.ac.uk Tue Dec 4 08:47:06 2001 From: des.small at bristol.ac.uk (Dr. Des Small) Date: Tue, 4 Dec 2001 13:47:06 GMT Subject: Numerical Python Question References: <9uieop$bncra$1@hades.rz.uni-sb.de> <9uih0n$bs948$1@hades.rz.uni-sb.de> Message-ID: Yow! Uwe Schmitt writes: > Well, i fixed it: I have to use Matrix() in order to construct a > Matrix whith appropriate __mult__()-method. Now I encountered another > problem: [code snipped, x is a n*1 array] > print "x=", x > print > print "x'*x=", transpose(x)*x > print > print "x*x'=", x*transpose(x) > print > > This program should output a vektor, then a scalar and finally a matrix. > But it outputs a vektor and two matrices. > I think this is a bug. This is not a bug; it's documented. The operator "*" does not perform matrix multiplication in the linear algebra sense (it does a sort of element-wise multiplication). The function you want is matrixmultiply, as in: print "x*x'=", matrixmultiply(x,transpose(x)) This is a common source of surprise with people new to Numpy. Des. -- Dr Des Small, Scientific Programmer, School of Mathematics, University of Bristol, Tel: 0117 9287984 From dale at riverhall.NOTHANKS.co.uk Sun Dec 30 14:20:26 2001 From: dale at riverhall.NOTHANKS.co.uk (Dale Strickland-Clark) Date: Sun, 30 Dec 2001 19:20:26 +0000 Subject: REPOST: Re: win32all-141 for Python 2.2 References: <3C2D4676.5060700@skippinet.com.au> Message-ID: <3$--$$_----_%-_%$$@news.noc.cabal.int> Mark Hammond wrote: >I have made a new win32all release for Python 2.2. > >Hrmm - it seems I can't login to starship :( So I have temporarily >placed it at: > >http://users.bigpond.net.au/mhammond/win32all-141.exe > Thanks Mark. This was all that was stopping me looking at 2.2. -- Dale Strickland-Clark Riverhall Systems Ltd ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Dale Strickland-Clark Newsgroups: comp.lang.python Subject: cmsg cancel <06qu2u85qldj0066b9kn78tge4uvmev50l at 4ax.com> Control: cancel <06qu2u85qldj0066b9kn78tge4uvmev50l at 4ax.com> Date: Mon, 31 Dec 2001 01:51:26 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774110 27193 211.57.49.2 (31 Dec 2001 04:48:30 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:48:30 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jkraska at san.rr.com Thu Dec 27 18:04:47 2001 From: jkraska at san.rr.com (Courageous) Date: Thu, 27 Dec 2001 23:04:47 GMT Subject: Two languages, too similar, competing in the same space. References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> Message-ID: >And I like and respect Matz and the whole Ruby community. I wish them well. >But I recognize that their success may, on the margins at least, slow down >Python. I would think it more likely that Matz will simply pick up many folks who know Japanese but not English fluently. The world is a very large place, where even niche variants of programming languages can attract followings sizeable enough to give languages for those niches momentum. This would characterize Python's early history, as a matter of fact. C// From andreyw at mailandnews.com Tue Dec 18 02:58:00 2001 From: andreyw at mailandnews.com (andreyw) Date: 17 Dec 2001 23:58:00 -0800 Subject: deleting from bsddb References: <9vlnmp$12ck$1@news.doit.wisc.edu> Message-ID: <76d5d34e.0112172358.74c7c3e9@posting.google.com> "Erika Skoe" wrote in message news:<9vlnmp$12ck$1 at news.doit.wisc.edu>... > i don't see the syntax anywhere for deleting an element from a bsddb. any > hints? > > -e See shelve.py : del dict[key] From aleax at aleax.it Fri Dec 28 10:42:17 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 16:42:17 +0100 Subject: pth files - can they prepend to sys.path? References: Message-ID: "Skip Montanaro" wrote in message news:mailman.1009549952.9614.python-list at python.org... > > Is it possible to force a directory mentioned in a .pth file to be inserted > at the beginning of sys.path instead of appended to the end? Only by editing your site.py, I fear (or, by doing it in siteconfigure.py, probably better). Function site.addpackage, as it stands, uses sys.path.append, so directories thus added won't get to the start of sys.path, but always to the end. Alex From phd at phd.pp.ru Mon Dec 10 16:42:09 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Tue, 11 Dec 2001 00:42:09 +0300 Subject: two questions - sockets / c functions In-Reply-To: <200112101947.fBAJllua032444@ratthing-b246.strakt.com>; from lac@strakt.com on Mon, Dec 10, 2001 at 08:47:47PM +0100 References: <3c14bc2c$1_2@news7.fast.net> <20011210165417.P18573@phd.pp.ru> <200112101947.fBAJllua032444@ratthing-b246.strakt.com> Message-ID: <20011211004209.A14348@phd.pp.ru> On Mon, Dec 10, 2001 at 08:47:47PM +0100, Laura Creighton wrote: > The only thing Oleg forgot to tell you was that sockets don't work on > Windows Sockets don't work on Windows? It is nice to hear, but I do not beleive it! What do you mean?! Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From rpm1deletethis at frontiernet.net Sun Dec 2 13:54:57 2001 From: rpm1deletethis at frontiernet.net (RPM1) Date: Sun, 2 Dec 2001 13:54:57 -0500 Subject: age of new pythonistas [was: The Editor Poll results are in!] References: <3bfd7f87@news.airtel.net> <9u4cbu$2ts$1@news.xmission.com> <9udn1g$64c$1@brokaw.wa.com> Message-ID: "Alan Winston" wrote in message news:9udn1g$64c$1 at brokaw.wa.com... > > it'd also be cool to see the relative age of new pythonistas -- I suspect > > that they're young, but this is completely unfounded. > 37 I make my living coding C. I have recently begun coding all my own projects in Python. I also write utilities at work in Python that other programmers end up 'borrowing'. I've found that I can whip up some cool utilities in Python that could have been coded in C but it wouldn't have been worth the effort. For example, something that only takes 45 minutes to code in Python would probably have taken 3 or 4 hours in C. One example, is a utility that parses a C .h file to get the structure of records in a C binary file, and then reads in the records and prints them out in readable format. What made this hard to code in C was the fact that our customers have different structures and different byte alignments. With Python, I just give it the name of the data file, the name of the .h file and the alignment and it spits out the data with no problem. My brother ,(who's mentioned in the thank you's of "Learning Python"), tipped me off to Python back in 1996, but I never got around to doing much with it until about a year ago. Patrick Mullhaupt From chris.gonnerman at newcenturycomputers.net Thu Dec 20 21:53:31 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Thu, 20 Dec 2001 20:53:31 -0600 Subject: Is there a tool for python under Linux? References: <003b01c189ba$136a71f0$4301010a@sky> Message-ID: <004d01c189ca$b251f800$0101010a@local> Actually in Linux it won't have a .exe extension. IS there a way to do this? ----- Original Message ----- From: ??? To: python-list Sent: Thursday, December 20, 2001 6:54 PM Subject: Is there a tool for python under Linux? I want to know if there is a tool which can compile python's source code into a standalone EXE file under Red Hat Linux7.0 ,for example,compile my.py into my.exe under Linux. Regards, Edward -------------- next part -------------- An HTML attachment was scrubbed... URL: From AdrianLeu at kelseus.com Thu Dec 6 05:37:10 2001 From: AdrianLeu at kelseus.com (Adrian Leu) Date: 6 Dec 2001 02:37:10 -0800 Subject: re. module References: <993ae4ca.0111140731.3c11e6d5@posting.google.com> <9tm2t5$o66$1@usenet.Stanford.EDU> Message-ID: <993ae4ca.0112060237.6685646a@posting.google.com> amitp at Xenon.Stanford.EDU (Amit Patel) wrote in message news:<9tm2t5$o66$1 at usenet.Stanford.EDU>... > Adrian Leu wrote: > | I am trying to figure out a solution for the following: > | > | import re > | > | text = 'name_0 goto place' > | string = 'name|name_0|name_1' > | > | pattern = re.compile(string, re.I) > | d = pattern.search(text) > | return d.group(0) > | > | The problem is that my program will return 'name' to this. What I want > | is for the search to return a match (if it exists) only after looking > | at the whole string (name_0 in this case). I.e. in my example I would > | like the program to return 'name_0' not 'name'. > > Rearrange the pattern to 'name_0|name_1|name'. :-( > > Most of the time, regular expressions will find the 'longest match', > but in this case it doesn't work. It's a real pain when writing a > parser generator. I'd really like to just | together the tokens to > match, but because of the above.. er.. "feature", it doesn't work so > well. (And because the parser generator takes a generic set of > tokens, it doesn't know which one is a subset of another.) > > Another option in your example would be if you're willing to match an > entire word, there's some re pattern (\b??) that matches the end of a > word. > > - Amit > > > -- Thanks ! Yes, the r'\b' pattern did the trick. From donn at drizzle.com Mon Dec 17 23:40:44 2001 From: donn at drizzle.com (Donn Cave) Date: Tue, 18 Dec 2001 04:40:44 -0000 Subject: pty/fork and SIGINT References: Message-ID: <1008650439.385033@yabetcha.sttl.drizzle.com> Quoth bsturk at news.rcn.com (Brian Sturk): | I'm using the pty module to to "control" a shell process | and I'm having a hard time getting SIGINT to be sent to | the processes spawned within it, i.e. ping . | | I've tried registering a handler via signal.signal and externally | sending it SIGINT with the pid returned from fork() using kill, | and also using the returned pid from fork() to send it a signal.SIGINT | from within the script. Nothing I've tried seems to work. | | The script is a little large to post here but it basically | is run within the editor vim so there are a few variables at work. | I'm wondering if the problem is that I'm never returning control | to the editor since I continually have data to be read(). I'm not | a signal/process guru so I'm unsure where to look. Works for me. I'm running BeOS right now, so that's where I tried it, but I imagine it will work under UNIX too. You have a big problem there - as you recognize, with a big script and an unusual operating environment and all, it's hard to say where it's going wrong. You need to simplify. You can run ping behind a pty and print out the output in a few lines of code; now use posix.kill to deliver your signal to the ping process. Works? Hm. Run a simple sleep process from vim, let it die naturally. That working? Kill it, still works like you expect? Etc. When you have a simple 20 line script that we can run and see the same problem for ourselves, then you can hope for help. (But I bet you'll find the problem on your own in the process.) Donn Cave, donn at drizzle.com From timcera at earthlink.net Sun Dec 30 00:15:56 2001 From: timcera at earthlink.net (Tim Cera) Date: 29 Dec 2001 21:15:56 -0800 Subject: REPOST: Paramaterized local variable name Message-ID: <7$--$$_----__%%$$$@news.noc.cabal.int> Hello, I have the following code: def paging(data, key, query_dict): for i in range(0, len(data[key]), use_pagesize): start = data[key][i].name ...etc. which works fine for data[key][i].name, but sometimes I want this function to process data[key][i].rev. So, if local_name is equal to 'name' or 'rev' or 'whatever', what I want is something like: def paging(data, key, query_dict, local_name): for i in range(0, len(data[key]), use_pagesize): start = data[key][i]. # What goes here ^^^^ ? Thanks Tim Cera ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!newsfeed.gamma.ru!Gamma.RU!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: timcera at earthlink.net (Tim Cera) Newsgroups: comp.lang.python Subject: cmsg cancel <9c3f2e9c.0112292115.6a4e22af at posting.google.com> Control: cancel <9c3f2e9c.0112292115.6a4e22af at posting.google.com> Date: Mon, 31 Dec 2001 01:10:31 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774389 27193 211.57.49.2 (31 Dec 2001 04:53:09 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:53:09 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From ymmt at yc5.so-net.ne.jp Sat Dec 22 07:59:55 2001 From: ymmt at yc5.so-net.ne.jp (Hirotaka Yamamoto) Date: 22 Dec 2001 21:59:55 +0900 Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic References: <3218013921984060@naggum.net> Message-ID: <87vgeze7g4.fsf@yc5.so-net.ne.jp> Erik Naggum writes: > Look, Tengwar is more widely used than Scheme these days. The features > unique to Scheme today are those that are universally considered bad > ideas. Prove it by examples, please. Yamamoto From peter at engcorp.com Wed Dec 26 20:59:24 2001 From: peter at engcorp.com (Peter Hansen) Date: Wed, 26 Dec 2001 20:59:24 -0500 Subject: references for shifting from Py1.5.2 to Py2.2? References: <3c2a5cd1_2@corp.newsgroups.com> Message-ID: <3C2A807C.255A9D82@engcorp.com> Joshua Muskovitz wrote: > > After a long hiatus, I'm returning to the Python community. I haven't > touched Python since 1.5.2, and I'd like to climb the curve to 2.2 as > quickly as possible. What are the definitive references for making the > transition? For a start, and maybe sufficiency, look at the changes made in the intervening releases: For example, the section "What's new in release 1.6?" at http://www.python.org/1.6.1/ ... and "What's New in Python 2.0?" at http://www.python.org/2.0/ or, even better, look at Andrew Kuchling's detailed descriptions for 2.0 through 2.2 at http://www.amk.ca/python under the rubrik "What's New in Python". -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From michael at stroeder.com Sun Dec 30 09:58:33 2001 From: michael at stroeder.com (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Sun, 30 Dec 2001 15:58:33 +0100 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <4VlX7.6657$l93.1694996@newsb.telia.net> <6o6s2u4pa4kvqben6ftatrfttu9s78ee1k@4ax.com> Message-ID: <4$--$$_----__$_$-$@news.noc.cabal.int> Ulf Magnusson wrote: > > C is: > Easy to learn > [..] > Python is: > Hard to learn (well relativly to C) ??? Ciao, Michael. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Michael =?iso-8859-1?Q?Str=F6der?= Newsgroups: comp.lang.python Subject: cmsg cancel <3C2F2B99.DE8AD110 at stroeder.com> Control: cancel <3C2F2B99.DE8AD110 at stroeder.com> Date: Mon, 31 Dec 2001 02:20:27 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774210 27193 211.57.49.2 (31 Dec 2001 04:50:10 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:50:10 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From fdrake at beowolf.digicool.com Sat Dec 15 15:44:16 2001 From: fdrake at beowolf.digicool.com (Fred Drake) Date: Sat, 15 Dec 2001 15:44:16 -0500 (EST) Subject: [maintenance doc updates] Message-ID: <20011215204416.B421F286BC@beowolf.digicool.com> The development version of the documentation has been updated: http://python.sourceforge.net/maint-docs/ Miscellaneous minor updates/fixes. From phd at phd.pp.ru Mon Dec 3 11:10:55 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Mon, 3 Dec 2001 19:10:55 +0300 Subject: zope newsgroup? In-Reply-To: <9ug7rq$86oo8$1@ID-84593.news.dfncis.de>; from s.lorenz@release-it.de on Mon, Dec 03, 2001 at 05:02:51PM +0100 References: <9ug7rq$86oo8$1@ID-84593.news.dfncis.de> Message-ID: <20011203191055.L15009@phd.pp.ru> On Mon, Dec 03, 2001 at 05:02:51PM +0100, .seshi wrote: > im lookin for a zope newsgroup... i have to work with this ***** and have > several questions. or may i ask here? http://www.zope.org/Resources/MailingLists Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From paul at boddie.net Wed Dec 5 10:38:41 2001 From: paul at boddie.net (Paul Boddie) Date: 5 Dec 2001 07:38:41 -0800 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <23891c90.0112040300.77f64f8e@posting.google.com> Message-ID: <23891c90.0112050738.60ed8b25@posting.google.com> Steve Lamb wrote in message news:... > OR... are you going to admit that you were > purposely misrepresenting what you fully knew what a tab represented in this > context just to get a rise out of me? Yes. I hope you enjoyed it as much as I did. :-) Paul P.S. Actually, I'm much more serious about the whole indentation thing in other forums, but you wading into this debate as you did really invited some irreverence. From rdsteph at earthlink.net Fri Dec 28 20:11:51 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sat, 29 Dec 2001 01:11:51 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> <5162AA73D84B5DBA.D2515DB62E721798.F62643D4812CA388@lp.airnews.net> Message-ID: <3C2D18D9.D08FA7D0@earthlink.net> Cameron Laird said in reply to Alex martelli's question: What huge firm[s] might possibly make a >similar decision in the case of Python? And why? An intriguing question, to which we per- haps shall return later. . . . Wow, YYikes ;-)) I, for one, am intrigued, and I bet I'm not alone. I'm dying to know what you might know along these lines, Cameron ;-))) From clgonsal at kami.com Tue Dec 4 12:07:47 2001 From: clgonsal at kami.com (C. Laurence Gonsalves) Date: Tue, 04 Dec 2001 17:07:47 GMT Subject: A modest indentation proposal References: <3C0773C2.A12D0BAC@pacific.net.hk> Message-ID: On Sat, 01 Dec 2001 00:46:42 GMT, Fredrik Lundh wrote: >> I believe effbot and the other people at Python Labs are working >> on a "refactoring browser" for Python. > >Secret Labs != Python Labs. > >and yes, we have a refactoring browser for PythonWorks. it >does a lot more than keeping the indentation intact, though; >it helps you reorganize code (inline functions, move code >fragments into a separate functions, encapsulate attributes, >rename classes/methods/attributes, get rid of arguments, >etc) while doing its best to make sure that the resulting code >has *exactly* the same meaning as before. If I have the following piece of code to start with: while A(): B() C() if D(): E() F() I() J() then suppose I paste a chunk of code after the "F()" line. What indentation would your refactoring browser give that new chunk of code? There are three possible valid indentations, and unless your editor is smart enough that it can actually understand what your code is supposed to do, I don't see how it can make the right decision. I think this is the problem Erann is getting at: Python doesn't have any (redundant) notation after a block closing that indicates that a block was closed. It does however have redundant information before a block opening (the colon). Because of this (the lack of redundant info at the end of a scope), editors cannot always determine how to auto-indent pasted chunks of code, because there are multiple "right answers" for certain lines. I don't actually like Erann's semicolon suggestion though. I think it would have equally annoying problems, in addition to breaking all of the code that people wrote in Python when they first switched from C/C++/Java... :-) Incidently, I ran into a related problem a couple of years ago when I was trying to make mappings in VIM for [{ and ]} that worked in Python code. In VIM, [{ and ]} normally go to the beginning or end of the current scope, assuming your language uses curly-braces for scoping blocks. So if I was on the "E()" line of the following piece of C code: while (A()) { B(); C(); if (D()) { E(); F(); } } I(); J(); and then I hit [{, it would bring me to the D() line. Hitting [{ again would bring me to the A() line. Going in the other direction, if I started at the E() line again, hitting ]} would bring me to the first curly brace after the F() line. Hitting ]} again would bring me to the next curly brace. The Python equivalent I wrote worked very well for [{. Using the Python code at the top of this post, starting at the E() line, and then hitting [{ would bring you to the D() line, and hitting [{ again would bring you to the A() line. Unfortunately, ]} didn't work so well. Starting at the E() line, hitting ]} would bring you to the I() line. So it actually caused the cursor to move two scopes. This is unavoidable, because there is no character position after the F() but before the I() that is inside the while but outside of the if. -- C. Laurence Gonsalves clgonsal at kami.com From dalke at dalkescientific.com Sun Dec 2 23:01:50 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Sun, 2 Dec 2001 21:01:50 -0700 Subject: a comment about PEPs References: Message-ID: <9uetv2$vtn$1@slb6.atl.mindspring.net> phil hunt: >Whenever I have a peek at c.l.p, there are usually several threads going >suggesting improvements to the langauge. > >Why is this? Here's a few I've seen. - Python isn't perfect (type/class dichotomy, rich comparisons) - There are bugs in the C implementation (xrange, list.append) - Some other languages have neat features which people miss when they switch to Python (nested static scopes, lazy iterators) - People don't know the history of a thread, and keep reviving it OVER AND OVER AND OVER AND OVER (eg, using something other than indentation for scope) - Some think that needs of a small domain are needs of a general programming language (switch statements are useful for state machines, but are they useful for Python?; if cgi.py is imported then the traceback display hook should display output to HTML) - Others don't realize a specific need can be done in other ways (Java-style interfaces) - With extra hints provided by the language, different implementations could work better (explicit type declarations can help a hypothetical Python compiler produce machine code) Andrew dalke at dalkescientific.com From claird at starbase.neosoft.com Fri Dec 14 20:31:57 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 14 Dec 2001 19:31:57 -0600 Subject: python and SOAP?? References: <9valdt$ik6$1@pea.uk.research.att.com> Message-ID: <59E456FD3AD1FE80.FF0578E51CFDE7B5.7FEBAE7CEB1F44D9@lp.airnews.net> In article <9valdt$ik6$1 at pea.uk.research.att.com>, Duncan Grisby wrote: >In article , >Markus Jais wrote: >>On Thu, 13 Dec 2001 16:31:34 +0100, Cameron Laird wrote: >> >>> http://www.onlamp.com/pub/a/python/2001/06/14/pysoap.html >> >>thanks for the URL. was very helpful. > >It's a good article. I'd like to correct a common myth about CORBA, >though. The article says: > > """ > Compared to other distributed programming tools like DCOM or CORBA > (or, more properly, the IIOP which transports CORBA,) SOAP is > > * platform-neutral, > * computing language-independent, and > * Unicode-ready. > """ > >CORBA's IIOP _is_ platform-neutral, language independent, and Unicode >ready. . . . I'm glad you called me on that. At best, that passage is misleading. That was unintentional on my part, of course. I esteem CORBA's (or IIOP's) platform-neutrality and language independence. The only argument there is that it seems to remain difficult for many languages to construct high-quality CORBA bindings--maybe harder than corresponding SOAP ones, although I'm well aware of the defects in the latter. Unicode's the sticking point. Again, I under- stand that, in principle, CORBA does a good job of transporting any kind of data (is this a good point, by the way, for a gratuitous snipe at SOAP's performance?). On a practical level, though, multi-byte codesets have not been a focus for most CORBA implementations, and I be- lieve the majority still only support single-byte for (IDL) "string". True? I'm cross-posting this to c.o.c, to ensure we reach a fully accurate answer. This is my summary: at this point, it's easier to find a SOAP binding that "does the right thing" with Unicode than it is to track down such an ORB. The one question I have about this is whether I'm being unfair to (IDL) "wstring". I'm in- experienced with CORBA; my impression, though, is that wstring isn't the solution one wants. I welcome correction from those who know better. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From LLoeffler at home.com Mon Dec 17 13:18:16 2001 From: LLoeffler at home.com (Luke) Date: Mon, 17 Dec 2001 12:18:16 -0600 Subject: Looping in Python References: <9vl8os$gcs$1@bob.news.rcn.net> Message-ID: <3C1E36E8.3070707@home.com> > loop(start=0, stop, step=1): > (loop.count and loop.value automagically generated by Python, > loop count starts from 1 and incremented by 1, > loop value starts from start value and incremented by step value, > stop value is a long integer) > > if condition: > break > elif anothercondition: > continue > your_statements_and_what_have_you_here If loop were a function, how would you get the code to be executed into the function? Then maybe we could have also: if(condition=None) and break(loop=thisloop) and continue(loop=thisloop). L From mwh at python.net Tue Dec 18 11:09:39 2001 From: mwh at python.net (Michael Hudson) Date: Tue, 18 Dec 2001 16:09:39 GMT Subject: Cygwin socket library status enquiry References: <20011218131502.GA2268@dothill.com> <2JJT7.22497$PA.5674@atlpnn01.usenetserver.com> Message-ID: "Steve Holden" writes: > "Michael Hudson" wrote in message > news:un10gk0v6.fsf at python.net... > > "Steve Holden" writes: > > > > > ----- Original Message ----- > > > From: "Jason Tishler" > > > To: "Andy Todd" > > > Cc: "Steve Holden" ; > > > Sent: Tuesday, December 18, 2001 8:15 AM > > > Subject: Re: Cygwin socket library status enquiry > > [snip[ > > > > Andy brings up a good point -- What platform are you using? 9x/Me > > > > or NT/2000/XP? > > > > You didn't answer this question (hint, hint). > > > OK, I'll 'fess up: this was on Win 98. I'll be trying the same tricks on NT > when I can get my network stable enough to make it practical -- at present > everything's being reinstalled and/or upgraded. Aha! Can you try running the test suite from 2.2c1 on a recent-ish cygwin? I'd like to include some more up to date information in the README -- currently all it says is "we don't know the current state of play wrt cygwin on 95/98/Me." This applies to anyone else who has access to the relavent software too, of course. Cheers, M. -- Some people say that a monkey would bang out the complete works of Shakespeare on a typewriter give an unlimited amount of time. In the meantime, what they would probably produce is a valid sendmail configuration file. -- Nicholas Petreley From peter at engcorp.com Sat Dec 29 18:45:42 2001 From: peter at engcorp.com (Peter Hansen) Date: Sat, 29 Dec 2001 18:45:42 -0500 Subject: Zope Documentation (was RE: Python Popularity: Questions and Comments) References: Message-ID: <3C2E55A6.D873E301@engcorp.com> Bill Tate wrote: > > I understand the "zen" thing, If you say that, then you don't really understand it. ;-) > but it's not something that business > people are going to care about when they making a decision about > whether to use it or not. As a business person, I take mild exception to that. I'd rather have "zen" from Zope than "marketing" from Microsoft. -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From objectway at divalsim.it Thu Dec 13 05:44:00 2001 From: objectway at divalsim.it (Nicola Musatti) Date: Thu, 13 Dec 2001 11:44:00 +0100 Subject: UK Python event, April 3-6 2002 - speakers wanted! References: Message-ID: <3C188670.5EB99145@divalsim.it> I'd just like to add that the ACCU Spring Conference is a very high quality event: you can check here ( http://www.accu.org/events/public/accu0204.htm ) for provisional details, and it is usually offered at a very reasonable price. As a very satisfied attendee of last year's edition I'm looking forward to attending the coming one. A high quality Python track would be an appreciated bonus. One last thing: the marketing/commercial side is usually kept to a minimum! Last year there were only a couple of small stands outside the conference rooms set up by small companies and a book stall from the local branch of a national bokseller. It's incredible how refreshing it is to attend a hype free conference! Cheers, Nicola Musatti From tim at vegeta.ath.cx Thu Dec 27 14:22:15 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Thu, 27 Dec 2001 19:22:15 GMT Subject: A new message board is up References: <40dbad98.0112262232.1868734e@posting.google.com> <40dbad98.0112271006.b98e822@posting.google.com> Message-ID: Andrew Nguyen graced us by uttering: > and yes, python does need a lighter heart. Python _does_ indeed have a lighter heart. It merely disliked being dragged down by doomsayers and promptly floated away. Tim Hammerquist -- For every problem, there is one solution which is simple, neat and wrong. -- H. L. Mencken From slinkp23 at yahoo.com Wed Dec 5 11:33:30 2001 From: slinkp23 at yahoo.com (Paul Winkler) Date: Wed, 05 Dec 2001 16:33:30 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> Message-ID: On Mon, 3 Dec 2001 12:07:20 +0100, Andreas Kostyrka wrote: >Were does it say so? I've been programming Python with mixed spaces/tabs >since 1.3. Works like a charm. Just never forget to install python-mode.el ;) Which means the editor is replacing each tab level with 4 spaces, so there are no tabs in your code. Works for me too. --PW From borcis at geneva-link.ch Thu Dec 27 16:54:34 2001 From: borcis at geneva-link.ch (Boris Borcic) Date: Thu, 27 Dec 2001 22:54:34 +0100 Subject: REPOST: Re: A new message board is up References: <40dbad98.0112262232.1868734e@posting.google.com> <3C2B724D.E4D31E24@ccvcorp.com> Message-ID: <0$--$$_----_-$-_%$@news.noc.cabal.int> Jeff Shannon wrote: > > others (like sheer disgust at the thought of anyone using "l33t > sp34k" in anything other than total parody), What's this standard, anyway clearly a 3 should stand for a B, not an e. 1234567 IRBASGT obviously. BB ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Boris Borcic Newsgroups: comp.lang.python Subject: cmsg cancel <3C2B989A.1D504787 at geneva-link.ch> Control: cancel <3C2B989A.1D504787 at geneva-link.ch> Date: Mon, 31 Dec 2001 03:56:48 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775572 27193 211.57.49.2 (31 Dec 2001 05:12:52 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:12:52 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From chrisw at nipltd.com Fri Dec 21 08:34:22 2001 From: chrisw at nipltd.com (Chris Withers) Date: Fri, 21 Dec 2001 13:34:22 +0000 Subject: Strip-o-Gram 1.1 Released! Message-ID: <3C233A5E.D5BCB497@nipltd.com> Strip-o-Gram is an HTML Conversion Library that can convert HTML to Plain Text and strip specified tags from HTML. See http://www.zope.org/Members/chrisw/StripOGram for more details. This release fixes a minor bug and has a new implementation for the html2text function. cheers, Chris From lbergman at abi.tconline.net Fri Dec 21 17:45:19 2001 From: lbergman at abi.tconline.net (Lewis Bergman) Date: Fri, 21 Dec 2001 16:45:19 -0600 Subject: SimpleXMLRPCServer use examples? Message-ID: <200112212245.fBLMjJC16067@lewis.abi.tconline.net> Anyone know of any? -- Lewis Bergman Texas Communications 4309 Maple St. Abilene, TX 79602-8044 915-695-6962 ext 115 From jkraska at san.rr.com Fri Dec 28 19:17:59 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 29 Dec 2001 00:17:59 GMT Subject: Python on the desktop References: <94e3fce8.0112210053.2568529d@posting.google.com> <3C238618.9F54E5CA@attbi.com> Message-ID: >See? It's still not working... why would someone deliberately misspell >something? Well, see, hegemoney is a play on words see. On one hand, you have hegemony. On the other, you have money. Together, you get hegemoney. This would make the comment a jab at Microsoft, see? :) From fredrik at pythonware.com Fri Dec 21 11:28:23 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 21 Dec 2001 16:28:23 GMT Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> <7xlmfxvbx7.fsf@ruckus.brouhaha.com> <3dbsgt7f0e.fsf@ute.mems-exchange.org> Message-ID: Suchandra Thapa wrote: > Not bugs per se unless perfect backward compatibility was > an overriding concern. it isn't. From andymac at bullseye.apana.org.au Sun Dec 30 16:30:43 2001 From: andymac at bullseye.apana.org.au (Andrew MacIntyre) Date: Mon, 31 Dec 2001 08:30:43 +1100 (EDT) Subject: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) In-Reply-To: <3C2F2920.89841C81@stroeder.com> Message-ID: On Sun, 30 Dec 2001, Michael [iso-8859-1] Str?der wrote: > Seriously, I'm sick of all the security announcements regarding > buffer overflows and such. Not to speak of memory leaks. That's > stone age. Not the fault of the language per se, but the "standard" C library. -- Andrew I MacIntyre "These thoughts are mine alone..." E-mail: andymac at bullseye.apana.org.au | Snail: PO Box 370 andymac at pcug.org.au | Belconnen ACT 2616 Web: http://www.andymac.org/ | Australia From walter at livinglogic.de Thu Dec 6 08:02:52 2001 From: walter at livinglogic.de (Walter =?ISO-8859-1?Q?D=F6rwald?=) Date: Thu, 06 Dec 2001 14:02:52 +0100 Subject: Strip HTML tags from downloaded files References: <20011205184727.14933.qmail@email.com> Message-ID: <3C0F6C7C.3030502@livinglogic.de> Thomas Pham wrote: > When I use urlretrieve to download a file from the web, the raw text file have HTML tags embedded at the beginning and the end of the file. > > > > > > > >

> > > Is there anyway to strip all the HTML tags from the file? You could do this with XIST (http://www.livinglogic.de/Python/xist/) Code might look like this: from xist import parsers from xist.ns import html doc = parsers.parseTidyURL("http://www.freshmeat.net/", defaultEncoding="latin-1") string = doc.find(type=html.pre, searchchildren=1)[0].asPlainString() print string HTH, Walter D?rwald From claird at starbase.neosoft.com Fri Dec 28 11:25:28 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 28 Dec 2001 10:25:28 -0600 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <889C110F5BBBFAFD.A03B35C232EA2760.70B0892CB9479323@lp.airnews.net> Message-ID: <4$--$$_----_--$%_$@news.noc.cabal.int> In article , Alex Martelli wrote: >"Cameron Laird" wrote in message >news:889C110F5BBBFAFD.A03B35C232EA2760.70B0892CB9479323 at lp.airnews.net... . . . >Maybe, but Python could be usable as an extension language >even if the application was implemented otherwise, in the >right environments (JVM: Jython always usable where Java >is; Microsoft COM/Automation). . . . Yikes! Let me make this perfectly clear: YES, Python deserves consideration as an extension language even in applications largely implemented in other languages such as C and Java. I apolo- gize for making that obscure, for it definitely was one of the points I intended to make. As usual, Alex and I agree. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: claird at starbase.neosoft.com (Cameron Laird) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:51:21 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775293 27193 211.57.49.2 (31 Dec 2001 05:08:13 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:08:13 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From usenet at lophty.com Sun Dec 2 20:50:05 2001 From: usenet at lophty.com (brian donovan) Date: Sun, 02 Dec 2001 20:50:05 -0500 Subject: Newbie : Installing Python locally in acct on shared server References: <3C0A3F04.3090206@lophty.com> <3C0A5717.1040508@lophty.com> Message-ID: <3C0ADA4D.4030507@lophty.com> Chris Thanks ! Please scratch my other reply to your post. I'd forgotten to clear my browser cache before checking out the base64 script with the text/plain header added. Once I did so, I got the expected output. I've also tried some other examples and they're all working now. I'm very grateful for your help and the time that you spent to get me up and running. It really means a lot. Thanks again ! -brian Chris Gonnerman wrote: > Ahh... I just realized you aren't giving the web server > the correct headers. Try this: > > -------------------------------------------- > #!/home/luser/bin/python > > import sys > > print "Content-type: text/plain\n" > > print "path has", len(sys.path), "members" > -------------------------------------------- > > and let me know what happens... From shalehperry at attbi.com Thu Dec 13 01:41:40 2001 From: shalehperry at attbi.com (Sean 'Shaleh' Perry) Date: Wed, 12 Dec 2001 22:41:40 -0800 (PST) Subject: Python 1.5.x vs Python 2.x.x In-Reply-To: <3C180FF7.DEAEA6C6@radical.ca> Message-ID: On 13-Dec-2001 Angus Mackay wrote: > there seems to be lots of stuff that refrences python 1.5.x or requires it > but > he www.python.org website doesn't mention it at all. > > what is the deal? > > what are people using? it seems to me that python doesn't handle versioning > at > all well under windows, if I build a module agains python 2.1 it wont work > under > a python 2.2 interpreter at all? > for the most part python modules from 1.5 work under 2.x but not vice versa. Compiled modules are dependent on the version of python they were compiled against. From Daniel.Kinnaer at Advalvas.be Thu Dec 27 08:28:03 2001 From: Daniel.Kinnaer at Advalvas.be (Daniel) Date: Thu, 27 Dec 2001 14:28:03 +0100 Subject: REPOST: Re: Running a script in windows References: Message-ID: <1$--$$_----_%-%-$$@news.noc.cabal.int> On Thu, 27 Dec 2001 20:51:49 +0900, Jonathan Gardner wrote: >I know this comes up a lot, but I can't seem to find the answer in the >archives. (If the answer is RTFM, please let me know where.) > >I don't have a windows box on my desk. A friend of mine does, but I can't get >to it. He is trying to run a program I wrote, but the error message is coming >up too fast for him to catch it. How can you keep that error message window >around longer in Win2K? (BTW, let's pretend he doesn't know how to use the >DOS prompt.) > >Jonathan Use the command window (c:\winnt\system32\cmd.exe or click "Start->Run" and write "cmd" click on "Ok") and call the python module like 'python myscript.py -v' (-v if youre program has argv) Hope this helps. Best regards, Daniel ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Daniel Newsgroups: comp.lang.python Subject: cmsg cancel <638m2u8frhvp7be8piena9q1ll7cf07qac at 4ax.com> Control: cancel <638m2u8frhvp7be8piena9q1ll7cf07qac at 4ax.com> Date: Mon, 31 Dec 2001 01:39:14 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775794 27193 211.57.49.2 (31 Dec 2001 05:16:34 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:16:34 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From brian at sweetapp.com Fri Dec 7 01:16:21 2001 From: brian at sweetapp.com (Brian Quinlan) Date: Thu, 6 Dec 2001 22:16:21 -0800 Subject: strict python? In-Reply-To: Message-ID: <006101c17ee6$b0f1f7b0$445d4540@Dell2> Brian Sturk wrote: > def call_func( self ): > self.func <--- no parentheses > > It took me a little for me to figure it out in my real > script. It'd be nice to have this stuff pointed out > while parsing it. Is it possible? PyChecker might catch errors like this, but Python can't consider this an error. There might be a side-effect of attribute lookup that you are trying to trigger. Pascal does not consider expressions statements and it is very annoying. Cheers, Brian From john.thingstad at chello.no Mon Dec 10 15:00:39 2001 From: john.thingstad at chello.no (John Thingstad) Date: Mon, 10 Dec 2001 21:00:39 +0100 Subject: clearity of exposition Message-ID: <8661TFDKF4YV5SO2VT95ECONSMLG.3c151467@mjolner> Python is often explained as a beginners language. Though it is good for learing peaple to program it also has potential for proffesional programmers. Me I've worked with C++ programming professionally for 6 years. (worked the language for 10) I find the programms I wrote in C++ for my 386 can be written in python on my 686 with approx equal speed. Since the 386 code was fas enough so is the newer python code on my faster machine. The real speed penalties happen in the windows interface, but most ofthe core code is written in C anyhow. In mathemathics we are awarded simplicity and cleary of exposition. I think the same should be true of programming. So now I mostly program in python. My new logic lanuage is closing on completion. (formula.sourceforge.net) It was a pleasure to write to read and is a pleasure to read. Enjoy John From bill-bell at bill-bell.hamilton.on.ca Sat Dec 29 08:22:03 2001 From: bill-bell at bill-bell.hamilton.on.ca (Bill Bell) Date: Sat, 29 Dec 2001 08:22:03 -0500 Subject: Python Popularity: Questions and Comments In-Reply-To: <1009594369.935.71655.m3@yahoogroups.com> Message-ID: <3C2D7D2B.8556.9BDB05A@localhost> Paul Prescod wrote: > Dave Thomas wrote: > > > > ... Instead, Ruby will attract folks from outside the > > Python world. Ruby and Python differ in philosophy and _feel_. Some > > folks like one, some the other. I don't see it as competition. I see > > it as choice. > > Is there really a difference? Pepsi and Coke are choices. They are > also in competition. They have a somewhat different taste but are more > similar than different. In the long run, there will come a day when > they've taken as much of the market share of other drinks away as they > will, and the primary competition will be between the two of them. I haven't been following this thread; forgive me if my comment is redundant. The above exchange reminds me of what marketers have learned about the effect of increasing the number of alternative brands of goods and services in a particular market segment. It is simply that, to a point, the more brands that exist the bigger the market. Or, IOW, the entry of a new brand may deprive the original brands of some of their percentage market shares; however, the overall value of the market increases. As software people very much interested in certain ways of getting work done (ie, Python and Ruby)--not to mention enjoying ourselves!--this is likely to help each of us, provided one does not cling to products and methods that are on their ways out. "It is the time that you have wasted for your rose that makes your rose so important."--St-Exupery From rob at pythonemproject.com Fri Dec 28 22:46:52 2001 From: rob at pythonemproject.com (Rob) Date: Sat, 29 Dec 2001 03:46:52 GMT Subject: need help with class of arrays which have attibutes References: Message-ID: <3C2D3C2C.C9EF5AFE@pythonemproject.com> Emile van Sebille wrote: > > "Rob" wrote in message > news:pan.2001.12.28.15.45.35.83.2001 at ieee.org... > > Hi, > > > > I'm trying to contruct a class of arrays which have attributes. This one > > respresents a wire[] array which can have x,y,z etc coordinates. I just > > can't figure out how to do it. Here is what I have so far: (it uses > > Numpy) > > > You need to review and work some with classes. Start with section 9 in the > tutorial http://www.python.org/doc/current/tut/node11.html and look at the > __init__ references, which is used to initialize class instances. > > HTH, > > -- > > Emile van Sebille > emile at fenx.com > > --------- -- The Numeric Python EM Project www.pythonemproject.com Hi Emile, I've been reading the books and experimenting with different kinds of classes, but it just doesn't seem possible to use an array as a basis for a number of class attributes. For example, wire=conductor (i.e. class) wire[1].x1=30 wire[2].x2=40 etc. Rob. From richard at bizarsoftware.com.au Tue Dec 11 21:50:03 2001 From: richard at bizarsoftware.com.au (Richard Jones) Date: Wed, 12 Dec 2001 13:50:03 +1100 Subject: XXX In-Reply-To: <20011212111644.A5144@jupiter.senux.com> References: <20011212111644.A5144@jupiter.senux.com> Message-ID: <200112120249.fBC2nIk53051@bigboy.bizarsoftware.com.au> On Wednesday 12 December 2001 1:16 pm, Brian Lee wrote: > I'm newbie at Python programming. Sometimes I read ``XXX'' > character as comments in Python source code file. Does that > mean something special? Generally it's a placeholder that indicates that some attention is required somewhere down the track when enough tuits (round) are available. Personally I use "TODO: " to mark such things, though vim highlights both as special in its syntax highlighting. Richard From johnroth at ameritech.net Wed Dec 19 17:45:15 2001 From: johnroth at ameritech.net (John Roth) Date: Wed, 19 Dec 2001 14:45:15 -0800 Subject: moderator: please unsubscribe me! References: Message-ID: This is not a mailing list. There is no moderator. Since you appear to be using Outlook Express, right click on the newsgroup name, and then select "unsubscribe." John Roth "Peoter Veliki" wrote in message news:mailman.1008792803.16755.python-list at python.org... Moderator, I haven't been able to unsubscribe. Please do it for me. Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From sag at hydrosphere.com Thu Dec 13 12:00:56 2001 From: sag at hydrosphere.com (Sue Giller) Date: Thu, 13 Dec 2001 10:00:56 -0700 Subject: Difference in formatting list and tuple values Message-ID: <20011213165905322.AAA289@mail.climatedata.com@SUEW2000> I am trying to format values from either a list or a tuple, and I am getting the following odd (to me) behavior. I can format the tuple entry using %d, but I get an error when I use the same formatting for the same data in a list. Why does this happen? >>> l = [1,2,3] # list >>> t = (1,2,3) # tuple >>> print "%02d" % t[:1] # format first entry in tuple ok 01 >>> print "%02d" % l[:1] # get error with list Traceback (most recent call last): File "", line 1, in ? TypeError: an integer is required >>> print "%02d" % tuple(t[:1]) # cast to a tuple works ok 01 From km-list-python at miazine.net Mon Dec 17 06:55:07 2001 From: km-list-python at miazine.net (Kirill Miazine) Date: Mon, 17 Dec 2001 12:55:07 +0100 Subject: Update Oreilly books? In-Reply-To: <9vkiln$61d$1@mozo.cc.purdue.edu> References: <9vkiln$61d$1@mozo.cc.purdue.edu> Message-ID: <20011217125507.C6285@poff.miazine.net> * Alex Russell [20011217 06:09]: > My personal opinion is that you can do better than "Programming Python". I > own both editions, and like neither, which is a damn shame since it's > O'Rielly, and the author isn't bad at all. It's just that the organization > is a mess, there's virtually no reference material, and truly useful topics I agree with you here. I expected something like Programming Perl when I bought Programming Python (that's why PP was my first Python book). My expectations wasn't met. But still the book contains many useful examples and thus can be a great source of inspiration. -- Kirill From jslowery at hotmail.com Mon Dec 3 03:31:22 2001 From: jslowery at hotmail.com (Jeremy Lowery) Date: Mon, 3 Dec 2001 02:31:22 -0600 Subject: Add method to class Message-ID: Hello all, I've been playing with a system that dynamically adds methods to classes, and editing them, etc. I've found the following code works, but it has several drawbacks. >>> class Spaminator: ... pass ... >>> mySpam = Spaminator() >>> csrc = \ ... ''' ... def foo(self, x): ... print '%s spams %s' % (self.name, x) ... ''' >>> ns = {} >>> cbyte = compile(csrc, '', 'exec') >>> exec cbyte in {}, ns >>> Spaminator.foo = new.instancemethod(ns['foo'], mySpam, Spaminator) >>> mySpam.name = 'The Circus' >>> mySpam.foo('I hate perl!') The Circus spams I hate perl! The main problems with this is that you have to put the function definition code inside the string. Would there be a way to just have the string as the function body and programmaticly add the arguments to construct the function object? Jeremy From roy at panix.com Sat Dec 22 10:38:06 2001 From: roy at panix.com (Roy Smith) Date: Sat, 22 Dec 2001 10:38:06 -0500 Subject: Book "python programming patterns". anybody read this?? References: Message-ID: Gordon McMillan wrote: > I am a long-time Pythoneer and a very long-time programmer, and I had to > study many of the examples carefully before understanding how they > worked. I havn't seen the book, but I have to wonder about the above. Over the 25 or so years I've been programming, I've gradually shifted my priorities from elegance, cleverness, and efficiency, to simplicity and ease of understanding. We do a lot of code review at work, and I'm always the guy at the meetings arguing for rewriting it so it's easier to understand. It seems to me that if somebody is experienced in both algorithms and in the particular language a program is written in still has to study the code carefully to figure out what it's doing, it's probably not very good code. From tim at vegeta.ath.cx Tue Dec 11 22:58:10 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Wed, 12 Dec 2001 03:58:10 GMT Subject: XXX References: <20011212111644.A5144@jupiter.senux.com> Message-ID: Richard Jones graced us by uttering: > On Wednesday 12 December 2001 1:16 pm, Brian Lee wrote: >> I'm newbie at Python programming. Sometimes I read ``XXX'' >> character as comments in Python source code file. Does that >> mean something special? > > Generally it's a placeholder that indicates that some attention is required > somewhere down the track when enough tuits (round) are available. > > Personally I use "TODO: " to mark such things, though vim highlights both as > special in its syntax highlighting. "XXX" has also been used to identify an email, particularly in an AOL mailbox. ;) Tim Hammerquist -- : Do you want perl everywhere or not? No, sometimes I just want it nearby. -- Larry Wall in <199904091930.MAA06625 at kiev.wall.org> From fperez528 at yahoo.com Sat Dec 8 08:14:47 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Sun, 09 Dec 2001 12:42:47 +2328 Subject: It's hard to find documentation References: <9uuith$qb8$1@peabody.colorado.edu> Message-ID: <9v0et3$5n3$1@peabody.colorado.edu> Brad Bollenbach wrote: > I'm well aware of pydoc. Using your instructions on how to use it, > we /still/ aren't able to locate the top-level document Bruce was > interested in: > > mothra at mothra:~$ python2.1 > Python 2.1.1 (#1, Nov 11 2001, 18:19:24) > [GCC 2.95.4 20011006 (Debian prerelease)] on linux2 > Type "copyright", "credits" or "license" for more information. >>>> from pydoc import help >>>> help("Extending and Embedding the Python Interpreter") > no Python documentation found for 'Extending and Embedding the > Python Interpreter' > You are right. pydoc isn't perfect yet, I think its indexing algorithm still has room for a lot of improvement. But there's a solid base to start from. >>> If I wanted it badly enough, I would have done so already. :) >> >> Ka-Ping Yee already did. > > Kudos to Ka-Ping Yee. He obviously wanted it more than I did, but it > still doesn't provide the extreme ease of use (particularly for > accessing top-level documents with minimal effort) that, for > example, perldoc does. (That isn't a Perl plug, but the name "pydoc" > implies that it wanted to be Python's equivalent of perldoc.) Agreed. I love the html form of pydoc for module browsing, but I do miss the ease of finding general info with perldoc. Another minor gripe is that when running pydoc -g, the search box almost never finds what I want (plus it's dog slow). I never use it, I just fire it up so the server runs and then click my way through the top-level module list. So to summarize this whole discussion (maybe in the future someone from the doc team can use this): 1) The 'search' at www.python.org is a perfectly useless piece of junk. It would be better to remove the search option altogether and just tell people to use google. Maybe in the future the 'ultraseek' joke can be replaced with a site-local google. 2) Pydoc is great, but could stand improvement in its indexing/search capabilities. Ideally, after a search it would return hierarchically organized results (top-level docs, pages, modules, function docstrings, etc). Returning this as a webpage (it already has a server) would be great. 3) The written html docs are top-quality, but they lack a bit in cross-referencing (though the general indices at the end of each are *extremely* good). Fixing this is slow and time-consuming, and can really only be done by someone who knows both python and the documentation very well. I think (1) should be very easy to fix (and should be a priority of the site maintainers IMHO), (2) requires coding work but sounds like a fairly interesting project. Moderately difficult, but not impossible by any means. (3) I suspect will be the slowest to improve. Just my thoughts, f. From GabeN at captura.com Mon Dec 3 19:48:23 2001 From: GabeN at captura.com (Gabe Newcomb) Date: Mon, 3 Dec 2001 16:48:23 -0800 Subject: the purpose of this list??? Message-ID: <168B2A5F6A99D4119E200008C7C9CA8001CCA5E7@gibraltar.captura.com> Hee hee. Of course the response I get IS snooty, although I get the point about gathering statistics. I won't get into a whole thing on that (since that would be hypocritical, per my original mail), other than to say I wasn't intending anything statistically significant. Heuristics, baby! I was simply saying it's a waste of our time to send flames (the joke is I got my own little one in response, I guess). Thanks Fernando :) -----Original Message----- From: Fernando P?rez [mailto:fperez528 at yahoo.com] Sent: Sunday, December 02, 2001 9:18 AM To: python-list at python.org Subject: Re: the purpose of this list??? Gabe Newcomb wrote: > So I just joined the list an hour ago. I've read 4 of the messages > and half of them involve some form of flaming. If we're going to > argue about how to do something, that's one thing, but please, > people, if you're trying to make points just to preserve your image, > give it a rest. It's a waste of all our time. Well, not trying to sound snotty or anything, but: you've read 4 messages in a list that generates around 400 per day, 'half' (that is, a wholesome *2*) are flames and you conclude this is a flamer's list? One simple suggestion: spend a few days on it, see if you get useful information concerning Python questions, and *then* decide. It's called 'collecting statistics': from a sample of 4 messages you can not say *absolutely anything statistically meaningful* concerning the traffic on a list of this volume. In the long term, chances are you'll find (as most of us seem to) that this list provides *a lot* of very informative, intelligent discussion, useful python tricks and debate on the language at large. But you'll have to read more than 4 messages to notice that. Cheers, f. -- http://mail.python.org/mailman/listinfo/python-list From loewis at informatik.hu-berlin.de Wed Dec 19 06:14:03 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 19 Dec 2001 12:14:03 +0100 Subject: SOAP.py References: <9vnpn1$t45$1@pea.uk.research.att.com> Message-ID: Duncan Grisby writes: > Am I barking up the wrong tree? I think so. I just downloaded SOAP.py 0.9.7 from SF, and tried your example literally, with Python 2.1 on Solaris, and got a reply of Hello Duncan In turn, .echo in the client would return with a string of just "Hello Duncan". Could it be that you have made further changes to your local installation, or that you've been picking up a wrong copy of SOAP.py? Regards, Martin From phd at phd.pp.ru Sat Dec 15 12:55:19 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Sat, 15 Dec 2001 20:55:19 +0300 Subject: default webbrowser In-Reply-To: ; from robin@jessikat.fsnet.co.uk on Sat, Dec 15, 2001 at 04:47:41PM +0000 References: Message-ID: <20011215205519.B6871@phd.pp.ru> On Sat, Dec 15, 2001 at 04:47:41PM +0000, Robin Becker wrote: > I'm trying to use the webbrowser module, but don't seem to have a > 'default' webbrowser set up somehow. Any win32 experts know what I have > to do to get win2k to use netscape as a default browser? webbrowser.py was written by ESR and honors BROWSER env var. Details are on ESR home page: http://www.tuxedo.org/~esr/BROWSER/index.html Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From syver-en+usenet at online.no Mon Dec 24 01:32:56 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 24 Dec 2001 07:32:56 +0100 Subject: Leading distributed object packages for python? References: Message-ID: grahamd at dscpl.com.au (Graham Dumpleton) writes: > Somewhat related is OSE. Check out: > > http://ose.sourceforge.net Hmm, looks cool. Especially that they seem to have focus on logging and other debugging facilities sounds interesting. But I get this knee jerk reaction when I see that it contains another container library for C++. Why the hell can't people just use the standard library, oh, well. -- Vennlig hilsen Syver Enstad From cb921 at voice.co.za Sat Dec 1 16:47:21 2001 From: cb921 at voice.co.za (Campbell) Date: Sat, 1 Dec 2001 23:47:21 +0200 Subject: raise third argument question Message-ID: Hi, I have confusion perhaps someone has sorted out for themselves already...? >From the raise documentation: """ If a third object is present, and it is not None, it should be a traceback object (see section 3.2), and it is substituted instead of the current location as the place where the exception occurred. This is useful to re-raise an exception transparently in an except clause. """ I don't suppose it would be possible to stick a pin in another running thread with the raise statement and a suitable third parameter? My threads are all execfile()'ing bits of code written by people other than myself, and sometimes they are not too bright about using tight while 1: loops, and other nasties, which do not include any of the functions which I have peppered with _hangup_check()'s (currently a hangup check will raise it's own exception if the object's .'alive' member is set down to 0). Rather than have to come to the office and bounce my server once a couple of these have collected up, I would like to raise an error in the thread when the caller hangs up - and have that exception arise within that thread. *prays* Please let this be possible - i have a long-running headache :) Thanks for any help.. campbell -- Let us not forget.. There is hope. Keep hope alive. From wex at flarg.com Wed Dec 26 11:08:41 2001 From: wex at flarg.com (Daniel Wexler) Date: Wed, 26 Dec 2001 16:08:41 GMT Subject: Offer to purchase Wexler.com References: Message-ID: Whoops, that was not meant to be sent to this newsgroup. Gosh, I'm sorry about that -- Outlook Express got me again. Dan From rnd at onego.ru Sun Dec 23 05:01:22 2001 From: rnd at onego.ru (Roman Suzi) Date: Sun, 23 Dec 2001 13:01:22 +0300 (MSK) Subject: MySQLdb "Illegal instruction" error. In-Reply-To: <97ae44ee.0112230102.791201d2@posting.google.com> Message-ID: On 23 Dec 2001, Stephen wrote: >> >>> import MySQLdb >> >>> d = MySQLdb.connect("", "test", "", "") >> Illegal instruction >> >> I can confirm that the MySQL database 'test' can be accessed >> by anybody on localhost (as well as any other host) using the >> mysql client. So, I think it must be MySQLdb on my system. > >Sorry, the above snippet was wrong - should've been > >>>> d = MySQLdb.connect("", "", "", "test") > >but the problem still persists (ie. "Illegal Instruction" error and >Python exits). > >I've tried using MySQLdb for Python1.5.2 and the same problem exists. >So, that pretty much rules out Python1 vs Python2 problems - now to >work out if it's a MySQLdb or MySQL problem. Maybe you've used wrong version of Python to compile extension module? I remember having problems with threads when compiling MySQLdb. Getting latest source solved the problem. OT: Why mysql and mysqladmin when used with -p gives core dumps on (slightly upgraded) RH 6.2 systems? >I can connect to the linux server from a Windows PC running Python2 >and using MySQLdb. So, the problem really lies with either MySQL or >MySQLdb on my linux box. Am starting to think it's more MySQL but it >hasn't shown any other anomalies (in fact, I was quite astounded at >how easy MySQLdb installed without complaining about not being able >to find libraries etc). I also remember MySQLdb has it's own maillist. Probably, you can ask MySQLdb author there. Sincerely yours, Roman Suzi -- _/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/ _/ Sunday, December 23, 2001 _/ Powered by Linux RedHat 6.2 _/ _/ "When a New Yorker looks as if he's suntanned, it's probably rust." _/ From eric at enthought.com Fri Dec 7 23:25:15 2001 From: eric at enthought.com (eric jones) Date: Sat, 08 Dec 2001 04:25:15 GMT Subject: numerical packages for 1.5.2? References: Message-ID: Hey Mark, You might be able to get SciPy working for 1.52, but I haven't tried. I expect it would require some effort and multiple changes. It should be possible though. The array comparison stuff like a < b, etc. was added to Numeric when Python got rich comparisons (either 2.0 or 2.1...), so they will give exceptions in 1.52. I don't think there is an easy solution here. All the SciPy development is going on with versions 2.1 and on. Are there a ton of people needing 1.52 support? If it's extremely popular, we could accept patches to the current version of SciPy that fix the incapatibilities. I think it might be easier to just upgrade the 10 machines though... :) eric "Mark Fardal" wrote in message news:yj1vgfi3hwd.fsf at coral.phys.uvic.ca... > > Hi, > > I'd like to do some scientific/numerical work with Python. On the > computers accessible to me, Python 1.5.2 is quite common but Python > 2.x is not to be found anywhere. I don't have root password to most > of these computers. I'd also like to share my code with > collaborators, and don't want to make them upgrade Python itself > (which is significantly harder than upgrading Python packages). So, > it looks like Python 1.5.2 is it for now. These are mostly Linux/x86 > systems with a few SGIs. > > Given that restriction, what version of Numeric should I be using? Is > there a version of SciPy that will work on 1.5.2? Are there known bugs > in any of these versions I should watch out for? > > thanks > Mark Fardal > University of Victoria > > From nospam at bigfoot.com Mon Dec 10 11:28:59 2001 From: nospam at bigfoot.com (Gillou) Date: Mon, 10 Dec 2001 17:28:59 +0100 Subject: Tkinter vs wxPython? Opinions/Experiences References: Message-ID: <9v2nfj$cq7$1@norfair.nerim.net> wxWindows offers a great collection of high level widgets and will be available for Mac OSX in few. But people from wxWindows sometimes change some API (I can't play Boa constructor with the latest wxWindows and I needed to change some stuffs in one of my apps). On the other hand, Tkinter is "poor" (but there are additional widgets available, browse in sourceforge.net), but its API is easier for newcomers. HTH --Gillou "Dan Howard" a ?crit dans le message news: MoKQ7.22480$2Fd.849 at news1.bloor.is... > I'm a newbie at Python and about to create my first set of GUI applications. > I would like to run them on Windows and Linux ( and possibly MAC). > I'm trying now to decide whether to use Tkinter or wxPthyon. > Would appleciate views, opinions and experiences... > Thanks - Dan > > From db3l at fitlinxx.com Fri Dec 28 22:17:47 2001 From: db3l at fitlinxx.com (David Bolen) Date: 28 Dec 2001 22:17:47 -0500 Subject: REPOST: Re: ETA for Win32all under Python 2.2? References: Message-ID: <3$--$$_-----$%_%_$@news.noc.cabal.int> David Brady writes: > Did you see the part where I said "anything you could > fix yourself"? You have apparently overlooked my vast > capacity for ignorance. It's vast. It's vaster > than... well, it's really vast, okay? Vast. Perhaps I was misreading it, but that earlier comment of yours seemed to say that the "longstanding rule in [your] family" should have precluded asking about something you could do yourself, so the response here seemed reasonable, since it said you could do it yourself :-) > Where do I get the package to build? The top level ActiveState pages for the win32all package (http://aspn.activestate.com/ASPN/Downloads/ActivePython/Extensions/Win32all) contain a reference to accessing with CVS, which points you to Mark's original win32all pages at http://starship.python.net/crew/mhammond/cvs.html. > How do I build the package? For the most part, you just pick the top level workspace/project file (it's already set up for VC 6) and build as any other VC 6 project. You do have to set up the directories where you have your Python installation first. It should be covered in the win32all web pages, which have a pointer to the specific build instructions at http://starship.python.net/crew/mhammond/win32/BuildingExtensions.html. > If your reply has anything to do with CVS, how the > heck do I get at it from Win32? (Lots of people have > told me they've heard of other people doing this, but > I'm starting to think it's an urban legend.) Just use a Win32 binary of CVS. If you've got a Cygwin environment, you should have one already, or there's a native NT binary available at http://www.cvsnt.com. I personally prefer the command line, but you can also use WinCVS as covered on Mark's win32all pages as noted above, including a reference on where to get it (http://www.wincvs.org). > > (if it doesn't, please submit a bug report). > > *sigh* Vast, man, vast. How do I submit a bug > report? Not that vast - although slightly grey at the moment now that Mark is no longer with ActiveState, but the ActiveState pages (above) have a Bug Reports option along the right edge, where you can submit bug reports. Or, given the current state of affairs, probably just an e-mail to Mark. > -dB > P.S. Please note, I may be ignorant, but I'm not > stupid. If there is a good place that explains how to > get and build Python and its packages, I'll happily > wade through the documentation. It's *finding* the > documentation that's killing me. I think most of this is pretty clear but perhaps it's finding that first page that is tricky. For win32all start with the ActiveState pages for the package, or via Mark's original win32all page http://starship.python.net/crew/mhammond/win32. As for Python itself, it's not that different - you can either download the specific version source from the main download location (http://www.python.org/download - get the .tgz file since that has source since Unix systems typically build from source), or access it via CVS from the SourceForge project (http://python.sourceforge.net) and check out the FAQ for accessing the tree via CVS. Then just check out the tag you want for the release you want. Once you have the source, build instructions are included in various readme's in it, and there are again VC project files that you can select to make the build. It's pretty painless, particularly if you're used to VC. -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l at fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: David Bolen Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:27:27 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774895 27193 211.57.49.2 (31 Dec 2001 05:01:35 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:01:35 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From nika at kassube.de Tue Dec 25 08:26:35 2001 From: nika at kassube.de (Nils Kassube) Date: 25 Dec 2001 14:26:35 +0100 Subject: O'Reilly's Python and XML References: <87itawalol.fsf@kursk.kassube.de> Message-ID: <87wuzbqvlg.fsf@kursk.kassube.de> Markus Jais writes: > I ordered it at the german store www.computerbooks.de where > it is cheaper than amazon.de I canceled my order at Amazon Germany (DEM 95) and ordered via Lehmanns www.lob.de (DEM 76.50). Thanks for reminding me to always compare prices :-) From ssthapa at classes.cs.uchicago.edu Wed Dec 19 11:50:49 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Wed, 19 Dec 2001 16:50:49 GMT Subject: ANN: ciphon 0.3.4 References: <20011219092711.31a8282a.gry@ll.mit.edu> Message-ID: george young wrote: >Umm, just a suggestion that when posting an announcement of a "new >version of XXX", one should mention briefly what XXX *is* -- I have no >idea what ciphon is.... Sorry, given the recent discussions, I thought people following the list would have already known. Ciphon is a utility that offers similar functionality to perl's CPAN shell. It'll let you download and install python modules automatically. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From edcjones at erols.com Sun Dec 23 23:49:30 2001 From: edcjones at erols.com (Edward C. Jones) Date: Sun, 23 Dec 2001 23:49:30 -0500 Subject: f(n=4) works; bug or feature? Message-ID: <3C26B3DA.4000102@erols.com> In Python 2.2, the following code prints a "4". def fun(n): print n fun(n=4) Bug or feature? Thanks, Ed Jones From hgg9140 at seanet.com Fri Dec 28 16:05:47 2001 From: hgg9140 at seanet.com (Harry George) Date: 28 Dec 2001 13:05:47 -0800 Subject: REPOST: ANN: pyperlish 1.4 Message-ID: <5$--$$_----__-$%_$@news.noc.cabal.int> pyperlish is a python emulation of essential perl mechnaisms, allowing use of perl-based idioms. particularly useful for perl-ists considering using python (or attempting to port code to python). Originally named "pyperl", but that name was usurped by Zope, so we gone to pyperlish. See: http://www.seanet.com/~hgg9140/comp/pyperlish-1.2/doc/index.html Download at: http://www.seanet.com/~hgg9140/comp Recent changes: 2001-12-28: 1.2 Converted tests to uniuttest style. Converted docstring to pydoc style. Fixed "split" to properly detect no maxcnt. 2001-09-29: 1.1 Renamed from pyperl to pyperlish, to avoid conflict with Zope's new pyperl. -- Harry George hgg9140 at seanet.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Harry George Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:34:42 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774275 27193 211.57.49.2 (31 Dec 2001 04:51:15 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:51:15 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From lucio at movilogic.com Fri Dec 28 18:09:59 2001 From: lucio at movilogic.com (Lucio Torre) Date: Fri, 28 Dec 2001 20:09:59 -0300 Subject: Python Popularity: Questions and Comments References: Message-ID: <3C2CFBC7.5060408@movilogic.com> > > > > >The only reason that I bring this up is to point out that Python is >already in use in very serious comercially-funded development. You >might not hear as many advertisements about it, but it is there. > >-Justin > > > > I think companies dont write "Done with Python" on the boxes of their products because they gain nothing from it. The gain is in using it, not naming it. Lucio. From roy at panix.com Fri Dec 28 09:40:21 2001 From: roy at panix.com (Roy Smith) Date: Fri, 28 Dec 2001 09:40:21 -0500 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: tatebll at aol.com (Bill Tate) wrote: > This past spring, I spent a full month pouring over Zope in detail. I > pulled every example product I could find that I thought would be > relative to the purpose of setting up a commercial-based application. > I downloaded the tutorial and the draft zope book. I pulled down > every bit of documentation I could find for developers. In so many > cases, I found whatever documentation was available that key aspects > of the implementation took the "assumed facts-already-in-evidence" > approach; omitting key details that would were critical to improving > my understanding of using Zope. Unfortunately, I have to agree. I've looked at Zope a few times, because the hype sounded really cool (as all good hype should). But, every time I ever tried to understand it to the level of, "OK, so how do I actually write an application using this", I was stumped. From sholden at holdenweb.com Sun Dec 2 18:19:28 2001 From: sholden at holdenweb.com (Steve Holden) Date: Sun, 2 Dec 2001 18:19:28 -0500 Subject: number of values in a list References: <9uebug$81d1i$1@ID-69142.news.dfncis.de> Message-ID: "Andreas Penzel" wrote ... > Hello NG! > > I have a list and want to know the number of values. > Example: abc = [5,10,15,20,25,30] > result should be: 6 > You're looking for the len() function. len([5,10,15,20,20,30]) == 6 regards Steve -- http://www.holdenweb.com/ From ralf at trance-formation.com Tue Dec 25 00:11:28 2001 From: ralf at trance-formation.com (ralf at trance-formation.com) Date: Tue, 25 Dec 2001 05:11:28 GMT Subject: Trance-Formation of America: Trance-Formation of America: The Most Dangerous Game (excerpt #3) Message-ID: During Christmas vacation of 1974, my father flew us all to Disney World by route of Tampa, Florida. Ignorant of geography, it did not occur to me that Tampa was out of the way to Disney World until my father drove the rented van to the gates of MacDill Air Force Base. Military personnel met me there and escorted me into the base TOP SECRET high tech mind control conditioning facility for "behavioral modification" programming. This was the first in what became a routine series of mind control testing and/or programming sessions on government installations that I would endure throughout my Project Monarch victimization. Whether I was in a military, NASA, or government building, the procedure for maintaining me under total mind control remained consistent with Project Monarch requirements. This included prior physical and/or psychological trauma; sleep, food, and water deprivation; high voltage electric shock; and hypnotic and/or harmonic programming of specific memory compartments/ personalities. The high tech equipment and methodisms I endured from that time on gave the U.S. government absolute control of my mind and life. I had been literally driven out of my conscious mind and existed only through my programmed subconscious. I lost my free will, ability to reason, and could not think to question anything that was happening to me. I could only do as I was told. In the summer of 1975, my family drove all the way from Michigan to the Teton Mountains of Wyoming. I was ordered to ride in the back storage area of the family Chevy Suburban since I was forbidden to associate or communicate with my brothers and sister. So I dissociated into books, or into the metaphorical, hypnotic suggestions from my father and tranced deeper as I watched the prairie's seemingly endless sea of "amber waves of grain" streak past my window. Once when we stopped at a gas station, my father took me inside to show me a stuffed "jackalope" mounted on the wall. Due to my tranced, dissociative state and high suggestibility level, I believed it was indeed a cross between a jack rabbit and antelope. It was 100+ degrees in the Badlands when it cooled down at night. The intense heat of the day accentuated my ever increasing thirst. My father was physically preparing me though water deprivation for the intense tortures and programming I would endure in Wyoming. Dick Cheney, then White House Chief of Staff to President Ford, later Secretary of Defense to President George Bush, documented member of the Council on Foreign relations (CFR), and Presidential hopeful for 1996, was originally Wyoming's only Congressman. Dick Cheney was the reason my family had traveled to Wyoming where I endured yet another form of brutality -- his version of "A Most Dangerous Game," or human hunting. It is my understanding now that A Most Dangerous Game was devised to condition military personnel in survival and combat maneuvers. Yet it was used on me and other slaves known to me as a means of further conditioning the mind to the realization there was "no place to hide," as well as traumatize the victim for ensuing programming. It was my experience over the years that A Most Dangerous Game had numerous variations on the primary theme of being stripped naked and turned loose in the wilderness while being hunted by men and dogs. In reality, all "wilderness" areas were enclosed in secure military fencing whereby it was only a matter of time until I was caught, repeatedly raped, and tortured. Dick Cheney had an apparent addiction to the "thrill of the sport." He appeared obsessed with playing A Most Dangerous Game as a means of traumatizing mind control victims, as well as to satisfy his own perverse sexual kinks. My introduction to the game occurred upon arrival at the hunting lodge near Greybull, Wyoming, and it physically and psychologically devastated me. I was sufficiently traumatized for Cheney's programming, as I stood naked in his hunting lodge office after being hunted down and caught. Cheney was talking as he paced around me, "I could stuff you and mount you like a jackalope and call you a two legged dear. Or I could stuff you with this (he unzipped his pants to reveal his oversized penis) right down your throat, and then mount you. Which do you prefer?" Blood and sweat became mixed with the dirt on my body and slid like mud down my legs and shoulder. I throbbed with exhaustion and pain as I stood unable to think to answer such a question. "Make up your mind," Cheney coaxed. Unable to speak, I remained silent. "You don't get a choice, anyway. I make up your mind for you. That's why you're here. For me to make you a mind, and make you mine/mind. You lost your mind a long time ago. Now I'm going to give you one. Just like the Wizard (of Oz) gave Scarecrow a brain, the Yellow Brick Road led you here to me. You've 'come such a long, long way' for your brain, and I will give you one." The blood reached my shoes and caught my attention. Had I been further along in my programming, I perhaps would never have noticed such a thing or had the capability to think to wipe it away. But so far, I had only been to MacDill and Disney World for government/military programming. At last, when I could speak, I begged, "If you don't mind, can I please use your bathroom?" Cheney's face turned red with rage. He was on me in an instant, slamming my back into the wall with one arm across my chest and his hand on my throat, choking me while applying pressure to the cartorid artery in my neck with his thumb. His eyes bulged and he spit as he growled, "If you don't mind me, I will kill you. I could kill you -- Kill you -- with my bare hands. You're not the first and you won't be the last. I'll kill you any time I goddamn well please." He flung me on the cot-type bed that as behind me. There he finished taking his rage out on me sexually. On the long trip back to Michigan, I lay in a heap behind the seats of the Suburban, nauseated and hurting from Cheney's brutality and high voltage tortures, plus the whole Wyoming experience. My father stopped by the waterfalls flowing through the Tetons to "wash my brain" of the memory of Cheney. I could barely walk through the woods to the falls for the process as instructed, despite having learned my lessons well from Cheney on following orders. The next year when our "annual" trip to Disney World rolled around, my father drove, pulling his new Holiday Rambler Royale International trailer. My father dropped me off en route at the Kennedy Space Center in Titusville, Florida where I was subjected to my first NASA programming. From then on, I was "obsessed" with following the "Yellow Brick Road" to Nashville, Tennessee. Moving to Nashville was all I could talk about. If anyone asked me the question I could not think to ask myself "Why?", I would respond by reiterating it was something "I had to do." TO BE CONTINUED... -- http://www.trance-formation.org/ http://www.trance-formation.com/ Trance-Formation of America: Project Monarch (excerpt #1) http://www.trance-formation.com/book_excerpts/monarch.htm http://howardk.moonfall.com/msgid.cgi?ID=100925768100 http://groups.google.com/groups?selm=EC8F5BAE.8523C14B%40trance-formation.com&output=gplain http://howardk.moonfall.com/msgid.cgi?STYPE=msgid&MSGI=%3CEC8F5BAE.8523C14B at trance-formation.com%3E Trance-Formation of America: Trance-Formation of America: From Dorothy to Tinker-Belle (excerpt #2) http://www.trance-formation.com/book_excerpts/dorothy.htm http://howardk.moonfall.com/msgid.cgi?ID=100925953900 http://howardk.moonfall.com/msgid.cgi?STYPE=msgid&MSGI=%3C62371BB7.8BC522F0 at news.clara.net%3E http://groups.google.com/groups?as_q=&num=10&as_scoring=r&btnG=Google+Search&as_epq=&as_oq=&as_eq=&as_ugroup=&as_usubject=&as_uauthors=&as_umsgid=%3C62371BB7.8BC522F0 at news.clara.net%3E&lr=&as_drrb=q&as_qdr=&as_mind=12&as_minm=5&as_miny=1981&as_maxd=24&as_maxm=12&as_maxy=2001 -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From aroach at electriceyeball.com Tue Dec 4 21:00:35 2001 From: aroach at electriceyeball.com (Anthony Roach) Date: Tue, 4 Dec 2001 21:00:35 -0500 Subject: os.spawnve and threads References: Message-ID: Anthony Roach wrote: [snip] > The problem with > os.spawnve() is that it seems to block the interpreter so no other threads > can run, thus destroying our parallelism. I took a look at posixmodule.c > (where spawnve is implemented for Windows) and the problem appears to be > that Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS is not being used around > the call to _spawnve(). > > Is this a known bug? Any chance of getting it fixed for Python 2.2? Should I > submit a patch? This bug IS present in the current CVS version of Python, and doesn't appear to be a known bug (well, you and I know about it, but no one else seems to). I went ahead and submitted a patch that fixes it like you suggested. I even fixed the the doc strings! To top it all off I ran the scons option-j.py test, and it now passes. I'm not a registered Python developer, so it's anyone's guess whether or not this fix will make it into Python 2.2. Cross your fingers... -Anthony From peter.milliken at gtech.com Thu Dec 6 15:11:36 2001 From: peter.milliken at gtech.com (Peter Milliken) Date: Fri, 7 Dec 2001 07:11:36 +1100 Subject: Python evangelists unite! References: Message-ID: <9uojfl$jum1@news1.gtech.com> Thanks Jim, appreciate the replies - I have learnt a lot. I have a completely different background where the requirements were/are very much different - what suits your environment wouldn't have suited mine :-), but now I have a better appreciation of what else exists in the world :-). Your experience with C++ confirms something that I have believed (and been opinionated about! :-)) for some time now. I will save this email off in my "ammunition" folder :-). Me personally, I take the "unworldy" view of "what is best for the customer and company" rather than "what is best for my resume" - perhaps not the smartest of viewpoints but then I never expected that the field of software engineering wouldn't have some kind of place for me. I have some quite "strong" discussions with some of the younger members of our staff advocating this viewpoint - they think I am wrong :-). It's a shame, because all of those C++ projects were driven by (at least in part) this attitude and yet it has ended up costing everyone involved (except the developers - their resume looks better! :-)). Ah well..... Thanks Peter wrote in message news:mailman.1007592436.8944.python-list at python.org... > > Peter Milliken wrote: > >Just like you can produce large programs in C++ (but I wouldn't personally > >:-)) - just out of curiousity, why was the C++ version of the product > >replaced by a Jython version? Too difficult/expensive to update to the new > >requirements? > > Yes, those were factors. But actually, the market (for large, > sophisticated ERP/Exchange systems) has changed pretty dramatically the > past couple of years. In the early-to-mid nineties customers in this > market wanted/expected C++ servers talking to Windows/MFC/C++ clients. In > the late nineties the market shifted dramatically to where customers > demanded Java-based servers interacting with HTML in web browsers (or Java > desktop applications in some cases). Java was seen by many in this market > as providing > - better portability across different kinds of servers, > - increased interoperability between services from multiple vendors, > - better leverage of "plumbing" and advanced transaction services (using > J2EE containers), > - better productivity, reliability, and subsequent lower cost of ownership, > among other things. This market today is nearly 100% Java. C++ based > products don't sell anymore (again in this specific market). > > >Any ideas of what the maintenance costs of the C++ version were in > >comparison to any other language? Was the Jython version cheaper, more > >expensive or the same in terms of productions costs as the C++ version? > > I don't have accurate measures but most of the developers here believe that > our new Java/Jython-based system yielded 5X to 10X productivity increases > in development over the equivalent/previous C++ system and that the > maintenance ratio is at least as good. > > >What were the problems encountered by the various teams using Jython? It > has > >always interested me what the selection process is in choosing a language > >for a project - do you know how and why Jython was chosen? Was it because > of > >popular aclaim or was some formal comparision of various languages > >performed? If there was some formal selection process, what languages were > >considered? What features of Jython caused it to be selected? i.e. what > >features where missing in the other languages under consideration. > > The biggest problem with using Jython was convincing the team to use it. > My experience is that developers are very interested (with good cause ;-) > in populating their resumes with experience that is directed at the center > of the market. At the time we started this new technology our C++ > developers were far more interested in putting Java on their resumes than > Python. Since I was the CTO and Senior VP of development, though, I > basically dictated the choice of Jython. Of course, to be fair, I sold the > concept by first developing (with my own rusty hand) a prototype system in > a month that amazed and dazzled all the C++ developers. They were > astonished to see that such a system could be created by one (old and > cranky ;-) person in such a short amount of time. The other factor that > helped in our case was the fact that the technology -- by market demand -- > had to be Java *and* we were convinced that we needed a scripting language > as part of our technology. I sold Jython as being the best possible > scripting language for Java. The reason *I* was sold on Jython was because > of its being a complete, dynamic (not statically type-checked), OO language > that interfaced seamlessly with Java. I like to view Jython/Python as a > "high-level, application language" and Java as a "low-level, systems > language". :-) > > Jim > > > From Dave at PragmaticProgrammer.com Thu Dec 27 18:28:12 2001 From: Dave at PragmaticProgrammer.com (Dave Thomas) Date: Thu, 27 Dec 2001 23:28:12 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA4D3.5F0BC994@earthlink.net> Message-ID: Ron Stephens writes: > Thus, while I admire Ruby, I suspect that it divides the pool of > developers who might otherwise be all in the Python *camp*. >From personal experience, I have to disagree. I tried many times to like Python. I used it on projects and for personal work, but it never clicked. I couldn't tell you why, and I know it isn't a failing of the language. It's just that Python and my brain have some kind of impedance mismatch. When I tried Ruby, I fell in love within an hour, so much so that I was driven to write a book about it. This isn't a "Ruby is better than Python" response. It's just an observation. Ruby and Python are different, and I suspect there is a substantial body of developers out there who, like me, have a preference for one over the other. I don't believe that Ruby is raiding the Python camp. I believe that Ruby is attracting people to OO scripting who would not otherwise be doing it. Regards Dave From wurmy at earthlink.net Fri Dec 28 10:12:20 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Fri, 28 Dec 2001 15:12:20 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <3C2C8A86.50C74E60@earthlink.net> Alex Martelli wrote: > > "Steve Lamb" wrote in message > news:slrna2nhfo.nme.grey at teleute.dmiyu.org... > > On Thu, 27 Dec 2001 17:48:13 +0000, phil hunt > > > wrote: > > > Python runs quickly on my 300 MHz box, which is 3 times slower > > > than the slowest PC you can buy today. It can only get more popular. > > > > Well, if you take the measure of just pure Mhz.... 4 times slower. ;) > > FIVE or more. 1.5 GHz desktop machines are hardly news these days. Hey, you guys, stop dissing my box like that! >=) (900 MHz, bought last month...) --Hans From h.jehadalwan at student.kun.nl Sun Dec 23 16:04:59 2001 From: h.jehadalwan at student.kun.nl (husam) Date: Sun, 23 Dec 2001 22:04:59 +0100 Subject: Search the difference: Why this function defenition does'nt work? References: <3C260A92.5030907@student.kun.nl> <3C261778.60108@student.kun.nl> Message-ID: <3C2646FB.7000000@student.kun.nl> Aahz Maruch wrote: > In article <3C261778.60108 at student.kun.nl>, > husam wrote: > >>Aahz Maruch wrote: >> >>>In article <3C260A92.5030907 at student.kun.nl>, >>>husam wrote: >>> >>>>I'm not trying to add string to a list of integeres. What I wanted to do >>>>is to add each argument of func2('a','b','c') to sum=['e']. Since sum is >>>>a list of chars, and the arguments are accessable as a sequence, one >>>>would expect that the addition operation would be correct. On the >>>>interactive shell, it is a trivial operation. But, only when i use it in >>>>the function defenition i get problems. Adding 'a' to ['b'] does not >>>>work, but adding list('a') to ['b'] it does, so, i thought that this >>>>might help my code, but converting the args to a list did not helpe >>>>either . I really didn't get yet! >>>> >>>use list.append() >>> >>I know that this works, but it does not help my understanding! >> > > What don't you understand? The '+' operation in Python applies to types > that are more-or-less equivalent. You can't do this, either: > > >>>>t='a', >>>>t >>>> > ('a',) > >>>>l=['b'] >>>>l >>>> > ['b'] > >>>>l+t >>>> > Traceback (most recent call last): > File "", line 1, in ? > TypeError: can only concatenate list (not "tuple") to list > > The '+' operation for lists is equivalent to list.extend(). > yes, but the arguments are passed as a tuple and the addition still not working even after converting it to a list with: list(x) your example shows an illegal addition operation, i agree with you, but what i'm doing is adding items of a list of chars to sum=['a'], which doesn't work only when i do sum=args[0]. I see no difference between sum=['a'] and sum=args[0], simply because args[0] is the first index of the arguments list passed to the function. args[0] is nothing but one char 'b' or whatever char. From hrvoje.tercek at caatoosee.hr Tue Dec 18 04:58:02 2001 From: hrvoje.tercek at caatoosee.hr (=?iso-8859-2?Q?Hrvoje_Ter=E8ek?=) Date: Tue, 18 Dec 2001 10:58:02 +0100 Subject: How to print e.g. 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE regardless locale settings ??? Message-ID: <002801c187aa$7b59fe50$6f00000a@activmedia.hr> There is the problem: You have two attachments. Box.gif, box.txt. As you suppose the image is capture screen how file should appear and how it should look like on my dot-matrix printer, send from python !!! Box.txt is written in Notepad because there is only editor which accept my ALT+ commands exactly as I need. So task would be: If box.txt appeared exactly as box.gif look like, try load box.txt and push to printer all from python. Doesn't work at my place :((( Rephrase the problem ... in Python21\lib\encode there is the file cp437.py. Obviously used at installation and locale settings. Q: How to print (standard output or dot matrix printer) e.g. 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE regardless locale settings??? I have Win2000, Python 2.1 and locale setting set to cp1250... Thanks at front Hrvoje Tercek -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at stroeder.com Sat Dec 29 09:08:19 2001 From: michael at stroeder.com (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Sat, 29 Dec 2001 15:08:19 +0100 Subject: REPOST: Re: CGI form repost from browser--how to prevent? References: Message-ID: <7$--$$_----_-%$_$$@news.noc.cabal.int> Andreas Kostyrka wrote: > > On Tue, Dec 11, 2001 at 10:51:53AM -0800, Chris wrote: > > I'm writing a Python cgi script that does some inserts into a mysql > > database based on data in an html form submitted by a user. Is there > > any way to prevent the browser from reposting the data from the form > > when the user hits refresh in the browser after they have submitted > > the form? When this happens, the script receives the same cgi form > > data and performs the same inserts on the database. I think maybe > > this can be prevented by storing some state info with cookies?? Not > > sure (have never used cookies). Any ideas on an easy way to prevent > > this? > Make it a POST Method. This way a standard conforming browser has to ask > permission from the user to repost the data. Which doesn't prevent the user from hitting the button "Yes, resend form". BTW: Chris already said "to prevent the browser from reposting". If it's crucial for the data integrity the server-side CGI-BIN part has to cross-check the input against existing data. There's no general solution without knowing details about the data model. Also the [Back] button and "Open Link in New window" are things to consider. Ciao, Michael. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Michael =?iso-8859-1?Q?Str=F6der?= Newsgroups: comp.lang.python Subject: cmsg cancel <3C2DCE53.AF5477E3 at stroeder.com> Control: cancel <3C2DCE53.AF5477E3 at stroeder.com> Date: Mon, 31 Dec 2001 03:15:05 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774764 27193 211.57.49.2 (31 Dec 2001 04:59:24 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:59:24 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From aleax at aleax.it Fri Dec 28 06:26:48 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 12:26:48 +0100 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9901.998345FB@earthlink.net> Message-ID: "Steve Lamb" wrote in message news:slrna2nhl5.nme.grey at teleute.dmiyu.org... > On Thu, 27 Dec 2001 21:53:41 GMT, Ron Stephens wrote: > > Now, my perception is that most Ruby developers run under Linux or some > > other Unix. I wonder what percentage of Python developers run Windows, and > > what percentage run Linux? I have no idea, does anyone have a guess? If you > > put my back to the wall to make a prediction, I'd guess that more than half > > of us on this newsgroup use windows. Anyone? > > Well, sure, worded that way. I /use/ Windows. I need something for my > games and while Linux suits 99.5% of my productivity needs it isn't quite > there in the games market. I don't do much gaming, but I still have to use Windows (mostly in win4lin under Linux) for a few needs (e.g., SOME durned webpages that I need won't show correcty under any browser except Internet Explorer). Not to mention that think3 is a mostly-Windows shop, too. Linux is my preferred platform for most tasks, except that my firewall/etc machine runs OpenBSD (sometimes security is more important than richness of features, support for strange hardware, and so on). Python runs just great on all of these platforms, and more besides. Alex From tim at vegeta.ath.cx Fri Dec 21 18:20:57 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Fri, 21 Dec 2001 23:20:57 GMT Subject: vi or emacs for editing Python on Linux? References: Message-ID: Lucio Torre graced us by uttering: [ snip ] > ps: i still hit escape on word. Are you kidding?! Whenever I'm reduced to using Netscape for mail (remote emergencies...) all my news posts have ':x' at the end! ;) Tim Hammerquist -- /earth is 98% full ... please delete anyone you can. From careye at spamcop.net Sun Dec 30 03:46:02 2001 From: careye at spamcop.net (Carey Evans) Date: 30 Dec 2001 21:46:02 +1300 Subject: Finding out that Python is in interactive mode in sitecustomize.py References: <3C2B8F47.4CEACF6E@olen.to> <87g05wgq84.fsf@psyche.dnsalias.org> <11aed8f9.0112281443.afbc668@posting.google.com> Message-ID: <87k7v5ksdx.fsf@psyche.dnsalias.org> joonas at olen.to (Joonas Paalasmaa) writes: > For some reason it doesn't work in sitecustomize.py . > When these lines are to sitecustomize.py and Python is started in > interactive mode, Python prints "In non-interactive mode". [...] Looking closer, it looks like sys.ps1 is set up just before the interactive loop is started, but after sitecustomize.py is imported. Given this, the easiest solution looks like the PYTHONSTARTUP environment variable. The file this points to is only executed for an interactive session. You could set this for all users in a global shell startup file, or just set it from sitecustomize.py: import os os.environ['PYTHONSTARTUP'] = '/path/to/interactive_startup.py' -- Carey Evans http://home.clear.net.nz/pages/c.evans/ From daves_spam_dodging_account at yahoo.com Fri Dec 28 19:07:55 2001 From: daves_spam_dodging_account at yahoo.com (David Brady) Date: Fri, 28 Dec 2001 16:07:55 -0800 (PST) Subject: ETA for Win32all under Python 2.2? In-Reply-To: Message-ID: <20011229000755.41208.qmail@web21110.mail.yahoo.com> > -----Original Message----- > From: Martin von Loewis > > David Brady > writes: > > > P.S. There's a longstanding rule in my family: > you're > > not allowed to complain about anything you could > fix > > yourself. > Did you even try to build the package from source??? Did you see the part where I said "anything you could fix yourself"? You have apparently overlooked my vast capacity for ignorance. It's vast. It's vaster than... well, it's really vast, okay? Vast. I would *LOVE* to know how to build the package, but I haven't got a clue where to even begin. I've got a Windows box, Visual C++ 6.0 and an internet connection. Where do I go from here? Where do I get the package to build? How do I build the package? If your reply has anything to do with CVS, how the heck do I get at it from Win32? (Lots of people have told me they've heard of other people doing this, but I'm starting to think it's an urban legend.) > (if it doesn't, please submit a bug report). *sigh* Vast, man, vast. How do I submit a bug report? Thank you kindly for your patience, -dB P.S. Please note, I may be ignorant, but I'm not stupid. If there is a good place that explains how to get and build Python and its packages, I'll happily wade through the documentation. It's *finding* the documentation that's killing me. ===== David Brady daves_spam_dodging_account at yahoo.com I'm feeling very surreal today... or *AM* I? __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com From stephen at theboulets.net Wed Dec 5 09:51:08 2001 From: stephen at theboulets.net (Stephen Boulet) Date: Wed, 05 Dec 2001 08:51:08 -0600 Subject: Help setting path on windows References: <3C0D1802.6D93D957@motorola.com> Message-ID: Thank you. Stephen Boulet wrote: > Can someone help me? > > I'd like to be able to do: > > from someModule import * > > and have my someModule.py file imported. Thanks. > > -- Stephen From philh at comuno.freeserve.co.uk Mon Dec 3 21:47:34 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Tue, 4 Dec 2001 02:47:34 +0000 Subject: On string formatting and functional programming References: Message-ID: On Mon, 3 Dec 2001 05:10:14 -0500, Oren Tirosh wrote: > >According to the responses I got to my string interpolation proposal people >have missed the point. I don't really care if the interpolation is done >with dollars, percents, backticks or ampersands. I don't care either. > What I care about is that >Python should have a compact and readable syntax for representing a string >with embedded expression and that THESE EXPRESSION ARE NOT EVALUATED AT >RUNTIME. This means that it can only be a language feature, not a module. Python has enouigh language features, and doesn't need the syntax made more complex. If you must, implement this "feature" with a preprocessor. -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From gmcm at hypernet.com Sun Dec 23 09:07:28 2001 From: gmcm at hypernet.com (Gordon McMillan) Date: 23 Dec 2001 14:07:28 GMT Subject: inproc server with gordon mcmillan's installer References: <1009084826.534637@critter.monarch.net> Message-ID: Craig Morris wrote: > While it seems simple to get a local com server working with Gordon > McMillan's installer package, I am having trouble figuring out how to > make the inproc stuff (introduced in version 5) work. I can't seem to > find an example or much doc on this. If anyone could point me towards > some, I would be grateful. You shouldn't have to do anything special. If your class's _reg_clsctx_ has the CLSCTX_INPROC bit flag on, you'll get a dll and a little extra registration logic. It's the _reg_clsctx_ flag that drives this - you don't have to use any command line options or anything else. You cannot use an inproc server created this way from a process that uses Python - the dll *must* be the one to start Python (or it can't get it's import hooks in). So you can't fire up the interpreter to test it - you'll need to use WScript or Excel or ... -- Gordon http://www.mcmillan-inc.com/ From joshm at taconic.net Wed Dec 26 18:35:41 2001 From: joshm at taconic.net (Joshua Muskovitz) Date: Wed, 26 Dec 2001 18:35:41 -0500 Subject: references for shifting from Py1.5.2 to Py2.2? Message-ID: <3c2a5cd1_2@corp.newsgroups.com> Hi all, After a long hiatus, I'm returning to the Python community. I haven't touched Python since 1.5.2, and I'd like to climb the curve to 2.2 as quickly as possible. What are the definitive references for making the transition? No beginner books, please. I'm a proficient developer, and I really understood 1.5.2 pretty well. I really liked Beazley's _Python Essential Reference_, as it got me up to speed on 1.5.2 exactly as I needed. (It was essentially the equivalent of K&R's book on C in structure and brevity.) Is there a new edition, or are there other places where one can find the interim information? I know there have been a lot of enhancements to the language, and I'd like to not be stuck in the 1.x paradigms, but on the other hand, there are a lot of really terrible tech books in the universe, and I don't have the cash to buy blind. One thing I *don't* need is a porting guide -- I'm not trying to move *code* from 1.5.2 to 2.2, just my own understanding of the language for my own future projects. Help! -- josh -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- From emile at fenx.com Thu Dec 13 09:37:24 2001 From: emile at fenx.com (Emile van Sebille) Date: Thu, 13 Dec 2001 06:37:24 -0800 Subject: unintentionaly shared attributes in two different instances References: Message-ID: <9vaepn$e5ps2$1@ID-11957.news.dfncis.de> "maxm" wrote in message news:lG2S7.7217$z4.958374 at news000.worldonline.dk... > "Alexandre Fayolle" wrote in message > > > Don't use mutable primitives (lists, dictionaries or class instances) as > > default value in a method or function. See ?4.7.1 in the Python tutorial: > > > > "Important warning: The default value is evaluated only once. This makes a > > difference when the default is a mutable object such as a list or > dictionary." > > Bummer ... thanks! > > regards Max M > > The normal approach is: def __init__(self, content=None): if content == None: content = [] -- Emile van Sebille emile at fenx.com --------- From hungjunglu at yahoo.com Wed Dec 5 11:43:29 2001 From: hungjunglu at yahoo.com (Hung Jung Lu) Date: 5 Dec 2001 08:43:29 -0800 Subject: Is Python suitable for some binary file editing? References: <1FD639F0.1DA46084@cns.net.au> Message-ID: <8ef9bea6.0112050843.6b9b2c1c@posting.google.com> David Rollo wrote in message news:<1FD639F0.1DA46084 at cns.net.au>... > I am considering as a beginning Python project an iterative task > involving conversion of a set of image files to an alternative format. > The file conversion is simply making the same change to a handful of > characters at a particular offset, and saving under a new filename. It > would be repeated several thousand times, looping through a hierarchical > directory structure in Windows, editing and renaming as it went. Yeah, I did this sort of things for thousands of multimedia binary files like .bmp, .wav, etc. I can't think of any other language better than Python in this. I was doing it in Java at beginning, but found out Python was far better. Python is kind of slow, but developer's time was much more important to me than the execution time. Also, because it's simple file processing, it was easy to "parallel process": I often used several machines to do gigantic batches of files. For file/directory operations, you maybe interested in os.stat(), os.system(), etc. In fact, take a look at the os module under "Files and Directories." Look also the os.path module, it allows you to walk directories and tweak file/directory path names. Regular expressions (the re module) and string methods help, too. In multimedia processing, you often have some third-party utilities or your own C++ binary tools, in that case, the os.system() really helps. When you get a lot of fun done, start to implement some user interface by using things like wxPython. And later you can start to look at socket or xmlrpc programming to allow "parallel processing", or make things into binary executable by using things like py2exe, or set up Zope server to do the job remotely. It's a lot of fun! :) Hung Jung From mwh at python.net Sun Dec 23 16:58:42 2001 From: mwh at python.net (Michael Hudson) Date: Sun, 23 Dec 2001 21:58:42 GMT Subject: How can a module find its own module object? References: Message-ID: Oren Tirosh writes: > 'import myname' is not exactly a reliable way to get your own module > object - the file may be renamed, placed in a package, affected by > case-sensitivity problems, loaded from somewhere not in the path, etc. > > Is there any other way for a module to find itself other than searching > sys.modules for a module whose __dict__ is globals()? What's wrong with __file__? Cheers, M. From jkraska at san.rr.com Sun Dec 23 13:36:41 2001 From: jkraska at san.rr.com (Courageous) Date: Sun, 23 Dec 2001 18:36:41 GMT Subject: Why is Complex number notation the way it is? References: <23302360.0112142245.59089e4f@posting.google.com> <3C21173A.8E02D0A0@cosc.canterbury.ac.nz> Message-ID: <2q8c2uk1cljtjispghi1133ir0hpu9v29a@4ax.com> >Or maybe it's because I think of the complex plane, so I'm >already using x-hat and y-hat in my head... I know, that's >why I'm not as good at thinking about quaternions. I think maybe y'all are some of them preverts, ain't ya? C// From missive at frontiernet.net Fri Dec 21 18:52:16 2001 From: missive at frontiernet.net (Lee Harr) Date: Fri, 21 Dec 2001 23:52:16 -0000 Subject: Strip-o-Gram 1.1 Released! References: Message-ID: > Strip-o-Gram is an HTML Conversion Library that can convert HTML to Plain Text > and strip specified tags from HTML. > > See http://www.zope.org/Members/chrisw/StripOGram for more details. > Thank you Chris! I was looking for something like this just the other day when I saw they post on the Zope mailing list. Works like a charm. What I did was install this stripogram library in my site-packages directory, then created an External method to use the functions in my Zope site. Useful for any CGI or web application which needs to take input from unknown/untrusted users and put it back on a web page. From rdsteph at earthlink.net Sat Dec 29 22:24:12 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sun, 30 Dec 2001 03:24:12 GMT Subject: Video Programming Message-ID: <3C2E89DD.F3304EA9@earthlink.net> In this slow holiday week I am throwing out this "post" (I started to say "idea", but it is definitely too half-baked, moronic, and simple-minded, to be called an idea), FWIW. Please forgive my clueless presumptuousness (is that even a word ???) ... My son got a Microsoft X-box game machine for Christmas. Watching him play games, and once even participating myself (sort-of), I had these thoughts: In the future (far-future?), when computers are more "advanced", and so are programming languages, and so are software "component" models and interfaces, would it be conceivable to have a very high level video programming language? That is, a language that used a video-game like user interface. I could visualize an interface where one used a game-control like device for writing programs. These game control devices are really interesting; I am not able to use one at all well, because they are complex, with many input devices on each control device. You hold them with two hands and use several fingers and thumbs ;-))). You can move 3D objects around the screen, "shoot" guns, "fire" missiles, they have at least 10 or 12 different joystick-trigger-button-thingys for the user to play with. Even though I don't know how to use them, my son and lots of kids are experts; I think Nintendo, Sony, Sega and now X-box all have similar complex control devices, and the upcoming generation will reach adulthood with an intuitive working knowledge of how to use them well. So I visualize a "programmer" "reaching" into a 3D environment on a monitor, to manipulate 3D "components" that have "interfaces" so that they can only be plugged into certain other components in certain ways; but being 3D and visual, one could presumably build up very complex configurations of such visual components, with each component representing a software object or component, with certain well defined interfaces that are represented visually on the monitor. I speculate that this kind of model, or programming metaphor, might offer certain ease-of-use advantages for certain (unknown ;-)) types of programs. One could also use a virtual reality hand glove to manipulate the components, I suppose, or even, in a pinch, one could use a simple present day mouse to do the manipulations. Which brings me to one related thought or memory. A few years ago, when Java was sort of new, I read a couple of Java books (one was Learn in 24 hours I think ;-))) and that got me to the point where I could at least embed applets in a web page and run them, and make simple alterations in the source code to somewhat modify or customize the programs; but it did not get this particular clueless newbie to the point where I could, or where I wanted to anyway, write my own original Java applets or programs. So I found Java Studio, a $99 Sun Microsystems program that allowed one to create simple apps, and/or applets, by manipulating on-monitor 2D graphical components. It was really sort of like creating flow charts that the Java Studio program subsequently turned into Java source code; but it was better than just creating flowcharts, because the components were sort of half-way 3D and you fit them together, on screen, more like a plumber fitting pipes and widgets together, rather than a 2D flow chart. It actually worked, and I was able to create a few original applets that I liked and put on my personal web pages; I loved Java Studio. Then Sun, in their infinite wisdom, discontinued Java Studio. Unfortunately for me, I soon thereafter changed machines or had a disk crash or whatever, to make a long story short, I lost my Java Studio source code (which I had downloaded after paying for it, so I didn't have a master copy) and without the source code of the Java Studio (complier?-interpreter-whatever it was) I could not create new applets. Ah well, I learned a lesson I guess, can anyone say OPEN SOURCE ;-)))) But I always remember that Java Studio as a neat idea. In the future, if there were a much better implementation of such an idea, it could be good. (Of course, Python should be the underlying language ;-))) Now, I know code-genertors have a bad name with many smart folks, but keep in mind, video programing could be more of a reusable component interfacing, high-level architecturing kind of thing; but with perhaps a little code generation going on, around the sides, too , eh ;-))) Anyway, the video game control devices, though I personally dislike using them, do give an awful lot of sophisticated input capabilities, and the coming generations will be intuitively familiar with them, and if you with a kid play 3D first person shooter games (gasp) they do manipulate 3D objects on screen in an amazing fashion. And of course there would always be the need to code the original, sophisticated components in real Python, command line style. Please forgive me for this rambling post, but there it is, food for thought, or for speculation, or for...??? whatever, Ron Stephens P.S. being 3D, you could build really big programs, zooming into the screen's 3D environment really fast to get to different levels of a large program (it wouldn't be necessary to keep all the progam on screen at the same time, streams of components could fade into the background or leap into the foreground gradually as you travel into the "space", just like a real 3D space; and one could choose either high-level sweepingly panaromic views of whole large code sections, or conversely zoom in on narrow code segments. 3D spaces could allow one to create really convoluted patterns with great "depth". I was a Basic language spaghetti coder at heart in college (25-30 years ago!!!) and so I can just imagine the possibilities ;-))) One last aside, as a Math and Physics major in college so long ago, almost all my class mates were head over heels in love with computers, and most of them wound up in the computer science field for careers. Not me. I was sure that computer programming technology would progress so far so fast, that before long whatever I learned about programming in college would be obsolete, since computers would practically program themselves, or at least in such high level languages that most sophisticated users would interface with their computers in natural language ;-)) Boy was I wrong. So, at long last, my hobby now is bringing me back full circle; I still believe that someday, (real-soon-now? maybe not) computer programming languages will advance so far as to massively empower sophisticated users. Maybe I'm still just as wrong as I was 30 years ago, but one can dream, anyway ;-))) And now I find the ideas around building higher level languages more interesting than just about anything else. From LLoeffler at home.com Sun Dec 2 23:22:21 2001 From: LLoeffler at home.com (Luke) Date: Sun, 02 Dec 2001 22:22:21 -0600 Subject: Very new to this References: <#k0oOh4eBHA.1192@cpimsnntpa03> <#EQGkj4eBHA.1188@cpimsnntpa03> <3C0AB92D.2010407@home.com> <#3jVur4eBHA.1404@cpimsnntpa03> <3C0AEF74.3080005@home.com> <9uesrd$pm4$1@slb7.atl.mindspring.net> Message-ID: <3C0AFDFD.6060105@home.com> true. From wurmy at earthlink.net Sat Dec 15 09:06:35 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Sat, 15 Dec 2001 14:06:35 GMT Subject: perl style formating References: Message-ID: <3C1B590E.C58FFEAF@earthlink.net> Les Ander wrote: > > Hi, > i am new to python. > > say i wanted to print out 3 variable in the following format: > $name is left justified and has the width of size 10 > $comment is left justified and starts at column 11 and ends at 40 > $line starts at 41 and is of variable length) > > in perl i would write it as: > > format OUT = > @<<<<<<<<<< >@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >@* > $name, $comment, $line; Cool, ASCII art on c.l.py. Is it a centipede? As people pointed out, this can be done with string formatting: >>> name = "Fred" >>> comment = "And nice red uniforms." >>> line = "Bye!" >>> "%-10s %-30s %s" % (name, comment, line) 'Fred And nice red uniforms. Bye!' However, if the strings are longer than 10 and 30 characters, respectively, they will show up entirely, rather than being clipped: >>> name = "Dr. Fred Mbogo" >>> "%-10s %-30s %s" % (name, comment, line) 'Dr. Fred Mbogo And nice red uniforms. Bye!' You can prevent this using a . (dot): >>> "%-10.10s %-30.30s %s" % (name, comment, line) 'Dr. Fred M And nice red uniforms. Bye!' HTH, --Hans From bckfnn at worldonline.dk Mon Dec 31 09:36:54 2001 From: bckfnn at worldonline.dk (Finn Bock) Date: Mon, 31 Dec 2001 14:36:54 GMT Subject: ANN: Jython-2.1 released. Message-ID: <3c307045.17602761@mail.wanadoo.dk> I am happy to announce the release of Jython 2.1. Jython is a Java implementation of the Python programming language. It allows users to compile Python source code to Java byte codes, and run the resulting bytecodes on any Java Virtual Machine. It is a very seamless and smooth integration with Java: from Python you have complete access to all Java libraries, can build applets, can integrate with Java beans, and can subclass Java classes in Python and vice versa. Like Python, and unlike Java, Jython can also be used interactively: just type some Jython code at the prompt and see the results immediately. A java installer is available for download at the Jython website: http://www.jython.org/ Installation is started by running the installer class. Further information and tips on installation is available at: http://www.jython.org/install.html Jython 2.1 is feature compatible with Python 2.1.1 and among the new feature are: - Improve speed when indexing a string and iterating over a string in a for loop. - Reworked coercing model (pep-0208) - Added {}.popitem(). - Improved speed for python files by buffering the RandomAccessFile. - Added function attributes (pep-0232) - Rich comparison (pep-0207) - Updated cPickle to handle CPython compatible unicode strings. - Updated sre to CPython-2.1a1 - Added the "new" module - Added a PyServlet class to the util package. - Warning framework (pep-0230). - Added sys.add_classdir and sys.add_extdir. - Added nested scope to the interpreter (pep-0227). - Added ReadlineConsole class. This class will make it a lot easier to integrate Bablok's readline support. - Display Hook for Interactive Use (pep-0217) - Added zlib, gzip and zipfile modules. - Added nested scope to jythonc (pep-0227). - A settable console encoding will allow windows users to enter national characters at the command prompt. - Non-public classes are available when respectJavaAccessibility is false - The names of zip- and jarfiles can be added to sys.path. - The weakref module is now available. - The sys.exitfunc hook is called on exit and the sys.excepthook is called when an exception occur. - A CPython compatible xreadlines module. - Support for os.environ and os.system() on common platforms. - Includes zxJDBC for Python DB API 2.0 compatibility. - support for callproc() in zxJDBC is now available for most simple stored procedure calls. The list of bugs fixed since the previous beta2 release includes: - [ #493359 ] Installer should include button - [ #495602 ] os.path.dirname() can result in an NPE - [ #495604 ] imp.find_module fails when None is 2 arg A complete list of changes and differences are available here: http://www.jython.org/NEWS.html Bugs can be reported to the bug manager on SourceForge: http://sourceforge.net/bugs/?group_id=12867 Happy New Year, the jython-developers From tjreedy at home.com Sat Dec 29 16:20:37 2001 From: tjreedy at home.com (Terry Reedy) Date: Sat, 29 Dec 2001 21:20:37 GMT Subject: Was that to inpolite? Re: Call for a small program References: <3C2BAEF3.CC34B8DD@htp-tel.de> <3C2E0D55.9EC9B67F@htp-tel.de> Message-ID: "Tom Karas" wrote in message news:3C2E0D55.9EC9B67F at htp-tel.de... > Hello out there. > > A few quick questions: > > Was my "Call" to inpolite? Sorry, don't remember rest of title or what it was about. > Was it the wrong place / newsgroup to ask? > > I just wonder, because there wasn?t even a reaction like "Go away" or > "Plonk / Killfile" We are mostly too polite to say such things unless a person is really obnoxious, which you definitely do not seem to be as evidenced by this query. At any one time, there is only a limited mindspace available for actively discussed threads. Sometimes deserving topics slip in between. Sometimes I see a post that 'calls' for a response, but I do not know what to say, or assume that someone else will (or maybe has already) answer. > This may sound odd, but i would be even willing to pay for a solution that would > fit the basic needs (running on windows and linux and some features) Willingness to pay is 'odd' only in that it tends to be unusual. Did you mention this originally? Terry J. Reedy From johngrayson at home.com Mon Dec 17 07:00:23 2001 From: johngrayson at home.com (johngrayson42) Date: Mon, 17 Dec 2001 12:00:23 -0000 Subject: Compiling Python with Tkinter Message-ID: <9vkmon+sa6n@eGroups.com> WhoaH!! Slow down there, I think the problem is much simpler and has nothing to do with the platform, X or what day it is... X11/Xlib.h *is* as you've correctly stated part of the X distribution, but that has nothing to do with compiling Tcl/Tk on WinXXX, since Xlib.h is in the Tk distribution. Compiling for WinXXX requires you to edit the project files in the PCBuild directory, and is generally straight forward. Now, if you're compiling for UNIX/Linux you've got to have X installed so that the include and lib files end up in the 'normal'locations and then you'll have to adjust the Setup.dist file in Modules to reflect the proper include and lib directories. Tkinter is not compiled by default, so you have to uncomment several lines in the file. Save it as Setup and run makesetup. Tcl/Tk must be installed or compiled/installed before you compile Python. In general, compiling a Tkinter-capable Python should take 30 minutes on a new UNIX/Linux platform: Install Tcl, Tk and Python as peers of each other (same with Tix) run configure in Python make and make install Tcl (unless you're using binary dist)make and make install Tk (unless you're using binary dist) edit Setup make and make install Python Now, you can proceed to make PIL. Follow the instructions in the README (but then nobody reads those... :-) ) The only machine that ever caused me a problem was a UniSys multiprocessor which required some code changes to compile, but that is another story... Good Luck! John From chris.gonnerman at newcenturycomputers.net Wed Dec 19 23:48:54 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Wed, 19 Dec 2001 22:48:54 -0600 Subject: module question References: <017e01c18909$523f84d0$4301010a@sky> Message-ID: <002901c18911$a65ac360$0101010a@local> > ----- Original Message ----- > From: ??? > > I have a question about a module's attribute and method. How can > I know which attribute and method a method has? For example, the > module os has attribute 'WNOHANG' and method os.wait(). Read the manual, for starters. Have you? Strictly speaking, functions in a module aren't methods, they are functions. > My next question is os module may use waitpid method, as like > os.waitpid(ret,os.WNOHANG), How can I know the relevant value of > os.WNOHANG . If I use os.waitpid(ret,0),I want to know what this > 0 relevantly refers? (I really don't know what this 0 refers > to? please tell me) Read the Unix or Linux (or BSD etc.) manual page for the relevant function. That's where most of them come from anyway; the os module docs are a bit sketchy because the assumption is that you have access to those docs also. In this event, the WNOHANG constant is a flag value; that is, it contains a bitmask type value. When using such values, the equivalent to "no options" is 0. This is a C thing actually. > Any idea will be appreciated. Hope this helps. From ajs at ix.netcom.com Tue Dec 25 05:49:53 2001 From: ajs at ix.netcom.com (Arthur Siegel) Date: Tue, 25 Dec 2001 05:49:53 -0500 Subject: [Visualpython-users] New Windows VPython References: <4220490166.1009242837@HYPERON.REM.CMU.EDU> Message-ID: <000d01c18d31$e33b1ae0$a9e1fea9@carol> > Bruce writes - > I will attempt to say nothing more about any of this. Which I guess gives me the last word. No I don't have any *proof* that the issue in the classroom is not as you analyze. It does seem that you somehow *knew* it was going to be *the* issue, and that the classroom experience you report is only confirming your own foresight. I was a Python and programming beginner not very long ago, so *I* know perhaps better than you what were the significant issues and what were the minor issues in getting up to speed. Do you have a basis to tell me that my own real lived experience was not lived, not accurately reported, or that besides being the crankiest of bastards, I am somehow outside the norm. You refuse to address, among other things, the fact that VPython is distributed with Numeric, and that you *cannot* expect your students to use it without disaster if they are not introduced to its typing and numerical coercian rules - a discussion in which the old div operator behavior is given context. From there on - one would think - its their *job* to keep it straight, and simply a few of the many of the things I expect you would expect them to keep straight in the course of a course. For the record: >From my perspective the issue here is not the div operator change, and , never has been. It is about science, about evidence and the reporting of evidence, and about common sense. Art From tatebll at aol.com Sat Dec 29 09:07:33 2001 From: tatebll at aol.com (Bill Tate) Date: 29 Dec 2001 06:07:33 -0800 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> <3C2D1833.1D481943@earthlink.net> Message-ID: Paul Prescod wrote in message news:... > PHP is a language absolutely optimized to solve a particular problem. > PHP's inventor does not try to claim that it is the best programming > language. Rather he claims that it is the programming language that is > completely optimized for solving one and only one problem: dynamic web > pages. > I do agree with what you saying re: PHP and dynamic web pages. But isn't Zope supposed to be able to do that as well? Yet, Zope doesn't appear (perhaps only to myself) to enjoy the same kind of enthusiasm even amongst Python devotees. You have Python programmers that have probably tried - even more than once I suspect - to "get" Zope but haven't as yet succeeded. My background is mechanical engineering and civil engineering, so my tendency is to tackle problems by going back to first principles or by stepping back and looking at the fundamentals. In the case of zope, the problem isn't that the product lacks this or that feature, its popularity suffers from the fact that people can't figure out how to get it to work for them - that's like starting with 2 strikes against you at bat in today's market. Zope by no means defines the universe of what Python can do, however, if it doesn't get the kind of traction ultimately hoped for, I can imagine that it COULD be PERCEIVED as a "setback" of sorts for Python amongst those who represent the "skeptical" and/or "non-converted" Zope represents one of the most visible products using python out there; if it is ultimately marginalized, I don't think you can simply dismiss the negative consequences of such a result as being isolated only to Zope. Regrettably, false perceptions often carry a greater weight than fact. From tdpham at email.com Tue Dec 4 00:03:13 2001 From: tdpham at email.com (Thomas Pham) Date: Mon, 03 Dec 2001 22:03:13 -0700 Subject: Download file from web site Message-ID: <20011204050314.21892.qmail@email.com> Hi group, I am trying to download a file from a website. My source code is listed below. But I can only get to its first page. I could not go further to its second page. The second page "idm_download" however, does require an user ID & password to open it. Thanks, Thomas #!/usr/local/bin/python import httplib h = httplib.HTTP('www.teamidm.com/idm_download/') h.putrequest('GET', '/index.html') h.putheader('Accept', 'text/html') h.putheader('Accept', 'text/plain') h.endheaders() errcode, errmsg, headers = h.getreply() print errcode f = h.getfile() data = f.read() print data f.close() -- _______________________________________________ 1 cent a minute calls anywhere in the U.S.! http://www.getpennytalk.com/cgi-bin/adforward.cgi?p_key=RG9853KJ&url=http://www.getpennytalk.com From ajs at ix.netcom.com Mon Dec 31 12:47:53 2001 From: ajs at ix.netcom.com (Arthur Siegel) Date: Mon, 31 Dec 2001 12:47:53 -0500 Subject: Python Popularity: Questions and Comments Message-ID: <002101c19223$51baecc0$a9e1fea9@carol> Paul writes - >I'm concerned by the historical precedents. What language have you ever >heard of that took over the universe slowly and quietly? They tend to do >it in a big bang, following some trend like Unix or the Web or mobile >computing. If there is ever a "big bang" associated with a language in >Python's class, Python could be overshadowed. For instance if PHP had >been better designed as a general purpose programming language, and had >had support from a big corporation (e.g. Sun), it might be the "default >language" in the scripting world today. My belief is that Python *is* different. That it is, has two implications. A) Its niche is secure B) Its future cannot be predicted by reference to past models. By my lights, Python is the glue language extraordinaire. Using the 'glue' reference both in terms of its technical implications, and beyond. It is extraordinarily useful as the glue holding together interdisciplinary approaches to problem solving. That's sort of a complex niche. Its growth will be evolutionary rather than at internet speed. I'm talking as if I know. Which of course I don't. But frankly I wouldn't be here with as much interest as I have, if I thought we were only dealing with another cool programming language. Art From cliechti at gmx.net Sat Dec 29 15:49:03 2001 From: cliechti at gmx.net (Chris Liechti) Date: 29 Dec 2001 21:49:03 +0100 Subject: REPOST: values of sys.platform? for a serial port lib Message-ID: <1$--$$_----__%--%$@news.noc.cabal.int> i've written a portable serial port library. it runs now on linux and win32 (using marks win32all) but i would like to make it compatible with more unix like platforms. basicaly it should run on any POSIX compilant system. i'm interested in values for "sys.platform" and, if possible, the name of the serial port (an how the ports are numbered ttyS0, ttyS1 etc.) e.g "linux2" and "/dev/ttyS%d" % port, numbering starting at zero. the library is open source and optimized for binary communication including access to the control lines. i'll post a link just after i have added the new platforms and a licence statement. thanks. chris -- Chris ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Chris Liechti Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:41:45 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774594 27193 211.57.49.2 (31 Dec 2001 04:56:34 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:56:34 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From Tom.Karas at htp-tel.de Thu Dec 27 16:35:25 2001 From: Tom.Karas at htp-tel.de (Tom Karas) Date: Thu, 27 Dec 2001 22:35:25 +0100 Subject: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B5E9F.FF1C2CC@bellatlantic.net> Message-ID: <3C2B941D.B1E45AA5@htp-tel.de> Hello out there. > >It depends on how you view this 'forum.' As far as I am concerned, > >**nothing** beats NNTP newsgroups viewed in a dedicated NNTP viewer. What means nntp ? Just my 2 cent question Best regards Tom Karas -- The early bird catches the worm. Trust the computer industry to shorten the term If you want something else for "Year 2000" to Y2K. It was this kind of thinking breakfast, get up later. that got us in trouble in the first place. Adrian Tyvand From printers at sendme.cz Wed Dec 26 12:40:58 2001 From: printers at sendme.cz (A) Date: Wed, 26 Dec 2001 18:40:58 +0100 Subject: How to solve a problem? Message-ID: <3C2A19BA.17732.1AE6EE@localhost> Hi, My program downloads regularly some files and it takes some time so I need to shorten this downloading time. As most of these files are the same, many times when the program downloads these files, I would like to download only those that are not the same or are newer. What is the best solution? Many thanks for help. Ladislav From aleax at aleax.it Sat Dec 8 17:50:23 2001 From: aleax at aleax.it (Alex Martelli) Date: Sat, 08 Dec 2001 22:50:23 GMT Subject: Calling a generator multiple times References: Message-ID: Bruce Eckel wrote: > I'm trying to create a clever way to call a generator multiple > times, but the only thing I've been able to come up with is: > > import random > rgen = random.Random() > def itemGenerator(dummy): > return rgen.choice(['one', 'two', 'three', 'four']) > > print map(itemGenerator, [None]* 25) > > This works, but it requires the 'dummy' argument which seems > inelegant. I'll bet someone has a better idea... Why not just: def itemChooser(): return rgen.choice(('one','two','three','four')) print [itemChooser() for i in range(25)] (In Python 2.2 and later, 'generator' is a specific term, used in "from __future__ import" in particular, for a function containing keyword 'yield' and thus returning an iterator; like other terms that get hijacked by some programming language for specific meanings, such as "module", "function", "type", etc, it's thus best avoided in its non-specific wider sense:-). Alex From loewis at informatik.hu-berlin.de Mon Dec 3 05:54:56 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 03 Dec 2001 11:54:56 +0100 Subject: A Python bytecode assember? References: <9uf0kd$1r4r$1@agate.berkeley.edu> Message-ID: Daniel Yoo writes: > I'm planning to do a small project with Python's bytecode, and I'd > like to know if anyone's written a bytecode assember for it? Yes, ask google for decompyle. Regards, Martin From deweese at usc.edu Thu Dec 20 16:16:41 2001 From: deweese at usc.edu (John DeWeese) Date: Thu, 20 Dec 2001 13:16:41 -0800 Subject: (semi) stackless python References: Message-ID: <9vtklj$bef$1@usc.edu> > The new generators in Python2.2 implement semi-coroutines, not > full coroutines: the limitation is that they always return to > their caller -- they can't take an arbitrary continuation as > a return target. > > So you can't do everything you can do in Stackless, or at least, > you can't do it the same way. I'm not sure what the limitations > are yet, but you might be surprised with what you CAN do. > If all the generator objects yield back to the same 'driver' > procedure, then you can do a sort of cooperative multithreading. > In that case, you're executing the generators for their side > effects -- the value returned by yield may be unimportant except > perhaps as a status code. > > [ See also Tim Peters' post on the performance advantages of > generators -- you only parse args once for many generator > calls, and you keep and reuse the same stack frame. So I > believe you get some of the same benefits of Stackless > microthreads. ] > > Maybe I can find the time to post an example of what I mean. > In the mean time, some previous posts on generators might give > you some ideas. Thanks, I will do some research on generators. If they are sufficient, I would be able to stick to the latest python. - John From tim.one at home.com Wed Dec 5 23:29:44 2001 From: tim.one at home.com (Tim Peters) Date: Wed, 5 Dec 2001 23:29:44 -0500 Subject: Do 2.2 and 2.1.1coexist well? In-Reply-To: <3c0d15e9.340462648@news> Message-ID: [David C. Ullrich] > ... > I imagine it's true nonetheless that the 2.x install is not > going to change the 1.5 registry entries, eh? (Not if I > back them up first, anyway...) Nothing has actually changed since the last time I answered this : no, except the registry entries for Windows-mandated one-of-a-kind shared resources, like (a) file extension associations, and (b) HKEY_LOCAL_MACHINE\ Software\ Microsoft\ Windows\ CurrentVersion\ App Paths\ Python.exe which tells Windows which version of Python to run when you, e.g., enter plain "python" from the Start -> Run box and haven't fiddled your Windows PATH to pick up some other version of Python before it. Just try it! If you don't like it, you can uninstall it. The 2.2 installer undoes everything the installer did, including restoration of file extensions etc. From dmallwitz at cox.rr.com Thu Dec 20 20:25:46 2001 From: dmallwitz at cox.rr.com (David Mallwitz) Date: Thu, 20 Dec 2001 20:25:46 -0500 Subject: Comunicating through COM ports References: Message-ID: <3c228dff$1_1@goliath.newsgroups.com> Comunicating through COM portsChapter 19 of Mark Hammond and Andy Robinson's 'Python Programmingon on Win32' covers this quit well, and with the Activestate Python distro there is a multithreaded demo called 'win32comport_demo.py'. But here's what I do - example is from a console connection to an old Cisco router. >>> from Serial import Serial >>> ### open the COM1 port >>> serialconfig = Serial.PortDict() >>> serialconfig['port'] = Serial.COM1 >>> serialconfig['rxBufSize'] = 4096 >>> port = Serial.Port(serialconfig) >>> port.open() >>> port.write('show conf \r') >>> x = port.read() >>> x 'show conf \r\nUsing 768 out of 32762 bytes\r\n!\r\nversion 11.1\r\nno service u dp-small-servers\r\nno service tcp-small-servers\r\n!\r\nhostname Router\r\n!\r\ n!\r\nip subnet-zero\r\nno ip domain-lookup\r\n!\r\nhub ether 0 1\r\n link-test\ r\n auto-polarity\r\n!\r\nhub ether 0 2\r\n link-test\r\n auto-polarity\r\n!\r\n hub ether 0 3\r\n link-test\r\n auto-polarity\r\n --More-- ' Best, Dave "Alves, Carlos Alberto - Coelce" wrote in message news:mailman.1008852145.28654.python-list at python.org... Anybody could give me an example code of how connect/comunicate through COM ports (i.e. COM1, COM2). I'm under windows 98. Thanks!!! Carlos Alberto COELCE/DPRON-Departamento de Projetos e Obras Norte Fone: 677- 2228 e-mail: calves at coelce.com.br \|||/ (o o) --ooo0-(_)-0ooo-- -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- From tatebll at aol.com Wed Dec 19 09:56:32 2001 From: tatebll at aol.com (Bill Tate) Date: 19 Dec 2001 06:56:32 -0800 Subject: Newbie Wondering About Database Support? References: Message-ID: richardkessler at matteicos.com (Richard Kessler) wrote in message news:... > I have recently discovered Python and am excited about the possibility of > developing with the language. Unfortunately, I develop database centric > applications, MS SQL Server, etc. and I do not see much talk about Python and > access to databases. Am I missing something or is Python not intended for that > purpose. I would love to replace programs currently in VB with Python, but > they must be able to access databases. > > Thanks in advance. > > Richard ODBC and ADO worked very well with Python (not the only options mind you). Default ODBC support is provided with the base distribution of Python, but I would encourage downloading Sam Rushing's DynWin package. Just add - "from dynwin import odbc" to the beginning of your own DB module, and you will have access to a pretty extensive odbc api. If you use stored procs extensively, you still can use from within Python without too much trouble WHERE the SP returns a result set. Where you are returning a single value, that's a different story that I haven't found a workaround to in Python - perhaps others can comment. Another alternative is using ADO. Mark Hammond's win32com package for python is very nice and makes using ADO about as easy as it gets. Its slower than ODBC but its still very easy to use. If you want to do a lot of Win32api programming in Python, definitely check out Mark's Book Pythn Programming on Win32 - lots of great ideas and solid examples to work from including database stuff. There are also examples of using ADO with Python, do a google on it and you find tutorials out there. Same for odbc. Good luck. From jason at tishler.net Thu Dec 27 22:10:48 2001 From: jason at tishler.net (Jason Tishler) Date: Thu, 27 Dec 2001 22:10:48 -0500 Subject: Replacing Python 2.1 with 2.2 in Cygwin In-Reply-To: References: Message-ID: <20011228031048.GF1888@dothill.com> Richard, On Thu, Dec 27, 2001 at 10:48:07AM -0800, Richard Crawford wrote: > I have Cygwin running on my Windows 2000 computer. I have Python 2.1 > installed, and would like to replace it with Python 2.2. I had > assumed (wrongly, I guess) that when I installed 2.2 it would > automatically overwrite 2.1, but that wasn't the case. > > How do I accomplish this, anyway? You have three options: 1. Wait for me to update Cygwin Python to 2.2 in the standard Cygwin distribution. I will not commit to a date, but you should not have to wait unreasonably long. 2. Just do a make install and set your PATH so that /usr/local/bin is before /usr/bin. Note I am assuming that you configured with --prefix=/usr/local (which is the default). 3. make install into a temporary directory, make a compressed tarball from the temporary install, point Cygwin's setup.exe at it, and then do an install from local directory. Jason From woodsplitter at rocketmail.com Sun Dec 30 22:54:08 2001 From: woodsplitter at rocketmail.com (stalin) Date: 30 Dec 2001 19:54:08 -0800 Subject: REPOST: Re: wxBitmapFromImage function in wxPython? References: <3C2F7BB3.577D3712@cti.ecp.fr> Message-ID: <5$--$$_----__%$%-$@news.noc.cabal.int> Stephane SOPPERA wrote: > I read in the documentation of wxPython that this function exists: > wxBitmapFromImage(image, depth=-1) > ... > It's not in dir(wxPython.wx). > I'm using python 2.1. You don't mention what version of wxPython you're using, but I know that wxBitmapFromImage is supported by wxPython 2.3.2.1, the version I'm using. c:\>python -c "from wxPython.wx import *; print wxBitmapFromImage" ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: woodsplitter at rocketmail.com (stalin) Newsgroups: comp.lang.python Subject: cmsg cancel <7876a8ea.0112301954.2dc7d8b8 at posting.google.com> Control: cancel <7876a8ea.0112301954.2dc7d8b8 at posting.google.com> Date: Mon, 31 Dec 2001 01:47:31 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009773914 27193 211.57.49.2 (31 Dec 2001 04:45:14 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:45:14 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From coca at houston.rr.com Fri Dec 21 00:25:18 2001 From: coca at houston.rr.com (Dan Compton) Date: 20 Dec 2001 21:25:18 -0800 Subject: Troubleshoot: Problem getting Tkinter to work with Python 2.2C1 on Linux Message-ID: <60c49aa9.0112202125.520fd62@posting.google.com> I built python 2.2 release candidate 1 on my Linux laptop (Mandrake 8.0 distro) after reading everything in the README file in the root of the source tree. I tried importing Tkinter after testing other modules successfully and found that it wasn't able to be found by the interpreter so I backtracked and read the README regarding Tkinter again. I had already uncommented the relevant lines in the Modules/Setup file but I went back and double checked everything looked correct and it was. I read that you should try to perform a "make install libinstall" under the Tkinter section if it was recognized and so I did that but it pretty much looked as if it was the same process as "make install" and after it finished and I tested it, Tkinter was still no where to be found. The make process built _tkinter to my knowledge and the make install or make install libinstall should have linked the Tkinter module to _tkinter. Then I noticed that _tkinter wasn't able to found either when I tried importing it. Well I am lost now and don't know what to do to get this to work... help, please :) Dan From tatebll at aol.com Wed Dec 19 13:38:52 2001 From: tatebll at aol.com (Bill Tate) Date: 19 Dec 2001 10:38:52 -0800 Subject: stackless python References: <9vpjds$due$1@usc.edu> Message-ID: "John DeWeese" wrote in message news:<9vpjds$due$1 at usc.edu>... > Hello, I'm a python newbie interested in using stackless python to support > hundreds of simulation objects for a game. I've checked out various articles > and it sounds great, and I've visited stackless.com. Seems that branch is > becoming a bit dated. I also see that some features such as generators (not > relevant to me) have made it into python 2.2. So, what's up, can anyone > share their experiences regarding stackless python, micro-threads, etc.? > > Thanks! Real life - The largest implementation I've seen was done by gordon mcmillan while I was working for a particular company that shall remain anonymous - CBI applies unfortunately. Gordon's implementation was very stable, fast, and scalable. I think you might some useful information on gordon's site - some of its dated - but it does a pretty good job of driving home certain key concepts. I don't think you can go wrong here given that continuations are so damn lightweight and they work beautifully with non-blocking sockets. If your going to be doing network-based game development, sounds like a good fit to me. From rdsteph at earthlink.net Thu Dec 27 16:53:41 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Thu, 27 Dec 2001 21:53:41 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <3C2B9901.998345FB@earthlink.net> > Phil Hunt wrote: > > Just as Python can compile to the JVM, I'm sure it will compile to > Microsoft's .net platform. Hmm, I'm not so sure about this. Mark Hammond has stated, I believe, that the work done so far at ActiveState was preliminary and not complete; and now we hear that ActiveState has ceased work on Python related projects??? It sounds like a Python.Net is a daunting task; as woudl be a Perl.net or a Ruby.NET don't want programming to be forcibly OO. In Ruby, can you write > > What can I do in Ruby that I cannot just as easily do in python? Until > that\ question is answered, Ruby will stay behind python in popularity. I know of absolutely nothing that you can do in Ruby but not in Python. I know that both Ruby and Python will survive, no question. I also suspect that Python will always be more popular than Ruby. My only concern was that Ruby, which I perceive as very similar to Python in many ways, will divert *some* folks form Python to Ruby; many more than will divert from, say, Python to Perl, or from Python to Tcl. > > > I expect Python to keep growing. As computers get faster, programming in > C++ makes less and less sense. People will move over to more high level > langauges, such as Java, C#, Perl and Python. Java and C# are roughly > on the same level, faster than Perl/Python but slower to code in. Python > offers the fastest coding time, as it is "executable pseudocode", so > I expect more and more stuff to be done in it. > > I totally agree with you on this. I am feeling better about Python vs. Ruby, partly based on what I am hearing from folks in this thread, and partly from what I hear on the Ruby newsgroup about problems running under windows with threading and slowness etc. I have no gripe against Ruby folks either , none whatsoever. not only is it a fee world, but people are trying Ruby out just like we tried Python out ;-))) Both communities are friendly, to. I just am more hoping that Python grows in popularity vs. Ruby. Now, my perception is that most Ruby developers run under Linux or some other Unix. I wonder what percentage of Python developers run Windows, and what percentage run Linux? I have no idea, does anyone have a guess? If you put my back to the wall to make a prediction, I'd guess that more than half of us on this newsgroup use windows. Anyone? Also, one more thing: Guido was interviewed recently in a magazine and he conjectured that programming for handholds and PDA's might be a huge niche for Python in the future. Does anyone have any thoughts on this? What are Python's strengths and weaknesses vs other languages, including Ruby, in this arena? How is Pippy doing ???? Ron Stephens http://www.awaretek.com/plf.html From jason at jvoegele.com Tue Dec 4 10:53:10 2001 From: jason at jvoegele.com (Jason Voegele) Date: 4 Dec 2001 07:53:10 -0800 Subject: Python evangelists unite! References: <9u77i8$a5j$1@slb0.atl.mindspring.net> <91acf731.0111301017.31cd71a5@posting.google.com> <9ufdth$155$1@slb5.atl.mindspring.net> <91acf731.0112031205.2782a5f9@posting.google.com> <9uhpkh$9u7$1@slb5.atl.mindspring.net> Message-ID: <91acf731.0112040753.49b930cd@posting.google.com> > > The problem with this is that it defeats the idea of transparent > > persistence. One goal of object databases is that persistence is not > > limited to a subset of the class heirarchy. > > Okay, I can see that. In other words, the hierarchy should express the > relationships between objects, not a particular feature of certain objects? I'm not sure I understand what you're saying. My original point was that persistence should not be limited to objects whose class subclasses "Persistent". *Any* object should be capable of persistence, whether it's class is Integer, or MyClass. > > ... > > Some OO databases ignore this and force applications to use > > "Persistent" superclasses or interfaces. IMO, this is a very bad > > idea. Consider that you may have a million instances of a class, only > > one of which is persistent (by the reachability definition). If the > > class has to subclass a "Persistent" class, all of those million > > objects have to carry around the Persistence baggage, even though only > > one of those objects needs them. > > I thought only the persistent objects would subclass the Persistent class; > how does the persistence baggage get into objects of classes derived from > Transient? Wouldn't only leaves, so to speak, of the hierarchy derive from > Persistent or Transient anyway? That's precisely how it works, because individual objects can have methods added to them. If they didn't have this capability, then all objects of a particular class would have to support persistence. I think an example is in order. Say I have a class called "Book", that represents a book having a title, an author, a date of publication, etc. In my application, I might instantiate a million Book objects. But say that I only need to store one of them in the database. Given the ability to add members to a specific object, I can add persistence support methods (such as object_id, mark_modified, etc.) to the single book instance that I need to store in the database. (More precisely, the database binding could add these methods for me!) If Ruby did not have this ability, the Book class would have to inherit from some sort of Persistent class. This would mean that all one million books have these methods and variables to support persistence, even though only one book object actually needs them. > > > Adding the persistence baggage to individual objects as necessary > > provides a much simpler and scalable solution. Simpler because > > application developers don't have to bother with subclassing (or > > implementing) a Persistent class (or interface). More scalable > > because the persistence support is added to *only* those objects (not > > classes) that need it. > > I'm not sure how the singleton stuff is more scalable (though I'm sure you > have more experience than me). To be fair, I don't know that it's any more scalable, but my intuition tells me that it should be. > Hypothetically (yeah, I'm on shaky ground > here), what if you had more than one major behavior (besides just > persistence) that might vary between objects of a given class? Mightn't it > get messy to keep track of which objects are which? (I suppose, though, you > don't have to "keep track" of which ones are persistent; they just act > differently.) Yes, you just answered your own question :-) In addition, dynamic languages aren't concerned with such strict semantics. Type is often defined by the messages an object understands (whether those messages where implemented by the object's class, or whether they were added to this specific instance does not matter for a dynamic language). > I wonder if it wouldn't really be clearer just to declare > trivial classes which inherit multiply from Persistent/Transient, other > behavior implementations, and other parent classes. You could do this, but then you force application developers to do things you could automate for them. And it doesn't provide any benefit anyway. Adding this kind of behavior at the class level means that all instances of that class provide that behavior. Most of the time, this is what you want, but sometimes it is just incorrect. See the Book example above. > (Of course, in Python > there's no such thing as a trivial subclass definition; you've got to > overload __init__ specifically and call __init__'s in each base class. This > ticks me off to no end.) I'm just starting to play around with Python, so I can't comment on this. > Also, a more technical concern: shouldn't every Ruby object need hooks in > place so that any single method could be overridden in individual objects? > I'm envisioning a class instance with a function pointer for each method ... > that's a nasty thought. Or does each object carry a list of overridden > methods, to be checked with each method call? Isn't there significant > overhead either way? Or (most likely) is it implemented in too clever a way > for me to come up with? :-) The Ruby object model is very flexible. Classes have methods, objects have methods, objects can have a class created specifically for their own use, objects or classes can mixin methods from a module, etc. A lot of the (presumed) overhead is handled by method caching. See: http://www.rubycentral.com/book/classes.html for a description of the Ruby object model (although, unfortunately, the very helpful figures from the printed book are not available in the online version.) -- Jason From loewis at informatik.hu-berlin.de Fri Dec 21 12:13:29 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 21 Dec 2001 18:13:29 +0100 Subject: How to generate XML References: <3c21e330@news.opennet.it> Message-ID: Fabrizio writes: > Does anybody know if there are modules to generate XML? I'm amazed that people always start proposing difficult-to-use libraries when this question comes up. I'd prefer to use print "" any time over SAX, DOM, or anything else people have come up with. I have yet to see an example where generating XML to print statements isn't more readable, and quicker to develop and maintain than any architected API (excluding, of course, applications where you already have a DOM tree or SAX event stream that originated from parsing a document). Regards, Martin From fredrik at pythonware.com Tue Dec 4 10:23:16 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 04 Dec 2001 15:23:16 GMT Subject: Draft PEP: string interpolation with backquotes References: <20011202080626.A76724@hishome.net> <20011202170805.A36879@hishome.net> <200112032307.fB3N78327930@bigboy.bizarsoftware.com.au> Message-ID: Oren Tirosh wrote: > As for the issue of interpolation with backticks being equivalent to str() > rather than repr() - I believe most people won't even notice. anyone who proposes to use backticks extensively in a programming language should be forced to travel around the world for a couple of months, trying out different keyboards. besides, the following is only a few characters longer than your suggested notation (and probably fewer keypresses on my key- board), works with all existing Python versions, and also with all existing syntax-aware tools: i('X=', x, ', Y=', calc_y(x), '.') coding the "i" function is left as an exercise for the interpolating reader. From boud at rempt.xs4all.nl Fri Dec 14 15:34:19 2001 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 14 Dec 2001 20:34:19 GMT Subject: Model View Presenter GUI pattern? References: <20011213172833.0bfac3c7.gry@ll.mit.edu> <9vddsl$15t$1@news1.xs4all.nl> Message-ID: <9vdnob$n2l$1@news1.xs4all.nl> Boudewijn Rempt wrote: > george young wrote: >> Is anyone using the Model View Presenter GUI framework/pattern in python? >> I've been reading bits about it, and it sounds quite attractive. > Yes: in http://stage.linuxports.com/projects/pyqt/c4626.htm I discuss > it in some detail. I'm now working on an editor in Python that will > carry the paradigm to its conclusion. It tends to be difficult to > implement the paradigm with a gui toolkit that doesn't use it for > every single widget, like Swing attempts. It has been brought to my attention that the above url is wrong (funny, since I pasted it straight out of my browser. Perhaps Joshua has just regenerated the book). It's now: http://stage.linuxports.com/projects/pyqt/c4625.htm -- Boudewijn Rempt | http://www.valdyas.org From mhammond at skippinet.com.au Fri Dec 14 05:59:10 2001 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 14 Dec 2001 10:59:10 GMT Subject: "XXX undetected error" in python_d.exe References: Message-ID: <3C19DC19.6060107@skippinet.com.au> Courageous wrote: > How am I supposed to interpret this error when it is printed > by the Python interpreter? It generally means that someone has previously set an exception and not cleared or propagated it. For example, the following code could cause it: PyObject *ob = PyObject_GetAttrString(a,"whatever"); if (ob==NULL) { Py_INCREF(Py_None); return Py_None; } The GetAttrString() call sets an exception, but the function returns an object. In some cases this could trigger the above message. These are hard to debug - the message is often not printed as the error is left pending - it is often quite stale by the time the warning is printed. The frame location as it is printed can give you a hint though. Finding it hsa always been pure grunt :( > This appears to be a feature of newer (2.2?) interpreters in > debug build only. I believe debug only, but pre 2.2. I think 2.0 at least, but maybe only 2.1. Mark. From store_li at sina.com Fri Dec 14 23:24:32 2001 From: store_li at sina.com (Kick) Date: Sat, 15 Dec 2001 12:24:32 +0800 Subject: Is there any method to run Tk program without dos window? Message-ID: <9vejd3$euvji$1@ID-12869.news.dfncis.de> I use Active Python in windows, every time I double click to run a tk program, it will bring a dos window. How can I make this hidden? Thanks for any reply! From warren-postma at NOSPAM.rogers.com Sat Dec 15 00:45:11 2001 From: warren-postma at NOSPAM.rogers.com (Warren Postma) Date: Sat, 15 Dec 2001 05:45:11 GMT Subject: using IDLE as a syntax highlighting external editor for Zope? Message-ID: I'm interested in patching Zope to use FTP send and receive to remotely edit Zope script methods. Has anybody else tried this yet? Warren From david at wmol.com Mon Dec 10 08:53:07 2001 From: david at wmol.com (David Hill) Date: Mon, 10 Dec 2001 08:53:07 -0500 Subject: two questions - sockets / c functions Message-ID: <3c14bc2c$1_2@news7.fast.net> Hello - I am learning python, and I like what I see so far. Is it possible to use sockets with python, so that I may write client/server code? If so, where can I find more information? Is it possible to use c functions within python? For example, openbsd has a function arc4random(). How could I use this in python? Thanks David From erik at pacific-shores.com Fri Dec 28 11:25:39 2001 From: erik at pacific-shores.com (Erik Myllymaki) Date: Fri, 28 Dec 2001 16:25:39 GMT Subject: REPOST: Re: base64.decodestring gives binascii.error References: <3C2C03CB.7030000@pacific-shores.com> Message-ID: <6$--$$_----_-$--_$@news.noc.cabal.int> The '_' and '!' were in the original string that was then encoded, not in the resulting encoded string. Alex Martelli wrote: > "Erik Myllymaki" wrote in message > news:3C2C03CB.7030000 at pacific-shores.com... > >>should base64.decodestring give a binascii.error if it encounters >>special chars like '_' and '!' ? >> > > Makes sense to me; after all, such characters should never be > in a string produced by base64, so the data must have been > damaged in transit -- raising an exceptions seems appropriate. > > > Alex > > > > -- -- Erik Myllymaki erik at pacific-shores.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Erik Myllymaki Newsgroups: comp.lang.python Subject: cmsg cancel <3C2C9D79.9050501 at pacific-shores.com> Control: cancel <3C2C9D79.9050501 at pacific-shores.com> Date: Mon, 31 Dec 2001 02:42:09 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775290 27193 211.57.49.2 (31 Dec 2001 05:08:10 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:08:10 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From Bruce at EckelObjects.com Sat Dec 8 16:28:04 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Sat, 08 Dec 2001 13:28:04 -0800 Subject: It's hard to find documentation Message-ID: <200112081328040980.0156CC2B@mail.rdc1.sdca.home.com> Here's an example. In the Python FAQ, there's a reference (no URL) to a document: 5.1. Can I create my own functions in C? Yes, you can create built-in modules containing functions, variables, exceptions and even new types in C. This is explained in the document "Extending and Embedding the Python Interpreter" (the LaTeX file Doc/ext.tex). Also read the chapter on dynamic loading. So let's try to find "Extending and Embedding the Python Interpreter". Using 'search,' using 'advanced search,' nothing comes up with that title. Maybe it doesn't exist. Who knows. I have this struggle a lot when hunting for python information. Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From fperez528 at yahoo.com Thu Dec 6 10:14:27 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Fri, 07 Dec 2001 14:42:27 +2328 Subject: Multi-isinstance idiom (Re: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)) References: Message-ID: <9urd59$ilt$1@peabody.colorado.edu> Tim Peters wrote: > [Mike C. Fletcher] >> ... >> AFAIK, list comprehensions are basically just syntactic sugar >> around >> regular loops, so they aren't likely any faster than a for loop. >> If that's changed, it would be good to know. > > They are just sugar, but are nevertheless faster than the for loop > most sane people are *likely* to write (the generated code > uses a bound method object for the hidden list.append, doing the > method lookup just once before the loop begins). Can you comment on list comprehensions vs. map? I tend to shy away from the convenience of comprehensions because I'm afraid of their cost and --at the expense of clarity-- pretty much anything can be written with map(). Curious, F. From sholden at holdenweb.com Fri Dec 21 12:17:51 2001 From: sholden at holdenweb.com (Steve Holden) Date: Fri, 21 Dec 2001 12:17:51 -0500 Subject: ANN: eGenix.com mx BASE Extension Package 2.0.3 References: <3C235C5E.C4E2BB12@astro.cornell.edu> Message-ID: "Tom Loredo" wrote in message news:3C235C5E.C4E2BB12 at astro.cornell.edu... > > A dumb question I've long wondered about: What does the "mx" stand for > in the various mx packages? > Marc-Andre's extensions regards Steve -- http://www.holdenweb.com/ From aleax at aleax.it Fri Dec 28 10:42:17 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 16:42:17 +0100 Subject: REPOST: Re: pth files - can they prepend to sys.path? References: Message-ID: <7$--$$_----_---$_$@news.noc.cabal.int> "Skip Montanaro" wrote in message news:mailman.1009549952.9614.python-list at python.org... > > Is it possible to force a directory mentioned in a .pth file to be inserted > at the beginning of sys.path instead of appended to the end? Only by editing your site.py, I fear (or, by doing it in siteconfigure.py, probably better). Function site.addpackage, as it stands, uses sys.path.append, so directories thus added won't get to the start of sys.path, but always to the end. Alex ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Alex Martelli" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:00:43 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775259 27193 211.57.49.2 (31 Dec 2001 05:07:39 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:07:39 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jkraska at san.rr.com Sat Dec 29 18:29:19 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 29 Dec 2001 23:29:19 GMT Subject: REPOST: Re: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> <3C2E498B.6DC757E0@stroeder.com> Message-ID: <0$--$$_----__-%--$@news.noc.cabal.int> >> C and programmers who like C should die a slow and painful death for >> holding back the computer industry for two decades. > >Fully agree with that. *shrug* C's AT&T-approved follow-on turned into a textbook case of pathological creeping featurism. The few features which increased the language's expressiveness and clarity were overcome by dozens of elements of complexity and obfuscation that ruin any chance of the language being any more clear or understandable than what it replaces. I would venture a guess that was one of the driving forces of Java. Mass defection from an unwieldy monstrosity that droves of programmers would rather not use. C remains in use because it's a better portable assembly than its unnamed younger decendent, and likewise is quite clear. What I'm trying to say is that you're accusing C programmers of holding back the industry, without aknowledging that the good alternatives have been fairly scarce and polluted in and of their own right. Perhaps the Children of Bjarne should die a slow and painful death for the horror they've inflicted upon us and two decades of misdirection down entirely the wrong path. >:-/ C// ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Courageous Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:39:17 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774489 27193 211.57.49.2 (31 Dec 2001 04:54:49 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:54:49 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From dalke at dalkescientific.com Thu Dec 27 04:53:47 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Thu, 27 Dec 2001 02:53:47 -0700 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: Ron Stephens: >How is Python doing popularity wise? I can tell you that it's doing well in computational chemistry. I know several places that have switched to doing development in Python over Perl or other VHLLs. I think it's because of Python's readability and its easy ability to add new data types which act like native objects. In structural biology it also seems to be popular. I know of several Python projects (PyMol, VMD, MMTK, MSMS, Chimera), a couple old ones in Tcl, none in Perl, none in Ruby. Although I'm biased by prefering Python, so I'm sensitized to Python projects. In bioinformatics, Perl is still the most popular, although we (the Biopython project) are trying. :) >Python, while fabulously successful, is at an interesting point in its >growth curve. It will be difficult to maintain the extremely high rate >of growth exhibited so far; new contenders are possible problems; and >the recessionary economy could also negatively impact Python's growth. It's impossible to undergo a meteoric growth forever. Exponential growths must turn into S-curves. So why should there be a need for an extremely high growth rate? >1. Ruby is an especially interesting competitor to Python. I have been >monitoring the Ruby newsgroup, and it shows incredible growth and >vitality. Furthermore, Ruby is aimed right at the heart of Python's >niche. I looked at Ruby last summer. I read the documentation and followed the newsgroup for a couple months. I was able to follow what was going on, but didn't want to see myself explaining it to non-software developers; that is, the chemists, biologists, and physicists who use the tools I develop. I don't see how it's aimed at "the heart of Python's niche" -- what do you see as Python's niche? I see it as a language which is usable by beginning programmers and enjoyable by experienced developers. I don't see Ruby really fitting the first of those. (I don't see how '@var' obviously means "instance variable" nor '$var' for "global variable", while Python's is much easier to explain, since the 'self.' makes it more apparant. I like that Python doesn't have an implicit return of the last evaluated expression, making it easier to find them. I like that I can say "methods inside of __s are special" as compared to Ruby where you have to memorize that things like "to_s", "initialize", have special meaning. I like that empty function calls still need a () in the declaration. I don't like that Ruby promotes adding methods to existing classes, since I think that can lead to conflict. I think 'abs(x)' is better than 'x.abs' or 'x.abs()'. I'm forgetful, so I don't like special syntax shortcuts, like a = %w{ ant bee cat dog elk } for a = ["ant", "bee", "cat", "dog", "elk"] (especially since it can be written a = "ant bee cat dog elk".split() ) I don't like that regular expressions are treated with special syntax. I don't like having aliases, as Hash.indexes/indicies, Array.len/size. Ohh, and Hash has three equivalents in has_key?(key) / key?(key) / include?(key) . At the implementation level, I like that the C Python implementation uses native threads rather than it's own threading package. That lets me work with other threaded libraries more easily. I like that the C garbage collector is built on reference counting, since I need the guaranteed semantics more than I need lesser implementation complexity. ) >If we view Microsoft's Visual Studio, especially Visual Studio.net's C# >and VB, as the official 800 lb. gorilla of software development; and if >we view Java as the 400 lb. gorilla pretender to the throne; and if we >view Borland's Delphi and Kylix as no more than a smart leader of a >chimp; then everything else is the pack of open source chimps. Luckily, I work in a field where most people use unix for real development, so solutions based on C# and VB just don't exist, and there's a huge installed based of C and FORTRAN code. I do know one company doing some work with Kylix under Linux. So I can't really comment on this paragraph. >The open source world is still led by PERL, but PERL is truly more of a >text processing, web CGI, scripting specialist; not so much of a direct >threat to Python. Why can't we all just get along? Seriously, in my usual environment there are half a dozen "real" programming languages in use (C, C++, FORTRAN, Python, Perl, Tcl), a couple times more homebrew scripting languages (related to the different scientific packages in use), and a slew of programs which are only accessable through the command-line. > Python aims to be a powerful general purpose >programming language, in addition to being a very easy to learn and easy >to use scripting language. And who can say that Python does not succeed >very well in all of the above? Is this what you see as Python's niche? Someone in the Perl group would say exactly the same thing, as would someone from Smalltalk, and from Ruby, and from Tcl, and from .... >But Ruby is also a more general purpose, object oriented, relatively >easy to read, language. What do you mean by "more general purpose"? I didn't see all that much in Ruby which was more general purpose than Python, especially now with the closing of the type/class dichotomy. I guess the biggest ability is being able to send a block to be evaluated. I know Smalltalk-ers love it, but to me things like 3.times do print "Ho! " end aren't as easy to explain or understand as for i in range(3): print "Ho! " (I know, I've been contaminated by years of BASIC, PASCAL, C, and C++, but so have my clients.) > Ruby folks include those who like its more >Perl-like syntax, but Ruby's core converts believe that its pure, >absolute object oriented nature exceeds those of Python and make it more >worthy to long term success. I know there's the argument that Ruby is "pure", but I think the whole "functions are really private members of the Object base class" idea is a sign of impurity, done because people are used to writing functions and not having to define a static class method like one might have to do for Java. But I think impurity is a good thing. So I think the call for purity to be a wrong argument. > They seem to see Ruby as a more modern, up-to-date version > of Python. I thought most people see Ruby as a more modern version of Perl than Python. I definitely see it as a cross between Perl and Smalltalk, with some ideas derived from Python. > They see Python as a compromise between object oriented and > procedural programming. And that's bad because ... why? Compromise is often seen as bad, yet the world works on it. Others replace the term "compromise" with "synthesis" or "fusion" or "hybrid" or many other words. The phrase "multiparadigm" is another fun one. >Be that as it may, I suspect that much of Ruby's momentum is simply due >to its newness; all things new are seen as sexy in this world of ours. >But nonetheless, Ruby has the following going for it. I agree with you. I also think people are willing to give Ruby a try, because they don't want to be seen as a fuddy-duddy. >Now, its more like a 4:3 ratio, with Python getting say, 4000 per month, >and Ruby 3000. At this rate, Ruby could pass Python is afew months, by >this measure! How do they get any work done? I can barely follow the outlines of most of c.l.py these days. Oh, and much of the development email is on a pretty high-traffic mailing list, so c.l.py doesn't reflect all the Python traffic. Then there's the various lists like for Jython and Zope, which get some Python questions. Again, talking about the fields I'm in, I've been presenting Python at computational chemisty and biology conferences for the past three years. I keep waiting for someone to ask me "what aout Ruby?", but as of yet no one has. There is one site for Ruby in bioinformatics -- bioruby.org. That site seems to be down right now, but as I recall, the packages they had were pretty minimal. They had a presentation at the last Bioinformatics Open Source Conference, but it didn't show any real advantages over the equivalent Perl. We were pushing to get a BioRuby developer at the upcoming Bioinformatics hackathon (promo: co-sponsored by O'Reilly and Electric Genetics, with support from the Open Bioinformatics Foundataion, AstraZeneca, and your's truely, Dalke Scientific Software :) We couldn't get anyone. >b. Ruby is getting alot of favorable press, and new books are coming out >now. First, Pickaxe , now, Matz' own Ruby in a Nutshell and several >others soon to be or already here. If books are a good metric, then there's also plenty of new Python books coming out (as you know from your dozen plus reviews :). And Perl ones. And Java ones. It's just easier to notice when there are only a few books. >c. Ruby actually seems to be a nice language to me. Its object oriented >features seem well thought out and yet its still easy to comprehend. I had problems with it. I could comprehend Python's features from the documentation. I still can't from the Ruby on-line docs. One thing is that Ruby objects seem so heavy-weight to me. For example, Hash has support for a built-in default object, and for "freezing" hash. So if I wanted to make a Hash-like object, I need to do quite a bit, I think. (Again, I got into Python about 6 years ago, when the dictionary object which much lighter weight than it is now, and I learned about the changes when the occured instead of all at once. Still, Python's dictionary seems conceptually easier to understand and use than Ruby's.) >d. Ruby has some smart and aggressive coders doing libraries, >extensions, Java version etc. etc. etc., tehy are agressive and >motivated; tehy think they will see world domination ;-))) They will leanr how to sepll 'tehy'? :) Python, Perl, and Java also have "smart and agressive coders" etc. For example, I've seen nothing in Perl or Ruby to match Marc-Andre Lemburg's mxTextTools, which I use for my Martel parser. >2. The economy is hurting Python's open source development model. It is? I guess I started when Guido worked at Stichting Mathematisch Centrum, before CNRI, and I don't think then he could ever work full time on Python. The recent spate of development progress has actually worried me, since I'm not able to follow all this new work, like __getattribute__ and __slots__ and new-style classes. >Without Mark Hommond's win32 work, Python would be a mere shell >of its current self. A lot of that work was when he was a contractor, before working with ActiveState. I know PythonWin 1.5.2 has no ActiveState copyright notice in it. I can't make any real statement about the people you mentioned. I can say Python developed without a lot of dedicated resources for it, so I'm not going to worry about it. Besides, why should it affect Python any less than other projects? >3. Third, Python faces the laws of large numbers. It is exceedingly hard >to continue a growth spurt past a certain point. Maybe were at that >point, maybe not. But ask yourself this; Two years from now, will you >see more Python success stories, more growth, or a leveling out? Five >years from Now? So? What's the growth curve in C? Do you see more C success stories? More growth, or a leveling out? I expect to have success stories of my own in the 2-5 year range. Frankly, for a while I was learning about better and better ways to develop software: BASIC -> Pascal -> C -> C++, then C/C++ augmented with Tcl, then Perl, then Python augmented by C/C++, which is where I'm at now. I also tried out a dozen other languages, including Prolog, APL, Lisp, and other classics, and read about more languages, including Smalltalk and Eiffel. As far as I can tell, I think the basics of the Ruby/Smalltalk/ Perl/Python/C/C++/Java/... class of languages are pretty well understood. I don't think Ruby or any similar language can offer anything sufficiently new enough to get many people to change. The only new topic my limited prognositications can make for the future is aspect oriented programming, and I don't know enough of that to make any firm statement. BTW, I think what's going to happen in Python's future is 1) refactoring browsers, like what Smalltalk has, 2) better performance through some sort of typing, and 3) the development of more specialized libraries for different domains. (Please bear in mind that I'm biased by being a library and application programmer.) >Ten years from now, will Python still be Relevant? Oh, I know that >Python will still be being used, and the community will still exist, but >will it really be a thing that seems to Matter, like it does now. I hope not. I want to have new tools and new ways of thinking on programming. It's still a lot of hassle to develop new code, and I'm a slacker in the Gen-X mold, with a short attention span. (Okay, the length of this response belies that statement :) Still, I want something better then Python, and I hope that in ten years we'll at least start using it. I also hope I'll recognize it early enough, like I did with Python. Mind you, Python's data model is still simple enough that it can be ported to other systems without much effort. Andrew dalke at dalkescientific.com From loewis at informatik.hu-berlin.de Fri Dec 21 11:44:10 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 21 Dec 2001 17:44:10 +0100 Subject: index()-like behavior that returns all occurences... References: <3C2110BE.8060300@my-deja.com> Message-ID: Lorin Hochstein writes: > I've got a list of lists, something like this: > > x = [ [1], [1,2], [], [1,2,3], [], [2], [12] ] > > I want to find the index of all of the empty lists. [...] > I know there's an index method of list, such that x.index([]) would > return "2". But I want all of the indexes, not just the first one. Is > there a simple way to do this (besides the obvious for-loop approach)? List comprehension may be not that obvious >>> [i for i in range(len(x)) if x[i] == []] [2, 4] HTH, Martin From loewis at informatik.hu-berlin.de Sun Dec 16 07:55:25 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 16 Dec 2001 13:55:25 +0100 Subject: default webbrowser References: Message-ID: Robin Becker writes: > I'm trying to use the webbrowser module, but don't seem to have a > 'default' webbrowser set up somehow. Any win32 experts know what I have > to do to get win2k to use netscape as a default browser? netscape *is* the default on Windows, but it tries to find it in your PATH. If that fails, it tries to do os.startfile to open a browser; if you manage to associate anything with the extension of the file you are trying to open, it should work with webbrowser as well. Regards, Martin From greg at cosc.canterbury.ac.nz Wed Dec 19 17:46:15 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Thu, 20 Dec 2001 11:46:15 +1300 Subject: if __name__ == "__main__" References: <5a4226f0.0112171509.30e46e05@posting.google.com> Message-ID: <3C2118B7.AB0D3F9B@cosc.canterbury.ac.nz> Kevin Cazabon wrote: > > In the namespace of the module that was the one actually executed, > __name__ will be "__main__". In all others, it will be something else > (hmmm... what will it be, never thought about it?). The name of the module! -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From cliechti at gmx.net Thu Dec 13 18:42:57 2001 From: cliechti at gmx.net (Chris Liechti) Date: 14 Dec 2001 00:42:57 +0100 Subject: Model View Presenter GUI pattern? References: <20011213172833.0bfac3c7.gry@ll.mit.edu> Message-ID: [posted and mailed] george young wrote in news:20011213172833.0bfac3c7.gry at ll.mit.edu: > Is anyone using the Model View Presenter GUI framework/pattern in > python? I've been reading bits about it, and it sounds quite > attractive. > > I've started trying to write a simple MVP module as a basis for an > application. The hardest part is dealing with the overall structure: > my app deals with a big structured data object and it's hard to picture > how the parallel trees of models, views, and presenters all get > instantiated and linked. > > Below I include my baby mvp.py file (using pygtk) for > comment/discussion. Any comments of design/implementation/style etc. > are very welcome. > > A few mvp references for the curious: > http://www.object-arts.com/Lib/EducationCentre4/htm/modelviewpresenter.h > tm > http://www.object-arts.com/EducationCentre/Overviews/ModelViewPresenter. > htm http://www-106.ibm.com/developerworks/library/mvp.html > > > import gtk > class Topw(gtk.GtkWindow): > def __init__(self): > gtk.GtkWindow.__init__(self, gtk.WINDOW_TOPLEVEL) > self.connect("destroy", gtk.mainquit) > self.connect("delete_event", gtk.mainquit) > > > class Observable: > def __init__(self): > self.observers = [] > def register(self, o): > self.observers.append(o) > def un_register(self, o): > self.observers.remove(o) > def notify(self): > for o in self.observers: > o.update(self) i prefer "notify(self, *args, **kargs)" and o.update(self, *args, **kargs) then you can give along detailed information on changes e.g. when your model is a table you can pass the row and column of the changed cell. > class Observer: > '''Just for clarity, not really needed.''' > def update(self): pass i would throw an exception here, so that you see when you forgot to override update somewhere. > class Model(Observable): > def __init__(self, value=None): > Observable.__init__(self) > self.set(value) > def get(self): > return self._value > def set(self, v): > self._value = v shouldn't notify() be called here? > def str(self): > return `self.get()` > > > class IntegerModel(Model): > def __init__(self, i): > Model.__init__(self, i) > def set(self, i): > self._value = int(i) notify()... > > class IntegerView(gtk.GtkEntry, Observer): > def __init__(self): > gtk.GtkEntry.__init__(self) > > def set(self, x): > self.set_text(`x`) > > def clear(self): > self.delete_text(0, -1) > > def update(self, mod): > self.set(mod.get()) > > > class IntegerPresenter: > def __init__(self, i=None): > self.view = IntegerView() > self.model = IntegerModel(i) > self.model.register(self.view) > self.view.connect('changed', self.changed) > > def changed(self, v): > try: > self.model.set(int(v.get_text())) > except ValueError: > gtk.gdk_beep() > > > if __name__ == '__main__': > pres = IntegerPresenter(33) > topw = Topw() > topw.add(pres.view) > topw.show_all() > gtk.mainloop() > there yould also be an diffrent solution using a proxy pattern. the proxy class implements __getattr__ and __setattr__, gets its data from the wrapped class, but also notifies all registred observers on a __setattr__ call. chris -- Chris From fperez528 at yahoo.com Mon Dec 17 10:18:56 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Tue, 18 Dec 2001 14:46:56 +2328 Subject: /usr/bin/env: python: No such file or directory References: <171220010818339518%jwbaxter@spamcop.net> <9vnvue$m5d$1@peabody.colorado.edu> Message-ID: <9vodkc$1pi$1@peabody.colorado.edu> Michael Hudson wrote: > Fernando P?rez writes: > >> It is NOT practical to expect users to write their scripts using >> #!/usr/bin/env python2, simply because that's a weird, redhat only >> default that breaks everywhere else. And what of code they download? >> Now they have to manually inspect every script they get from the web >> to replace python->python2? That's plain moronic. > > No, those scripts should use distutils, which will get it right when > it installs them. > > $ python2 setup.py install --prefix=$HOME > > Everyone should use distutils. All the time. > > Cheers, > M. > Well, not if it's a single script not intended as a package. It often happens that you find something useful on the web which is a stand-alone script. The widely accepted convention is that #!/usr/bin/env python will 'do the right thing' but unfortunately redhat breaks that. That's my beef. f. From cmkleffner at gmx.de Tue Dec 11 05:17:03 2001 From: cmkleffner at gmx.de (cmkl) Date: 11 Dec 2001 02:17:03 -0800 Subject: pyrepl-0.6 References: <3b091a1c.0112060650.1f185978@posting.google.com> <3C1531D9.1010507@yahoo.com> Message-ID: <3b091a1c.0112110217.2150c8fa@posting.google.com> Manoj Plakal wrote in message news:<3C1531D9.1010507 at yahoo.com>... > Michael Hudson wrote: > > > cmkleffner at gmx.de (cmkl) writes: > > > >>Really cool, > >> > >>during development I'm able to put several lines with > >> > >> pyrepl.python_reader.ReaderConsole(vars(), 0, None).interact() > >> > >>within the code, even inside functions! > >> > >>All I need is 'import pyrepl.python_reader' at the beginnig of > >>the module. Now I can estimate the state of the programm interactivly > >>within the scope of the function - break pyrepl with CTRL - proceed > >>with the script and take a break at the next line with pyrepl.... > >> > >>Some kind of debugging with hardcoded breakpoints or > >>'debbuging for dummies'. This is the thing I was looking for! > >> > > > > Heh, that is quite a neat idea. Certainly one that hadn't occurred to > > me. > > > > BTW, pyrepl can integrate itself somewhat into pdb (see pyrepl.py for > > details), but it's not that thorough yet. > > > > Being able to have an interactive shell inside arbitrary > points in a program is cool for debugging. BTW, this > functionality is provided by the "Interactive Debug Probe" > in Wing IDE (wingide.com). You can stop the program > at any point and then launch a shell in the context of the > stack frame where you stopped. > > Manoj Unfortunately WingIde is not available on HPUX. Does the "Ability to debug applications running on a remote host" help there? I guess not. From peter at engcorp.com Tue Dec 4 02:40:05 2001 From: peter at engcorp.com (Peter Hansen) Date: Tue, 04 Dec 2001 02:40:05 -0500 Subject: minidom References: <9uhr26$nfs$1@newsg1.svr.pol.co.uk> Message-ID: <3C0C7DD5.AC50A8CB@engcorp.com> Duncan Smith wrote: > > This may be a stupid question, but I'm struggling. I can retreive > information from an XML file (using minidom) as long as it is a node > attribute. But I cannot figure out how to get data otherwise. eg. > > > > EngineStart Leak > > good > > bad > > XPOS etc. no problem. But how (using minidom) do I retreive 'Engine Start > Leak' and 'good' etc? Anyone know of any good documentation / worked > examples for minidom? Thanks in advance. For one, you should probably start your XML document with or it won't be valid XML (but that's not necessary for this case.) You also need to close the tag at the end with or you'll get a parse error (SAXParseException). Having done that: >>> from xml.dom import minidom >>> doc = minidom.parseString(open('test.xml').read()) >>> doc.getElementsByTagName('DESCRIPTION')[0].childNodes[0].nodeValue u'EngineStart Leak' That should give you a start. Use the interactive prompt and use dir() a lot. For example: >>> dir(doc) ['childNodes', 'doctype', 'implementation', 'ownerDocument', 'parentNode'] >>> dir(doc.childNodes[0]) ['_attrs', '_attrsNS', 'childNodes', 'localName', 'namespaceURI', 'nextSibling', 'nodeName', 'nodeValue', 'ownerDocument', 'parentNode', 'prefix', 'previousSibling', 'tagName'] The API is effectively the DOM standard, so you shouldn't have much trouble if you have a reference to that handy. -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From starx at pacbell.net Tue Dec 4 01:43:48 2001 From: starx at pacbell.net (Philip Swartzleonard) Date: 4 Dec 2001 06:43:48 GMT Subject: Editing a Path References: Message-ID: Michael Kelly || Mon 03 Dec 2001 12:32:39p: > On Mon, 03 Dec 2001 11:58:41 -0800, Ben Ocean > wrote: > >>This may be slightly OT, but I need to edit my path /usr/bin/python such >>that it renders python2.1 instead of python1.5.2 >>I built python2.1 from source on an RH71 box. How do I update the path? >>TIA, >>BenO >> > Use the ln command to change the soft link. > man ln > > from the /usr/bin directory do > ls -l python > if you get something like: > python -> python1.5.2 > then it's a soft link pointing to that directory. > Just use ln to point it to python2.1 And IF it is a link and displayed like that, you can do this to change it rm /usr/bin/python ln -s /path/to/the/one/you/want/python(ver.si.on?) /bin/python If it isn't, well, maybe you could: mv /usr/bin/python /usr/bin/python152 Or something similar so that you keep it and can still use it if you need... -- Philip Sw "Starweaver" [rasx] :: From benjlee at delphi.com Sun Dec 23 15:13:55 2001 From: benjlee at delphi.com (benjlee at delphi.com) Date: Sun, 23 Dec 2001 21:13:55 +0100 (MET) Subject: Dear python-list New Lolitas Site For You Message-ID: ADULTS ONLY !! 100% FREE NEW !!! 00% FREE BEST--INNOCENT NAKED GIRLS GALLERY--FREE REAL LOLITAS SEX!!! TOTALLY ILLEGAL REAL LOLITAS FUCKING! 230 PICS ALL WITH THUMBS FOR FREE !!!! CLICK HERE http://hey.supper-teenz.com !!! REAL LOLITAS FUCKING! 230 PICS ALL WITH THUMBS From mtaylor at lowebroadway.com Tue Dec 18 09:14:50 2001 From: mtaylor at lowebroadway.com (Moray Taylor) Date: 18 Dec 2001 06:14:50 -0800 Subject: Newbie! Help with QT canvas please! Message-ID: Hi, Can anyone point out a simple example of displaying an image (PNG,JPEG, whatever) on a QT canvas using python. I have searched on Google for a couple of hours and either find short, but non-working examples, or an extract from huge program which is taken out of context so you have no idea what the hell is going on. Any help is much apprecated, please post to email aswell as newsgroup, thanks. Moray From Tom.Karas at htp-tel.de Sun Dec 30 09:15:34 2001 From: Tom.Karas at htp-tel.de (Tom Karas) Date: Sun, 30 Dec 2001 15:15:34 +0100 Subject: Call for a small program - willing to give a bonus Message-ID: <3C2F2186.52BF5D0C@htp-tel.de> Hello out there. Because of several mails, that my original posting and even the second posting on the same thread could not be found i decided to post my first posting again. I set a followup-to comp.lang.python so you will find any answers there. Sorry for any inconvenience. Hello out there, who wants to practice his skills and make the start of a language learn software. The reason: AFAIK there are just a few - if any - language learn programs under a GPL or FreeBSD-Style Licenses available - which could be run under linux and windows. I am learning spanish in an exchange with a mexican who learns german right now - and i bought several programs for windows - but none of them fulfill what a good learn software IMHO should do. One of the things that are often missing: presentation of a verb in different forms plus a few different examples: the verb to be: I am in the pool. Ich bin im Pool. You are cool. Du bist cool. He is at the movies with his sister. Er ist mit seiner Schwester im Kino. This is a quite simple example but i think this are the things one has to tackle at the beginning of learning a language The KDE project - www.kde.org - noticed a couple of weeks ago that the educational stuff under kde was kind of lagging behind. Since then there popped quite a few new programs out. But although the kde project does a great job - the programs still can't be used under windows ( at least not without a big effort). So i thought this is were python, java, ruby or even kylix/delphi could work. I do not know any of these languages but are willing to learn one (probably python) so i am not able to write the program myself, but i would help in maintenance stuff. (that would mean to type vocabulary in, to make example sentences, maintain the web site ) Later the program should also be able to play sound. I heard, this could be difficult with python !? So maybe Java would be a better bet ? I am even willing to pay a little for the solution that fits some basic needs, but because i am a student this will be more like a little bonus. For more details mail me: Tom.Karas at htp-tel.de Best regards Tom -- Trust the computer industry to shorten the term "Year 2000" to Y2K. It was this kind of thinking that got us in trouble in the first place. Adrian Tyvand From akuchlin at mems-exchange.org Sat Dec 29 22:02:20 2001 From: akuchlin at mems-exchange.org (Andrew Kuchling) Date: 29 Dec 2001 22:02:20 -0500 Subject: REPOST: Re: ETA for Win32all under Python 2.2? References: Message-ID: <9$--$$_----__$-__$@news.noc.cabal.int> Martin von Loewis writes: > I think this reliance on a single person to build a binary package is > unacceptable, especially since Mark has written all this documentation > to get others started. It is time that Win32all maintainance is > off-loaded to other shoulders. Now that the MacOS code lives in the main CVS tree, maybe the win32 code should, too. (Though not necessarily in the dist/ part; if it's too large maybe it should go into nondist/.) --amk ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Andrew Kuchling Newsgroups: comp.lang.python Subject: cmsg cancel <3dheq9if5v.fsf at mozart.mems-exchange.org> Control: cancel <3dheq9if5v.fsf at mozart.mems-exchange.org> Date: Mon, 31 Dec 2001 01:21:11 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774415 27193 211.57.49.2 (31 Dec 2001 04:53:35 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:53:35 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From fgranger at alussinan.org Fri Dec 14 11:58:20 2001 From: fgranger at alussinan.org (=?ISO-8859-1?Q?Fran=E7ois_Granger?=) Date: Fri, 14 Dec 2001 17:58:20 +0100 Subject: Deprecate tabs for indenting References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BD39F.D43D4FF7@mega-nerd.com> <3c0be454$1@207.229.64.20> <3C0BE5D5.4386B359@mega-nerd.com> <3c0bf170$1@207.229.64.20> Message-ID: <1f4es93.1erk6gs1w9rjswN%fgranger@alussinan.org> Peter Bismuti wrote: > With just a little bit of effort we can all learn to live together in > harmony. If Python 'tabbers' vs. 'non-tabbers' can't work out their > differences and learn to live together, what hopes do the Israelis and Arabs > have for god's sake! Well with the US attitude, they will never be able anyway. PS: Stupid answer, I know. -- un jardin peut-il ?tre non naturel ? ce qui n'est pas naturel peut-il ?tre un jardin ? qu'est-ce qu'une mauvaise herbe ? part une herbe naturelle ? un jardin sans herbe est-il un jardin ? - Richard From DeepBlue at DeepBlue.org Mon Dec 10 09:23:34 2001 From: DeepBlue at DeepBlue.org (DeepBlue) Date: Mon, 10 Dec 2001 08:23:34 -0600 Subject: python cgi questions References: <8SRQ7.22622$zp5.1091695@typhoon.austin.rr.com> <5a4226f0.0112092040.5cf0cab1@posting.google.com> Message-ID: "Kevin Cazabon" wrote in message news:5a4226f0.0112092040.5cf0cab1 at posting.google.com... > I'd suggest going at it the other way around: > > Use a normal submit button for the form, and include an onclick to > update the href location of the frame to the downloaded file. Kind of > like: > >
> > onclick="_self.location.href='/downloads/file.exe'"> >
> I tried that and it would not work. It just ran myform.cgi I changed the type from submit to button. Then it would download the file but the form is not submitted. DeepBlue > I believe that will do what you want... try it out though first, of > course, it's written off the top of my head. > > No cgi is really needed here, except myform.cgi for taking the info > from the form and updating the database. You could even use a > variable value in the onclick so that it downloaded a file specified > by some other item on the form. > (onclick="_self.location.href=self.form1.selectfieldname.value" > > Kevin Cazabon. > > > > "DeepBlue" wrote in message news:<8SRQ7.22622$zp5.1091695 at typhoon.austin.rr.com>... > > I have the following cgi python question. > > I need to allow users to download files through a series of HREF links. > > But also I need to be able to update a database table when a user clicks on > > the link. > > So, each file to be downloaded is in its separate Form. And each link has > > an ONCLICK event that submits the form for the corresponding file. When the > > form is submitted I was hoping that the database is updated with values in > > hidden fields in each form, and the user can download the file. > > But, I can accomplish only one thing: either the form is submitted or the > > file is downloaded. > > Can both things be accomplished: > > 1. File is downloaded when link is clicked, and > > 2. Form is submitted through onclick event in javascript > > (onclick=document.form.submit) > > > > > > Also, is it possible using a python script to submit a form in the > > background without anything being returned to the browser? > > In this case, I send the information via the python script (form submitted) > > and the database is updated, but nothing is returned to the browser so that > > the current page stays as is. > > Thanks for any help or hints, > > DB From rdsteph at earthlink.net Sun Dec 30 10:26:49 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sun, 30 Dec 2001 15:26:49 GMT Subject: Parrot aka Perl 6 info Message-ID: <3C2F3307.B47C9E26@earthlink.net> This is a follow on to thread from here that Dan Sugalski (perl implementer) posted over on comp.lang.ruby, that didn't show up here. I copy it here fyi only, just to show the firm intent of the Perl implementers to create a runtime that will run both ruby and Python as well as Perl. FWIW::: The folks over at comp.lang.ruby ae quite interested in this. I suppose if anyone has any follow up questions, they could be directed to Dan at his email address listed at the end of his post. I wonder how valuable such a "new runtime environment" for Python might be? I wonder if the Python core team is well aware of the Perl 6 efforts? At 07:57 PM 12/29/2001 -0800, ptkwt at aracnet.com wrote: >In article <5.1.0.14.2.20011229222259.0206fe80 at pop.sidhe.org>, >Dan Sugalski wrote: > >At 09:57 AM 12/30/2001 +0900, Ron Stephens wrote: > >>However, for what its worth, the PERL 6 implements, whom I met and > conversed > >>with at the MIT Lightweight Languages conference, are definitely > truing, as a > >>goal, to create a PERL 6 runtime environment that can easily and credibly, > >>someday later on, run Perl, Ruby, and Python. I suppose that could be > >>additional > >>runtime environments for these languages, just like Jython is an additional > >>runtime environment for Python. Maybe that could work, and give some of the > >>advantages of "bringing the tow (or , in this case, three) streams if > >>development back togethers into one mighty river. > >> > >>I am a doubter about this, btu who knows? > > > >Oh, don't doubt. We've pulled it off already, to an extent, with the perl 5 > >engine, and that's a mess as these things go. > > > >Technically, an engine capable of running all three languages (and more) is > >pretty trivial as these things go. Inter-language calling conventions are > >the toughest and that's not really tough at all. The politics involved are > >by far the biggest hurdle, and they exceed the technical difficulties by > >many orders of magnitude. > > > >Having said that, Parrot will be *capable* of running perl, python, and > >ruby. (Whether there's a full-blown language parser for python and ruby is > >up in the air--I'm all for the ruby parser in ruby, as that'd make my life > >really easy. > >So what do we have to do? Parse Ruby and spit out Parrot bytecode, right? For now, yep. Once we get things situated right, you won't even need to spit out bytecode. Spitting out a full AST would be sufficient, which then gets fed into the compiler module. >I think there is a project or two out there to create a Ruby parser in >Ruby. JRuby could always be modified, I suppose, to become PRuby - that >might be another option. Sure, and if you have a ruby parser in ruby, we can run it through the ruby engine as it stands now and spit out ruby bytecode. We run that through the ruby bytecode->parrot bytecode converter (which is already partially written) and get parrot bytecode which we then freeze to disk and poof! we have a working parser. > >We'll have full bytecode translators, but those are trivial > >compared to parsing the languages) Even if it's not fully used, it'll make > >Parrot a better engine. > > > >And anyway, at this point I can wave the "Hey, look, we have a JIT!" flag > >to entice people into writing a ruby parser for Parrot... :) > >I think that there are a lot of Rubyists out there who want to see a Ruby >parser for Parrot and some who would even be willing to work on it. Hey, >wouldn't it be cool if we could get there before the Pythonistas? Yep, darned cool. Heck, we don't have a full perl parser yet--you could even beat us! (Which, personally, I think would be amusing) Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai dan at sidhe.org have teddy bears and even teddy bears get drunk From cliechti at gmx.net Sun Dec 30 07:33:22 2001 From: cliechti at gmx.net (Chris Liechti) Date: 30 Dec 2001 13:33:22 +0100 Subject: values of sys.platform? for a serial port lib References: <3C2E543D.4BFB07D@engcorp.com> <3C2E82A5.D4E1EEB3@engcorp.com> Message-ID: Peter Hansen wrote in news:3C2E82A5.D4E1EEB3 at engcorp.com: > Chris Liechti wrote: >> i also have an optional argument to specify the port string, but when >> this is used it isn't portable anymore. > > Just a thought, but could you make this the same argument as > the port number, allowing either an integer or a string? > I could also see a benefit, in a cross-platform serial-port app, > in having a method to return the actual device name in use, for > display/troubleshooting purposes, even if specified as a number. minutes after i wrote the that message, i changed the code so that it is the same argument that takes a number or a string. i'll add a method to return the device name. > You may know this already, but in Windows you need to use > "overlapped" I/O operations if you want to be able to have > a read thread and a write thread waiting independently on > operations on the same serial port. Without this, any time > one thread is blocked waiting for results for its operation, > the other thread will also block when it tries to access the > device even if its operation would not otherwise block. > (Or something like that... I don't know the full details > behind it, only what I learned trying to implement a win32file- > based serial port class which didn't have this limitation.) it uses overlapped io. it's roughly based on the serial example that comes with the win32all package. chris -- Chris From aahz at panix.com Sat Dec 22 13:35:55 2001 From: aahz at panix.com (Aahz Maruch) Date: 22 Dec 2001 10:35:55 -0800 Subject: Search the difference: Why this function defenition does'nt work? References: <3C24A967.3070604@student.kun.nl> <3C24B3AE.8060103@student.kun.nl> <3C24C8DD.4090300@home.com> Message-ID: In article <3C24C8DD.4090300 at home.com>, Luke wrote: > >If you use a list index [0] that returns a single element of the type >that that element is (which is what you want in this case). But when >you use the colon for slice notation, you are asking python to return a >tuple of all the elements up to the zeroth element, which is no >elements--an empty tuple. Then you are trying to add a number to a >tuple which is undefined. s/tuple/list/ -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 9 days and counting From dsavitsk at e-coli.net Fri Dec 7 18:12:00 2001 From: dsavitsk at e-coli.net (dsavitsk) Date: Fri, 07 Dec 2001 23:12:00 GMT Subject: COMServer graphical output References: <_6tP7.5693$Rw2.4095674@newssrv26.news.prodigy.com> Message-ID: <41cQ7.5860$Rw2.4209089@newssrv26.news.prodigy.com> "Jens Gelhaar" wrote in message news:efc75b6a.0112052311.2345f838 at posting.google.com... > "dsavitsk" wrote in message news:<_6tP7.5693$Rw2.4095674 at newssrv26.news.prodigy.com>... > > It doesn't seem that this is a COM question at all? The COM server should > > get the data from Access, do whatever to the data, then return it as per > > normal. > > What I trying to do is: The GUI is sending me same datas and I like to > return a chart as a bitmap or something else. I know, I could write > the bitmap in a file and open the file from the GUI, but this is > simply to slow. > * * * The best way to do this is to do the processing on the client side. return the data that will make the chart and use a VB charting ocx to generate it. also, see python programming on win32 (pg 166) on how to use excel to do this. -d From peter at engcorp.com Sat Dec 29 18:39:41 2001 From: peter at engcorp.com (Peter Hansen) Date: Sat, 29 Dec 2001 18:39:41 -0500 Subject: values of sys.platform? for a serial port lib References: Message-ID: <3C2E543D.4BFB07D@engcorp.com> Chris Liechti wrote: > > i've written a portable serial port library. it runs now on linux and win32 > (using marks win32all) but i would like to make it compatible with more > unix like platforms. basicaly it should run on any POSIX compilant system. > > i'm interested in values for "sys.platform" and, if possible, the name of > the serial port (an how the ports are numbered ttyS0, ttyS1 etc.) > e.g "linux2" and "/dev/ttyS%d" % port, numbering starting at zero. Between links on Unix, third-party serial port devices under Windows which might not use the COMx convention, and other such variations, I'd strongly recommend you *not* try to use an index origin of 0 but instead pass the open() routine (or whatever you have) a *string* naming the serial port. By the way, does your win32 implementation work well with threads, if one thread is trying to read from the port while the other is trying to write to it? -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From amuys at shortech.com.au Thu Dec 13 21:47:25 2001 From: amuys at shortech.com.au (Andrae Muys) Date: 13 Dec 2001 18:47:25 -0800 Subject: Sorting things into bins References: Message-ID: <7934d084.0112131847.5edeab70@posting.google.com> "Sean 'Shaleh' Perry" wrote in message news:... > def sorter(bins, item): > bin = item[-2:] > bins.setdefault(bin, []).append(item) > > mylist = ['0102', '0302', '1242'] > mybins = {} > map(lambda x: sorter(mybins, x), mylist) > print mybins ... and just because I think List Comprehensions are really cool..... >>> mylist = ['0101', '0102', '0103', '0201', '0202', '0203'] >>> [bins.setdefault(s[-2:], []).append(s) for bins in [{}] for s in mylist] [None, None, None, None, None, None] >>> print bins {'02': ['0102', '0202'], '03': ['0103', '0203'], '01': ['0101', '0201']} Andrae Muys From aleax at aleax.it Fri Dec 28 07:56:21 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 13:56:21 +0100 Subject: REPOST: Re: install Python2.2 question References: Message-ID: <3$--$$_--__-%%$%%$@news.noc.cabal.int> "Tim Hammerquist" wrote in message news:slrna2ltdp.sjg.tim at vegeta.ath.cx... ... > If you have a sufficient devel environment and you are up to the > challenge, you can try to build Python yourself, but it may be more > trouble than it's worth if you're new to linux. How so? tar xzf, cd, ./configure, make, sudo make install -- how much trouble can that be? Alex ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!nntp1.roc.gblx.net!nntp.gblx.net!nntp.gblx.net!newsfeed.cwix.com!sunqbc.risq.qc.ca!newspeer.cwnet.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail Message-ID: Control: cancel Subject: cmsg cancel From: "Alex Martelli" Newsgroups: comp.lang.python X-No-Archive: yes Lines: 2 NNTP-Posting-Host: wonenara.ozemail.com.au X-Trace: ozemail.com.au 1009643010 203.108.164.177 (Sun, 30 Dec 2001 03:23:30 EST) NNTP-Posting-Date: Sun, 30 Dec 2001 03:23:30 EST Organization: OzEmail Ltd, Australia Distribution: world Date: Sat, 29 Dec 2001 15:50:29 GMT This message was cancelled from within Mozilla. From boud at rempt.xs4all.nl Sun Dec 23 08:03:06 2001 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 23 Dec 2001 13:03:06 GMT Subject: SnoPy 0.1 - SNOBOL pattern matching for Python References: Message-ID: Don Rozenberg wrote: > This is the first release of SnoPy, a Python extension build on > GNAT.SPITBOL.PATTERNS which provides many features of SNOBOL pattern matching > to the Python developer. It is released under the GPL. The home site for > SnoPy is http://snopy.sourceforge.net. There is an extensive users guide > including a SNOBOL pattern matching tutorial. Cool! I learnt SNOBOL at University and wrote a poetry analyzer for Old Norse poetry in it. It's a pity I can't get SnoPy to compile yet -- I did look for a list of dependences, but couldn't find it. I suspect I am missing something. -- Boudewijn Rempt | http://www.valdyas.org From martin at v.loewis.de Sun Dec 30 09:24:51 2001 From: martin at v.loewis.de (Martin v. Loewis) Date: 30 Dec 2001 15:24:51 +0100 Subject: REPOST: Re: How can I display unicode in Tk widget References: <9vkqm7$fqo83$1@ID-12869.news.dfncis.de> <9vnou6$gpvgr$1@ID-12869.news.dfncis.de> <9vunds$hiile$1@ID-12869.news.dfncis.de> Message-ID: <8$--$$_----___-_$$@news.noc.cabal.int> "Kick" writes: > Could someone help me? With the code you have given, it is still difficult to understand your problem: You fetch the string from the database, but we do not know what the string is. Could you please modify your program to print the type and value of f, then modify it to use the value literally, i.e. without any use of SQLite. Or, to try this vice versa, please execute the program import Tkinter l = Tkinter.Label(text=u"\u5321") l.pack() l.tk.mainloop() on your system. On my system (Python 2.2 on Windows XP), it displays a window with a single Chinese character (which I picked arbitrarily, since I don't speak Chinese). What does that very program do on your system? If it fails, which Python version and Windows version are you using? Regards, Martin ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: martin at v.loewis.de (Martin v. Loewis) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:06:16 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774227 27193 211.57.49.2 (31 Dec 2001 04:50:27 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:50:27 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From debl2nonoabolutelynospam at bellatlantic.net Wed Dec 5 23:52:43 2001 From: debl2nonoabolutelynospam at bellatlantic.net (David Lees) Date: Thu, 06 Dec 2001 04:52:43 GMT Subject: Distant learning Python classes? References: <3c0e80f6.4856295@news> Message-ID: <3C0EF9A0.D37398BD@bellatlantic.net> You might look at a link off the python.org home page: http://www.python.org/doc/Newbies.html debl Phredd Phlintstone wrote: > > I am new...not only new to Python, but new to computer programming. > I'm eager to learn but am looking for a bit more structure than just > reading a book and 'jumping in.' I am reading a book, and it's making > sense even... > > Any online 'distant learning' classes in Python? I've found a few on > different languages (free even) at: http://www.free-ed.net/catalog/ > but as you see, no Python is offered. Perl, but no Python. > > If you know of any online learning classes, please post the addresses > in the group. Thanks. > Please post any responses to this to this newsgroup. From importbinascii Sun Dec 2 16:54:24 2001 From: importbinascii (Eugene) Date: Sun, 2 Dec 2001 13:54:24 -0800 Subject: Newbie: searching an English dictionary for a reg exp References: <3c09f02f.97177874@news.akl.ihug.co.nz> Message-ID: I see a couple problems. First, the regular expression you're using, "abas?", actually means "match 'aba' with zero or one occurances of 's' after it." If you mean "match 'abas' with precisely one occurance of any character after it," you want "aba." [sic]. Second, "reg.match(regpattern)" will always match, because you're asking a regular object to match against itself. You wanted to try and match the pattern against each dictionary word in the loop, so you want to replace "regpattern" in that line with "word", like: > # search thru dictionary - print all matches > for word in dictionary: > m = reg.match(word) #[EG] change is in this line > .... Third, and this may not be a problem, it may have been intentional, the pattern you've chosen there is case-sensitive because the "re" module does case-sensitive matching unless you tell it otherwise. To do case-insensitive matching you would either change your pattern from 'abas.' to "(?i)aba." or change the line where you compile it from "reg = re.compile(regpattern)" to "reg = re.compile(regpattern, re.I)". On another note, if you're going to be searching through the entire dictionary every time, you might do the matching as you're going through the dictionary line-by-line and only store in your list the words that match. (Unless you needed to have stored the other words for some other purpose, I mean.) And finally, there are a couple of different ways to use the "re" module for most problems. In this reply you've seen there are two ways to turn on case-insensitivity (I don't know if the one using re.compile is faster than the other), and in the Python 2.1 Doc section 4.2.3 ([re] Module Contents) right at the top they say you can use re.compile or just put the pattern directly into re.match, but one can be more efficient. Note also the subtle difference between re.search and re.match - I've tried to use re.match more than once when I really wanted re.search because I wanted to search in the middle of the string.... -Eugene "^^@++" wrote in message news:3c09f02f.97177874 at news.akl.ihug.co.nz... > I want to search through the entire English language for a given > regexp. > > So, I'll have say a 'dictionary.txt' file which contains every English > word. > > Since I don't understand how python regexps work I'm kinda stuck. > > My guess is I should be doing something like: > ##################################### > import re > import string > > # heres our regpattern - once I get it going I'll read > # regpatterns from a file > regpattern = 'abas?' # should return 'abash' and 'abase' > > dictionary = [] > dictfile = open('dictionary.txt', 'r') > line = dictfile.readline() > while line != "": > dictionary.append(line) > line = string.strip(dictfile.readline()) > > reg = re.compile(regpattern) > > # search thru dictionary - print all matches > for word in dictionary: > m = reg.match(regpattern) > if m: > print m.group() > > ##################################### > This doesn't word properly - so how do I print each word that matches? > > Have I gone about this in the correct way? Having the entire > dictionary in memory could be dodgy I guess... > > Thanks > -Matt From peter at engcorp.com Wed Dec 26 21:06:26 2001 From: peter at engcorp.com (Peter Hansen) Date: Wed, 26 Dec 2001 21:06:26 -0500 Subject: try-except-finally question References: Message-ID: <3C2A8222.88C383A6@engcorp.com> "Igor V. Rafienko" wrote: > > try: > > > > > > except ExternalFactorError: > > except DBError: > > > I have 2 questions: > > * In the innermost try-except there is a possibility for other > exceptions than ExternalFactorError and DBError. How can I catch > _all_ other exceptions than these two[*]? I'm not so much interested > in error itself, but rather whether it occured. I.e. I'm looking for > C++'s "catch (...)" construct in Python. A simple "except:" will do the trick. Importing sys and using sys.exc_info() would let you find the details, per examples you could find posted in comp.lang.python/ in the mailing list archives. Remember to follow up with a "raise" to re-raise the exception, after you've recorded the fact of its occurrence. > [*] is there a type that _all_ python object inherit from? (I know > about exceptions.Exception, but I do not want to rely on whether third > party modules actually inherit from it) Nope (although 2.2 adds the new "object" class which moves in this direction). But I think it's considered bad form *not* to derive from exceptions.Exception, and I've read that raising strings instead of objects may eventually be deprecated. You could always do "except Exception:" followed by a totally general "except:" with the latter being considered a fatal error if you wanted to double-check a 3rd party lib. -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From bokr at accessone.com Tue Dec 11 18:41:53 2001 From: bokr at accessone.com (Bengt Richter) Date: Tue, 11 Dec 2001 23:41:53 GMT Subject: PEP 276 Simple Iterator for ints (fwd) References: <3c169178.96189593@wa.news.verio.net> Message-ID: <3c169813.97880965@wa.news.verio.net> On Tue, 11 Dec 2001 23:15:23 GMT, bokr at accessone.com (Bengt Richter) wrote: >On Tue, 27 Nov 2001 10:27:31 -0800, James_Althoff at i2.com wrote: > >> >>Greg Ewing wrote: >>>While trying to think of a range syntax that looks >>>unambiguously half-open without clashing with list >>>or tuple constructors, the following blindingly >>>obvious solution occurred to me: >>> >>> for 0 <= i < 5: >>> ... >> >>Greg, >> >>Since this looks like a suggestion for replacing xrange in the general >>case, did you have any thoughts on how one might specify a step value? >> > >How about if a bare [x:y:z] were interepreted as an abbreviation for slice(x,y,z) >and you defined what one might expect as an iterator for the slice type? > >Then you could write > for i in [0:5]: # or [:5] > ... > Oops, I forgot to mention steps ;-) for i in [0:5:2]: # or [:5:2] ... From loewis at informatik.hu-berlin.de Fri Dec 28 18:26:47 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 29 Dec 2001 00:26:47 +0100 Subject: REPOST: Re: Running MySQLdb under solaris and python 2.1 References: <3d504fd.0112281335.45ca330@posting.google.com> Message-ID: <3$--$$_-----$$%__$@news.noc.cabal.int> beyer at incent.com (hugh) writes: > ImportError: ld.so.1: python: fatal: libmysqlclient.so.10: open > failed: No such file or directory > >>> > > So it's finding the MySQLdb package; it's loading the _mysql.so > module; and then it's failing to link in the libmysqlclient. (right?) > I've found libmysqlclient but I can't get it into the right directory > so the system can link it in--usr/local/bin (where the python program > is), usr/local/lib and usr/local/lib/python2.1 all don't work. > > Is there some magic place for it? The system only looks in /lib and /usr/lib, see ld.so(1). You can hard-code additional directories to search for libraries inside _mysql.so, by passing a -R option to the linker, e.g. cc -G -o _mysql.so -R/myhome/lib -L/myhome/lib -lmysqlclient See ld(1) for a description of the -R option. > Is there some environment variable I can set so it can be found? Yes, LD_LIBRARY_PATH, see ld.so(1). HTH, Martin ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Martin von Loewis Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:29:15 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774986 27193 211.57.49.2 (31 Dec 2001 05:03:06 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:03:06 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From dan at cgsoftware.com Fri Dec 14 19:11:07 2001 From: dan at cgsoftware.com (Daniel Berlin) Date: Fri, 14 Dec 2001 19:11:07 -0500 (EST) Subject: CPython internal design question In-Reply-To: Message-ID: On Fri, 14 Dec 2001, Courageous wrote: > > >In this case "im" is (presumably) short for Instance Method, in all cases it > >makes it easy to find field references in the code base via simple search > >mechanisms, and in some cases it's a helpful reminder of what kind of object > >referencing code is mucking with. Note that there are more than 5,000 > >instances of the identifier "self" in the C portion of the Python code base. > >If you're specifically looking for uses of "self" in instance method > >structs, that there are only 18 hits on im_self greatly eases the task. > > > >the-simpler-the-conventions-the-simpler-the-needed-tools-ly y'rs - tim > > That makes sense, thanks. I'll have to consider that in light of > other projects. It's a good convention. Of course one convention > that Python uses internally that really annoys the devil out of > me is defining functions like this: > > ReturnType > MyFunction ( ... ); > > Why? probably so you can find the definition of the function easily. grep ^MyFunction will find it, without getting false hits on uses. From ykingma at accessforall.nl Sun Dec 9 15:36:37 2001 From: ykingma at accessforall.nl (Ype Kingma) Date: Sun, 09 Dec 2001 21:36:37 +0100 Subject: __subclasses__() (was OK, now *this* is cool) References: <3C112086.5F7072A9@accessforall.nl> <3C13404D.F7A60179@accessforall.nl> Message-ID: <3C13CB48.D1357B4C@accessforall.nl> Martin, you wrote: > > Ype Kingma writes: > > > Do I understand correctly that subclass references are weak links > > because a subclass may disappear (become not live) and a normal subclass > > reference could then keep the subclass accessible only because the > > of the existence of the normal subclass reference in the super class? > > Yes, but it is worse: the subclass also holds a reference to the base > class (in __bases__), so you would get a cyclic reference. That means > that even if both the subclass and the derived class become garbage, > they would be still alive until the cyclic garbage collector finds them. > > > To avoid this problem (superfluous reference to subclass) weak links are > > used so that the garbage collector can free the subclass when expected. > > If all goes well, the cyclic garbage collector won't even see the > subclass. The normal reference counting should drop them as soon as > the last strong reference is lost. > I am more familiar with the Jython source code than with CPython's source code, and Jython leaves all it's garbage collection to the Java VM. This simplifies the Jython source code (a lot, no reference counting anywhere). On the downside it is more difficult to have a method executed when an object becomes garbage. > > When a real reference is needed as a result if the __subclasses__() method > > this method then checks all weak references and (atomically) > > creates normal references from the ones that are still valid. > > Exactly. The __subclasses__ attribute could also report the list of > weak references; it is primarily for convenience (I think) that it > does not. > > Furthermore, the functional notation immediately removes the idea that > you may want to assign to __subclasses__, or otherwise modify the > result list (you can modify the result list, but that has no effect). > I found that also mentioned in the CPython source CVS, which is currently the only result when searching for __subclasses__ in google. You can manipulate __bases__, but not __subclasses__(). > > Superclass references should be normal references because they > > are needed to find attributes by inheritance. > > Right. A superclass must stay alive as long as there are subclasses, > which must stay alive as long as there are instances. > > > I suppose the cycles you mention are not direclty related to the former > > python problem that the garbage collector could not get rid of objects > > in cycles? > > Historically, absence of both weak references and collection of cycles > would have prevented introducing the feature in Python. It turns out > that strictly speaking, you need only on or the other, and that > collection of cycles is more general. > > However, people still like the CPython property that objects normally > go away once the last application reference is lost; that saves memory > and computation time (since the cycles collector won't have to deal > with such objects). In this specific case, weak references are they > means to preserve this desirable property. > (I end up using try/finally more in jython to have methods executed before objects become garbage. It's cleaner I think, but that is another discussion.) Java's weak references might be a good way of implementing __subclasses__() in jython. I'd better shut up on this, or people might start asking for patches... Thanks again, Ype From peter at engcorp.com Mon Dec 3 23:53:16 2001 From: peter at engcorp.com (Peter Hansen) Date: Mon, 03 Dec 2001 23:53:16 -0500 Subject: D-H, buffered socket and ssh wrapper modules in pure python References: <9ugne1$7ot$1@news.service.uci.edu> Message-ID: <3C0C56BC.DEEFF2C2@engcorp.com> > A coworker has written an ssh wrapper module. Is anyone interested in > seeing it? I could dig up permission from him to release it I think, > and I'd personally kind of like seeing it get some peer review. Interested. If it will help, I hereby promise not to use it in any commercial manner or redistribute it without more explicit permission from the author. I would, however, be interested in at least seeing, learning what I can from it, and possibly providing feedback, depending on what it can do. (I have some small personal applications I've been considering which would require Python wrapping ssh, but haven't progressed beyond the "neat idea" stage. Your coworker's module this might help.) Cheers, -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From fdrake at acm.org Tue Dec 18 12:26:36 2001 From: fdrake at acm.org (Fred L. Drake) Date: Tue, 18 Dec 2001 12:26:36 -0500 (EST) Subject: [development doc updates] Message-ID: <20011218172636.9E823286BC@cj42289-a.reston1.va.home.com> The development version of the documentation has been updated: http://python.sourceforge.net/devel-docs/ Added documentation for pydoc. Misc. other fixes. From phd at phd.pp.ru Wed Dec 19 23:32:12 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Thu, 20 Dec 2001 07:32:12 +0300 Subject: Can I change a unicode char to gb2312 using python? In-Reply-To: <9vrj7s$hd448$1@ID-12869.news.dfncis.de>; from store_li@sina.com on Thu, Dec 20, 2001 at 10:41:14AM +0800 References: <9vq6d9$gvc5p$1@ID-12869.news.dfncis.de> <9vrj7s$hd448$1@ID-12869.news.dfncis.de> Message-ID: <20011220073212.D22021@phd.pp.ru> On Thu, Dec 20, 2001 at 10:41:14AM +0800, Kick wrote: > Thank you! But what I want to change is a variable. How can I use this > method? Just f.encode("gb2312")? > > But python told me that out of range(128).What shall I do ? http://www.python.org/cgi-bin/faqw.py?req=show&file=faq04.102.htp Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From jwbaxter at spamcop.net Fri Dec 28 10:11:39 2001 From: jwbaxter at spamcop.net (John W. Baxter) Date: Fri, 28 Dec 2001 07:11:39 -0800 Subject: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B5E9F.FF1C2CC@bellatlantic.net> <3C2B941D.B1E45AA5@htp-tel.de> Message-ID: <281220010711395869%jwbaxter@spamcop.net> In article , DeepBleu wrote: > NNTP is an internet protocol like SMTP, POP3 and HTTP for communication. > Also, it is the oldest one and it used to be the most instructive before AOL > hit the scene along with the 'gold rush' :) Old enough to include transfer of messages on reels of magnetic tape aboard ships to get them to, eg, Australia and back. > Ask your ISP if they offer NNTP support through their own server. "Own server" seems a little strong these days. ISPs are increasingly outsourcing the news server operation. I know my life became MUCH simpler--and our range of news groups much larger--after we outsourced. Even given the provider changes which have happened since, the network issues, etc. Not only is NNTP quite old...the server implementations tend to be rather cantankerous. Now, if your ISP offers shell access (we stopped doing that in 1994), there's more advantage to "own server." --John From phd at phd.pp.ru Fri Dec 21 05:45:32 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Fri, 21 Dec 2001 13:45:32 +0300 Subject: mime decoding In-Reply-To: ; from ldwhitley@charter.net on Thu, Dec 20, 2001 at 03:58:06PM -0600 References: Message-ID: <20011221134532.J5332@phd.pp.ru> On Thu, Dec 20, 2001 at 03:58:06PM -0600, ldwhitley at charter.net wrote: > simply. However, I've spent most of the afternoon looking at mimetools, > rf822, quopri, and mimify and still don't have a good idea of how to proceed > for mime messages. Any suggestions would be welcome (please include a > short example, if possible). http://phd.pp.ru/Software/Python/#extract_mime http://phd.pp.ru/Software/Python/#mimedecode For faster mirrors replace phd.pp.ru with phd.by.ru or phd2.chat.ru. Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From skip at pobox.com Sat Dec 1 15:47:03 2001 From: skip at pobox.com (Skip Montanaro) Date: Sat, 1 Dec 2001 14:47:03 -0600 Subject: Whatever happened to String Interpolation? In-Reply-To: <9ubecn$ped$1@peabody.colorado.edu> References: <9u6dbn$nsj$1@peabody.colorado.edu> <9u6kft$5b$1@peabody.colorado.edu> <9ubecn$ped$1@peabody.colorado.edu> Message-ID: <15369.16839.673675.775918@beluga.mojam.com> fp> Andreas Kostyrka wrote: >> What about "%%%(x)s%%" % locals() fp> I'm looking for _clarity_ in the code. I've already written enough fp> perl code in my life for things like that. Well, what happens to the next person who comes along and wants to embed literal $ in his/her interpolated strings? I believe using your scheme (or the PEP 215 scheme) they wind up with something like "$$$x$$" % locals() or "$$${x}$$" % locals() (or something else similar) which isn't all that readable either. You just happen to want to embed literal %-signs in your strings. Please correct me if I'm wrong, but changing the character that introduces a value to be interpolated just moves the problem around a bit. I don't think it solves anything. -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From rdelon at hotmail.com Tue Dec 11 06:16:34 2001 From: rdelon at hotmail.com (=?ISO-8859-1?Q?R=E9mi_Delon?=) Date: 11 Dec 2001 03:16:34 -0800 Subject: Finding out if a python binary has been compiled with or without pymalloc Message-ID: Hi, I'd like to know if there is a way to find out if a python binary distribution has been compiled with or without pymalloc. My website hosting machine has python2.1 installed on it, but I don't know where this distribution comes from. I only have access to the python2.1 binary, and I'd like to check if it uses pymalloc or not. Thanks. R?mi. From use-net at schabi.de Tue Dec 4 05:10:22 2001 From: use-net at schabi.de (Markus Schaber) Date: Tue, 4 Dec 2001 11:10:22 +0100 Subject: Printing from Windows References: <9ui1ki$lfv$1@news.netpower.no> Message-ID: <20011204111022.682cc9dc.use-net@schabi.de> Hi, On Tue, 4 Dec 2001 09:35:44 +0100 "David Brown" wrote: > It doesn't look like there is much hope for using Tkinter for printing, > so I'm generalising my original question. > > Are there any good ways to make a printout from a Python program? I'll > be running mostly on Windows, but I'd much prefer a cross-platform > solution for later migration to Linux. Sure, I could use the Win32 api > directly - but that is the sort of thing I am trying to avoid with > Python + Tkinter. There must surely be thousands of developers out > there with the same problem. > > Any hints or ideas would be much appreciated. Maybe the gtk+ printing works with windows and unix in the same way. This has the disadvantage that gtk+ is not part of standard python, but there are some extreme powerful widgets there (including embedding the mozilla engine). markus -- "GPL software is not free - the cost is cooperation" From km-list-python at miazine.net Tue Dec 18 09:20:16 2001 From: km-list-python at miazine.net (Kirill Miazine) Date: Tue, 18 Dec 2001 15:20:16 +0100 Subject: Python equivalent to @lines = 'command'; In-Reply-To: References: Message-ID: <20011218152016.C22781@poff.miazine.net> * Christer Frovik <013-139047 at telia.com> [20011218 14:09]: > Is is possible to spawn a command (any command not just ls) > and have all the lines that the command outputs stored in a list? > > In PERL this is done quite nicely in a single statement: > > @files = `ls -1`; > > and you can then iterate over @files and do whatever you want. > Any ideas, or should i stick with Perl for my mindless scripts? import os files = os.popen("ls -1").readlines() -- Kirill From brian.hare at highmark.com Tue Dec 4 12:18:01 2001 From: brian.hare at highmark.com (brian.hare at highmark.com) Date: Tue, 4 Dec 2001 12:18:01 -0500 Subject: Script at boot Message-ID: <200112041712.fB4HCQi01133@igate.highmark.com> I'm not a python programmer (yet), but I am a JavaScript programmer to a degree. My questions is this: Can a Python script be made to run at every boot/reboot? My project is this: I've got Familiar linux running on an Ipaq handheld PC. I need a script to run every time the device is rebooted. Is this possible with python? It's kind of the equivalent of putting something in startup folder of windoze I suppose.... T. Brian Hare Highmark Desktop Technology Consulting 717 612 4882 From MarkH at ActiveState.com Mon Dec 3 17:23:51 2001 From: MarkH at ActiveState.com (Mark Hammond) Date: Mon, 03 Dec 2001 22:23:51 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BE445.2D4EDF72@mega-nerd.com> <3C0BF1C2.E12421D0@attbi.com> Message-ID: <3C0BFBFF.8010001@ActiveState.com> William Park wrote: > On Mon, Dec 03, 2001 at 01:42:26PM -0800, Chris Barker wrote: > >>Erik de Castro Lopo wrote: >> >>>How about a counter proposal? >>>Reject all .py files with spaces for indentation. >>> >>Either one would be fine with me...and better than allowing either >>(especially mixed...Yikes!!!) >> > > I don't care! Just set the standard, be done with it. Please, no more > on this issue... The standard has already been set - http://www.python.org/doc/essays/styleguide.html Mark. From loewis at informatik.hu-berlin.de Wed Dec 26 19:20:02 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 27 Dec 2001 01:20:02 +0100 Subject: Properties fun with 2.2 References: Message-ID: "Mike C. Fletcher" writes: > The "only defined properties" thing can be done with a __slots__ > definition in the object, but then there's no __dict__ in which to store > the data (there must be some way to say "store in the slot", I just > don't see it right now). Delegating to a different attribute might be appropriate: class X(object): __slots__ = ['_a'] def set_a(self, val): self._a = val def get_a(self): return self._a a = property(get_a, set_a) Regards, Martin From tim at vegeta.ath.cx Fri Dec 14 12:57:54 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Fri, 14 Dec 2001 17:57:54 GMT Subject: Unsung Python modules References: <3dsnad226b.fsf@ute.mems-exchange.org> Message-ID: Andrew Kuchling graced us by uttering: > What's your favorite unsung module? 1) readline (optional built-in) 2) xreadlines Two similarly named but unrelated modules have made my whole life much easier. =) Tim Hammerquist -- relaxen und watchen das blinkenlichten. From wware at alum.mit.edu Sun Dec 16 21:25:47 2001 From: wware at alum.mit.edu (Will Ware) Date: Sun, 16 Dec 2001 21:25:47 -0500 Subject: I need some help, Please!!!!! References: Message-ID: <3C1D57AB.AB5F68D4@alum.mit.edu> The Python tutorial will be a big help. http://www.python.org/doc/current/tut/tut.html > I tried to create my own phone book using a dictionary to do so and I > am having some problems. The phone book I was creating I wanted to be > able to add someone to it, find someone in the phone book, delete > someone, and change someone's entry. Everything you've described here can be done with one of Python's innate data structures, called a dictionary. Look here: http://www.python.org/doc/current/tut/node7.html Lo and behold, the example given is a small telephone directory. Your professor must have been snooping around here. > I also only wanted to use the fields Nick name, full name, phone > number, address, and e-mail. I'm not sure what you mean you "only" wanted use these fields. Maybe you're figuring that Python comes with a ready-made phone book entry data type that would include these and several others. Nope, you have to put something together yourself. So how to make a phone book entry data type, with these particular fields? Go back to the tutorial, chapter 9, about classes and objects: http://www.python.org/doc/current/tut/node11.html You may want to design your fields as attributes of a class, and then your phone book can be a list of instances of that class. If you want some flexibility in how to search your phone directory, go to http://www.python.org/doc/current/ref/customization.html and read about "__cmp__". From logiplexsoftware at earthlink.net Sun Dec 23 00:14:25 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Sat, 22 Dec 2001 21:14:25 -0800 Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic In-Reply-To: <007201c18b6a$3c924e20$0101010a@local> References: <3218013921984060@naggum.net> <007201c18b6a$3c924e20$0101010a@local> Message-ID: <20011222211425.39bb768f.logiplexsoftware@earthlink.net> On Sat, 22 Dec 2001 22:28:03 -0600 "Chris Gonnerman" wrote: > Who are these people, and what are they doing in this list? > > I bear no malice toward any language (unless you count disgust > with Visual Basic or confusion with Perl) and would not engage > in such heated battle with anyone over any language. > > This is the only list I still subscribe to because 1) I love > Python and 2) the people, from GvR on down, are reasonable and > generally quite polite. Apparently there is a skirmish involving some people who think Tengwar is superior to Lisp and/or Scheme and the battle has become so violent that it has seeped over to other lists... I understand there's a troll involved and perhaps a hobbit or two. -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From johnroth at ameritech.net Mon Dec 17 07:44:08 2001 From: johnroth at ameritech.net (John Roth) Date: Mon, 17 Dec 2001 04:44:08 -0800 Subject: Idiomatic portable way to strip line endings? (fwd) References: <3c1da747$0$94397$edfadb0f@dspool01.news.tele.dk> Message-ID: The poster child of a Windows application which does not do this is Notepad. However, Notepad may be reading the file as binary; it does other strange things. The few other applications I use for text all seem to do it right. John Roth "Peter Ring" wrote in message news:3c1da747$0$94397$edfadb0f at dspool01.news.tele.dk... > Except that files do respect operating system boundaries, the most common > cases being LF-style files appearing in Win32 applications and CR/LF-style > files appearing in *nix applications. In general, it's plain silly to > convert end-of-records just because files are moved around or opened > (through a file system) by a process with another run-time library. Some > operating systems (e.g., VMS) might require a record format conversion for > at least some files, but it's not really the general case. > > Kind regards > Peter Ring > > "Russ Cox" wrote in message > news:mailman.1008535879.30802.python-list at python.org... > > As has already been pointed out, section 7.19.2 of > > the ANSI C99 standard mandates that stdio FILEs > > opened in text mode are sequences of lines, each > > of which is terminated with a newline character. > > I believe this was the case for the C89 standard too. > > > > If you open in binary mode then you have to deal > > with the differing line-ending conventions on > > various systems. If you open in text mode, you > > should always get a single \n (\012); nothing more, > > nothing less. > > > > Russ > > > > > > From fperez528 at yahoo.com Sat Dec 1 16:02:34 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Sun, 02 Dec 2001 20:30:34 +2328 Subject: Draft PEP: string interpolation with backquotes References: <9ueh23$9e8$1@peabody.colorado.edu> Message-ID: <9uern5$hbk$2@peabody.colorado.edu> phil hunt wrote: >> >> "x is $x, f(x) is $f(x)" >> >>This to me is readable, unambiguous and very useful. > > To me it implies the same as: > > "x is %(x)s, f(x) is %(f)s(x)" % { 'x': x, 'f': f} > No. $_whatever_ means: fully evaluate _whatever_, as far as it can be evaluated, and put its value in there. So it gives an interpolation syntax which is in fact much cleaner than perl's, with much less need for braces and name protection. > > What's wrong with the existing way of doing things with "%"? > Try using the existing syntax for really complex cases. In the post you quote, I explicitly showed what the current options are, and their flaws. For one-liners it doesn't matter. The problem is *scalability*. As always, easy problems can be solved easily. The question is: is the tool good enough for solving the hard problems? If you read my complete post, either you'll agree that it doesn't or you'll give me a counter argument. But read and argue on the whole post, not just a snippet of it. f. From bryan at eevolved.com Thu Dec 13 23:50:03 2001 From: bryan at eevolved.com (Bryan) Date: Thu, 13 Dec 2001 23:50:03 -0500 Subject: Python CPAN beta test In-Reply-To: References: Message-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday 13 December 2001 07:45 pm, Suchandra Thapa wrote: > I've gotten ciphon to the point where I tihnk it's ready for beta > testing and am looking for people willing to help test it. Currently > ciphon has readline support, dependency handling, automatic updates > of server and package lists and a few other things. There are > currently 5 packages in the repository (wxpython, pygresql, numeric, > pil, and egenix-mx-base) but I'll be adding more. > Basically, if you would like to beta test ciphon you can get the > latest release by anonymous ftp from ftp.community.tummy.com (thanks > to Sean Reifschneider) in /pub/python-packages. If there are any modules > you would like to get into the repository then email me a link to the > module's homepage and I'll try to add it to the repository. > If you're an author and want to help me in getting your module > included in the repository, then you can just grab the ciphon tar ball, > run the createspec.py script in the utils directory, and email me the > generated file along with a location where I can get the source for > your module. Congratulations, and thank you. The readline support is a nice touch. Unfortunately I have not been able to successfully install a package with ciphon-0.3. Whether by RPM or not, the fetch and build process runs as expected but afterwards dies with the helpful message: Error installing package: Installing package Giving up... Specs: i586, python 2.1.1, gcc 2.96 I wanted to track this down so I went into ~/.config/ and manually issued a "setup.py install". The module installed fine. I returned to ciphon and did a "list" only to find my newly installed module not there :( PyGreSQL ). A quick browse of install.py shows that an exception is raised in the __install() method of the Installer class. My debugging print statements aren't appearing, so I will continue to investigate and send what I have so far to you. On another note, I was writing a ciphon mini-howto as I used ciphon for the first time. I also have a distutils module I would like to see included ( http://eevolved.com/cryptkit/ ) and wonder if a web-based submission system or simple ftp access for authors might be envisaged to ease the task of updating with new versions? Also, how does one go about being a ciphon module server? Please find attached the xml spec for cryptkit. Sorry about all the questions, but your work is promising :) - -- <=============================> Bryan Mongeau eEvolved Inc. Website: http://eevolved.com Public key: http://pgp.mit.edu <=============================> "The only thing that interferes with my learning is my education."-- Einstein -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAjwZhREACgkQ3SCd0lDF8nYvxgCfe1JVUAU8RitIsQotLbbMNsIO XQoAoIhPIm7XzSFU9g13dWl1KkI7YBAo =HPJk -----END PGP SIGNATURE----- -------------- next part -------------- A non-text attachment was scrubbed... Name: cryptkit.xml Type: text/xml Size: 378 bytes Desc: not available URL: From lucio at movilogic.com Thu Dec 20 11:26:27 2001 From: lucio at movilogic.com (Lucio Torre) Date: Thu, 20 Dec 2001 13:26:27 -0300 Subject: Huge Dicts and perfomance Message-ID: <3C221133.4090701@movilogic.com> Hi, I am making an application where i want to store links betwen nodes. So i have a dictionary where i store the objects. dict[0][objectname] = object the [0] is because i to signify a link betwen obj-a and obj-b, i do: dict[1][(obj-a, obj-b)] = obj(a, b) and so on, to six levels deep. and i also store links betwen dict[x][y] and other nodes (the stored object has those links) and i want to say for example, if i have a and b, what other nodes usually come togheter? so i follow the links and find the root nodes (z, x) and the groups (a, z) and (s, x). the main problem of course is that doing it this way, performance sucks. I took me nothing to code it, but it takes to much to run (more than coding). So, any ideas on how to achieve my goal in a better (faster) way? thanks, Lucio. From claird at starbase.neosoft.com Fri Dec 28 11:25:28 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 28 Dec 2001 10:25:28 -0600 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <889C110F5BBBFAFD.A03B35C232EA2760.70B0892CB9479323@lp.airnews.net> Message-ID: In article , Alex Martelli wrote: >"Cameron Laird" wrote in message >news:889C110F5BBBFAFD.A03B35C232EA2760.70B0892CB9479323 at lp.airnews.net... . . . >Maybe, but Python could be usable as an extension language >even if the application was implemented otherwise, in the >right environments (JVM: Jython always usable where Java >is; Microsoft COM/Automation). . . . Yikes! Let me make this perfectly clear: YES, Python deserves consideration as an extension language even in applications largely implemented in other languages such as C and Java. I apolo- gize for making that obscure, for it definitely was one of the points I intended to make. As usual, Alex and I agree. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From syver-en+usenet at online.no Sun Dec 9 13:24:04 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 09 Dec 2001 19:24:04 +0100 Subject: py2exe question References: Message-ID: Gordon McMillan writes: > Syver Enstad wrote: > > My question on py2exe is: Is it possible to make an exe that > searches > > > the normal sys.path for modules that doesn't exist in the exefile > > itself? > > First of all, the whole point of py2exe / Installer is to be able to > run a "frozen" app from one Python version on a system that may have > another Python version installed. If a Python 1.5 app tried to use > the lib from a Python 2.1 installation, it would probably die. I am aware of that, and also that I am using py2exe evt. Installer for something that it was not designed to do. That fact is also the reason why I am asking in this newsgroup. The reason why I am trying to make an exe with python is not to accomodate people who does not have python installed but a closer integration with what my operative system (win2k) and programs running under that os treats as a full blown executable. I have done the best I can to make python scripts full fledged executables under my os, but it's not quite there. In some situations I'll have to resort to batch files to convince another program that accepts an executable, to run my python scripts. This is not a good solution as .bat files open up console windows of their own, and it is overhead that makes using python a little bit less attractive because of it's non "plug and play" nature. Another issue would be that using py2exe (or something equivalent) could make it easy to distribute tools together with their "private modules", but rely on an existing python installation for the std library and additional modules that are fairly standard, like Numeric, PIL, win32all and suchlike. This would make the python program, small, easy to use, and completely integrated as a full blown executable under the windows api's. -- Vennlig hilsen Syver Enstad From sholden at holdenweb.com Tue Dec 18 17:33:21 2001 From: sholden at holdenweb.com (Steve Holden) Date: Tue, 18 Dec 2001 17:33:21 -0500 Subject: Cygwin socket library status enquiry References: <20011218131502.GA2268@dothill.com> <2JJT7.22497$PA.5674@atlpnn01.usenetserver.com> Message-ID: "Michael Hudson" wrote in message news:uu1uoi72e.fsf at python.net... > "Steve Holden" writes: > > [snip] > > It has already been reported (thirteen days ago) as > > > > > > http://sourceforge.net/tracker/?group_id=5470&atid=105470&func=detail&aid=48 > > 9709 > > > > and it apparently looks like it won't be fixed in the 2.2 timeframe -- it > > needs attention from the Cygwin team, who aren't synchronized to Python > > releases. So I have just added a note that the bug applies to 2.2c1/Win98 as > > well. We'll see what happens... > > Well, that bug is assigned to me, and there's a comment (also from me) > describing how to get round it (build _socket statically), which is > duplicated in the README (in a section written by me and Jason and > checked in by me) to the same effect. > > It's safe to say I knew about this . I should have warned you > about it, though -- sorry about that. > That's OK, feel free to waste any amount of my time ... I should have read the bug information more assiduously. > > I'll see what I need to omit to get it to build, and follow up if I > > make progress. > > You need to build _socket statically. > OK, that's happening right now... > I might see if I can bodge setup.py so that it screams at you if you > try to build a dynamic _socket module on cygwin. > That probably wouldn't be a bad idea if it doesn't need non-standard coding. Fancy expecting people to read the README file ... sheesh! Boy, these tests take a long time on a Celeron 300. Wish Santa would bring me something a little bit faster. [Hums tunelessly, twiddles thumbs...]. If it passes all its tests I'm going to install it and build mxODBC to test that web server code. Hmm ... I have an idea this test might never end. I'll see if I can leave the laptop running on the drive home. At least the system compiled! I'll get back to you. regards Steve -- http://www.holdenweb.com/ From phd at phd.pp.ru Wed Dec 12 08:25:15 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Wed, 12 Dec 2001 16:25:15 +0300 Subject: __getattr__ related question In-Reply-To: <9v7j44+8okt@eGroups.com>; from dominikush@yahoo.com on Wed, Dec 12, 2001 at 12:38:28PM -0000 References: <9v7j44+8okt@eGroups.com> Message-ID: <20011212162515.A588@phd.pp.ru> On Wed, Dec 12, 2001 at 12:38:28PM -0000, dominikush wrote: > the __getattr__ method causes me some headache. To prohibit unwanted > method calls of an object, I shield it by an interface object. So, > all method calls are addressed to the interface object. That means > the user calls > > capsuleInterface.send("Hallo") > > instead of directly calling capsule.send("Hallo"), see example > below. The __getattr__ in Port catches the call and returns the > send() method of Capsule. However, evaluating the method fails > > >>> capsuleInterface.send("Hallo") > Traceback (most recent call last): > File "", line 1, in ? > TypeError: not enough arguments; expected 2, got 1 Looks like the wrapper does not pass "self" as a first rgument. > def __getattr__(self,name): > if name in self.methods: > try: > return self.component.__class__.__dict__[name] > except KeyError, error: > raise AttributeError, error > raise AttributeError, name+" is not known to port" Aha, here is the error: > return self.component.__class__.__dict__[name] This returns *unbound* method. Return a *bound* method instead: return getattr(self.component, name) Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From jgardn at alumni.washington.edu Sat Dec 8 10:54:02 2001 From: jgardn at alumni.washington.edu (Jonathan Gardner) Date: Sun, 9 Dec 2001 00:54:02 +0900 Subject: lost interest? In-Reply-To: References: Message-ID: <200112081559.fB8FxOJ22691@my.knctv.co.kr> On Sunday 09 December 2001 12:07 am, John Roth wrote: > What's the difference between the Vaults of Parnassus and CPAN? > I can usually find what I want on the Vaults. > Yes, the CPAN's site is totally useless. Well, I mean, you can technically find stuff, but it takes way too much time to get to the actual stuff you want to download, and the search is horrible. One thing that runs against CPAN is the fact that there are so many modules of so many types. Python doesn't seem to have that problem quite yet. (I'm not saying Python needs more modules, I am only saying that you can do a whole lot more with less.) However, the interactive mode of CPAN (perl -MCPAN -e shell) is pretty cool. You can specify mirrors to download from pretty easily, it will check what you got and figure out what you need, and it has a few nice touches that makes it really useful. Something like this would be useful for Python in general. However, I find the traditional do-it-yourself easy and sufficient. That's just me, so... Jonathan From israelrt at optushome.com.au Sat Dec 22 09:09:50 2001 From: israelrt at optushome.com.au (IsraelRT) Date: Sun, 23 Dec 2001 01:09:50 +1100 Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic References: Message-ID: On 22 Dec 2001 06:07:37 -0800, newscheme at hotmail.com (New Scheme) wrote: >> Or an anonymous troll who is too scared to use his real name ? > >You obviously didn't read David Rush's rant. Are you suffering from a >bit of selective amnesia? Still posting anonymously ? Coward. From maarten at kittensandcats.net Sat Dec 29 18:27:20 2001 From: maarten at kittensandcats.net (Maarten Wiltink) Date: Sun, 30 Dec 2001 00:27:20 +0100 Subject: Was that to inpolite? Re: Call for a small program References: <3C2BAEF3.CC34B8DD@htp-tel.de> <3C2E0D55.9EC9B67F@htp-tel.de> Message-ID: Tom Karas wrote in message <3C2E0D55.9EC9B67F at htp-tel.de>... >Hello out there. > >A few quick questions: > > Was my "Call" to inpolite? > > Was it the wrong place / newsgroup to ask? > >I just wonder, because there wasn?t even a reaction like "Go away" or >"Plonk / Killfile" > >This may sound odd, but i would be even willing to pay for a solution >that would >fit the basic needs (running on windows and linux and some features) I was out for a week and seem to have missed your initial post. (And, I'm too lazy to go look it up.) Generally, if there is no flaming, but no answer either, nobody may know it, or everybody may think someone else will get the door. (And generally, if you know words like "plonk", you're sufficiently familiar with netiquette that you don't have to worry about it.) Speaking just for myself, my time is either my boss's or my own. Contact him, not me, for paid jobs and in the other case, don't ever offer me money. I'm here strictly for entertainment purposes. Groetjes, Maarten Wiltink From s.schwarzer at ndh.net Sun Dec 30 21:02:09 2001 From: s.schwarzer at ndh.net (Stefan Schwarzer) Date: Mon, 31 Dec 2001 03:02:09 +0100 Subject: REPOST: Re: (Almost) command line simulation with execfile References: <3C2CADA8.8D6BE4C@ndh.net> <3c2f4182_2@news.newsgroups.com> Message-ID: <7$--$$_----__$__-$@news.noc.cabal.int> Hello Brad Brad Clements wrote: > Please post internet.py Here it is: ''' Some internet-related modules ''' import socket import urllib import smtplib import time def url_content_part(url, count=None): '''Return a number of bytes from an URL.''' fetched = urllib.urlopen(url) if count is None: text = fetched.read() else: text = fetched.read(count) fetched.close() return text def send_example_email(server, from_addr, to_addr): '''Send an email (with fixed text).''' date = time.strftime( '%a, %d %b %Y %H:%M:%S', time.localtime() ) text = '''\ From: %(from_addr)s To: %(to_addr)s Date: %(date)s Subject: A little Python example for sending mails Hello user This is a mail from %(from_addr)s to %(to_addr)s via server %(server)s Best regards Your Python interpreter ;-)\n''' % vars() host = smtplib.SMTP(server) host.sendmail(from_addr, [to_addr], text) host.quit() raw_input( 'Please ensure you are connected to the internet and press [Return]: ') print try: url = 'http://www.python.org/' count = 150 print 'The first %s characters from %s:' % (count, url) print url_content_part(url, count) print print 'Sending an email:' server = raw_input('Enter a valid mailserver (full name) for your domain: ') from_addr = raw_input('Enter FROM email address: ') to_addr = raw_input('Enter TO email address: ') send_example_email(server, from_addr, to_addr) print 'Mail has been sent.' except (IOError, socket.error): print print 'There seems to be a problem with your internet connection.' print 'Are you really online? Is all set up?' except smtplib.SMTPException: print print 'Sending your mail failed. Please check your parameters and' print 're-execute the program with the correct ones.' ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Stefan Schwarzer Newsgroups: comp.lang.python Subject: cmsg cancel <3C2FC721.145D2EBC at ndh.net> Control: cancel <3C2FC721.145D2EBC at ndh.net> Date: Mon, 31 Dec 2001 03:13:55 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009773967 27193 211.57.49.2 (31 Dec 2001 04:46:07 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:46:07 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From peoter_veliki at hotmail.com Tue Dec 4 00:28:53 2001 From: peoter_veliki at hotmail.com (Peoter Veliki) Date: Mon, 3 Dec 2001 21:28:53 -0800 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <3C0BE492.5DACEA18@mega-nerd.com> <3C0C55A8.EAD03FD5@cosc.canterbury.ac.nz> Message-ID: <87ZO7.1377$eq3.87747655@news.incc.net> Anything you want to line up must be at the same indent level. In the example below, however many tabs the first line has in front of it, each of the other lines below must also have the same number of tabs and the use spaces to finishing lining everything up. If you do this it will line up on any editor. "Greg Ewing" wrote in message news:3C0C55A8.EAD03FD5 at cosc.canterbury.ac.nz... > Steve Lamb wrote: > > > > some_dict = {'Jane':{'Age':'21', 'Dept':'0001', 'Ext':'1234'}, > > 'John':{'Age':'22', 'Dept':'0010', 'Ext':'5678'}, > > 'Jeff':{'Age':'23', 'Dept':'0100', 'Ext':'9009'}, > > 'Jody':{'Age':'24', 'Dept':'1000', 'Ext':'8765'}, > > 'Jeny':{'Age':'25', 'Dept':'0110', 'Ext':'4321'} > > } > > > > You get it yet? You finally understand that preference SCREWS UP THE > > INTENT AND READABILITY OF THE ABOVE EXAMPLE WHICH IS NOT ALL THAT UNCOMMON? > > Yeesh. 3 days now and you still haven't address that real and valid concern! > > This concern *has* been addressed, by suggesting the > above be written as > > some_dict = { > 'Jane':{'Age':'21', 'Dept':'0001', 'Ext':'1234'}, > 'John':{'Age':'22', 'Dept':'0010', 'Ext':'5678'}, > 'Jeff':{'Age':'23', 'Dept':'0100', 'Ext':'9009'}, > 'Jody':{'Age':'24', 'Dept':'1000', 'Ext':'8765'}, > 'Jeny':{'Age':'25', 'Dept':'0110', 'Ext':'4321'} > } > > Also, there seems to be some confusion in this discussion > about two quite different kinds of formatting: Python > block-indentation on the one hand, and cosmetic lining-up > on the other. People arguing in favour of tabs are talking > only about the former, not the latter. > > If you need to do cosmetic lining-up, the best thing is > to use whatever your current convention is for block > indentation up to the syntactic level of the statement, > and then use spaces-only after that. It still won't work > if viewed with a proportional font, but it's the best > that can be done using plain ASCII. > > -- > Greg Ewing, Computer Science Dept, University of Canterbury, > Christchurch, New Zealand > To get my email address, please visit my web page: > http://www.cosc.canterbury.ac.nz/~greg > -- > http://mail.python.org/mailman/listinfo/python-list > From benoit.cerrina at writeme.com Fri Dec 28 11:29:12 2001 From: benoit.cerrina at writeme.com (Benoit Cerrina) Date: Fri, 28 Dec 2001 17:29:12 +0100 Subject: Embeddability (was: Python Popularity: Questions and Comments) References: <3C2A9D33.67FEC261@earthlink.net> <3C2BC584.53199AD5@cti.ecp.fr> <67E54B47BD89CB93.F31156BB065B59F8.45903B6CE0C1ED74@lp.airnews.net> Message-ID: > Somebody built a vim with Ruby as an extension language. Vim's source distribution comes with ruby support, it still needs to be activated through the appropriate configure option though. I also wrote a patch to make ruby easier to use as an extension language for vim. The important point though is that scripting vim in ruby is a regular part of vim. Benoit From bryder at afilias.info Thu Dec 6 10:15:34 2001 From: bryder at afilias.info (bryder at afilias.info) Date: 6 Dec 2001 15:15:34 GMT Subject: comp.lang.python Message-ID: <9uo22m$lbh$1@news.netmar.com> Can anyone tell me what might prevent the standard Python external methods in Zope not to work? Specifically, no matter what I do when I try to create the external method in the Zope UI it tells me it can't find the module. and, this is in an environment where Perl unrestricted methods ARE working. I'm thinking maybe there is a conf. file setting somewhere that turns python external methods on or off? Anyone have any ideas? Email much appreciated. I contribute to several newsgroups but I'm not typically at this one. Also, please let me know if there are more appropriate newsgroups for this question. Thanks! -Bill Ryder bryder at afilias.info ----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web ----- http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups NewsOne.Net prohibits users from posting spam. If this or other posts made through NewsOne.Net violate posting guidelines, email abuse at newsone.net From kragen at pobox.com Sat Dec 1 18:25:44 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 01 Dec 2001 18:25:44 -0500 Subject: Just started, need help! References: Message-ID: <83d71ysetj.fsf@panacea.canonical.org> "Kyle Thompson" writes: > When I do an input command, I hit enter so I may then do the if and else > command but when I hit enter it try's to run the input command. How do I > make it not run when its being made and just run when I'm done with a part > and want to run it? I think I understand what you're asking, but I'm not sure. Here's the answer to what I think you're asking. Put the stuff you want to not run inside a def, like this: def hikyle(): name = raw_input("What's your name? ") if name == 'Kyle': print "I love you" print "hello,", name Then you can run it by typing hikyle(). From djrassoc01 at mindspring.com Fri Dec 28 23:34:59 2001 From: djrassoc01 at mindspring.com (Dr. David J. Ritchie, Sr.) Date: Fri, 28 Dec 2001 22:34:59 -0600 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2CBACB.FBF3C3C9@mindspring.com> Message-ID: <1$--$$_----_-%$_$$@news.noc.cabal.int> In regard to what Justin Sheehy wrote: > "Dr. David J. Ritchie, Sr." writes: > > > there are features of Java (like strong typing) that at least > > mandate a certain level of consistency between all execution paths. > > Python has strong typing. It does not, however, have static typing or > explicit type declarations, which are probably what you are thinking about. Yes, I suppose that is it. To me, the requirement of saying what a variable is and then using it as you said it to be builds in a certain cross checking which one can >assert< results in more reliable code. Are there any studies to support such a view? I am not aware of any so I have to regard myself as engaging in hand-waving and demonstrating the marketing myth driven decision making process which I described in my original post. > > > > I can argue to myself to dismiss that one by saying that of course > > interpretative languages should not be expected to hold to that > > level of validation. > > Could you please explain what an "interpretative language" is and how > Java and Python are different with regard to that definition? > > Before you answer, realize that both are generally translated into an > intermediate language and then that language is executed by a virtual > machine at runtime. And the virtual machine byte code is eventually translated into microcode in some chip, etc., etc. I think what I was trying to get at was the problem of validating code when the language allows run time definition of the code and execution of it through an exec or eval or whatever. I am probably on shaky ground here due to ignorance but that's what I was refering to anyway. -- Dr. David J. Ritchie, Sr. djrassoc01 at mindspring.com http://home.mindspring.com/~djrassoc01/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Dr. David J. Ritchie, Sr." Newsgroups: comp.lang.python Subject: cmsg cancel <3C2D47F0.6DF7C8BE at mindspring.com> Control: cancel <3C2D47F0.6DF7C8BE at mindspring.com> Date: Mon, 31 Dec 2001 02:54:39 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774878 27193 211.57.49.2 (31 Dec 2001 05:01:18 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:01:18 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From schull at digitalgoods.com Sat Dec 8 20:25:08 2001 From: schull at digitalgoods.com (Jon Schull) Date: 8 Dec 2001 17:25:08 -0800 Subject: 11-15 new Python Books on the way! (fwd) References: Message-ID: <2621b014.0112081725.29ab24e8@posting.google.com> I'm pleased to hear of a specifically-Jython book. As a python programmer interested in accessing java libraries, and as a NON -java programmer I’m “shocked and amazed” at the Byzantine nature of java documentation, and code. Has anyone written a “guide to jython for non-java programmers?”. Or might one of the java bean programming environments offer a good “entry way?” Or is it hopeless to suppose that one could learn to use java libraries, frameworks and beans without learning to read and write java? LLewin at oreilly.com (Laura Lewin) wrote in message news:... > This is a great list! You can also add Jython Essentials, O'Reilly, > Samuele Pedroni and Noel Rappin. The book is due out in March. > Laura > LLewin at oreilly.com > > > Ron Stephens wrote: > > |Truly a surfeit of books. But, for what it is worth, I have listed all I > > |could find out about them all at http://www.awaretek.com/plf.html > > From fperez528 at yahoo.com Wed Dec 19 13:53:04 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Thu, 20 Dec 2001 18:21:04 +2328 Subject: Writing python documentation with LyX? Message-ID: <9vu2t6$4rv$1@peabody.colorado.edu> I'd like to know if someone has used LyX for writing documents which conform to the Python doc standards. Basically this would mean having written the lyx layout files corresponding to the manual and howto document classes defined by Python. It would save me a lot of work not to have to do those from scratch if someone has already done them. Ever since I started using LyX years ago, I can't bring myself to writing raw latex anymore :) Thanks, F. From philh at comuno.freeserve.co.uk Sun Dec 2 21:08:10 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Mon, 3 Dec 2001 02:08:10 +0000 Subject: Draft PEP: string interpolation with backquotes References: <9ueh23$9e8$1@peabody.colorado.edu> Message-ID: On Sun, 02 Dec 2001 17:28:41 +2328, Fernando P?rez wrote: >Exactly my point. I think when I mentioned my need of inserting % in >strange dynamic strings I inadvertedly set the discussion off-course. >That was just a side comment, and by no means the meat of my point. >My important point is that Ping's PEP allows a clear way of saying > > "x is $x, f(x) is $f(x)" > >This to me is readable, unambiguous and very useful. To me it implies the same as: "x is %(x)s, f(x) is %(f)s(x)" % { 'x': x, 'f': f} which of course isn't what you meant. What's wrong with the existing way of doing things with "%"? -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From wavefrnt at tampabay.rr.com Mon Dec 3 08:58:04 2001 From: wavefrnt at tampabay.rr.com (David Edwards) Date: Mon, 3 Dec 2001 08:58:04 -0500 Subject: pythoncookbook.com available to good home Message-ID: <20011203085804.A17723@buttercup.3digital.com> Hi, I registered the domain pythoncookbook.com a couple of years ago but never used it. It will be up for renewal in February and I probably won't renew it. If someone has a use for it that will benefit the Python community, I will gladly tranfer it to them. David Edwards From phd at phd.pp.ru Thu Dec 6 11:39:02 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Thu, 6 Dec 2001 19:39:02 +0300 Subject: pickle question In-Reply-To: <9uo5v7$c2a5i$1@hades.rz.uni-sb.de>; from uwe@rocksport.de on Thu, Dec 06, 2001 at 04:21:59PM +0000 References: <9unov6$c4on9$1@hades.rz.uni-sb.de> <9uo5v7$c2a5i$1@hades.rz.uni-sb.de> Message-ID: <20011206193902.I4616@phd.pp.ru> On Thu, Dec 06, 2001 at 04:21:59PM +0000, Uwe Schmitt wrote: > | Did you open the pickled file in binary mode? > > No. should I ? On Windows - yes. Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From calves at coelce.com.br Sun Dec 9 07:32:01 2001 From: calves at coelce.com.br (Alves, Carlos Alberto - Coelce) Date: Sun, 9 Dec 2001 09:32:01 -0300 Subject: comunicating with ports ( com, lpt1) Message-ID: <29A97D00F387D411AC7900902770E14802EAFEC3@LCOEEXC01> Hey guys, How could I comunicate through the com ports ( com1,com2,com3.LPT1 etc)? I mean, send and recieve data through those interfaces. Is there any module for this?what?! -------------- next part -------------- An HTML attachment was scrubbed... URL: From nospam at bigfoot.com Wed Dec 19 17:28:34 2001 From: nospam at bigfoot.com (Gillou) Date: Wed, 19 Dec 2001 23:28:34 +0100 Subject: zope question References: <9vq5n3$d6t0t$1@hades.rz.uni-sb.de> Message-ID: <9vr3u3$1o34$1@norfair.nerim.net> Hmmm (this could be a long thread/troll ;-) Short answer... Using ZClasses based objects for your articles (stored on ZODB back-end) is easier to program than using an SQL back-end. But if you got a huge number of articles, an SQL back-end should be faster. In addition, you can share your articles with non Zope apps (back office ...) Long answer... http://www.zope.org/Members/anthony/sql_vs_ZODB It's not the wrong newsgroup put you could have more answer in a zope mailing list (subscribe from http://lists.zope.org ) HTH --Gillou "Uwe Schmitt" a ?crit dans le message news: 9vq5n3$d6t0t$1 at hades.rz.uni-sb.de... > Hi, > > in order to learn Zope product programming, I try to implement a little > shop. The first step is a database of articles. How shall I implement > this ? Shall I use ZClasses respectively instances of a self implemented > object or shall I use a database adapter ? Which solution is faster ? > > I'm sorry if this is the wrong newsgroup for this question... > > Greetings, Uwe. > > -- > Dr. rer. nat. Uwe Schmitt Uwe.Schmitt at num.uni-sb.de > Universitaet des Saarlandes Angewandte Mathematik > Building 36.1 Room 4.17 PO-Box 151150 D-66041 Saarbruecken > Mobile:0177/6806587 Fax:+49(0)681/302-4435 Office:+49(0)681/302-2468 From m.bless at gmx.de Sun Dec 16 13:03:52 2001 From: m.bless at gmx.de (Martin Bless) Date: Sun, 16 Dec 2001 18:03:52 GMT Subject: Idiomatic portable way to strip line endings? References: Message-ID: <3c1cddd3.6188589@news.muenster.de> [Tim Hammerquist]: >Ah. So I was doing my normal over-thinking again. =) Yes - and it's totally appropriate. Danger is not over. The line[:-1] idiom works fine on windows, as long you (can) garantee that files are opened without the "b" (binary) mode switch. If the file is opened 'binary', as in fp = open(fname,'rb') no input conversion will be done by the lower level routines. This means your line endings are '\r\n' indeed on a windows system. To be on the safe side here's what I sometimes use: def removecrlf( line): """Remove \r\n or \n from end of string.""" if line[-1:] == '\n': if line[-2:-1] == '\r': return line[:-2] else: return line[:-1] else: return line Martin From westernsam at hotmail.com Tue Dec 11 07:30:04 2001 From: westernsam at hotmail.com (sam) Date: 11 Dec 2001 04:30:04 -0800 Subject: Handling callbacks from COM Message-ID: <292c8da4.0112110430.23cfd271@posting.google.com> Hello, I am using pythons' win32com to use a thrid party ActiveX control. I have very limited documentation but it does mention that I have to handle four call backs. I have used the makepy tools to generate a library in order to take advantage of early binding, and the generated Python gives (commented out)prototypes for these callbacks, but I have no idea where these need to be implemented. I guess each callback is an event (seeing as they can occur asycronously), and thefore need to be handled in a different thread from the main client. Any clues on this greatly appreciated. Sam From jkraska at san.rr.com Thu Dec 6 20:20:42 2001 From: jkraska at san.rr.com (Courageous) Date: Fri, 07 Dec 2001 01:20:42 GMT Subject: Calling a generator multiple times References: <200112061113290670.0100F457@mail.rdc1.sdca.home.com> <3C10135D.C101176A@cosc.canterbury.ac.nz> Message-ID: >Er... where is this "f" going to be stored? After I posted my message, it occured to me that I wasn't addressing a key part of the semantics, namely the ability for multiple consumers to generate the generator multiple times. While I understand that part of the problem is critical, if you don't mind, I'll politely dodge it*. The fact remains, as you state that you understand below, the current implementation of generators is counter-intuitive, misleading, and incongruous with Python itself. >When generators first appeared, quite a number of >people, including me, argued fervently and passionately >that generators *shouldn't* look like ordinary functions, >for this very reason. I agree with you emphatically, and while I am sure that this comment is a bit snide, let's just say that "language designer's intuition" should probably needs to smell out how an average newbie pythonista would react to a function that isn't. C// From roy at panix.com Sun Dec 30 09:32:50 2001 From: roy at panix.com (Roy Smith) Date: Sun, 30 Dec 2001 09:32:50 -0500 Subject: REPOST: Re: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> <3C2E498B.6DC757E0@stroeder.com> Message-ID: <0$--$$_----__-%%%$@news.noc.cabal.int> Cliff Wells wrote: > My sentiments exactly: C is excellent as the equivalent of a modern > assembly language. Back when I was doing M-6800 (6800, not 68000) machine code, I used to write my stuff in a stylized subset of C, then hand-compile it. As long as you stayed away from complex expressions, assignment side effects, and some of the fancier flow control constructs, there was an almost one to one mapping between C statements and blocks of assembler code, so the compilation stage was easy. But, what it let me do is write the structure of the program without having to worry about details like adding two integers by doing a series of byte-wise loads, adds, and carries. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Roy Smith Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:54:40 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774224 27193 211.57.49.2 (31 Dec 2001 04:50:24 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:50:24 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jeff at ccvcorp.com Fri Dec 28 13:25:36 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Fri, 28 Dec 2001 10:25:36 -0800 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <3C2CB920.DAEA7011@ccvcorp.com> Alex Martelli wrote: > "Fredrik Juhlin" wrote in message > news:mailman.1009544733.30338.python-list at python.org... > > On Fri, Dec 28, 2001 at 12:27:35PM +0100, Alex Martelli wrote: > > > "Steve Lamb" wrote in message > > > news:slrna2nhfo.nme.grey at teleute.dmiyu.org... > > > > On Thu, 27 Dec 2001 17:48:13 +0000, phil hunt > > > > > > > wrote: > > > > > Python runs quickly on my 300 MHz box, which is 3 times slower > > > > > than the slowest PC you can buy today. It can only get more popular. > > > > > > > > Well, if you take the measure of just pure Mhz.... 4 times slower. > ;) > > > > > > FIVE or more. 1.5 GHz desktop machines are hardly news these days. > > I'm afraid you missed the word "slowest" in the original statement, Alex > :) > > Ooops yes -- so did Steve, I think. You CAN still buy PCs whose CPU's > are claimed to run at 900 MHz *AND LESS* (so even the "3 times" in the > OP was incorrect:-). Yes, I still see quite a few 800MHz machines advertised. Of course, my place of employment still maintains a half dozen or so machines in the 150-233 MHz range... (and Python runs quite satisfactorily on them, too!) Jeff Shannon Technician/Programmer Credit International From breakfast at 10.am Mon Dec 17 17:48:08 2001 From: breakfast at 10.am (mallum) Date: Mon, 17 Dec 2001 22:48:08 +0000 Subject: pyexpat and unicode In-Reply-To: <002f01c18749$aca03f30$445d4540@Dell2> References: <9vlh7i$f4$1@peabody.colorado.edu> <002f01c18749$aca03f30$445d4540@Dell2> Message-ID: <20011217224808.D482@10.am> on Mon, Dec 17, 2001 at 02:25:03PM -0800, Brian Quinlan wrote: > > to have? Unicode objects, like strings, are immutable. What you probably > meant is: > > data_uni = data_uni.encode('utf8') > Looks like I was doing something stupid and missing the obvious :) Many thanks for the help; -- mallum From qrczak at knm.org.pl Sat Dec 1 14:18:14 2001 From: qrczak at knm.org.pl (Marcin 'Qrczak' Kowalczyk) Date: Sat, 1 Dec 2001 19:18:14 +0000 (UTC) Subject: Python-2.2b2 bug? Misc/Makefile.pre.in Message-ID: What happened to Misc/Makefile.pre.in? -- __("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ QRCZAK From usenet at NOSPAM-irmen.cjb.net Sun Dec 30 20:18:25 2001 From: usenet at NOSPAM-irmen.cjb.net (Irmen de Jong) Date: Mon, 31 Dec 2001 02:18:25 +0100 Subject: pyro 2.3 remote.py windows fix. References: Message-ID: Thanks, I'll have this fixed in the next version (2.4). Irmen de Jong From a at b.com Fri Dec 21 04:20:28 2001 From: a at b.com (Brian Sholly) Date: Fri, 21 Dec 2001 09:20:28 GMT Subject: Newbie Programming References: <84fd22ef.0112192032.14c75f8a@posting.google.com> Message-ID: <3c22fee7$1@nopics.sjc> I had the same problem. One thing I did was to do a search for computer classes that post their programming assignments online. These are good sources since the problems are usually geared toward teaching some programming concept. Find some intro level classes and work your way up. There are also programming contests with websites that list past year's problems. These tend to be more advanced though. Good luck. -B) From kevin at cazabon.com Mon Dec 17 13:42:22 2001 From: kevin at cazabon.com (Kevin Cazabon) Date: 17 Dec 2001 10:42:22 -0800 Subject: CONVERTING TIFF FILES TO JPEG FILES References: Message-ID: <5a4226f0.0112171042.4435a732@posting.google.com> The obvious answer is use the PIL library for Python (www.pythonware.com). If you're looking for a program to do it, and need to do it in high volumes automatically, try a shareware program I wrote called "Magic Converter" (lame name, I know): www.cazabon.com/python/ It's a hotfolder-based system that will convert file types, color space, resize, sharpen, rotate, and such. Plus, you can add custom functions fairly easily. Kevin Cazabon. "kmarkie2002" wrote in message news:... > Hello- > I'm looking for a way to convert a TIFF file to a JPEG file. Is > there a free program that I can download for this? From eldiener at earthlink.net Mon Dec 31 00:29:26 2001 From: eldiener at earthlink.net (Edward Diener) Date: Mon, 31 Dec 2001 05:29:26 GMT Subject: REPOST: Re: Python and Ruby: a comparison References: <3C2B9A61.EE1618DB@earthlink.net> <2WpX7.1145$0s5.714029@news20> <3C2E6876.4CBF45D4@geneva-link.ch> <465v2u4lv3illoviq19nhdf1r2vcknbakn@4ax.com> Message-ID: <7$--$$-$$$$_$-$__$@news.noc.cabal.int> CLR is a lowest common denominator for language ideas which MS supports. What happens when a language has good ideas which are more advanced than what CLR supports. It is left out of CLR, or included into it with those ideas stripped from the language to accomodate CLR. Sometimes the Holy Grail of language interoperability has serious flaws to it. Similarly Esperanto may be a nice idea but most countries love their own languages. The same goes for languages which programmers use. Tim Roberts wrote: > Boris Borcic wrote: > > >>Conrad Schneiker wrote: >> >> >>>So my question is: at such a presently entirely hypothetical future >>>juncture, is there any practical and desirable middle ground for a common >>>single successor language to the current generations of Python and Ruby? >>> >>What would be fun is to have library interoperability completed >>with interlingual source-to-source conversion from adequately >>constrained style... premitting more or less, to use one's language >>superficial idioms to mean corresponding idioms in the other >>language. >> > > Oddly enough, I believe that is almost exactly what Bill Gates believes he > has created with .NET and the common language runtime. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newsengine.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Edward Diener Newsgroups: comp.lang.python Subject: cmsg cancel <3C2FF718.1020306 at earthlink.net> Control: cancel <3C2FF718.1020306 at earthlink.net> Date: Mon, 31 Dec 2001 02:24:16 GMT Organization: Korea Telecom Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news1.kornet.net 1009779184 8801 211.57.49.2 (31 Dec 2001 06:13:04 GMT) X-Complaints-To: usenet at feeder.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 06:13:04 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From gh_pythonlist at gmx.de Wed Dec 12 16:19:40 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Wed, 12 Dec 2001 22:19:40 +0100 Subject: lost interest? In-Reply-To: <3c178a5c.36573229@news.laplaza.org> References: <20011208001123.A5989@casa.parque> <3C14FEBD.AD52B516@attbi.com> <3c178a5c.36573229@news.laplaza.org> Message-ID: <20011212211938.GA3987@lilith.hqd-internal> Le 12/12/01 ? 18:06, Mats Wichmann ?crivit: > ... And that's fine, if you are using an OS > that's well supported, and preferably are using only one. We've > already heard "ActiveState's blah blah can do that" (Windows only); Just for clarification: ActiveState's pyppm is included in all ActiveState distributions: Linux, Solaris and Windows. IMO its main advantage is that it's here today. Maybe ActiveState can be talked into licensing it under the Python license? Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From sholden at holdenweb.com Tue Dec 11 08:03:50 2001 From: sholden at holdenweb.com (Steve Holden) Date: Tue, 11 Dec 2001 08:03:50 -0500 Subject: two questions - sockets / c functions References: <3c14bc2c$1_2@news7.fast.net> <20011210165417.P18573@phd.pp.ru> <200112101947.fBAJllua032444@ratthing-b246.strakt.com> Message-ID: "Oleg Broytmann" wrote in message news:mailman.1008020727.17450.python-list at python.org... > On Mon, Dec 10, 2001 at 08:47:47PM +0100, Laura Creighton wrote: > > The only thing Oleg forgot to tell you was that sockets don't work on > > Windows > > Sockets don't work on Windows? It is nice to hear, but I do not beleive > it! What do you mean?! > Perhaps Laura is using the cygwin implementation. I have just been experimenting with a bunch of servers that run fine in the standard windows environment. Under cygwin usually something (and I currently have no idea what) gets jammed after a few client interactions, and netstat -a reveals many sockets in WAIT_STATE or WAIT_STATE2 (from memory). I was disappointed, having just got mxODBC to work on cygwin, that this wasn't more effective. Unfortunately I have neither the time nor the C expertise to put this right, so I'm hoping someone better suited to the task will take a look at it. I'm not even sure whether I need to report this as a bug yet (ISTR this is a known problem) , but I'll be doing some research in the next week or two. Might be different under NT, but under 98 2E it appears to be broke. regards Steve -- http://www.holdenweb.com/ From tatebll at aol.com Sun Dec 30 16:50:36 2001 From: tatebll at aol.com (Bill Tate) Date: 30 Dec 2001 13:50:36 -0800 Subject: REPOST: Re: Zope Documentation (was RE: Python Popularity: Questions and Comments) References: <3C2E55A6.D873E301@engcorp.com> <8gIX7.7072$l93.1790214@newsb.telia.net> Message-ID: <5$--$$_----____$-$@news.noc.cabal.int> "Fredrik Lundh" wrote in message news:<8gIX7.7072$l93.1790214 at newsb.telia.net>... > Bill Tate wrote: > > "Xxxxxx is the world's first company dedicated to using the science > > of experience strategy, design, and technology to create extraordinary > > results for our clients." > > interestingly enough, a google search for the above phrase > gave two very similar hits: > > Xxxxxx is the world's first company dedicated to using > the science of experience strategy, design, and technology > to create extraordinary results for our clients. > > Yyyyyy is the world's first company dedicated to using > the science of experience strategy, management, and > technologies to create extraordinary results for our clients. > > design or management, that's the question... > > Actually they are both from the same company. Its almost too painful to even think about. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: tatebll at aol.com (Bill Tate) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:56:03 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774063 27193 211.57.49.2 (31 Dec 2001 04:47:43 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:47:43 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From chrishbarker at attbi.com Thu Dec 20 13:16:54 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Thu, 20 Dec 2001 10:16:54 -0800 Subject: /usr/bin/env: python: No such file or directory References: <915a998f.0112161542.2ab07235@posting.google.com> Message-ID: <3C222B16.C1B1BC8D@attbi.com> Hamish Lawson wrote: > Though perhaps not the case here, I'll just mention a problem that is > worth being aware of when transferring a script from a Windows/DOS > system to Unix. If the difference in line-ending conventions hasn't > been taken care of (such as by using ASCII mode during FTP transfer), > then the spurious ^M in the script's #! line can trip up the shell or > the env command, since it will be trying to run the program python^M. This is a "moving stuff from Windows to *nix" issue, and has NOTHING to do with Python in particular. As stated, it is the shell (is it the shell? or is it something lower in the system...I have no idea) that is examining that first #! line, so we havn't gotten anywhere near Python yet. We really do need to find a Python solution to distinguishing different Python versions, however. Python has now gotten mature enough, and established enough that there are a lot of programs out there that work just fine with a current version, and users should not have to do anything to keep them working...It should be hard to break an existing settup when you upgrade Python, not hard to preserve it! I suppose, if we all, as a community, start using: #!/use/bin/env python2.1 Then the problem will be solved, at least on *nix... Then what do you do with a script that will run on either 1.5 or 2.0 or 2.1 ????? and you don't know which of these might be installed? -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From DeepBlue at DeepBlue.org Sun Dec 9 17:47:32 2001 From: DeepBlue at DeepBlue.org (DeepBlue) Date: Sun, 09 Dec 2001 22:47:32 GMT Subject: python cgi questions Message-ID: <8SRQ7.22622$zp5.1091695@typhoon.austin.rr.com> I have the following cgi python question. I need to allow users to download files through a series of HREF links. But also I need to be able to update a database table when a user clicks on the link. So, each file to be downloaded is in its separate Form. And each link has an ONCLICK event that submits the form for the corresponding file. When the form is submitted I was hoping that the database is updated with values in hidden fields in each form, and the user can download the file. But, I can accomplish only one thing: either the form is submitted or the file is downloaded. Can both things be accomplished: 1. File is downloaded when link is clicked, and 2. Form is submitted through onclick event in javascript (onclick=document.form.submit) Also, is it possible using a python script to submit a form in the background without anything being returned to the browser? In this case, I send the information via the python script (form submitted) and the database is updated, but nothing is returned to the browser so that the current page stays as is. Thanks for any help or hints, DB From wall at adinet.com.uy Mon Dec 17 08:39:30 2001 From: wall at adinet.com.uy (Walter Moreira) Date: Mon, 17 Dec 2001 10:39:30 -0300 Subject: Python CPAN beta test In-Reply-To: ; from ssthapa@classes.cs.uchicago.edu on Fri, Dec 14, 2001 at 12:45:04AM +0000 References: Message-ID: <20011217103930.A22815@casa.parque> On Fri, Dec 14, 2001 at 12:45:04AM +0000, Suchandra Thapa wrote: > I've gotten ciphon to the point where I tihnk it's ready for beta > testing and am looking for people willing to help test it. Currently > ciphon has readline support, dependency handling, automatic updates > of server and package lists and a few other things. There are > currently 5 packages in the repository (wxpython, pygresql, numeric, > pil, and egenix-mx-base) but I'll be adding more. Great! I have downloaded ciphon 0.3.1 and when executed it says: hedwig:/usr/local/src/ciphon-0.3.1$ ./ciphon.py Use rpms for installation [N/y]? Update package and server list on startup [Y/n]? Force updates[N/y]? Traceback (most recent call last): File "./ciphon.py", line 118, in ? if config.getConfig().getParameter('autoupdate') == 'true': File "./config.py", line 266, in getConfig config = Configuration() File "./config.py", line 85, in __init__ serverParser) File "/usr/local/lib/python2.1/xml/sax/__init__.py", line 30, in parse parser = make_parser() File "/usr/local/lib/python2.1/xml/sax/__init__.py", line 88, in make_parser raise SAXReaderNotAvailable("No parsers found", None) xml.sax._exceptions.SAXReaderNotAvailable: No parsers found The same exceptions is raised if I call make_parser() from the interpreter. Is there something missing in my installation? Thanks, and keep the good work. Walter -- -------------- Walter Moreira <> Centro de Matematica <> Universidad de la Republica email: walterm at cmat.edu.uy <> Home Page: http://www.cmat.edu.uy/~walterm From sasoft at gmx.de Sat Dec 8 17:56:31 2001 From: sasoft at gmx.de (cruciatuz) Date: Sat, 8 Dec 2001 17:56:31 -0500 Subject: lost interest? In-Reply-To: <200112081559.fB8FxOJ22691@my.knctv.co.kr> References: <200112081559.fB8FxOJ22691@my.knctv.co.kr> Message-ID: <20011208225631.GA6172@blackscarab> On Sun, Dec 09, 2001 at 12:54:02AM +0900, Jonathan Gardner wrote: > On Sunday 09 December 2001 12:07 am, John Roth wrote: > However, the interactive mode of CPAN (perl -MCPAN -e shell) is pretty cool. > You can specify mirrors to download from pretty easily, it will check what > you got and figure out what you need, and it has a few nice touches that > makes it really useful. Something like this would be useful for Python in > general. However, I find the traditional do-it-yourself easy and sufficient. > That's just me, so... THIS is cpan? If i understand you right, you can deal with perl modules like you can with debian's apt-get tool? (i just tried the command "perl -MCPAN -e shell") I'd really like something like that for python, based on "setup.py", but with the option to download the package directly. something like: $> py-get module install this would cool :) ... or did i understand everything wrong? -- Stefan Antoni ---------------------------- Sam Dez 8 17:51:27 EST 2001 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 240 bytes Desc: not available URL: From peter at engcorp.com Fri Dec 28 22:26:12 2001 From: peter at engcorp.com (Peter Hansen) Date: Fri, 28 Dec 2001 22:26:12 -0500 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> <3C2D1833.1D481943@earthlink.net> Message-ID: <7$--$$_----_-%$%%$@news.noc.cabal.int> Ron Stephens wrote: > > Does anyone know how old PHP is? I'd really like to know. I have not been aware of PHP for much > more than two years, but then I wasn't paying any attention before that. When was PHP "launched"? A quick check with google and "history of php" leads to: http://www.php-center.de/en-html-manual/intro-history.html ... which points out that "PHP was conceived sometime in the fall of 1994" (about a year after the author graduated from an engineering program). It didn't get popular until 95-96 and became more than just the author's personal project in 1997. > How did it grow so fast? Can the Python community learn anything from this phenomenon? Can we even > incorporate some of the good points from PHP for web programming into Python, or Python add-on > "products"? It filled a specialized niche and, for the technology of the time, filled it well. I don't think anything about this applies to Python, since it is neither trying to fill the same niche, nor does it need rapid growth. As for incorporating parts from PHP... what *are* the good points? From the little I know, I'd much prefer Python for web programming, let alone all the other areas where Python shines and PHP doesn't even exist. (By the way, Ron, when quoting material in your reply, could you please find some way to include markers for the quoted lines, like >> or something? It's very hard to read some of your replies without these.) -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.tele.dk!small.news.tele.dk!134.75.7.11!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Peter Hansen Newsgroups: comp.lang.python Subject: cmsg cancel <3C2D37D4.F06C779C at engcorp.com> Control: cancel <3C2D37D4.F06C779C at engcorp.com> Date: Mon, 31 Dec 2001 01:34:20 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774893 27193 211.57.49.2 (31 Dec 2001 05:01:33 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:01:33 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From aahz at panix.com Sun Dec 23 13:43:46 2001 From: aahz at panix.com (Aahz Maruch) Date: 23 Dec 2001 10:43:46 -0800 Subject: Search the difference: Why this function defenition does'nt work? References: <3C260A92.5030907@student.kun.nl> <3C261778.60108@student.kun.nl> Message-ID: In article <3C261778.60108 at student.kun.nl>, husam wrote: >Aahz Maruch wrote: >> In article <3C260A92.5030907 at student.kun.nl>, >> husam wrote: >>> >>>I'm not trying to add string to a list of integeres. What I wanted to do >>>is to add each argument of func2('a','b','c') to sum=['e']. Since sum is >>>a list of chars, and the arguments are accessable as a sequence, one >>>would expect that the addition operation would be correct. On the >>>interactive shell, it is a trivial operation. But, only when i use it in >>>the function defenition i get problems. Adding 'a' to ['b'] does not >>>work, but adding list('a') to ['b'] it does, so, i thought that this >>>might help my code, but converting the args to a list did not helpe >>>either . I really didn't get yet! >> >> use list.append() > >I know that this works, but it does not help my understanding! What don't you understand? The '+' operation in Python applies to types that are more-or-less equivalent. You can't do this, either: >>> t='a', >>> t ('a',) >>> l=['b'] >>> l ['b'] >>> l+t Traceback (most recent call last): File "", line 1, in ? TypeError: can only concatenate list (not "tuple") to list The '+' operation for lists is equivalent to list.extend(). -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 8 days and counting From jean-christophe.mincke at protonworld.com Tue Dec 4 05:40:33 2001 From: jean-christophe.mincke at protonworld.com (Mincke Jean-Christophe) Date: Tue, 4 Dec 2001 11:40:33 +0100 Subject: Help MULTILINE Message-ID: <7ACA7CB79E49D411AE51009027DCCF33DB2D1A@neutrino> Hello I am trying to use to MULTILINE flag of re.compile(). And I am not really successfull. Where can I find a set of well written examples of MULTILINE usage? Thank you Jean-Christophe Mincke Proton World +32 2 724.50.52 **********************D i s c l a i m e r************************* This message (including attachments) is intended only for the person or entity to which it is addressed. As it may contain confidential and/or privileged information, it must not be retransmitted or otherwise disseminated, nor must any actions be taken that rely upon it by persons or entities other than the intended recipient. Under no circumstances can this message (including attachments) be seen as evidence that may be used in court of law. If you received this message in error, please accept our apologies, delete it from your computer and advise the sender immediately by reply e-mail or by telephone to +32 2 724 51 11. Thank you for your co-operation ****************************************************************** From LLoeffler at home.com Wed Dec 26 22:01:18 2001 From: LLoeffler at home.com (Luke) Date: Wed, 26 Dec 2001 21:01:18 -0600 Subject: REPOST: Re: strange Tkinter problem References: <3C297E61.70701@home.com> Message-ID: <5$--$$-$$$$%%-$$-$@news.noc.cabal.int> No, Tkinter doesn't automatically spawn a new thread to handle a callback function. I suppose you could modify the code if you wanted to at the risk of destroying all portability. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Luke Newsgroups: comp.lang.python Subject: cmsg cancel <3C2A8EFE.4010406 at home.com> Control: cancel <3C2A8EFE.4010406 at home.com> Date: Mon, 31 Dec 2001 04:59:07 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775951 27193 211.57.49.2 (31 Dec 2001 05:19:11 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:19:11 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From r.b.rigilink at chello.nl Wed Dec 12 04:51:05 2001 From: r.b.rigilink at chello.nl (Roeland Rengelink) Date: Wed, 12 Dec 2001 09:51:05 GMT Subject: staticmethod and __call__ References: <3C1089FC.617D6D7B@chello.nl> Message-ID: <3C1728C3.548D608B@chello.nl> Bruce Eckel wrote: > > Actually, I can simplify this in one sentence: if you can make > __call__ a static method, then how do you create objects of that > class? > When I first investigated this, I hoped something like this would work: >>> class A(object): ... def __call__(*args, **kwargs): ... print 'called' ... return object.__new__(A, *args, **kwargs) ... __call__ = staticmethod(__call__) And it does, in the sense that A.__call__() returns a new instance >>> b = A.__call__() called >>> b <__main__.A object at 0x8161574> but, A() doesn't do A.__call__ >>> A() <__main__.A object at 0x815ed7c> That is, implementing __call__ such that is does return (new) instances is no problem. However, you can't convince Python to translate A() in A.__call__(). I used to think this was to bad, but now think is actually a good thing By the way, having remembered __new__, here's your ItemGenerator again >>> class ItemGenerator(object): ... rgen = random.Random() ... items = ['A', 'B', 'C'] ... def __new__(cls): # __new__ is always a classmethod ... return cls.rgen.choice(cls.items) ... >>> items = [ItemGenerator() for i in range(5)] >>> items ['C', 'C', 'A', 'A', 'A'] Looking forward to your paper, Roeland -- r.b.rigilink at chello.nl "Half of what I say is nonsense. Unfortunately I don't know which half" From ulf.magnusson at ubm-computing.com Sun Dec 30 03:39:55 2001 From: ulf.magnusson at ubm-computing.com (Ulf Magnusson) Date: Sun, 30 Dec 2001 08:39:55 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <4VlX7.6657$l93.1694996@newsb.telia.net> <6o6s2u4pa4kvqben6ftatrfttu9s78ee1k@4ax.com> Message-ID: "Courageous" wrote > >and to defeat the speed problem: an OPTIMIZING NATIVE CODE COMPILER > > You're not the first person to think of this. One of the problems > is that designing an optimizing native code compiler for a fully > dynamic language like Python is quite a difficult task. Yes I would be, personally I like to think of Python as the Inverse of C. C is: Easy to learn Genrates fast code and you have to write many lines of code to accomplish something. Python is: Hard to learn (well relativly to C) Generates piss pore performance code (I am sorry to say) A few lines of code does almost anything you want. I have been a dedicated C programmer for as long as I can remember, and a while back I realised that I had to adopt a *second* language a second default language that is. uhm, you know what I mean, we (community folks) learn a lot of languages to find one or two to stick with and to do our projects in. For me it is C and Python I am glad to say! Where was I, oh yes, we were discussing how difficult a task it would be to implement a compiler, Well I guess this will follow the C Inverse theory as well C in relativly easy and.... > > >1. Since the language is currently evolving very rapidly it is probably > > a bad time to start such a project, > > Not really. The basic parts of Python which the compiler needs to > support properly have been present for years. It has to do with > first class language access to the dictionary which exists in every > namespace, and how this first class access intertangles semantically > with Python itself. Or at least that is one major element of the > picture. IIRC, the generation of execution frames plays another role, > and these likewise offer first class accessibility in Python. Again, > they are intertwined. Good point. /U. Magnusson From brueckd at tbye.com Sat Dec 1 19:28:26 2001 From: brueckd at tbye.com (brueckd at tbye.com) Date: Sat, 1 Dec 2001 16:28:26 -0800 (PST) Subject: A modest indentation proposal In-Reply-To: <83y9knrwo2.fsf@panacea.canonical.org> Message-ID: On 1 Dec 2001, Kragen Sitaker wrote: > I'm interested to hear what you find to be common causes of problems > when you're programming in Python. Here's some long-winded ones off the top of my head: - I've yet to find a really good way to organize modules and functions I've written and know I'll want to use again later. If there's something annonying or missing in Python then usually a small function or module will fix that, but then I end up littering my home and work computers with various copies of different versions of that same thing, where some are accessed by being in the same directory as whatever program I'm working on, others by making sure the Python path includes some dump-all directory, and others by modifying the Python path at runtime. Maybe the solution is sort of a private CPAN-like thing, but I've never gotten around to working on it. - A lot of times I find my self over-engineering a solution, a problem made worse by the fact that so many projects have shifting/evolving requirements. I used to believe that it was best to get it right the first time, but often "right" can't even be defined until after the first release, and then it changes with each subsequent release. Assuming you've invested sufficiently in your testing, a complete rewrite can be cheaper (in both time and effort) than the cost of getting it "right" first and then pushing the original version to adapt to changing requirements. To help me overcome my aversion to rip-it-out-and-toss-it we actually scheduled a complete rewrite of a product after each major release. We're just starting the third rewrite, all our tests pass, and we have essentially zero code baggage (hacks added over time to make the product do what we didn't anticipate was needed) and loads of new features, all in the same amount of time we had scheduled originally just to add the new features. It still seems crazy to me but it has also gone so much easier than some past projects. I'm still trying to really understand why it has worked so well, but we're really benefitting from it anyway. - Too often I fail to use neat Python idioms, instead relying on using C, C++, Java, etc. techniques in Python. I'm anxious to read anyone's books on Python "patterns" or programming "gems" as they represent potentially untapped power. - Because Python code is so concise I often let little functions grow to 50 or more lines. Sometimes that's ok, but in Python that's often too much punch for a single function (you can do a heck of a lot in 50 lines!) and then that function ends up being too difficult to thoroughly test. - I sometimes abuse dynamic types by letting function parameters take on too large a set of meanings. One IMO beautiful example of where this works well and is ok is in asynchat, where you tell the module to read data from a socket until some terminator is reached. If the terminator is None, it reads all data, if the terminator is a number, it means read that many bytes, and if it's a string, it means read until that token is found in the data. Unfortunately, in my own code there's rarely that level of cohesion among the different meanings of a parameter. In all the problems I've encountered so far, I can't think of any that would be appropriately solved by modifying the language - it's all about learning how to better use the tools in front of me and replacing bad habits with better ones. -Dave From ulf.magnusson at ubm-computing.com Sat Dec 29 11:09:36 2001 From: ulf.magnusson at ubm-computing.com (Ulf Magnusson) Date: Sat, 29 Dec 2001 16:09:36 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <3$--$$_----__$--%$@news.noc.cabal.int> I am shocked and exhilarated what large discussion this turned out to be. I have been reading this news subject (started by Ron Stephens) all day long (Well almost :-) The future of a language (and especially Python) is truly an interesting topic. The submissions to this "news category" have truly been interesting. It was said that "we" (the community) wanted more "real" Commercial usage, Patrick (RPM1 ) said: "The guy with the bag of money needs to say, "Oh yeah, Python, I've heard of that."" It was also said that python vs. other languages didn't lack any functionality well I agree, it don't since it's "Turing complete" like all other computer languages, instead, one could possibly talk about the "supporting libraries" and python is darn good in that area. However, Python do lack one important heuristic for the commercial industry - RUNTIME SPEED - (Well this is not always true) I have a "little" proposal how to get gain more acceptance for the language and to defeat the speed problem: an OPTIMIZING NATIVE CODE COMPILER should be developed... Pheeew.. now I said it... (time to seek out the bomb shelter.. :-)) I guess I am a kind of a optimization junkie for mentioning this... anyhow I am not saying we should compete with languages like C in speed but a fairly optimizing compiler would be nice without compromising the language capabilities. Now the guy with the bag of money can say: "I bought a optimizing Python compiler yesterday"... and his associate would say: "Good for you, now your company can both develop applications rapidly which are free from bugs and even execute them safe and fast" Before you all jump at me at once, let me make a obvious initial statements: 1. Since the language is currently evolving very rapidly it is probably a bad time to start such a project, the language may look completely different in a year and a lot of resources would have been wasted. 2. It may be difficult and dumb to develop a native code compiler because Pythons great introspection capabilities. I haven't really thought about this issue for long, but it should at least be possible and cool... 3. Companies may have trouble to accept python before the language evolvement curve is fairly slow, consider trying to "link" python modules from 1.5.2 and "python 3.0" ouch... And now, what do you valued colleagues have to say about: 1 an optimizing native code compiler? 2 the commercial impact of such a compiler? (If by any chance a commercial company is considering this, I am for hire) /U. Magnusson **************************************** * Ulf Magnusson, Swedish Developer * UBM Computing * Mail: ulf.magnusson at ubm-computing.com * www: http://www.ubm-computing.com **************************************** ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Ulf Magnusson" Newsgroups: comp.lang.python Subject: cmsg cancel <4VlX7.6657$l93.1694996 at newsb.telia.net> Control: cancel <4VlX7.6657$l93.1694996 at newsb.telia.net> Date: Mon, 31 Dec 2001 05:11:31 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774618 27193 211.57.49.2 (31 Dec 2001 04:56:58 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:56:58 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From peter at engcorp.com Sat Dec 29 22:06:05 2001 From: peter at engcorp.com (Peter Hansen) Date: Sat, 29 Dec 2001 22:06:05 -0500 Subject: Python Popularity: Questions and Comments References: <3C2CBACB.FBF3C3C9@mindspring.com> <3C2D47F0.6DF7C8BE@mindspring.com> <3C2DF5FF.E332F4EE@mindspring.com> Message-ID: <3C2E849D.8242B65D@engcorp.com> "Dr. David J. Ritchie, Sr." wrote: > > I'd like to say that it almost seems like Python > is not that far away from allowing as a language feature: > > from module.python.org import * > or > from module.python.org import graphics > > where "module.python.org" is some internet node. The idea is sound, but for now I think really practical only on a company intranet. Internet connectivity is still too unreliable to make this very effective except for strictly Internet-related applications (i.e. those which have no intrinsic purpose when an Internet connection is not available.) That said, I suppose a little local caching would provide a reliable backup after the first invocation had succeeded. And none of this would be in any way difficult to implement even now, since you can just substitute your own implementation of __import__(). -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From rnd at onego.ru Sun Dec 23 04:56:48 2001 From: rnd at onego.ru (Roman Suzi) Date: Sun, 23 Dec 2001 12:56:48 +0300 (MSK) Subject: Search the difference: Why this function defenition does'nt work? In-Reply-To: <3C259F21.2070604@student.kun.nl> Message-ID: On Sun, 23 Dec 2001, husam wrote: >But when I adjust the code to this: > >sum=['c'] > >it still does not work, despite the fact that sum is not an undefined >object, right? Probably this is what is slightly more compact approach to your problem of making sum of numbers: >>> f = lambda *args: reduce(lambda x, y: x+y, args, 0) >>> f(1,2,3) 6 As for slices vs. indices, it is clear that a[0] is not a[:0] because a[0] is an element and a[:0] is a subsequence. I am not sure why do you need to change fun2, but this is what will work: def fun2 (*args): sum = args and args[0] or 0 for next in args[1:]: sum = sum + next return sum In any case, it is impossible to make universal summing function without specifying the zero-len case. Sincerely yours, Roman Suzi -- _/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/ _/ Sunday, December 23, 2001 _/ Powered by Linux RedHat 6.2 _/ _/ "When a New Yorker looks as if he's suntanned, it's probably rust." _/ From fperez528 at yahoo.com Thu Dec 20 14:22:17 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Fri, 21 Dec 2001 18:50:17 +2328 Subject: vi or emacs for editing Python on Linux? References: Message-ID: maxm wrote: > One of my biggest problems in switching is my editor. On windows I use > Ultraedit as a general editor, and i type really fast in it. Knowing the > shortcuts and all. Every time I boot up one of my Linux machines I have a > hard time editing files under the arcane unix editors. I have tried both > emacs and vim and I disklike both! I'm more of an Xemacs person than vi, but I'm not going to bash either here. What I'm going to say is: when I started using linux, I already had some fairly ingrained keyboard habits from windows, which I didn't want to lose. So I spent some time customizing the keybindings for Xemacs (gvim didn't exist at the time) to mimic a lot of what I knew from windows. The only problem I now have is that even though I fly in Xemacs, I can't do anything in a 'raw' emacs, I need *my* customizations :) So my point is: both are excellent tools, but go with a graphical one (either Xemacs or gvim). And before you go too far, spend some time fixing the keyboard shortcuts to everything you already know, it will save you *a lot* of grief. If shift-arrow selection is second nature to you, look at the latest Xemacs version which finally implements it. If you decide to go the xemacs way, I can mail you my customization file and you can start from there. I know exactly 0 lisp, but by copying other people's files and fixing them I have a very nicely setup Xemacs for my work. > > My understanding is that for emacs I have to use a lisp dialect to > automate/extend it, and in vim I can use Python as an extension language of > sort. Do I understand that correctly? As others have said, now you can do the same thing in emacs using pymacs. > I would especially like to use my next editor on my notebook with as little > use of the mouse as possible. don't worry. Just about every good unix tool views the mouse as a secondary option. You'll never find a decent unix editor *forcing* you to use the mouse, as is all too common in the windows world. good luck, f. From bob at kontact-nospam.com Sat Dec 15 17:33:40 2001 From: bob at kontact-nospam.com (Bob) Date: Sat, 15 Dec 2001 14:33:40 -0800 Subject: accessing CDO email message properties (outlook 2000) Message-ID: <3C1BCFC4.4C47CF3C@kontact-nospam.com> An HTML attachment was scrubbed... URL: From issac at myfirstlink.net Sun Dec 30 18:13:36 2001 From: issac at myfirstlink.net (Issac) Date: Sun, 30 Dec 2001 17:13:36 -0600 Subject: sizeof(int) References: <3C2A9D33.67FEC261@earthlink.net><3C2BA7B8.35286DE3@earthlink.net><3c2de385.9780406@news.t-online.de><3c2deb81.11823921@news.t-online.de><871yhd7red.fsf@kursk.kassube.de><87ellcrfs3.fsf@kursk.kassube.de><20011230145819.59aa99a2.logiplexsoftware@earthlink.net><00c201c19182$61e3ce60$6401a8c0@mojave> <20011230160506.5e7f3b5d.logiplexsoftware@earthlink.net> Message-ID: <010601c19187$9bd89740$6401a8c0@mojave> I agree. C isn't a bad language, it's just hardware-centric. Issac > > He's probably trying to drive home the point that sizeof(int) isn't > > well-defined in the C language. On C implementations with 16-bit > integers, the > > function call results in an overflow. In this case, the answer is 23575. > > Your phrasing ("sizeof(int) isn't well-defined") helped me see the > fundamental issue: in my mind, sizeof(int) _is_ well-defined, that is to > say, it is defined as the machine-word-size on whatever platform is being > used. Of course, this varies from machine to machine, but maybe this > should be seen as hardware word-sizes being poorly-defined ;-) One of the > big goals of C was efficiency, so defining ints this way made sense > (sizeof(int) equals size of CPU register). This is also why C is good for > writing to bare-metal: it is defined in terms of the machine. Other > languages that attempt to hide the underlying hardware architecture are > best for typical applications that don't care about the hardware, but can > get in the way or make it burdensome to write code that deals directly with > hardware. On the downside, it does affect portability, but any code that > deals with hardware is going to have issues like this. > > > Cliff > > > -- > Cliff Wells > Software Engineer > Logiplex Corporation (www.logiplex.net) > (503) 978-6726 x308 > (800) 735-0555 x308 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.310 / Virus Database: 171 - Release Date: 12/19/2001 From keyton at weissinger.org Tue Dec 11 21:12:48 2001 From: keyton at weissinger.org (A. Keyton Weissinger) Date: Tue, 11 Dec 2001 21:12:48 -0500 Subject: urllib2/httplib Problems: Any idea? In-Reply-To: Message-ID: Greetings, I have a large application service provider application (web/browser-based). I am attempting to write a simple script that will log into the application and initialize. This basically requires a login script, capturing the cookie (using WebLogic) and then (sending back the cookie) calling five JSPs in a row that return XML (some quite long). This process is repeated for about 100 sites (so approximately 600 JSP calls total). Well I've tried this both with httplib and with urllib2. They work. The cookie is being sent, etc. etc. But here's the problem: If I am at work, it will simply stop at some random point (typically after 20-30 of these sets) and hang. No error. Nothing. It just doesn't come back from the urlopen() call. I do it at work and it works fine. Any ideas? Keyton From roy at panix.com Sat Dec 29 13:40:16 2001 From: roy at panix.com (Roy Smith) Date: Sat, 29 Dec 2001 13:40:16 -0500 Subject: Two languages, too similar, competing in the same space. References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> Message-ID: gerson.kurz at t-online.de (Gerson Kurz) wrote: > Call me oldfashioned, but I don't like exception handling - I like > if-then-else and error checking style. I am certainly old fashioned. I thought FORTRAN was a great step up from writing in assembler. I've been doing python for about 4 years now, and I'm only just starting to really warm up to the idea of using exceptions on a regular basis, but I've finally gotten the hang of it (by which I mean not just learning the syntax, but getting to the point where it just seems natural). I've been writing lots of parsers lately, for every sort of data file we use. Each new parser is a subclass of a genericFileParser class I wrote (which takes care of low level stuff like reading the file, allowing lines to be pushed back onto the input stream to be reread later, keeping track of line numbers, and formatting error messages). Some of the parsers are pretty complex, employing state machines. Anyway, genericFileParser includes a parseError() method. A specific file parser subclass can just do: If len(blurfl) != 42: self.parseError ('bogus length for blurfl') and you end raising genericFileParser.ParseError with an argument of something like 'parse error in file foo.baz, line 47: bogus length for blurfl'). The really nice thing is it could have been generated deep in a function call chain, and I don't have to worry about propigating the error indication back up the chain. Even nicer, when I'm prototyping a new application, I don't have to worry about error checking at all; I just call my parser and assume everything works as it's supposed to. With return-status type error checking, if I got lazy and didn't check for errors, my program would just continue merrily on its way producing garbage, or mysteriously crashing at some other remote point in the code. With exceptions, if I fail to catch the exception, I blow out of the interpreter with a stack track, so I catch the error right away. Often times, all I'm going to do when I catch the error is exit cleanly with a nicely formatting message, but I can add that code later, at my convenience. From dgrisby at uk.research.att.com Tue Dec 18 11:09:05 2001 From: dgrisby at uk.research.att.com (Duncan Grisby) Date: 18 Dec 2001 16:09:05 GMT Subject: SOAP.py Message-ID: <9vnpn1$t45$1@pea.uk.research.att.com> [ I sent this post to the pywebsvcs list, but I thought I'd post it here too. ] I've just started trying some experiments with SOAP.py 0.9.7. I'm having a problem with the server side that is so fundamental that I'm sure I must be doing something wrong, but I can't see what. Here is my server: --------------- import SOAP SOAP.Config.dumpSOAPOut = 1 def echo(s): return "Hello " + s server = SOAP.SOAPServer(("localhost", 8000)) server.registerFunction(echo) server.serve_forever() --------------- Not exactly complicated. Now, when I try a client, I get: --------------- Python 2.2c1 (#1, Dec 17 2001, 19:20:56) [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import SOAP >>> server = SOAP.SOAPProxy("http://localhost:8000/") >>> server.echo("Duncan") "{'Result': 'Hello Duncan'}" --------------- Note that that is a _string_ containing the Python representation of a dictionary. Looking at the XML sent by the server: *** Outgoing SOAP ****************************************************** {'Result': 'Hello Duncan'} ************************************************************************ I'm sure that can't be right. The parsing code doesn't seem to understand "xsd:dict". I'm sure it must be wrong to be transmitting a dictionary using its Python representation. If I apply the following patch, everything behaves the way the documentation claims it should: --- old_SOAP.py Mon Dec 17 20:26:09 2001 +++ SOAP.py Mon Dec 17 20:24:42 2001 @@ -3769,7 +3769,7 @@ config = self.server.config) else: resp = buildSOAP(kw = - {'%sResponse' % method: {'Result': fr}}, + {'%sResponse' % method: fr}, encoding = self.server.encoding, config = self.server.config) except Exception, e: Is this the right thing to do? Am I barking up the wrong tree? Does anyone have a suggestion of any other Python SOAP implementation that is as simple to use as SOAP.py? Cheers, Duncan. -- -- Duncan Grisby \ Research Engineer -- -- AT&T Laboratories Cambridge -- -- http://www.uk.research.att.com/~dpg1 -- From soppers3 at cti.ecp.fr Sun Dec 30 15:40:19 2001 From: soppers3 at cti.ecp.fr (Stephane SOPPERA) Date: Sun, 30 Dec 2001 21:40:19 +0100 Subject: REPOST: wxBitmapFromImage function in wxPython? Message-ID: <8$--$$_----__$_%-$@news.noc.cabal.int> I read in the documentation of wxPython that this function exists: wxBitmapFromImage(image, depth=-1) Convert a wxImage to a wxBitmap. But the Python does not know it. When I use it, it return an Nameerror exception. (I use the from wxPython.wx import * command) It's not in dir(wxPython.wx). I'm using python 2.1. Is that function really exists? What could be another solution to do the same thing? Thanks in advance, -- Stephane SOPPERA http://stephane.soppera.free.fr ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Stephane SOPPERA Newsgroups: comp.lang.python Subject: cmsg cancel <3C2F7BB3.577D3712 at cti.ecp.fr> Control: cancel <3C2F7BB3.577D3712 at cti.ecp.fr> Date: Mon, 31 Dec 2001 04:31:18 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774091 27193 211.57.49.2 (31 Dec 2001 04:48:11 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:48:11 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From mwh at python.net Mon Dec 3 06:00:38 2001 From: mwh at python.net (Michael Hudson) Date: Mon, 3 Dec 2001 11:00:38 GMT Subject: pty controlling app References: Message-ID: bsturk at news.rcn.com (Brian Sturk) writes: > I am trying to control a shell and found a few posts with > examples of controlling ssh using the pty module and cribbed the code. > My issue is I'm unable to get it to execute commands. They just get > echo'ed back. I found a post where someone had the same issue but never > posted how he got it to work after he figured it out. :( > I'm probably missing something very obvious but I've searched > everywhere and haven't been able to figure it out. Any > help would be greatly appreciated! Well, my copy of bash2 prints its version and exits when invoked as $ bash2 --version Changing --version to -i and putting in a few more judicious time.sleep()s, your code seemed to work. The output is a bit messy but that's because I have a fancy $PS1. Cheers, M. -- 59. In English every word can be verbed. Would that it were so in our programming languages. -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html From bas at andrew.cmu.edu Tue Dec 25 01:13:57 2001 From: bas at andrew.cmu.edu (Bruce Sherwood) Date: Tue, 25 Dec 2001 01:13:57 -0500 Subject: [Visualpython-users] New Windows VPython In-Reply-To: <000901c18ce9$d8537020$a9e1fea9@carol> Message-ID: <4220490166.1009242837@HYPERON.REM.CMU.EDU> I'm not sure how to say it any more plainly than I've already said it, but I'll try once more. NOTHING has changed in VPython that forces you to use the new division operators! What has changed is that you MAY if you wish use the new division operators, even if you use Numeric arrays. The problem was that Numeric didn't recognize and process the new "true division" and "floor division" operators present in Python 2.2. There is no "fork" of Numeric. I've submitted the additions for inclusion in the next release of Numeric and been thanked for doing the work and told that many people were asking for this. But if you don't want to use the new division operators, DON'T put "from __future__ import division" in your programs! Including when you're using VPython! As to the student issue: There is no theorizing nor condescension in this. The actual data are that very smart college freshmen with very high SAT's etc., but who often have never written a computer program before, frequently make the "mistake" of writing such things as 1/2 thinking that this means the same as 0.5, because that's what it means in all other environments, including their pocket calculator. And they and their instructors find it difficult to track down why the program fails, because the difference between 1/2 and 1./2 is awfully subtle and hard to pick up in proofreading. I have a Ph.D. in physics, done a lot of system software work including creating a respectable programming language (cT), and I make this "mistake" too when doing scientific programming. I repeat that this is about the only significant problem our students have had with Python. Can you present data that our students don't have a serious problem with this issue? Remember too that this is in the context of a physics class, not a computer science class, and we can't afford to spend time on teaching picky details of syntax. Until now there was nothing we could do about this. We did not want to do what the Alice project did, which was hack Python to fix the problem, because this would be a "fork" and make our Python different from the world Python. Now with Python 2.2 we can teach our students to insert "from __future__ import division". And we can try to teach students that when a program fails, they should check to make sure that they've inserted this line. It is at least a reasonable question whether to drive Python or VPython with the "-Qnew" command-line option which has the same effect as the import statement. On balance, we think we shouldn't make this the default run mode in our local classroom VPython environment, because our students may well run Python and/or VPython in environments other than our classroom. I will attempt to say nothing more about any of this. Bruce Sherwood --On Monday, December 24, 2001 21:14 -0500 Arthur Siegel wrote: >> You've jumped the gun, but your input is useful nevertheless. > > I'm not sure how. I am reading your message to say that the copy > of Numeric that is downloaded with VPython has been patched. > And since I am directing users of PyGeo to VPython, I am directing > them to a forked version of Numeric. Which is somehow horrid to me. > > What am I missing. > > As to the rest - I should probably keep my peace. > > I've pissed off enough people and caused myself enough > grief in the course of it. > > But is all quite, quite incredible to me. > > I think the importance you attach to this issue is monumentally > overstated, and overwhelmingly condescending. > > Now you are further saying that your students can't even be > trusted to be able to handle the from __future__ statement > all my their little bitty selves. > > Suffice it to say that am I sure the hell glad I'm not in > school anymore. > > Art From ldw at us.ibm.com Wed Dec 19 17:08:43 2001 From: ldw at us.ibm.com (Larry Whitley) Date: Wed, 19 Dec 2001 16:08:43 -0600 Subject: Access to Windows Archive bit Message-ID: <9vr35a$q92$1@news.rchland.ibm.com> Is there a method in some module that will give me access to the archive information available for individual files in windows directories? Larry From quinn at chunder.ugcs.caltech.edu Mon Dec 3 19:04:28 2001 From: quinn at chunder.ugcs.caltech.edu (Quinn Dunkan) Date: Mon, 03 Dec 2001 16:04:28 -0800 Subject: whats new in 2.2 (was A modest indentation proposal) In-Reply-To: Your message of "Tue, 04 Dec 2001 00:11:18 +0100." <200112032311.fB3NBIua015658@ratthing-b246.strakt.com> Message-ID: <20011204000433.B380C781C8@chunder.ugcs.caltech.edu> > Here is my current decorator pattern: > > class Decorator: > """An abstract Decorator class based on one posted to comp.lang.python > by Rainer Deyke. > """ > def __init__(self, decorated): > self._decorated = decorated > # add some data attributes you want > def __getattr__(self, name): > return getattr(self._decorated, name) > def __call__(self, *args, **kwargs): > self._decorated(*args, **kwargs) > # Override other operators too Yeah, the "Override other operators too" part is the problem. You have to make sure you get all of them. With the above if you decorate a list, len(lst) will throw an exception, since getattr([], '__len__') fails. Here's my decorator that manages to avoid __getattr__ alltogether: class Exclusive_file: class Already_locked(IOError): pass def __init__(self, filename): self.fp = open(filename, 'r+') try: fcntl.lockf(self.fp.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EAGAIN: raise self.Already_locked(filename) else: raise # delegate methods without using a slow __setattr__ for attr in dir(self.fp): if not hasattr(self, attr): setattr(self, attr, getattr(self.fp, attr)) Making this change speeded the program up considerably, since readline() is so popular. It's not trustworthy in general, since dir() doesn't tell the whole story with regards to inheritance, etc. Still, it works ok for file objects. Once again, dir() has changed in 2.2. You wouldn't want to use this for a generic delegator, though, because things break horribly if someone has dynamic attributes. > This relies on the fact that my __getattr__ will not get called if > python already finds the attribute. What am I supposed to do in 2.2 > with not classic classes, if this is the exact behaviour I want? Classic classes are only activated when you inherit from 'object'. In any case, the 2.2 change that will make you happy here is that [] now has a __len__ attribute. 2.2 also seems to have a __getattribute__ that *always* gets called. It's like __builtins__ vs. __builtin__, it looks like a typo but actually there's an important difference. *sigh* Of course, if it had a 'len' attribute, we could get rid of the ugly __magic__ method and redefine the len() builtin as 'def len(x): x.len()'. Because of backwards compatibility, though, that will likely never happen. From maxm at mxm.dk Fri Dec 21 13:22:48 2001 From: maxm at mxm.dk (maxm) Date: Fri, 21 Dec 2001 19:22:48 +0100 Subject: age of new pythonistas [was: The Editor Poll results are in!] References: <3bfd7f87@news.airtel.net> <9u4cbu$2ts$1@news.xmission.com> <9udn1g$64c$1@brokaw.wa.com> <3c224f96.865756852@wa.news.verio.net> <3C226D85.1080308@skippinet.com.au> Message-ID: Pushing towards 37 here. And I LOVE writing in Python. Previous languages are: Pascal A nice simple language wich had a good dos enviroment. Really snappy. Cobol (a little) Just to try it out. Modula-2 Bought a damn expensive comiler as a student, but there was no good documentation, so that was a drag. Lingo The almost language in Director c Just got my toes wet on the Amiga/PC VBScript Years of writing dynamic websites. JavaScript A few more years of writing websites. Definitely more pleasureable than VBScript which is horrid. Java Way to much code for way to little work. The libraries kept changing to fast. Bothersome and slow compile cycle. Perl well I fell for the hype, fell in love with regular espressions. and in disgust with the syntax for lists and dicts. Python Love it every second. Every day spend writing Python is a fun day. And I hardly use reg-ex's any more :-) No messing arround with the language, just writing code, trying out ideas, and refactoring all the time because its so easy. I will try to get more up to speed in c, so that I can extend Python better. I havn't really made my mind up about c++. Most people seem to find it to hard to learn, and I also belive more in the Python/c combo as the way to go. But one of my interrests is algorithmic composition, and Python definitely has a lack of good media libraries. Well they will get her sooner or later, or I will write them myself. But for my bread and butter webstuff Python is far the best choice on any platform. Python is clean simple and elegant. So unless a better language shows up, my answer in 30 years will probably be ... "Pushing towards 67 here. And I LOVE ..." regards Max M From ngreco at softhome.net Sat Dec 29 12:21:47 2001 From: ngreco at softhome.net (Nahuel Greco) Date: Sat, 29 Dec 2001 14:21:47 -0300 Subject: PythonCard, ease of use, and the GUI problem/opportunity/niche In-Reply-To: <3C2D620C.2E67414D@earthlink.net> References: <3C2A9D33.67FEC261@earthlink.net> <458b194a.0112282052.1123341@posting.google.com> <3C2D620C.2E67414D@earthlink.net> Message-ID: <20011229142147.65dc5112.ngreco@softhome.net> On Sat, 29 Dec 2001 06:24:44 GMT Ron Stephens wrote: > Bingo! Boy, oh, boy, do I agree with you on this. I think you hit the nail > right on the head. > > Building a gui now using Python, compared to using VB, really sucks. Yes, it's > that bad. > Maybe in the future you will be building GUI's with GNUStep Project Center and Gorm ( http://www.gnustep.it/pierre-yves/index.html ), and using PyObjC (python.sourceforge.net), that will rock. But for now, you can build GUI's with glade and use them in your program. - Nahuel Greco Web Development - Open Source - - http://www.codelarvs.com.ar Game Programming - Research - - Freelance coding / sysadmin Networking. The answer is 42. - From mwh at python.net Mon Dec 3 07:06:47 2001 From: mwh at python.net (Michael Hudson) Date: Mon, 3 Dec 2001 12:06:47 GMT Subject: Distutils bdist_rpm missing licence option? References: Message-ID: Tom Bryan writes: > I'm using Distutils-1.0.2 with Python-1.5.2. I'm trying to build an RPM > for PyUnit. Here's my .cfg file > > # pyunit Distutils configuration file > [bdist_rpm] > licence = Python License > long_description = This package contains PyUnit, a unit testing framework \ > for Python. PyUnit is a standard library in Python 2.1, but it needs \ > to be installed separately for Python 1.5.2. > release = 1 > vendor = Ecoaccess.org > packager = Tom Bryan A wild guess, but could you put the licence option somewhere global to distutils rather than specific to bdist_rpm? This is inspired by finding: spec_file.extend([ 'Copyright: ' + self.distribution.get_license(), 'Group: ' + self.group, 'BuildRoot: %{_tmppath}/%{name}-buildroot', 'Prefix: %{_prefix}', ]) in Lib/distutils/command/bdist_rpm.py in CVS. Cheers, M. -- I'm okay with intellegent buildings, I'm okay with non-sentient buildings. I have serious reservations about stupid buildings. -- Dan Sheppard, ucam.chat (from Owen Dunn's summary of the year) From starx at pacbell.net Tue Dec 4 01:40:04 2001 From: starx at pacbell.net (Philip Swartzleonard) Date: 4 Dec 2001 06:40:04 GMT Subject: Displaying multiple results in a list References: <741f261e.0112031331.75c2e1c6@posting.google.com> Message-ID: Drew Fisher || Mon 03 Dec 2001 02:10:30p: >> Wanted to know if there was a way to specify ranges in a list such as: >> >> newlist = ["1", "2", "3", "4", "5", "6"] >> >> print newlist[1..3] #ie: print newlist[1], newlist[2], newlist[3] >> >> Can something like this be done? >> >> /russ >> -- > > Sure. > > Just use the ":" character to seperate the start / stop index: > > newlist = [1,2,3,4,5,6,7] > print newlist [start:stop] > > e.g.: > >>>> newlist = [1,2,3,4,5,6,7] print a[1:5] > [2, 3, 4, 5] I think what the OP is looking for is something more along the lines of: for each element in list[0:5]: print element Which is the next logical step from just making a newlist variable (sort of like making newlist then doing for each in newlist, without the intermdiate?), i think :) -- Philip Sw "Starweaver" [rasx] :: From mwh at python.net Mon Dec 24 15:41:14 2001 From: mwh at python.net (Michael Hudson) Date: Mon, 24 Dec 2001 20:41:14 GMT Subject: C++ throw causes abort in extension? References: <20011224.123518.378096161.2956@localhost.localdomain> <2ZKV7.13654$PO5.2163087@newsread1.prod.itd.earthlink.net> <20011224.150648.1067106872.1069@localhost.localdomain> Message-ID: "Robert Nikander" writes: > Well it is something that was added to gcc between 2.95.3 and 3.0.2. > > I just tried compiling my extension with gcc 2.95.3 rather than > 3.0.2 and exceptions are caught fine. So it must be something added > in gcc 3. Or taken away; it may only have worked by fluke before. Chris' advice is still probably worth considering. Cheers, M. From ChuckEsterbrook at yahoo.com Mon Dec 3 18:51:16 2001 From: ChuckEsterbrook at yahoo.com (Chuck Esterbrook) Date: Mon, 3 Dec 2001 15:51:16 -0800 Subject: [ANNOUNCE] Webware for Python 0.6 Message-ID: <20011203235117.NJYO9230.femail21.sdc1.sfba.home.com@there> Webware is a suite of Python packages for developing object-oriented, web-based applications. The suite uses well known design patterns and includes popular features such as: * A fast, multi-threaded, easy-to-use application server * Servlets * Python Server Pages (PSP, similar to ASP, PHP and JSP) * An object-relational mapper * Task scheduling * User management and authentication * A CGI wrapper Home: http://webware.sourceforge.net/ Download: http://prdownloads.sourceforge.net/webware/Webware-0.6.tar.gz Docs: http://webware.sourceforge.net/Webware/Docs Discuss: mailto:webware-discuss at lists.sourceforge.net Highlights of 0.6: * Still supports Python 1.5.2, but other than 0.6.x maintenance releases, future versions of Webware will require Python 2.0. * Major enhancements to various packages including WebKit & MiddleKit: http://webware.sourceforge.net/Webware/WebKit/Docs/RelNotes-0.6.html http://webware.sourceforge.net/Webware/MiddleKit/Docs/RelNotes-0.2.html From arno at research.att.com Mon Dec 10 17:40:24 2001 From: arno at research.att.com (Arno Puder) Date: Mon, 10 Dec 2001 22:40:24 GMT Subject: Instantiating Python class from C Message-ID: <3C1539D8.9090408@research.att.com> Hi, assume I have a Python class, defined through the interpreter. How do I instantiate a new object of this class in C within an extension of the Python interpreter. E.g., # Python class A: #... // C PyObject* new_A_object = ??? Thanks, Arno From ballsacks at xtra.co.enzed Mon Dec 3 00:23:32 2001 From: ballsacks at xtra.co.enzed (^^@++) Date: Mon, 03 Dec 2001 05:23:32 GMT Subject: Newbie: searching an English dictionary for a reg exp References: <3c09f02f.97177874@news.akl.ihug.co.nz> Message-ID: <3c0b09af.169241776@news.akl.ihug.co.nz> On Sun, 2 Dec 2001 13:54:24 -0800, "Eugene" wrote: >I see a couple problems. First, the regular expression you're using, >"abas?", actually means "match 'aba' with zero or one occurances of 's' >after it." If you mean "match 'abas' with precisely one occurance of any >character after it," you want "aba." [sic]. > Oops, typo. Thanks a lot for your help Eugene, it works now. Now all I need is a .txt file containing every English word... I'm searching now - anyone? Hmm, I just found web2 at ftp://ftp.funet.fi/pub/doc/dictionaries/English/Webster which looks like what I'm after, except being Webster's it'll no doubt be American spelling - I'm after British or New Zealand English... -Matt From rdsteph at earthlink.net Thu Dec 27 18:44:15 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Thu, 27 Dec 2001 23:44:15 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA4D3.5F0BC994@earthlink.net> Message-ID: <3C2BB2E8.737556A5@earthlink.net> Thanks, Dave. I suspect you are right about this. When I went searching for a "scripting" language to learn, about 10 months ago, (after becoming frustrated with Java as a "hobby" language) I really narrowed down the field to just Python and Ruby. I was quite torn because I liked what I saw of Ruby from the Pickaxe book, its a great book! But I ultimately chose Python because I perceived it might be a little easier for me to learn. After all, I have no "C" background at all and no Perl experience either; and rightly or wrongly, what I could find on the web and in the two newsgroups helped me make a close decision to try Python. Dave Thomas wrote: > Ron Stephens writes: > > > Thus, while I admire Ruby, I suspect that it divides the pool of > > developers who might otherwise be all in the Python *camp*. > > From personal experience, I have to disagree. I tried many times to > like Python. I used it on projects and for personal work, but it > never clicked. I couldn't tell you why, and I know it isn't a failing > of the language. It's just that Python and my brain have some kind of > impedance mismatch. > > When I tried Ruby, I fell in love within an hour, so much so that I > was driven to write a book about it. > > This isn't a "Ruby is better than Python" response. It's just an > observation. Ruby and Python are different, and I suspect there is a > substantial body of developers out there who, like me, have a > preference for one over the other. I don't believe that Ruby is > raiding the Python camp. I believe that Ruby is attracting people to > OO scripting who would not otherwise be doing it. > > Regards > > Dave From logiplexsoftware at earthlink.net Mon Dec 10 20:02:46 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Mon, 10 Dec 2001 17:02:46 -0800 Subject: two questions - sockets / c functions In-Reply-To: <200112101947.fBAJllua032444@ratthing-b246.strakt.com> References: <3c14bc2c$1_2@news7.fast.net> <20011210165417.P18573@phd.pp.ru> <200112101947.fBAJllua032444@ratthing-b246.strakt.com> Message-ID: <01121017024601.10828@logiplex1.logiplex.net> On Monday 10 December 2001 11:47, Laura Creighton wrote: > The only thing Oleg forgot to tell you was that sockets don't work on > Windows, so if that was the client-server you wanted, then you need > threading instead. You may, of course, have already known this. If > you want a client server with threading you may be interested in: Did you mean fork() doesn't work? Sockets work as well as anything else on Windows, and I don't see how threading would help if they didn't. -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From xx758 at cam.ac.uk Fri Dec 7 07:45:25 2001 From: xx758 at cam.ac.uk (Xiao-Qin Xia) Date: Fri, 7 Dec 2001 12:45:25 -0000 Subject: Polish the interface of applications Message-ID: <9uqdgq$j1a$1@pegasus.csx.cam.ac.uk> Hi, everybody, When I run my applications based on Tkinter, there is always a TK icon at the left of the title line of the window (northerwest of window), is there any way to replace it with my own icon (.bmp, jpg or gif)? The other thing is when the application (main.py) is running under windows XX, there is always a DOS window opened besides my application window. Is there any way to avoid displaying the DOS window? Cheers, Xiao-Qin Xia From tim.one at home.com Fri Dec 28 23:41:10 2001 From: tim.one at home.com (Tim Peters) Date: Fri, 28 Dec 2001 23:41:10 -0500 Subject: [Q] Deepcopy with Python 2.2 ? In-Reply-To: <440c5c6a.0112280847.55c92de7@posting.google.com> Message-ID: [Oliver Hofmann] > I've had a few problems with copying objects lately when they > reference each other. My understanding is that deepcopy should > take care of that due to the memo - dictionary; this does not > seem to be the case. > > The following code works fine if Base does _not_ inherit > from object. If it does the result is: > > RuntimeError: maximum recursion depth exceeded Please see http://sf.net/tracker/index.php?func=detail&aid=497426&group_id=5470&atid=105470 From alwyns at prism.co.za Tue Dec 11 06:03:34 2001 From: alwyns at prism.co.za (Alwyn Schoeman) Date: 11 Dec 2001 03:03:34 -0800 Subject: Signal handling and threads problem Message-ID: <362d4a8e.0112110303.7375e04d@posting.google.com> Hi, I'm experiencing the problem that on Solaris the main thread doesn't seem to get the signal. I've compiled Python with: --with-signal-module and --with-threads. The signal in question is SIGINT. Now from the source code it appears that it is hacked to work by the module checking whether the pid that receives the signal is that of the main thread or not. This do not seem to work. I wonder if it has anything to do with the fact that as far as I know the threads have the same pid as the main program on Solaris (not sure about this). Anyone shed any light on this please? Thank you Alwyn Schoeman From othello at javanet.com Mon Dec 10 19:28:34 2001 From: othello at javanet.com (Raymond Hettinger) Date: Mon, 10 Dec 2001 19:28:34 -0500 Subject: Small Bug? Message-ID: <9v3k0b$pt2$1@bob.news.rcn.net> I was testing the type/class unification in 2.2b2 and noted a change in behavior between a sub-class of list and a sub-class of UserList. This is excepted from library code for UserList.Py in Python 2.1.1: def __getslice__(self, i, j): i = max(i, 0); j = max(j, 0) return self.__class__(self.data[i:j]) It shows that slices of a userlist are intensionally cast to retain the class object being sliced. In the Python2.2b2, this behavior changes and the slice is returned as a list rather than the type of object being sliced. This code shows the difference: import UserList class L(UserList.UserList): pass p = L(['a','b','c','d']) print p.__class__ # Original object is of class L print p[1:].__class__ # Sliced object is also of class L class M(list): pass q = M(['a','b','c','d']) print q.__class__ # Original object is of class M print q[1:].__class__ # Sliced object in NOT of class M, but has become a list! Raymond Hettinger othello at javanet dot com P.S. I love the new Python. It's great to not have to use 1L anymore to avoid overflow. Generators are cool. Nested scopes are cool. The new divison operator is a step in the right direction. Thanks everyone for putting this together in time for Christmas. From kragen at pobox.com Fri Dec 21 07:11:46 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 21 Dec 2001 07:11:46 -0500 Subject: marshalling data structures between perl <-> php <-> python References: Message-ID: <83y9jw93i5.fsf@panacea.canonical.org> Tripp Scott writes: > aside from using XML-RPC, what python module can i use to > marshall data structures (possibly a combination of lists, > dictionaries, and scalars of ints, floats, ascii strings, and > null values) between these three languages? i prefer a compact, > common binary format rather than XML. "common"? Well, there's pickle, but it's not very "common". Can you give an example of a format you'd like? From chris.gonnerman at newcenturycomputers.net Fri Dec 28 08:45:48 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Fri, 28 Dec 2001 07:45:48 -0600 Subject: install Python2.2 question References: Message-ID: <002c01c18fa5$fa516a60$0101010a@local> ----- Original Message ----- From: "Alex Martelli" > "Tim Hammerquist" wrote in message > news:slrna2ltdp.sjg.tim at vegeta.ath.cx... > ... > > If you have a sufficient devel environment and you are up to the > > challenge, you can try to build Python yourself, but it may be more > > trouble than it's worth if you're new to linux. > > How so? tar xzf, cd, ./configure, make, sudo make install -- how > much trouble can that be? One word: Libraries. Python isn't the headache that, say, GNOME is that way, but it can be a hassle anyway. From fperez528 at yahoo.com Wed Dec 5 20:19:54 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Fri, 07 Dec 2001 00:47:54 +2328 Subject: strict python? References: <3C1060E4.756F33B2@earthlink.net> <3C107172.6866DC18@alcyone.com> Message-ID: <9ups92$ers$1@peabody.colorado.edu> Erik Max Francis wrote: > Hans Nowak wrote: > >> Well, 'self.func' is a perfectly valid Python expression, >> just like '3'. Not very useful when used like this, but >> still, perfectly valid. > > Seems like now there are warning facilities built into the language > it might be useful to have warnings emitted in situations like this > (a statement with no side effects) -- things that are truly not > error but are genuinely not useful either. > > Or is the general approach of the core Python team to relegate that > to third-party developers (such as PyChecker)? > At the risk of incurring the wrath of the religious language police, one of the few things I miss from perl in python is the -w switch: it puts perl in a somewhat paranoid mode where it gives you warnings about all sorts of legal but subtle or potentially dangerous situations. You can ignore them or not use it, but it often opens your eyes to something you didn't even realize you were doing. It can be quite a time saver (it's a bit like gcc's -Wall switch). I honestly don't see any reason for something like that not to be included in python (other than perhaps 'if perl has it it can't be good' :) Cheers, f From jason at jorendorff.com Wed Dec 19 14:01:33 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Wed, 19 Dec 2001 13:01:33 -0600 Subject: os.stat() crashes on Win32 In-Reply-To: <3C208E67.2080401@skippinet.com.au> Message-ID: Mark wrote: > I have submitted a bug, with fix at: > http://sourceforge.net/tracker/index.php?func=detail&aid=495021&group_id=547 0&atid=105470 This patch works for me. > [...] Hopefully this will make 2.2!! Indeed! It's important to release something that Windows developers can build from source and run. -- Jason Orendorff http://www.jorendorff.com/ From emile at fenx.com Sun Dec 30 00:42:05 2001 From: emile at fenx.com (Emile van Sebille) Date: Sat, 29 Dec 2001 21:42:05 -0800 Subject: REPOST: Re: Help - command line arguments References: Message-ID: <6$--$$_----___%%%$@news.noc.cabal.int> "Steve Zatz" wrote in message news:YpxX7.242028$bs2.45285312 at news02.optonline.net... > I am new to Python and although I am sure that the following is obvious I > can't figure the following out or find an answer in any of the texts that I > have access to. > > My question is: Can you run a script that takes command line arguments from > within the Python shell or from the Python command line? > > For example, something like: > > test.py -a -b > > runs fine from the *Windows XP* command prompt. > > From the Python command line, I can do the following: > > import test > test.main() > > which doesn't produce an exception but I can't figure out how to input the > command line arguments. > > And from the Python Shell, just running test.main() produces a getopt > exception which does not occur when it runs from the Python command line. > (But in either case, I can't figure out how to use command line arguments.) > > Again, any help would be appreciated. Thanks. > > > C:\>type test.py import sys print sys.argv C:\>python -c "import os; print os.popen('test.py passed_arg').read()" ['C:\\test.py', 'passed_arg'] Or you could force sys.argv appropriately: import test import sys sys.argv = [test.__file__, 'my_argv1', 'etc...'] test.main() HTH, -- Emile van Sebille emile at fenx.com --------- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Emile van Sebille" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:37:25 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774372 27193 211.57.49.2 (31 Dec 2001 04:52:52 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:52:52 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From rdsteph at earthlink.net Thu Dec 27 19:07:11 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Fri, 28 Dec 2001 00:07:11 GMT Subject: REPOST: Python web programming for Newbies article on NewsForge ;-))) Message-ID: <0$--$$_----_-$--_$@news.noc.cabal.int> Shamelessly trolling for newbies to convert to Python, article makes Newsforge. http://www.newsforge.com/article.pl?sid=01/12/27/1950241&mode=nocomment ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2BB84E.233C304A at earthlink.net> Control: cancel <3C2BB84E.233C304A at earthlink.net> Date: Mon, 31 Dec 2001 01:39:44 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775485 27193 211.57.49.2 (31 Dec 2001 05:11:25 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:11:25 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From awinston at scn.org Sun Dec 2 12:05:52 2001 From: awinston at scn.org (Alan Winston) Date: Sun, 2 Dec 2001 09:05:52 -0800 Subject: age of new pythonistas [was: The Editor Poll results are in!] References: <3bfd7f87@news.airtel.net> <9u4cbu$2ts$1@news.xmission.com> Message-ID: <9udn1g$64c$1@brokaw.wa.com> > it'd also be cool to see the relative age of new pythonistas -- I suspect > that they're young, but this is completely unfounded. 51 here. I happily switched to Algol as my programming language of choice about 1967, seeing its major advantages over the Fortran and assembler ("mnemonic plague") I had been using previously. I've happily (occasionally less happily) learned and used many, many other languages in the intervening years. My only real problem with Python is that I should have taken a closer look at it years ago, instead of just writing it off as "yet another Unix scripting language." Now if you mean folks who will ONLY code in Python, them folks have gotta be young. And it is quite possible that old hat Unixers who had long since become comfortable with Perl aren't as likely to change. But I hope that among those of us for whom Unix was just one more operating system when it came along (albeit better than most), a little more flexibility obtains. (I think Unix was about my tenth OS, I do vaguely remember that MSDOS was either my 20th or 21st and that IBSYS was my first. I had a calico cat that I named IBSYS.) At this point I doubt I could name even half the languages I have programmed in (I do remember that Focal followed C -- I may be unique in that). Languages are tools. Learning a new language should be a routine part of maintaining one's acumen as a programmer. Cf. Hunt & Thomas, _The Pragmatic Programmer_, p12: "Learn at least one new language every year." Python is now my primary language of choice. I recommend it to other programmers. I have been assuming that that might make me a Pythonista. But if being a Pythonista means refusing to program in anything but Python, then yes, those folks are probably young. Very young. Another respondent indicated that there aren't a lot of job openings out there for Python programmers. Yes, I suspect that if you answer "What do you program in?" with "Python," that that will indeed hurt you. But if you answer "C++, C, Java, of course, some other languages, but I prefer Python since it is so much more cost-effective," I would expect the interview to go well. Alan Winston Seattle From nospam at bigfoot.com Mon Dec 24 10:44:40 2001 From: nospam at bigfoot.com (Gillou) Date: Mon, 24 Dec 2001 16:44:40 +0100 Subject: MimeWriter and smtplib: long list of 'To:' recipients References: <9vvks6$27qr$1@norfair.nerim.net> <3C24F71F.FC44FBAE@geneva-link.ch> Message-ID: But I ran that script with a server.set_debuglevel(1) to see the running protocol. The server did not reply anything silly. The smptlib did not raise any exception during that process. I can send mail to lots of "To:" recipients with my usual mail clients (Outlook express and StarOffice mail) with the same SMTP server. The only difference is that the long header lines like "To" are splitted by the clients (con't lines of each header beginning with some spaces) when the MimeWriter.addheader(...) puts all in one long line. Cheers and Happy Christmas. --Gilles "Boris Borcic" a ?crit dans le message news: 3C24F71F.FC44FBAE at geneva-link.ch... > Gillou wrote: > > > > Hi, > > > > My application sends mail to a list of 'To' recipients but there are > > problems when the list is long. > > Are you sure the SMTP server doesn't put an upper bound on the > number of recipients ? > > BB From usenet at lophty.com Sun Dec 2 20:39:51 2001 From: usenet at lophty.com (brian donovan) Date: Sun, 02 Dec 2001 20:39:51 -0500 Subject: Newbie : Installing Python locally in acct on shared server References: <3C0A3F04.3090206@lophty.com> <3C0A5717.1040508@lophty.com> Message-ID: <3C0AD7E7.1090108@lophty.com> Thanks for the reminder about the headers. After telling the scripts to print headers, the one that uses sys now works, printing "path has 6 members", but the base64 one still craps out. Each time that I attempt to access the page, 3 lines are added to my Error log : [Sun Dec 2 20:15:21 2001] [error] [client 208.59.249.9] Premature end of script headers: /home/luser/public_html/test/cgi-bin/base64.py File "/home/luser/public_html/test/cgi-bin/base64.py", line 6, in ? File "/home/luser/public_html/test/cgi-bin/base64.py", line 3, in ? The script is : ------------------------------------------ #!/home/luser/bin/python import base64 message = "life of brian" data = base64.encodestring(message) original_data = base64.decodestring(data) print "Content-type: text/plain\n" print "original : ", repr(message) print "encoded data : ", repr(data) print "decoded data : ", repr(original_data) ------------------------------------------ Except for the addition of the print statement for the headers, this script, like the original sys script, was sopied verbatim from a python text. Is it a problem with the script? I'm going to try more examples and see what happens. :D thanks, brian Chris Gonnerman wrote: > Ahh... I just realized you aren't giving the web server > the correct headers. Try this: > > -------------------------------------------- > #!/home/luser/bin/python > > import sys > > print "Content-type: text/plain\n" > > print "path has", len(sys.path), "members" > -------------------------------------------- > > and let me know what happens... From fperez528 at yahoo.com Tue Dec 25 18:44:44 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Wed, 26 Dec 2001 23:12:44 +2328 Subject: REPOST: Re: custom split function References: Message-ID: <3$--$$-$$$$%_%__-$@news.noc.cabal.int> I.J. wrote: > Hi > Is there a way to spit file content into list of individual > bytes/characters. > I know it could be done with substring manipulation but I hope there is more > direct way. > Bye file = open('filename') file_as_string = file.read() Now you have your whole file in a string, which for most purposes can be thought of as a list of characters. And you can always do file_as_list = list(file_as_string) if you really want it as a list. hth, f ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Fernando =?ISO-8859-1?Q?P=E9rez?= Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:46:09 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775901 27193 211.57.49.2 (31 Dec 2001 05:18:21 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:18:21 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From matt at avaquest.com Sun Dec 9 14:13:55 2001 From: matt at avaquest.com (Matthew King) Date: Sun, 09 Dec 2001 14:13:55 -0500 Subject: freeze and minidom problem References: <3C129FAC.50906@avaquest.com> Message-ID: <3C13B7F3.8030906@avaquest.com> yup, that did it. thanks! Martin von Loewis wrote: > Matthew King writes: > > >>Any ideas? Thanks in advance... >> > > My guess is that freeze doesn't detect that expatreader is used, so it > imports none of the SAX code. > > For Python 2.2, we put > > # tell modulefinder that importing sax potentially imports expatreader > _false = 0 > if _false: > import xml.sax.expatreader > > into xml.sax.__init__.py; that should allow you to freeze minidom/sax. > > There is another complication that modulefinder can't learn to also > freeze _xmlplus when looking for xml. This should be no problem for > you, since minidom should work fine in Python 2.1. > > Regards, > Martin > > From oren-py-l at hishome.net Thu Dec 6 08:44:54 2001 From: oren-py-l at hishome.net (Oren Tirosh) Date: Thu, 6 Dec 2001 08:44:54 -0500 Subject: Toy interpolation code [was Re: Draft PEP: string interpolation with backquotes] In-Reply-To: ; from QnickQm@alum.mit.edu on Thu, Dec 06, 2001 at 04:59:05AM +0000 References: <20011202080626.A76724@hishome.net> <20011202170805.A36879@hishome.net> <200112032307.fB3N78327930@bigboy.bizarsoftware.com.au> <9ujspb$777$1@news.island.liu.se> <3C0E715D.855DE84D@ccvcorp.com> Message-ID: <20011206084454.A38759@hishome.net> On Thu, Dec 06, 2001 at 04:59:05AM +0000, Nick Mathewson wrote: > One thing I don't understand from the Interpolation Wars is why people > feel Python needs any new syntax for this. Here's some example code > that shows how to implement four kinds of proposed interpolation. First, I must say that I like your approach. Code speaks much louder than words. There are two reasons I can think of why anyone would feel that Python needs new syntax for string interpolation: 1. One likes his syntactic sugar extra-sweet and feels than even an import statement and an extra pair of parens is too bitter. 2. One likes all the expressions in his code syntax-checked at compile time and converted into bytecode without the use of runtime evaluation. PEP 215 appears to be written with #1 in mind. My PEP draft for string interpolation is mostly concerned with #2. If the BDFL ever decides to implement string interpolation he should have more than just one proposal to choose from. Oren From chris.gonnerman at newcenturycomputers.net Thu Dec 27 09:00:19 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Thu, 27 Dec 2001 08:00:19 -0600 Subject: Running a script in windows References: <638m2u8frhvp7be8piena9q1ll7cf07qac@4ax.com> Message-ID: <005b01c18ede$e7dd2bc0$0101010a@local> > On Thu, 27 Dec 2001 20:51:49 +0900, Jonathan Gardner > wrote: > > I know this comes up a lot, but I can't seem to find the answer in > the archives. (If the answer is RTFM, please let me know where.) > > I don't have a windows box on my desk. A friend of mine does, but I > can't get to it. He is trying to run a program I wrote, but the > error message is coming up too fast for him to catch it. How can > you keep that error message window around longer in Win2K? (BTW, > let's pretend he doesn't know how to use the DOS prompt.) > > Jonathan Rewrite your script like this: import sys try: # your script body goes here except: import traceback traceback.print_exc(file=sys.stderr) raw_input() Hope this helps. From jason at jorendorff.com Fri Dec 21 02:49:43 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Fri, 21 Dec 2001 01:49:43 -0600 Subject: threading.py -> winthreading.c : Some results Message-ID: I've reimplemented the synchronization objects of threading.py in non-portable, Win32-only C. The C versions of RLock, Event, Semaphore, and Condition perform at least 5x faster than their standard counterparts in threading.py in every situation I've tried. Acquiring an RLock runs 25x faster. Condition.wait(timeout) runs 500x faster. This benchmark: http://www.bagley.org/~doug/shootout/bench/prodcons/prodcons.python runs 6.3 times as fast under the C version of Condition. That's fast enough to post a reasonably non-humiliating benchmark number; it closes the gap between Python and Java considerably. ...If you care about such things. ...As of course no sane person does. Whether this C code would mean a significant performance increase in a real-life program remains to be proven. Comments? ## Jason Orendorff http://www.jorendorff.com/ From joshm at taconic.net Sun Dec 30 14:36:31 2001 From: joshm at taconic.net (Joshua Muskovitz) Date: Sun, 30 Dec 2001 14:36:31 -0500 Subject: Video Programming References: <3C2E89DD.F3304EA9@earthlink.net> Message-ID: <3c2f6ac4_3@corp.newsgroups.com> Personally, the thought of using a VR system to write code is an extremely unpleasant thought. However, I *have* seen some fun come of the idea of using First Person Shooters as unusual interfaces. I saw a version of doom where the monsters were all representations of the currently running processes, and you could shoot them to kill the process. Rather cathartic, and there is a certain amount of justice in having an ill behaved app able to shoot back at you. :-) -- j -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- From sholden at holdenweb.com Mon Dec 17 08:08:56 2001 From: sholden at holdenweb.com (Steve Holden) Date: Mon, 17 Dec 2001 08:08:56 -0500 Subject: socket question References: Message-ID: "Jason Orendorff" wrote in message news:mailman.1008530480.16525.python-list at python.org... > > The server should call udpSerSock.bind( ('10.1.1.27', 21567) ) > > before it issues the recvfrom() call - otherwise, how is the > > server's UDP layer to know which interface and address to > > listen on? > > This is a red herring. udpSerSock is not intended to listen for > packets, only to send one. > In which case, calling the program that uses it a "server" seems to be a little misleading in terms of conventional client/server structures! they-also-serve-who-only-stand-and-wait-ly y'rs - steve -- http://www.holdenweb.com/ From jyrinxatmindspringdotcom Tue Dec 4 01:12:52 2001 From: jyrinxatmindspringdotcom (Jyrinx) Date: Mon, 3 Dec 2001 22:12:52 -0800 Subject: Python evangelists unite! References: <9u77i8$a5j$1@slb0.atl.mindspring.net> <91acf731.0111301017.31cd71a5@posting.google.com> <9ufdth$155$1@slb5.atl.mindspring.net> <91acf731.0112031205.2782a5f9@posting.google.com> Message-ID: <9uhpkh$9u7$1@slb5.atl.mindspring.net> > > > For example, I'm writing a Ruby binding to the Object-Oriented > > > database GOODS. Some objects are persistent, some are transient. You > > > don't know at "compile time" which are which, so it's very nice for my > > > binding to be able to add persistence support methods at run-time only > > > to those objects that will be stored in the database. Without Ruby's > > > support for adding these methods to individual objects, I'd have to > > > modify the class, which would mean adding all this persistence-related > > > stuff to transient objects. Ruby allows a much cleaner solution: add > > > the persistence support methods only to those objects that need them. > > > > Under the basic premises of OO, shouldn't you just have a base class with > > derived classes "persistent" and "transient," or some such? I'd think this > > would make clearer your intent for the uses of the objects. > > The problem with this is that it defeats the idea of transparent > persistence. One goal of object databases is that persistence is not > limited to a subset of the class heirarchy. Okay, I can see that. In other words, the hierarchy should express the relationships between objects, not a particular feature of certain objects? > ... > Some OO databases ignore this and force applications to use > "Persistent" superclasses or interfaces. IMO, this is a very bad > idea. Consider that you may have a million instances of a class, only > one of which is persistent (by the reachability definition). If the > class has to subclass a "Persistent" class, all of those million > objects have to carry around the Persistence baggage, even though only > one of those objects needs them. I thought only the persistent objects would subclass the Persistent class; how does the persistence baggage get into objects of classes derived from Transient? Wouldn't only leaves, so to speak, of the hierarchy derive from Persistent or Transient anyway? > Adding the persistence baggage to individual objects as necessary > provides a much simpler and scalable solution. Simpler because > application developers don't have to bother with subclassing (or > implementing) a Persistent class (or interface). More scalable > because the persistence support is added to *only* those objects (not > classes) that need it. I'm not sure how the singleton stuff is more scalable (though I'm sure you have more experience than me). Hypothetically (yeah, I'm on shaky ground here), what if you had more than one major behavior (besides just persistence) that might vary between objects of a given class? Mightn't it get messy to keep track of which objects are which? (I suppose, though, you don't have to "keep track" of which ones are persistent; they just act differently.) I wonder if it wouldn't really be clearer just to declare trivial classes which inherit multiply from Persistent/Transient, other behavior implementations, and other parent classes. (Of course, in Python there's no such thing as a trivial subclass definition; you've got to overload __init__ specifically and call __init__'s in each base class. This ticks me off to no end.) Also, a more technical concern: shouldn't every Ruby object need hooks in place so that any single method could be overridden in individual objects? I'm envisioning a class instance with a function pointer for each method ... that's a nasty thought. Or does each object carry a list of overridden methods, to be checked with each method call? Isn't there significant overhead either way? Or (most likely) is it implemented in too clever a way for me to come up with? :-) Jyrinx jyrinx at mindspring dot com From laurent.pointal at laposte.net Sat Dec 1 17:16:51 2001 From: laurent.pointal at laposte.net (Laurent Pointal) Date: 01 Dec 2001 22:16:51 GMT Subject: Parsing chars from serial port References: <5ZbO7.10943$%B6.3479393@news2.rdc1.bc.home.com> Message-ID: [posted and mailed] "Erik Myllymaki" wrote in news:5ZbO7.10943$%B6.3479393 at news2.rdc1.bc.home.com: > I am using the win32comport_demo as the basis for a serial port > handler. > > It works well, but the even loop grabs input from the COM port > character-by-character, and I need to pass a full line to my database. > > I have fooled around with this all morning, but I feel like I am > reinventing the whell. > > Can anyone point to my solution? Have you looked at USPP ? There was an announce post (found back with google groups): << De :Isaac Barona Mart?nez (ibarona at tid.es) Objet :[Module] USPP (Universal Serial Port Python) Library v0.1 Groupes de discussion :comp.lang.python.announce Date :2001-09-14 09:01:01 PST USPP (Universal Serial Port Python) Library v0.1 ------------------------------------------------ Multi-platform Python module to access serial ports USPP Library is a multi-platform Python module to access serial ports. At the moment, it only works in Windows and Linux (the platforms I have access to) but as it is written entirely in Python I hope you can extend it to support any other platforms. The module has the following features: - hight level access to serial port under several platforms. - autodetects the platform in which it is working and exports the correct classes for that platform. - object oriented approach. - file object semantic operations over the ports. - allows using the serial port with different speeds and characteristics. - RS-232 and RS-485 modes (now only RS-232). In RS-485 mode the communication is half-duplex and uses the RTS line to control the direction of the transference. - blocking, non-blocking or configurable timeout reads. URL: http://balder.prohosting.com/ibarona/en/python/uspp/uspp_en.html Download: http://balder.prohosting.com/ibarona/en/python/uspp/uspp-0_ 1.tar.gz License: GPL Categories: Miscellany Isaac Barona Mart?nez (ibarona at tid.es) http://balder.prohosting.com/ibarona/ >> Maybe it can help (at least you may look into the code). A+ Laurent. From mwh at python.net Sun Dec 30 05:26:02 2001 From: mwh at python.net (Michael Hudson) Date: Sun, 30 Dec 2001 10:26:02 GMT Subject: REPOST: Re: How to do "ANN:"? References: Message-ID: <9$--$$_----___-$-$@news.noc.cabal.int> Harry George writes: > A couple of times I've tried to annouce package upgrades using "ANN:" > entries to c.l.p and c.l.p.a, but nothing shows up. Is there a magic > decoder ring? Well, for clpa you have to wait for the moderators' christmas hangovers to fade. > Most recently, updates for mkpythonproj, pdx, and pyperlish. I've just approved those. Hopefully they'll show up soon. (20 messages in the queue: 4 approvals, 16 discards, sigh). Cheers, M. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp.gblx.net!feeder.qis.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Michael Hudson Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:05:56 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774290 27193 211.57.49.2 (31 Dec 2001 04:51:30 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:51:30 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From paul at JUNKCATCHER.ciphergoth.org Mon Dec 10 05:26:14 2001 From: paul at JUNKCATCHER.ciphergoth.org (Paul Crowley) Date: Mon, 10 Dec 2001 10:26:14 GMT Subject: CryptKit 0.9: cryptsock References: <7x667pw8ap.fsf@ruckus.brouhaha.com> Message-ID: <87k7vvl7cg.fsf@saltationism.subnet.hedonism.cluefactory.org.uk> dpj at world.std.com (David P Jablon) writes: > >(Seems like half the password-assisted PKCs around exist mostly to avoid > > patents on other password-assisted PKCs). > > This might also be interpreted as a sign of healthy competition > in a capitalist system. ;-) No such motivation existed in the AES contest. -- __ Paul Crowley \/ o\ sig at paul.ciphergoth.org /\__/ Employ me! http://www.ciphergoth.org/cv Cryptography, Linux, Unix, Perl, C/C++, Java, TCP/IP, and more. From issac at myfirstlink.net Wed Dec 26 19:11:58 2001 From: issac at myfirstlink.net (Issac) Date: Wed, 26 Dec 2001 18:11:58 -0600 Subject: re.match oddity References: <3C2A6D23.AD1807D9@earthlink.net> Message-ID: <034a01c18e6b$19a652e0$6401a8c0@mojave> I'll give that a try. Thanks for your help. Issac ----- Original Message ----- From: "Hans Nowak" Newsgroups: comp.lang.python To: Sent: Wednesday, December 26, 2001 6:42 PM Subject: Re: re.match oddity > Issac wrote: > > > > A curious thing is happening in my c2py.py script (below). > > The resulting files contain little ^M's (when viewed with the Windows > > version of gvim 6.0 but not when viewed with notepad.exe) at the ends > > of the lines. When I remove the lines > > > > line_is_lone_left_curly = re.match(r'^\s*{\s*((//.*)|(/\*.*\*/))?$', line) > > if line_is_lone_left_curly: > > pylines[-1] = pylines[-1][:-1] + ':\n' > > continue > > > > the ^M's go away. Does anyone know why? I'm using Python 2.1.1 > > on Cygwin with Windows 2000. > > Not sure it has anything to do with re.match. Most likely it's caused > by the line that appends ':\n'. This is probably written to file > as '\r\n' (CR/LF) (in Windows). I suspect that some other lines > only have '\n' (LF) as a line separator, otherwise gvim would not show > them; it usually detects the line ending and displays the text > accordingly. > > The solution is to make sure that your lines have either a Windows > or a Unix line ending, but not a mix. Use os.linesep when in doubt. > > --Hans > -- > http://mail.python.org/mailman/listinfo/python-list --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.310 / Virus Database: 171 - Release Date: 12/19/2001 From jgardn at alumni.washington.edu Mon Dec 10 22:44:33 2001 From: jgardn at alumni.washington.edu (Jonathan Gardner) Date: Tue, 11 Dec 2001 12:44:33 +0900 Subject: Client/server chat program In-Reply-To: <7xpu5m3ei9.fsf@ruckus.brouhaha.com> References: <7xpu5m3ei9.fsf@ruckus.brouhaha.com> Message-ID: <200112110348.fBB3mqJ10221@my.knctv.co.kr> On Tuesday 11 December 2001 07:18 am, Paul Rubin wrote: > The usual way to do this is use separate threads for reading input and > displaying messages. Errr... not necessarily. Note that this is a chat program - you'll want the seperate threads to work with each other. I find it easier to program this sort of thing with only one thread and one process that sees what can be done and does it without blocking. As a semi-experienced thread developer, I know that in the end, it's better to try and avoid threads whenever possible, unless they are almost completely independent of each other. (ie, in games, one thread to do the ai, one thread to do the rendering, one thread to do the game logic makes sense, because they don't really communicate with each other, except for when they start and when they end.) Something like a web-server, where two HTTP connections don't have to know about each other - is perfect for giving each connection a thread or a process to call their own. Jonathan From wurmy at earthlink.net Mon Dec 3 08:29:58 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Mon, 03 Dec 2001 13:29:58 GMT Subject: More assignment/copy novice confusion References: Message-ID: <3C0B7E58.2CA2FDDE@earthlink.net> > Arthur Siegel wrote: [binding and references to lists] > All of this is far from obvious, but of course does > in the end make perfect sense. While it is a continuous source of confusion for newbies, it is only far from obvious if you're used to the implicit copying of other languages. But in fact, many other languages don't implicitly copy either for more complex objects... if you hack up a linked list in C, it doesn't copy itself magically... neither do arrays or what C calls "strings". So I think Python's concept isn't all that far-fetched... in fact, it might be more intuitive than most. --Hans From martin.kuchlmayr at abri.une.edu.au Thu Dec 13 22:10:41 2001 From: martin.kuchlmayr at abri.une.edu.au (DoggyKennel) Date: Fri, 14 Dec 2001 03:10:41 GMT Subject: Python beginner: Downloading a pdf file from a web server on VMS. References: <3c1964a5.352410439@129.180.1.4> Message-ID: <3c196c4d.354369856@129.180.1.4> I wrote: > ... blah ... blah ... blah ... >am hoping that if a "http" class as I have described above exists and that should read "that a 'http'..." not "that *if* a 'http'...". > ... blah ... blah ... blah ... >Does anyone know of good overview of Python - things like what it can >do. If everything can be compiled. How portable it is? I should have pointed out that I am interested in popular libraries, compilers and other stuff beyond the language itself. Mainly in things that might be considered and are likley to remain around as long as python is and be ported to most ports of python. I just found the postings on python books. These may be helpfull but am currently deciding whether to commit to python and wouldn't really want to buy a book until I have committed. > >Any help gratefully received, Martin From alf at sagittarius.logilab.fr Tue Dec 11 12:57:17 2001 From: alf at sagittarius.logilab.fr (Alexandre Fayolle) Date: Tue, 11 Dec 2001 17:57:17 +0000 (UTC) Subject: pypasax (was Deprecate tabs for indenting) References: Message-ID: On Thu, 6 Dec 2001 10:08:06 -0000, Tony J Ibbs (Tibs) wrote: >2. Wonder if he'd been using pypasax_ > (one of my favourite "it's so silly it must > be useful" projects). Well, as the author of pypasax, I can answer this one. He's not been using it to produce the sample. It's not the same mapping, and his description goes much deeper in the python tree. Pypasax merely lists classes, methods and docstrings. Now, I didn't code pypasax just for bragging around. The goal is to be able to easily generate an XML document from a set of python modules. Right now, we use it for checking the UML diagrams of the Narval project (1), and we are planning to work on the production of XMI files to ease reverse engineering of python code (still have to finish reading the XMI spec, though ;o) You may be interested to know that I just published a new release (2) enabling pypasax to work with python > 1.5.2. Having SAX-ish parsers for several kinds of files is a useful thing IMO. There are great tools for dealing with XML files (pyxml (3), 4Suite (4)), and this is a great way of using XML as a pivot format for conversion for example. For another SAX parser parsing something else that XML files, you can check vcalsax (5) which handles VCal files (as used by korganiser and many other PIMs) Cheers, (1) http://www.logilab.org/narval/ (2) http://www.logilab.org/pypasax/ (3) http://pyxml.sf.net/ (4) http://www.4Suite.org/ (5) http://www.logilab.org/vcalsax/ Alexandre Fayolle -- LOGILAB, Paris (France). http://www.logilab.com http://www.logilab.fr http://www.logilab.org Narval, the first software agent available as free software (GPL). From Dave at PragmaticProgrammer.com Thu Dec 27 17:34:38 2001 From: Dave at PragmaticProgrammer.com (Dave Thomas) Date: Thu, 27 Dec 2001 22:34:38 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <1$--$$_-----$$_$_$@news.noc.cabal.int> Ron Stephens writes: > 1. Ruby is an especially interesting competitor to Python. I have been > monitoring the Ruby newsgroup, and it shows incredible growth and > vitality. Furthermore, Ruby is aimed right at the heart of Python's > niche. Ruby and Python grew up largely in parallel. Matz was aware of Python, but as far as I know didn't use many of Python's ideas when designing the Ruby language. It would be wrong to characterize Ruby as "aiming for Python" in that regard. The Ruby community is not particularly out to steal folks from the Python world: it's quite happy collecting new users from all over the place. My guess is we'll see more converts from Perl than from Python, and that by a large margin. In the past, I've made statements that Ruby could be bigger than Python in terms of number of active developers. I still believe that could happen. However, I don't see that happening at the expense of the Python community, which I suspect will remain strong and vibrant for many years. Instead, Ruby will attract folks from outside the Python world. Ruby and Python differ in philosophy and _feel_. Some folks like one, some the other. I don't see it as competition. I see it as choice. Dave ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Dave Thomas Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:22:50 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775546 27193 211.57.49.2 (31 Dec 2001 05:12:26 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:12:26 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From aleax at aleax.it Thu Dec 6 09:31:50 2001 From: aleax at aleax.it (Alex Martelli) Date: Thu, 6 Dec 2001 15:31:50 +0100 Subject: Help setting path on windows References: <3C0D1802.6D93D957@motorola.com> Message-ID: <9unvgl$p9a$1@serv1.iunet.it> "Stephen Boulet" wrote in message news:3C0D1802.6D93D957 at motorola.com... > Can someone help me? > > I'd like to be able to do: > > from someModule import * > > and have my someModule.py file imported. Thanks. Probably simplest: add to directory C:\Python21 (if that's where you installed Python) a textfile named anyname.pth (any name, extension must be PTH). In this file, list, one per line, all directories you want to be searched for modules you import. Alex From ryan.phillips at csus.edu Thu Dec 27 19:57:59 2001 From: ryan.phillips at csus.edu (Ryan Phillips) Date: 28 Dec 2001 00:57:59 GMT Subject: python irc References: Message-ID: irc.openprojects.net #python #pygame are the ones i know about -ryan "Garett Shulman" wrote in message news:e5bn2us3h5hi86lvkadn58glg9i7n6u0ov at 4ax.com... > does anyone know of python irc servers/channels? From philh at comuno.freeserve.co.uk Thu Dec 6 18:41:19 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Thu, 6 Dec 2001 23:41:19 +0000 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> Message-ID: On 6 Dec 2001 03:46:44 -0800, sebastien wrote: > >In this format, the integer part correspond to the number of elapsed >days since the start of the day 1858-11-17 CE. Negatives numbers are >allowed for date before 1858-11-17. Any reason why that day particularly? > The decimal component is the >fraction of the day corresponding to hour minutes and seconds, >expressed in GMT. Perhpas it'd be better to have se seconds as a separate integer, for accuracy of arithmetic. >This format has the following advantages: > - date arithmetic is easy (number of days between two dates is >trivial, the day of week need only to compute a modulo 7 ..) True -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From johnroth at ameritech.net Sun Dec 16 15:54:39 2001 From: johnroth at ameritech.net (John Roth) Date: Sun, 16 Dec 2001 12:54:39 -0800 Subject: Idiomatic portable way to strip line endings? References: <3c1cddd3.6188589@news.muenster.de> Message-ID: "Martin Bless" wrote in message news:3c1cddd3.6188589 at news.muenster.de... > [Tim Hammerquist]: > > >Ah. So I was doing my normal over-thinking again. =) > > Yes - and it's totally appropriate. Danger is not over. > > The line[:-1] idiom works fine on windows, as long you (can) garantee > that files are opened without the "b" (binary) mode switch. > If the file is opened 'binary', as in > fp = open(fname,'rb') > no input conversion will be done by the lower level routines. This > means your line endings are '\r\n' indeed on a windows system. This is quite true, but if you're opening it in binary mode, it's questionable whether there's anything that corresponds to a "line" in the first place. This is, in fact, the standard distinction between a 'text' and a 'binary' file: text files are organized into lines, and binary files have some other organization, which is strictly dependent on the kind of file. John Roth From djrassoc01 at mindspring.com Fri Dec 28 23:34:59 2001 From: djrassoc01 at mindspring.com (Dr. David J. Ritchie, Sr.) Date: Fri, 28 Dec 2001 22:34:59 -0600 Subject: Python Popularity: Questions and Comments References: <3C2CBACB.FBF3C3C9@mindspring.com> Message-ID: <3C2D47F0.6DF7C8BE@mindspring.com> In regard to what Justin Sheehy wrote: > "Dr. David J. Ritchie, Sr." writes: > > > there are features of Java (like strong typing) that at least > > mandate a certain level of consistency between all execution paths. > > Python has strong typing. It does not, however, have static typing or > explicit type declarations, which are probably what you are thinking about. Yes, I suppose that is it. To me, the requirement of saying what a variable is and then using it as you said it to be builds in a certain cross checking which one can >assert< results in more reliable code. Are there any studies to support such a view? I am not aware of any so I have to regard myself as engaging in hand-waving and demonstrating the marketing myth driven decision making process which I described in my original post. > > > > I can argue to myself to dismiss that one by saying that of course > > interpretative languages should not be expected to hold to that > > level of validation. > > Could you please explain what an "interpretative language" is and how > Java and Python are different with regard to that definition? > > Before you answer, realize that both are generally translated into an > intermediate language and then that language is executed by a virtual > machine at runtime. And the virtual machine byte code is eventually translated into microcode in some chip, etc., etc. I think what I was trying to get at was the problem of validating code when the language allows run time definition of the code and execution of it through an exec or eval or whatever. I am probably on shaky ground here due to ignorance but that's what I was refering to anyway. -- Dr. David J. Ritchie, Sr. djrassoc01 at mindspring.com http://home.mindspring.com/~djrassoc01/ From max at alcyone.com Mon Dec 10 23:46:34 2001 From: max at alcyone.com (Erik Max Francis) Date: Mon, 10 Dec 2001 20:46:34 -0800 Subject: __init__ concerns References: Message-ID: <3C158FAA.DA4A4BF4@alcyone.com> Peter Wang wrote: > what is the proper python > idiom (or, failing that, the proper technique) for ensuring that a > subclass instance is properly initialized, especially when details of > the base class are unknown? I don't understand the circumstances under which the arguments to a base class constructor would be unknown. You're not picking base classes at random, a class will require a certain base class and will be dependent on it. Therefore, it will know the necessary arguments to pass to its constructor. Under what circumstances would you truly not know? -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ Laws are silent in time of war. \__/ Cicero Esperanto reference / http://www.alcyone.com/max/lang/esperanto/ An Esperanto reference for English speakers. From erik at pacific-shores.com Sat Dec 1 16:29:37 2001 From: erik at pacific-shores.com (Erik Myllymaki) Date: Sat, 01 Dec 2001 21:29:37 GMT Subject: Parsing chars from serial port Message-ID: <5ZbO7.10943$%B6.3479393@news2.rdc1.bc.home.com> I am using the win32comport_demo as the basis for a serial port handler. It works well, but the even loop grabs input from the COM port character-by-character, and I need to pass a full line to my database. I have fooled around with this all morning, but I feel like I am reinventing the whell. Can anyone point to my solution? -- Erik Myllymaki erik at pacific-shores.com From peter.milliken at gtech.com Wed Dec 26 14:58:50 2001 From: peter.milliken at gtech.com (Peter Milliken) Date: Thu, 27 Dec 2001 06:58:50 +1100 Subject: Book "python programming patterns". anybody read this?? References: Message-ID: No Gordon, that's a ridiculous assumption! Who said the code was bad? Not I! Your original email implied that you had to put some amount of study into understanding the examples - there was an implication that the examples where not straight forward and therefore required some considerable time and effort on your part to understand what was going on. Nobody has tried to equate this with "bad code", just bad coding practice (in our opinion - well, Roy's and mine :-)) - a very different thing. Perhaps if you take objection to our comments you should perhaps clarify and quantify your comments on just how much effort was required to understand the examples? and why? i.e. if the book is more "algorithmic" in nature then perhaps you cannot get away from examples that do take some considerable study effort - if this is the case then perhaps you should provide that clarification/caveat on your comment. Otherwise I'll have to stick with my decision (unless I stood in the book store and read the book! :-)). Peter "Gordon McMillan" wrote in message news:Xns9180CE1BAC652gmcmhypernetcom at 199.171.54.214... > Peter Milliken wrote: > > > Actually, I doubt there is any intersection - or perhaps I should > > qualify that by an intersection in the realms of code that you and only > > you will ever have to look at or maintain. > > > > I side with Roy's opinions purely because it is almost never the code > > author that has to maintain the code (at least on systems I have worked > > on over the last 20 years :-)). > > This is ridiculous. I said I had to study some things to understand what was > going on, and that has become "ewww, it must be bad code". > > Every API has two sides. One side is supposed to be easy to use and > understand. The other side almost certainly isn't. If the internals of > Python dictionaries were easy to understand, their performance would suck. > > If you're only interested in using APIs, this book probably isn't for you. > But it's presumptuous to equate "challenging" with "bad". > > -- Gordon > http://www.mcmillan-inc.com/ From jeff at ccvcorp.com Mon Dec 3 14:09:28 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Mon, 03 Dec 2001 11:09:28 -0800 Subject: Copy operator (was list.remove for Noivces) References: Message-ID: <3C0BCDE8.43C7B064@ccvcorp.com> Arthur Siegel wrote: > Andreas writes - > > >Actually, if you like it your way, you can add this to lines to your > site.py: > >import copy,__builtin__ > >__builtin__.copy=copy.copy > > Very cool. > > who knew. Of course, one should be careful using this sort of thing. If you then trade code (in which you use copy() ) with someone else, this will bite you. Especially if you've made this change and then forgotten about it. Or, you made this change, someone else learns using your methods without being aware that you've made this change, and then that someone else is totally confused when they can't use copy() elsewhere. It's a cool trick, and can be very useful at times, but it *is* a trick, and it's important to be aware of the risks involved. :) Jeff Shannon Technician/Programmer Credit International From zhangsc at neusoft.com Mon Dec 17 20:42:56 2001 From: zhangsc at neusoft.com (=?gb2312?B?1cXJ2bPb?=) Date: Tue, 18 Dec 2001 09:42:56 +0800 Subject: How to make a socket.recv with nonblock? Message-ID: <00bd01c18765$514975e0$4301010a@sky> I have a program like that: HOST='' PORT=21567 ADDR=(HOST,PORT) udpSerSock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) udpSerSock.bind(ADDR) ipsock=socket.socket(socket.AF_INET,10,8) while 1: recvpack=ipsock.recv(1024) .... data,addr=udpSerSock.recvfrom(1024) #I want to only make this sentence with nonblock at port 21567 #notice that this sentence is in loop. .... How to realize this function ? I'm a newbie ,Would you give me detailed step to correct my program ?Thanks. Edward -------------- next part -------------- An HTML attachment was scrubbed... URL: From loewis at informatik.hu-berlin.de Thu Dec 6 06:11:00 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 06 Dec 2001 12:11:00 +0100 Subject: Psyco at SourceForge References: Message-ID: Armin Rigo writes: > I have opened a "Psyco" project at SourceForge: > > http://sourceforge.net/projects/psyco/ > > I suggest that people interested in Psyco post a welcome and start > discussion in the mailing list that I am currently opening there. What mailing list? Has it been created, yet? Martin From rdsteph at earthlink.net Sat Dec 29 20:09:02 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sun, 30 Dec 2001 01:09:02 GMT Subject: REPOST: Re: Who needs exceptions (was Re: Two languages, too similar, competing References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> <3C2E498B.6DC757E0@stroeder.com> Message-ID: <7$--$$_----_-%$_-$@news.noc.cabal.int> Several folks seem to agree that +++C and programmers who like C should die a slow and painful death for > holding back the computer industry for two decades.+++ I am hoping that the above does not apply to fellow I've heard of named Guido van Rossum, who, it is commonly rumored, has written some useful progrms in "C" from time to time ;-)))) ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E6A51.589E7F1D at earthlink.net> Control: cancel <3C2E6A51.589E7F1D at earthlink.net> Date: Mon, 31 Dec 2001 04:35:27 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774791 27193 211.57.49.2 (31 Dec 2001 04:59:51 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:59:51 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From peter at engcorp.com Tue Dec 4 02:30:36 2001 From: peter at engcorp.com (Peter Hansen) Date: Tue, 04 Dec 2001 02:30:36 -0500 Subject: Download file from web site References: Message-ID: <3C0C7B9C.E80E3A2F@engcorp.com> Thomas Pham wrote: > > I am trying to download a file from a website. My source > code is listed below. But I can only get to its first page. > I could not go further to its second page. The second page > "idm_download" however, does require an user ID & password to > open it. > > #!/usr/local/bin/python > import httplib > h = httplib.HTTP('www.teamidm.com/idm_download/') > h.putrequest('GET', '/index.html') I can't help with the userid/password part, but it looks to me like the above is asking for the index.html file that is in the root folder. You are using an absolute path for the GET, with a leading slash. If you want to get idm_download/index.html, you probably don't want to use "/index.html" to get it, but "index.html". (But I could be all wet on this.) -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From mhammond at skippinet.com.au Tue Dec 18 00:39:52 2001 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 18 Dec 2001 05:39:52 GMT Subject: WYSIWYG text Editor in python? References: <3C1DDCAC.C477A0A6@cicei.ulpgc.es> Message-ID: <3C1ED752.7060205@skippinet.com.au> Neil Hodgson wrote: > In a quick search I couldn't find a Python demonstration of RichEdit. The closest in Pythonwin is probably pywin\framework\sgrepmdi - this is the "find in files" function of Pythonwin. The: class GrepView(docview.RichEditView): class is probably the best intro to how it is used. Mark. From fdrake at acm.org Tue Dec 4 12:03:32 2001 From: fdrake at acm.org (Fred L. Drake) Date: Tue, 4 Dec 2001 12:03:32 -0500 (EST) Subject: [development doc updates] Message-ID: <20011204170332.0B76A28698@beowolf.digicool.com> The development version of the documentation has been updated: http://python.sourceforge.net/devel-docs/ The indexes are now working for the Python/C API manual and the Reference Manual. From ullrich at math.okstate.edu Thu Dec 6 13:29:59 2001 From: ullrich at math.okstate.edu (David C. Ullrich) Date: Thu, 06 Dec 2001 18:29:59 GMT Subject: Do 2.2 and 2.1.1coexist well? References: Message-ID: <3c0fb875.513172555@news> On Wed, 5 Dec 2001 23:29:44 -0500, "Tim Peters" wrote: >[David C. Ullrich] >> ... >> I imagine it's true nonetheless that the 2.x install is not >> going to change the 1.5 registry entries, eh? (Not if I >> back them up first, anyway...) > >Nothing has actually changed since the last time I answered this : Right. (_Something_'s changed since the last time you answered the question of whether Python looked in the registry for PYTHONPATH, though... changing the value of PYTHONPATH in the registry _does_ have a definite effect on what Python 1.5.2 does or does not find. At least when a *.py is started through the shell. Uh, wink.) >no, except the registry entries for Windows-mandated one-of-a-kind shared >resources, like (a) file extension associations, and (b) > >HKEY_LOCAL_MACHINE\ > Software\ > Microsoft\ > Windows\ > CurrentVersion\ > App Paths\ > Python.exe > >which tells Windows which version of Python to run when you, e.g., enter >plain "python" from the Start -> Run box and haven't fiddled your Windows >PATH to pick up some other version of Python before it. > >Just try it! If you don't like it, you can uninstall it. The 2.2 installer >undoes everything the installer did, including restoration of file >extensions etc. > > David C. Ullrich From skip at pobox.com Fri Dec 21 09:16:27 2001 From: skip at pobox.com (Skip Montanaro) Date: Fri, 21 Dec 2001 08:16:27 -0600 Subject: marshalling data structures between perl <-> php <-> python In-Reply-To: <5.1.0.14.2.20011221164328.031b3b50@202.95.131.154> References: <5.1.0.14.2.20011221164328.031b3b50@202.95.131.154> Message-ID: <15395.17467.559226.856294@12-248-41-177.client.attbi.com> Tripp> aside from using XML-RPC, what python module can i use to Tripp> marshall data structures (possibly a combination of lists, Tripp> dictionaries, and scalars of ints, floats, ascii strings, and Tripp> null values) between these three languages? i prefer a compact, Tripp> common binary format rather than XML. Dunno about "common", but there is a Python version of marshal that Guido wrote for JPython. You could translate that to Perl and PHP. I have a copy lying about if you need it. XML-RPC streams could also be compressed using zlib and the equivalent libraries on Perl and PHP. That would make it both compact and binary. ;-) -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From tundra at tundraware.com Tue Dec 11 20:50:04 2001 From: tundra at tundraware.com (Tim Daneliuk) Date: Wed, 12 Dec 2001 01:50:04 GMT Subject: Getting at an item in a list of tupples References: <9v66mi$17mi$1@newshost.nmt.edu> Message-ID: <3C16B738.E1A7D56D@tundraware.com> Bob Greschke wrote: > > Here's what I've got > > a = [] > a.append((ints, floats, strings)) > a.append((ints, floats, strings)) > a.append((ints, floats, strings)) > a.append((ints, floats, strings)) > ... > > I want to do something like > > print max(of all of the floats) > print min(of all of the floats) > > In general, how do you get at the floats (or ints, or strings)? We > can see doing something with map() calling a function that returns the > second item, but isn't there something a little simpler? > How about: print max([f for i, f, s in a]) -- ------------------------------------------------------------------------------ Tim Daneliuk tundra at tundraware.com From aahz at panix.com Sun Dec 23 12:39:43 2001 From: aahz at panix.com (Aahz Maruch) Date: 23 Dec 2001 09:39:43 -0800 Subject: Looping constructs References: <3c25d37e_9@news.newsgroups.com> Message-ID: In article <3c25d37e_9 at news.newsgroups.com>, Janos Blazi wrote: > >There is one thing I envy Perl programmers: they have several nice looping >constructs and Python has almost none. For exmaple redo unless can be nice >sometimes and they have several others. What do you think about adding such >contructs to Python? Why? With the addition of iterators to Python 2.2, almost any loop construct you can think of can be easily handled with a for loop. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 8 days and counting From info at mjais.de Mon Dec 24 16:29:57 2001 From: info at mjais.de (Markus Jais) Date: Mon, 24 Dec 2001 22:29:57 +0100 Subject: O'Reilly's Python and XML References: <87itawalol.fsf@kursk.kassube.de> Message-ID: Nils Kassube wrote: > "A. Keyton Weissinger" writes: > >> I just snagged a copy of _Python and XML_, a new release from O'Reilly. >> Excellent book. Pulls together quite a range of XML tips and tricks. >> There > > I'm still waiting for my copy from Amazon Germany. Is the book on sale > now? Or did you have to bribe someone? accoriding to amazon.com it ships within 24 hours. I ordered it at the german store www.computerbooks.de where it is cheaper than amazon.de but I have not yet received my copy markus > > Cheers, > Nils From news-fr at maniacosex.com Tue Dec 4 20:54:08 2001 From: news-fr at maniacosex.com (news-fr at maniacosex.com) Date: Wed, 05 Dec 2001 02:54:08 +0100 Subject: ••••[MANIACOSEX.COM]•••• Ajoutez vos sites et galeries ! Message-ID: <20011205021213.5E60736175@mail2.fr.clara.net> Bonjour, Ce message s'adresse a tous les webmasters X. Vous pouvez d?s a pr?sent inscrire votre site, vos galeries photos et vid?os sur notre annuaire International du Sex MANIACOSEX.COM Version fran?aise : http://www.fr.maniacosex.com/html/sommaire.cfm English version : http://www.uk.maniacosex.com/html/sommaire.cfm Versi?n espa?ola : http://www.sp.maniacosex.com/html/sommaire.cfm Deutsche Version : http://www.de.maniacosex.com/html/sommaire.cfm Rejoignez l'un des futurs plus grands portails du Sex et syst?mes TGP du WEB. Notre site fera grimper, grimper, grimper votre audience... A tr?s bient?t. Si vous ne souhaitez plus recevoir nos messages Cliquez ici pour vous d?sabonner : http://www.fr.maniacosex.com/html/mailing.cfm?email=python-list at python.org&state=remove From setattr at yahoo.no Fri Dec 7 04:24:26 2001 From: setattr at yahoo.no (Kjetil Jacobsen) Date: 7 Dec 2001 01:24:26 -0800 Subject: httplib slow read References: <48cs0u0a88eef5sacpbo12k1qappf9kodp@4ax.com> <2a9e827c.0112060226.16a20a42@posting.google.com> Message-ID: <2a9e827c.0112070124.31a246cc@posting.google.com> John Hunter wrote in message news:... > >>>>> "Kjetil" == Kjetil Jacobsen writes: > > Kjetil> another option may be to use the pycurl module which wraps > Kjetil> the curl library: > > Thanks for the tip. I have installed it and it looks nice. One thing > I have not been able to figure out is how to direct pycurl to print > the HTTP header it would send were I too invoke 'perform'. > > Something like > > import pycurl > c = pycurl.init() > c.setopt(pycurl.URL, 'http://www.python.org') > c.setopt(pycurl.REFERER, 'http://www.yahoo.com) > > # tried this but it ain't right. > print pycurl.HTTPHEADER > > How can I do this? pycurl.HTTPHEADER is used to set additional headers which will be used when doing the request. see e.g. tests/basicfirst.py on how to use the HTTPHEADER option to set custom headers. afaik there is no way to get the header _before_ doing the actual perform(). however, you can turn on the verbose flag: c.setopt(pycurl.VERBOSE, 1) which will print the header when perform() is invoked. you may also use the pycurl.CUSTOMREQUEST to hand-craft your own header to be used when doing the perform(). > Aside from the internal __doc__ and the cURL pages and the > pycurl/tests files, is there any documentation I should be aware of? pycurl closely follows the behaviour of libcurl. just remove the CURLOPT_ prefix for setopt() and the CURLINFO_ prefix for getinfo(). i am not aware of any other documentation. regards, - kjetil From david_j_dawkins at spamless.hotmail.com Fri Dec 14 21:37:21 2001 From: david_j_dawkins at spamless.hotmail.com (David Dawkins) Date: Sat, 15 Dec 2001 02:37:21 -0000 Subject: Preserving program structure References: <3C1A5960.4A27136D@attbi.com> Message-ID: <1EyS7.6544$ia7.942739@news6-win.server.ntlworld.com> "Chris Barker" wrote in message news:3C1A5960.4A27136D at attbi.com... > David Dawkins wrote: > > So I'm using IDLE, and Alt-F5 tells me I have a problem with > > indentation. > > > > It seems I had (inadvertently) mixed tab and space characters. > > No amount of "tabbifying" and "untabbifying" resolved the issue, > > so I had to shift *everything* to the left-margin, and re-create > > the indentation with a consistent scheme (8 space hard tabs). > > I'm confused. How is it that "untabbifying" didn't resolve it? While you > may have had a couple of indentations messed up, I would think that > would be a whole lot easier to fix than re-indenting the entire code! You'd think so wouldn't you. > By the way, I don't know about IDLE, but PythonWin (and other editors) > has a mode that allows you to see tabs and spaces, so you can easily go > in a clean out the ones that you don't want. The impression I get is "avoid IDLE". I'm a vi fan, so I'll find a way to emulate the "Ctrl-F5" (run script) feature. Thanks for everyone's input. David From sholden at holdenweb.com Tue Dec 18 11:32:23 2001 From: sholden at holdenweb.com (Steve Holden) Date: Tue, 18 Dec 2001 11:32:23 -0500 Subject: Cygwin socket library status enquiry References: <20011218131502.GA2268@dothill.com> <2JJT7.22497$PA.5674@atlpnn01.usenetserver.com> Message-ID: "Michael Hudson" wrote in message news:uitb4jypy.fsf at python.net... > "Steve Holden" writes: [ ... ] > > OK, I'll 'fess up: this was on Win 98. I'll be trying the same tricks on NT > > when I can get my network stable enough to make it practical -- at present > > everything's being reinstalled and/or upgraded. > > Aha! Can you try running the test suite from 2.2c1 on a recent-ish > cygwin? > > I'd like to include some more up to date information in the README -- > currently all it says is "we don't know the current state of play wrt > cygwin on 95/98/Me." > > This applies to anyone else who has access to the relavent software > too, of course. > > Cheers, > M. > Haven't downloaded candidate 1 yet, but I'll try to do so in the next few hours and give it a try on Windows 98. I presume you won't mind about the 2.2-specific feature tests failing ... I refreshed my Cygwin installation yesterday (if only Python packages installed so easily!) so I hope this will be recent enough. regards Steve -- http://www.holdenweb.com/ From LLoeffler at home.com Tue Dec 18 01:31:15 2001 From: LLoeffler at home.com (Luke) Date: Tue, 18 Dec 2001 00:31:15 -0600 Subject: Dear python-list New Lolitas Site For You References: <3C1EDA7F.5F6D7BDF@earthlink.net> Message-ID: <3C1EE2B3.6040901@home.com> Ummm CGI? Yeah, we've definently got Cu**s Galore Inside!!! Cum and see! > Cool! Can they help me with my cgi module? From fperez528 at yahoo.com Tue Dec 18 21:21:05 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Thu, 20 Dec 2001 01:49:05 +2328 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <9vruil$ipm$1@peabody.colorado.edu> <7x1yhqbefg.fsf@ruckus.brouhaha.com> <9vs0e0$jtm$1@peabody.colorado.edu> <7xr8pq9utg.fsf@ruckus.brouhaha.com> Message-ID: <9vs8p5$p5l$1@peabody.colorado.edu> Paul Rubin wrote: > Fernando P?rez writes: >> Well, considering that Python 2.0 was out in October 2000, the >> 'tight deadline' excuse doesn't fly too well, as far as I'm >> concerned. As I said above, I have yet to see a good justification >> for this mess. If there is one, > > Do you mean the Redhat configuration hassles, or the underlying mess > of the incompatibility between the two "mature" Python versions? the latter. Don't know what the 'config hassles' you refer to are. But the python mess is *very* annoying. f. From fredrik at pythonware.com Fri Dec 21 15:15:50 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 21 Dec 2001 20:15:50 GMT Subject: age of new pythonistas References: Message-ID: Tim Peters wrote: > I suspect Fredrik Lundh also knows Mark's age, but you've seen > how hard it is to get a straight answer from a bot. iirc, Barry's a few years older than Mark (or was it the other way around?), and I'm a few years older than my sister. From emwoj at poczta.onet.pl Tue Dec 25 16:45:36 2001 From: emwoj at poczta.onet.pl (emwoj) Date: Tue, 25 Dec 2001 22:45:36 +0100 Subject: national characters References: Message-ID: Great Thanks Wojciech Mickiewicz "Kirill Simonov" wrote in message news:mailman.1009298609.8696.python-list at python.org... > On Tue, Dec 25, 2001 at 11:26:23AM +0100, emwoj wrote: > > How can I use polish characters (cp1250) in Idle under Windows > > 1. > Create the file "Python21/sitecustomize.py" and write: > > import locale, sys > encoding = locale.getdefaultlocale()[1] > if encoding: > sys.setdefaultencoding(encoding) > > 2. > Open the file "Python21/Lib/lib-tk/FixTk.py", remove all lines, and > write: > > import sys, os > if not os.environ.has_key('TCL_LIBRARY'): > tcl_library = os.path.join(sys.prefix, "tcl", "tclX.Y") > os.environ['TCL_LIBRARY'] = tcl_library > > 3. > Open the file "Python21/Tools/idle/Percolator.py", go to the line 23. > You need to insert two lines of code into the function "insert": > > def insert(self, index, chars, tags=None): > # Could go away if inheriting from Delegator > if index != 'insert': # You need to add > chars = unicode(chars) # these lines. > self.top.insert(index, chars, tags) > > 4. > Open the file "Python21/Tools/idle/PyShell.py", go to the line 470. > You need to add two lines: > > line = self.text.get("iomark", "end-1c") > if type(line) == type(u""): # You need to add > line = line.encode() # these lines. > self.resetoutput() > > > \Xi > > From amackay at radical.ca Wed Dec 12 21:18:31 2001 From: amackay at radical.ca (Angus Mackay) Date: Wed, 12 Dec 2001 18:18:31 -0800 Subject: Python 1.5.x vs Python 2.x.x Message-ID: <3C180FF7.DEAEA6C6@radical.ca> there seems to be lots of stuff that refrences python 1.5.x or requires it but he www.python.org website doesn't mention it at all. what is the deal? what are people using? it seems to me that python doesn't handle versioning at all well under windows, if I build a module agains python 2.1 it wont work under a python 2.2 interpreter at all? cheers, Angus. From fgranger at alussinan.org Fri Dec 14 11:58:21 2001 From: fgranger at alussinan.org (=?ISO-8859-1?Q?Fran=E7ois_Granger?=) Date: Fri, 14 Dec 2001 17:58:21 +0100 Subject: Deprecate tabs for indenting References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BD39F.D43D4FF7@mega-nerd.com> <3c0be454$1@207.229.64.20> <3C0BE5D5.4386B359@mega-nerd.com> <3c0bf170$1@207.229.64.20> Message-ID: <1f4eseb.1hxd7x6hou3hsN%fgranger@alussinan.org> Steve Lamb wrote: > On Tue, 4 Dec 2001 01:36:49 -0800, Peter Bismuti wrote: > > I'm on your side. After following this thread I am more convinced that tabs > > are a better approach as it allows for a separation of style and content. > > Each person can view their file with whatever indentation width they prefer > > (style) without altering the contents of the file (content). > > How many times to I have to point out that style and content cannot be > separated? You need a time machine to come back to 21st century. You stayed in the 11th with cleck doing it all by hand. -- "La mort est un manque de savoir vivre" - Pierre Dac From timo at alum.mit.edu Fri Dec 7 01:59:15 2001 From: timo at alum.mit.edu (Timothy O'Malley) Date: Fri, 07 Dec 2001 06:59:15 -0000 Subject: Adding timeouts to Internet sockets Message-ID: hola. John Copella wrote: > How have developers added timeout behavior to Internet sockets in Python? I > am developing an application that uses ftplib, and I need to timeout if the > server is unavailable, etc. I note that Tim O'Malley has a package out > (http://www.vex.net/parnassus/apyllo.py?i=87800233) that very cleverly and > transparently does this (or seems to). Has anyone used it? My application > will be mission-critical, and I would prefer to use whatever is considered > the current best practice. It depends what you mean by "mission critical". As I see it, timeoutsocket has one big weakness: it doesn't help if the delay results from your host name resolver. If your DNS server is down, timeoutsocket will not prevent your connection from hanging while it tries to resolve the host name. (Web servers have this problem, and the common practice is to disable hostname resolution on incoming requests.) In my experience, once the IP address is resolved, timeoutsocket works darn well. I've received a bunch of emails from people who comment that timeoutsocket fits their needs. Most often, the emails read something like: "Thank you for writing this. It is so simple to use and just what we needed." I don't know what types of applications all those people are using it for". I'd be the last person to claim that widespread use means that this module is suitable for your "mission critical" needs. But, I will say that I haven't yet seen a better solution to add timeouts on any and all TCP connections, including those used by ftplib. And if there was a better solution, I'd switch to using it. Good Luck. TimO From donn at drizzle.com Thu Dec 20 00:02:03 2001 From: donn at drizzle.com (Donn Cave) Date: Thu, 20 Dec 2001 05:02:03 -0000 Subject: stackless python References: None <9vpjds$due$1@usc.edu> Message-ID: <1008824522.772261@yabetcha.sttl.drizzle.com> Quoth "John DeWeese" : | Hello, I'm a python newbie interested in using stackless python to support | hundreds of simulation objects for a game. I've checked out various articles | and it sounds great, and I've visited stackless.com. Seems that branch is | becoming a bit dated. I also see that some features such as generators (not | relevant to me) have made it into python 2.2. So, what's up, can anyone | share their experiences regarding stackless python, micro-threads, etc.? Stackless can really do miracles for an application design that has to deal with asynchronous event handling of some kind. I don't think you ever get miracles like that free, though. To work with Stackless, you really need to keep your head screwed on - in my opinion it isn't for casual use in every conceivable application. Raw continuations, anyway - I don't know microthreads, that sword is probably not so double-edged. Anyway, it's like a whole new language, and one with not much competition - I don't know, can Scheme do that stuff? Donn Cave, donn at drizzle.com From careye at spamcop.net Thu Dec 27 19:09:31 2001 From: careye at spamcop.net (Carey Evans) Date: 28 Dec 2001 13:09:31 +1300 Subject: REPOST: Re: Finding out that Python is in interactive mode in sitecustomize.py References: <3C2B8F47.4CEACF6E@olen.to> Message-ID: <0$--$$_----_-_$%$$@news.noc.cabal.int> Joonas Paalasmaa writes: > How can I find out that Python is started in interactive mode in > sitecustomize.py ? A search on http://groups.google.com/ for "python test interactive" comes up with this as the second result: import sys if hasattr(sys, "ps1"): # probably interactive else: # probably not interactive -- Carey Evans http://home.clear.net.nz/pages/c.evans/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.tele.dk!small.news.tele.dk!134.75.7.11!nntp.kreonet.re.kr!news.kigam.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Carey Evans Newsgroups: comp.lang.python Subject: cmsg cancel <87g05wgq84.fsf at psyche.dnsalias.org> Control: cancel <87g05wgq84.fsf at psyche.dnsalias.org> Date: Mon, 31 Dec 2001 05:00:42 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775482 27193 211.57.49.2 (31 Dec 2001 05:11:22 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:11:22 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From starx at pacbell.net Sun Dec 2 05:30:44 2001 From: starx at pacbell.net (Philip Swartzleonard) Date: 2 Dec 2001 10:30:44 GMT Subject: Pymode + NTemacs + Cygwin = ^M's Message-ID: Finally have just about everything set up right, using the latest versions of everything with bash as my shell for ntemacs. When, and only when, i use c-c c-c to execute the buffer, and it does not get loaded into a running interactive session, the output in the windows has a ^M after every line. Anyone else have this problem? I think it's because the execute-region function exports the file as a dos CRLF file, which gets confused piping though bash, but don't know what to do about it. Thanks. -- Philip Sw "Starweaver" [rasx] :: From GeorgLohrer at gmx.de Thu Dec 27 05:23:52 2001 From: GeorgLohrer at gmx.de (Georg Lohrer) Date: Thu, 27 Dec 2001 11:23:52 +0100 Subject: Problems with tkinter in python 2.2 References: <19eb8d3d.0112261056.2227760e@posting.google.com> Message-ID: On 26 Dec 2001 10:56:09 -0800, kmilo0 at hotmail.com (Kmilo) wrote: [snipped] >Somebody know what i have to do for run, tkinter.py? I got this error as I've built Python from source and forgotten to uncomment the lines below (already uncommented in this sample): # The _tkinter module. # # The command for _tkinter is long and site specific. Please # uncomment and/or edit those parts as indicated. If you don't have a # specific extension (e.g. Tix or BLT), leave the corresponding line # commented out. (Leave the trailing backslashes in! If you # experience strange errors, you may want to join all uncommented # lines and remove the backslashes -- the backslash interpretation is # done by the shell's "read" command and it may not be implemented on # every system. # *** Always uncomment this (leave the leading underscore in!): _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \ # *** Uncomment and edit to reflect where your Tcl/Tk libraries are: -L/usr/lib \ # *** Uncomment and edit to reflect where your Tcl/Tk headers are: -I/usr/include \ # *** Uncomment and edit to reflect where your X11 header files are: -I/usr/X11R6/include \ etc. So, your rpm's seems to have been built without tkinter support. There might be probably another rpm with activated tkinter. Another fault could be, that your LD_LIBRARY_PATH does not point to all necessary lib-paths or PYTHONPATH was not set accordingly. Ciao, Georg From store_li at sina.com Fri Dec 21 02:11:06 2001 From: store_li at sina.com (Kick) Date: Fri, 21 Dec 2001 15:11:06 +0800 Subject: How can I display unicode in Tk widget References: <9vkqm7$fqo83$1@ID-12869.news.dfncis.de> <9vnou6$gpvgr$1@ID-12869.news.dfncis.de> Message-ID: <9vunds$hiile$1@ID-12869.news.dfncis.de> Would You like tell me what could I do? "Martin von Loewis" wrote in message news:j4adwfldin.fsf at informatik.hu-berlin.de... > "Kick" writes: > > > Thank you! I have Tcl/Tk installed on my system, then How can I make it > > display with correct encoding? > > Did you try setting TCL_LIBRARY? > > Regards, > Martin From aleax at aleax.it Fri Dec 28 07:42:49 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 13:42:49 +0100 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B7276.88339BE7@earthlink.net> Message-ID: "Hans Nowak" wrote in message news:3C2B7276.88339BE7 at earthlink.net... > Ron Stephens wrote: ... > > Sourceforge projects, about 1300 to 80). By the way, Just van Rossum's > > http://starship.python.net/~just/comp.lang.python/ graph of Python > > newsgroup coverage seems to show a slight decline from over 6000 per > > month in late-middle 2001 to the current 3500 or so I see on here. Mr. > > van Rossum said he may not be able to update these any more due to some > > Yahoo change; anyway, am I interpreting these numbers and trends > > accurately? Will the Python newsgroup usage turn upwards again? Does it > > matter? Hmmm, I think it's all my fault -- in late-middle 2001 I basically turned off the Python newsgroup (and other netnews) to concentrate on other activity (all Python-related). And, these days, less and less often do I find myself somewhere with a newsreader and no other applicable tools (but it still happens from time to time, e.g. today). Some day or other, I'll be back with my exaggerated posting volume... just got a few books & projects to complete first... Alex From BgPorter at NOartlogicSPAM.com Wed Dec 5 15:36:59 2001 From: BgPorter at NOartlogicSPAM.com (Brett g Porter) Date: Wed, 05 Dec 2001 20:36:59 GMT Subject: mp3info and python References: Message-ID: "Dave Pawson" wrote in message news:Xns916EC841E89E8davePdpawsonfreeserv at 195.92.195.157... > My need is to read the header info from an mp3 file, > to determine its play time. (This is stuff we've encoded ourselves) > > Finally managed to get mp3info.py, and it appears > to work OK, except it always shows a 00:00 length. > > Reading the associated documentation, I'm unsure if > an mp3 file tells the whole tale in its header, > or whether the blocks which make up the file actually > sum to the total time of the whole file. > > Has anyone used this please, and could share > experience? > > All I need is to pull the length from 50 or so files > in sequence and add the times, nothing fancy inside > the files. I can't get the mp3info.tar file that's on the Vaults to expand correctly, so I can't venture how they handle things, but I do have a lot of experience with MP3 data. Can you get the bit rate from mp3info? Assuming that you can, and it's a constant bit rate file, the length in seconds is filesize / (bitrate / 8). If there's ID3 data at the end of the file, subtract that from the filesize before calculating. If it's a variable bit rate file, you will need to scan through the file and count frames, multiplying by the constant # of milliseconds per frame. From alexis.layton at post.harvard.edu Sat Dec 1 01:53:35 2001 From: alexis.layton at post.harvard.edu (Alexis Layton) Date: Sat, 01 Dec 2001 06:53:35 GMT Subject: Let's make Python really strict about indentation Message-ID: <3C087F11.4030706@post.harvard.edu> I'm starting to believe the only solution to the indentation "mixups" that occur is to have Python become really strict about indentation, yet still allow a mixture of spaces and tabs. This can be accomplished by defining SPACES and TABS as being indentation characters that have NO relation to one another. In this model, if someone is crazy enough to include a mixture of spaces and tabs as indentation, the rule is quite simple: you can only change the right side. A sequence of TTSTS for example, can be indented by adding more Ts and Ss, and can be exdented by removing the exact righmost sequence of Ss and Ts that occurred previously. Anything else would be an indentation error. This does mean that the lexer has to keep knowledge of the currently running indentation string along with the "level", but "level" becomes merely an index into the indentation prefix string. Of course, we could always become REALLY, REALLY strict and never allow a mixture. Alexis Layton From walter at livinglogic.de Thu Dec 13 10:59:40 2001 From: walter at livinglogic.de (Walter =?ISO-8859-1?Q?D=F6rwald?=) Date: Thu, 13 Dec 2001 16:59:40 +0100 Subject: Read and Print ASCII >128 as is in cp437 on DOT-MATRIX printer or file regardless local setting References: <002f01c183e1$1a006bc0$6f00000a@activmedia.hr> <20011213154140.C9760320968@bireme.oratrix.nl> Message-ID: <3C18D06C.4030707@livinglogic.de> Sjoerd Mullender wrote: > [...] > So, an alternative which will ignore all unconvertible characters is: > > result = [] > for c in unicode(data, 'cp437'): > try: > result.append(c.encode('iso-8859-2')) # or 'us-ascii', or ... > except: > pass > print ''.join(result) This can be done much simpler: print unicode(data, 'cp437').encode('iso-8859-2', "ignore") Bye, Walter D?rwald From tbryan at python.net Sun Dec 16 21:01:36 2001 From: tbryan at python.net (Tom Bryan) Date: Mon, 17 Dec 2001 02:01:36 GMT Subject: Oracle Access References: <9uqmsf0t7f@enews2.newsguy.com> Message-ID: <4mcT7.299918$HA6.57236422@typhoon.southeast.rr.com> Choco wrote: > Right now, I've had better luck compiling cx_Oracle on a Digital Tru64 > database server, so I've been using that one for all my scripting. It > works for most things; not necessarily better than DCOracle2. I initially had trouble building DCOracle, but I found that I had much better success when using the Oracle shared library: libclntsh.so. I'm not sure whether they're still doing the insane Oracle linking thing (haven't used DCOracle in a while), but I was able to replace all of their link arguments for the Oracle libraries with a simple -L$ORACLE_HOME/lib -lclntsh if I remember correcctly. Since it's a shared library, DCOracle also has a smaller footprint with the shared library. Regards, ---Tom From deliberatus at my995internet.com Sun Dec 9 01:21:22 2001 From: deliberatus at my995internet.com (Kirk Bailey) Date: Sun, 09 Dec 2001 01:21:22 -0500 Subject: intresting buried treasure in the on line reference manual Message-ID: <3C1302E2.B23E1824@my995internet.com> Sending a message in python to the mail MTA I also found this in the refernece, very helpful, eccept for 2 things- a line of gibberish, and there is a bug on line 14. Relevant page: http://www.python.org/doc/current/lib/SMTP-example.html 1 import smtplib 2 import string 3 4 def prompt(prompt): 5 return raw_input(prompt).strip() 6 7 fromaddr = prompt("From: ") 8 toaddrs = prompt("To: ").split() 9 print "Enter message, end with ^D:" 10 11 # Add the From: and To: headers at the start! 12 msg = ("From: %s\r\nTo: %s\r\n\r\n" 13 % (fromaddr, string.join(toaddrs, ", "))) # <-- I suspect this is a linewrap error, it does not bomb 14 while 1: # <-- this line screws everything up! # if I place it all on one line. 15 try: # the test is APPARENTLY to create an endless loop with 2 16 line = raw_input() # hard coded exit conditions manually built in. But my python hates it. 17 except EOFError: 18 break 19 if not line: 20 break 21 msg = msg + line 22 23 print "Message length is " + `len(msg)` 24 25 server = smtplib.SMTP('localhost') 26 server.set_debuglevel(1) 27 server.sendmail(fromaddr, toaddrs, msg) 28 server.quit() 29 30 -- Respectfully, -Kirk D Bailey (C)2001 Addme! icq #27840081 end Within the sweep of his sword, Each man is an Ubar. http://www.howlermonkey.net/ http://www.sacredelectron.org/ From gh_pythonlist at gmx.de Tue Dec 11 12:37:50 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Tue, 11 Dec 2001 18:37:50 +0100 Subject: Some stupid questions In-Reply-To: <9v5ea4$d1ek8$1@ID-119882.news.dfncis.de> References: <9v5ea4$d1ek8$1@ID-119882.news.dfncis.de> Message-ID: <20011211173749.GA6229@lilith.hqd-internal> Le 11/12/01 ? 17:04, Another rookie ?crivit: > > Hi I'm an old fart and a newbie. So I hope you'll bear with me and answer a > few basic questions for me. Feel free as patronizing as you want. > > I've just downloaded the latest version of Python 2.2, and have started > learning to program from the web tutorials. If I stick with it ...... I hope you'll enjoy it :) > ... Will I be able to compile my progs as executables, so that they can run > on anybodies machine, whether or not they have a version of Python > installed? Yes, in principle, that's possible and easy. It can get tricky once you want to use some very useful third-party modules like win32com or wxPython. I'll just assume your target platform is Windows. py2exe and Gordon McMillan's installer are two tools that can create standalone executables for Windows that include the Python interpreter, all the used modules and your Python scripts. > ... If not, does jpython or jython allow me to compile my progs as java > apps, so that they will run on any machine with java? That's another possibility, you can use jythonc to "freeze" Python scripts, similar to the above mentioned tools for CPython. Then, you could create an executable jar file from the compiled classes and jython.jar. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From fperez528 at yahoo.com Tue Dec 18 18:26:57 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Wed, 19 Dec 2001 22:54:57 +2328 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> Message-ID: <9vruil$ipm$1@peabody.colorado.edu> Suchandra Thapa wrote: > Fernando P?rez wrote: >>This is clumsy, and is why yesterday I wrote a detailed post on the issue >>hoping to hear from the redhats for a reasonable explanation. As far as I >>can tell, their python distribution is simply broken. The problems can be >>worked around, but it's an annoyance. > > I think it's primarily to maintain compatibility. Although redhat > may be able to change all the references to python1.5 in their scripts, it > still leaves the possibility that scripts that worked under redhat 7.0 will > break due to the compatibility issues between python 1.5 and 2.x. All the scripts for which this is an issue are distributed by them, as part of their own system setup. So they can point every script which explicitly needs 1.5 to use it. They cause their users a fair amount of annoyance and I have yet to see a solid technical reason to justify it. My post from yesterday included ways out of this with (as far as I could tell) reasonable solutions for them. Yesterday someone from redhat was around on this thread (or the /usr/bin/env thread), I'm curious to hear from them. There may be a solid technical reason for them doing things this way, but so far I'm unconvinced. cheers, f From jpt.d at rogers.com Sun Dec 30 03:45:56 2001 From: jpt.d at rogers.com (Jeffrey Drake) Date: Sun, 30 Dec 2001 08:45:56 GMT Subject: REPOST: Re: Option Explicit: Yuck. References: <3BE4DF39.AE0A8EAA@ix.netcom.com> <3BE534B7.F0F56060@chello.nl> <3BE5F306.446480AD@ix.netcom.com> <%JlJ7.552378$j65.135625324@news4.rdc1.on.home.com> Message-ID: <2$--$$_----__$-%%$@news.noc.cabal.int> I can't agree with your statement that VB isn't object oriented. The only thing VB doesn't support is implementation inheritance. This isn't necessarily needed though to be classified as OO because it does support Interface inheritance. Regards, Jeffrey Drake > >(3) Visual Basic, at least until Visual Studio.NET is not capable of either >#1 or #2, and it remains to be seen if .NET can reverse that. (VB.net will >be the first truly Object Oriented version of VB, but will probably still >not be fully dynamic like Python.) > > > >Warren Postma > > ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: jpt.d at rogers.com (Jeffrey Drake) Newsgroups: comp.lang.python Subject: cmsg cancel <3c2ed3d9.18033070 at nntp> Control: cancel <3c2ed3d9.18033070 at nntp> Date: Mon, 31 Dec 2001 03:12:21 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774300 27193 211.57.49.2 (31 Dec 2001 04:51:40 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:51:40 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From usenet at thinkspot.net Sat Dec 29 20:22:35 2001 From: usenet at thinkspot.net (Sheila King) Date: Sat, 29 Dec 2001 17:22:35 -0800 Subject: Is learning Python "extraordinary"? References: Message-ID: On Sat, 29 Dec 2001 13:29:35 -0800, "Jesse F. W" wrote in comp.lang.python in article : > I am a high school senior, and like many others, I am applying > to college. I am applying to MIT (as well as many other schools). > MIT describes what they are looking for as students who do or have > done "extraordinary things". My question is this, Is teaching myself > Python (with the aid of the Python tutorials and some help from the > various lists) an "extraordinary thing"? How many python-list'ers are > high school students? As a high school teacher of many years, and a former AP Computer Science teacher, I would say that teaching yourself *any* programming language on your own is unusual, although not uncommon. But teaching yourself Python, is rather rare. In writing college admission essays, go ahead and tell about this. More importantly, tell about your motivation for doing it, and any accomplishments that have followed as a result, especially any future plans down the road that your are looking towards as a result of your exposure to Python. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org/ From nikander at mindspring.nospamcom Mon Dec 24 12:35:19 2001 From: nikander at mindspring.nospamcom (Robert Nikander) Date: Mon, 24 Dec 2001 12:35:19 -0500 Subject: C++ throw causes abort in extension? Message-ID: <20011224.123518.378096161.2956@localhost.localdomain> Hi everyone, I am trying to use C++ in my Python extension, but any throwing of exceptions cause the program to 'abort.' I put this code in my init module function; and below you see what happens when I try to import... cout << "about to throw in initrobs" << endl; try { throw 100; } catch (...) { cout << "Caught ..." << endl; } Python 2.2c1 (#1, Dec 18 2001, 11:04:07) [GCC 3.0.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import robs about to throw in initrobs Aborted [rob at ibooker py_ext2]$ I tested exceptions apart from Python and they are working fine on my system normally. So is there something wrong with throwning an exception when your C++ code was called by C code? I also tried downloading CXX and it aborts foir the same reasons, so maybe this is something with GCC 3.02? Thanks for any help, Rob From db3l at fitlinxx.com Wed Dec 5 19:28:42 2001 From: db3l at fitlinxx.com (David Bolen) Date: 05 Dec 2001 19:28:42 -0500 Subject: ANN: Simple Newsgroup Searchterm Monitor (attached) References: <3c13ba77.19343935@127.0.0.1> <3C0DBB04.5070102@home.com> <3c21bc9f.19896499@127.0.0.1> Message-ID: root at 127.0.0.1 ((Five Fresh) Fish) writes: > The attachment is bugger-all long -- as in, much shorter than some scripts > I've seen posted here -- so the "non-binaries" argument doesn't much wash. > "Infected" also doesn't much work: it's a zipfile with Python scripts, > because that makes it even shorter than posting the scripts. Just FYI, "binaries" isn't dictated by size, it's determined by, well, if they're binary. :-) A zipfile is a binary encoding, so you're posting a binary (whether uuencoded or whatever). If the scripts are really that small just keep them in text form where they're readable without needing decoding. -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l at fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/ From borcis at geneva-link.ch Fri Dec 7 04:26:10 2001 From: borcis at geneva-link.ch (Boris Borcic) Date: Fri, 07 Dec 2001 10:26:10 +0100 Subject: Jython with embedded Java Message-ID: <3C108B32.436B1999@geneva-link.ch> Say I wanted to use Jython to program animations in an SVG plugin through the Java API. Is this possible ? How should I go about it ? BB From mertz at gnosis.cx Thu Dec 20 18:44:41 2001 From: mertz at gnosis.cx (Lulu of the Lotus-Eaters) Date: Thu, 20 Dec 2001 18:44:41 -0500 Subject: age of new pythonistas Message-ID: Bengt Richter wrote: > What I wonder about is the dev group, starting with Guido and Tim ;-) Mark Hammond wrote: |Guido is a few years older than me, and Tim a few years older than him :) I've wondered that myself, from time to time. In Guido's case, it seems fairly easy to ballpark (maybe just from recent pictures). His resume at http://www.python.org/~guido/Resume.html provides some guidelines. It says he got a Master's degree in 1982, and that he worked for 5 years at SARA while getting it. It is possible within the phrasing that he took more than 5 years for the Masters, but only worked at SARA for five of them. Still, that puts the start probably around 1977. Guessing the MA came right after a college degree, he was probably around 23 in 1977. Tim Peters is much harder to pin down, of course. I once saw a picture on the Python website that was rumored to be Tim (sitting on the shoulder of some gray haired guy :-)). But who knows whether that's accurate. It doesn't seem to be around now. Older-than-I-used-to-be-ly yours, Lulu... From donn at u.washington.edu Thu Dec 6 18:41:46 2001 From: donn at u.washington.edu (Donn Cave) Date: 6 Dec 2001 23:41:46 GMT Subject: Detection of subsequent data by poll() References: <79179cf5.0112051303.24daac96@posting.google.com> <9um3qr$d20$1@nntp6.u.washington.edu> <79179cf5.0112061416.48ce89c5@posting.google.com> Message-ID: <9uovnq$2p3m$1@nntp6.u.washington.edu> Quoth rupe at metro.yak.net (Rupert Scammell): | > Quoth rupe at metro.yak.net (Rupert Scammell): | > | I recently wrote a program that uses the select.poll() method in order | > | to | > | check for incoming data on multiple listening sockets. When I open a | > | connection to one of the listening sockets (e.g. via telnet), the | > | program accepts the first item of data sent (a character string with a | > | trailing CRLF). However, subsequent calls to poll() never appear to | > | detect more strings sent in the same connection to this socket. The | > | file descriptors for the sockets are all correctly registered with the | > | poll object. | > | | > | Is there a way to make poll() detect this incoming data without having | > | to close and re-open a connection to the socket in question each time? | > | | > | Any suggestions would be appreciated! | Per Donn Cave's request, the source of the program that's producing | the problem is provided below. The system in use is a RH Linux 6.2 | machine (x86 architecture), running kernel version 2.4.13. Again, any | assistance or insight into why the poll() call made against the poll | object is failing to return more than the first sent line of data | would be greatly appreciated. In this program, poll() doesn't really detect the first line, either. You register only the service sockets, so you detect connections. Then on connect, you accept(), and you infer the existence of the first line. If you want poll() to see the first line, you have to register the cur_conn_obj you get from accept(). This should make sense: in general, if you want poll to tell you there's data to be read on X, you must give it X to look at. Donn Cave, donn at u.washington.edu ---------------------------------------- | Polling code source: | | import sys, socket, select | | # Create polling object. | poll_obj = select.poll() | | # List of ports to open | port_list = [8555, 8556, 8557, 8558] | | # List of associated file descriptor numbers. These match up | # by subscript with the values in port_list, above. | fileno_list = [] | | # List of socket objects. | sock_obj_list = [] | | # Number of sockets to create: | num_sockets = len(port_list) | | # Create socket objects for each port in port_list, append to | sock_obj_list, | # then bind and listen on each. | for i in range(num_sockets): | print 'entering socket addition FOR, port: ', port_list[i] | sock_obj_list.append(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) | sock_obj_list[i].setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | sock_obj_list[i].bind(('',port_list[i])) | sock_obj_list[i].listen(1) | | | # Add the file descriptor to fileno_list: | fileno_list.append(sock_obj_list[i].fileno()) | | # Register the fd with poll_obj. | poll_obj.register(sock_obj_list[i]) | | # Poll for data on each of the registered socket objects. | | print 'fileno_list: ', fileno_list | print 'sock_obj_list: ', sock_obj_list | | | while 1: | # Start with an empty list that'll contain data from | # our sockets that have events. | data_list = [] | | # Poll for data on each of the sockets. | print 'Polling...' | event_list = poll_obj.poll() | print 'event_list', event_list | | # Number of socket objects returned. | event_count = len(event_list) | print 'event count: ', event_count | | """ | Match the file descriptor values returned by .poll() into event_list with | the socket that has that file descriptor value in sock_obj_list. | Once we know the socket, call .accept() on it, then read 1024 bytes of data | from it. Then print the list of retrieved data. Each item in the list is a | two item tuple in the form (port_number, retrieved_data). | """ | | for i in range(event_count): | current_fd = event_list[i][0] | for b in range(num_sockets): | if (current_fd == fileno_list[b]): | (cur_conn_obj, cur_addr) = sock_obj_list[b].accept() | data_list.append([port_list[b], cur_conn_obj.recv(1024)]) | print data_list From ullrich at math.okstate.edu Tue Dec 4 13:34:00 2001 From: ullrich at math.okstate.edu (David C. Ullrich) Date: Tue, 04 Dec 2001 18:34:00 GMT Subject: Do 2.2 and 2.1.1coexist well? References: Message-ID: <3c0d15e9.340462648@news> On Mon, 3 Dec 2001 14:32:37 -0500, "Tim Peters" wrote: >[...] In fact, Python on >Windows normally never reads the registry for anything, not even for >PYTHONPATH. You can verify that by changing the PYTHONPATH in your >registry, and then noting that sys.path doesn't change as a result. Actually come to think of it I coulda sworn that various things didn't work on "the new machine" until I added a DU directory to PYTHONPATH in the registry. Checked just now - I delete that directory from PYTHONPATH using regedit and the script says it can't find whatever.py; I put the directory back and it runs just fine. (Python 1.5.2; like you said, maybe the rules are different.) I imagine it's true nonetheless that the 2.x install is not going to change the 1.5 registry entries, eh? (Not if I back them up first, anyway...) David C. Ullrich From opengeometry at yahoo.ca Mon Dec 3 16:42:30 2001 From: opengeometry at yahoo.ca (William Park) Date: Mon, 3 Dec 2001 16:42:30 -0500 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) In-Reply-To: <3C0BF1C2.E12421D0@attbi.com>; from chrishbarker@attbi.com on Mon, Dec 03, 2001 at 01:42:26PM -0800 References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BE445.2D4EDF72@mega-nerd.com> <3C0BF1C2.E12421D0@attbi.com> Message-ID: <20011203164230.A337@node0.opengeometry.ca> On Mon, Dec 03, 2001 at 01:42:26PM -0800, Chris Barker wrote: > Erik de Castro Lopo wrote: > > How about a counter proposal? > > Reject all .py files with spaces for indentation. > > Either one would be fine with me...and better than allowing either > (especially mixed...Yikes!!!) I don't care! Just set the standard, be done with it. Please, no more on this issue... -- William Park, Open Geometry Consulting, . 8 CPU cluster, NAS, (Slackware) Linux, Python, LaTeX, Vim, Mutt, Tin From jason at jorendorff.com Mon Dec 10 15:33:31 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Mon, 10 Dec 2001 14:33:31 -0600 Subject: reference counting for garbage collection In-Reply-To: Message-ID: "Paul Brian" wrote: > I am getting confused over object references/pointers etc.... Relax. It's easier than you think (I think). > [...] will the function foo still keep some reference to conn > such that del(x) will *not* destroy conn but conn will still > stay alive? Nope. As long as you have a variable somewhere by which you could ever possibly reach that connection object and use it, ever again ever, Python keeps the object alive. But when your function exits, all its local variables go away. After you've lost every possible way to reach an object, Python is likely to kill it. After all, the reasoning goes, you clearly won't be using it anymore. If you want Python to keep an object alive, just stash it someplace where you can get to it later - in a global list, for example. > what have I done wrong in the stuff I just wrote (no not the above:-)? There's no telling. -- Jason Orendorff http://www.jorendorff.com/ From m.bless at gmx.de Sun Dec 16 18:54:49 2001 From: m.bless at gmx.de (Martin Bless) Date: Sun, 16 Dec 2001 23:54:49 GMT Subject: Algorithms for 6-byte ("real48") Borland Pascal Floating Point numbers References: <3c19262e.1671423@news.muenster.de> <3C192B25.4F1BD2F9@indra.com> <87lmg6f3sx.fsf@pc714.maths.usyd.edu.au> Message-ID: <3c1d309b.27384056@news.muenster.de> Below is a working example of 3 different ways I figured out to convert those 6-byte Borland Pascal floating points to 'normal' floats. Status: experimental. What do you think about it? The algorithms presented seem to hold at least for values from -1000.0 to +1000.0. But where are the pitfalls? I'd be very pleased if someone with more "real" and "numerical" understandig has a look at it. And yes, if the algorithm 'real48_to_double' seems ok, it would be wonderful to have this little bit shifting available via the 'struct' module. Getting greedy: Yes, both ways, pack and unpack... :-) Here's my 'real48.py': '''Unpack Borland Pascal 6-byte "real48" floating point number. Status: experimental Martin Bless (mb), m.bless at gmx.de, 2001-12-16, 2001-12-16 In the context of this program the data structure of a real48 number is assumed to be a six-byte string ('r48'): r48[0] r48[1] r48[2] r48[3] r48[4] r48[5] a0 a1 a2 a3 a4 a5 sffffff ffffffff ffffffff ffffffff ffffffff eeeeeeee s=sign, f=mantisse (39 bit), e=exponent (8bit, bias 129) order: S-F-E See http://www.merlyn.demon.co.uk/pas-type.htm#FF ''' import struct START_RANGE = -10 END_RANGE = +10 + 1 USE_INLINE_DATA = 1 # sampled real nums from file created by Borland Pascal pascal_data = ('' +'\x84\x00\x00\x00\x00\xa0' # -10.000000 +'\x84\x00\x00\x00\x00\x90' # -9.000000 +'\x84\x00\x00\x00\x00\x80' # -8.000000 +'\x83\x00\x00\x00\x00\xe0' # -7.000000 +'\x83\x00\x00\x00\x00\xc0' # -6.000000 +'\x83\x00\x00\x00\x00\xa0' # -5.000000 +'\x83\x00\x00\x00\x00\x80' # -4.000000 +'\x82\x00\x00\x00\x00\xc0' # -3.000000 +'\x82\x00\x00\x00\x00\x80' # -2.000000 +'\x81\x00\x00\x00\x00\x80' # -1.000000 +'\x00\x00\x00\x00\x00\x00' # 0.000000 +'\x81\x00\x00\x00\x00\x00' # 1.000000 +'\x82\x00\x00\x00\x00\x00' # 2.000000 +'\x82\x00\x00\x00\x00\x40' # 3.000000 +'\x83\x00\x00\x00\x00\x00' # 4.000000 +'\x83\x00\x00\x00\x00\x20' # 5.000000 +'\x83\x00\x00\x00\x00\x40' # 6.000000 +'\x83\x00\x00\x00\x00\x60' # 7.000000 +'\x84\x00\x00\x00\x00\x00' # 8.000000 +'\x84\x00\x00\x00\x00\x10' # 9.000000 +'\x84\x00\x00\x00\x00\x20' # 10.000000 +'\x84\x00\x00\x00\x00\xa0' # -10.0 +'\x84\x00\x00\x00\x00\x90' # -9.0 +'\x84\x00\x00\x00\x00\x80' # -8.0 +'\x83\x00\x00\x00\x00\xe0' # -7.0 +'\x83\x00\x00\x00\x00\xc0' # -6.0 +'\x83\x00\x00\x00\x00\xa0' # -5.0 +'\x83\x00\x00\x00\x00\x80' # -4.0 +'\x82\x00\x00\x00\x00\xc0' # -3.0 +'\x82\x00\x00\x00\x00\x80' # -2.0 +'\x81\x00\x00\x00\x00\x80' # -1.0 +'\x00\x00\x00\x00\x00\x00' # 0.0 +'\x81\x00\x00\x00\x00\x00' # 1.0 +'\x82\x00\x00\x00\x00\x00' # 2.0 +'\x82\x00\x00\x00\x00\x40' # 3.0 +'\x83\x00\x00\x00\x00\x00' # 4.0 +'\x83\x00\x00\x00\x00\x20' # 5.0 +'\x83\x00\x00\x00\x00\x40' # 6.0 +'\x83\x00\x00\x00\x00\x60' # 7.0 +'\x84\x00\x00\x00\x00\x00' # 8.0 +'\x84\x00\x00\x00\x00\x10' # 9.0 +'\x84\x00\x00\x00\x00\x20' # 10.0 ) # some helper functions def s2hex(s,delim=''): '''String to hex-string.''' l = ['0000', '0001', '0010', '0011', '0100', '0101', '0110', '0111', '1000', '1001', '1010', '1011', '1100', '1101', '1110', '1111'] result = map( lambda c,l=l: '%02x' % ord(c),s) result = delim.join(map( lambda c,l=l: '%02x' % ord(c),s)) return result def s2bin(s, byte_delim='', nibble_delim=''): '''String to bin-string. Example: print s2bin('AB') -> '0100000101000010' print s2bin('AB', '...') -> '01000001...01000010' print s2bin('AB', '...', '-') -> '0100-0001...0100-0010' ''' l = ['0000', '0001', '0010', '0011', '0100', '0101', '0110', '0111', '1000', '1001', '1010', '1011', '1100', '1101', '1110', '1111'] result = byte_delim.join(map( lambda c,l=l,d=nibble_delim: l[ord(c)/16]+d+l[ord(c)%16],s)) return result def bin2s(s, byte_delim='', nibble_delim=''): '''Reverse s2bin. Nothing checked.''' len1 = len(byte_delim) len2 = len(nibble_delim) L = [] while s: L.append(s[:4] + s[4+len2:8+len2]) s = s[8+len1+len2:] result = ''.join(map(lambda x:chr(int(x,2)),L)) return result def s_reverse(s): '''Reverse string. Is there something built in???''' L = map(lambda c:c,s) L.reverse() return ''.join(L) def bin(i): # by Andrew Gaul, c.l.p, 2001-05-10 l = ['0000', '0001', '0010', '0011', '0100', '0101', '0110', '0111', '1000', '1001', '1010', '1011', '1100', '1101', '1110', '1111'] s = ''.join(map(lambda x, l=l: l[int(x, 16)], hex(i)[2:])) if s[0] == '1' and i > 0: s = '0000' + s return s # now the working part def real48(r48): '''Return value of r48 - explicit calculation. Algorithm 'stolen' and adapted from: program sixbytes { jrs at merlyn.demon.co.uk >= 2001-11-25 } ; at http://www.merlyn.demon.co.uk/pas-type.htm#FF ''' a0,a1,a2 = ord(r48[0]), ord(r48[1]), ord(r48[2]) a3,a4,a5 = ord(r48[3]), ord(r48[4]), ord(r48[5]) sign = a0 / 128 exp = a5 - 129 # Q = 1.0/256 # Q / R2 = alternative if a5 == 0: R1 = 0.0 # R2 = 0.0 else: R1 = 1.0 + 2.0 * ((a0 % 128)+(a1+(a2+(a3+a4/256.0)/256.0)/256.0)/256.0)/256.0 # R2 = 1.0 + 2.0 * ((((a4*Q+a3)*Q+a2)*Q+a1)*Q+(a0 % 128))*Q if sign: R1 = -R1 # R2 = -R2 # info_tuple = sign, exp, 2.0**exp * R1, R1, R2 result = 2.0**exp * R1 return result def real48_to_single(r48): '''Convert r48 via struct as 'single float'. By mb. Experimental. What happens to precision? Does it hold for - at least - all possibilities of single floats? ''' exp = ord(r48[5]) if not exp: return 0.0 # adjust for exponent bias 127 of singles # instead of 129 of real48s exp = exp - 129 + 127 s = s2bin(r48[:6]) rearranged = s[0]+s2bin(chr(exp))+s[1:40] packed_single = bin2s(rearranged) result, = struct.unpack('>f', packed_single[0:4]) return result def real48_to_double(r48): '''Convert r48 via struct as 'double float'. By mb. Experimental. What happens to precision? Does it hold for possibilities of a real48? order S-E-F, s=sign, e=exponent, f=fraction part, 1-11-52 bits, exponent bias 1023 ''' exp = ord(r48[5]) if not exp: return 0.0 # adjust for exponent bias 1023 of doubles # instead of 129 of real48s. exp = exp - 129 + 1023 # we only want 11 bits bin_exp = s2bin(chr(exp/256)+chr(exp%256))[5:16] s = s2bin(r48[:6]) rearranged = s[0] + bin_exp + s[1:40] + '0'*(52-39) packed_double = bin2s(rearranged) result, = struct.unpack('>d', packed_double[0:8]) return result if __name__== "__main__": if USE_INLINE_DATA: position_adjust = 10 else: #file with 6-byte floats -1000.0 to +1000.0 pascal_data = open('real.txt','rb').read() position_adjust = 1000 for x in range(START_RANGE,END_RANGE): offset = (x + position_adjust) * 6 s, = unpack('6s',pascal_data[offset:offset+6]) # create some source data if 0: print " +'\\x%02x\\x%02x\\x%02x\\x%02x\\x%02x\\x%02x' # %5.1f" % \ (ord(s[0]),ord(s[1]),ord(s[2]),ord(s[3]), ord(s[4]),ord(s[5]), x*1.0) r48 = s_reverse(s) v = '%6d: ' % x if 0: print v, s2bin(r48,' ') if 1: fmt = '%5.1f ' print v, print fmt % real48(r48), print fmt % real48_to_single(r48), print fmt % real48_to_double(r48) ++++++++++++++ History: On 14 Dec 2001 22:18:22 +1100, nigel at pc714.maths.usyd.edu.au wrote: >Ron Reidy writes: > >> Martin Bless wrote: >> > >> > I have to convert those "good (?) old" 6-byte, "real48" floating point >> > numbers used in Borland's Pascal to nowadays "normal" floating points. >> > >> > Has is already been done? >> > >> > Martin >> You will have to do this using pack(). >> -- >> Ron Reidy >> Oracle DBA >> Reidy Consulting, L.L.C. > >The little-known xdrlib in the standard python distro should do >part of the job. > >http://www.python.org/doc/current/lib/module-xdrlib.html > >From what I can see in RFC1014 (http://www.faqs.org/rfcs/rfc1014.html) >the XDR and IEEE formats coincide for floating point. The real48 format >(http://www.borland.com/techpubs/delphi/delphi5/oplg/memory.html) >looks similar enough to IEEE that a bit of byte-shifting should do >the conversion, and xdrlib.pack_double(data) gives you your number. > >nigel >( at maths. usyd. edu. au ) From jblazi at hotmail.com Sun Dec 23 07:53:02 2001 From: jblazi at hotmail.com (Janos Blazi) Date: Sun, 23 Dec 2001 13:53:02 +0100 Subject: Looping constructs Message-ID: <3c25d37e_9@news.newsgroups.com> There is one thing I envy Perl programmers: they have several nice looping constructs and Python has almost none. For exmaple redo unless can be nice sometimes and they have several others. What do you think about adding such contructs to Python? J.B. -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- From guido at python.org Mon Dec 17 16:51:01 2001 From: guido at python.org (Guido van Rossum) Date: Mon, 17 Dec 2001 21:51:01 GMT Subject: "XXX undetected error" in python_d.exe References: Message-ID: > Tim wrote: > > It's best not to think too hard about what those rules imply when a > > destructor gets called by magic ... "Jason Orendorff" writes: > Oh. I thought Python would automatically squelch exceptions in > destructors, so you didn't have to check after every DECREF. (?) Correct, DECREF doesn't return an error indicator. But it means that if a destructor calls something that returns an error, there's nowhere to pass the error on -- and that's what Tim was referring to. As he said, don't try to think about it; there's code in place that does the right thing for __del__. --Guido van Rossum (home page: http://www.python.org/~guido/) From david_j_dawkins at spamless.hotmail.com Thu Dec 13 07:22:17 2001 From: david_j_dawkins at spamless.hotmail.com (David Dawkins) Date: Thu, 13 Dec 2001 12:22:17 -0000 Subject: Calling member functions? References: Message-ID: "Oleg Broytmann" wrote in message news:mailman.1008243437.6415.python-list at python.org... > On Thu, Dec 13, 2001 at 11:20:52AM -0000, David Dawkins wrote: > > class Handler: > > def Callback(self): > > print "Callback called" > > > > class Notifier: > > > > def __init__(self, object, method): > > self.m_object = object > > self.m_method = method > > > > def notify(self): > > ## Now what?? > > self.m_method(self.m_object) ## naive attempt > > ^^^^^^^^ You call a method with one argument, but the > Callback method does not accept any arguments. but then how does Handler.Callback receive its own "self" value? In this call, "self" is an instance of Notifier. Handler.Callback must receive an instance of Handler, which is stored in self.m_object. > > > h = Handler() > > n = Notifier( h, h.Callback ) > > h.notify() # I want this to do h.Callback() in effect > > h.notify()? You certainly meant n.notify()! Other than that you naive > attempt is pretty close! You're right, I made a typo as I created the example for this posting. > > Oleg. > -- > Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru > Programmers don't die, they just GOSUB without RETURN. > From Tom.Karas at htp-tel.de Sun Dec 30 12:34:32 2001 From: Tom.Karas at htp-tel.de (Tom Karas) Date: Sun, 30 Dec 2001 18:34:32 +0100 Subject: verben online Message-ID: <3C2F5028.50134C31@htp-tel.de> Hallo Data, evtl. was f?r dich ? http://csgrs6k1.uwaterloo.ca/~dmg/lando/verbos/con-jugador.html cu -- The early bird catches the worm. If you want something else for breakfast, get up later. From paul at boddie.net Tue Dec 4 05:39:19 2001 From: paul at boddie.net (Paul Boddie) Date: 4 Dec 2001 02:39:19 -0800 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BD39F.D43D4FF7@mega-nerd.com> Message-ID: <23891c90.0112040239.72e92f5@posting.google.com> Steve Lamb wrote in message news:... > On Mon, 03 Dec 2001 19:34:25 GMT, Erik de Castro Lopo > wrote: > > How hard is it to find an editor that treats tabs correctly and allows > > the tab width to be set to something other than 8? > > Quite easy, which is the problem. Or are you ignoring my rather basic but > not uncommon example of code which gets messed up when people are able to > modify indention levels. If you have a file which uses only "hard tabs" for indentation, and someone then modifies their indentation level in an editor which supports "hard tabs", and that person then uses "hard tabs" to indent code in that file, then there isn't a problem. If, on the other hand, someone loads the file into such an editor and starts slapping the space bar to indent code, then you do have a problem. One might ask who caused that problem but, for the sake of objectivity, it's much better to discuss what kind of procedures you have around the development of your code to prevent this from happening. Even if it does sound extreme, rejecting files with "hard tabs" in it does constitute a solution, and there are ways that people can still choose their indentation style within this framework. If you can't handle such issues, yet have the time or inclination to flame others about what you perceive to be the cause of such issues, then I suggest you redirect your energy towards investigating those issues and possible solutions more closely, if only because "tabs vs. spaces" isn't the only pitfall you're going to encounter when dealing with source code in a multi-developer environment. Paul From daves_spam_dodging_account at yahoo.com Mon Dec 10 11:10:44 2001 From: daves_spam_dodging_account at yahoo.com (David Brady) Date: Mon, 10 Dec 2001 08:10:44 -0800 (PST) Subject: Date manipulation in Python Message-ID: <20011210161044.45386.qmail@web21102.mail.yahoo.com> Hello, Firstoff, thanks to all the great answers I keep getting on this list. I hope I'm not annoying everyone... :-) I am writing a tool that prints calendar/planner pages for me. I know how to get today's date and day of the week from strftime and localtime... but I'd like to be able to move around in the date and still be able to print out the correct calendar. For example, if today were Saturday, December 1st, I'd like to be able to show the week from Monday, November 26th through Sunday, December 30th. My initial impulse is to figure out which time format returns epoch seconds, and then add and subtract 86,400 seconds per day to move around in the date. But somehow I also think that "Guido has thoughtfully shot me in the foot years ago." :-) Oh, one last thing. A coworker *also* has a similar need, only he needs to go back to exactly midnight of a certain day of the week, and get the epoch seconds to return a hardcoded timestamp. Is there a good, Python way to do this? ...of course there is. It just may not be written yet. If it is, would someone share? Thanks! -dB ===== David Brady daves_spam_dodging_account at yahoo.com I'm feeling very surreal today... or *AM* I? __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com From nospam at bigfoot.com Tue Dec 18 15:58:22 2001 From: nospam at bigfoot.com (Gillou) Date: Tue, 18 Dec 2001 21:58:22 +0100 Subject: Newbie Wondering About Database Support? References: Message-ID: <9voa90$21ir$1@norfair.nerim.net> Google for "mxODBC" package. Runs immediately under windows with any valid dsn (SQL*Server ones too of course) It's free for personal use. --Gillou "Richard Kessler" a ?crit dans le message news: u1v8qtaje19rd2 at corp.supernews.com... > I have recently discovered Python and am excited about the possibility of > developing with the language. Unfortunately, I develop database centric > applications, MS SQL Server, etc. and I do not see much talk about Python and > access to databases. Am I missing something or is Python not intended for that > purpose. I would love to replace programs currently in VB with Python, but > they must be able to access databases. > > Thanks in advance. > > Richard > From jdhunter at nitace.bsd.uchicago.edu Sat Dec 8 13:26:11 2001 From: jdhunter at nitace.bsd.uchicago.edu (John Hunter) Date: Sat, 08 Dec 2001 12:26:11 -0600 Subject: string conversion and formatters References: Message-ID: >>>>> "Spiffy" == Spiffy writes: Spiffy> Doh! Wow, you guys are the best...the BEST!! Thanks for Spiffy> your help. What a great community thang Python's got going Spiffy> here. Hopefully, I will be able to contibute in a Spiffy> meaningful way someday... Here's my re-write and ...IT Spiffy> WORKS NOW!! #Decimal/Hex Convertor Since you're into learning python and converting numbers, why don't you use a regular expression to detect whether the input string is decimal, hex or octal, and then spit out the conversions to the other two. 0xff looks like hex 064 looks like octal (leading '0') 92 looks like decimal Have fun, John Hunter From laurent.pointal at laposte.net Sat Dec 1 17:20:16 2001 From: laurent.pointal at laposte.net (Laurent Pointal) Date: 01 Dec 2001 22:20:16 GMT Subject: Let's make Python really strict about indentation References: <3C087F11.4030706@post.harvard.edu> Message-ID: Courageous wrote in news:va8i0ugph8cvq8ml7q87h9aqj3e1hlq1u3 at 4ax.com: > While I am sure most people understood what you meant, to be clear, > you must have certainly meant that your editor "replaces a tab, when > struck, with enough spaces to get to the next tab stop." Yes. A+ Laurent. From greg at cosc.canterbury.ac.nz Thu Dec 6 18:24:43 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Fri, 07 Dec 2001 12:24:43 +1300 Subject: Multi-isinstance idiom (Re: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)) References: <3C0EAEBF.61858076@cosc.canterbury.ac.nz> Message-ID: <3C0FFE3B.7B97D6C1@cosc.canterbury.ac.nz> "Mike C. Fletcher" wrote: > > That doesn't seem to keep the semantics, it only works if the tested > class is an actual sub-class of your combination class B****r, you're right! I withdraw the suggestion. There was talk a while back of extending isinstance() to take a tuple of classes as well as just a single class. Something like that seems called for here. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From keyton at weissinger.org Fri Dec 7 06:40:52 2001 From: keyton at weissinger.org (A. Keyton Weissinger) Date: Fri, 7 Dec 2001 06:40:52 -0500 Subject: Oracle Access In-Reply-To: <200112071045.fB7Aj5ua023654@ratthing-b246.strakt.com> Message-ID: What is the best module out there for running queries (both DDL and DML) against an Oracle 8i database? Keyton From munitalp at gmx.de Tue Dec 4 17:49:21 2001 From: munitalp at gmx.de (Frank Lohfelt) Date: Tue, 4 Dec 2001 23:49:21 +0100 Subject: german documentation Message-ID: <9ujjvp$918ch$1@ID-19768.news.dfncis.de> Hello, i'm search the Python documentation translatet to german to download and read offline or other Books and guids in german for free download. thx From clpy at snakefarm.org Mon Dec 10 09:48:22 2001 From: clpy at snakefarm.org (Carsten Gaebler) Date: Mon, 10 Dec 2001 15:48:22 +0100 Subject: Can't catch SIGUSR1 Message-ID: <3C14CB36.F857A0E6@snakefarm.org> Hi there, I'm experiencing a strange problem with this short test script which is supposed to catch a SIGUSR1: #! /usr/bin/python import os, signal got_signal = 0 def signal_handler(signo, frame): global got_signal got_signal = 1 signal.signal(signal.SIGUSR1, signal_handler) os.kill(os.getpid(), signal.SIGUSR1) print got_signal Obviously it should always print '1', which it does on my desktop machine (Linux kernel 2.2.14). But if I run it on a different machine (kernel 2.2.19) it prints '0'. This problem applies to SIGUSR1 only, SIGINT, SIGTERM, SIGUSR2 work fine. Any ideas? Regards Carsten. -- 'In iteger arithetric divsion is no the oposite of multiplication.' -- scenes from comp.lang.python From allanwind at mediaone.net Wed Dec 12 08:59:21 2001 From: allanwind at mediaone.net (Allan M. Wind) Date: Wed, 12 Dec 2001 08:59:21 -0500 Subject: mod_python vs mod_snake In-Reply-To: References: Message-ID: <20011212135921.GA3005@digit-safe.dyndns.org> On 2001-12-12 11:28:10, Xavier Defrang wrote: > Now the question is should I use mod_python or mod_snake? Both have pros > and cons... mod_python looks more mature, more documented and has a > much simpler architecture than mod_snake. There is also PyApache. Suggest you spend a little time with each and see which you like more. mod_snake is a "thinner" layer on top of apache's module interface than mod_python which more resemble mod_perl. PyApache is "just" a cgi accelerator unlike the other two which allows you to plug into apache's handlers (for instance, you would want probably want to plug into the access handler if you want to do more than basic authentication). I like mod_snake more (in part because it claims support for Apache 2.x), but you might find that there are more people using mod_python (e.g. more community knowledge / support). PyApache would also satisfy your need from how you describe your need and seem to most mature. /Allan -- Allan M. Wind email: allanwind at mediaone.net P.O. Box 2022 finger: awind at digit-safe.dyndns.org (GPG/PGP) Woburn, MA 01888-0022 USA -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 240 bytes Desc: not available URL: From brueckd at tbye.com Thu Dec 6 15:00:51 2001 From: brueckd at tbye.com (brueckd at tbye.com) Date: Thu, 6 Dec 2001 12:00:51 -0800 (PST) Subject: getting the name of a variable In-Reply-To: Message-ID: On 6 Dec 2001, Sandy Norton wrote: > When I'm debugging I'm always sticking stuff like "print 'x:', x" in > my code. So is there a handy function that will print a variable name > and value such that: > > >>> def print_var_name_and_value(var): > "prints variable name : value" > > > >>> variable = 'me var' > >>> print_var_name_and_value(variable) > variable : me var Hi Sandy, Others will probably tell you why a Python value doesn't know which variables reference it, but I think all you really want is a quick-and-dirty way to generate that print statement, right? What editor are you using? Many editors have support for macros, and for binding a macro to a keypress, so it should be pretty easy to have your editor do this for you, ie - you type the variable name, hit a key, and the editor replaces it with the print statement that includes the variable name and the value it references. If this is really all you need, let us know what editor you're using and I'm sure someone here will be able to help you write a macro to do that for you. -Dave From jason at jorendorff.com Mon Dec 10 18:57:23 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Mon, 10 Dec 2001 17:57:23 -0600 Subject: client/server chat program In-Reply-To: Message-ID: "neuromorphus" wrote: > The client program continuously asks for 'raw_input' from the user,and > then sends the msg to the server to be broadcasted. However, I can't > output messages to the terminal/console, if the client program is > waiting for input. This question is common -- and rich with implications. The best way to proceed is to read a few chapters of Stevens' excellent book, "Advanced Programming in the UNIX Environment". Many deep Unix secrets and aha! moments await. http://www.kohala.com/start/apue.html The answer, in summary: * Use select.select() to wait for input. Provide the list [sys.stdin, mysocket] to select. This is Unix-specific. * When select tells you that there's input waiting on stdin, use os.read(sys.stdin.fileno(), 1000) to get it. Alternatively, you could use 2 threads, one for input and one for output. Either way, the output will typically stomp all over what the user is currently typing. Everything will work right, but the display will be confusing. (I hope it's clear what I mean by this.) Curing that won't be easy. You'll have to look at either the "termios" and "tty" modules; or the "curses" module. Both are Unix-only. "curses" is quite flexible. It lets you put output wherever you like on the console, and it provides color. -- Jason Orendorff http://www.jorendorff.com/ From pobrien at orbtech.com Mon Dec 3 18:02:45 2001 From: pobrien at orbtech.com (Patrick K. O'Brien) Date: Mon, 03 Dec 2001 23:02:45 GMT Subject: Difference between 'import' and 'from ... import' References: Message-ID: As far as I know, the only thing that could have created an __init__.py file is you. Doing a "from ... import" wouldn't. Just FYI. Perhaps you copied one over? Or got it some other way? Frankly, I'm not sure why there *isn't* one by default. You're very welcome. -- Patrick K. O'Brien Orbtech.com - Your Source For Python Development Services "Andy Todd" wrote in message news:Xns916D6079FB498andytoddspamfreeyaho at 203.109.250.24... [snip] > Certainly does, that nailed it. I must have created an __init__.py > inadvertently by using 'from ... import'. By removing the file I can > 'import gadfly'. Strange error though. > > You are a legend. Thanks very much. > > Regards, > Andy > -- > Content free posts a speciality > From grey at despair.dmiyu.org Tue Dec 4 10:42:06 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Tue, 04 Dec 2001 15:42:06 -0000 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <23891c90.0112040300.77f64f8e@posting.google.com> Message-ID: On 4 Dec 2001 03:00:16 -0800, Paul Boddie wrote: > Steve Lamb wrote in message news:... >> On Sun, 2 Dec 2001 20:13:37 -0600, Jeff Hinrichs wrote: >> > my 0.02$US: >> > Actually, spaces are the problems not tabs. A tab is a tab, where is >> > indenting by spaces....hmm. >> >> No, a tab isn't a tab. > It's hard to know what you're getting at here. Is this the ultimate > form of denial? :-) Only because you're being willfully ignorant. > The Tab key (or whatever symbol is used on your keyboard to denote it) > is commonly used to move the cursor to a particular location, whether > it be the next field in a form, or whether it be to a particular > horizontal position in a human-readable textual document. Neither of which applies. We are talking about a tab character inside a piece of code and you know it. >> With spaces that always comes out the same. With tabs set to different >> lengths you get different results. The only constant when it comes to >> indention is a space. A space is a space. A tab is not constant and >> therefore should NOT be used for indention. Ever. > Indentation isn't at all important with respect to the correct > interpretation of the above statement (which is the real issue here), > but I've long suspected that you don't have a real argument to bring > to the table. That is beacuse you are applying what a tab represents in two different and unrelated fields to this one. When you stop being willfully ignorant you'll see my argument is quite valid. > You're wasting your time making code "art" just as I could be wasting > my time explaining to you what a tab is. In short, we're both wasting > our time. Only one of us is, and that is me. I am well aware of what a tab is in word processing. However, this isn't microsoft.public.applications.word (or whatever it is). Nor is this comp.sys.database.sql.forms. This is comp.lang.python. Your definitions of tab addressed human readable documents and form entry. Neither of which have any application here. Code is, first and foremost, a machine parsed document which also needs to be somewhat human readable. In that context tab takes on a whole different meaning. Doubly so in Python since indention matters. When you get on the same page as the rest of us my argument will make sense. Until then might I suggest returning to to the word processing and form entry newsgroups as maybe discussing a programming language is beyond your limited experience. OR... are you going to admit that you were purposely misrepresenting what you fully knew what a tab represented in this context just to get a rise out of me? -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From sholden at holdenweb.com Wed Dec 19 09:41:36 2001 From: sholden at holdenweb.com (Steve Holden) Date: Wed, 19 Dec 2001 09:41:36 -0500 Subject: my unanswered question: copy clipboard to a widget References: Message-ID: "bup_schaefer" wrote in message news:mailman.1008760943.8601.python-list at python.org... I have posted this two times, but I hve no answer yet: Hello, with "clipboard_append" (Tkinter) I can copy the text content of a widget in the clipboard. My question: How is it possible to copy (by the program,not with ctrl-V)the content of the clipboard to a widget? Many thanks for your answer, Bruno Sch?fer So now you have a reply, but no answer. Sorry, this isn't a deterministic "we will fix your problem" group. What have you tried? What searches have you done? Why do you keep asking the same question? regards Steve -- http://www.holdenweb.com/ From roy at panix.com Sun Dec 23 14:20:12 2001 From: roy at panix.com (Roy Smith) Date: Sun, 23 Dec 2001 14:20:12 -0500 Subject: vi or emacs for editing Python on Linux? References: Message-ID: Fernando Perez wrote: > The only problem I now have is that even though I fly in Xemacs, I can't > do anything in a 'raw' emacs, I need *my* customizations :) This is very true. I work in a mostly vi shop, but one other guy and myself are die-hard emacs fans. Not only can we not edit in each other's login sessions (because our emacs key bindings are different), we almost can't even edit on each other's keyboards, because some of the keys are in different places! Every once in a while one of us will observe the other doing somethink cool in emacs and say, "how'd you do that?". As often as not, the answer will be a slightly puzzled look, followed by pantomiming typing the key sequence in mid-air :-) I've been doing it so long, my fingers know how to do somethings that I have to conciously have to think about to figure out what the actual keystrokes are. About all the vi I really know is :q!. If I'm someplace where there's no emacs, I survive on ed until I can get emacs up and running. From tim.one at home.com Sat Dec 15 13:51:32 2001 From: tim.one at home.com (Tim Peters) Date: Sat, 15 Dec 2001 13:51:32 -0500 Subject: RELEASED Python 2.2 release candidate 1 is out! In-Reply-To: Message-ID: [Robin Becker] > just looking at http://www.python.org/2.2/ I see only references to > Python 2.2b2! Is this the same as 2.2c1 or is the page lagging behind? It says 2.2c1 for me -- try clearing your browser cache and reloading the page? From ykingma at accessforall.nl Wed Dec 5 09:24:44 2001 From: ykingma at accessforall.nl (Ype Kingma) Date: Wed, 05 Dec 2001 15:24:44 +0100 Subject: Jython thread safety References: <3C0E019E.BF5179C7@lucent.com> <3C0E1C11.1080300@gmx.net> Message-ID: <3C0E2E29.F3282764@accessforall.nl> Andreas Ulbrich wrote: > > Eoin Kelly wrote: > > > > > > > Hello, > > > > Can anyone please tell me of references to information regarding thread > > safety issues with jython > > > > Thank in adv, > > Eoin > > > > > > Jython safety is pretty good. I never got hurt using jython. :-) As far > as security is concerned, well jython is 100% pure Java. Everything that > applies to Java is valid for Jython too. Or do you mean the use of thread synchronisation mechanisms to obtain thread safety? In that case this might be interesting to know: - jython threads are java threads, you can set scheduling priorities for them using java's thread facilities, - jython has no central interpreter lock like cpython, it uses java's synchronisation mechanisms instead. If you have more than one processor, jython will allow you to use all of them. - the standard thread synchronisation classes Queue, Lock, Event, Semaphore etc. are part of the jython distribution, - when you need faster synchronisation, you can use Doug Lea's util.concurrent package for java as it is: http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html It's interface is remarkably similar to the python standard synchronisation classes, and it has a lot more to offer. Have fun, Ype From sholden at holdenweb.com Fri Dec 21 13:18:11 2001 From: sholden at holdenweb.com (Steve Holden) Date: Fri, 21 Dec 2001 13:18:11 -0500 Subject: Importing modules for cgi's References: <3C218270.C331131E@yahoo.com> Message-ID: <_3LU7.34502$pc4.27558@atlpnn01.usenetserver.com> "Daniel" wrote ... > Hi, > I installed a database api module in python and added the path to my > PYTHONPATH. In order for my cgi to work, though, I have to invoke my cgi > from a shell script that first sets the PYTHONPATH so the module will be > foud when the cgi runs. Is there a simpler way? I'd prefer not having to > have the shell script. Is there a way for python to always know about my > module without using PYTHONPATH? > > Another thing I tried that doesn't work is modifying sys.path at the > start of the cgi script. It seems that this has to be set (via the shell > script) before the cgi script starts. > Modifying sys.path *should* work. Are you sure you dodn't make a mistake? Try sending the code in your posting to see if someone can spot a mistake... regards Steve From pcc at ecet.vtc.edu Sun Dec 30 15:10:31 2001 From: pcc at ecet.vtc.edu (Peter) Date: Sun, 30 Dec 2001 15:10:31 -0500 Subject: REPOST: Manipulating Win32 attributes; newbie question. Message-ID: <4$--$$_----__%-$$$@news.noc.cabal.int> Hello! I'm new to Python although I have a fair amount of experience with other languages (C++, Java, some Perl). I'm working on the Windows platform with Python 2.0. I have Pythonwin installed. My problem is that I need to manipulate some Win32 specific file attributes. In particular, I need to temporarly turn off the read-only attribute on a directory. In C I could use the Win32 API functions GetFileAttributes() and SetFileAttributes() to do this. I'm not sure how to get the job done with Python. I looked around in both the generic and Pythonwin documentation but I didn't see anything that addressed this issue. TIA Peter ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!nnxp1.twtelecom.net!newsfeed.cs.wisc.edu!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Peter Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:17:42 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774094 27193 211.57.49.2 (31 Dec 2001 04:48:14 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:48:14 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From thomas.heller at ion-tof.com Thu Dec 20 08:46:52 2001 From: thomas.heller at ion-tof.com (Thomas Heller) Date: Thu, 20 Dec 2001 14:46:52 +0100 Subject: ciphon 0.3.4 References: Message-ID: <9vsq4f$hk6cn$1@ID-59885.news.dfncis.de> "Suchandra Thapa" wrote in message news:slrna1utlm.53k.ssthapa at hepcat.telocity.com... > > I've uploaded a new version of ciphon to sourceforge.net and to > anonymous ftp at ftp.community.tummy.com. The recent changes to ciphon > are: > > Ciphon now supports distutils so it can be updated from within itself. > Packages that ciphon installs are now recorded so that they won't have to > be downloaded again if they are a dependency. > RPM should now work for modules that support the bdist_rpm option of distutils > I played a little bit with ciphon last night. It doesn't run here, I'm using windows. Several questions: Can anyone suggest a tar.exe for win32 which can handle the 'tar zxvf ' command line? How do I upload a package? Can ciphon do this? It seems you only support gzip'd tar files or rpms. Are other formats planned? What about binary distributions? >From reading the source I got the impression that ciphon mostly spawns external utilities. Can/should it be extended to use Python modules (gzip, zipfile,...)? Regards, Thomas From hgg9140 at seanet.com Sat Dec 29 20:16:28 2001 From: hgg9140 at seanet.com (Harry George) Date: 29 Dec 2001 17:16:28 -0800 Subject: REPOST: How to do "ANN:"? Message-ID: <6$--$$_----___-_$$@news.noc.cabal.int> A couple of times I've tried to annouce package upgrades using "ANN:" entries to c.l.p and c.l.p.a, but nothing shows up. Is there a magic decoder ring? Most recently, updates for mkpythonproj, pdx, and pyperlish. -- Harry George hgg9140 at seanet.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Harry George Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:54:38 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774571 27193 211.57.49.2 (31 Dec 2001 04:56:11 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:56:11 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From eppstein at ics.uci.edu Mon Dec 3 22:03:57 2001 From: eppstein at ics.uci.edu (David Eppstein) Date: Mon, 03 Dec 2001 19:03:57 -0800 Subject: more fun with PEP 276 References: Message-ID: In article , James_Althoff at i2.com wrote: > Let's start with Greg Ewing's recent suggestion of writing for-loops as: > > for -5 <= i <= 5: > print i > > The nice thing about the above is the apparent clarity of intent. And the > fact that all combinations of open and closed intervals are handled nicely. > On the down side we observe that this construct requires new syntax, that > it doesn't work outside of the context of a for-loop (in fact, it is a > relational expression outside the context of a for-loop), and that there is > no apparent mechanism for having a step size other than 1 (or -1). But there isn't a huge distinction between "works only in a for loop" and "produces general-purpose iterators" because of list comprehensions: L = [i for -5 <= i <= 5] -- David Eppstein UC Irvine Dept. of Information & Computer Science eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/ From jwbaxter at spamcop.net Sat Dec 29 00:36:06 2001 From: jwbaxter at spamcop.net (John W. Baxter) Date: Fri, 28 Dec 2001 21:36:06 -0800 Subject: REPOST: Re: Is this a bug? References: <33e9b770.0112281857.563a36d4@posting.google.com> Message-ID: <3$--$$_----_-$%_$$@news.noc.cabal.int> In article <33e9b770.0112281857.563a36d4 at posting.google.com>, Gilbert wrote: > Hi! > > I am wondering if the following results below imply any bug in Python > 2.2 or 2.1? > When I try to use float numbers, python 2.2 and 2.1.1 shows a little > bit different results (I think it is incorrect) from what I enter. > But python 1.5.2 seems to be okay? What is wrong? > > If you know why and how they are different, please let me know. > > Thanks! > > ----------------------------------- > > Python 2.2 (#1, Dec 23 2001, 09:30:32) > [GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-98)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> 653.34 > 653.34000000000003 > >>> > > ----------------------------------- > > Python 1.5.2 (#1, Oct 13 2001, 09:06:03) [GCC 2.96 20000731 (Red Hat > Linux 7.1 2 on linux-i386 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> 653.34 > 653.34 > >>> Python 1.5.2 is lying to you (by rounding off). Later versions are telling you the unpleasant truth. 653.34 doesn't exist in the representation used. [653.00, 653.25, 653.50, and 653.75 do exist...the other 96 are approximated.] YAPDFP --John ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.tele.dk!small.news.tele.dk!134.75.7.11!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "John W. Baxter" Newsgroups: comp.lang.python Subject: cmsg cancel <281220012136066403%jwbaxter at spamcop.net> Control: cancel <281220012136066403%jwbaxter at spamcop.net> Date: Mon, 31 Dec 2001 01:33:21 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774865 27193 211.57.49.2 (31 Dec 2001 05:01:05 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:01:05 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From pinard at iro.umontreal.ca Sun Dec 2 11:14:21 2001 From: pinard at iro.umontreal.ca (=?iso-8859-1?q?Fran=E7ois?= Pinard) Date: 02 Dec 2001 11:14:21 -0500 Subject: InterScan NT Alert In-Reply-To: References: Message-ID: [Daniel Berlin] > On Sat, 1 Dec 2001 virus_catcher at oceanic.com wrote: > > Receiver, AntiVirus Catcher has detected virus(es) in the e-mail > > attachment. The Sender has been notified. > > I surely understand how you feel, and this is indeed annoying. Yet, python-list should ideally not convey neither viruses nor spam. Of course, this is more easily said than done. But we have no choice, as list administrators, to learn how to act with those phenomenon. For email directly addressed to me, I manage with spam, and even with viruses (not that I care much about viruses, but some of my friends use my setup, and I filter viruses so they also do, as a service to them :-). However, I would expect mailing lists to do better filtering for their subscribers. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From dieter at handshake.de Wed Dec 5 17:14:56 2001 From: dieter at handshake.de (Dieter Maurer) Date: 05 Dec 2001 23:14:56 +0100 Subject: Baffled by httplib and SSL! References: Message-ID: "Steve Holden" writes on Mon, 3 Dec 2001 22:09:37 -0500: > > ... > > send: 'POST https://www.dotster.com/account/login/login.asp HTTP/1.1\r\n' > > send: 'Host: www.dotster.com:443\r\n' > > .... > Since I am not yet using this library I will limit my observation to the > fact that the scheme (https:) and the host (//www.dotster.com) are normally > implied by a) the connection port (443 by default) and b) the connected > host. I would therefore have expected the first line to be > > send: 'POST /account/login/login.asp HTTP/1.1\r\n' > > but I don't know if this is what's causing your problem. As of HTTP 1.1, the request locator should contain the full URI, including the host part and (I think) the protocol part. Dieter From nospam at mega-nerd.com Fri Dec 7 16:36:42 2001 From: nospam at mega-nerd.com (Erik de Castro Lopo) Date: Fri, 07 Dec 2001 21:36:42 GMT Subject: Python classes for reading/writing/parsing MIDI files References: <3C0F63F0.20D2B25@alum.mit.edu> <7876a8ea.0112061455.6685b313@posting.google.com> <3C1030AF.5103FE40@alum.mit.edu> Message-ID: <3C113669.9279C7F7@mega-nerd.com> Will Ware wrote: > > It looks like midithing is the closest to what I've been trying to do. My > only reservation about adopting it is that I am a lamebrain Red Hat user > who is still stuck on Python 1.5.2 because the RPM system whines about > breaking other stuff if I try to upgrade, and midithing needs a more > current version of Python. What you can do is install python 2 from source code and keep the version Redhat insists on. The existing python version is in /usr/bin and the source installed version will be placed in /usr/local/bin . The other option is trying a better Linux distribution like Debian which currently has bother 1.5.2 and 2.1 available. Cheers, Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam at mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ The government everybody loves to abuse sues the company everybody loves to hate. Throw in a bunch of faceless lawyers cross-examining techies [with] all the charisma of a video driver and you've got a spectacle of thoroughly miniscule proportions. From sab at NOSPAM.freeuk.com Wed Dec 26 20:24:16 2001 From: sab at NOSPAM.freeuk.com (G. Willoughby) Date: Thu, 27 Dec 2001 01:24:16 -0000 Subject: Newbie question References: Message-ID: Hi Peak Allan, I learned the basics by reading 'Learning Python' from O'reilly's, i found it very helpful. :) I think perhaps it would help to have a little experience in another language too. I am looking forward to reading 'Python on win32' from the same publishers! :) G. Willoughby. "Peak Allan" wrote in message news:mailman.1009150409.8361.python-list at python.org... > I copied this code from one of the tutorials on the > python.org website, but when I tried to run it, I got > an error. > > # Program FileTest > > out_file = open("test.txt", "w") > out_file.write("This crap is going to out file\n") > out_file.close() > > in_file = open("test.txt", "r") > text = in_file.read() > in_file.close() > print text > > bash-2.05$ ./fileTest.py > ./fileTest.py: line 3: syntax error near unexpected > token `open("' > ./fileTest.py: line 3: `out_file = open("test.txt", > "w")' > > Can someone please tell me what I did wrong? > > Also, are the tutorials at python.org a good way to > learn Python? If not, are there any other good online resources? > > __________________________________________________ > Do You Yahoo!? > Send your FREE holiday greetings online! > http://greetings.yahoo.com > From loewis at informatik.hu-berlin.de Tue Dec 4 09:59:36 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 04 Dec 2001 15:59:36 +0100 Subject: minidom References: <9uhr26$nfs$1@newsg1.svr.pol.co.uk> <3C0C7DD5.AC50A8CB@engcorp.com> Message-ID: Peter Hansen writes: > For one, you should probably start your XML document with > or it won't be valid XML (but that's > not necessary for this case.) That is not true. Presence of the XML declaration is not a validity constraint in XML. > >>> from xml.dom import minidom > >>> doc = minidom.parseString(open('test.xml').read()) > >>> doc.getElementsByTagName('DESCRIPTION')[0].childNodes[0].nodeValue > u'EngineStart Leak' Actually, obtaining the text by looking at the first child is unreliable: The first child may be a comment, and the text may be split over several nodes, unless .normalize() was called (in which case the text can still be split over several notes, in case of comments, CDATA sections, or processing instructions). Regards, Martin From emile at fenx.com Sun Dec 30 14:00:08 2001 From: emile at fenx.com (Emile van Sebille) Date: Sun, 30 Dec 2001 11:00:08 -0800 Subject: REPOST: Origin of ly y'rs signature style Message-ID: <8$--$$_----___%%%$@news.noc.cabal.int> I know I've read a good article or post on the origin and adoption of the "xx-xx-xx ly y'rs" signoffs brought to the python group by Tim Peters. After some searching this morning I couldn't relocate that article/post. Does anyone have a link to it? Searchin-for-love-in-all-the-wrong-places ly y'rs, -- Emile van Sebille emile at fenx.com --------- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Emile van Sebille" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:43:57 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774117 27193 211.57.49.2 (31 Dec 2001 04:48:37 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:48:37 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jkraska at san.rr.com Thu Dec 6 13:43:03 2001 From: jkraska at san.rr.com (Courageous) Date: Thu, 06 Dec 2001 18:43:03 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <3C0C8330.79D0E598@mega-nerd.com> <23891c90.0112050750.2bed3aa8@posting.google.com> <23891c90.0112060419.7a9f9185@posting.google.com> Message-ID: <9hev0uku0g38ng2a9tnd4bu67ilhjfitif@4ax.com> >I can actually understand why one would want to do this, but in my >tab-only private universe I move onto the next line after the opening >bracket: > > log.Fatal( > "Unexpected RETURN...\n" > "This is almost certainly..." Sure. I do this if the other approach doesn't work. The other approach is used to limit vertical use of space in the file, which you can probably guess from my other examples is something I often try to do. But note that if you run out of horizontal space, you'll have to go down a line as you did, which I think is perfectly reasonable. My problem is with rules that disallow me the flexibility of doing what I did. My problem is NOT with rules that allow you the flexibility of doing what YOU did. >This is similar to your first case. Personally, I'm not a huge fan of >doing this kind of thing. I often do it with single line cases in C, C++, and Java, for example. I merely like to limit vertical space in some situations, if the simplicity of the situation allows it. C// From uche.ogbuji at fourthought.com Wed Dec 19 02:48:44 2001 From: uche.ogbuji at fourthought.com (Uche Ogbuji) Date: Wed, 19 Dec 2001 00:48:44 -0700 Subject: [XML-SIG] Pyana 0.2.0 released References: <006601c18829$789ff4b0$445d4540@Dell2> Message-ID: <3C20465C.AC888ECC@fourthought.com> Brian Quinlan wrote: > I tried to install it but I got a lot of compilation errors in > "Ft/Xml/src/domlette/xmlcharhelp.h" (I can send you the error log if > you'd like). Please do. What platform are you running? > But I notice that you archive your CVS tree. Could you point me to a > shapshot that includes your optimizations but compiles cleanly on > Windows? Also, if there is a more optimal code fragment to execute the > 4suite test, please send that as well. Jeremy is on this list, I'm not sure about Roxane. Are either of you able to compile 4Suite on Windows? I know Roxane was able to a few weeks ago, but this was before the merges from the branches that had most of the optimization work (cDomlette completion from Mike and me, XSLT engine core optimizations from Jeremy). Also, Mike Brown has made recent conformance fixes. Our current goal/hope is to have a prerelease out tomorrow, and a final package on Friday. -- Uche Ogbuji Principal Consultant uche.ogbuji at fourthought.com +1 303 583 9900 x 101 Fourthought, Inc. http://Fourthought.com 4735 East Walnut St, Boulder, CO 80301-2537, USA XML strategy, XML tools (http://4Suite.org), knowledge management From timr at probo.com Tue Dec 11 02:07:43 2001 From: timr at probo.com (Tim Roberts) Date: Mon, 10 Dec 2001 23:07:43 -0800 Subject: smtplib References: <_YUQ7.24843$ER5.305743@rwcrnsc52> Message-ID: "Senthil Kumar" wrote: >I compiled and installed python 2.1.1 in my linux server, I tried to send an >e-mail using python. I wrote a script to import smptlib and send the test >message, I get the following error > >-- > import smtplib >Traceback (most recent call last): > File "", line 1, in ? > File "/usr/local/lib/python2.1/smtplib.py", line 42, in ? > import socket > File "/usr/local/lib/python2.1/socket.py", line 41, in ? > from _socket import * >ImportError: No module named _socket > >I am not sure if this is bug or or I missed something during my python >compilation. I encountered the same problem when building Python 2.1.1 on Linux. For some reason, the installer decided not to build the _socket module. I solved it by uncommenting the _socket line in Modules/Setup and rebuilding. I was never able to chase down the true cause. -- - Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From kevin at cazabon.com Sun Dec 2 12:15:37 2001 From: kevin at cazabon.com (Kevin Cazabon) Date: 2 Dec 2001 09:15:37 -0800 Subject: InterScan NT Alert References: Message-ID: <5a4226f0.0112020915.6b79e1ad@posting.google.com> > The next version will include the text: "Please forward this message to > everyone in your addressbook". :-) Actually, it does that for you automatically. You see, they've learned something from the virus writers too. q:] From fperez528 at yahoo.com Tue Dec 4 11:11:13 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Wed, 05 Dec 2001 15:39:13 +2328 Subject: Suggestion for a change to a standard module - where? Message-ID: <9um7m0$ie9$1@peabody.colorado.edu> Today I needed to make a small change to the rlcompleter module for a project. The change is tiny, fully backwards compatible and gives new useful functionality (specifically, the ability for rlcompleter to work in any namespace the user specifies, not just in __main__). Who/where should I go to suggest incorporating this change in the new release? If anyone is interested, it amounts to adding a constructor to Completer of the form: def __init__(self, namespace = __main__.__dict__): self.namespace = namespace and replacing in the file all __main__.__dict__ by self.namespace. This simple change allows using rlcompleter in contexts where the execution context is restricted (namespace sandboxes), such as those that arise in the standard module code. Code which uses the module in its standard form needs no changes whatsoever. So, who should I talk to? Cheers, f. From gerson.kurz at t-online.de Sat Dec 29 11:16:03 2001 From: gerson.kurz at t-online.de (Gerson Kurz) Date: Sat, 29 Dec 2001 16:16:03 GMT Subject: REPOST: Re: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> Message-ID: <1$--$$_----__$-%%$@news.noc.cabal.int> On Sat, 29 Dec 2001 19:56:48 +0300, Oleg Broytmann wrote: > Ok, let me call you oldfashioned. Errno chcecking is good in local >context: > > file = open(...) > if not file: report_error() > >But is not so easy to pass errno to upper context. To explain what I mean >I am writing a pice of code using exceptions: > >def top(): > try: > upper() > except IOError: > report_error() > >def upper(): > data4 = lower() > process(data4) > >def lower(): > file = open(...) > retunr file.read(4) > >Now please rewrite the code without exceptions, using errno checking. def top(): if not upper(): return report_error("upper failed()") def upper(): data = lower() if data: process(data) return 1 def lower(): file = open(...) if file: return file.read() report_error("lower failed()") So ? After all, C doesn't need it, and I think few C programmers would call this feature the "most missing", or? ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: gerson.kurz at t-online.de (Gerson Kurz) Newsgroups: comp.lang.python Subject: cmsg cancel <3c2deb81.11823921 at news.t-online.de> Control: cancel <3c2deb81.11823921 at news.t-online.de> Date: Mon, 31 Dec 2001 04:35:16 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774671 27193 211.57.49.2 (31 Dec 2001 04:57:51 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:57:51 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jkraska at san.rr.com Thu Dec 27 13:51:19 2001 From: jkraska at san.rr.com (Courageous) Date: Thu, 27 Dec 2001 18:51:19 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <4$--$$_----_%__-%$@news.noc.cabal.int> >I don't want programming to be forcibly OO. In Ruby, can you write >a procedure which isn't part of a class? (Like you can in Python, but >can't in Java). If not, then Ruby is forcing you to hammer square pegs >into round holes. I agree with you in spirit, however I should like to point out that Python's module system puts your functions into a module object, indeed making these functions completely object oriented, except without the added syntactic weight. You have all of the benefits with syntactic brevity at the same time, which would seem to satisfy the Occam's Razor of programming, or at least to me. C// ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.cwix.com!newsfeed.mathworks.com!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Courageous Newsgroups: comp.lang.python Subject: cmsg cancel <3jqm2ukc9ll6mv7f5edd94hcsm7c7j9s50 at 4ax.com> Control: cancel <3jqm2ukc9ll6mv7f5edd94hcsm7c7j9s50 at 4ax.com> Date: Mon, 31 Dec 2001 04:20:08 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775668 27193 211.57.49.2 (31 Dec 2001 05:14:28 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:14:28 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From Tom.Karas at htp-tel.de Sat Dec 29 16:32:30 2001 From: Tom.Karas at htp-tel.de (Tom Karas) Date: Sat, 29 Dec 2001 22:32:30 +0100 Subject: Was that to inpolite? Re: Call for a small program References: <3C2BAEF3.CC34B8DD@htp-tel.de> <3C2E0D55.9EC9B67F@htp-tel.de> Message-ID: <3C2E366E.7D417B41@htp-tel.de> Terry Reedy wrote: > > Was my "Call" to inpolite? > > Sorry, don't remember rest of title or what it was about. The title was: Call for a small program X-posting followup-to comp.lang.python from friday > > This may sound odd, but i would be even willing to pay for a > > solution that would > > fit the basic needs (running on windows and linux and some features) > Willingness to pay is 'odd' only in that it tends to be unusual. Did > you mention this originally? No, i did not. But i am mentioning it now to show that i am serious with that. I have no idea how long someone already skilled in python has to hack to get a solution done, so i have no idea how the price supposed to be. Thanks for your answer. At least now i am sure that at least this posting went right (had some problems with the first one) -- The early bird catches the worm. If you want something else for breakfast, get up later. From logiplexsoftware at earthlink.net Fri Dec 21 16:59:42 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Fri, 21 Dec 2001 13:59:42 -0800 Subject: Python on the desktop In-Reply-To: References: <94e3fce8.0112210053.2568529d@posting.google.com> <3C238618.9F54E5CA@attbi.com> Message-ID: <20011221135942.6a1460ae.logiplexsoftware@earthlink.net> On Fri, 21 Dec 2001 20:32:43 GMT Tim Hammerquist wrote: > I beg to differ. I happen to actually enjoy listening to (exactly 2 of) > Britney's songs... but not as much as I enjoy observing her less vocal > attributes. ;) Hm. Yes, it's sort of like porn - you have to turn the soundtrack off to enjoy it ;-) -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From dyoo at hkn.eecs.berkeley.edu Mon Dec 3 03:37:43 2001 From: dyoo at hkn.eecs.berkeley.edu (Daniel Yoo) Date: Mon, 3 Dec 2001 08:37:43 +0000 (UTC) Subject: Regular expression as dictionary key? References: <3C0B2DE9.5040308@home.com> Message-ID: <9ufdkn$21dk$1@agate.berkeley.edu> Luke wrote: : Let's say you have a dict of words like : words = {"dogs":1,"cats":2} : Let's say I'm given a singular form of a word and want to match it with : plurals still, but words["dog"] will obviously raise a KeyError. : Without doing a linear substring search on every element in words.key(), : is there a way to take advantage of the dict's binary tree layout : properties (e.g. speed) like: : words["dog*"] # where dog* is a Regex : Nonexistant syntax, I know, but you get the idea... I smell a PEP Hmmm... Interesting! Let's see: ### import re from UserDict import UserDict from types import StringType class RegexDict(UserDict): """A dictionary that supports regular expressions to get at a key. Response to a post on c.l.py.""" def __getitem__(self, key): if self.data.has_key(key): return self.data[key] regex = key if isinstance(key, StringType): regex = re.compile(key) for k in self.data.keys(): if regex.search(k): return self.data[k] raise KeyError, key ### Let's see if this works: ### >>> words = RegexDict({'dogs' : 1, "cats" : 2}) >>> words['cat'] ## Normal lookups work 2 >>> words['dog*'] ## And so do regular expressions! 1 >>> words['dog*r'] ## But we can still get KeyErrors. Traceback (most recent call last): File "", line 1, in ? File "/tmp/python-1176RQL", line 17, in __getitem__ KeyError: dog*r ### Hope this helps! From fredrik at pythonware.com Tue Dec 18 17:40:38 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 18 Dec 2001 22:40:38 GMT Subject: /usr/bin/env: python: No such file or directory References: <9vivft$593$1@peabody.colorado.edu> <171220010818339518%jwbaxter@spamcop.net> <9vnvue$m5d$1@peabody.colorado.edu> <3C1F9B6E.19471D84@alcyone.com> Message-ID: Trond Eivind Glomsr?d wrote: > Having the best compiler for a year and a half can hardly be called a > fiasco for us maybe not for you, but it was rather annoying for us Python developers... Python 2.0b2 (#2, Sep 27 2000, 11:40:58) [GCC 2.96 20000731 (Red Hat Linux 7.0)] on linux2 Type "copyright", "credits" or "license" for more information. >>> a = 5 * 5 Traceback (most recent call last): File "", line 1, in ? OverflowError: integer multiplication (next time you release a brand new C compiler, try compiling the latest Python interpreter *before* the release ;-) From sdm7g at Virginia.EDU Thu Dec 6 16:02:20 2001 From: sdm7g at Virginia.EDU (Steven Majewski) Date: Thu, 6 Dec 2001 16:02:20 -0500 (EST) Subject: Calling a generator multiple times In-Reply-To: <200112061113290670.0100F457@mail.rdc1.sdca.home.com> Message-ID: On Thu, 6 Dec 2001, Bruce Eckel wrote: > I'm trying to create a clever way to call a generator multiple > times, but the only thing I've been able to come up with is: > > import random > rgen = random.Random() > def itemGenerator(dummy): > return rgen.choice(['one', 'two', 'three', 'four']) > > print map(itemGenerator, [None]* 25) > > This works, but it requires the 'dummy' argument which seems > inelegant. I'll bet someone has a better idea... Somebody already mentioned list comprehensions. For clarity, I'ld probably define the function without the dummy variable, and then use a lambda expression to add a dummy back again: def itemGenerator(): ... map( lambda dummy: itemGenerator(), [None]*25 ) Another thing is just use random.Random().choice on copies of the items: map( random.Random().choice, [ item-list ]*25 ) or if you need to keep the random generator around for more: rgen = random.Random() map( rgen.choice, [ item-list ]*25 ) or if you're doing this alot, maybe just define your function to take a collection and an optional number: def itemGenerator( collection, n=1 ): if n == 1: return rgen.choice(collection) else: return map( rgen.choice, [collection]*n ) >>> itemGenerator(['one','two','three','four']) 'four' >>> itemGenerator(['one','two','three','four'], 10 ) ['two', 'two', 'four', 'one', 'two', 'four', 'one', 'four', 'four', 'two'] -- Steve Majewski From bsturk at news.rcn.com Mon Dec 3 02:11:27 2001 From: bsturk at news.rcn.com (Brian Sturk) Date: 3 Dec 2001 07:11:27 GMT Subject: pty controlling app Message-ID: I am trying to control a shell and found a few posts with examples of controlling ssh using the pty module and cribbed the code. My issue is I'm unable to get it to execute commands. They just get echo'ed back. I found a post where someone had the same issue but never posted how he got it to work after he figured it out. :( I'm probably missing something very obvious but I've searched everywhere and haven't been able to figure it out. Any help would be greatly appreciated! #!/usr/bin/env python import os, pty, time, signal def remote_ex( sh, arg ): pid, fd = pty.fork() if pid == 0: os.execv( sh, [ sh, arg ] ) else: print ">> 1 sh says %r" % os.read( fd, 1024 ).strip() # time.sleep(2) print ">> 2 sh took %d bytes." % os.write( fd, "ls\n" ) # time.sleep(2) print ">> 3 sh says %r" % os.read( fd, 1024 ).strip() # time.sleep(2) os.kill( pid, signal.SIGKILL ) def main(): sh = "/bin/bash" arg = '--version' remote_ex( sh, arg ) if __name__ == "__main__": main() // outputs // >> 1 sh says 'GNU bash, version 2.05.0(1)-release (i386-slackware-linux-gnu) \r\nCopyright 2000 Free Software Foundation, Inc.' >> 2 sh took 3 bytes. >> 3 sh says 'ls' -- .-----------------------------------------------------,-------. | Brian M. Sturk - http://www.nh.ultranet.com/~bsturk \ C/C++ | .> )\,^a__ |--------------------------| bsturk at nh.ultranet.com | Java | ( _ _)/ /-." ~ | http://www.telengard.com `---------------------------`------| `( )_ )/ | Telengard Technologies Inc. - NT/*nix UI & device drivers | _<_s_<_s '-------------------------------------------------------------' From ajs at ix.netcom.com Mon Dec 24 21:14:10 2001 From: ajs at ix.netcom.com (Arthur Siegel) Date: Mon, 24 Dec 2001 21:14:10 -0500 Subject: [Visualpython-users] New Windows VPython References: <4199579036.1009221926@HYPERON.REM.CMU.EDU> Message-ID: <000901c18ce9$d8537020$a9e1fea9@carol> > You've jumped the gun, but your input is useful nevertheless. I'm not sure how. I am reading your message to say that the copy of Numeric that is downloaded with VPython has been patched. And since I am directing users of PyGeo to VPython, I am directing them to a forked version of Numeric. Which is somehow horrid to me. What am I missing. As to the rest - I should probably keep my peace. I've pissed off enough people and caused myself enough grief in the course of it. But is all quite, quite incredible to me. I think the importance you attach to this issue is monumentally overstated, and overwhelmingly condescending. Now you are further saying that your students can't even be trusted to be able to handle the from __future__ statement all my their little bitty selves. Suffice it to say that am I sure the hell glad I'm not in school anymore. Art From aleax at aleax.it Tue Dec 11 12:42:54 2001 From: aleax at aleax.it (Alex Martelli) Date: Tue, 11 Dec 2001 18:42:54 +0100 Subject: lost interest? References: <20011208001123.A5989@casa.parque> <3C14FEBD.AD52B516@attbi.com> <3dzo4pputt.fsf@ute.mems-exchange.org> Message-ID: <9v5gj00aab@enews4.newsguy.com> "Andrew Kuchling" wrote in message news:3dzo4pputt.fsf at ute.mems-exchange.org... > Skip Montanaro writes: > > CPAN is marvelous. The way the Perl and Python communities operate, it > > fills a niche perfectly in the Perl world, but I think would be a bit of a > > solution looking for a problem in the Python world. > > Also, those of us using Debian already have dependency information for > Python modules through apt. It's not much fun to do a lot of work > implementing a parallel Python solution that will still be less > functional, as apt will also handle dependencies on non-Python > software or libraries, a difficult task for a Python-only system. > Switching to Debian has neatly killed my urge to work on a catalog. Funny, the reverse effect to what switching to Mandrake had for me (see mention of urpmi in my previous post on this thread). Same or similar causes, opposite effects!-) Maybe it's about "being cross-platform in one's bones"...:-). Alex From greg at cosc.canterbury.ac.nz Thu Dec 6 18:16:30 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Fri, 07 Dec 2001 12:16:30 +1300 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <23891c90.0112040300.77f64f8e@posting.google.com> <23891c90.0112050738.60ed8b25@posting.google.com> <3C0EE13A.302F1857@engcorp.com> Message-ID: <3C0FFC4E.4267C912@cosc.canterbury.ac.nz> Peter Hansen wrote: > > My god! Haven't you considered the environmental impact of having > to dispose of all those tabs?! Where will we put them all? Obviously we need to bring the technology of genetic engineering to bear, and tame that whitespace-eating nanovirus and turn it into a useful tool! -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From laurent.pointal at laposte.net Sat Dec 8 12:10:25 2001 From: laurent.pointal at laposte.net (Laurent Pointal) Date: 08 Dec 2001 17:10:25 GMT Subject: python log() function References: <9ut07m$qni$1@plutonium.btinternet.com> Message-ID: Oleg Broytmann wrote in news:mailman.1007815211.29346.python-list at python.org: > This is integer division. So you've calculted log(2)/log(2) :) Use > floting point division: 20.0/7. Or switch to 2.2 and use: >>> from __future__ import division >>> 20/7 2.8571428571428572 GVR seem to be on the right way... even if it needs programmers to change their code and coding. A+ Laurent. From guido.goldstein at a-nugget.de Mon Dec 24 15:31:28 2001 From: guido.goldstein at a-nugget.de (Guido Goldstein) Date: 24 Dec 2001 21:31:28 +0100 Subject: C++ throw causes abort in extension? References: <20011224.123518.378096161.2956@localhost.localdomain> <2ZKV7.13654$PO5.2163087@newsread1.prod.itd.earthlink.net> Message-ID: Hi! On Mon, 24 Dec 2001 19:02:22 GMT "Chris Tavares" wrote: > "Robert Nikander" wrote in message > news:20011224.123518.378096161.2956 at localhost.localdomain... > > Hi everyone, > > I am trying to use C++ in my Python extension, but any throwing of > > exceptions cause the program to 'abort.' [...] > Typically, this sort of problem arises when mixing C++ and C. I'm not a GCC > expert (I do most of my programming on Windows, actually) so take what I'm > saying with a grain of salt, but... > [...] > In the Windows world, the solution is to compile main with a C++ compiler, > not a C compiler. No clue what to do under GCC/Linux, though. Exactly the same on *nix/Linux. With the Python-2.2 comes a switch for configure which is named: --with-cxx= Maybe that should use this to get C++ support and the desired exception handling. Bye Guido G. <-- note that! :-) -- In case of emergency, the only thing better than presence of mind, is absence of body. -- anon From greg at cosc.canterbury.ac.nz Wed Dec 5 18:33:19 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Thu, 06 Dec 2001 12:33:19 +1300 Subject: Multi-isinstance idiom (Re: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)) References: Message-ID: <3C0EAEBF.61858076@cosc.canterbury.ac.nz> Bjorn Pettersen wrote: > > > From: Courageous [mailto:jkraska at san.rr.com] > > > > if isinstance(f, future.Step) or \ > > isinstance(f, future.Status) or \ > > isinstance(f, future.Announce) or \ > > isinstance(f, possibility.Observe) or \ > > isinstance(f, future.Incarnate) or \ > > isinstance(f, future.Start) or \ > > isinstance(f, future.Timeout): > > Ack, so much typing :-) How about class ClassesOfInterest(future.Step, future.Status, future.Announce, possibility.Observe, future.Incarnate, future.Start, future.Timeout): pass if isinstance(f, ClassesOfInterest): ... -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From freebird317 at hotmail.com Thu Dec 27 19:04:11 2001 From: freebird317 at hotmail.com (~Jason~) Date: Fri, 28 Dec 2001 00:04:11 GMT Subject: tcl??? Message-ID: <%FOW7.8662$7p6.139123@rwcrnsc51.ops.asp.att.net> I am playing around with Python and it is telling me that to activate tcl type tclch80. I do this and I get an error. I think may be it is because either I am typing in the wrong version or I do not have it? Am I right and if so how do I correct it? And if I am wrong, how do I fix it? What it wants me to do is type [% put "Hello World"] and I do that and I get an error, why? -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If GOD be for us, who can be against us? ~ Romans 8:31~ Jason Lehman freebird317 at hotmail.com From robin at alldunn.com Tue Dec 11 15:59:29 2001 From: robin at alldunn.com (Robin Dunn) Date: Tue, 11 Dec 2001 12:59:29 -0800 Subject: ANN: wxPython 2.3.2 Message-ID: <117501c18286$bb66f580$0214a8c0@Rogue> wxPython 2.3.2 has been released as is available for download from http://wxPython.org/download.org or the wxPython project pages at SourceForge. wxPython is a popular GUI toolkit for the Python language that is usable on Windows and Linux/Unix systems with the GTK+ toolkit, and a Mac OS X version is in progress. Some of the changes for the 2.3.2 release are: Added EVT_HELP, EVT_HELP_RANGE, EVT_DETAILED_HELP, EVT_DETAILED_HELP_RANGE, EVT_CONTEXT_MENU, wxHelpEvent, wxContextMenuEvent, wxContextHelp, wxContextHelpButton, wxTipWindow, and a demo to show them in action. Deprecated PyShell and PyShellWindow, added a snapshot of PyCrust (see http://sourceforge.net/projects/pycrust/. ) Added the new virtual list capabilities to wxListCtrl. Added a wxSTC style editor from Riaan Booysen to the sample apps. Added XRCed to the wxPython Tools directory, contributed by Roman Rolinsky. Added a new "constructor" to most of the window classes that calls the default C++ contructor, (the one with no parameters) and also added the coresponding Create(...) method. This allows you to do a 2-step creation of windows which is sometimes required for doing things such as setting extended style flags before the window is created, or for passing the object to the XRC resource system to be created from the resource. The name of the new "constructor" is the original name of the class with a "Pre" in it. For example, wxPreWindow, wxPreFrame, etc. Updated to version 1.40 of Scintilla and updated wxStyledTextCtrl accordingly. While doing this update I dropped the wxLB_SORT style from the wxListBox created for the AutoComplete functionality. This means that you will have to sort the keyword lists yourself, but you are free to do case sensitive or case insensitive sorts and set the wxSTC flag accordingly. Updated wxColumnSorterMixin to also be able to place sort icons on the column headers, and updated the wxListCtrl demo to show it off by using wxColumnSorterMixin. Added wxGenBitmapTextButton, TablePrint, etc. contribs from Lorne White. Added wxNativeFontInfo and wxFontMapper. Added pySketch to the samples. Significantly changed how the Python interpreter lock and thread state are managed, which should fix the problem of running on a multi-processor machine. Added wxPyLog so log targets can be created in Python to handle log messages however is wished. See demo/Main.py for an example. Added wxFindReplaceDialog. The second phase of OOR is implemented (for wxEvtHandler and derived classes at least.) This means that functions and methods that return an object derived from wxEvtHandler that was originally created in Python, will return the original Python object (if it still exists) instead of letting SWIG wrap a new shadow object around the original C++ pointer. Added some optimization methods to wxDC: GetBoundingBox, DrawLineList, DrawPointList. Added a set of sophisticated Error Dialogs from Chris Fama. Added wxRightTextCtrl from Josu Oyanguren to wxPython.lib for aligning text in a wxTextCtrl to the right side. Added wxURLDataObject and and example showing drag and drop of URLs to and from web browsers. It's still not 100% bullet-proof for all types of browsers, but it works for the majority of cases with the popular browsers on Windows. On wxGTK it seems that only Netscape 4.x works, if anybody has any suggestions about this please bring it up on the wx-dev list. Added wxStopWatch. Added wxMimeTypesManager and wxFileType. Passing None for the handler parameter to one of the EVT_** functions will now Disconnect the event. Added wxPopupWindow and wxPopupTransientWindow. Added wxFileHistory. Added wxDynamicSashWindow, which allows you to endlessly split widnows by dragging a little tab next to the scrollbars. Added a demo to show this and also the ability of multiple wxStyledStectCtrls to share the same document. Added wxEditableListBox gizmo. Updated wxEditor with lots of enhancements from Steve Howell and Adam Feuer. Added the "SplitTree gizmos" which are a collection of classes that were designed to operate together and provide a tree control with additional columns for each item. The classes are wxRemotelyScrolledTreeCtrl, wxTreeCompanionWindow, wxThinSplitterWindow, and wxSplitterScrolledWindow, some of which may also be useful by themselves. Added wxDllWidget from Vaclav Slavik which allows wx widgets derived from wxWindow to be loaded from a C++ .dll (or .so) and be used in a wxPython program, without the widget having to be SWIGged first. The visible API of the widget is limited to wxWindow methods plus a SendCommand method, but it is still quite powerful. See wxPython/contrib/dllwidget and wxPython/demo/dllwidget for more details. -- Robin Dunn Software Craftsman robin at AllDunn.com Java give you jitters? http://wxPython.org Relax with wxPython! From andymac at bullseye.apana.org.au Tue Dec 11 05:30:14 2001 From: andymac at bullseye.apana.org.au (Andrew MacIntyre) Date: Tue, 11 Dec 2001 21:30:14 +1100 (EDT) Subject: Fatal Error in the interpreter? In-Reply-To: Message-ID: On Mon, 10 Dec 2001, Courageous wrote: > I'm currently using the Debug build from Python as checked > out of the current CVS branch (Python22). I have an extension > that I've written and compiled successfully, but when I import > it, the interpreter crashes: > > Fatal Error: Interpreter not initialized (version mismatch?) > > Upon introspection, it appears that the program is crashing > from within Py_InitModule(). > > I clearly see the version mismatch suggestion on the error > line, but after fishing about, I'm fairly confident that I > don't have a different Python in my runtime than the Python > I compiled with. > > What else causes this error? The one time I saw this (on OS/2 so it may not translate), ISTR that I was trying to explicitly load the Python DLL, rather than rely on linkage via an import library. I concluded that, for this case, various things that the DLL expected to be defined/initialised (by linkage of the parent with the import library) in the process address space weren't there.... -- Andrew I MacIntyre "These thoughts are mine alone..." E-mail: andymac at bullseye.apana.org.au | Snail: PO Box 370 andymac at pcug.org.au | Belconnen ACT 2616 Web: http://www.andymac.org/ | Australia From jae at jerhard.org Sun Dec 9 19:18:34 2001 From: jae at jerhard.org (=?ISO-8859-1?Q?=22J=FCrgen_A=2E_Erhard=22?=) Date: Mon, 10 Dec 2001 01:18:34 +0100 Subject: Tab-key = Indent Correctly, != Insert Whatever (Was: Re: Deprecate tabs for indenting) In-Reply-To: <3C0EACD6.B2191A44@cosc.canterbury.ac.nz> (message from Greg Ewing on Thu, 06 Dec 2001 12:25:10 +1300) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BD39F.D43D4FF7@mega-nerd.com> <3c0be454$1@207.229.64.20> <3C0BE5D5.4386B359@mega-nerd.com> <3C0EACD6.B2191A44@cosc.canterbury.ac.nz> Message-ID: >>>>> "Greg" == Greg Ewing writes: Greg> Huaiyu Zhu wrote: >> So I'd suggest the tab advocates to consider the other side's >> view. Greg> And vice versa as well. To give one concrete example, BBEdit Greg> on the Mac is very definitely what Huaiyu calls a Greg> "tab-character" editor, both in what happens when you press Greg> the tab key, and in the way its block-shifting commands Greg> work. Get a better editor... like Emacs >;-) Seriously, I'm following this thread (lazily, and even more so, disgustedly) for some time... and haven't seen my position, so for all the world: Pressing the tab key in python-mode (Emacs) means "indent-for-tab-command". It doesn't mean "insert a tab character". And neither does it mean "insert N spaces". The closest it gets to is "jump to a fixed position". Which is context-sensitive, so it's not what most people mean with "fixed pos". And that's what I'm thinking when I press it (not: insert a tab now, but indent this correctly). I *can* configure Emacs' indentation to use spaces and tabs, or just spaces. Bye, J PS: cut-and-paste a block? Misaligned? Ctrl-C > and Ctrl-C < shift by the indentation. PPS: Did I mention that I *adore* Emacs' malleability? :-) -- J?rgen A. Erhard (juergen.erhard at gmx.net, jae at users.sf.net) MARS http://mars.jerhard.org Linux - Free PC Unix (http://www.linux.org) Shah, shah! Ayatollah you so! -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 248 bytes Desc: not available URL: From gh_pythonlist at gmx.de Sat Dec 22 10:33:38 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Sat, 22 Dec 2001 16:33:38 +0100 Subject: Building C modules static to the interpreter? In-Reply-To: References: Message-ID: <20011222153335.GA1994@lilith.hqd-internal> Le 22/12/01 ? 00:24, Dave Cinege ?crivit: > Before I try to think too hard on my own (dangerous) is there an > easy way to build a static python interpreter that includes some > of the C modules? You need to edit Modules/Setup, then recompile your Python. If you also want to statically link against glibc, you'll probably need to insert "--static" somewhere in the top-level Makefile. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From DeepBlue at DeepBlue.org Mon Dec 10 14:18:01 2001 From: DeepBlue at DeepBlue.org (DeepBlue) Date: Mon, 10 Dec 2001 13:18:01 -0600 Subject: Can't import from mx.ODBC References: <8f8ffe67.0112101027.24a3dcaf@posting.google.com> Message-ID: try import from mx.ODBC DeepBlue "Sunit Joshi" wrote in message news:8f8ffe67.0112101027.24a3dcaf at posting.google.com... > Hello > I'm trying to imort from mx.ODCB.Windows but I keep getting an error > saying "ImportError: No module named mx.ODBC.Windows". I checked the > sys.path and I do have the following: 'C:\\Python21\\mx\\ODBC' > > Could someone please tell me what is wrong here..?? > > thanks > Sunit > sjoshi at ingr.com From pete at shinners.org Thu Dec 20 02:35:23 2001 From: pete at shinners.org (Pete Shinners) Date: Thu, 20 Dec 2001 07:35:23 GMT Subject: ANN: pygame-1.3 Message-ID: <3C219665.1050804@shinners.org> Pygame, game development for python Pygame 1.3 released on December 19, 2001 Pete Shinners (pete at shinners.org) http://www.pygame.org Pygame is a set of python modules written to help create games in Python. The package is wrapped over SDL and several of the SDL helper libraries. SDL is a cross-platform media library created by Sam Lantinga. SDL is currently used for many commercial and open source game projects. Version 1.3 fixes a few drawing bugs and loose ends. It also adds a higher level sprite module to help manage game objects. Other small enhancements include framerate controlling clocks and improved communication with other python imaging libraries. Also new for 1.3 is three new tutorials, starting with one for the very beginning user. For those new to the pygame library, some of it's features include: * fullscreen or windowed framebuffer * multiple audio channel mixing, with streaming music * control of joystick and cdrom devices * antialiased truetype font rendering * variety of media formats: png, jpg, ogg, mp3, mod (and more) The pygame package also comes with complete documentation, tutorials, and many playable examples. The pygame mailing list has an active list of users, which makes getting started much more accessable. Pygame is distributed under the LGPL licese, which is the same license used by many its dependencies. From oren-py-l at hishome.net Mon Dec 3 05:10:14 2001 From: oren-py-l at hishome.net (Oren Tirosh) Date: Mon, 3 Dec 2001 05:10:14 -0500 Subject: On string formatting and functional programming Message-ID: <20011203051014.A56681@hishome.net> What takes an object describing some job to be done and a tuple of arguments and applies the tuple to that object? There's more than one correct answer to this riddle. It could be either Python's built-in apply() function or the formatting operator '%'. The formatting operator '%' is a functional programming operator. Yes, a format string is a function. But it's a limited function. It can only insert values into a string by position or by name. You can't embed an expression into a format string. Or can you? Nothing will stand in the way of a determined hacker so some brave soul developed the following trick: class EvalClass: def __getitem__(self, expr): return eval(expr) Eval = EvalClass() a = "string with %(embedded(expression))s using" % Eval I can appreciate the hack value but this is abuse of the language. What this trick basically does is emulate functional programming with runtime evaluation. Don't fear the lambda. Why emulate when you can use the real thing? Runtime evaluation of strings is inefficient and a security risk. Runtime evaluation leads to quoting and escaping problems. Quoting and escaping have already been solved once in the Python tokenizer so why solve them over and over again at higher layers? It's great that Python has an eval() function but... Abuse of eval is the first step on the road to scripting hell :-) According to the responses I got to my string interpolation proposal people have missed the point. I don't really care if the interpolation is done with dollars, percents, backticks or ampersands. What I care about is that Python should have a compact and readable syntax for representing a string with embedded expression and that THESE EXPRESSION ARE NOT EVALUATED AT RUNTIME. This means that it can only be a language feature, not a module. If you want to make a formatting template and defer the actual formatting just stick a "lambda:" in front of it, don't start messing with prefixes, escapes, quoting and runtime parsing. They are 90% of what I dislike about so-called scripting languages. *If* string interpolation is added to Python it should be done this way. There's another question of whether string interpolation should be added at all. I will welcome postings from anyone willing to comment or contribute to the proposal and leave the final decision to the BDFL. Oren Tirosh From marcora at colorado.edu Mon Dec 17 14:32:28 2001 From: marcora at colorado.edu (Edoardo ''Dado'' Marcora) Date: Mon, 17 Dec 2001 12:32:28 -0700 Subject: pyexpat and unicode References: Message-ID: <9vlh7i$f4$1@peabody.colorado.edu> I am getting the same error when I am trying to extract a Latin-1 string from an xml doc I am parsing with minidom. Is Python 2.2 gonna make this unicode mess transparent to the user/programmer? Dado "mallum" wrote in message news:mailman.1008606560.15267.python-list at python.org... > Hi all; > > I may be doing something stupid here and missing the obvious, but if I > run the following; > > ...snip... > > import xml.parsers.expat > parser = xml.parsers.expat.ParserCreate(encoding='utf8') > > data_uni = u"\202" > data = "there" > > data_uni.encode('utf8') > > parser.Parse(data) > parser.Parse(data_uni) > > ...... > > expat barfs with ; > > Traceback (most recent call last): > File "./testuni.py", line 12, in ? > parser.Parse(data_uni) > UnicodeError: ASCII encoding error: ordinal not in range(128) > > Does this mean Im unable to pass utf8 encoded strings to pyexpat ? > According to the docs it should. Can anyone spread some light on this. > > -- mallum > From dcinege at psychosis.com Sun Dec 2 21:24:05 2001 From: dcinege at psychosis.com (Dave Cinege) Date: Sun, 2 Dec 2001 21:24:05 -0500 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) In-Reply-To: <100d01c17ba0$1e2f6190$6702a8c0@gato> References: <100d01c17ba0$1e2f6190$6702a8c0@gato> Message-ID: On Sunday 02 December 2001 21:13, Jeff Hinrichs wrote: > my 0.02$US: > Actually, spaces are the problems not tabs. A tab is a tab, where is > indenting by spaces....hmm. > let's see, I like 4 spaces, he like 8 and she likes 6 and so on. That > causes more grief than tabs. > Where as tabs, 1 tab = 1st level block, 2 tabs = 2nd level block and so on. > > Maybe if people didn't use such brain dead editors that actually replaced > tabs with spaces this would be a complete non-issue. You should be able to > configure your editor to display tabs in a width that is to your liking > WITHOUT mucking with the data. As it is, we are doomed to listen to this > argument go on ad nauseum. Be comforted to know the LORD has told me, to tell you, you will be saved for spreading the good word... > @home.com ...though he says he can only do so much to keep your connection up. -- The time is now 22:54 (Totalitarian) - http://www.ccops.org/ From fardal at coral.phys.uvic.ca Fri Dec 7 15:16:34 2001 From: fardal at coral.phys.uvic.ca (Mark Fardal) Date: 07 Dec 2001 12:16:34 -0800 Subject: numerical packages for 1.5.2? Message-ID: Hi, I'd like to do some scientific/numerical work with Python. On the computers accessible to me, Python 1.5.2 is quite common but Python 2.x is not to be found anywhere. I don't have root password to most of these computers. I'd also like to share my code with collaborators, and don't want to make them upgrade Python itself (which is significantly harder than upgrading Python packages). So, it looks like Python 1.5.2 is it for now. These are mostly Linux/x86 systems with a few SGIs. Given that restriction, what version of Numeric should I be using? Is there a version of SciPy that will work on 1.5.2? Are there known bugs in any of these versions I should watch out for? thanks Mark Fardal University of Victoria From hgg9140 at seanet.com Mon Dec 31 14:46:35 2001 From: hgg9140 at seanet.com (Harry George) Date: 31 Dec 2001 11:46:35 -0800 Subject: How to do "ANN:"? -- ignore References: Message-ID: Looks like they are coming through this time. Harry George writes: > A couple of times I've tried to annouce package upgrades using "ANN:" > entries to c.l.p and c.l.p.a, but nothing shows up. Is there a magic > decoder ring? > > Most recently, updates for mkpythonproj, pdx, and pyperlish. > > -- > Harry George > hgg9140 at seanet.com -- Harry George hgg9140 at seanet.com From oren-py-l at hishome.net Tue Dec 4 02:16:39 2001 From: oren-py-l at hishome.net (Oren Tirosh) Date: Tue, 4 Dec 2001 02:16:39 -0500 Subject: Draft PEP: string interpolation with backquotes In-Reply-To: <200112032307.fB3N78327930@bigboy.bizarsoftware.com.au>; from richard@bizarsoftware.com.au on Tue, Dec 04, 2001 at 10:07:41AM +1100 References: <20011202080626.A76724@hishome.net> <20011202170805.A36879@hishome.net> <200112032307.fB3N78327930@bigboy.bizarsoftware.com.au> Message-ID: <20011204021639.B35263@hishome.net> On Tue, Dec 04, 2001 at 10:07:41AM +1100, Richard Jones wrote: > This would then cause confusion - why not revert back to using $ as the magic > interpolation character? It has no prior history in Python and therefore no > preconceived ideas exist as to what its result might be. It does have some > history outside of Python as a string interpolation character though, in > many, many systems... This proposed form of interpolation is fundamentally different from that found in scripting languages and I believe it deserves a syntax that highlights this difference. The embedded expression is NOT part of the string. It is a real Python expression, syntax-checked at compile time and converted into bytecode. No parsing, escaping or quoting is done at runtime. Your language-aware editor should even color-code it as it would any other expression, not with the color code for a string. Syntactically, the string starts at the quotes and ends at the backtick and another string starts at the backtick and ends at the quotes. The expression is surrounded by string fragments with unbalanced quoting. As for the issue of interpolation with backticks being equivalent to str() rather than repr() - I believe most people won't even notice. When the system simply does the Right Thing according to the context it feels more consistent even if technically it isn't. Please read my previous posting titled 'On string formatting and functional programming'. Oren From LLoeffler at home.com Sat Dec 22 12:54:37 2001 From: LLoeffler at home.com (Luke) Date: Sat, 22 Dec 2001 11:54:37 -0600 Subject: Search the difference: Why this function defenition does'nt work? References: <3C24A967.3070604@student.kun.nl> <3C24B3AE.8060103@student.kun.nl> Message-ID: <3C24C8DD.4090300@home.com> If you use a list index [0] that returns a single element of the type that that element is (which is what you want in this case). But when you use the colon for slice notation, you are asking python to return a tuple of all the elements up to the zeroth element, which is no elements--an empty tuple. Then you are trying to add a number to a tuple which is undefined. From aahz at panix.com Wed Dec 26 19:09:59 2001 From: aahz at panix.com (Aahz Maruch) Date: 26 Dec 2001 16:09:59 -0800 Subject: try-except-finally question References: Message-ID: In article , Igor V. Rafienko wrote: > >The skeleton code looks something like this: > >def updateDB(): > > # some initializing > > try: > > try: > > > > > > except ExternalFactorError: > > except DBError: > except: raise > # yrt > # od > finally: > > > # yrt ># end updateDB > >The outermost try-finally is needed to free the initialized resources. > >I have 2 questions: > >* In the innermost try-except there is a possibility for other > exceptions than ExternalFactorError and DBError. How can I catch > _all_ other exceptions than these two[*]? I'm not so much interested > in error itself, but rather whether it occured. I.e. I'm looking for > C++'s "catch (...)" construct in Python. Note the addition of "except:" above. You need the "raise" to make sure the error gets re-raised (you *want* to abort if the user hits ^C). -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 5 days and counting From roymath at yahoo.com Sat Dec 1 11:26:53 2001 From: roymath at yahoo.com (Roy Mathew) Date: 1 Dec 2001 08:26:53 -0800 Subject: variable scoping across imports? Message-ID: <7b408077.0112010826.47a6a758@posting.google.com> Dear Pythoneers, I have what seems to be a vexing problem. In its simplest form, here are 2 files # ------ file x.py ------------------------------------------------ z0 = None import y def set(): global z0 z0 = 33 if __name__=='__main__': y.show() set() y.show() # ------ file y.py ------------------------------------------------ import x def show(): print x.z0 # ----------------------------------------------------------------- Now, I would expect that running "python x.py" would produce None 33 but instead, it produces None None I have read the rules on variable scoping pretty carefully, I think. Are the circular imports confusing python. (BTW, I am using "ActivePython 2.1, build 210 ActiveState"). What am I missing? Thanks, Roy. From chrishbarker at attbi.com Fri Dec 21 14:06:22 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Fri, 21 Dec 2001 11:06:22 -0800 Subject: An hour's talk on python...Suggestions required (from a newbie) References: Message-ID: <3C23882E.FD128591@attbi.com> Karthik Gurumurthy wrote: > I was planning to take an introductory session on python. Good plan, I'm planning on doing the same thing myself someday. If you put togetheer a good outline, perhaps you could post it somewhere for all to use and comment on. > I feel irrespective of how good the language is, not many > w'd want to try it out unless and otherwise they can see lots of > supporting tools and libraries. Quite true and Python is very strong on this front. THe Standard library is great, and there are a lot of independently developed modules that are very usefull. Be sure to find a few that would be usefull to your organisation. Some suggestions: PIL, Numeric, mxDateTime, mxODBC, etc... > 2. about new features that have been included in 2.2? No point in talking about new features if your listeners aren't familiar with the old ones. However, presenting 2.2 is probably the way to go. > 4. GUI : Tkinter You might want to take a good look at other GUI options: wxPython, PyQT, Jython/Swing, etc. You sould probably find a few examples of tings you have used Python for in your work. Examples of how you have solved problems quickly and effectively will go over well. A "This is a great language, but I havn't actually done anythong usefull with it" talkl, won't have the same weight. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From DeepBlue at DeepBlue.org Mon Dec 17 09:04:29 2001 From: DeepBlue at DeepBlue.org (DeepBlue) Date: Mon, 17 Dec 2001 08:04:29 -0600 Subject: Update Oreilly books? References: Message-ID: Dan I truly got no idea why everyone seems willing to criticize Programming Python. It is an excellent book. If you have 2nd edition, you do not have to wait for another edition. One book simply will not do it. My plan is this: Have Programming Python, then get the latest Python Essential Reference by Beazley. Now, if you need anything specilaized (Python and XML or Python and the Web etc....) then get one. The opinion that one book should have all there is to be about a language is not only a myth but an insult to the language itself. There are many books to be published soon, Holden's Python web programming, another one on Python and XML etc...... My ture hope is that these forthcoming books will not reinvent the wheel by starting a multi-chapter introduction on how to use Python. DeepBleu wrote in message news:mailman.1008555261.15036.python-list at python.org... > I am about to slowly transfer out of my newbie status, and I am going > to purchase a Programming Python Book (an upgrade from learning python) > and I wanted to know if anyone knows whether Oreilly will update the > book with the upcoming 2.2 release or if the 2nd edition will last till > 3.0 Python relase. > > Thank You > Dan > -- > John 11:25 "Jesus said to her, I am the resurrection and the life. He who > believes in me will live, even though he dies;" -- > http://www.tddm.org/salvation.shtml > > > From shriek at gmx.co.uk Sun Dec 23 12:30:36 2001 From: shriek at gmx.co.uk (Stephen) Date: 23 Dec 2001 09:30:36 -0800 Subject: MySQLdb "Illegal instruction" error. References: Message-ID: <97ae44ee.0112230930.35bb2ac1@posting.google.com> Roman, you're a legend. Have got it working ! > >but the problem still persists (ie. "Illegal Instruction" error and > >Python exits). > > > >I've tried using MySQLdb for Python1.5.2 and the same problem exists. > >So, that pretty much rules out Python1 vs Python2 problems - now to > >work out if it's a MySQLdb or MySQL problem. > > Maybe you've used wrong version of Python to compile extension > module? I remember having problems with threads when compiling > MySQLdb. Getting latest source solved the problem. > I also remember MySQLdb has it's own maillist. Probably, you can ask > MySQLdb author there. That was the ticket. Went looking for the mailing list but there isn't one. However, there is a forum at sourceforge and a previous posting was titled "Illegal Instruction" also on Redhat7.x. Followed the advice given and it worked for me first time. Sincerely relieved and indebted to yourself and the guys (Andy Dustman and Halokido?) who solved this at sourceforge. Merry Christmas indeed. :-) Stephen From cliechti at gmx.net Sun Dec 30 07:40:23 2001 From: cliechti at gmx.net (Chris Liechti) Date: 30 Dec 2001 13:40:23 +0100 Subject: REPOST: Re: values of sys.platform? for a serial port lib References: <7876a8ea.0112292200.593d01e8@posting.google.com> Message-ID: <5$--$$_----__%--%$@news.noc.cabal.int> woodsplitter at rocketmail.com (stalin) wrote in news:7876a8ea.0112292200.593d01e8 at posting.google.com: > Chris Liechti wrote in message > news:... >> i've written a portable serial port library. it runs now on linux and >> win32 > > Are you aware of Isaac Barona's Universal Serial Port Python Library? > http://balder.prohosting.com/ibarona/en/python/uspp/uspp_en.html > > How do the design goals of your library differ from USPP? How do you > intend to license it? USPP uses the IMHO restrictive GPL. > > Disclaimer: I've never used USPP. im'aware of that library but it has some drawbacks for me: 1. initialization of binary mode is not correct on posix 2. i must be able to select parity e.g. 9600,8,E,1 3. i need the control lines RTS/DTR, which are not yet implemented 4. licence. it may be used in a proprietary product so i can't use GPL mine is under the python licence. chris -- Chris ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Chris Liechti Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:30:41 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774253 27193 211.57.49.2 (31 Dec 2001 04:50:53 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:50:53 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From dalke at dalkescientific.com Fri Dec 21 13:32:30 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Fri, 21 Dec 2001 11:32:30 -0700 Subject: Speeding dictionary lookup of instances References: <3C22676C.3020606@wi.mit.edu> Message-ID: <9vvuv4$g0v$1@slb6.atl.mindspring.net> Brian Kelley: >This speeds up dictionary lookup by a factor of 20. Not that >implementing a __hash__ method to return the handle won't speed up the >lookup. Are you saying the same thing as method calls are expensive in Python? Or that attribute lookups are expensive? >It turns out this the speed of this is identical to the speed of using >the handle. I like using the handle because the dictionary is picklable > with the instance. id(f) changes during different sessions. You also need to pickle the id generator state as otherwise you may have duplicate values created during different sessions. >So if you want faster lookups using instances as keys, use a handle or >the id. > >Attached is some simple timing code showing these three methods. I ran it on a Linux/Alpha box with python 2.2b2+. I'm not getting a factor of 20 performance difference. [dalke at pw600a ~/src]$ python spam.py time for lookups of instances 0.0959539413452 time for lookups of integers 0.0619969367981 time for lookups of ids 0.0673110485077 [dalke at pw600a ~/src]$ I also tried this class, which reduces one level of lookup. class FastHandledNode: def __init__(self, data, HandleGenerator=IndexGenerator()): self.data = data handle = HandleGenerator.next() def _hash(handle = handle): return handle self.__hash__ = _hash def __repr__(self): return "Node(%s)"%`self.data` That gives me time for lookups of instances 0.0949679613113 time for lookups of integers 0.0595859289169 time for lookups of ids 0.0635080337524 time for fast lookups 0.0655270814896 so it looks like __hash__ lookup in class namespace is taking up a good chunk of time. By the way, I also tried this on Python 1.5.2 (needed to replace a += of yours) time for lookups of instances 0.0599880218506 time for lookups of integers 0.0540360212326 time for lookups of ids 0.0583939552307 time for fast lookups 0.0580099821091 Looks like Python is now slower for the code you use. Andrew dalke at dalkescientific.com From store_li at sina.com Tue Dec 18 21:50:57 2001 From: store_li at sina.com (Kick) Date: Wed, 19 Dec 2001 10:50:57 +0800 Subject: How can I display unicode in Tk widget References: <9vkqm7$fqo83$1@ID-12869.news.dfncis.de> Message-ID: <9vovdv$glg4c$1@ID-12869.news.dfncis.de> Thank you! I will try it. "Kirill Simonov" wrote in message news:mailman.1008693863.23418.python-list at python.org... > On Tue, Dec 18, 2001 at 12:19:58PM +0100, Martin von Loewis wrote: > > On Windows, Tcl doesn't find its encoding database, thus it cannot > > find out how to convert the Unicode string for display. Setting > > TCL_LIBRARY may help. > > > > It is questionable whether this is a bug in Tcl or Python: It is a bug > > in Python, for not installing Tcl libraries in a place where Tcl will > > find them, and it is a bug in Tcl, for not offering an API to tell it > > a different location for the codecs database. > > This is a bug in "Python2*/Lib/lib-tk/FixTk.py". > Here is the right way to set TCL_LIBRARY. > > FixTk.py > ======== > > # Do not import _tkinter! > import sys, os > > if not os.environ.has_key('TCL_LIBRARY'): > # Tcl is smart enough to check "$TCL_LIBRARY/tclX.Y/../tcl8.3/". > tcl_library = os.path.join(sys.prefix, "tcl", "tclX.Y") > os.environ['TCL_LIBRARY'] = tcl_library > > ======== > > > Kirill. > > From teg at redhat.com Tue Dec 18 15:39:44 2001 From: teg at redhat.com (Trond Eivind =?iso-8859-1?q?Glomsr=F8d?=) Date: 18 Dec 2001 15:39:44 -0500 Subject: /usr/bin/env: python: No such file or directory References: <9vivft$593$1@peabody.colorado.edu> <171220010818339518%jwbaxter@spamcop.net> <9vnvue$m5d$1@peabody.colorado.edu> <3C1F9B6E.19471D84@alcyone.com> Message-ID: Erik Max Francis writes: > Fernando P?rez wrote: > > > Right. Just discovered that yesterday: I also broke printing! > > > > At this point I'm fully willing to say that RedHat has simply put out > > a > > broken python setup. I fail to see one good reason for the current > > mess, with > > system-level things (like printing) needing python 1.5 to be the > > default and > > be called python. > > It wouldn't be too surprising. Red Hat seems to be fond of shipping > custom versions of everything, to the point that some are totally > unofficial or downright broken. Take the gcc 2.96 fiasco, for instance. Having the best compiler for a year and a half can hardly be called a fiasco for us - it is a problem that there were no decent official releases to ship, though. -- Trond Eivind Glomsr?d Red Hat, Inc. From paul at boddie.net Thu Dec 20 11:38:57 2001 From: paul at boddie.net (Paul Boddie) Date: 20 Dec 2001 08:38:57 -0800 Subject: DOM - some pointers References: <9voi51$fco$1@slb7.atl.mindspring.net> Message-ID: <23891c90.0112200838.209adc50@posting.google.com> Martin von Loewis wrote in message news:... > "Andrew Dalke" writes: > > > So I too am looking for pointers. > > You may want to try getting a copy of "Python & XML", by Jones and > Drake. I don't know whether it is already available; but it certainly > offers lots of examples - small ones and large ones. Down this road lies the Enterprise JavaBeans experience, however, where it seems like there's a lack of really decent material on the Internet, and that people want you to buy their books anyway. Add to that a changing standard, old tutorials decaying on Sun's site, and a chorus of unanswered cries for help (on a Java forum near you!). Still, I wouldn't mind writing a few documents about getting started with DOM. I feel myself that I'm still only getting started even now, although my experiences wouldn't have helped Mr Dalke - I tend only to read XML documents, not write them. Paul From joonas at olen.to Fri Dec 28 17:43:16 2001 From: joonas at olen.to (Joonas Paalasmaa) Date: 28 Dec 2001 14:43:16 -0800 Subject: Finding out that Python is in interactive mode in sitecustomize.py References: <3C2B8F47.4CEACF6E@olen.to> <87g05wgq84.fsf@psyche.dnsalias.org> Message-ID: <11aed8f9.0112281443.afbc668@posting.google.com> Carey Evans wrote in message news:<87g05wgq84.fsf at psyche.dnsalias.org>... > Joonas Paalasmaa writes: > > > How can I find out that Python is started in interactive mode in > > sitecustomize.py ? > > A search on http://groups.google.com/ for "python test interactive" > comes up with this as the second result: > > import sys > if hasattr(sys, "ps1"): > # probably interactive > else: > # probably not interactive For some reason it doesn't work in sitecustomize.py . When these lines are to sitecustomize.py and Python is started in interactive mode, Python prints "In non-interactive mode". # the lines import sys if hasattr(sys, "ps1"): print "In interactive mode" else: print "In non-interactive mode" From pzw1 at hotmail.com Mon Dec 10 18:03:20 2001 From: pzw1 at hotmail.com (Peter Wang) Date: 10 Dec 2001 15:03:20 -0800 Subject: Populating a list References: <3C150599.33C3449B@attbi.com> Message-ID: Chris Barker wrote in message news:<3C150599.33C3449B at attbi.com>... > Kevin Cazabon wrote: > > > f=open('/home/mlorfeld/states.txt', 'r+').readlines() > > > The file is still open > > however, you just have no way to close it. I'd hope that Python would > > close the file once it goes out of scope, but I couldn't guarantee it. > > Python does close the file when it's reference count goes to zero, which > will happen as soon as that line is done processing. I'm pretty sure it > is guaranteed, I certainly have never had a problem with it. That's > what's nice about Python's reference counting scheme. It's guaranteed to be deleted once the refcount reaches zero, but note that if readlines() throws an exception, then a reference to the file handle will still exist in the stack frame in the traceback object, meaning that the file is not closed as long as the traceback object is active. my take on things is that with sockets and files, it's better to be neat and clean them up yourself, because then you know exactly what is going on in your code, rather than relying upon the interpreter/gc implementation. -peter From bbollenbach at home.com Sat Dec 8 20:14:26 2001 From: bbollenbach at home.com (Brad Bollenbach) Date: Sun, 09 Dec 2001 01:14:26 GMT Subject: It's hard to find documentation References: Message-ID: In article , Bruce Eckel wrote: > So let's try to find "Extending and Embedding the Python > Interpreter". Using 'search,' using 'advanced search,' nothing > comes up with that title. Maybe it doesn't exist. Who knows. I have > this struggle a lot when hunting for python information. So do I, except when using the WinHelp version of the documentation with ActivePython on Windows systems. Even /then/, the links from the index usually don't take you right to the function documentation. Additional scrolling (augh) is usually required. More commonly, I'm in a non-Windows environment though, so I don't have access to said documentation anyway. Any argument that tries to make it look as though Python's documentation is easily searchable is -- as far as I can tell -- wrong. All we need now is for the right person to get lazy enough to write a good search (either for use with the website, or -- even better -- at your local command prompt). If I wanted it badly enough, I would have done so already. :) From tripps81 at yahoo.com Thu Dec 6 12:34:24 2001 From: tripps81 at yahoo.com (Tripp Scott) Date: Fri, 07 Dec 2001 00:34:24 +0700 Subject: Fwd: simple, lightweight component based development in python? Message-ID: <5.1.0.14.2.20011207003338.04e28e38@wheresmymailserver.com> sorry for the repost, i had wrongly set my From field. t >Date: Thu, 06 Dec 2001 22:39:29 +0700 >To: python-list at python.org >From: Tripp Scott >Subject: simple, lightweight component based development in python? > >is there already a lightweight component framework in python? > >i need cross platform compatibility so COM is out of my list. > >there's CORBA and XPCOM and their python ORBs/binding, but i'm >still looking for something simpler, straightforward, and more >lightweight. i do not see the need to interface to other >languages in the near future so a python-only solution will do >-- though the possibility of bridging to COM or CORBA would certainly be nice. > >what i want is a framework that allows me to specifically deal >with "components" (i.e.: i design interfaces, implement them >with one or more python classes, and later assemble the >components). the framework should provide the following functions: > >- enable a client to locate components which implement a >desired interface, and instantiates them; >- instantiate a remote component (probably with a simple proxy >object mechanism); >- transactional feature would certainly be nice; > >however, i do not desire these features: >- some registry database in a binary format of some kind (i'd >rather put all my components in a directory and it's >automatically "registered"); > >the application i am building is a non-visual one (to be run >over the Web); i am still looking here and there for an >existing solution for a couple of weeks, but if none such beast >exists will consider to build one myself -- probably only the >minimal feature set first. > >t From fperez528 at yahoo.com Fri Dec 21 12:18:17 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Sat, 22 Dec 2001 16:46:17 +2328 Subject: ANN: IPython 0.2.2 Message-ID: Announcing an update to IPython, an enhanced interactive Python shell. WHERE: http://www-hep.colorado.edu/~fperez/ipython NEW: - Now there is a minimalistic webpage with information at the above link. - distutils-based installer. - user manual (html and pdf). - various small bugfixes (see changelog for details). What is IPython? (this is just for context. See the webpage for full details). IPython tries to: i - provide a flexible, useful and powerful environment for interactive work in Python programming. It tries to address what we see as shortcomings of the standard Python prompt, and adds many features to make interactive work much more efficient. ii - offer a flexible framework so that it can be used as the base environment for other projects and problems where Python can be the underlying language. Specifically scientific environments like Mathematica, IDL and Mathcad inspired its design, but similar ideas can be useful in many fields. Python is a fabulous language for implementing this kind of system (due to its dynamic and introspective features), and with suitable libraries entire systems could be built leveraging Python's power. iii - serve as an embeddable, ready to go interpreter for your own programs. Portability: currently only Linux/Unix. Probably not to hard to port to others. Python version: requires 2.1 or newer. License: LGPL (a few files from third parties carry MIT licenses). Cheers, Fernando Perez. From dmallwitz at cox.rr.com Fri Dec 21 14:12:22 2001 From: dmallwitz at cox.rr.com (David Mallwitz) Date: Fri, 21 Dec 2001 14:12:22 -0500 Subject: Comunicating through COM ports References: Message-ID: <3c2387f0_1@goliath.newsgroups.com> FW: Comunicating through COM portsWhich Python distribution are you using? Or did you compile from source? Dave "Alves, Carlos Alberto - Coelce" wrote in message news:mailman.1008955468.30561.python-list at python.org... Sorry, but as I said before, I'm under windows98 and I haven't such directory. Do I need to download that module from anywhere?!If so, give me an URL. -----Original Message----- From: David Lees [mailto:deblnonospammyno at raqia.com] Sent: Friday, December 21, 2001 1:46 PM To: python-list at python.org Subject: Re: FW: Comunicating through COM ports Python21/scripts/PythonSerial david lees > "Alves, Carlos Alberto - Coelce" wrote: > > Thanks for the example. But, where can I find such module Serial?! > > -----Original Message----- > From: David Mallwitz [mailto:dmallwitz at cox.rr.com] > Sent: Thursday, December 20, 2001 10:26 PM > To: python-list at python.org > Subject: Re: Comunicating through COM ports > > Comunicating through COM portsChapter 19 of Mark Hammond and Andy > Robinson's > 'Python Programmingon on Win32' covers this quit well, and with the > Activestate Python distro there is a multithreaded demo called > 'win32comport_demo.py'. But here's what I do - example is from a > console > connection to an old Cisco router. > > >>> from Serial import Serial > >>> ### open the COM1 port > >>> serialconfig = Serial.PortDict() > >>> serialconfig['port'] = Serial.COM1 > >>> serialconfig['rxBufSize'] = 4096 > >>> port = Serial.Port(serialconfig) > >>> port.open() > >>> port.write('show conf \r') > >>> x = port.read() > >>> x > 'show conf \r\nUsing 768 out of 32762 bytes\r\n!\r\nversion 11.1\r\nno > > service u > dp-small-servers\r\nno service tcp-small-servers\r\n!\r\nhostname > Router\r\n!\r\ > n!\r\nip subnet-zero\r\nno ip domain-lookup\r\n!\r\nhub ether 0 1\r\n > link-test\ > r\n auto-polarity\r\n!\r\nhub ether 0 2\r\n link-test\r\n > auto-polarity\r\n!\r\n > hub ether 0 3\r\n link-test\r\n auto-polarity\r\n --More-- ' > > Best, > Dave > > "Alves, Carlos Alberto - Coelce" wrote in > message > news:mailman.1008852145.28654.python-list at python.org... > Anybody could give me an example code of how connect/comunicate > through COM > ports (i.e. COM1, COM2). I'm under windows 98. > Thanks!!! > Carlos Alberto > COELCE/DPRON-Departamento de Projetos e Obras Norte > Fone: 677- 2228 > e-mail: calves at coelce.com.br > \|||/ > (o o) > --ooo0-(_)-0ooo-- > > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- > http://www.newsfeeds.com - The #1 Newsgroup Service in the World! > Check out our new Unlimited Server. No Download or Time Limits! > -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- > -- > http://mail.python.org/mailman/listinfo/python-list -- debl -- http://mail.python.org/mailman/listinfo/python-list -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- From philh at comuno.freeserve.co.uk Sun Dec 2 00:05:29 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Sun, 2 Dec 2001 05:05:29 +0000 Subject: A modest indentation proposal References: Message-ID: On 30 Nov 2001 20:07:25 GMT, Quinn Dunkan wrote: >On Fri, 30 Nov 2001 14:25:12 +0000, phil hunt >wrote: >>If I ever design a Python-like language, there will be 2 alternate syntaxes, >>one with and one without semantic indentation. So people will be able to >>write >> >> if x > 3: >> a := b + c >> print a >> >>or: >> >> if x > 3: { >> a := b + c; >> print a; >> } >> >>(Though why anyone would prefer the second way is beyond me). >> >>The language would be stored internally in a form resembling the upper >>of the two, and there would be automatic translators so everyone could >>see it the way they liked, with {} or not, with whatever number of >>characters per indentation they liked, spaces/tabs, etc. > >http://www.haskell.org/onlinereport/lexemes.html#lexemes-layout > >I don't entirely like it because error messages can be confusing ("missing >close brace" when you mess up indentation) and code that uses both at once can >be confusing. I'd rather have only indentation or only delimiters. Having >both and a rule to magically transform from one to the other is too >complicated. You could have separate filename extensions .lang and .langb for example. So wether a particular code fragment nused brackets would depend on what extension its file has. -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From emile at fenx.com Fri Dec 28 20:27:25 2001 From: emile at fenx.com (Emile van Sebille) Date: Fri, 28 Dec 2001 17:27:25 -0800 Subject: REPOST: Re: need help with class of arrays which have attibutes References: Message-ID: <6$--$$_----_---_$$@news.noc.cabal.int> "Rob" wrote in message news:pan.2001.12.28.15.45.35.83.2001 at ieee.org... > Hi, > > I'm trying to contruct a class of arrays which have attributes. This one > respresents a wire[] array which can have x,y,z etc coordinates. I just > can't figure out how to do it. Here is what I have so far: (it uses > Numpy) You need to review and work some with classes. Start with section 9 in the tutorial http://www.python.org/doc/current/tut/node11.html and look at the __init__ references, which is used to initialize class instances. HTH, -- Emile van Sebille emile at fenx.com --------- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Emile van Sebille" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:37:10 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774918 27193 211.57.49.2 (31 Dec 2001 05:01:58 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:01:58 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From ahimsa at inext.co.za Tue Dec 25 02:55:26 2001 From: ahimsa at inext.co.za (Ahimsa) Date: Tue, 25 Dec 2001 09:55:26 +0200 Subject: Obtaining the IDLE GUI under Red Hat Linux 7.2 Message-ID: Greetings and compliments of the season to y'all Quick question. I understand that there is a way of obtaining a GUI for Python 2.2. If so, what would be the way to get this under Linux Red Hat 7.2? Anyone got any experience with this? Thanks Andrew From grey at despair.dmiyu.org Fri Dec 28 15:36:04 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Fri, 28 Dec 2001 20:36:04 -0000 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2C8A86.50C74E60@earthlink.net> <3C2CBA56.17FE536C@earthlink.net> Message-ID: <7$--$$_-----$%$__$@news.noc.cabal.int> On Fri, 28 Dec 2001 18:36:09 GMT, Hans Nowak wrote: > Fair enough, but did you buy those recently? The original remark > was about the slowest computers one could get today... > Ah well, that's what I get for buying mine at K-mart... ;-) All were aquired one manner or another in the past year. :) -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Steve Lamb Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:16:51 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775076 27193 211.57.49.2 (31 Dec 2001 05:04:36 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:04:36 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From loewis at informatik.hu-berlin.de Fri Dec 14 05:52:07 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 14 Dec 2001 11:52:07 +0100 Subject: reading 6-byte ("real48") Borland Pascal Floating Point numbers References: <3c19262e.1671423@news.muenster.de> <3C192B25.4F1BD2F9@indra.com> <87lmg6f3sx.fsf@pc714.maths.usyd.edu.au> Message-ID: nigel at pc714.maths.usyd.edu.au writes: > From what I can see in RFC1014 (http://www.faqs.org/rfcs/rfc1014.html) > the XDR and IEEE formats coincide for floating point. The real48 format > (http://www.borland.com/techpubs/delphi/delphi5/oplg/memory.html) > looks similar enough to IEEE that a bit of byte-shifting should do > the conversion, and xdrlib.pack_double(data) gives you your number. XDR (and thus xdrlib) support float (real32) and double (real64), so it won't help for real48. They are all IEEE formats, but you have to split the real48 into its fields yourself. pack won't help, either. Regards, Martin From rolffreimuth at hotmail.com Mon Dec 31 13:37:35 2001 From: rolffreimuth at hotmail.com (Rolf) Date: 31 Dec 2001 10:37:35 -0800 Subject: Client-side web scripting in Python? Message-ID: <8abfe95a.0112311037.35fb4c2@posting.google.com> I am considering writing a simple application in Python. I am evaluating the possibility of writing the GUI for the app as a static HTML page that uses client-side script. I installed ActiveState's Python 2.1 and I can successfully write Python code on both the server and client sides, but I am having trouble doing a few things. Python does not seem to know about the document object which is accessible from Javascript. It seems necessary to be able to use that document object in order to modify the contents of the page. Is there any way to do *pure* python client-side scripting? Are there any good resources with examples of how to do it? Thanks in advance! Rolf From info at mjais.de Sat Dec 22 05:33:20 2001 From: info at mjais.de (Markus Jais) Date: Sat, 22 Dec 2001 11:33:20 +0100 Subject: Book "python programming patterns". anybody read this?? Message-ID: hello has anybody already read the book "python programming patterns" published by prentice hall. I thought this would be about design patterns in python but the review at amazon says different things about this book. but there is only one review there yet. I do not need another introduction to python, but if this is really an advanced book then I would like it. so, if anybody has already read this book it would be nice if she or he could give a short review of the book. thanks markus From syring at email.com Mon Dec 31 04:52:05 2001 From: syring at email.com (Karl M. Syring) Date: Mon, 31 Dec 2001 10:52:05 +0100 Subject: Python and Ruby: a comparison References: <3C2B9A61.EE1618DB@earthlink.net> <2WpX7.1145$0s5.714029@news20> <3C2E6876.4CBF45D4@geneva-link.ch> <465v2u4lv3illoviq19nhdf1r2vcknbakn@4ax.com> <3C2FF718.1020306@earthlink.net> Message-ID: "Edward Diener" schrieb > CLR is a lowest common denominator for language ideas which MS supports. > What happens when a language has good ideas which are more advanced than > what CLR supports. It is left out of CLR, or included into it with those > ideas stripped from the language to accomodate CLR. Sometimes the Holy > Grail of language interoperability has serious flaws to it. Well, they are fully aware of the the limitations and there is work on an improved IL (http://citeseer.nj.nec.com/444964.html). Karl M. Syring From llewin at oreilly.com Wed Dec 19 10:15:07 2001 From: llewin at oreilly.com (Laura Lewin) Date: 19 Dec 2001 07:15:07 -0800 Subject: Update Oreilly books? References: <3C1E3805.6090009@home.com> <20011219074308.GA30387@kub.nl> Message-ID: <47d2cd7c.0112190715.5898f485@posting.google.com> Hi, I'm glad you like the new pocket reference (Python Pocket Reference, 2nd Edition). It does fit well as an adjunct to Programming Python, 2nd Edition. As I've noted earlier, I have heard a lot of feedback on Programming Python, 2nd Edition requiring more language reference material, and we will certainly take that into account for the third edition (though we are not revising the book just yet--Lutz is working on Learning Python, 2nd Edition at the moment with David Ascher). In the meantime, I hope the new edition of Python Pocket Reference fills that gap (I'm hearing it does). Look forward to more feedback like this. I do take your comments very seriously. Laura LLewin at oreilly.com Kirill Miazine wrote in message news:... > * Bas van Gils [20011219 08:43]: > > > I agree... Programming Python is a massive treasure trove of topics. It > > > just covers so much. The Tkinter section is great and pretty extensive, > > > the networking and CGI areas are good as well. Then there are the > > > sections on system scripting and so forth. It is well rounded. My only > > > complaint is the excessive code redundancy--they could have shaved > > > 100-200 pages off the thing by not reprinting an entire code example > > > when one or two lines change... > > > > I am a believer as well :-) The first edition of PP was my intro in the > > world of Python. I still think mr. Lutz dit an excellent job on that > > Mine too, but I started with PP2. > > > one. I recently purchased the second edition and am reading it back to > > back. IMHO the book is written in a consistent manner, has lots of humor > > in it and many insightfull examples. > > Yes. But as I mentioned before, some people (including me) expected more > of a reference book (like Programming Perl is). But examples are always > great and Python Pocket Reference together with Programming Python make an > unbeatable combination. > > > However, I agree that some improvements should be made on the index. It > > is sometimes hard to find what one needs. Thats why I also bought > > "Python Pocket Reference"... > > I got my Python Pocket Reference 2 Edition yesterday. It's a lot better > than PPR1. Highly recommended. From jason-dated-1008366492.09220b at mastaler.com Thu Dec 6 16:48:10 2001 From: jason-dated-1008366492.09220b at mastaler.com (Jason R. Mastaler) Date: Thu, 06 Dec 2001 14:48:10 -0700 Subject: a smarter rfc822.dump_address_pair() ? Message-ID: I was looking for a Python function to take a "fullname" and corresponding e-mail address and return a string suitable for a From: header in an e-mail message. I found rfc822.dump_address_pair() which seemed perfect, except that all it does is throw double quotes around the fullname, and append the e-mail address surrounded by angle brackets. e.g, Python 2.1.1 (#14, Sep 13 2001, 13:12:38) [C] on irix646 Type "copyright", "credits" or "license" for more information. >>> import rfc822 >>> print rfc822.dump_address_pair(('Jason Mastaler','jason at mastaler.com')) "Jason Mastaler" >>> The problem here is that according to rfc2822, is it not necessary to double quote 'Jason Mastaler' as it contains no special tokens that require double quoting. It should be just: Jason Mastaler What it should do is first look for a character that cannot appear unquoted according to rfc2822 before it decides to double-quote the fullname. This is what most MUAs and MTAs do. So, is there a way to do this in the Python library that I haven't seen? If not, has anyone out there written code that does this that I could steal? Perhaps if you are writing your own MUA in Python or somesuch. Also, this issue may sound trivial, and it is. However, some e-mail users are rather picky about aesthetics, and I've actually gotten complaints about the unnecessary double-quoting from some users of my apps. Thanks. -- (TMDA - http://tmda.sourceforge.net) (Python-based SPAM reduction system) From LLewin at oreilly.com Fri Dec 28 19:53:26 2001 From: LLewin at oreilly.com (Laura Lewin) Date: 28 Dec 2001 16:53:26 -0800 Subject: O'Reilly book production (was Re: Wine applicability) References: Message-ID: Right. To clarify again...O'Reilly does not make anyone use Word. Word is an option, along with Frame, XML, StarOffice, others as well. Alex happened to start his book in Word, and changing mid-stream often presents conversion challenges (I'll talk with Alex about this separately.) Hope I've clarified this matter, please feel free to email me if anyone has further questions on ORA template options. Happy Holidays everyone! Laura LLewin at oreilly.com "A. Keyton Weissinger" wrote in message news:... > I've written two books for O'Reilly, one of which has two editions out. The > Word template works very well for me. Now FrameMaker, their production > application sucks, but fortunately you rarely have to deal with that. > > Keyton > > > -----Original Message----- > > From: python-list-admin at python.org > > [mailto:python-list-admin at python.org]On Behalf Of Aahz Maruch > > Sent: Friday, December 28, 2001 12:42 PM > > To: python-list at python.org > > Subject: O'Reilly book production (was Re: Wine applicability) > > > > > > In article , > > Alex Martelli wrote: > > >"Cameron Laird" wrote in message > > >news:200112281642.KAA24897 at starbase.neosoft.com... > > >>Alex: > > >>> > > >>>that's my primary need -- Word with O'Reilly customized macros &c, > > >>>as that's what I'm required to use for one of the books. So, I > > >> > > >> O'REILLY MAKES YOU USE WORD MACROS?!??!!? > > >> I've got to talk with those boys. That strikes me as an atrocity. > > > > > >"makes" is probably an overbid. The Cookbook I'm doing in XML with a > > >custom DTD, and that's just fine - I get to use VIM:-). But for the > > >Nutshell, that wasn't an option. > > > > Really? May you explain why? (I'm still hoping to do a book with > > O'Reilly and I *really* don't want to use Word.) > > -- > > --- Aahz <*> (Copyright 2001 by aahz at pobox.com) > > > > Hugs and backrubs -- I break Rule 6 > > http://www.rahul.net/aahz/ > > Androgynous poly kinky vanilla queer het Pythonista > > > > Tenth Virtual Anniversary: 3 days and counting > > -- > > http://mail.python.org/mailman/listinfo/python-list > > > > From max at alcyone.com Sun Dec 16 14:14:57 2001 From: max at alcyone.com (Erik Max Francis) Date: Sun, 16 Dec 2001 11:14:57 -0800 Subject: Idiomatic portable way to strip line endings? References: Message-ID: <3C1CF2B1.89D5D342@alcyone.com> Skip Montanaro wrote: > Even if you get the file from an operating system that uses another > line > ending convention? Then you should probably handle it on a case-by-case basis. After all, you might be getting an arbitrary binary file, or a "text" file that has an end-of-line convention that you've never seen before. -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ Laws are silent in time of war. \__/ Cicero Esperanto reference / http://www.alcyone.com/max/lang/esperanto/ An Esperanto reference for English speakers. From aleax at aleax.it Tue Dec 11 05:59:47 2001 From: aleax at aleax.it (Alex Martelli) Date: Tue, 11 Dec 2001 11:59:47 +0100 Subject: __init__ concerns References: Message-ID: <9v4ov301ukq@enews4.newsguy.com> "Peter Wang" wrote in message news:ab0cb7fb.0112102036.74cc8bfb at posting.google.com... > i'm subclassing UserDict to journal transactions to gdbm, and i'm > writing my own __init__() to take an open journal handle. > > it occurs to me that since i don't have *any idea* what the base > class's constructor needs or does, i should probably call it, in order > to ensure that my object is valid. then it occurs to me that i don't > know what the UserDict constructor looks like in its entirety, but it > must be callable with no arguments, since i can do "x = > UserDict.UserDict()". so the problem is kind of solved: i can just > call UserDict.__init__(self). > > however, the bigger question of properly calling parent classes' > constructors still remains. i figured you can always put a line into > the subclass's constructor: > > def __init__(self, *args): > apply(BASECLASS.__init__, (self,) + args) > > but i thought this was kind of a kludge. what is the proper python > idiom (or, failing that, the proper technique) for ensuring that a > subclass instance is properly initialized, especially when details of > the base class are unknown? I've posted on this thread, replying to Erik Max Francis and changing the subject to "a class's coupling to its bases (was Re: __init__ concerns)", as to the WHY, but I hope the reply can also be useful regarding the HOW. apply() is indeed pretty old, but I guess you'll have to stick with it if you're stuck on Python 1.5.2. In modern Python, def __init__(self, *args, **kwds): BASECLASS.__init__(self, *args, **kwds) # whatever else you need here is a very typical idiom, and I don't see any "kind of a kludge" are about it (and, of course, variations were args and/or kwds are tweaked somehow before delegating to a base class's __init__). Alex From uwe at rocksport.de Wed Dec 19 08:46:11 2001 From: uwe at rocksport.de (Uwe Schmitt) Date: 19 Dec 2001 13:46:11 GMT Subject: zope question Message-ID: <9vq5n3$d6t0t$1@hades.rz.uni-sb.de> Hi, in order to learn Zope product programming, I try to implement a little shop. The first step is a database of articles. How shall I implement this ? Shall I use ZClasses respectively instances of a self implemented object or shall I use a database adapter ? Which solution is faster ? I'm sorry if this is the wrong newsgroup for this question... Greetings, Uwe. -- Dr. rer. nat. Uwe Schmitt Uwe.Schmitt at num.uni-sb.de Universitaet des Saarlandes Angewandte Mathematik Building 36.1 Room 4.17 PO-Box 151150 D-66041 Saarbruecken Mobile:0177/6806587 Fax:+49(0)681/302-4435 Office:+49(0)681/302-2468 From tim at vegeta.ath.cx Thu Dec 27 05:17:20 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Thu, 27 Dec 2001 10:17:20 GMT Subject: REPOST: Re: install Python2.2 question References: Message-ID: <3$--$$-$$$$%_-$_$$@news.noc.cabal.int> graced us by uttering: > My computer operation system is Red Hat Linux7.0, > I install python2.2,it raise a error,How to correct? > it follows: > > [root at storm /root]# rpm -i python2-2.2-2.i386.rpm > error: failed dependencies: > libcrypto.so.2 is needed by python2-2.2-2 > libdb-3.2.so is needed by python2-2.2-2 > libexpat.so.0 is needed by python2-2.2-2 > libreadline.so.4 is needed by python2-2.2-2 > libssl.so.2 is needed by python2-2.2-2 v2.2 is the most recent release of Python and was probably built using libraries that didn't come on your distribution CDs. The rpm you're trying to install requires the listed rpms in order to function. You can try to search for them at one of the http://rpmfind.net/ mirrors. If you have a sufficient devel environment and you are up to the challenge, you can try to build Python yourself, but it may be more trouble than it's worth if you're new to linux. HTH Tim Hammerquist -- Little one, I would like to see anyone -- prophet, king or god -- persuade a thousand cats to do anything at the same time. -- Orange Cat, The Sandman ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Tim Hammerquist Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:06:13 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775829 27193 211.57.49.2 (31 Dec 2001 05:17:09 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:17:09 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From aahz at panix.com Fri Dec 28 12:41:30 2001 From: aahz at panix.com (Aahz Maruch) Date: 28 Dec 2001 09:41:30 -0800 Subject: O'Reilly book production (was Re: Wine applicability) References: <3C2A9D33.67FEC261@earthlink.net> <200112281405.IAA20884@starbase.neosoft.com> <200112281642.KAA24897@starbase.neosoft.com> Message-ID: In article , Alex Martelli wrote: >"Cameron Laird" wrote in message >news:200112281642.KAA24897 at starbase.neosoft.com... >>Alex: >>> >>>that's my primary need -- Word with O'Reilly customized macros &c, >>>as that's what I'm required to use for one of the books. So, I >> >> O'REILLY MAKES YOU USE WORD MACROS?!??!!? >> I've got to talk with those boys. That strikes me as an atrocity. > >"makes" is probably an overbid. The Cookbook I'm doing in XML with a >custom DTD, and that's just fine - I get to use VIM:-). But for the >Nutshell, that wasn't an option. Really? May you explain why? (I'm still hoping to do a book with O'Reilly and I *really* don't want to use Word.) -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 3 days and counting From johnroth at ameritech.net Thu Dec 6 20:45:05 2001 From: johnroth at ameritech.net (John Roth) Date: Thu, 6 Dec 2001 17:45:05 -0800 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C0FBAA8.F1A44304@attbi.com> <3C100EFF.6EEA6C7A@cosc.canterbury.ac.nz> Message-ID: "Greg Ewing" wrote in message news:3C100EFF.6EEA6C7A at cosc.canterbury.ac.nz... > Chris Barker wrote: > > > > I would > > argue that applications that deal with nanoseconds are of a different > > breed than those that deal with day, month, year type calculations. > > I'm not sure that's true. Consider something like generating > timestamps for transactions. They need to be unique over > a long time, and need quite fine-grained accuracy as well, > certainly much less than a second. Even microseconds might > be too coarse -- today's processors can do a LOT of > computation in a microsecond! I think it is true. You basically have two different kinds of date/time calculations: those based on the calendar, which is ultimately based on the rotation of the Earth on its axis, and those based on a uniform measure of time. In general, physicists and similar people involved with the real world need the second, people involved with business and such concerns need the first. It's possible to translate between them, but not easy. Timestamps are a special case: they usually need to be translatable into calendar terms, but they need more resolution than we normally give calendar based dates and times. For calendar based dates, I would suggest using the astronomical Julian date as the basis. It's well known and has published algorithms for translating from and to just about every known calendar system. John Roth From mikecrowe at bigfoot.com Sat Dec 29 19:05:54 2001 From: mikecrowe at bigfoot.com (MikeCrowe) Date: Sun, 30 Dec 2001 00:05:54 -0000 Subject: Reg-Ex and lambda optimization Message-ID: Hi folks, New to Python, and had this question. I couldn't figure out how to read a directory and filter the results by what I wanted. I basically wanted to read: dir\db*.* and get all names of files matching that spec. Here's the line I finally came up with: dbDirs = filter(lambda s: re.match('^db.*$',s), os.listdir(self.start)) I couldn't figure out how to us the FileList class, and this works. Here's my question: Is the re.match('^db.*$',s) compiled each iteration of the loop lookup? I don't notice this being slow, but was curious if this was bad coding. Mike From bsturk at news.rcn.com Mon Dec 10 22:32:38 2001 From: bsturk at news.rcn.com (Brian Sturk) Date: 11 Dec 2001 03:32:38 GMT Subject: Python Vim Module - works References: Message-ID: On Thu, 15 Nov 2001 01:10:13 GMT, Tim Hammerquist wrote: > Andrei Kulakov graced us by uttering: >> I'm sorry if this is a dumb question, but what's the purpose of this? > > Andrei Kulakov graced us again by uttering: >> I just don't understand what is the >> purpose, i.e. what would be a useful application of this module? >> >> I'm asking because I love vim and I used python vim module and if >> someone finds this thing useful, I might too.. Check out my terminal buffer python script for vim. I find it useful. :) http://www.nh.ultranet.com/~bsturk/vim.html Having just started programming with python, I find it easier to write scripts using it than vim's built in scripting language. > I can't seem to say what I mean, so let the author speak for himself: > > In correspondence, Tim Hammerquist wrote: >> Jonathan Gardner wrote: >> > The main idea that drove me to this insanity was getting a way to edit >> > files with vim and also to incorporate some kind of IDE with it. For >> > instance, Wouldn't It Be Great If (TM): You could edit Python classes >> > outside of the script, and see your changes immediately inserted into the >> > file? WIBGI you could connect your debugger (which cannot run inside Vim) >> > to Vim and have it highlight lines and show error messages? WIBGI you could >> > actually CHOOSE which editor you used for all the day-to-day stuff? This is >> > all the first step towards it. I'll be working on the above. At least for C and gdb. What does python use for a debugger? The script mentioned above will have hooks put in it for actions on the read/write ends to trigger actions in vim. Using the new glyph code you could possibly single step code all from within vim. I haven't tested any of this out, but I think it's possible. >> > All that I implemented at this point is the code to allow you to send >> > messages to a vim session. In the future, I will implement some code to get >> > the responses. And then maybe I'll be able to build an interface to allow >> > you to work directly with buffers, etc... >> > >> > Jonathan >> >> WIBGI is one of major driving forces of software development (as opposed >> to a suit's request..."It would be great if you could...for me. >> Thanks.") >> >> This will also allow Vim to offer the flexibility Emacs loves to claim, >> but without the monolithic size. Yay! =) And that's having the best of both worlds. -- .-----------------------------------------------------,-------. | Brian M. Sturk - http://www.nh.ultranet.com/~bsturk \ C/C++ | .> )\,^a__ |--------------------------| bsturk at nh.ultranet.com | Java | ( _ _)/ /-." ~ | http://www.telengard.com `---------------------------`------| `( )_ )/ | Telengard Technologies Inc. - NT/*nix UI & device drivers | _<_s_<_s '-------------------------------------------------------------' From ajw126 at student.cs.york.ac.uk Thu Dec 13 07:14:39 2001 From: ajw126 at student.cs.york.ac.uk (Andrew Wilkinson) Date: Thu, 13 Dec 2001 12:14:39 +0000 Subject: Games Made w/ Python References: <9v9gss$5hr$1@nntp9.atl.mindspring.net> Message-ID: <3C189BAF.2070502@student.cs.york.ac.uk> Gerhard H?ring wrote: > Le 13/12/01 ? 06:10, nobody at nowhere ?crivit: > >>Is Python an appropriate language for game programming? >> > > Yes! Check out http://www.pygame.org/ It rocks. > I've found it's excellent, I knocked up a quick wrapper for a DirectX graphics engine and have been programming an entire game using python. I get speed of development because of python, and speed of execution because all the drawing code is in compiled c++. It's perfect! When the game gets nearer completion I will move the python code over to c++. I've even been cosidering adding a text editor into the game, so I can edit the game files as the game runs. /me drools at the possibilities. Andrew From mixo at beth.uniforum.org.za Tue Dec 4 06:07:31 2001 From: mixo at beth.uniforum.org.za (mixo) Date: Tue, 04 Dec 2001 13:07:31 +0200 Subject: 'ioctl ' call in python (serial port reading) References: <3C0C8FF3.7060500@beth.uniforum.org.za> Message-ID: <3C0CAE73.6060304@beth.uniforum.org.za> Michael Hudson wrote: > mixo writes: > > >>I am current trying to drop 'RTS' (Request To Send) >>on a serial port. In 'c' I do the following : >> >>++++++++++++++++++++++++++++++++++++++++++++++++ >>. >>. >> >>int fd, mdlns;//fd is a file discriptor >>. >>. >> >>ioctl (fd, TIOCMGET, &mdlns); >>mdlns &= ~TIOCM_RTS; >>ioctl (fd, TIOCMSET, &mdlns); >>. >>. >>. >>+++++++++++++++++++++++++++++++++++++++++++++++ >> >>What would the equivilent code in 'python' be? >>How can I disable 'RTS' on a serial port? >> >> > > Something a bit like this: > > import fcntl, struct, termios > > s = fcntl.ioctl(fd, termios.TIOCMGET, "\000\000\000\000") > i = struct.unpack('l', s)[0] > i &=~ termios.TIOCM_RTS > s = struct.pack('l', i) > fcntl.ioctl(fd, termios.TIOCMSET, s) > > Not tested! > > Cheers, > M. > > Thanks. P.S I had to change "i &=~ termios.TIOCM_RTS" to "i = (i) & ~TIOCM_RTS" For one reason or another I don't "TIOxxxx" defined in "termios" module,so I also had to define them #from /usr/include/asm/termios.h TIOCMGET =0x5415 TIOCMSET =0x5418 TIOCM_RTS =0x004 From johnroth at ameritech.net Sun Dec 16 11:11:49 2001 From: johnroth at ameritech.net (John Roth) Date: Sun, 16 Dec 2001 08:11:49 -0800 Subject: Idiomatic portable way to strip line endings? References: Message-ID: "Tim Hammerquist" wrote in message news:slrna1pbik.6jf.tim at vegeta.ath.cx... > I've been trying to figure out the canonical way to strip the line > endings from a text file. > > In general, I can use: > > line = line[:-1] > or > del line[-1:] > > to strip the last character off the line, but this only works on > operating systems that have a one-byte line separator like Unix/Linux > ('\n'). The Win32 line separator is 2-bytes ('\r\n'), so this > solution is not portable. Huh? This works fine on Windows. The C library (which is what Python is based on, after all) is defined to convert the operating system dependent line end sequence to '\n' on input, and back on output. John Roth From grisha at modpython.org Wed Dec 5 17:43:39 2001 From: grisha at modpython.org (Gregory (Grisha) Trubetskoy) Date: Wed, 5 Dec 2001 17:43:39 -0500 Subject: os.path.exists throws Exception only w/ mod_python + MySQLdb 0.9.x In-Reply-To: References: Message-ID: This in the FAQ: http://www.modpython.org/FAQ/faqw.py?req=all#2.3 Grisha On 3 Dec 2001, L.C. wrote: > I am seeing a very curious behaviour and haven't been able to explain it. > I have apache 1.3.20 with mod_python 2.7.5 and MySQLdb 0.9.1 and if I try > the following code in a handler: > > import os.path > os.path.exists( "/tmp/nonexistentpath" ) > > It throws an Error: > [Errno 2] No such file or directory: '/tmp/nonexistentpath' > > The code works fine outside of apache, and what confuses me is that it > works fine with an older version of MySQLdb (0.3.x) but not with 0.9.x. > > If I create the directory in question exists() returns 1 as expected. > > -- > L.C. > From bkc at murkworks.com Sun Dec 30 16:43:03 2001 From: bkc at murkworks.com (Brad Clements) Date: Sun, 30 Dec 2001 16:43:03 -0500 Subject: CEPort: I Need help with compile.c bug In-Reply-To: <15407.28583.289894.153044@12-248-41-177.client.attbi.com> References: <3c2f4102_5@news.newsgroups.com> Message-ID: <3C2F41E7.3979.14C1FD51@localhost> Duh.. Just quietly ignore this post please ... (fyi, helpful to delete old .pyc files from old releases.. why they're not recompiled, I don't know..but seems to work now) (will now checkout the recompile issue) Brad Clements, bkc at murkworks.com (315)268-1000 http://www.murkworks.com (315)268-9812 Fax netmeeting: ils://ils.murkworks.com AOL-IM: BKClements From teg at redhat.com Mon Dec 31 13:39:12 2001 From: teg at redhat.com (Trond Eivind =?iso-8859-1?q?Glomsr=F8d?=) Date: 31 Dec 2001 13:39:12 -0500 Subject: Obtaining the IDLE GUI under Red Hat Linux 7.2 References: Message-ID: "Ahimsa" writes: > Greetings and compliments of the season to y'all > > Quick question. I understand that there is a way of obtaining a GUI for > Python 2.2. If so, what would be the way to get this under Linux Red Hat > 7.2? Anyone got any experience with this? Install the python-tools package ("up2date python-tools" will download it for you) -- Trond Eivind Glomsr?d Red Hat, Inc. From greg at cosc.canterbury.ac.nz Thu Dec 6 19:30:18 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Fri, 07 Dec 2001 13:30:18 +1300 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <83wv00mer7.fsf@panacea.canonical.org> Message-ID: <3C100D9A.57CC96D9@cosc.canterbury.ac.nz> Kragen Sitaker wrote: > > Given that Python has arbitrary-precision integers, it might be best > to just use them. Indeed. If the unit is small enough, floating point isn't really necessary, and using Python longs would eliminate any upper limit on the range. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From niemeyer at conectiva.com Wed Dec 5 07:53:57 2001 From: niemeyer at conectiva.com (Gustavo Niemeyer) Date: Wed, 5 Dec 2001 10:53:57 -0200 Subject: Scientific Libraries in Python In-Reply-To: <20011205104159.A1685@ibook.distro.conectiva> References: <9t1iqq$es0$2@peabody.colorado.edu> <3BF45CAF.9983E26A@home.net> <7a8L7.5503$_J2.576156@news1.cableinet.net> <83n113tgu6.fsf@panacea.canonical.org> <20011205104159.A1685@ibook.distro.conectiva> Message-ID: <20011205105357.B1685@ibook.distro.conectiva> > It depends on which BSD license it's licensed under, and if it has Please, forgive me. The revision in BSD license seems to state that old revisions are also affected by the change, so the BSD license revision doesn't matter. -- Gustavo Niemeyer [ 2AAC 7928 0FBF 0299 5EB5 60E2 2253 B29A 6664 3A0C ] -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 240 bytes Desc: not available URL: From andy47 at halfcooked.com Tue Dec 4 20:19:33 2001 From: andy47 at halfcooked.com (Andy Todd) Date: 5 Dec 2001 01:19:33 GMT Subject: Linux Kernel Design and Why Python is Rad References: Message-ID: Ric Werme wrote in : >Jonathan Gardner writes: > >>Check out this link: http://kerneltrap.org/article.php?sid=398 > >>Linus Torvalds on design: "Nothing successful has every been designed. >>It has evolved." Fascinating article, anyone who professes to build software should read it, and then have a good long think about what it means and what he is saying. > >>Everyone else: "No wait a minute, that's not what this book says! And >>that's not what my teacher said!" > >Everyone else has not read "The Mythical Man-Month"? It states quite >clearly that you should "Plan to throw one away." It's still one of the >few books on system design that's worth reading. Ah, but what Brooks also says (in "No Silver Bullet" if memory serves) is that programs (and systems) that 'evolve' beat the pants off programs that are iterated. I agree that everyone should read "The Mythical Man-Month". Its amazing that it was written over twenty five years ago and still isn't as widely read as it should be, for instance by most of the project managers I've ever worked with ;-) Whilst you are reading about the process of development, don't miss Joel on Software (http://www.joelonsoftware.com/). He has some interesting things to say on many subjects, and specifically for this thread on the adviseability of throwing away perfectly good software and starting from scratch, mainly in relation to Mozilla. Joel isn't the free software role model that Linus is but he provides a fascinating corollary. > >Jeez, kids these days.... Its not like it was back in the good old days is it? Now where is Guido's time machine when you need it ... >-- >"When we allow fundamental freedoms to be sacrificed in the name of real >or perceived emergency, we invariably regret it. -- Thurgood Marshall > Ric Werme | werme at nospam.mediaone.net > http://people.ne.mediaone.net/werme | ^^^^^^^ delete Regards, Andy -- Content free posts a speciality From wurmy at earthlink.net Sat Dec 29 15:57:36 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Sat, 29 Dec 2001 20:57:36 GMT Subject: REPOST: Re: Was that to inpolite? Re: Call for a small program References: <3C2BAEF3.CC34B8DD@htp-tel.de> <3C2E0D55.9EC9B67F@htp-tel.de> Message-ID: <9$--$$_----__$%$_$@news.noc.cabal.int> Tom Karas wrote: > > Hello out there. > > A few quick questions: > > Was my "Call" to inpolite? > > Was it the wrong place / newsgroup to ask? > > I just wonder, because there wasn?t even a reaction like "Go away" or > "Plonk / Killfile" > > This may sound odd, but i would be even willing to pay for a solution > that would > fit the basic needs (running on windows and linux and some features) I don't see the message you're referring to. When did you post it? --Hans ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Hans Nowak Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E2D00.A8E511EB at earthlink.net> Control: cancel <3C2E2D00.A8E511EB at earthlink.net> Date: Mon, 31 Dec 2001 04:50:56 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774591 27193 211.57.49.2 (31 Dec 2001 04:56:31 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:56:31 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jason at jorendorff.com Wed Dec 19 12:31:27 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Wed, 19 Dec 2001 11:31:27 -0600 Subject: how to free PyArg_Parse'd args? In-Reply-To: <20011219.120523.74603.8495@localhost.localdomain> Message-ID: Robert Nikander wrote: > If I create a C extension class with a member char * name, and > I get the name initially from a PyArg_ParseTuple(args, 's'...), > Who should I call to free it when the objects tp_dealloc slot is called? > I am trying PyMem_Del/Free( obj->name ) but am getting a seg fault. Don't free it. You're given a pointer to the actual char buffer within the provided string object. It's like a borrowed reference. -- Jason Orendorff http://www.jorendorff.com/ From nbecker at fred.net Mon Dec 24 08:26:52 2001 From: nbecker at fred.net (nbecker at fred.net) Date: 24 Dec 2001 08:26:52 -0500 Subject: /usr/bin/env: python: No such file or directory References: <9vivft$593$1@peabody.colorado.edu> <171220010818339518%jwbaxter@spamcop.net> <9vnvue$m5d$1@peabody.colorado.edu> <9vo6ng$mhs$1@nntp6.u.washington.edu> Message-ID: The correct solution is for Redhat to put: #!/usr/bin/python1.5 I proposed that to them before and they rejected it. From ergeorge at worldnet.att.net Tue Dec 18 12:06:08 2001 From: ergeorge at worldnet.att.net (eg) Date: 18 Dec 2001 09:06:08 -0800 Subject: Listbox + scrollbar refresh problem Message-ID: <732d35a1.0112180906.2c742651@posting.google.com> Ok, I have a listbox & scrollbar tied together as described in the pythonware documentation.(http://www.pythonware.com/library/tkinter/introduction/x5453-patterns.htm) I also have a polling method setup with after() function so that my listbox is refreshed every few seconds The problem is that I can't seem to preserve the listbox view over the refresh. I can use the listbox.see() function to make sure the current selection is visible, but the scrolled position moves. It seems I should be able to make this happen by saving the scrollbar position with: scroll=scrollbar.get() before I clear & reload the listbox, and then restore it after the new data is loaded: scrollbar.set(scroll[0], scroll[1]) But it doesn't work!?! I've pasted an example below. Any help is appreciated! Eric ################################################################# #!/usr/bin/python2 import sys import os import glob import time import string from Tkinter import * class Example1: def __init__(self): self.root = root = Tk() self.root.minsize(300, 200) self.row = 0 self.root.rowconfigure(0, weight=1) self.root.columnconfigure(0, weight=1) self.root.columnconfigure(1, weight=0) self.listbox = Listbox(root, selectmode=SINGLE) self.listbox.grid(column=0, sticky=E+W+N+S) self.scrollbar = Scrollbar(root, orient=VERTICAL) self.scrollbar.grid(row = self.row, column = 1, sticky=W+N+S) self.scrollbar.config(command=self.listbox.yview) self.listbox.config(yscrollcommand=self.scrollbar.set, font='courier') self.load_data() self.poll(5000) root.mainloop() def poll(self, interval): self.load_data() self.root.after(interval, self.poll, interval) def load_data(self): select = self.listbox.curselection() scroll = self.scrollbar.get() print "Scroll: ", scroll self.listbox.delete(0, END) for i in range(20): self.listbox.insert('end', `i`) if len(select): self.listbox.select_set(int(select[0])) self.listbox.see(int(select[0])) self.scrollbar.set(scroll[0], scroll[1]) x = Example1() From jparise at cmu.edu Sun Dec 9 14:55:31 2001 From: jparise at cmu.edu (Jon Parise) Date: Sun, 9 Dec 2001 14:55:31 -0500 Subject: comunicating with ports ( com, lpt1) In-Reply-To: <29A97D00F387D411AC7900902770E14802EAFEC3@LCOEEXC01> References: <29A97D00F387D411AC7900902770E14802EAFEC3@LCOEEXC01> Message-ID: <20011209145531.A3469@andrew.cmu.edu> On Sun, Dec 09, 2001 at 09:32:01AM -0300, Alves, Carlos Alberto - Coelce wrote: > How could I comunicate through the com ports ( com1,com2,com3.LPT1 etc)? > I mean, send and recieve data through those interfaces. > Is there any module for this?what?! Under Windows, there's the winioport module: http://www.geocities.com/dinceraydin/python/indexeng.html -- Jon C. Parise (jparise at cmu.edu) . Entertainment Technology Center http://www.cs.cmu.edu/~jparise/ : "Making the fun things funner." From tim at worthy.demon.co.uk Sat Dec 22 16:12:58 2001 From: tim at worthy.demon.co.uk (Tim Howarth) Date: Sat, 22 Dec 2001 21:12:58 GMT Subject: Can I trust mktime ? Message-ID: <67090aed4a.tim@worthy.demon.co.uk> To find the date in 4 months time I've added to the months element of a list copy of a localtime tuple. (Which obvioulsy means months can be >12.) Is converting this to a time() value with mktime then reading back with localtime() considered correct/safe ? All I know is it seems to work, I'd rather not load something like mxDateTime as it's a simple task. now=time.localtime(time.time()) print now then=list(now) then[1]+=4 then=time.mktime(then) then=time.localtime(then) print then -- ___ |im ---- ARM Powered ---- From david_j_dawkins at spamless.hotmail.com Thu Dec 13 22:09:40 2001 From: david_j_dawkins at spamless.hotmail.com (David Dawkins) Date: Fri, 14 Dec 2001 03:09:40 -0000 Subject: Preserving program structure Message-ID: So I'm using IDLE, and Alt-F5 tells me I have a problem with indentation. It seems I had (inadvertently) mixed tab and space characters. No amount of "tabbifying" and "untabbifying" resolved the issue, so I had to shift *everything* to the left-margin, and re-create the indentation with a consistent scheme (8 space hard tabs). While doing so, I stuffed up a lot of the program logic, because it wasn't always obvious which block a particular statement belonged in. This dismayed me intensely. How do experienced Python programmers avoid this problem? I don't see much code out there with comments like "# endif", etc. David -- david_j_dawkins /*AT*/ hotmail.com From tim at vegeta.ath.cx Thu Dec 27 14:12:14 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Thu, 27 Dec 2001 19:12:14 GMT Subject: The Python community needs a lighter heart to it. References: <40dbad98.0112261431.3e928cf2@posting.google.com> Message-ID: Chris Gonnerman graced us by uttering: > Tim Hammerquist wrote: > > Your boredom is not cause per se to change the society at large. > > I second that motion. > > I just have one question: Who is Andrew Nguyen and why should we > follow him around anyway? Excellent question! We're gonna seem a few answers. FETCH THE COMFY CHAIR! Tim Hammerquist -- How do I type "for i in *.dvi do xdvi i done" in a GUI? -- discussion in comp.os.linux.misc From craig at redtree.com Sun Dec 23 13:11:36 2001 From: craig at redtree.com (Craig Morris) Date: Sun, 23 Dec 2001 18:11:36 GMT Subject: inproc server with gordon mcmillan's installer References: <1009084826.534637@critter.monarch.net> Message-ID: <1009131425.26281@critter.monarch.net> > You shouldn't have to do anything special. If your class's _reg_clsctx_ has > the CLSCTX_INPROC bit flag on, you'll get a dll and a little extra > registration logic. It's the _reg_clsctx_ flag that drives this - you don't > have to use any command line options or anything else. I had that right, but the problem turned out to be that I had set a different names for the root name for the dll and the exe. This had come about because I did not want the name prepended by drive, but if changed the name of the dll I would get an error when my VB script tried to create my object, even for local server. Changing the name of just the exe worked fine for the local server version though and I then forgot they were different when I build the inproc version. So I guess I have another silly question, what is the correct way to change the exe and dll names so that they don't have the drive prefix? BTW as long as I have your ear (eyes), I want to thank you for all the excellent work you have contributed. Your python C++ API has been a great help to me. :-) -- Craig Morris Fernie, BC, Canada http://redtree.com From ekelly at lucent.com Wed Dec 5 06:14:38 2001 From: ekelly at lucent.com (Eoin Kelly) Date: Wed, 05 Dec 2001 11:14:38 +0000 Subject: Jython Message-ID: <3C0E019E.BF5179C7@lucent.com> Hello, Can anyone please tell me of references to information regarding thread safety issues with jython Thank in adv, Eoin From grey at despair.dmiyu.org Thu Dec 27 21:13:52 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Fri, 28 Dec 2001 02:13:52 -0000 Subject: State of the SysAd art (was: vi or emacs for editing Python on Linux?) References: <2E48C714A6E1FBA1.19DE5ADEBF7F088A.DF90F2C1E6CC9E7C@lp.airnews.net> Message-ID: On 27 Dec 2001 19:53:22 -0600, Cameron Laird wrote: > I entirely agree that in-place editing is not strictly necessary. I was > arguing for ssh, CVS, and IP reacha- bility while some readers were ... > well, younger than they are now. At the same time, I ask for tolerance of > our brethren who cope with more conservative computing regimes. Which is why I wrote my response in the neutral and left out the entire "vi is everywhere" argument that most vi people trot out. The editor, especially vim, stands on its own without resorting to bogus arguments that are no longer applicable in anything remotely approaching the majority of cases. -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From richard at bizarsoftware.com.au Mon Dec 3 18:07:41 2001 From: richard at bizarsoftware.com.au (Richard Jones) Date: Tue, 4 Dec 2001 10:07:41 +1100 Subject: Draft PEP: string interpolation with backquotes In-Reply-To: <20011202170805.A36879@hishome.net> References: <20011202080626.A76724@hishome.net> <20011202170805.A36879@hishome.net> Message-ID: <200112032307.fB3N78327930@bigboy.bizarsoftware.com.au> On Monday 03 December 2001 09:08, Oren Tirosh wrote: > On Sun, Dec 02, 2001 at 02:44:22PM -0500, Tim Peters wrote: > > Oren Tirosh wrote: > > > The prefix "i" stands for "interpolation" or "in-line". Within > > > a string with an "i" prefix an expression enclosed in backquotes is > > > converted into its string representation > > > > That's ambiguous, and this is a real problem: Python generally has two > > forms of "string representation", str() and repr(). Unfortunately for > > the proposal, backticks are a shortcut for repr() but str() is probably > > more useful in this context. > > I meant str(). repr() isn't very useful when embedding strings because of > the quotes. I should have been more specific. Yes, this is inconsistent > with the standard use of backquotes which is equivalent to repr(), not > str(). I believe this is an acceptable compromise since it does the > Right Thing for formatting. I wonder how ABC's backquotes worked inside > strings. This would then cause confusion - why not revert back to using $ as the magic interpolation character? It has no prior history in Python and therefore no preconceived ideas exist as to what its result might be. It does have some history outside of Python as a string interpolation character though, in many, many systems... It could be either i"the value of x is $x$ and f(x) is $f(x)$" or, if there really is a way of disambiguating it, just the leading "$"... Richard From mwh at python.net Fri Dec 21 16:22:47 2001 From: mwh at python.net (Michael Hudson) Date: Fri, 21 Dec 2001 21:22:47 GMT Subject: age of new pythonistas References: Message-ID: "Fredrik Lundh" writes: > Tim Peters wrote: > > I suspect Fredrik Lundh also knows Mark's age, but you've seen > > how hard it is to get a straight answer from a bot. > > iirc, Barry's a few years older than Mark (or was it the other > way around?), and I'm a few years older than my sister. Another game: who's the oldest/youngest developer in the project at sf? I don't know of any younger than me (23), but there are rather a lot now... Cheers, M. From frankimmich at gmx.de Fri Dec 7 03:20:17 2001 From: frankimmich at gmx.de (Frank Immich) Date: Fri, 7 Dec 2001 09:20:17 +0100 (MET) Subject: How to use NetUseGetInfo() ? Message-ID: <11468.1007713217@www46.gmx.net> Hello there, I have a question concerning the win32net module. I want to map the networkpath (UNC) to the corresponding network resource with Python. E.g. E: = \\server1\dr1\dir2 Therefore, I think, I have to use NetUseGetInfo() ? But I get the following error thread: import win32net > dict = win32net.NetUseGetInfo( None, 'E:' , 0 ) > > Traceback (most recent call last): > File "C:\info.py", line 4, in ? > dict = win32net.NetUseGetInfo( None, 'E:' , 0 ) > pywintypes.api_error: (2250, 'NetUseGetInfo', 'Die Netzwerkverbindung > konnte > nicht gefunden werden. This tells me that the Network connection couldn’t be found... But the DOS command: net use E: works fine !!! What’s wrong. Am I using the NetUseGetInfo() command correct ? Thanks for help Ciao Frank -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From LLoeffler at home.com Thu Dec 6 20:46:32 2001 From: LLoeffler at home.com (Luke) Date: Thu, 06 Dec 2001 19:46:32 -0600 Subject: staticmethod and __call__ References: Message-ID: <3C101F78.20505@home.com> Being new to Python all that code was way over my head, but why isn't f() defined as: def f(self): print 'An Item' ?? > class Item: > def f(): print 'An Item' From erik at pacific-shores.com Fri Dec 28 11:25:39 2001 From: erik at pacific-shores.com (Erik Myllymaki) Date: Fri, 28 Dec 2001 16:25:39 GMT Subject: base64.decodestring gives binascii.error References: <3C2C03CB.7030000@pacific-shores.com> Message-ID: <3C2C9D79.9050501@pacific-shores.com> The '_' and '!' were in the original string that was then encoded, not in the resulting encoded string. Alex Martelli wrote: > "Erik Myllymaki" wrote in message > news:3C2C03CB.7030000 at pacific-shores.com... > >>should base64.decodestring give a binascii.error if it encounters >>special chars like '_' and '!' ? >> > > Makes sense to me; after all, such characters should never be > in a string produced by base64, so the data must have been > damaged in transit -- raising an exceptions seems appropriate. > > > Alex > > > > -- -- Erik Myllymaki erik at pacific-shores.com From jason at jorendorff.com Thu Dec 20 12:02:44 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Thu, 20 Dec 2001 11:02:44 -0600 Subject: Huge Dicts and perfomance In-Reply-To: <3C221133.4090701@movilogic.com> Message-ID: This is an interesting problem. I have a few questions... > I am making an application where i want to store links betwen nodes. So > i have a dictionary where i store the objects. > > dict[0][objectname] = object > > the [0] is because i to signify a link betwen obj-a and obj-b, i do: > > dict[1][(obj-a, obj-b)] = obj(a, b) > > and so on, to six levels deep. I think I see. Is it kind of like this? dict[0][a.name] = a dict[1][(a.name, b.name)] = LinkObject(a, b) But I still can't tell what you mean by "six levels deep". Is it like this? dict[2][(a.name, b.name, c.name)] = LinkObject(a, b, c) dict[3][(a.name, b.name, c.name, d.name)] = LinkObject(a, b, c, d) etc. Or is it like this? dict[2][(link1.name, link2.name)] = MetaLinkObject(link1, link2) dict[3][(mlink1.name, mlink2.name)] = MetaMetaLinkObject(mlink1, mlink2) etc. Or something else? > and i also store links betwen dict[x][y] and other nodes (the stored > object has those links) All right... part of what's confusing me is the words "object", "link", and "node". Does "node" mean "any object or link"? Or is "node" == "object"? > and i want to say for example, if i have a and b, what other nodes > usually come togheter? so i follow the links and find the root nodes (z, > x) and the groups (a, z) and (s, x). What does "usually come together" mean? > the main problem of course is that doing it this way, performance sucks. > I took me nothing to code it, but it takes to much to run (more than > coding). So, any ideas on how to achieve my goal in a better (faster) way? If you could be clearer about what you are trying to do, I think someone here could help. If you post a little bit of sample code, you'll get more responses. ## Jason Orendorff http://www.jorendorff.com/ From sholden at holdenweb.com Thu Dec 6 16:53:56 2001 From: sholden at holdenweb.com (Steve Holden) Date: Thu, 6 Dec 2001 16:53:56 -0500 Subject: gadfly and autonumber/auto_increment/guid? References: Message-ID: "Lutz Schroeer" wrote ... > Hi, > > i've searched through the Net for hours now and couldn't find any hint: > > How do I create an autonumber/auto_increment/guid or the like in a table > using the gadfly DB? > > Please help, I really don't want to switch to M$ Access and VB :-)) > Gadfly doesn't support such refinements. You could, however, use the GUID creation routine in the Win32 extensions if you have them loaded. You need to do: >>> import pythoncom >>> s = str(pythoncom.CreateGuid()) >>> print s {B4CD0B60-EA69-11D5-8364-0060978B74F3} >>> Hope this helps. regards Steve -- http://www.holdenweb.com/ From arash at froggy.com.au Tue Dec 11 11:55:53 2001 From: arash at froggy.com.au (Arash Partow) Date: Wed, 12 Dec 2001 03:55:53 +1100 Subject: New Project - C.O.R.E Message-ID: <3c164330.0@mercury.planet.net.au> Hi, We are starting a new project totally unique from anything anyone has ever set out to design and build. we will be working in many areas, in order to build a fully cognitive system which will be able to intelligently understand "objects" of specific data, be it visual,audio or logical. The project will be called C.O.R.E which stands for Cognitive Object Recognition Enterprise. This project will not be on Open-Source, it will be a fully private venture, all participants will be entitled to their fair share of profits gained from the development of IP rights etc. we are looking for people who are willing to participate in C.O.R.E seriously and who are willing to put time into C.O.R.E. We need dedicated, intelligent, enthusiastic and highly motivated people, C.O.R.E will be an international project, and hopefully a whole company will be created soon which would also include physical headquarters for the C.O.R.E's research and development. we need people with skills in the following areas: 1.) Artificial intelligence and intelligent systems 2.) Neural Networks and Genetic Algorithms 3.) Image and Audio processing 4.) High end predicate mathematics and logic 5.) Neurology and cognitive psychology 6.) Databases and any other fields which maybe of use in the development of highly sophisticated logic systems. if you would like to find out more about the CORE project, feel free to read our project abstract which can be found at: http://www.core-project.cjb.net If also you have any questions feel free to e-mail them to: arashp at hotmail.com For now have fun and stay young Arash Partow PS: Please forward this on to anyone you know that might be interested in C.O.R.E From josephwinston at mac.com Wed Dec 19 18:46:18 2001 From: josephwinston at mac.com (Jody Winston) Date: Wed, 19 Dec 2001 23:46:18 GMT Subject: Bus Error in HP-UX 11.00 References: <950ee0f0.0112172230.1d7eba3f@posting.google.com> Message-ID: imvenki at hotmail.com (venkatakrishnan.k) writes: > Hai all, > I have a program which runs good in linux systems.When i tried to port it to > HP i got this strange error called "bus error" and my program core-dumped. > Since i am new to HP i dont know how to solve it and i am not even sure > whether the problem lies with my code. > I would be very pleased to get a solution for this as this is very urgent. > > bye, > venkatakrishnan.k You didn't give us much to go on. o What's the python version o What modules are being used o Did you compile the dynamic modules correctly using something like (aCC -Wl,-E -Wl,+s -Wl,+b$(HOME)/Tools/$(FULLNAME)/lib/python2.2/lib-dynload) Try running with python -v to see what's going on. Run python under a debugger. -- Jody Winston From ssthapa at classes.cs.uchicago.edu Wed Dec 19 21:44:19 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Thu, 20 Dec 2001 02:44:19 GMT Subject: Python CPAN beta test References: Message-ID: MikeK wrote: >Then, I told ciphon (or is it siphon? It's called both in various >places) to use RPMs. That was a mistake. Not one package installed. >But when I tried again, telling it NOT to use RPMs, everything was >smooth sailing. > >Here's the tail end of an attempt to install egenix-mx-base using >RPMs, where the error occurs. If you need more info, email me: Yes, there was a bug in installing rpms. It assumed distutils put rpms in the top level directory when they were placed in a subdirectory. Ciphon 0.3.4 should fix this, at least I was able to install packages as rpms using this version. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From sfeil at io.com Sat Dec 22 20:43:07 2001 From: sfeil at io.com (Steven Feil) Date: Sun, 23 Dec 2001 01:43:07 GMT Subject: Preserving program structure References: Message-ID: Several years ago I came up with a song that fixes this problem. (sing to the tune of the mexican hat dance) I hate embeded tabs, becouse the suck so much! I hate embeded tabs, becouse the suck so much! I hate embeded tabs, becouse the suck so much! (repeat) Basicaly don't use tabs! In article , "David Dawkins" wrote: > So I'm using IDLE, and Alt-F5 tells me I have a problem with > indentation. > > It seems I had (inadvertently) mixed tab and space characters. No amount > of "tabbifying" and "untabbifying" resolved the issue, so I had to shift > *everything* to the left-margin, and re-create the indentation with a > consistent scheme (8 space hard tabs). > > While doing so, I stuffed up a lot of the program logic, because it > wasn't always obvious which block a particular statement belonged in. > This dismayed me intensely. > > How do experienced Python programmers avoid this problem? I don't see > much code out there with comments like "# endif", etc. > > David > -- > david_j_dawkins /*AT*/ hotmail.com > > -- ======================================================================== Steven Feil | Gram-pa, back at the turn of the .~. Programmer/Developer | century, why did people use an /V\ sfeil at io.com | operating system, when they were not // \\ | allowed to see the source code? (X_X) ======================================================================== From mrchameleon at hotmail.com Wed Dec 5 17:02:41 2001 From: mrchameleon at hotmail.com (Chris Reay) Date: 5 Dec 2001 14:02:41 -0800 Subject: The Best Smart Card Story You've Never Heard References: <3C0E39FD.F74E4014@med.uni-tuebingen.de> Message-ID: <7652139e.0112051402.4470d817@posting.google.com> This may not be useful to you, but I read the news by pointing at http://groups.google.com/groups?hl=en&lr=&safe=off&group=comp.lang.python and thus have an unclogged and (mostly) spam-free mailbox. HTH, yours Chris From paul at boddie.net Thu Dec 6 07:19:04 2001 From: paul at boddie.net (Paul Boddie) Date: 6 Dec 2001 04:19:04 -0800 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <3C0C8330.79D0E598@mega-nerd.com> <23891c90.0112050750.2bed3aa8@posting.google.com> Message-ID: <23891c90.0112060419.7a9f9185@posting.google.com> Courageous wrote in message news:... > >Can you give an example of how spaces must creep in on continuation > >lines? > > ##--snip; not in particular the column-positioning of the "or". If > ## tabs are used here, it will be misaligned with other > ## tabstop stettings for certain > > if isinstance(f, future.Step) or \ > isinstance(f, future.Status) or \ [...] I'm pretty sure that this would go against Guido's style guide, which just goes to show that that document is only prescriptive and is followed only selectively by most Python coders. (Try claiming that to someone who cites the "4 spaces for one indentation level" advice as law, though!) Of course, a proportional font would cause the space between the closing brackets and the "or" keywords to vary... > ##--snip; in this case, the continuation line is lined up on the > ## string boundary to create some congruity between the code > ## and the message produced > > log.Fatal("Unexpected RETURN intercepted from user code.\n" > "This is almost certainly due to an inappropriate explicit\n" [...] I can actually understand why one would want to do this, but in my tab-only private universe I move onto the next line after the opening bracket: log.Fatal( "Unexpected RETURN...\n" "This is almost certainly..." Note that I've simulated the effect of tabs because we all know that you can't trust news/mail software to deliver them (and IE won't let me enter any in the text box I'm using to compose this message), but you can practise this with spaces too. > ##--snip; here, like the or, the actions are put into a column. > ## simple actions, organized like this are both compact and > ## readable. > > if methodname==self.task.name: methodname="-" > else: methodname=methodname[0:20]+"()" [...] This is similar to your first case. Personally, I'm not a huge fan of doing this kind of thing. > > am aware that there's a lot of hostility to tab > >usage in various open source projects, but that's really a consequence > >of the tools around on many platforms today. > > I don't think so. Even word will get fucked up if someone tweaks > the positioning of the tabs in the ruler. The reason this problem > doesn't make itself more evident is that the document carries its > tabstops with it. Well, I'd certainly be annoyed if the average word processor document didn't retain its tabstop settings between editing sessions. Back in the days when I used word processors and desktop publishers more, I actually preferred to use frames to give me the layout for many of the things which tabs could potentially have been used for, and one finds out that spaces, tabs, margins and frames are a continuum of tools each providing a tradeoff between being sufficient and convenient, and being most appropriate. Tabs have the weakness that they don't always move to a given horizontal location (even if that is the intention) since the cursor might have moved past that location. One might wonder what this has to do with Python. Given that Python has, in a sense, decided against explicit structuring of code within constructs (like having the equivalent of "frames" and playfully illustrated in an XML example provided elsewhere in this thread), the "blunt" tool of indentation is the only thing we have to instruct the interpreter appropriately. Consequently, those of us who have the tools available to us can choose to utilise tabs or spaces to perform this instruction, and it seems to me that tabs are the better, "sharper" tool, given that only leading indentation really matters to the Python interpreter. Of course, there's another interpretation of the tab as a structural markup character, and this arises in things like tab-separated value files; the tab *always* mandates movement to the next location or "slot", and is analogous to the element in HTML 3.2. By using tabs in this fashion (which is possible at the start of a line), I believe that one can be liberated from the fixed-font, "reserved number of columns at the start of a line" mindset that has caused some people to provocatively use the word "Fortran" when referring to Python. (Even if that is going a bit too far!) Paul From jtlispl at poczta.NOSPAM.onet.pl Mon Dec 17 04:30:10 2001 From: jtlispl at poczta.NOSPAM.onet.pl (Tomasz Lisowski) Date: Mon, 17 Dec 2001 10:30:10 +0100 Subject: Idiomatic portable way to strip line endings? (fwd) References: Message-ID: <9vkdrc$pm3$1@news.onet.pl> Uzytkownik "Lulu of the Lotus-Eaters" napisal w wiadomosci news:mailman.1008535340.29425.python-list at python.org... > m.bless at gmx.de (Martin Bless) wrote: > |To be on the safe side here's what I sometimes use: > |def removecrlf( line): > | """Remove \r\n or \n from end of string.""" > | if line[-1:] == '\n': > | if line[-2:-1] == '\r': > | return line[:-2] > | else: > | return line[:-1] > | else: > | return line > > This is probably not quite safe enough. MacOS lines end with '\r'. > Adding that case is left as an exercise to readers (I like the regex > version that someone--Skip?--posted in this thread). Why not use the string.rstrip() function? Tomasz From peter at engcorp.com Tue Dec 4 02:26:50 2001 From: peter at engcorp.com (Peter Hansen) Date: Tue, 04 Dec 2001 02:26:50 -0500 Subject: Python evangelists unite! References: <3C07884E.75E18DF7@engcorp.com> <9ue2o2$b344@news1.gtech.com> <3C0B08F3.C9CDE885@engcorp.com> <9ugrrt$b345@news1.gtech.com> <3C0C526A.C7CB4FD0@engcorp.com> <9uhn3i$b348@news1.gtech.com> Message-ID: <3C0C7ABA.10C90FD9@engcorp.com> Peter Milliken wrote: > > "Peter Hansen" wrote: > > ... we have had an order of magnitude > > fewer reported bugs, and have productivity at least two, probably > > three times, higher than on any project I've worked on in the past. > > These numbers are largely attributable to Python, and that makes > > using it good business sense no matter how you look at it. > > > > Good to hear your experiences. You look after 14 people - well done, that's > a big team, do you manage to do any development yourself with that number of > people to supervise? I never could with teams that size, it drove me to > distraction...... Some. Enough for now. Not much. > What is the basis for your comparisons though? You state that you have > achieved fewer bugs and increased productivity using Python. (just for my > information :-)) it would be nice to know over what other language you claim > these improvements. C, C++, Java, Delphi as primary languages involved in the comparison. The kind that emphasize (obviously not C :-) things like data hiding, type checking, compile-time checking, and so on (the things too often claimed as being required for writing "real" programs but lacking from Python and therefore making it unsuitable). Many others before and along with these with no better results. (I did learn Ada, but not Ada95. :-) (But after 100,000 hours of writing software or thinking about it, I forget which languages I used to know.) > Have you considered that there might be other languages > available that provide similar order of magnitude improvements over Python? Except in specialized areas, very, very doubtful. I'll consider it seriously when I see the slightest evidence of such a thing. I do keep abreast of the industry and stay alert for more data. > What was the basis for your choice of Python as the development language of > choice? i.e did you perform any studies into available languages, or did > someone recommend it? If it was recommended, what was the basis of the > recommendation? Have you considered mixing languages i.e. Python for the > bits that suit python and some other language for the rest? We contrasted it with other languages with similar capabilities (fitting our requirements at the time), including Perl, TCL, Ruby, others. Not recommended by anyone, except as discovered during research. And yes, naturally we mix Python as needed. We just rarely find the need, and more often than not find that the benefits of sticking with Python outweigh the minor apparent advantages of diluting our focus. (For example, C is used from time to time for performance or integration with hardware. Almost all other areas we now find more effective to do with Python, increasing the gains from code reuse, training, utilities, test frameworks, and so forth. If we encounter a situation where another language will clearly be better we'll use it.... but we're still waiting.) > Having done some industrial control software when I was a > "pup" what features of Python do you find useful here that you can't find in > some other language? Does the interpreted nature of Python cause any speed > difficulties? What is the required responsiveness of yoir problem domain? Speed is not an issue. As I've written elsewhere, I believe 95% (or was it 98% last time? :-) of all optimization is an unnecessary waste of programmer time. We recently had to optimize a routine in Python. It's an unusual occurrence. Responsiveness varies from tens of microseconds (some embedded stuff for which we obviously use straight C, not Python) up to several seconds, where Python is more than adequate even on 100MHz 486. Advantages of Python (not necessarily missing from other languages, but perhaps not available in any single other one, and certainly not implemented in the same, simple, effective way) include its introspection, dynamic typing (yes, an advantage!), named arguments, incredible readability, maintainability, and learnability, its interpreted nature (interactive console lets developers test small portions of code during development, so the result is already valid *before* the application is run the first time, and it saves looking up APIs), cross-platform support (Windows and Linux), very strong standard library, incredible community support, licensing (well down the list), capabilities as a "glue" language (highly valued when we wrote the factory automation application which talks GPIB, writes XML, has a GUI, multitasks, talks to a serial port, talks to a CAN interface, wraps some Windows DLLs, and does a half dozen other things), and probably a few more which I won't think of tonight. :) Oh, yeah, dictionaries, regular expressions, Zope, and more. Oh, wxPython is great, too. And it's great for writing automated testing (yes, a circular argument, since we rely more on automated testing *because* it's Python.) > > ... Or perhaps the advice that a "poor workman should not > > blame his tools" should apply even to those calling themselves software > > engineers. (If I were you, I would probably have put a smiley here.) > > > I'll put in as many as you want - I intend no offence in any of my comments, Often people overuse smileys in postings with frequent sarcastic remarks, apparently to let belittle others even while they claim not to have meant it. I'll accept you didn't intend any of your comments that way! > I am pursuing this thread in the hopes of (self) improvement :-). Lets see, > information hiding, type checking, run-time checking, design by 'contract' > (ties in with information hiding), spring to mind as immediate features that > I would like to see in a language and that I was taught are "good features" > to have. Seems you don't find them important, I guess we will have to > disagree as to what is important or not :-) Agreed. :-) I used to think information hiding was important, and that type checking provided value to *me* (and not just to the compiler). Python's pragmatic approach (self._dontuseme) to the issue and the number of times it has been useful during development or testing *not* to have to fight with the Java/C++ type of strictness has convinced me otherwise. I assume you mean compile-time checking above (?) (not "run-time checking") and PyChecker provides a large part of the same value. The rest should (I now believe) be caught by adequate testing, since compile-time checking becomes a crutch (people end up relying solely on it, and don't do the other tests). No reason you can't do design by contract, if you wish. Test-first design provides a more efficient way of handling the issue. But the part about our training is interesting, too. I was not taught much about information hiding and type-checking. I was in an engineering program which emphasized systems design, looking at complexity of systems, coupling and cohesion, design methodologies, and so forth. Little directly to do with software, as it tried to move to a "higher" level (so they claimed) and focus on issues which apply to engineering in any field. As a result, perhaps I'm less tied to (or trained in :-) these things which I consider minor and mundane details of certain programming languages, and look more at the benefits Python brings to those other issues. Code, for example, appears to be significantly simpler in Python than in many other languages. The result is less complexity, easier debugging and maintenance, faster development, and so on. *These* are the engineering principles I keep in mind and on which I judge languages. > Personally I love information hiding and coding by 'contract' - it seems > there is always someone in the team who is just plain lazy and wants to > access and modify the behaviour of another object directly rather than using > the agreed interface or requesting that the agreed interface be changed. When (or if, really) this happens, we'll just refactor the problem out of the code. It hasn't happened yet. > Strong typing is wonderful too. My Ada programs have 95%+ of *all* bugs out > of them by the time I get it to compile cleanly - wished I could say the > same of my Python programs! :-) > Finding bugs by testing is just so *expensive*! Not if you write the tests first... > Do you gather metrics on the problems that PyChecker is meant to cure? i.e. > does anyone record the fact that they lost 1/2 hr to the fact that they > mispelt a variable name? :-) Metrics is the best way to improve your shop - > unfortunately the typical programmer doesn't like to record them :-). Our metrics are poor so far, but then again resources have been exceptionally tight and we've done our best under the circumstances. But if problems caused by things like misspelt variable names showed up much (or at all... not sure anyone's actually been caught by it in the last year), we would focus more attention on the problem. These things just haven't been a problem for us, so we given them little thought. > > So your suggestion doesn't seem likely to reveal any significant > > deficiencies to me: if I haven't seen any myself, it must be because > > *for my purposes* there are none! > > Hmmm.... at the risk of offending, have you considered that you might not > have sufficiently broad experience to be able to determine that? I'm considering it. Yes, of course that's possible. No one could say otherwise. I just have no evidence to think that's the case, and I believe I have quite enough experience (not quite your level, but twenty something years developing professionally, and probably 100,000 hours as I said above) to judge when I have a problem to solve. The last time I judged that to be the case, I went looking for a solution. That's when I found Python. :-) > > > You could stick with Python as it matures ... > > > > How much more than 10 years old does a language have to be for you > > to call it mature? > > 10 years is a long time, I guess from what I have observed in some posts on > the list, people are attempting to state that they would like to see things ^^^^^^ Not "people", newbies. :-) (Yes, I know they're not all newbies.) > like some facility in the language to make it easy for them to type-check > their arguments (one example that springs to mind). I really don't spend too > much time looking for these items though or I might be able to pull up many > more examples :-) Unfortunately, I "skim" these because I know there are > very good languages that already offer these features (and they didn't take > 10 years to get there! - which is *not* a slame at Guido - he has done an > excellent job! :-)). Don't kid yourself. Python is not going to arrive suddenly at static type-checking after fifteen years and realize it was wrong all along. It *might* end up with such a thing, probably more to support compiler optimizations than anything, but some of us (probably many of us) will be quite uninterested in it. Guido has (in my opinion, as a supposedly well trained systems design engineer) an excellent design sense. Some of these things were left out for a reason. > All either of us can do is talk from personal experience. I have a > reasonable amount in that regards but it is limited in the sense of 29 years > work experience in certain fields and situations - first 8 in industrial > control, next 20 in defence (biggest project was 100+ programmers) and the > last year in a "commercial" environment. So I am trying to gather as much > as I can from other people (we can't learn it all! :-)). Ahh.. You are much more experienced than I am in really hardcore heavy-metal development (or whatever euphemism I can apply to the defence industry :-). I seem to be much more experienced than you in the commercial environment, where the issues can sometimes be quite different (I believe). I'm still working in the commercial area, while you are freshly arrived, but I won't presume to think that makes me more right than you. I *might*, however, have found that in this environment, some of the rigorous controls provided by other languages actually get in the way of solving the problem in a high quality and efficient manner (high quality being defined as satisfying the customer, and efficient being defined as before profitability vanishes :-). Actually, I believe that's exactly what I have found, and Python is a part of it. (XP is another part, by the way, but that's a discussion for another newsgroup. :-) Either way, I wouldn't be at all surprised if my conclusions would be all wrong in your former field. -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From kirill at xyz.donetsk.ua Tue Dec 18 11:48:09 2001 From: kirill at xyz.donetsk.ua (Kirill Simonov) Date: Tue, 18 Dec 2001 18:48:09 +0200 Subject: How can I display unicode in Tk widget In-Reply-To: ; from loewis@informatik.hu-berlin.de on Tue, Dec 18, 2001 at 12:19:58PM +0100 References: <9vkqm7$fqo83$1@ID-12869.news.dfncis.de> Message-ID: <20011218184809.A748@xyz.donetsk.ua> On Tue, Dec 18, 2001 at 12:19:58PM +0100, Martin von Loewis wrote: > On Windows, Tcl doesn't find its encoding database, thus it cannot > find out how to convert the Unicode string for display. Setting > TCL_LIBRARY may help. > > It is questionable whether this is a bug in Tcl or Python: It is a bug > in Python, for not installing Tcl libraries in a place where Tcl will > find them, and it is a bug in Tcl, for not offering an API to tell it > a different location for the codecs database. This is a bug in "Python2*/Lib/lib-tk/FixTk.py". Here is the right way to set TCL_LIBRARY. FixTk.py ======== # Do not import _tkinter! import sys, os if not os.environ.has_key('TCL_LIBRARY'): # Tcl is smart enough to check "$TCL_LIBRARY/tclX.Y/../tcl8.3/". tcl_library = os.path.join(sys.prefix, "tcl", "tclX.Y") os.environ['TCL_LIBRARY'] = tcl_library ======== Kirill. From jknapka at earthlink.net Thu Dec 27 17:29:20 2001 From: jknapka at earthlink.net (Joseph A Knapka) Date: Thu, 27 Dec 2001 22:29:20 GMT Subject: Finding out that Python is in interactive mode in sitecustomize.py References: <3C2B8F47.4CEACF6E@olen.to> Message-ID: <3C2B498E.2C53D822@earthlink.net> Joonas Paalasmaa wrote: > > How can I find out that Python is started in interactive mode in > sitecustomize.py ? > The need for that information is, that I want that certain > customizations take place only at > interactive mode. I want to know the answer to this as well. My reason is, I want the Anygui curses binding to disable itself if it finds that it's being imported from an interactive shell, since this has, er, unfortunate side effects. FAQ-reading and random flailing about with my Wand of Google have not been productive thus far... Cheers, -- Joe "I should like to close this book by sticking out any part of my neck which is not yet exposed, and making a few predictions about how the problem of quantum gravity will in the end be solved." --- Physicist Lee Smolin, "Three Roads to Quantum Gravity" From lac at strakt.com Sun Dec 30 12:07:58 2001 From: lac at strakt.com (Laura Creighton) Date: Sun, 30 Dec 2001 18:07:58 +0100 Subject: Is learning Python "extraordinary"? In-Reply-To: Message from "Jesse F. W" of "Sat, 29 Dec 2001 13:29:35 PST." <3C2DC53F.31010.D9D6B0A@localhost> References: <3C2DC53F.31010.D9D6B0A@localhost> Message-ID: <200112301707.fBUH7wua025493@ratthing-b246.strakt.com> You may get further in impressing the folks at MIT if you describe why you decided to learn Python. Whatever it was that made you decide to do something that the rest of your peers didn't is likely to be something interesting about you. (And, if you did it because you and six friends at school decided to learn it together, then, that is in itself something that makes you and your friends unusual and interesting.) US admissions to University is not one of the things that I know anything about, but it seems likely that what your letter is supposed to accomplish, if it works, is make you stand out from the crowd. If you happen to be exceptionally humble and modest, this test will be rather hard for you. Fake it. Stand as outside of yourself as you can and say, 'My peers are all turnips. _I_ on the other hand, am _very interesting_ because ... and write down whatever your mind comes up with.' That, I suspect, is the sort of thing that they are looking for. Whatever you do, after you have written your letter, pack your ego down to size so you can go back to being a humble learner. The world is full of traps for young people who have more ego than is good for them, and it would be a shame to trigger a bunch of them because you wanted to write the perfect letter to impress MIT. Good luck with it! Laura Creighton From skip at pobox.com Wed Dec 19 17:49:05 2001 From: skip at pobox.com (Skip Montanaro) Date: Wed, 19 Dec 2001 16:49:05 -0600 Subject: Dictionaries as records In-Reply-To: References: Message-ID: <15393.6497.5052.545221@beluga.mojam.com> Bill> I have a file with 200K records and 16 fields. This file is Bill> parsed and each row is put into a dictionary and the dictionary is Bill> added to a list. The raw file is only about 50mb. I was shocked Bill> to see that my memory use jumped to 500MB! Skip> You might want to consider storing it in an on-disk mapping Skip> object. Check pout the anydbm, bsddb, gdbm modules and the like. Yitz> That will solve the memory problem, but it may be slow due to disk Yitz> access. That obviously depends on his access patterns. If disk delays are a problem, implementing a simple LRU cache is a reasonable way to deal with the problem while limiting memory consumption. -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From aleax at aleax.it Fri Dec 28 07:56:21 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 13:56:21 +0100 Subject: install Python2.2 question References: Message-ID: "Tim Hammerquist" wrote in message news:slrna2ltdp.sjg.tim at vegeta.ath.cx... ... > If you have a sufficient devel environment and you are up to the > challenge, you can try to build Python yourself, but it may be more > trouble than it's worth if you're new to linux. How so? tar xzf, cd, ./configure, make, sudo make install -- how much trouble can that be? Alex From deja-google at wotevah.com Mon Dec 3 22:19:52 2001 From: deja-google at wotevah.com (L.C.) Date: 3 Dec 2001 19:19:52 -0800 Subject: os.path.exists throws Exception only w/ mod_python + MySQLdb 0.9.x Message-ID: I am seeing a very curious behaviour and haven't been able to explain it. I have apache 1.3.20 with mod_python 2.7.5 and MySQLdb 0.9.1 and if I try the following code in a handler: import os.path os.path.exists( "/tmp/nonexistentpath" ) It throws an Error: [Errno 2] No such file or directory: '/tmp/nonexistentpath' The code works fine outside of apache, and what confuses me is that it works fine with an older version of MySQLdb (0.3.x) but not with 0.9.x. If I create the directory in question exists() returns 1 as expected. -- L.C. From jason at jorendorff.com Sun Dec 9 15:18:05 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Sun, 9 Dec 2001 14:18:05 -0600 Subject: Generator syntax (was: Calling a generator multiple times) In-Reply-To: Message-ID: Courageous wrote: > This is fair enough, and I can live with it. It's not like generators > are all that hard, or anything. And it's not that I think that the > current _behavior_ of generators is wrong; rather, I'm flummoxed as > to the leaving of the syntax as it is, as it leads to surprises. > The syntax as is predicts other behavior to me. >>> def f(x): ... yield 1 ... >>> type(f) You can think of a generator as a function that returns a list (in a lazy way). The syntax nicely suggests this interpretation. Consider: def gen_lines(file): L = file.readline() while L: yield L L = file.readline() def list_lines(file): _result = [] L = file.readline() while L: _result.append(L) L = file.readline() return iter(_result) They behave quite differently: list_lines is eager; gen_lines is lazy. But I find the syntactic parallel compelling. -- Jason Orendorff http://www.jorendorff.com/ From ekock at movatis.com Sat Dec 15 05:00:16 2001 From: ekock at movatis.com (Eike Kock) Date: Sat, 15 Dec 2001 11:00:16 +0100 Subject: i18n and german umlauts Message-ID: <9vf6fu$82e$05$1@news.t-online.com> Hi! I just got started with Python and internationalization using the gettext module, pygettext.py and msgfmt.py. Everything works fine except when it comes to special characters like german umlauts. Has anyone mastered this in a plattform independent way? Thanx, Eike From fredrik at pythonware.com Sat Dec 1 08:51:34 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sat, 01 Dec 2001 13:51:34 GMT Subject: IOError when printing in Python service after 2 days References: <9TYN7.189006$IR4.70920026@news1.denver1.co.home.com> Message-ID: Jason R. Coombs wrote: > The program doesn't crash in debug mode. In run mode, it runs fine for a > couple of days, then I get this exception in one of my threads: > > Exception at Thu Nov 29 04:04:20 2001 > Traceback (most recent call last): > File "C:\bin\FileChangeNotifier.py", line 87, in run > self.Handle( filepath ) > File "C:\bin\watch.py", line 41, in SetLastChange > print time.asctime(), 'Change detected in', filename > IOError: [Errno 9] Bad file descriptor > > So, something strange appears to be happening to the stdout file > descriptor. how much data do you print? approximately how much data have you printed after a couple of days? it could be that you're slowly filling up the output buffer, and you get the error when stdio flushes the buffer. try running the program with the -u option, and see if you get the error sooner. > I'm having difficulty identifying this as anything but a bug in Python. well, unlike most C or C++ code, Python actually checks the error status after each stdio call... From virus_catcher at oceanic.com Sat Dec 1 23:22:09 2001 From: virus_catcher at oceanic.com (virus_catcher at oceanic.com) Date: Sat, 01 Dec 2001 18:22:09 -1000 Subject: InterScan NT Alert Message-ID: Receiver, AntiVirus Catcher has detected virus(es) in the e-mail attachment. The Sender has been notified. Date: Sat, 01 Dec 2001 18:22:09 -1000 Method: Mail From: <_hdbiker at darientel.net> To: File: stuff.MP3.pif Action: clean failed - deleted Virus: WORM_BADTRANS.B From syver-en+usenet at online.no Fri Dec 7 22:24:28 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 08 Dec 2001 04:24:28 +0100 Subject: Win32all documentation? References: Message-ID: David Brady writes: > Hello, > > Is there a good source for *complete* documentation of > win32all and the wonders it can accomplish? Get python programming on win32 by Hammond and Robinson. Good stuff. For the functions that win32 all wraps goto MSDN and read the platform SDK documentation, it's all there. For WSH buy WSH book from Wrox by Dino Esposito, but WSH is not that exciting when you have Python and win32all, I think sendkeys is about the only function that is any interesting for a python programmer with win32all. -- Vennlig hilsen Syver Enstad From loewis at informatik.hu-berlin.de Wed Dec 19 05:17:52 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 19 Dec 2001 11:17:52 +0100 Subject: How can I display unicode in Tk widget References: <9vkqm7$fqo83$1@ID-12869.news.dfncis.de> <9vnou6$gpvgr$1@ID-12869.news.dfncis.de> Message-ID: "Kick" writes: > Thank you! I have Tcl/Tk installed on my system, then How can I make it > display with correct encoding? Did you try setting TCL_LIBRARY? Regards, Martin From tim at vegeta.ath.cx Sun Dec 16 09:21:34 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Sun, 16 Dec 2001 14:21:34 GMT Subject: Idiomatic portable way to strip line endings? Message-ID: I've been trying to figure out the canonical way to strip the line endings from a text file. In general, I can use: line = line[:-1] or del line[-1:] to strip the last character off the line, but this only works on operating systems that have a one-byte line separator like Unix/Linux ('\n'). The Win32 line separator is 2-bytes ('\r\n'), so this solution is not portable. Perl (the dreaded word!) had a chomp() function that worked similar to the following. (The original modified its argument and returned the number of bytes chomped.) def chomp(line): if line.endswith(os.linesep): return line[:line.rindex(os.linesep)] return line I've seen several other solutions, including: line.replace(os.linesep, '') The above works when iterating over text files, but fails if only a final linesep should be stripped. OTOH, I've seen the non-portable: line = line[:-1] in production code. Is there a common idiom for this procedure? What do you use with portability in mind? TIA, Tim Hammerquist -- Did I listen to pop music because I was miserable... Or was I miserable because I listened to pop music? -- John Cusack, "High Fidelity" From plakal at cs.wisc.edu Tue Dec 11 17:09:01 2001 From: plakal at cs.wisc.edu (Manoj Plakal) Date: Tue, 11 Dec 2001 16:09:01 -0600 Subject: pyrepl-0.6 References: <3b091a1c.0112060650.1f185978@posting.google.com> <3C1531D9.1010507@yahoo.com> <3b091a1c.0112110217.2150c8fa@posting.google.com> Message-ID: <3C1683FD.9090206@cs.wisc.edu> cmkl wrote: > Manoj Plakal wrote in message news:<3C1531D9.1010507 at yahoo.com>... >> >> Being able to have an interactive shell inside arbitrary >> points in a program is cool for debugging. BTW, this >> functionality is provided by the "Interactive Debug Probe" >> in Wing IDE (wingide.com). You can stop the program >> at any point and then launch a shell in the context of the >> stack frame where you stopped. >> > > Unfortunately WingIde is not available on HPUX. Does the > "Ability to debug applications running on a remote host" help there? > I guess not. The remote debugging might help. What you need to do is copy a small stub program to the remote machine. The stub talks to the IDE (running on the local machine, which is either Linux or Windows) through XML-RPC. The stub is in pure Python so you can run it on HPUX if you have Python available there. Though this is kinda slow and I wouldn't recommend it if the HPUX box is your main development machine. This was intended to debug stuff running on a remote deployment machine. Manoj From skip at pobox.com Sun Dec 16 13:50:45 2001 From: skip at pobox.com (Skip Montanaro) Date: Sun, 16 Dec 2001 12:50:45 -0600 Subject: Idiomatic portable way to strip line endings? In-Reply-To: References: <9viekc$fkp74$1@ID-11957.news.dfncis.de> Message-ID: <15388.60677.992976.748339@12-248-41-177.client.attbi.com> > I've been trying to figure out the canonical way to strip the line > endings from a text file. I suspect the high frequency of line = line[:-1] simply means that most people haven't worried too much about their code running across multiple platforms. I know for most of the code I've written I've never worried too much about it. Still, how about: line = re.sub(r'(\r\n|\r|\n)$', '', line) ? In a little filter script I use to convert to canonical line endings I use sys.stdout.write(re.sub(r'\r\n|\r', r'\n', sys.stdin.read())) (This for a set of filters that processes web pages in various ways.) -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From jdukarm at hydracen.com Fri Dec 14 14:36:14 2001 From: jdukarm at hydracen.com (J.J. Dukarm) Date: Fri, 14 Dec 2001 11:36:14 -0800 Subject: PythonWare: Anyone using for real projects? Message-ID: <3.0.1.32.20011214113614.00cfe450@pop.islandnet.com> Hi - After using PythonWin a lot, and occasionally the Windows Notepad or IDLE, for Python programming, I have recently switched to using Pythonware (after owning it since it was first released) for all my Python work, including one very large project with over 100 modules. Pythonware's editor is usable, not as nice as the PythonWin editor, but starting to get there. (I have not tried it in Linux). But the instant access to all your project resources and all your Python documentation, with a very good multi-module search/replace facility, is a huge plus. The debugger works well, even if your software includes third-party components such as wxPython or mxODBC, and even if your software does wierd things with __import__. The distribution-building machinery actually seems to work - I was able to build a shippable distribution of my first small project with only about half an hour of fiddling, starting from complete ignorance of how to do it. It took me awhile to switch over to Pythonware because in earlier versions I considered the editor not good enough, and I did not have the time to figure out how to get along with the Pythonware project repository. With versions 1.2 and 1.3, that has all changed. I do still use the Windows Notepad for quickie Python scripts, but I am hoping that some day Secret Labs will find a way to make the Pythonware editor more independent so that (like the Notepad or vim) it can be used quickly on files that are not part of a "project". Jim Dukarm DELTA-X RESEARCH Victoria BC Canada From aleax at aleax.it Mon Dec 17 14:10:22 2001 From: aleax at aleax.it (Alex Martelli) Date: Mon, 17 Dec 2001 19:10:22 GMT Subject: pyexpat and unicode References: Message-ID: mallum wrote: ... > data_uni = u"\202" > data = "there" > > data_uni.encode('utf8') > > parser.Parse(data) > parser.Parse(data_uni) ... > Does this mean Im unable to pass utf8 encoded strings to pyexpat ? > According to the docs it should. Can anyone spread some light on this. You can't, I believe, pass SOME strings with a certain encoding followed in the same parse by others with different encodings; or, as in this case, ones not in fact encoded (remember the call to .encode returns an encoded string, which you ignore -- it doesn't change data_uni, of course, as it's immutable, like all strings). Separate parses work fine: import xml.parsers.expat parser = xml.parsers.expat.ParserCreate(encoding='utf8') data_uni = u"\202" data = "there" denc = data_uni.encode('utf8') for thedata in data_uni, data, denc: parser = xml.parsers.expat.ParserCreate(encoding='utf8') print 'parsing', repr(thedata) parser.Parse(data, 1) print 'done' Alex From dsavitsk at e-coli.net Tue Dec 11 18:59:24 2001 From: dsavitsk at e-coli.net (dsavitsk) Date: Tue, 11 Dec 2001 23:59:24 GMT Subject: win32service win32pipe question References: <93wR7.6168$Rw2.4468272@newssrv26.news.prodigy.com> <3C1695A2.30103@ActiveState.com> Message-ID: i downloaded the version in the book and it works better than mine, so i assume a typo. when i try to stop the version i downloaded, however, the stop command only sort of works. when issued, the service hangs for about 30 seconds, then responds ... Stopping service PythonPipeService Error stopping service: The service did not respond to the start or control requ est in a timely fashion. (1053) it does stop, though. is this something to worry about? doug "Mark Hammond" wrote in message news:3C1695A2.30103 at ActiveState.com... > dsavitsk wrote: > > > i followed the example of making a win32service in Mark Hammond's book. > > when i run the client i get the following error. does anyone know what this > > might be from? > > > > > X:\epsp2\server\bin>PipeServiceClient.py hello there service > > Traceback (most recent call last): > > File "X:\epsp2\server\bin\PipeServiceClient.py", line 8, in ? > > data = win32pipe.CallNamedPipe(pipeName, message, 512, 0) > > pywintypes.api_error: (2, 'CallNamedPipe', 'The system cannot find the file > > spec > > ified.') > > > CallNamedPipe assumes some other process has opened the pipe and is > reading from it. It appears this has not happened - ie, the pipe does > not exist. > > Mark. > From paul at zope.com Sat Dec 29 18:00:30 2001 From: paul at zope.com (Paul Everitt) Date: Sat, 29 Dec 2001 18:00:30 -0500 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: <3C2E4B0E.5010002@zope.com> I think there's a lot of merit to what you (Bill) say below. Zope is a big project in scope, and though there is a lot of documentation, it is scattered and not organized as it should be. The current Zope (2.x) also suffers from more of a "one size fits all" approach, where content authors, web designers, and site developers are all wedged into the same basic box. Thus, documentation and GUI suffer from having different audiences. All in all, Zope has a higher learning curve than it should. Tackling this basic issue is the goal of Zope3: http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/ In particular, read "VisionStatement" on that page for a pretty blunt statement showing we're in tune with your points. Zope3 actually has documentation, interface files, and unit tests being written *before* code. All in all, Zope3 is proving to be much more Pythonic, more modular, more explicit than implicit, etc. This doesn't preclude the need to do this for Zope2. I'm interested in hearing more about the Pet Shop example you mentioned. Is it a canonical example that is written up somewhere else for a different system? All in all, Zope is doing quite well. I'd say, with all the books out and coming out, we're ahead of where PHP was at a similar age. Also, it's important to note that around half of the people using Zope had never used Python before. It's a significant achievement. Like Python, Zope has a large and active community with bright and pleasant people all around the world. I'd also like to point out that Zope isn't a straight-up competitor to J2EE. In many ways, Zope competes more with Vignette, Interwoven, and other content management systems as much as it competes with application servers. This explains why appealing to content authors and site designers has been on our radar. It also explains why I think WebWare, Quixote, and other Python web systems are complementary to Zope. It's a big market with lots of audiences. And we all need Python to succeed. In fact, with Zope3 I'd like to see more ways for us to collaborate with other Python web systems, as there is a lot of good work going on. With Zope3 being more Pythonic and more modular, there's a better basis for two-way sharing. But only if other projects are also interested. 2002 is going to be a critical year for Zope. On the one hand, we have the validation from multiple books and some nice customer success stories (hooray, we can finally talk about CBS!). Also, Zope3 combined with Python 2.2 will make Zope more friendly to Python developers. On the other hand, we either win back people like you this year, or we face the thought that we've peaked. Bill, can you send me an offline note and explain the Pet Shop example? --Paul Bill Tate wrote: > Ron Stephens wrote in message news:<3C2B9E04.9957801F at earthlink.net>... > >>I recently read an interview with a Digital Creations top manager where he said >>that he hopes someone starts a successful business based solely on providing >>ISP services using Zope, with full technical support. Is anyone looking into >>this? Does anyone think this could be a successful business model? I am >>interested in opinions on this. >> > > This past spring, I spent a full month pouring over Zope in detail. I > pulled every example product I could find that I thought would be > relative to the purpose of setting up a commercial-based application. > I downloaded the tutorial and the draft zope book. I pulled down > every bit of documentation I could find for developers. In so many > cases, I found whatever documentation was available that key aspects > of the implementation took the "assumed facts-already-in-evidence" > approach; omitting key details that would were critical to improving > my understanding of using Zope. I consider myself a masochist in the > sense that I'm willing to go through various contortions to figure > something out, but like many others, I reached a point of saying that > I still don't get it. I won't even touch the issue of ZOPE's CMF or > Zope Templates - the documentation on that couldn't be more confusing > if it tried. > > My point is, the product may be perfect for my needs, but please do > away with tutorial examples referring to using zoo animals to > illustrate object navigation or elvis sightings to solidfy > understanding of the product. There were simply too many disjointed > pieces in the documentation to allow me to pull all the pieces > together and believe me when I say I'm a person who will go to great > lengths to try to "get something." If I'm having trouble, than I > suspect more than a few others are as well. > > Any commercial enterprise is likely to be supported by either some > data model or object-class model that almost invariably has a RDBMS on > the back-end for persistent storage (I've also worked with ODBMS so > ZODB isn't an issue for me). If you want to gain converts to zope, > build a tutorial that follows some resemblance of a what a normal web > site has to provide by way of example - perhaps something akin to the > Pet Store example in Zope would be useful??? How about building an > example auction site from scratch? I would be more than happy to > devote time and energy contributing to Zope but I can't until I figure > out how Zope works. To some degree, I think my confusion with Zope > increased AFTER I went through the documentation. Truthfully, I don't > even know whether Zope would be even a reasonable candidate for doing > something akin to the Pet Store example or even an auction site for > that matter. > > PHP has virtually exploded on the scene by providing a everything > including the kitchen sink - it appears to have taken little > convincing to gain converts to PHP and accordingly to the latest web > surveys, its implementation is huge. I much rather see tools like > Zope achieve that kind of status. But I don't imagine that too many > folks are going to be willing to work that hard to achieve Zope Zen > when other alternatives exists and that's a damn shame because I > suspect Zope is an excellent product. > > I truly do commend and appreciate DC's contribution's to Python, but I > hope somebody can point to something (either examples or > documentation) that gives me a reason to try again. > > Truthfully, I just don't think its me. > > Bill Tate > From pedro_rodriguez at club-internet.fr Sat Dec 15 03:55:18 2001 From: pedro_rodriguez at club-internet.fr (Pedro) Date: Sat, 15 Dec 2001 09:55:18 +0100 Subject: Model View Presenter GUI pattern? References: <20011213172833.0bfac3c7.gry@ll.mit.edu> Message-ID: sorry about the previous lengthy and slightly off topic post... George finds it hard to picture object creation and connexion and so do I. Your code seems ok to me, but I think you should go a step further to picture some kind of framework that will work for you. Currently there are two things that bother me : - first subclassing a real, implementation dependent, widget - second explicit creation of a widget in your presenter The first point may be addressed by the "anygui" library once it will be available. This library also provides some notification mechanism that you may check. The second point defies, IMHO, the ability to use a graphical interface to draw your user interface. I've try to address those two points, is using some kind of proxy-objects to access the widgets. These proxies will have the Observable interface to use the same notification mechanism, and will associated with the real widget. The widget will have to be retrieved from some factory class. Pseudo code will look like this : [[abstract module ui.py]] class WidgetFactory: def __init__(self, designerFilePath): pass def getWidget(self, name): pass class IntegerWidget(Observable): class ObserverInterface: def valueChanged(self, widget, newValue): pass def __init__(self, factory, widgetName): pass you could then create a specialized module for Gtk, another for Qt, another for Tk that will implement the concrete class for your toolkit. This is a large amount of work to wrap all widgets in that way. But since it only concerns the common behaviour of the widgets (view and controls) it is not as difficult. By doing so you get ride of explicitly messing with object layout in your code (with Gtk/Glade, you can embed the GladeXML class, with Qt/Designer, you can pick up and evaluate the result of pyuic compiler). And your presenter can be toolkit independent (in your example, the connect mechanism comes from Gtk and does not appear explicitly), with this framework you stick to your notification mechanism. I am wondering if the same reasoning couldn't be applied to the model (consider a database and the database api). Hoping this might be helpful and not confusing... -- Pedro From bob at passcal.nmt.edu Wed Dec 12 10:51:09 2001 From: bob at passcal.nmt.edu (Bob Greschke) Date: Wed, 12 Dec 2001 08:51:09 -0700 Subject: Getting at an item in a list of tupples References: <9v66mi$17mi$1@newshost.nmt.edu> <9v68qp$da5j6$1@ID-11957.news.dfncis.de> <9v695t$blv$1@peabody.colorado.edu> Message-ID: <9v7ucq$21b3$1@newshost.nmt.edu> "Fernando P?rez" wrote in message news:9v695t$blv$1 at peabody.colorado.edu... > Emile van Sebille wrote: > > >>>> a > > [(1, 2.0, '3'), (11, 12.0, '13'), (21, 22.0, '23')] > >>>> max([i[1] for i in a]) > > > > Nice. I just sent in a solution using map(), but this does look more readable > (and may be quicker, since it doesn't require calling a selection lambda()). > Note to self: must get used to using list comprehensions more. Whew! Me too! :) Thanks, Emile! Bob From danielk at aracnet.com Thu Dec 6 11:03:15 2001 From: danielk at aracnet.com (Daniel Klein) Date: Thu, 06 Dec 2001 08:03:15 -0800 Subject: Python - string to hexbytes conversion - HELP! References: Message-ID: It looks like you need to import the xdrlib module and use the Packer and Unpacker objects. I have not experimented with these classes so you are on your own here. Just thought I would point you in the right direction. Daniel Klein On Wed, 05 Dec 2001 20:48:39 GMT, "me" wrote: >I'm a newbie to Python and I am trying >to convert a string of decimal numbers - read from raw_input >to a series of hexbytes >eg >if I do a read and get a='1234567' >I need an equivalent string to be >b=Chr(0x01)+chr(0x23)+chr(x045)+chr(0x67) > >all this is to control a device from the serial port >but I cannot seem to recall how to conver the input to my required output >An hints or suggestion most appreciated! I've spend hours trying various >built in's >which I would prefer to use > >HELP! > From daniel.pote at xms.se Wed Dec 12 09:23:21 2001 From: daniel.pote at xms.se (Daniel Pote) Date: Wed, 12 Dec 2001 15:23:21 +0100 (CET) Subject: Import random In-Reply-To: References: Message-ID: <56767.192.168.146.2.1008167001.squirrel@portal.xms.se> Michael Hudson said: > "Daniel Pote" writes: > >> >>>> from math import exp, sqrt >> >>>> 4 * exp(-0.5)/sqrt(2.0) >> > >> Result is: 0.0 > > Congratulations, you have a seriously broken installation. Did you compile it > yourself? Which compiler did you use? I used the pre-compiled package from hpux.connect.org.uk Thanks /Daniel From syt at gemini.logilab.fr Tue Dec 11 03:27:15 2001 From: syt at gemini.logilab.fr (Sylvain Thenault) Date: Tue, 11 Dec 2001 08:27:15 +0000 (UTC) Subject: "import" analysis References: <3C15082E.4FC3D726@attbi.com> Message-ID: On Mon, 10 Dec 2001 11:08:30 -0800, Chris Barker wrote: >Sylvain Thenault wrote: >> does anyone know a tool which parse a project's files and tell you which >> modules are imported but not present in the parsed project nor in the >> standard python library ? > >no, but check out Py2exe and McMillian's Installer. Either one will do >part of the job for you... I'll check for that... thanks, Chris and Robin! -- Sylvain Thenault LOGILAB http://www.logilab.org From skip at pobox.com Sun Dec 30 14:48:55 2001 From: skip at pobox.com (Skip Montanaro) Date: Sun, 30 Dec 2001 13:48:55 -0600 Subject: CEPort: I Need help with compile.c bug In-Reply-To: <3c2f4102_5@news.newsgroups.com> References: <3c2f4102_5@news.newsgroups.com> Message-ID: <15407.28583.289894.153044@12-248-41-177.client.attbi.com> Brad> Sorry to post here, but I'm trying to figure out where in the 2.2 Brad> code to look to solve this problem. Brad> I'm porting the release22-maint CVS checkout to CE 3.0 Brad> Seems to work okay, except that many of the regression tests fail Brad> because the CE port is casting numbers to long somewhere... so Brad> numeric output has L at end. I've no idea other than suggesting that you post your note to python-dev. -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From jkraska at san.rr.com Wed Dec 5 12:03:39 2001 From: jkraska at san.rr.com (Courageous) Date: Wed, 05 Dec 2001 17:03:39 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> Message-ID: >>Works like a charm. Just never forget to install python-mode.el ;) >Which means the editor is replacing each tab level with 4 spaces, >so there are no tabs in your code. Works for me too. For vim users: set softtabstop=4 set shiftwidth=4 set et set showmatch set matchtime=1 "ascii-183==? "ascii-187==? set lcs=tab:?\ set list The lcs=tab: line should be typed like this: set lcs=tab:187\ Note that the normal tabstop is left alone at 8. This gives the python writer using vim the following: Each time you press tab, it moves you to the closest tabstop of 4 by inserting just enough spaces to get you there. When hard tabs are present, they align on an 8 character boundary and appear with the ascii character 187 (the "small double greater than character"). This makes tabs show up like a sore thumb, which is important in Python. You'll likewise find it helpful for MAKE. Note that since you are getting spaces every time you type tab, when using make and occasionally other systems you'll eventually need a REAL tab. You get this by typing TAB. It took me a while to figure out (with the helpful advice of someone here or in the editors group) to use 8 character stops for real tabs. But it really is the way to go, particularly if you are on a unix system, where any variety of programs (lpr, cat, more, et al) will treat your tabstops as 8 characters by default. Note that Python treats your tabstops as 8 characters by default, so this will always make DEDENT syntax errors obvious as well. C// From cliechti at gmx.net Sun Dec 30 07:33:22 2001 From: cliechti at gmx.net (Chris Liechti) Date: 30 Dec 2001 13:33:22 +0100 Subject: REPOST: Re: values of sys.platform? for a serial port lib References: <3C2E543D.4BFB07D@engcorp.com> <3C2E82A5.D4E1EEB3@engcorp.com> Message-ID: <4$--$$_----__%--%$@news.noc.cabal.int> Peter Hansen wrote in news:3C2E82A5.D4E1EEB3 at engcorp.com: > Chris Liechti wrote: >> i also have an optional argument to specify the port string, but when >> this is used it isn't portable anymore. > > Just a thought, but could you make this the same argument as > the port number, allowing either an integer or a string? > I could also see a benefit, in a cross-platform serial-port app, > in having a method to return the actual device name in use, for > display/troubleshooting purposes, even if specified as a number. minutes after i wrote the that message, i changed the code so that it is the same argument that takes a number or a string. i'll add a method to return the device name. > You may know this already, but in Windows you need to use > "overlapped" I/O operations if you want to be able to have > a read thread and a write thread waiting independently on > operations on the same serial port. Without this, any time > one thread is blocked waiting for results for its operation, > the other thread will also block when it tries to access the > device even if its operation would not otherwise block. > (Or something like that... I don't know the full details > behind it, only what I learned trying to implement a win32file- > based serial port class which didn't have this limitation.) it uses overlapped io. it's roughly based on the serial example that comes with the win32all package. chris -- Chris ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Chris Liechti Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:08:23 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774258 27193 211.57.49.2 (31 Dec 2001 04:50:58 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:50:58 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From dgrisby at uk.research.att.com Wed Dec 19 05:19:40 2001 From: dgrisby at uk.research.att.com (Duncan Grisby) Date: 19 Dec 2001 10:19:40 GMT Subject: SOAP.py and Python 2.2. Was Re: SOAP.py References: <9vnpn1$t45$1@pea.uk.research.att.com> Message-ID: <9vppjs$tfp$1@pea.uk.research.att.com> In article <9vnpn1$t45$1 at pea.uk.research.att.com>, Duncan Grisby wrote: >I've just started trying some experiments with SOAP.py 0.9.7. I'm >having a problem with the server side that is so fundamental that I'm >sure I must be doing something wrong, but I can't see what. Following up to my own post, the thing I was doing wrong was using Python 2.2. SOAP.py works fine with Python 2.1. I don't have the time (or the inclination) to find out why, but I suspect it's due to different behaviour of type(). Cheers, Duncan. -- -- Duncan Grisby \ Research Engineer -- -- AT&T Laboratories Cambridge -- -- http://www.uk.research.att.com/~dpg1 -- From max at alcyone.com Tue Dec 18 14:39:26 2001 From: max at alcyone.com (Erik Max Francis) Date: Tue, 18 Dec 2001 11:39:26 -0800 Subject: /usr/bin/env: python: No such file or directory References: <9vivft$593$1@peabody.colorado.edu> <171220010818339518%jwbaxter@spamcop.net> <9vnvue$m5d$1@peabody.colorado.edu> Message-ID: <3C1F9B6E.19471D84@alcyone.com> Fernando P?rez wrote: > Right. Just discovered that yesterday: I also broke printing! > > At this point I'm fully willing to say that RedHat has simply put out > a > broken python setup. I fail to see one good reason for the current > mess, with > system-level things (like printing) needing python 1.5 to be the > default and > be called python. It wouldn't be too surprising. Red Hat seems to be fond of shipping custom versions of everything, to the point that some are totally unofficial or downright broken. Take the gcc 2.96 fiasco, for instance. -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ Laws are silent in time of war. \__/ Cicero Esperanto reference / http://www.alcyone.com/max/lang/esperanto/ An Esperanto reference for English speakers. From philh at comuno.freeserve.co.uk Mon Dec 3 13:24:46 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Mon, 3 Dec 2001 18:24:46 +0000 Subject: Draft PEP: string interpolation with backquotes References: <9ueh23$9e8$1@peabody.colorado.edu> <9uern5$hbk$2@peabody.colorado.edu> Message-ID: On Sun, 02 Dec 2001 20:30:34 +2328, Fernando P?rez wrote: >phil hunt wrote: > >>> >>> "x is $x, f(x) is $f(x)" >>> >>>This to me is readable, unambiguous and very useful. >> >> To me it implies the same as: >> >> "x is %(x)s, f(x) is %(f)s(x)" % { 'x': x, 'f': f} >> >No. Wrong. Read what I said closely. I am right on this, beleive me. > $_whatever_ means: fully evaluate _whatever_, as far as it can be >evaluated, and put its value in there. So it gives an interpolation >syntax which is in fact much cleaner than perl's, with much less need >for braces and name protection. If you want Perl-like features, you can always use Perl. >> >> What's wrong with the existing way of doing things with "%"? >> > >Try using the existing syntax for really complex cases. Easy: "some %s expression" % really_complex_expression() What's wrong with that? Anyway, having complex espressions interleaved with static text, whether you do it the Perl way or the C++ way, makes the code less readable, IMO. > In the post >you quote, I explicitly showed what the current options are, and >their flaws. For one-liners it doesn't matter. The problem is >*scalability*. As always, easy problems can be solved easily. The >question is: is the tool good enough for solving the hard problems? >If you read my complete post, either you'll agree that it doesn't or >you'll give me a counter argument. But read and argue on the whole >post, not just a snippet of it. I've re-read your whole post, and still don't see any problem. You mention long strings with lots of lines and lots of values to fill in. I've done that with the % oprator, with no problems. I disagree that using a temporary variable here is a problem, to me it doesn't reduce clarity at all. I would have no problem with someone intruducing i"....$x...." as a preprocessor to Python(*), but I do not think it should go in the language. [*] I have done something similar with having HTML statements which are converted to strings with %(variable)s inside them and replaced by Python at run time. If you have a specialised use like that, then it is sensible to write a Python progrsam to solve your problem. But the Python language and syntax is good as it is, and doesn't need any extra complexity. -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From pzw1 at hotmail.com Mon Dec 10 23:36:50 2001 From: pzw1 at hotmail.com (Peter Wang) Date: 10 Dec 2001 20:36:50 -0800 Subject: __init__ concerns Message-ID: i'm subclassing UserDict to journal transactions to gdbm, and i'm writing my own __init__() to take an open journal handle. it occurs to me that since i don't have *any idea* what the base class's constructor needs or does, i should probably call it, in order to ensure that my object is valid. then it occurs to me that i don't know what the UserDict constructor looks like in its entirety, but it must be callable with no arguments, since i can do "x = UserDict.UserDict()". so the problem is kind of solved: i can just call UserDict.__init__(self). however, the bigger question of properly calling parent classes' constructors still remains. i figured you can always put a line into the subclass's constructor: def __init__(self, *args): apply(BASECLASS.__init__, (self,) + args) but i thought this was kind of a kludge. what is the proper python idiom (or, failing that, the proper technique) for ensuring that a subclass instance is properly initialized, especially when details of the base class are unknown? TIA, peter From cafugate at worldnet.att.net Sun Dec 9 20:06:21 2001 From: cafugate at worldnet.att.net (Cris Fugate) Date: Mon, 10 Dec 2001 01:06:21 GMT Subject: ** Anybody Hiring? ** Message-ID: <3C140B54.E1780E4C@worldnet.att.net> Got laid off. I have 1 year experience with Python and 4 years experience with Tk (Tcl). Is anybody hiring? Cris Fugate crisfugate at excite.com From dav-nospam-id at westco-nospam-ntrol.com Wed Dec 5 09:39:32 2001 From: dav-nospam-id at westco-nospam-ntrol.com (David Brown) Date: Wed, 5 Dec 2001 15:39:32 +0100 Subject: Printing from Windows References: <9ui1ki$lfv$1@news.netpower.no> <20011204111022.682cc9dc.use-net@schabi.de> <3C0CA3BB.9090508@gmx.net> <20011204160622.7afb6a2a.use-net@schabi.de> <3C0E1CF0.4070401@ivs.tu-berlin.de> Message-ID: <9ulbak$4hq$1@news.netpower.no> Andreas Ulbrich wrote in message <3C0E1CF0.4070401 at ivs.tu-berlin.de>... >>>I personally prefer PyQt for this purpose. Of course, just like gtk+ its >>>not part of the standard Python distribution. Using Qt seems somewhat >>>more sane to me. But well that's pretty much a matter of taste :-) >>> >> >> But Qt has the license disadvantage on windows platform. >> >> markus >> > >Maybe, but AFAIK. PyQT does freely (beer) include Qt. > The licence disadvantage is that while Qt is free on Linux (AFAIK), it is only free on Windows if the program using it is open source. If you want to sell a closed-source program under Windows using Qt, you have to pay for it. While that is a perfectly good and fair model, the prices involved are extremly high and would put it out of our reach. I prefer to mix open source and closed source - there are times when different licences suit better. For example, I'm writing a program that uses Tkinter for the GUI and uses a serial library for communications. The changes I will be making to the serial library will be open for everyones benifit (assuming, of course, that I get the think working :-), while the main part of the program will be proprietry. PyQT will let me do that, but at a hefty cost which is outside my budget. From shiver at yubc.net Wed Dec 26 20:56:50 2001 From: shiver at yubc.net (I.J.) Date: Thu, 27 Dec 2001 02:56:50 +0100 Subject: is this a bug or what? Message-ID: >>> M=[[0]*3]*3 >>> M [[0, 0, 0], [0, 0, 0], [0, 0, 0]] >>> M[1][1]=1 >>> M [[0, 1, 0], [0, 1, 0], [0, 1, 0]] Is this new age math? -------------- next part -------------- An HTML attachment was scrubbed... URL: From phd at phd.pp.ru Wed Dec 5 07:44:31 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Wed, 5 Dec 2001 15:44:31 +0300 Subject: ANN: PyGeo V.6 In-Reply-To: <000901c17d88$8ac539d0$f64ef6d1@ArtSiegel>; from ajs@ix.netcom.com on Wed, Dec 05, 2001 at 07:29:51AM -0500 References: <000001c17d31$ba0b5960$c747f6d1@ArtSiegel> <20011205115304.B19636@phd.pp.ru> <000901c17d88$8ac539d0$f64ef6d1@ArtSiegel> Message-ID: <20011205154430.R19636@phd.pp.ru> On Wed, Dec 05, 2001 at 07:29:51AM -0500, Arthur Siegel wrote: > >> I didn't find any mentions of a license. Is it public >>domain? > > Also GPL. This shoud be mentioned on the site and in announcements. Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From grey at despair.dmiyu.org Mon Dec 24 16:49:17 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Mon, 24 Dec 2001 21:49:17 -0000 Subject: vi or emacs for editing Python on Linux? References: <1009127729.9271.0.nnrp-12.c2de51d8@news.demon.co.uk> Message-ID: On Sun, 23 Dec 2001 17:18:39 -0000, Michael Thompson wrote: > I don't think the 'learn vi as it is everywhere' argument to be bogus. If > you work in a large company and support UNIX machines scattered all over the > world then the availability of vi is something you can depend on. > Furthermore it is a powerful efficient editor and works well over slow > network connections! Obviously one can configure their own personal > workstation to their own tastes. Reconfiguring company or even customer > machines usually isn't an option! *sigh* Fine,you had to bring it up. Michael, I *do* work on unix systems scattered across the nation and my personal workspace is not on every single one. You know what is, though? ssh. That means scp is there so when I need to get something to/from that machine I can always scp to another machine, edit, scp back. Furthermore, when it comes to programming, I would hope that a company that has machines all over the world would have learned the joys of a CVS server which would also fill in on the above. Edit on one machine, commit, ssh to the machine that needs it, cvs update. Knowing vi because vi is "everywhere" is bogus because in nearly any production environment that I know of, except for ones that are constructed on theory by vi people trying to prove one MUST know vi, there is very little need to edit on the local machine. The one legit exception is, of course, first installing the system. This, too, is bogus because there are two unix variants I can think of off the top of my head which do *NOT* have vi installed by default until after one could install other things. Conclusion, having to know vi because "vi is everywhere" has been bogus for about a decade and it is about damn time that the vi people stop spewing that crap! -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From peter at engcorp.com Tue Dec 4 10:16:32 2001 From: peter at engcorp.com (Peter Hansen) Date: Tue, 04 Dec 2001 10:16:32 -0500 Subject: Python evangelists unite! References: <3C07884E.75E18DF7@engcorp.com> <9ue2o2$b344@news1.gtech.com> <3C0B08F3.C9CDE885@engcorp.com> <3C0C53F5.9A7EBC08@engcorp.com> Message-ID: <3C0CE8D0.7876F72E@engcorp.com> Fredrik Lundh wrote: > > Peter Hansen wrote: > > I'm not sure how it missed that one... > > were you trolling? or was I perhaps referring to that other > "I learned the one truth years ago" job security guy? Sorry, a smiley might have helped. I was attempting to make a small joke (and failed miserably) when it occurred to me that *my* pattern matching might have failed, and I realized you're the re guy... I'll work on my act more before taking it to the streets. :-) -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From killspam at darwinwars.com Mon Dec 10 12:29:27 2001 From: killspam at darwinwars.com (Andrew Brown) Date: Mon, 10 Dec 2001 17:29:27 GMT Subject: Date manipulation in Python References: Message-ID: David Brady wrote in : >Is there a good, Python way to do this? ...of course >there is. It just may not be written yet. If it is, >would someone share? > The mxdatetime library is full of clever routines to do things with dates, among them getting values for things like "Next Friday". They are at http://www.lemburg.com/files/python/mxDateTime.html To quote from the web site: "The package provides three data structures for working with date and time values. These are: DateTime for referring to absolute date/time values, DateTimeDelta for date/time spans and RelativeDateTime for representing variable date/time spans (these are the TABs of date/time calculation)" I think that's what you wanted, in any case. From ajs at ix.netcom.com Wed Dec 5 07:29:51 2001 From: ajs at ix.netcom.com (Arthur Siegel) Date: Wed, 5 Dec 2001 07:29:51 -0500 Subject: ANN: PyGeo V.6 References: <000001c17d31$ba0b5960$c747f6d1@ArtSiegel> <20011205115304.B19636@phd.pp.ru> Message-ID: <000901c17d88$8ac539d0$f64ef6d1@ArtSiegel> Oleg aks - >> I didn't find any mentions of a license. Is it public >>domain? New license I made up - the SNTAA. Requires anyone who uses it to Say Nice Things About the Author. Also GPL. Art From thomasNO at SPAM.obscure.dk Tue Dec 11 16:47:42 2001 From: thomasNO at SPAM.obscure.dk (Thomas Jensen) Date: Tue, 11 Dec 2001 21:47:42 GMT Subject: os.mkdir() errno inconsistency on Windows? References: <9v5rmb$36u$1@news1.xs4all.nl> Message-ID: "Irmen de Jong" wrote in news:9v5rmb$36u$1 at news1.xs4all.nl: > On windows (2000), Python 2.1: > Why does os.mkdir() return a different errno when trying to create > an already-existing directory, or trying to create the drive root > directory? See below: > >>>> os.mkdir('d:\\test') os.mkdir('d:\\test') > Traceback (most recent call last): > File "", line 1, in ? > OSError: [Errno 17] File exists: 'd:\\test' >>>> os.mkdir('d:\\') > Traceback (most recent call last): > File "", line 1, in ? > OSError: [Errno 13] Permission denied: 'd:\\' Well, it's consistent with the command shell's behaviour: C:\>mkdir C:\test C:\>mkdir C:\test A subdirectory or file C:\test already exists. C:\>mkdir C:\ Access is denied. I guess Python just forwards the shell's behaviour? (OSError also suggests that). Doesn't help you with your problem, but it's not Python's "fault" :-) -- Thomas Jensen From store_li at sina.com Wed Dec 19 08:46:41 2001 From: store_li at sina.com (Kick) Date: Wed, 19 Dec 2001 21:46:41 +0800 Subject: Can I change a unicode char to gb2312 using python? Message-ID: <9vq6d9$gvc5p$1@ID-12869.news.dfncis.de> I know that Java have a method that can manually encode string, like that, System.out.println(new String("some chinese char".getBytes()"GB2312")) Is there any python function or method can do the same work? Thanks for any help! Kick From com-nospam at ccraig.org Tue Dec 11 08:26:23 2001 From: com-nospam at ccraig.org (Christopher A. Craig) Date: 11 Dec 2001 08:26:23 -0500 Subject: PEP 276 Simple Iterator for ints (fwd) In-Reply-To: References: <9uomtp$e1cbj$1@fido.engr.sgi.com> <9up46o$e2ost$1@fido.engr.sgi.com> <3C150188.C31AC4B8@ccvcorp.com> Message-ID: David Eppstein writes: > For example, suppose you want to loop over the set of integers i satisfying > x <= i < y (the usual half-open interval), but you need them in reverse > order, and x and y may be non-integer. As far as I can tell, the "one > right way" of doing this is > import math > for i in range(int(math.ceil(y-1)),int(math.ceil(x-1)),-1): ... How about: i = y while i > x: print i i-=1 That looks quite clear to me. A heck of a lot clearer than for i in y > i >= x: print i Which to me does not specify the step size for floats. (If y=5 and x=0, shouldn't that print 3.1415926 at some point?) Python's "for" loops were designed to iterate over sequence objects. >From the way range was designed it seems fairly obvious that even it was designed, not for iteration over mathematic sequences, but traversing python lists by index instead of value. Even with generators and iterators, I can't imagine why you would want to use a for loop to iterate over "a set of integers i satisfying x <= i < y in reverse order where x and y may be non-integer". (Or over floats at all for that matter) This, and its whole class of similar mathematical sequences scream "while" at me. -- Christopher A. Craig From marklists at mceahern.com Sat Dec 29 20:34:29 2001 From: marklists at mceahern.com (Mark McEahern) Date: Sat, 29 Dec 2001 17:34:29 -0800 Subject: Reg-Ex and lambda optimization In-Reply-To: Message-ID: Check out the glob module--it may be what you need. http://aspn.activestate.com/ASPN/Python/Reference/Products/ActivePython/pyth on/lib/module-glob.html // mark From wurmy at earthlink.net Thu Dec 27 14:18:02 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Thu, 27 Dec 2001 19:18:02 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <2$--$$_----_-$-%_$@news.noc.cabal.int> Ron Stephens wrote: > How is Python doing popularity wise? After such a meteoric growth > thought the nineties, and a spectacular climax in 2000 and early 2001, > is Python leveling out, going dot.bust, or still not yet at the knee of > the software world's most spectacular growth curve? I should hope it's still growing. :) I want more books, more Python jobs, more programs, more everything! :-) > Python, while fabulously successful, is at an interesting point in its > growth curve. It will be difficult to maintain the extremely high rate > of growth exhibited so far; new contenders are possible problems; and > the recessionary economy could also negatively impact Python's growth. Commercial growth, yes. A recession doesn't stop anyone from sitting down and writing some Python code for fun. (Assuming the recession isn't so bad that they cannot do even this anymore.) > But Ruby is also a more general purpose, object oriented, relatively > easy to read, language. Ruby folks include those who like its more > Perl-like syntax, but Ruby's core converts believe that its pure, > absolute object oriented nature exceeds those of Python and make it more > worthy to long term success. They seem to see Ruby as a more modern, > up-to-date version of Python. They see Python as a compromise between > object oriented and procedural programming. It is... and functional programming, and possibly some other paradigms. I don't see how Ruby can be more modern, unless it does that new stuff like aspect-oriented programming. It may be perceived as cleaner by some, but Python is rapidly removed its warts, like mending the type/class dichotomy. (And gaining lots of other features of dubious utility along the way... but that's a different story... ;-) > a. Usage on the Ruby newsgroup is growing much faster than on > comp.lang.python in the last year that I have been observing it. A year > ago, Python got typically three times as many posts per day as Ruby. > Now, its more like a 4:3 ratio, with Python getting say, 4000 per month, > and Ruby 3000. At this rate, Ruby could pass Python is afew months, by > this measure! (Rest assured, Ptyhonis fdoing much better if mesured by > Sourceforge projects, about 1300 to 80). By the way, Just van Rossum's > http://starship.python.net/~just/comp.lang.python/ graph of Python > newsgroup coverage seems to show a slight decline from over 6000 per > month in late-middle 2001 to the current 3500 or so I see on here. Mr. > van Rossum said he may not be able to update these any more due to some > Yahoo change; anyway, am I interpreting these numbers and trends > accurately? Will the Python newsgroup usage turn upwards again? Does it > matter? I don't know, but remember that there are many SIGs, mailing lists etc, besides this newsgroup. So the more specialized discussions are done elsewhere. I don't know if Ruby has a lot of mailing lists comparable to Python's, but it would seem to me that the number of messages in c.l.py isn't all there is to it. > 2. The economy is hurting Python's open source development model. It was > bad enough when the core Python coders were jerked around by Be Open; > now I am very sad to hear of Mark Hammond's not being with ActiveState > anymore? [...] I think PythonLabs, or Zope Corp., should hire him. That would seem like a smart move. > Ten years from now, will Python still be Relevant? Oh, I know that > Python will still be being used, and the community will still exist, but > will it really be a thing that seems to Matter, like it does now. Ten years is a long time. Maybe by then, we won't even *want* to program in Python, because there's something better out, based on insights from working with other languages, possibly including Python. Or maybe in ten years Python will look nothing like it is right now. Who knows... Regards, --Hans ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Hans Nowak Newsgroups: comp.lang.python Subject: cmsg cancel <3C2B7276.88339BE7 at earthlink.net> Control: cancel <3C2B7276.88339BE7 at earthlink.net> Date: Mon, 31 Dec 2001 05:00:03 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775630 27193 211.57.49.2 (31 Dec 2001 05:13:50 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:13:50 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From justin at iago.org Sat Dec 8 15:19:54 2001 From: justin at iago.org (Justin Sheehy) Date: Sat, 08 Dec 2001 15:19:54 -0500 Subject: lost interest? In-Reply-To: <20011208001123.A5989@casa.parque> (Walter Moreira's message of "Sat, 8 Dec 2001 00:11:23 -0300") References: <20011208001123.A5989@casa.parque> Message-ID: Walter Moreira writes: > I've been reading some of the catalog-sig archives and I wonder why the > interest of the community about something like CPAN is so small. When a > message about this thing pops up in c.l.py, it receives only one or two > answers and the thread dies, and in catalog-sig usually happens something > similar. > Why do you think people is not interested? Didn't the community should try to > encourage something like siphon? The standard library is extremely rich, and provides a great deal of functionality simply as a result of having Python installed. ("batteries included") When one does need a third-party module, in most cases it is trivial to find, download and "python setup.py install". I'd ask a different question from yours. Why is it a problem that Python doesn't have an equivalent to CPAN? "Perl has it" isn't enough. In order for a number of people to put time and work into this, it has to pose enough of a problem in its absence that those people will have real motivation to make it happen. If something like this (siphon or otherwise) becomes well-accepted and used by the Python community, I'll be happy about it. I'm not going to worry too much about it in the meantime, since I haven't had any problems as a result of not having such a thing avaiable to me. -Justin From m.bless at gmx.de Mon Dec 17 05:25:51 2001 From: m.bless at gmx.de (Martin Bless) Date: Mon, 17 Dec 2001 10:25:51 GMT Subject: Idiomatic portable way to strip line endings? (fwd) References: <9vkdrc$pm3$1@news.onet.pl> Message-ID: <3c1dc277.9098933@news.muenster.de> [Tomasz Lisowski]: >Why not use the string.rstrip() function? Because (1) rstrip() removes ALL whitespace chars ('\t\x20\r\n...') and because (2) rstrip() is greedy. Removes all and not just one. It's simply something different. I like the elsewhere here presented "chomp()" version. And to clarify: for line in open(fname,'rb').readlines(): print `line` on a windows system will yield very well lines ending with '\n' except maybe - as documented and in general - the last one. Only difference to open(fname,'r'): all \r are left untouched. So contrary to what someone suspected you are not in "great difficulties" if you open files binary (at least on a windows systems). You just get get each and every byte from the infile, which is sometimes what you need. readlines() still works fine. You just have the *opportunity* to distinguish between carriage return, line feed or both. How could you control your good old electric typewriter better? ;-) Let it dance! Martin From matt at mondoinfo.com Sun Dec 30 13:47:03 2001 From: matt at mondoinfo.com (Matthew Dixon Cowles) Date: Sun, 30 Dec 2001 18:47:03 GMT Subject: Pmw.ScrolledText: selecting a line? References: <9vte32$7rs$1@newshost.nmt.edu> Message-ID: On Thu, 20 Dec 2001 12:27:52 -0700, Bob Greschke wrote: >I can click on a point on the graph and get the ScrolledText field to >jump to the corresponding line in the file with .yview(line number), >but how (if possible) can I get the line to then also be 'selected' >or 'highlighted' somehow so the user knows which line the point is >associated with? Dear Bob, You can tag the appropriate line and configure the tag to highlight the text. Here's a small example: >>> from Tkinter import * >>> import Pmw >>> r=Tk() >>> t=Pmw.ScrolledText(r) >>> t.pack() >>> t.insert(END,"one\ntwo\nthree\nfour\nfive\nsix\nseven\n") >>> t.component("text").tag_add("standout","2.0","2.end") >>> t.component("text").tag_configure("standout",background="yellow") Regards, Matt From mwh at python.net Fri Dec 14 05:43:48 2001 From: mwh at python.net (Michael Hudson) Date: Fri, 14 Dec 2001 10:43:48 GMT Subject: "XXX undetected error" in python_d.exe References: Message-ID: Courageous writes: > How am I supposed to interpret this error when it is printed > by the Python interpreter? What information is it telling me? > This appears to be a feature of newer (2.2?) interpreters in > debug build only. I think it means some opcode evaluated and failed to maintain the required invariant mentioned at the top of the Big Switch in ceval.c: /* BEWARE! It is essential that any operation that fails sets either x to NULL, err to nonzero, or why to anything but WHY_NOT, and that no operation that succeeds does this! */ At a guess, the opcode that does this is CALL_FUNCTION, and you have an extension module somewhere that fails to return NULL when it sets an exception. > I've seen it flag off on reads from zero memory, so I know it's > not just an ordinary internal catch. It almost seems as if the > Python interpreter is catching SIGSEGV or something like that, > only I can find no code to enable such shenanigans. It's not that. > I'm having a problem with it under VC6.0, because when it throws > off, it seems to cause the interpreter to exit, even when a serious > error has occured in extension modules I am writing/ > adapting. What's bizarre is that this seems inconsistent, and I > can't identify any code that would allow Python to intercept memory > faults under windows. I have nasty memories of debugging memory faults under Windows, specifically of them not always landing me in the debugger. ISTR some dialog box that allowed me to get memory exceptions to "Always Stop" (and gibbering with fright that this wasn't the default). I could have a faulty memory here (and it was VC5). HTH, M. -- ARTHUR: Don't ask me how it works or I'll start to whimper. -- The Hitch-Hikers Guide to the Galaxy, Episode 11 From mwh at python.net Sun Dec 30 16:41:14 2001 From: mwh at python.net (Michael Hudson) Date: Sun, 30 Dec 2001 21:41:14 GMT Subject: REPOST: Re: CEPort: I Need help with compile.c bug References: <3c2f4102_5@news.newsgroups.com> Message-ID: <6$--$$_----___-$-$@news.noc.cabal.int> "Brad Clements" writes: > Sorry to post here, but I'm trying to figure out where in the 2.2 code to > look to solve this problem. > > I'm porting the release22-maint CVS checkout to CE 3.0 > > Seems to work okay, except that many of the regression tests fail because > the CE port is casting numbers to long somewhere... so numeric output has L > at end. > > I'm looking for a suggestion where to look in the code. It's on input, not > output, that the problem is occuring. I'm looking at the diffs and nothing > seems to stick out. Thanks for any suggestions.. Well, I'm baffled too. My only suggestions are for more things to try. > Here's an example on CE 3.0 > > >>> import dis > >>> def a(): x = 1 > >>> dis.dis(a) > 0L SET_LINENO 1L > > 3L SET_LINENO 1L > 6L LOAD_CONST 1L (1L) > 9L STORE_FAST 0L (x) > 12L LOAD_CONST 0L (None) > 15L RETURN_VALUE > > >>> x = 1 > >>> type(x) > > >>> Try these? ord('a') type(ord('a')) int("1") type(int("1")) eval("1") type(eval("1")) Cheers, M. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Michael Hudson Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:44:51 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774066 27193 211.57.49.2 (31 Dec 2001 04:47:46 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:47:46 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From lac at strakt.com Tue Dec 11 03:46:33 2001 From: lac at strakt.com (Laura Creighton) Date: Tue, 11 Dec 2001 09:46:33 +0100 Subject: two questions - sockets / c functions In-Reply-To: Message from Cliff Wells of "Mon, 10 Dec 2001 17:02:46 PST." <01121017024601.10828@logiplex1.logiplex.net> References: <3c14bc2c$1_2@news7.fast.net> <20011210165417.P18573@phd.pp.ru> <200112101947.fBAJllua032444@ratthing-b246.strakt.com> <01121017024601.10828@logiplex1.logiplex.net> Message-ID: <200112110846.fBB8kXua001298@ratthing-b246.strakt.com> > On Monday 10 December 2001 11:47, Laura Creighton wrote: > > The only thing Oleg forgot to tell you was that sockets don't work on > > Windows, so if that was the client-server you wanted, then you need > > threading instead. You may, of course, have already known this. If > > you want a client server with threading you may be interested in: > > Did you mean fork() doesn't work? Sockets work as well as anything else > on Windows, and I don't see how threading would help if they didn't. > > -- > Cliff Wells > Software Engineer > Logiplex Corporation (www.logiplex.net) > (503) 978-6726 x308 > (800) 735-0555 x308 Ah, I see I have to thank Cliff Wells as well as Oleg. Thank you Cliff. Laura From jkraska at san.rr.com Thu Dec 27 02:30:05 2001 From: jkraska at san.rr.com (Courageous) Date: Thu, 27 Dec 2001 07:30:05 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <96jl2u83ge9jfqfc4eedmeprp96c8sisno@4ax.com> >How is Python doing popularity wise? After such a meteoric growth >thought the nineties, and a spectacular climax in 2000 and early 2001, >is Python leveling out,... Compare the newsgroup traffic to other contemporary languages. While an imperfect metric, I believe you will find that Python is quite healthily alive. C// From igorr at ifi.uio.no Wed Dec 26 19:03:12 2001 From: igorr at ifi.uio.no (Igor V. Rafienko) Date: 27 Dec 2001 01:03:12 +0100 Subject: REPOST: try-except-finally question Message-ID: <5$--$$-$$$$%_-%_-$@news.noc.cabal.int> Hi, I'm writing a small program that updates a database. An update session depends on a number of external factors, and it is very important to log (to a file) if anything goes wrong. The skeleton code looks something like this: def updateDB(): # some initializing try: try: except ExternalFactorError: except DBError: # yrt # od finally: # yrt # end updateDB The outermost try-finally is needed to free the initialized resources. I have 2 questions: * In the innermost try-except there is a possibility for other exceptions than ExternalFactorError and DBError. How can I catch _all_ other exceptions than these two[*]? I'm not so much interested in error itself, but rather whether it occured. I.e. I'm looking for C++'s "catch (...)" construct in Python. * Is there a more elegant way of writing this function? TIA, ivr [*] is there a type that _all_ python object inherit from? (I know about exceptions.Exception, but I do not want to rely on whether third party modules actually inherit from it) -- Documentation is like sex: when it is good, it is very, very good; and when it is bad, it is better than nothing. -- Dick Brandon ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: igorr at ifi.uio.no (Igor V. Rafienko) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:44:44 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009776009 27193 211.57.49.2 (31 Dec 2001 05:20:09 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:20:09 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From Tom.Karas at htp-tel.de Sat Dec 29 16:26:01 2001 From: Tom.Karas at htp-tel.de (Tom Karas) Date: Sat, 29 Dec 2001 22:26:01 +0100 Subject: Was that to inpolite? Re: Call for a small program References: <3C2BAEF3.CC34B8DD@htp-tel.de> <3C2E0D55.9EC9B67F@htp-tel.de> <3C2E2D00.A8E511EB@earthlink.net> Message-ID: <3C2E34E9.E748DB4F@htp-tel.de> Hello Hans, > I don't see the message you're referring to. When did you post it? the name of the subject / thread is: Call for a small programm X-posting followup-to comp.lang.python from Friday Tom Karas -- Trust the computer industry to shorten the term "Year 2000" to Y2K. It was this kind of thinking that got us in trouble in the first place. Adrian Tyvand From rdsteph at earthlink.net Fri Dec 28 20:17:10 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sat, 29 Dec 2001 01:17:10 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B7276.88339BE7@earthlink.net> Message-ID: <4$--$$_----_-%$%%$@news.noc.cabal.int> Alex Martelli wrote: ....Hmmm, I think it's all my fault ...(snip-snip)..I basically turned off the Python newsgroup (and other netnews) to concentrate on other activity...(snip-snip).....Some day or other, I'll be back with my exaggerated posting volume... just got a few books & projects to complete first...... I noticed. It's sure good to read your posts again, Alex ;-))))) Looking forward to "Python in a Nutshell" and the "Python Cookbook", but missing intelligent posts and exponentially rising graph-lines for comp.lang.python usage in the meantime'ly yours, Ron Stephens http://www.awaretek.com/plf.html > "Hans Nowak" wrote in message > news:3C2B7276.88339BE7 at earthlink.net... > > Ron Stephens wrote: > ... > > > Sourceforge projects, about 1300 to 80). By the way, Just van Rossum's > > > http://starship.python.net/~just/comp.lang.python/ graph of Python > > > newsgroup coverage seems to show a slight decline from over 6000 per > > > month in late-middle 2001 to the current 3500 or so I see on here. Mr. > > > van Rossum said he may not be able to update these any more due to some > > > Yahoo change; anyway, am I interpreting these numbers and trends > > > accurately? Will the Python newsgroup usage turn upwards again? Does it > > > matter? > > Hmmm, I think it's all my fault -- in late-middle 2001 I basically turned > off the Python newsgroup (and other netnews) to concentrate on other > activity > (all Python-related). And, these days, less and less often do I find myself > somewhere with a newsreader and no other applicable tools (but it still > happens from time to time, e.g. today). > > Some day or other, I'll be back with my exaggerated posting volume... just > got a few books & projects to complete first... > > Alex ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2D1A0C.DF930726 at earthlink.net> Control: cancel <3C2D1A0C.DF930726 at earthlink.net> Date: Mon, 31 Dec 2001 02:17:28 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774924 27193 211.57.49.2 (31 Dec 2001 05:02:04 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:02:04 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jkraska at san.rr.com Wed Dec 19 23:44:38 2001 From: jkraska at san.rr.com (Courageous) Date: Thu, 20 Dec 2001 04:44:38 GMT Subject: Newbie Programming References: <84fd22ef.0112192032.14c75f8a@posting.google.com> Message-ID: On 19 Dec 2001 20:32:54 -0800, manutd8611 at softhome.net (Evan Roman) wrote: >I have just begun programming in Python a couple months ago. While i >feel like i am doing OK, i don't think im getting any better. The >problem is i can't think of anything to program... I think I have most >of the fundamentals down, but i can't think of any ways to use them. Get the pygame interface and write a computer game of some kind. Combine fun with education. C// From woodsplitter at rocketmail.com Sat Dec 22 04:45:46 2001 From: woodsplitter at rocketmail.com (stalin) Date: 22 Dec 2001 01:45:46 -0800 Subject: Fate of win32all? References: <7876a8ea.0112212116.2ebabc23@posting.google.com> <3C242A7F.2060805@skippinet.com.au> Message-ID: <7876a8ea.0112220145.2b7457af@posting.google.com> [Mark Hammond wrote] > Unfortunately, I am no longer employed by ActiveState :( I knew that (see my "employment... untimely end" comment); that was why I had become worried about the licensing status of win32all. > The win32all license remains unchanged. Glad to hear that. > I am leaving for a Christmas break, but intend getting a win32all out by > the new year - if not, just a few days after. Thanks for all your hard work. From tim at zope.com Thu Dec 13 12:27:49 2001 From: tim at zope.com (Tim Peters) Date: Thu, 13 Dec 2001 12:27:49 -0500 Subject: threading module oddness In-Reply-To: Message-ID: [Jason Orendorff] > I've been kicking around in the threading.py source code. > > Two things: > > 1. In Condition, I noticed this code: > > class _Condition: > ... > def _is_owned(self): > if self.__lock.acquire(0): > self.__lock.release() > return 0 > else: > return 1 > > According to the current documentation for the 'thread' module, > the lock object should have a locked() method: > > def _is_owned(self): > return self.__lock.locked() threading != thread; Conditions are documented as requiring a threading.Lock or threading.RLock, not a thread.lock, and the former define only .acquire() and .release(). > 2. Wow, I had no idea what was going on under the hood here. > Especially Condition.wait(). Wouldn't it be better if all this > stuff were implemented using the native primitives? Better according to what criteria? Certainly not better for maintainability or clarity. Still, threading.Condition is a factory function rather than a class precisely so that it would be *possible* to replace it with platform-specific cruft someday (i.e., without needing to worry about breaking user subclasses). Ditto all the other threading synch objects. > How would a patch for that be received, assuming I could only help > out with 1 or 2 platforms (pthread and NT)? (The rest could fall > back on the current Python implementation for now.) How it's received would depend on how portable and solid it was; e.g., there are many flavors of pthreads kicking around, while the Windows API has some useful synch primitives that don't actually exist on Win95. Sorting all that out is time-consuming, delicate work, so try to enlist platform experts to help. In the end, if the patch *only* kicked in for, say, Linux and post-Win95 Windows, but was well-tested on those, and proved significantly "better" (according to some objective criterion you have yet to identify <0.5 wink>), that's the majority of actual Python platforms, so I'd say "cool! good enough". From infinitystwin.SPAM at IS.BAD.yahoo.com Sat Dec 15 00:38:38 2001 From: infinitystwin.SPAM at IS.BAD.yahoo.com (Greg Krohn) Date: Fri, 14 Dec 2001 23:38:38 -0600 Subject: Is there any method to run Tk program without dos window? References: <9vejd3$euvji$1@ID-12869.news.dfncis.de> Message-ID: <3c1ae0e8$0$79560$6e49188b@news.goldengate.net> "Kick" wrote in message news:9vejd3$euvji$1 at ID-12869.news.dfncis.de... > I use Active Python in windows, every time I double click to run a tk > program, it will bring a dos window. How can I make this hidden? > > Thanks for any reply! use '.pyw' instead of '.py' From preben_er_t0ff at hotmail.com Thu Dec 13 15:23:04 2001 From: preben_er_t0ff at hotmail.com (Preben) Date: Thu, 13 Dec 2001 20:23:04 GMT Subject: which book? Message-ID: I've been recommended to buy a Python book, but I'm not sure which one I should buy.. Somebody told me to buy Python2.1 Bible. Anybody got an opinion? From ssthapa at classes.cs.uchicago.edu Mon Dec 17 21:49:36 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Tue, 18 Dec 2001 02:49:36 GMT Subject: Python CPAN beta test References: Message-ID: Syver Enstad wrote: >Very cool, but I have problems accessing the site, trying both with >emacs and with internet explorer. > I'll be putting things on sourceforge tonight, but tummy uses anonftpd which returns things in a slightly different format, although it follows the RFC standard. I had to include a patched version of the ftplib to download files from it. Try using a regular ftp client. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From loewis at informatik.hu-berlin.de Sat Dec 29 03:36:29 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 29 Dec 2001 09:36:29 +0100 Subject: REPOST: Re: ETA for Win32all under Python 2.2? References: Message-ID: <0$--$$_-----$$%__$@news.noc.cabal.int> David Brady writes: > Where do I get the package to build? > > How do I build the package? Others have already referred to the build instructions, at http://starship.python.net/crew/mhammond/win32/BuildingExtensions.html Follow the link "downloads", then "information on getting the sources". If you don't understand the instructions on these pages, don't hesitate to ask. > If your reply has anything to do with CVS, how the > heck do I get at it from Win32? (Lots of people have > told me they've heard of other people doing this, but > I'm starting to think it's an urban legend.) Well, I'm doing it myself, so I know it's not a legend. The instructions on getting a CVS binary, and on getting the Win32all source tree should be pretty clear. If you also want the Python source tree proper using CVS, see http://python.sourceforge.net/sf-faq.html#c2 > > (if it doesn't, please submit a bug report). > > *sigh* Vast, man, vast. How do I submit a bug > report? Go to http://sf.net/projects/python Select "Bugs", then select "Submit New". > P.S. Please note, I may be ignorant, but I'm not > stupid. If there is a good place that explains how to > get and build Python and its packages, I'll happily > wade through the documentation. Please report success or failure on this list. Notice I've never build the extensions myself, so I don't know how easy it is. If you succeed, you may consider packaging them as well. I believe you need the Wise installer for that; you'll find links on Mark's pages as well. If you have the Wise installer, and you've managed to package the extensions, don't hesitate to publish your binaries; contact python-dev at python.org if you don't know how to publish them or post to comp.lang.python.announce when you have published some somewhere. I think this reliance on a single person to build a binary package is unacceptable, especially since Mark has written all this documentation to get others started. It is time that Win32all maintainance is off-loaded to other shoulders. Regards, Martin ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Martin von Loewis Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:01:51 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774801 27193 211.57.49.2 (31 Dec 2001 05:00:01 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:00:01 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From daniel.pote at xms.se Wed Dec 12 04:37:33 2001 From: daniel.pote at xms.se (Daniel Pote) Date: Wed, 12 Dec 2001 10:37:33 +0100 (CET) Subject: Import random Message-ID: <54907.192.168.146.2.1008149853.squirrel@portal.xms.se> Hi, Just joined this group after trying to compile mailman on HP-UX 11.00. It seems to be something wrong when trying to import random. Compiling /opt/mailman/Mailman/versions.py ... Traceback (most recent call last): File "bin/update", line 31, in ? from Mailman import Utils File "/opt/mailman/Mailman/Utils.py", line 32, in ? import random File "/opt/python/lib/python2.1/random.py", line 93, in ? _verify('NV_MAGICCONST', 1.71552776992141) File "/opt/python/lib/python2.1/random.py", line 88, in _verify raise ValueError( ValueError: computed value for NV_MAGICCONST deviates too much (computed 0, expe cted 1.10415e+09) Same result if i run python and types: import random Can anyone help me on this ? I have installed python 2.1 package from hpux.connect.org.uk /Daniel From fperez528 at yahoo.com Wed Dec 5 20:50:27 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Fri, 07 Dec 2001 01:18:27 +2328 Subject: strict python? References: <3C1060E4.756F33B2@earthlink.net> <3C107172.6866DC18@alcyone.com> <9ups92$ers$1@peabody.colorado.edu> <3C10776C.8BB710EF@alcyone.com> Message-ID: <9upu2a$g4v$1@peabody.colorado.edu> Erik Max Francis wrote: > Fernando P?rez wrote: > >> I honestly don't see any reason for something like that not to be >> included in python (other than perhaps 'if perl has it it can't be >> good' :) > > Agreed. For the record, I wasn't suggesting something mandatory. Certainly not. In perl, it's the -w switch, in gcc the -W family (with -Wall the max). And that's as it should be, an option (sort of a builtin pychecker). While on the topic of pychecker, I've been a bit disappointed. Not meaning to demerit the developers, I'm sure it's been a ton of hard work, but when I've used it I tend to get way too many spurious warnings and very little substance. Well, maybe I just don't know how to use it well, I really haven't looked at it in detail. Regards, f. From mcfletch at rogers.com Mon Dec 24 03:15:45 2001 From: mcfletch at rogers.com (Mike C. Fletcher) Date: Mon, 24 Dec 2001 03:15:45 -0500 Subject: Properties fun with 2.2 Message-ID: <3C26E431.9030800@rogers.com> For a long time I've wanted a way to define properties for Python classes that have all the automated checking you'd expect from properties (in order to automatically create GUIs): only defined properties can be assigned to assignment/retreival is with standard syntax (x.y) only values of the appropriate type can be assigned, allow for automatic bounds checking and the like values are (intelligently) coerced to proper types if possible data is stored in the class using standard mechanisms (__dict__) (make it easy for things such as pickling, introspection, etceteras to work without special support) allow for introspection of the property definition to allow for declaring appropriate editing controls, events, etceteas (in GUI environments) allow completely different functionality for each property Well, just did some playing with the 2.2 properties class/type, and it turns out it's easily sub-classable to create something to support the list above. class SimpleProperty( property ): def __init__( self, name, documentation = "" ): property.__init__( self, self.getValue, self.setValue, self.delValue, documentation ) self.name = name def getValue( self, client ): return client.__dict__[ self.name ] def setValue( self, client, value ): client.__dict__[ self.name ] = value def delValue( self, client ): del client.__dict__[ self.name ] class X( object ): first = SimpleProperty( 'first', 'testing documentation' ) So, to define a new property type (for instance, a property type whose values must always be subclasses of a given type/class): class CheckedProperty( SimpleProperty ): def __init__( self, name, documentation = "", dataType = None ): self.dataType = dataType SimpleProperty.__init__( self, name, documentation ) def setValue( self, client, value ): if not isinstance( value, self.dataType ): raise TypeError( '''The value %s is not of the required type %s'''%(repr(value), self.dataType)) return SimpleProperty.setValue( self, client, value ) class Y( object ): first = CheckedProperty( 'first', 'testing documentation', int ) The "only defined properties" thing can be done with a __slots__ definition in the object, but then there's no __dict__ in which to store the data (there must be some way to say "store in the slot", I just don't see it right now). Real-world examplex of property classes will likely wind up being fairly complex (with shared coercian mechanisms/codecs, application-specific coding, etcetas), but a core set might be workable, possibly something that can support extensions for common requirements (e.g. bounds and type checking, or coercian plugin frameworks (into which you'd plug your application-specific checkers/coercers)). Anyway, just thought others might be interested in the new world which has opened at our feet :o) ;) . Thanks dev peoples! Much appreciated! Enjoy yourselves, Mike _______________________________________ Mike C. Fletcher http://members.rogers.com/mcfletch/ From duncan at NOSPAMrcp.co.uk Tue Dec 4 04:28:03 2001 From: duncan at NOSPAMrcp.co.uk (Duncan Booth) Date: Tue, 4 Dec 2001 09:28:03 +0000 (UTC) Subject: Tuples -> Function Params? References: Message-ID: Philip Swartzleonard wrote in news:Xns916DB37570FARASXnewsDFE1 at 130.133.1.4: > Duncan Booth || Tue 04 Dec 2001 12:57:16a: > >> Philip Swartzleonard wrote in >> news:Xns916D6505401FRASXnewsDFE1 at 130.133.1.4: >>> a,b,c = self.color glColor3f(a,b,c) >>> >>> Ok, the question is, is there a way to do this where i >>> don't unpack the tuple and pass sepearte arugments? >> >> Recent versions of Python: >> glColor3f(*self.color) >> >> For older versions, use the apply function. >> > > Thanks, both of you, that will mkae this more friendly i think :). > Where can i go to read up on this * notation, i've only vaguely seen > it before... > http://www.python.org/2.0/new-python.html#SECTION0001010000000000000000 Unfortunately this particular syntax doesn't yet seem to have made it into the main documentation. -- Duncan Booth duncan at rcp.co.uk int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3" "\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure? From grey at despair.dmiyu.org Mon Dec 24 18:54:06 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Mon, 24 Dec 2001 23:54:06 -0000 Subject: State of the SysAd art (was: vi or emacs for editing Python on Linux?) References: <1009127729.9271.0.nnrp-12.c2de51d8@news.demon.co.uk> <2E48C714A6E1FBA1.19DE5ADEBF7F088A.DF90F2C1E6CC9E7C@lp.airnews.net> Message-ID: On 24 Dec 2001 17:43:00 -0600, Cameron Laird wrote: . > Does this match others' experience? I continue to > run into plenty of production hosts which have barely > been maintained for up to four years, let alone > outfitted with such new-fangled decorations as a > properly-installed ssh. Then how are you getting onto the machine? I hope not plain old telnet. Furthermore there are other options of gettimg things onto that machine than scp. That was, of course, an example to point out that one doesn't need to edit on that machine to get work done. I have been on a machine where ssh was available but scp out of it was not. cat > sift.pl Any other questions or can we finally put the bullshit argument to rest? -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From michael at stroeder.com Sat Dec 29 17:54:03 2001 From: michael at stroeder.com (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Sat, 29 Dec 2001 23:54:03 +0100 Subject: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> Message-ID: <3C2E498B.6DC757E0@stroeder.com> Nils Kassube wrote: > > gerson.kurz at t-online.de (Gerson Kurz) writes: > > [Error checking without exceptions] > > > So ? After all, C doesn't need it, and I think few C programmers would > > call this feature the "most missing", or? > > C and programmers who like C should die a slow and painful death for > holding back the computer industry for two decades. Fully agree with that. Ciao, Michael. From mwh at python.net Sun Dec 23 14:40:07 2001 From: mwh at python.net (Michael Hudson) Date: Sun, 23 Dec 2001 19:40:07 GMT Subject: [BEGINNER] meta-functions References: Message-ID: Igor Mozetic writes: > A simple question from a newbie, sorry. > > I have functions defined normally, def fname(arg1,arg2): > and also represented as tuples (fname, arg1, arg2), > to use them by apply(fname, (arg1,arg2)) - no problem. > > How do I make a comparison: fname == 'string' ? > I found that I could use repr(fname) and parse the > resulting string, but I consider this ugly. > Is there a standard function to return a function name > as a string? Try fname.__name__ or fname.func_name, but also try this: def f(): pass g = f print g.func_name > I'm restricted to Python 1.5.2. > I'm not on the list, please reply to me. Oops. Cheers, M. From michael at rcp.co.uk Fri Dec 7 06:51:30 2001 From: michael at rcp.co.uk (Michael Abbott) Date: Fri, 7 Dec 2001 11:51:30 +0000 (UTC) Subject: strict python? References: <3C1060E4.756F33B2@earthlink.net> <3C107172.6866DC18@alcyone.com> Message-ID: Erik Max Francis wrote in news:3C107172.6866DC18 at alcyone.com: > Hans Nowak wrote: > >> Well, 'self.func' is a perfectly valid Python expression, just like >> '3'. Not very useful when used like this, but still, perfectly valid. > > Seems like now there are warning facilities built into the language it > might be useful to have warnings emitted in situations like this (a > statement with no side effects) -- things that are truly not error but > are genuinely not useful either. > Unfortunately, it is possible that self.func does indeed have important side effects, and in general the Python compiler can't tell. For example, there might be a __getattr__ method defined doing something naughty behind the scenes! From peter at engcorp.com Mon Dec 17 19:26:03 2001 From: peter at engcorp.com (Peter Hansen) Date: Mon, 17 Dec 2001 19:26:03 -0500 Subject: Preserving program structure References: Message-ID: <3C1E8D1B.FC35E4E@engcorp.com> Michael Chermside wrote: > > > A problem that just about everything except SciTE (Scintilla) > > has is that it may color code the program, but it only prints in > > black and white (if it will print at all). > > Check out my favorite, CodeWright (windows only) found at > http://www.starbase.com CodeWright's a nice editor, but they really need to add support to make it an Active Script Host, so we could write our scripts in Python instead of the existing options (VB, Perl, or via DLLs only!). Given that it's a Windows-only product, the lack of support for this interface is pathetic. Unfortunately, their marketing group doesn't think enough people are requesting this feature (yet) for it to be worth their time to add it. -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From LLoeffler at home.com Sun Dec 2 22:45:15 2001 From: LLoeffler at home.com (Luke) Date: Sun, 02 Dec 2001 21:45:15 -0600 Subject: Very new to this References: <#k0oOh4eBHA.1192@cpimsnntpa03> <#EQGkj4eBHA.1188@cpimsnntpa03> <3C0AB92D.2010407@home.com> <#3jVur4eBHA.1404@cpimsnntpa03> <3C0AEF74.3080005@home.com> Message-ID: <3C0AF54B.8070301@home.com> It will close automatically when there are no more commands to be executed. To explicitly kill it, import sys sys.exit(0) Luke From shalehperry at attbi.com Sun Dec 30 00:34:51 2001 From: shalehperry at attbi.com (Sean 'Shaleh' Perry) Date: Sat, 29 Dec 2001 21:34:51 -0800 (PST) Subject: Paramaterized local variable name In-Reply-To: <9c3f2e9c.0112292115.6a4e22af@posting.google.com> Message-ID: > > So, if local_name is equal to 'name' or 'rev' or 'whatever', what I > want is something like: > > def paging(data, key, query_dict, local_name): > for i in range(0, len(data[key]), use_pagesize): > start = data[key][i]. ># What goes here ^^^^ ? > exec("start = data[key][i].%s" % local_name) should do nicely I think. Basically, create a line of python code and tell python to execute it. Works just as if the line was in your code. From kirifam1 at cs.com Mon Dec 24 02:37:08 2001 From: kirifam1 at cs.com (Kirifam1) Date: 24 Dec 2001 07:37:08 GMT Subject: Confusion with Classes Message-ID: <20011224023708.28093.00000469@mb-cq.news.cs.com> I am pretty new to Python and object oriented programming in general. I am writing a gui module for another program and want to model it after the standard gui widgets Visual Basic. (Yes I know there are already GUI moduls and packages for python, but i am writing my own, we all need to write our own code sometimes). To create this I am using PyGame so anyone that doesn't have a background in pygame, might not quite get all of it. I started with a form class. This create form objects. My plan was that all widgets such as buttons, images, labels, etc., would be underneath this. such as NewForm = form() then u could set parameters such as NewForm.pos = (100,100) NewForm.bgcolor = (255,255,255) NewForm.bgimage = "bgimage.bmp" Then the form class has a method for rndering the form and all objects underneath it onto a single surface, return that surface and blit it onto the screen whereever the user wants, such as screen.blit(NewForm.render(), (0,0)) Ok, so that's the plan...here's where the problem comes in. To get all the widget objects underneath the form I nested the classes as u can see in the attached code. Now what i need to do is figure out a way to reach the parent object (namely the form) from within the widget's methods to add the widget to a list in the form object. So for example NewForm.labellist would hold a list of all the labels in NewForm such as NewForm.label1 NewForm.label2 NewForm.label3 If I am going about this all wrong, please help, but please try to get my basic idea. Thanks a lot for any help you could provide. Email me at akiriwas at poboxes.com please. Thanks -Anton Kiriwas ATTACHED CODE #/usr/bin/env python # imports import pygame, pygame.font, pygame.image, pygame.transform from pygame.locals import * pygame.init() class cursor: cursorlist = [] def __init__(self, pointpos=(0,0), image="c:\windows\pinstripe.bmp", maskrpg=(255,0,255)): self.__class__.cursorlist.append(self) self.pointpos = pointpos #To know where the point is on the cursor self.image = image self.maskrgb = maskrpg self.currentpos = (0,0) def update(self): self.currentpos = pygame.mouse.get_pos() class form: def __init__(self, formwidth, formheight, bgimage=None, bgcolor=(0,0,0)): self.formwidth = formwidth self.formheight = formheight self.bgimage = bgimage self.bgcolor = bgcolor def render(self): #self.widgetlist.append(self.label.labellist) #self.widgetlist.append(self.button.buttonlist) #self.widgetlist.append(self.cursor.cursorlist) main_surface = pygame.Surface((self.formwidth, self.formheight), HWSURFACE).convert() main_surface.fill(self.bgcolor) if self.bgimage != None: tempimg = pygame.image.load(self.bgimage) tempimgrect = tempimg.get_rect() tempimg = pygame.transform.scale(tempimg, (self.formwidth, self.formheight)) main_surface.blit(tempimg, (0,0)) del tempimg, tempimgrect for x in self.label.labellist: font = pygame.font.Font(x.fontname, x.fontsize) templabel = font.render(x.text,1,x.fontcolor) templabelpos = templabel.get_rect() print "the templabelpos is ", templabelpos main_surface.blit(templabel,x.pos) print "blitted 1" templabel = "" return main_surface #------------------------------------------------------------------------------ class label: labellist = [] def __init__(self, pos=(0,0), text="sample text", fontsize=12, fontcolor=(255,255,255), fontname=None): self.__class__.labellist.append(self) self.pos = pos self.text = text self.fontsize = fontsize self.fontcolor = fontcolor self.fontname = fontname class button: buttonlist = [] def __init__(self): self.__class__.buttonlist.append(self) self.imageup = "sampleup.bmp" self.imagedown = None self.imageover = None self.fontname = None self.fontsize = 20 self.fontcolor = (0,0,0) self.text = "" self.locx = 0 self.locy = 0 From fperez528 at yahoo.com Fri Dec 7 11:53:57 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Sat, 08 Dec 2001 16:21:57 +2328 Subject: It's hard to find documentation References: <200112081328040980.0156CC2B@mail.rdc1.sdca.home.com> <20011208213833.GA1268@lilith.hqd-internal> Message-ID: <9uu7c4$j1e$1@peabody.colorado.edu> Bruce Eckel wrote: > Sure, but why can't I use the search mechanism to do this? If it > won't discover a document when I give it the exact title, it seems > pretty difficult to find lesser things. For that matter, I can't > think of when the search mechanism on the site has given me what I > was looking for. It seems to vary between thousands of documents > and "nothing found" > Fully agreed. I consider the search engine at the site useless for all practical intents and purposes. My normal routine is to keep a bookmark to my local copies of: - the main index for the html docs - the general library index: http://www.python.org/doc/current/lib/genindex.html and I always run pydoc -g as a webserver, and keep an open window at http://localhost:7464/ This gives me full access to the docs. That, plus having 'from pydoc import help' in my shell defaults. Don't bother with the website. You type 'Extending and Embedding the Python Interpreter' the *exact* title of the document http://www.python.org/doc/current/ext/ext.html and you get *three* lousy hits, mainly on the words 'python' and 'the'. The most recent is from 1996, and *none* refer to the above doc. So if the search engine can't even find major documents within the site itself, don't waste your time with it. I have no idea why they don't use google instead. Type the same string in google, and even though it's searching *the whole web*, not just python.org, the very first hit is exactly the url above. The problem is simply that the 'ultraseek' engine that python.org uses is a complete piece of junk. Google can be used by sites, so maybe at some point they'll change. In the meantime, use the web-wide google and prepend all your queries with 'python', or if you really want site-specific info only with 'site:python.org'. Cheers, f From Remove_This_malex at viking.tagancha.org Fri Dec 14 11:29:14 2001 From: Remove_This_malex at viking.tagancha.org (Oleksandr Moskalenko) Date: Fri, 14 Dec 2001 16:29:14 +0000 (UTC) Subject: which book? References: <9vd6n0$ha8$1@mozo.cc.purdue.edu> Message-ID: <9vd9cq$ihj$1@mozo.cc.purdue.edu> Maybe that's why I wrote PUBLISHED in capital letters... Who knows what the quality and scope of those that are yet unpublished will be. So far there aren't any good ones on this topic it seems. Alex. P.S.: I would love to hear about any good documentation on a web design framework with Python that would let me build a web application as my first project (barring the textbook excercises I've done so far). On Fri, 14 Dec 2001, DeepBlue unleashed unto the World: > There are two books to be published on Python and the web, and one to be > published on Python and XML in addition to one that is already published. > DeepBlue > > "Oleksandr Moskalenko" wrote in > message news:9vd6n0$ha8$1 at mozo.cc.purdue.edu... >> On Fri, 14 Dec 2001, DeepBlue unleashed unto the > World: >> > Learning Python by Lutz and Ascher and >> > Python Essential Reference 2nd Ed by Beazley >> > >> > At a more later stage: >> > Programming Python 2nd Edition by Lutz >> > >> > For web application and Python, check amazon.com or bn.com and search > for >> > Python. >> > DeepBlue >> >> And such a search would come up with the following PUBLISHED books: >> 1) An impossible to find book by Guido van Rossum and >> 2) "Web Programming in Python: Techniques for Integrating Linux, Apache > and >> MySQL", which doesn't have a single review and a bunch of them are >> already sold used. I would be very cautious with a book like that. >> >> I couldn't find any other published book on the web programming with > Python >> subject unfortunately. >> >> Alex. >> > > From chrishbarker at attbi.com Tue Dec 11 15:37:41 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Tue, 11 Dec 2001 12:37:41 -0800 Subject: lost interest? References: <20011208001123.A5989@casa.parque> <3C14FEBD.AD52B516@attbi.com> <3dzo4pputt.fsf@ute.mems-exchange.org> <3C16501E.D817323D@attbi.com> <3du1uxpma1.fsf@ute.mems-exchange.org> Message-ID: <3C166E95.62B357AA@attbi.com> Andrew Kuchling wrote: > It would certainly be nice if someone would actually finish > implementing a bdist_deb target for Distutils, though, so that all > Python modules can be automatically turned into .debs. Yes, that would be very nice > > The same is true for rpm based systems, but let's face it, distutils > > was created for a reason. It would be very helpful if there could be ONE > > way for people to do it, on ALL platforms. > > The community seems to disagree on this point. Come to think of it, I disagree on this point (and I made it!). In fact, I think what most people want is some sort of installer/package that is native to their platform, rather than a Python based one. Form above, it seems to be that this could, in fact, be done with Distutils. If Distutils can automagically build a complete set of packages for various p[latforms, we'd be in good shape to set up a one stop shopping repository. > Has Suchandra gotten > any comments on ciphon? I know I had never heard of it, and still can't find it (the sourceforge page seems to be dead). > Will Jason Petrone get any comments on the > ports-style package manager that he just posted about? No comments on > either have ever been posted to the catalog-sig, as far as I can see. I have to say that I'm curious as well about this...It seems that there are a lot of posts from people wanting a "CPAN-like" something, but when someone posts a proposal, they get very few comments, and even less support. My experience when I posted a proposal was that almost everyone that did comment was all gung ho about their own personal vision of the nifty it-dowloads-and-installs-itself system, and no one wanted to do the work of just getting all the packages together. It seems no one wants to start small. Will all things open source, this is going to take one person who puts in the time to put together something truly usefull, and then they may get some support. I hope I'll have the time someday, and if not me, someone else. I'm convinced it is needed. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From java at dejazzd.com Fri Dec 7 10:22:58 2001 From: java at dejazzd.com (Choco) Date: Fri, 07 Dec 2001 10:22:58 -0500 Subject: Oracle Access References: Message-ID: <9uqmsf0t7f@enews2.newsguy.com> I have used two: cx_Oracle (http://www.computronix.com/utilities/) DCOracle2 (http://www.zope.org/Members/matt/dco2) Right now, I've had better luck compiling cx_Oracle on a Digital Tru64 database server, so I've been using that one for all my scripting. It works for most things; not necessarily better than DCOracle2. Glenn A. Keyton Weissinger wrote: > What is the best module out there for running queries (both DDL and DML) > against an Oracle 8i database? > > Keyton From joonas at olen.to Thu Dec 27 16:14:47 2001 From: joonas at olen.to (Joonas Paalasmaa) Date: Thu, 27 Dec 2001 23:14:47 +0200 Subject: REPOST: Finding out that Python is in interactive mode in sitecustomize.py Message-ID: <8$--$$_----_-$-%_$@news.noc.cabal.int> How can I find out that Python is started in interactive mode in sitecustomize.py ? The need for that information is, that I want that certain customizations take place only at interactive mode. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!newsfeed.mathworks.com!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Joonas Paalasmaa Newsgroups: comp.lang.python Subject: cmsg cancel <3C2B8F47.4CEACF6E at olen.to> Control: cancel <3C2B8F47.4CEACF6E at olen.to> Date: Mon, 31 Dec 2001 04:59:42 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775584 27193 211.57.49.2 (31 Dec 2001 05:13:04 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:13:04 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From sholden at holdenweb.com Wed Dec 19 09:37:46 2001 From: sholden at holdenweb.com (Steve Holden) Date: Wed, 19 Dec 2001 09:37:46 -0500 Subject: Complex numbers and division by zero errors References: Message-ID: "Stephen Boulet" wrote in message news:u20jppidgmhcc3 at corp.supernews.com... > Is there any package that handles division by zero errors in complex > numbers gracefully? > The problem there is, exactly what you consider to be "graceful". Since there is no generally acceptable specification of what to do, there is no way that anything except raising an exception can be considered "doing the right thing". Of course this is unfortunate if it's happening inside a package you are calling. There one error can mean a whole computation doesn't finish. regards Steve -- http://www.holdenweb.com/ From wurmy at earthlink.net Mon Dec 17 16:19:33 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Mon, 17 Dec 2001 21:19:33 GMT Subject: Dr. Dobb's Python-URL! - weekly Python news and links (Dec 17) References: Message-ID: <3C1E6196.8B039A10@earthlink.net> Paul Boddie wrote: > Mygale seems to make the "Python-URL!" editor's job redundant... > or easier? > http://www.awaretek.com/nowak/mygale.html Easier. A program is pretty poor at judging whether an article is related to Python or not. :-) I might as well make this a semi-official announce: Mygale is a specialized webcrawler that searches news sites for Python-related articles. Current version is 0.6.x, and it should be reasonably stable. Not everything I wanted has been implemented yet, though. The main problem is that some news sites seem to return any old article when you do a search for "python". Some articles just contain the word, but are unrelated; can't really blame the site's search engine for this. Other articles don't even contain the p-word at all. >=( This kind of thing is very hard to filter out (at least I think so). There are also problems with determining the dates of some articles. More info at the aforementioned site. Suggestions, bug reports, patches, new extractors, etc. are welcome. :) --Hans From LLoeffler at home.com Fri Dec 28 17:40:26 2001 From: LLoeffler at home.com (Luke) Date: Fri, 28 Dec 2001 22:40:26 GMT Subject: is this a bug or what? References: Message-ID: <3C2CF499.9070607@home.com> > Is this new age math? *chuckle* From warkid at storm.ru Tue Dec 18 04:54:40 2001 From: warkid at storm.ru (Kerim Borchaev) Date: Tue, 18 Dec 2001 12:54:40 +0300 Subject: sys.path ordering question Message-ID: <4537.011218@storm.ru> Could someone explain the paths ordering logic used to create sys.path listed below? Why win32 extensions are before standard python paths but Numeric and other after? (I know this ordering makes sense - it's how modules are searched. And in fact I'm asking this to get guidelines how should I arrange my own packages.) >>> import sys >>> import pprint >>> pprint.pprint(sys.path) ['', 'C:\\Python21\\Pythonwin', 'C:\\Python21\\win32', 'C:\\Python21\\win32\\Lib', 'C:\\Python21', 'C:\\Python21\\DLLs', 'C:\\Python21\\lib', 'C:\\Python21\\lib\\plat-win', 'C:\\Python21\\lib\\lib-tk', 'C:\\Python21\\Numeric', 'C:\\Python21\\PIL', 'C:\\Python21\\PPM'] Thanks in advance... Ragards, Kerim. From buzzard at urubu.freeserve.co.uk Wed Dec 5 11:51:42 2001 From: buzzard at urubu.freeserve.co.uk (Duncan Smith) Date: Wed, 5 Dec 2001 16:51:42 -0000 Subject: PyInline problem Message-ID: <9uljcb$8ap$1@newsg4.svr.pol.co.uk> Can anybody tell me why this won't build? It doesn't seem to like the include files, but I have been advised that I probably need them. Python 2.0, PyInline 0.03. Thanks. import PyInline m = PyInline.build(code=""" #include #include int myfunc(int a) { if(n < 0){ exit(1); } return a * (a+1); } """, language="C") From dalke at dalkescientific.com Wed Dec 12 18:00:44 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Wed, 12 Dec 2001 16:00:44 -0700 Subject: common regular expressions Message-ID: <9v8ns4$46m$1@slb3.atl.mindspring.net> Hey all, I'm trying to put together a set of common regular expression patterns for Martel (http://www.dalkescientific.com/Martel/ ). The idea is to provide a set of `macros,' rather than having people create them from scratch. The ones I've thought of so far are: Digits = \d+ Integer = [+-]?\d+ Float = something like (wrote this on the fly; likely wrong) [+-]?([0-9](\.[0-9]*)?|\.[0-9]+)([eE][+-]?[0-9]+)? I know this excludes NaN and [+-]Inf Word = \w+ Spaces = [ \t]+ (NOT the same as \s+) # Before you read further, yes, I know some of these # patterns are too small or too large. Yes, the IPv4 # should only take a number up to 255 and there are # different forms besides the dotted quad. Yes, the # URN could have a "." in the last position. Yes, # URLs are very complicated. Yes, I've read Friedl's # book. # # All I'm trying to do is make it so people who don't # know regular expressions very well (and haven't read # Friedl's book) can get nearly all of what they want # with little work. _basic_host = [a-zA-Z]([a-zA-Z0-9]|-[a-zA-Z0-9])* Hostname = {_basic_host}(\.{_basic_host})+ | [0-9]+(\.[0-9]){3} Email = {Word}@{Hostname} RFC_From = ... a big mess Mailto = mailto:{Email} URN = [Uu][Rr][Nn]:([^\s.]+|\.(?!\s))+ URL = ... another big mess US_phone = (\(\d+\) ?|\d\d\d[ .-])?\d\d\d[ .-]\d\d\d\d (sigh, this excludes 1-800-555-1212) # various dates -- would be nice to have more formal # names for these rather than making up my own month = 0[1-9]|1[012]?|[23456789] day = 0[1-9]|1[0-9]?|2[0-9]?|3[01]?|[456789] year_2 = \d\d year_4 = \d\d\d\d year_2_or_4 = \d\d(\d\d)? US_date = {month}/{day}{year_2_or_4} International_date = {day}[/.]{month}[/.]{year_2_or_4} ISO8601_date = \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} ARPA_date = ... As you can see, these get hairy, fast. Does anyone have suggestions for common, useful patterns? Both needed patterns and existing definitions would help. I searched the web for definitions but found nothing better than what I listed here. Andrew dalke at dalkescientific.com From jdhunter at nitace.bsd.uchicago.edu Sat Dec 29 22:10:36 2001 From: jdhunter at nitace.bsd.uchicago.edu (John Hunter) Date: Sat, 29 Dec 2001 21:10:36 -0600 Subject: Is learning Python "extraordinary"? References: Message-ID: >>>>> "Jesse" == Jesse W writes: Jesse> Going back to the salt mines of college essay writing, Write some python code that writes extraordinary college essays. Now that would be extraordinary. Search http://groups.google.com/advanced_group_search for 'write-thesis' limiting the newsgroup to gnu.emacs.help. Read the posts for inspiration. Take care to be clear in your essay since none of your application readers will have heard of python, likely. Good luck! John Hunter From hfoffani at yahoo.com Fri Dec 21 13:39:16 2001 From: hfoffani at yahoo.com (Hernan M. Foffani) Date: Fri, 21 Dec 2001 19:39:16 +0100 Subject: /usr/bin/env: python: No such file or directory References: <915a998f.0112161542.2ab07235@posting.google.com> <3C222B16.C1B1BC8D@attbi.com> <3C225488.AF5C93F4@attbi.com> <9vu4pp$8to$1@news.island.liu.se> Message-ID: <20011221133917.970$4T@news.newsreader.com> > > How would the interpreter know what version was required? That's exactly > > what I think we need...A way to tell the interpreter what version is > > required by a script. > > So, your script requires Python version 2.5 to run, but won't run on > 2.4 or 2.6. But is that version 2.5 of the language specification, or > is that version 2.5 of Guido's Python interpreter (which implements > version 2.4 of the language spec)? > ... etc ... The simplest way to do is to pack your own interpreter and put it in some deep-down directory. Think on Zope! If they do it (and they pay python devs salaries :)) I won't go upstream. Actually RH should provide 2 python interpreters. The one that would be installed in a special dir along with the bunch of scripts they need and the one that goes with the devs package or whatever RH like to name it. Yes. We may end with a dozen of Python's interpreters in the hard-drive. But, so what? :) Regards, -Hernan From frankimmich at gmx.de Fri Dec 7 03:20:06 2001 From: frankimmich at gmx.de (Frank Immich) Date: Fri, 7 Dec 2001 09:20:06 +0100 (MET) Subject: How to use NetUseGetInfo() ? Message-ID: <11247.1007713206@www46.gmx.net> Hello there, I have a question concerning the win32net module. I want to map the networkpath (UNC) to the corresponding network resource with Python. E.g. E: = \\server1\dr1\dir2 Therefore, I think, I have to use NetUseGetInfo() ? But I get the following error thread: import win32net > dict = win32net.NetUseGetInfo( None, 'E:' , 0 ) > > Traceback (most recent call last): > File "C:\info.py", line 4, in ? > dict = win32net.NetUseGetInfo( None, 'E:' , 0 ) > pywintypes.api_error: (2250, 'NetUseGetInfo', 'Die Netzwerkverbindung > konnte > nicht gefunden werden. This tells me that the Network connection couldn’t be found... But the DOS command: net use E: works fine !!! What’s wrong. Am I using the NetUseGetInfo() command correct ? Thanks for help Ciao Frank -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From ssthapa at classes.cs.uchicago.edu Fri Dec 28 17:27:52 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Fri, 28 Dec 2001 22:27:52 GMT Subject: REPOST: Re: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> Message-ID: <8$--$$_-----$%$__$@news.noc.cabal.int> Anne & Lynn Wheeler wrote: > >claird at starbase.neosoft.com (Cameron Laird) writes: >> RFC 765 FILE TRANSFER PROTOCOL June 1980 >> RFC 821 SIMPLE MAIL TRANSFER PROTOCOL August 1982 >> RFC 854 TELNET PROTOCOL SPECIFICATION May 1983 >> RFC 850 Standard for Interchange of USENET Messages June 1983 >> RFC 977 Network News Transfer Protocol February 1986 > >765 is the latest standard .... there is a trail of previous RFCs that >were replaced by the latest ... going back to Actually I believe rfc765 and rfc959 (FTP protocol) is superceded by rfc1123 which outlines and corrects the specifications for the ftp, telnet, smtp, and dns protocols. In particular interest to me, rfc1123 indicates that pasv responses in the ftp protocol don't have to have the format of 227 (h1,h2,h3,h4,p1,p2). This was something that the python ftplib assumed until the 2.2 release and which caused problems with anonftpd. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:40:10 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775011 27193 211.57.49.2 (31 Dec 2001 05:03:31 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:03:31 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From fredrik at pythonware.com Tue Dec 4 02:29:20 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 04 Dec 2001 07:29:20 GMT Subject: Python evangelists unite! References: <3C07884E.75E18DF7@engcorp.com> <9ue2o2$b344@news1.gtech.com> <3C0B08F3.C9CDE885@engcorp.com> <3C0C53F5.9A7EBC08@engcorp.com> Message-ID: Peter Hansen wrote: > I'm not sure how it missed that one... were you trolling? or was I perhaps referring to that other "I learned the one truth years ago" job security guy? From usenet at NOSPAM-irmen.cjb.net Tue Dec 4 16:48:05 2001 From: usenet at NOSPAM-irmen.cjb.net (Irmen de Jong) Date: Tue, 4 Dec 2001 22:48:05 +0100 Subject: license key validation - encryption/decryption References: Message-ID: <9ujgam$a1e$1@news1.xs4all.nl> > How do i validate it at the customer site that the > "key" installed is valid? You're looking for a secure hash of your license file, to protect the contents of the file from tampering. The sha module can do this for you. Now somehow you need to encode information about that unique customer into your license, so that another customer cannot also use that license file. Perhaps some sort of public-private key scheme would work? It's quite a task to create a Python application that can't be tricked (hacked) to think that the license is valid for *all* features. Irmen de Jong From jkraska at san.rr.com Tue Dec 11 14:07:36 2001 From: jkraska at san.rr.com (Courageous) Date: Tue, 11 Dec 2001 19:07:36 GMT Subject: Fatal Error in the interpreter? References: Message-ID: On Tue, 11 Dec 2001 21:30:14 +1100 (EDT), Andrew MacIntyre wrote: >On Mon, 10 Dec 2001, Courageous wrote: > >> I'm currently using the Debug build from Python as checked >> out of the current CVS branch (Python22). I have an extension >> that I've written and compiled successfully, but when I import >> it, the interpreter crashes: "Fatal Error: Interpreter not >> initialized (version mismatch?)" >> Upon introspection, it appears that the program is crashing >> from within Py_InitModule(). >The one time I saw this (on OS/2 so it may not translate), ISTR that I was >trying to explicitly load the Python DLL, rather than rely on linkage via >an import library. It appears to somehow be associated with some confusion over python22_d.lib and the likes. Only I believe that I should be getting the _d.lib when I build in VC, and that should be the one I'm picking up when I run the interpreter. There must be something I don't know. Do I have to explicitly define a flag? I'd think that the VC build should be able to pick up on my build configuration -- debug mode. C// From aleax at aleax.it Fri Dec 28 07:16:01 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 13:16:01 +0100 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: <4$--$$_--__-%$-%-$@news.noc.cabal.int> "Patrick" wrote in message news:u2oo84bc39ujb7 at corp.supernews.com... ... > They DO ask what compilers and linkers we use! They even > make suggestions! We make very customized software. > Some customers write parts of their own code through > 'user exits'. I stand corrected. In this case, I guess you do have to care about your customers' software preferences. If you were working in a JVM environment, Jython and Java might be considered nearly equivalent (hard to tell from the outside what language a .jar or .class was coded in); if you were working in a COM environment, this would hold in an even stronger way (again, a COM server is a COM server, "from the outside" it little matters if it's written in C++, VB, Python or what else); this is also a particular strength of the .NET Framework; but few other environments give you such high transparency. Alex ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail Message-ID: Control: cancel Subject: cmsg cancel From: "Alex Martelli" Newsgroups: comp.lang.python X-No-Archive: yes Lines: 2 NNTP-Posting-Host: wonenara.ozemail.com.au X-Trace: ozemail.com.au 1009643028 203.108.164.177 (Sun, 30 Dec 2001 03:23:48 EST) NNTP-Posting-Date: Sun, 30 Dec 2001 03:23:48 EST Organization: OzEmail Ltd, Australia Distribution: world Date: Sat, 29 Dec 2001 15:51:22 GMT This message was cancelled from within Mozilla. From MAILBOX-SA at nameconnector.com Sat Dec 1 23:22:21 2001 From: MAILBOX-SA at nameconnector.com (System Attendant) Date: Sat, 1 Dec 2001 23:22:21 -0500 Subject: ScanMail Message: To Recipient virus found and action taken. Message-ID: ScanMail for Microsoft Exchange has detected virus-infected attachment(s). Sender = hdbiker Recipient(s) = python-list at python.org Subject = Scanning Time = 12/01/2001 23:22:21 Action on virus found: The attachment stuff.MP3.pif matched file blocking settings. ScanMail has Moved it. The attachment was moved to C:\Program Files\Trend\Smex\Alert\stuff.MP33c09ac7d3.pif_. Warning to recipient. ScanMail has detected a virus. From eldo at nethere.com Fri Dec 28 17:07:58 2001 From: eldo at nethere.com (Frank W. Jackson) Date: Fri, 28 Dec 2001 14:07:58 -0800 Subject: REPOST: Re: Running a script in windows References: Message-ID: <7$--$$_----_-%$$%$@news.noc.cabal.int> You might run this by. Right-click the script icon (or associated shortcut) then click **Properties** from the popup menu, then select the **Program** tab and make sure that the **Close on exit** checkbox is UNCHECKED. Jonathan Gardner wrote: > I know this comes up a lot, but I can't seem to find the answer in the > archives. (If the answer is RTFM, please let me know where.) > > I don't have a windows box on my desk. A friend of mine does, but I can't get > to it. He is trying to run a program I wrote, but the error message is coming > up too fast for him to catch it. How can you keep that error message window > around longer in Win2K? (BTW, let's pretend he doesn't know how to use the > DOS prompt.) > > Jonathan Regards Frank ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Frank W. Jackson" Newsgroups: comp.lang.python Subject: cmsg cancel <3C2CED3E.2000207 at nethere.com> Control: cancel <3C2CED3E.2000207 at nethere.com> Date: Mon, 31 Dec 2001 04:13:37 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775024 27193 211.57.49.2 (31 Dec 2001 05:03:44 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:03:44 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jeff at jdkoftinoff.com Thu Dec 13 20:25:23 2001 From: jeff at jdkoftinoff.com (Jeff Koftinoff) Date: 13 Dec 2001 17:25:23 -0800 Subject: CGI form repost from browser--how to prevent? References: <5a4226f0.0112121013.34827aa1@posting.google.com> Message-ID: <789798cc.0112131725.2e98d6d4@posting.google.com> bit_bucket5 at hotmail.com (Chris) wrote in message news:... > Seems like a good idea, but due to the non-persistent nature of cgi > (assuming I don't have mod_python or the like), I'd have to store the > number to file, then open and read/write the file for each submission. > This isn't too bad (my cgi application is for a single user--a mysql > front end), but it seems like there would be a more elegant and > efficient approach. Thanks for the suggestion. > You have a database there, why not store the session information in a table? If you want multiple simultaneous users, index it by a cookie value. Jeff Koftinoff jeffk at jdkoftinoff.com www.jdkoftinoff.com From DaveP at dpawson.freeserve.co.uk Wed Dec 5 14:41:28 2001 From: DaveP at dpawson.freeserve.co.uk (Dave Pawson) Date: 5 Dec 2001 19:41:28 GMT Subject: mp3info and python Message-ID: My need is to read the header info from an mp3 file, to determine its play time. (This is stuff we've encoded ourselves) Finally managed to get mp3info.py, and it appears to work OK, except it always shows a 00:00 length. Reading the associated documentation, I'm unsure if an mp3 file tells the whole tale in its header, or whether the blocks which make up the file actually sum to the total time of the whole file. Has anyone used this please, and could share experience? All I need is to pull the length from 50 or so files in sequence and add the times, nothing fancy inside the files. Regards DaveP From fperez528 at yahoo.com Mon Dec 3 16:46:23 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Tue, 04 Dec 2001 21:14:23 +2328 Subject: try: and while/continue don't mix? Bizarre behavior with function calls. References: <6ac595a2.0112041944.75dab62b@posting.google.com> Message-ID: <9uk71v$t02$1@peabody.colorado.edu> it's a known bug, fixed for 2.2. there's a reference to it in sourceforge, if you really want to know (don't have it at hand, sorry). morale is: for now, don't use continue in try. f. From bogus at eschatek.com Mon Dec 31 15:49:02 2001 From: bogus at eschatek.com (J B Bell) Date: Mon, 31 Dec 2001 12:49:02 -0800 Subject: Beginner Tkinter Q.: how to re-pack a frame in place? Message-ID: <3C30CF3E.3020202@eschatek.com> Hello all. I'm new to Tkinter, but not Python. I've written a utility dice-roller for an RPG and would like to GUIfy it. My main snag right now is that I haven't been able to find docs on how one does a re-draw in place. That is, at the simplest level, let's say I have a frame with several text input widgets packed into it--I'd like to be able to edit one of the input boxes, then hit a "re-sort" button and have the fram they're in re-pack them in some kind of sorted order. So if I had widgets saying, e.g., "1", "2", "3", and I changed the "2" to a "5" and hit "Re-pack", the widget order would change, with underlying variables preserved appropriately. Any sample code somebody could point me at? Please cc: me by changing "bogus" in the address to "cipher"; I don't read this ng much. --JB From jeff at ccvcorp.com Tue Dec 4 15:25:04 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Tue, 04 Dec 2001 12:25:04 -0800 Subject: AW: Are there any PEPs for typed arguments? References: Message-ID: <3C0D3120.3B471215@ccvcorp.com> "F. GEIGER" wrote: > So now I have to implement it. To assure requirements and promises as > documented I have to convert > > object.meth(mine: MyClass, yours: YourClass) > > into > > def object.meth(mine, yours): > assert isinstance(mine, MyClass) > assert isinstance(yours, YourClass) Seems to me that it'd be pretty simple to write a file-processing script that would search out lines of the first form, and convert them into the second form... just run that script over each of your source files once, before first running them, a la pychecker. Jeff Shannon Technician/Programmer Credit International From rdsteph at earthlink.net Fri Dec 28 23:41:14 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sat, 29 Dec 2001 04:41:14 GMT Subject: REPOST: Re: win32all-141 for Python 2.2 References: <3C2D4676.5060700@skippinet.com.au> Message-ID: <2$--$$_----_-%$_$$@news.noc.cabal.int> Thanks, Mark. I really appreciate your efforts. I also suggest that *anyone* and everyone* using Python and Windows rush out and buy your book, Python Programming on Win32. Do you have any other book projects in mind? Mark Hammond wrote: > I have made a new win32all release for Python 2.2. > > Hrmm - it seems I can't login to starship :( So I have temporarily > placed it at: > > http://users.bigpond.net.au/mhammond/win32all-141.exe > > The only new known issue is that "Active Debugging" will probably not > work - using the Microsoft Debuggers when using Python in an ASP or IE > page will fail. > > I will move this to starship, including details of exactly what has > changed, ASAP. > > Mark. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2D49E6.39FD96BE at earthlink.net> Control: cancel <3C2D49E6.39FD96BE at earthlink.net> Date: Mon, 31 Dec 2001 05:11:24 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774869 27193 211.57.49.2 (31 Dec 2001 05:01:09 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:01:09 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From kmilo0 at hotmail.com Wed Dec 26 13:56:09 2001 From: kmilo0 at hotmail.com (Kmilo) Date: 26 Dec 2001 10:56:09 -0800 Subject: REPOST: Problems with tkinter in python 2.2 Message-ID: <5$--$$-$$$$%%%-_%$@news.noc.cabal.int> I download today to the python ftp and install python2-2.2-2.i386.rpm python2-devel-2.2-2.i386.rpm python2-docs-2.2-2.i386.rpm python2-tkinter-2.2-2.i386.rpm here I have a dependence problem by libtcl.so.0 libtk.so.0 python2-tools-2.2-2.i386.rpm python work very good, until I run Tkinter.py bash-2.04# python2 /usr/lib/python2.2/lib-tk/Tkinter.py Traceback (most recent call last): File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 35, in ? import _tkinter # If this fails your Python may not be configured for Tk ImportError: shared object not open I have Tcl8.3.2-16.rpm Tk8.3.2-16.rpm tix8.1-5.rpm in SuSe Linux 7.1 Somebody know what i have to do for run, tkinter.py? ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: kmilo0 at hotmail.com (Kmilo) Newsgroups: comp.lang.python Subject: cmsg cancel <19eb8d3d.0112261056.2227760e at posting.google.com> Control: cancel <19eb8d3d.0112261056.2227760e at posting.google.com> Date: Mon, 31 Dec 2001 04:42:25 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009776134 27193 211.57.49.2 (31 Dec 2001 05:22:14 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:22:14 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From clams17 at yahoo.com Fri Dec 7 14:43:16 2001 From: clams17 at yahoo.com (Spiffy) Date: Fri, 07 Dec 2001 19:43:16 GMT Subject: string conversion and formatters Message-ID: Hello! I am total newbie to programming and Python. I am teaching myself with online tutes and documentaion. First, does anyone know where the list of output formatters ( such as %d, %s, etc.) is in the reference material? I know I have seen this list, but I cannot find it. By the way, I'm using Python2.2 on Windows 98. Secondly, here is my first real program.... #Decimal/Hex Convertor def print_options(): print "Options:" print " 'a' decimal to hex" print " 'b' hex to decimal" print " 'c' print options" print " 'd' quit" choice = "c" while choice != "d": if choice == "a": dec = input("Decimal: ") print "Hex: %X" % (dec) elif choice == "b": hex = raw_input("Hex: ") print "Decimal: %d" % (hex) elif choice != "d": print_options() choice = raw_input("option: ") Please dont laugh. It is supposed to convert decimals to hex numbers and vice-versa. It works fine until you try to convert hex to decimal and then here's what I get.... Options: 'a' decimal to hex 'b' hex to decimal 'c' print options 'd' quit option: b Hex: A Traceback (most recent call last): File "C:\Program Files\Python2\convertor.py", line 17, in ? print "Decimal: %d" % (hex) TypeError: an integer is required Why doesn't this work? I have tried using "string.atoi" and some other things, but no luck. I am stumped. Please, if you have an explanation or any hints to point me in the right direction, I would very much appreciate it. ...just dont laugh at me...I'm a newbie! Thanks, Spiffy From Lutz.Schroeer at kybernetik-manufaktur.de Thu Dec 6 18:35:05 2001 From: Lutz.Schroeer at kybernetik-manufaktur.de (Lutz Schroeer) Date: 6 Dec 2001 23:35:05 GMT Subject: gadfly and autonumber/auto_increment/guid? References: Message-ID: "Steve Holden" wrote in news:tKRP7.16143$P_.594425 at atlpnn01.usenetserver.com: [...] > Hope this helps. Thanks, this was exactly the piece of information I was looking for (though it is disappointing that autonumbers aren't suported :-) Latz From fardal at coral.phys.uvic.ca Fri Dec 7 18:11:16 2001 From: fardal at coral.phys.uvic.ca (Mark Fardal) Date: 07 Dec 2001 15:11:16 -0800 Subject: numerical packages for 1.5.2? References: <9ur8nk$fg6$1@peabody.colorado.edu> Message-ID: Fernando P?rez writes: > > Given that restriction, what version of Numeric should I be using? > Why don't you just create a ~you/local/ directory and build py2.1 > there? It will take a half hour, and the improvements are > substantial. You can just tell your friends to have an alias that > points to ~you/local/bin/python for them to use it without upgrading > anything. So far I've failed to install the rpm for 2.1 on my own computer. So has my sysop. I doubt I'm going to manage installing 2.1 on ~10 different systems. And I can't rule out people wanting to run the code on systems I don't have access to. Somebody must have used 1.5.2 at one point--what versions worked then? > Just an idea, since you lose some important features with python<2.0 > for numeric (such as rich comparisons: a number in old python, but a full array of a[i] versions. This can make writing certain algorithms much easier and > they also perform faster as the looping is done in C). What's wrong with less(a,b), besides uglier syntax? I find a <3FFT7.5573$Q3.847787@news010.worldonline.dk> Message-ID: maxm wrote: >I guess that to kickstart a system like that, there would have to be a >source of authority blessing the use of the system. And it should be >featured prominently on the frontpage of python.org. I have used Python for >a couple of years. Have been on the list the same time, and didn't know that >the functionality existed. > >A believe that a Python CPAN system has to be somehow officially sanctioned >to work. It doesn't even have to be a official sanction. A little nudge would really help. It would also have the ancillary benefit of getting packages to use distutils since both ciphon and swallow require packages to use distutils. >But then that's the old problem with core language design vs. library >enhancements, and who should do what, that we see again. Distutils has been incorporated into the standard python distribution and it holds the same position in relation to the python language as any CPAN-shell implemenation would. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From tatebll at aol.com Sun Dec 30 10:07:22 2001 From: tatebll at aol.com (Bill Tate) Date: 30 Dec 2001 07:07:22 -0800 Subject: Zope Documentation (was RE: Python Popularity: Questions and Comments) References: <3C2E55A6.D873E301@engcorp.com> Message-ID: Peter Hansen wrote in message news:<3C2E55A6.D873E301 at engcorp.com>... > Bill Tate wrote: > > > > I understand the "zen" thing, > > If you say that, then you don't really understand it. ;-) OK - I'll put in another way. I "perceive" that there exists a timeline from which the Zope newbie enters the "realm" of confusion/uncertainty wrt Zope and then eventually achieves some degree of enlightment, "oneness" or "harmony" if you will with respect to its use and power. Fair enough??? :>) > > but it's not something that business > > people are going to care about when they making a decision about > > whether to use it or not. > > As a business person, I take mild exception to that. I'd rather > have "zen" from Zope than "marketing" from Microsoft. Hmmm - so as a business person, that begs the question would you prefer someone pitching Zope to you in abstract terms or would you prefer them to describe its benefits in practical and concrete terms that are relevant to any business??? My personal preference is to ignore the marketing coming from Sun, MS, Oracle, IBM, et.al.; I prefer to stick to facts that I can substantiate or back up. From jkraska at san.rr.com Sun Dec 30 13:34:54 2001 From: jkraska at san.rr.com (Courageous) Date: Sun, 30 Dec 2001 18:34:54 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <4VlX7.6657$l93.1694996@newsb.telia.net> <6o6s2u4pa4kvqben6ftatrfttu9s78ee1k@4ax.com> Message-ID: <0$--$$_----___-$-$@news.noc.cabal.int> >C is: Easy to learn >Python is: Hard to learn (well relativly to C) If you didn't just say that backwards, you are a mutant. :) >Generates piss pore performance code (I am sorry to say) Python is almost always faster than the equivalent C, for somewhat arcane definitions of the "equivalent C". For example, if you set up every object in your C class hierarchy to contain attributes which were in a hash table, and then always accessed them that way, what you would come up with would almost certainly be slower than Python. C// ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.cwix.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Courageous Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:55:15 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774124 27193 211.57.49.2 (31 Dec 2001 04:48:44 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:48:44 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From max at alcyone.com Tue Dec 11 14:07:06 2001 From: max at alcyone.com (Erik Max Francis) Date: Tue, 11 Dec 2001 11:07:06 -0800 Subject: __init__ concerns References: <9v4ov301ukq@enews4.newsguy.com> Message-ID: <3C16595A.5A5B456F@alcyone.com> Peter Wang wrote: > ah, i was not aware that python 2.0 had this particular construct. > i'll have to go back and read the ChangeLogs. :) you're right, the > new notation is not a kludge at all, and i was actually a bit > disappointed that this was not the behavior in 1.5.2. (the old style > of using apply() seemed a bit... uncouth.) I agree. It is a surprisingly elegant notation with no drawbacks. -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ Laws are silent in time of war. \__/ Cicero Esperanto reference / http://www.alcyone.com/max/lang/esperanto/ An Esperanto reference for English speakers. From ldsavings at checkhouston.net Sun Dec 16 19:47:48 2001 From: ldsavings at checkhouston.net (Long Distance Savings) Date: Sun, 16 Dec 2001 19:47:48 Subject: Spend Less On Your Phone Calls This Holiday Season Message-ID: Do you make international phone calls? If you do, there is a very good chance that you can save money by using our international callback service. Sample Rates - Calls From The Netherlands: You can make phone calls to the following countries for only - 10 CENTS PER MINUTE! - (US$) Denmark Germany Singapore Sweden United Kingdom Australia Belgium France The Netherlands New Zealand USA Austria Hong Kong South Korea Switzerland Rates are the same for calls made to the The Netherlands from these countries. Service is also available at very low rates between any other two countries in the world. NO cost to open a new account NO pre-payment NO deposit required NO per call surcharges If you would like more information on this money saving service, please click on the link below: mailto:moreinfo777 at checkhouston.net?Subject=More_Info Click below to be removed: mailto:remove777 at checkhouston.net?Subject=REMOVE From usenet at lophty.com Sun Dec 2 11:30:15 2001 From: usenet at lophty.com (brian donovan) Date: Sun, 02 Dec 2001 11:30:15 -0500 Subject: Newbie : Installing Python locally in acct on shared server References: <3C0A3F04.3090206@lophty.com> Message-ID: <3C0A5717.1040508@lophty.com> Hi Chris, Yes, the below should work, but it doesn't. :( I just did the steps as outlined below and I'm getting the same bizarre result as previously. A helloworld script composed of a few print statements and ointed at my install executes without a hitch, but importing a module causes a "500 Internal Server Error". :/ I tested with a number of extremely simple scripts using different modules. An example : --------------------------------- #!/home/luser/bin/python import sys print "path has", len(sys.path), "members" --------------------------------- another --------------------------------- #!/home/luser/bin/python import base64 MESSAGE = "life of brian" data = base64.encodestring(MESSAGE) original_data = base64.decodestring(data) print "original : ", repr(MESSAGE) print "encoded data : ", repr(data) print "decoded data : ", repr(original_data) --------------------------------- Any ideas? The installation went off seemingly without a hitch. and everything seems to physically be "there", but scripts that import a module die. -brian Chris Gonnerman wrote: > HMMMM... > > First, I'd recommend > > ./configure --prefix=/home/luser > make > make test > make install > > Make sure any script you write has > > #!/home/luser/bin/python > > at the top. > > This really should work... From skip at pobox.com Fri Dec 28 15:00:50 2001 From: skip at pobox.com (Skip Montanaro) Date: Fri, 28 Dec 2001 14:00:50 -0600 Subject: pth files - can they prepend to sys.path? In-Reply-To: References: Message-ID: <15404.53106.210579.952695@12-248-41-177.client.attbi.com> Skip> Is it possible to force a directory mentioned in a .pth file to be Skip> inserted at the beginning of sys.path instead of appended to the Skip> end? Michael> You realise the handling of .pth files is done in site.py? No, actually, I wasn't. Thanks for pointing that out. I only recently realized they were useful outside of the package facility, so hadn't ever investigated them. Michael> The answer seems to be no, though presumably there's nothing Michael> stoppoing you supporting .pthplus files in a sitecustomize.py. In looking at the code (now that I know where to look), it seems to me the more logical thing to do would be to add an optional second word to the directory line that specifies whether to prepend or append the directory (the default obviously being to append): # stick at the start /usr/local/lib/automatrix/python prepend # append to the end /usr/local/lib/automatrix/python append # append - same as current /usr/local/lib/automatrix/python Skip From fdrake at acm.org Sat Dec 15 15:46:40 2001 From: fdrake at acm.org (Fred L. Drake) Date: Sat, 15 Dec 2001 15:46:40 -0500 (EST) Subject: [development doc updates] Message-ID: <20011215204640.8FF5E286BC@beowolf.digicool.com> The development version of the documentation has been updated: http://python.sourceforge.net/devel-docs/ Miscellaneous minor updates/fixes post 2.2c1. From thomasNO at SPAM.obscure.dk Wed Dec 19 18:56:09 2001 From: thomasNO at SPAM.obscure.dk (Thomas Jensen) Date: Wed, 19 Dec 2001 23:56:09 GMT Subject: if __name__ == "__main__" References: <5a4226f0.0112171509.30e46e05@posting.google.com> <3C2118B7.AB0D3F9B@cosc.canterbury.ac.nz> <87lmfyucr4.fsf@moskau.hmotakef.homeip.net> Message-ID: Henrik Motakef wrote in news:87lmfyucr4.fsf at moskau.hmotakef.homeip.net: >>>> import sys >>>> sys.__name__ > 'sys' >>>> import sys as foo foo.__name__ 'sys' > > Why isn't foo.__name__ not 'foo', exactly? The name foo is a reference to the module named 'sys'. Unlike many other objects, modules has names. The default behaviour of import is to bind the name of the module in the global namespace to the module object (or something like that ;-). -- Thomas Jensen From max at alcyone.com Thu Dec 20 16:44:28 2001 From: max at alcyone.com (Erik Max Francis) Date: Thu, 20 Dec 2001 13:44:28 -0800 Subject: Bug in % string formatting? References: <9vtiev$no8$1@peabody.colorado.edu> <871yhp7guv.fsf@ifm.uni-kiel.de> <9vtk6h$ojk$1@peabody.colorado.edu> Message-ID: <3C225BBC.2D06CB8@alcyone.com> Fernando P?rez wrote: > It does surprise me though that % binds harder than +. I would naively > think > that by its nature, % would have fairly low precedence. Oh well, I'm > sure > there's a good reason for it being the way it is. The reason is because % is also the modulo division operator. -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ Laws are silent in time of war. \__/ Cicero Esperanto reference / http://www.alcyone.com/max/lang/esperanto/ An Esperanto reference for English speakers. From bill-bell at bill-bell.hamilton.on.ca Fri Dec 28 13:25:22 2001 From: bill-bell at bill-bell.hamilton.on.ca (Bill Bell) Date: Fri, 28 Dec 2001 13:25:22 -0500 Subject: COM Registration Attributes In-Reply-To: <1009557526.1044.26375.m5@yahoogroups.com> Message-ID: <3C2C72C2.32510.5AD06A3@localhost> "Alex Martelli" wrote, in part: > "Bill Bell" wrote in message > news:5edaf477.0112280645.246f7229 at posting.google.com... > I have been > wondering again about the best way of handling a > collection of > Windows registry key additions, deletions or changes as > part of > registering a Python COM server. > ... > > 4. Wrap atl.dll and make it part of the standard Windows > > distribution. > ... > > changes the specs for .rgs scripts. (Mind you, isn't this stuff > > meant to become less of an issue?) Option 4 looks nicest to me. > > Maybe not to Microsoft's legal department, though. It would be at > least wise to check with them rather than assuming they'd be glad to > see some of their "redistributables" redistributed this way (i.e., as > a part of a development environment). You're right: maybe they wouldn't. :o) I should perhaps have suggested (something like) distributing a wrapper, rather than the thingy being wrapped. Thanks for comment. "It is the time that you have wasted for your rose that makes your rose so important."--St-Exupery From MateIn4 at hotmail.com Sun Dec 30 13:18:54 2001 From: MateIn4 at hotmail.com (Jose Vasconcellos) Date: Sun, 30 Dec 2001 18:18:54 GMT Subject: Problems using Tix with Windows Python 2.2 Message-ID: I've installed Python 2.2 on Windows 98 and XP. Tried a few things and they seem to work ok. However, when I try to use Tix it fails: >>> import Tix >>> root = Tix.Tk() Traceback (most recent call last): File "", line 1, in ? NameError: name 'TixTk' is not defined Note that using Tkinter works fine. Using IDLE gives a similar error. Is python not configured properly? What to do? Jose From geo_engineer at yahoo.com Wed Dec 19 06:50:54 2001 From: geo_engineer at yahoo.com (Geometric Engineer) Date: 19 Dec 2001 03:50:54 -0800 Subject: Python Hosting Questions References: Message-ID: BUMBLEBEE BUZZ: Might be worth your while to check out [http://www.your-site.com/]. They've got a good repuation, a good price ($60 a year), and full language support (I like PHP myself, but wanted to be able to use Python when time permits). - Grouchy Engineer "Dave Butler" wrote in message news:... > I have found a potential hosting company, http://www.hostignition.com , that > offers Python, Perl, PHP4, and JSP/Servlets for $5/month. This seems almost > too good to be true. Any thoughts? From garry at sage.att.com Fri Dec 7 14:57:48 2001 From: garry at sage.att.com (Garry Hodgson) Date: Fri, 7 Dec 2001 19:57:48 GMT Subject: Python classes for reading/writing/parsing MIDI files References: <3C0F63F0.20D2B25@alum.mit.edu> <7876a8ea.0112061455.6685b313@posting.google.com> Message-ID: <3C111F3C.1B41508C@sage.att.com> stalin wrote: > > Will Ware wrote: > > > Nearly a year ago I wrote some Python classes for MIDI events and objects... > > Have you registered this module with the Vaults of Parnassus? There > are several MIDI packages currently listed there; is one of them > yours? > > http://www.vex.net/parnassus/apyllo.py?find=midi i'm interested in being able to display/print sheet music from a given midi file. does anyone know: a) if any of the above packages provide for this? b) if this is a particularly hard problem? i'm asking from the perspective of someone who knows little about either midi or music notation. is this a problem worth tackling? -- Garry Hodgson Let my inspiration flow Senior Hacker in token rhyme suggesting rhythm Software Innovation Services that will not forsake me AT&T Labs 'til my tale is told and done. garry at sage.att.com From mcherm at destiny.com Wed Dec 19 17:29:24 2001 From: mcherm at destiny.com (Michael Chermside) Date: Wed, 19 Dec 2001 17:29:24 -0500 Subject: Update Oreilly books? Message-ID: <3C2114C4.9050309@destiny.com> > Hi, > I wanted to write to respond to the comments on ORA books. First off, > thanks for writing about this. I take your comments very seriously, > and try to incorporate your suggestions whenever possible. > [...] > ...and we will > meet the needs of readers. Please feel free to email me with any > other comments or suggestions. > > Laura > LLewin at oreilly.com > Now THAT is why O'Reilly, if they don't already publish the best book on a given subject, may well BECOME the best. Keep up the great attitude, and I'll keep buying the great books! -- Michael Chermside From peterb at cortland.com Tue Dec 4 04:36:49 2001 From: peterb at cortland.com (Peter Bismuti) Date: Tue, 4 Dec 2001 01:36:49 -0800 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BD39F.D43D4FF7@mega-nerd.com> <3c0be454$1@207.229.64.20> <3C0BE5D5.4386B359@mega-nerd.com> Message-ID: <3c0bf170$1@207.229.64.20> > > So much for cooler heads prevailing....(deep sigh). > > Maybe my post was not the best way to deal with this matter. > I was just trying to add a little humor to lighten the conversation a bit. > However, the people who like me prefer using tabs (and nothing but tabs) for > indentation need to speak up. I'm on your side. After following this thread I am more convinced that tabs are a better approach as it allows for a separation of style and content. Each person can view their file with whatever indentation width they prefer (style) without altering the contents of the file (content). With just a little bit of effort we can all learn to live together in harmony. If Python 'tabbers' vs. 'non-tabbers' can't work out their differences and learn to live together, what hopes do the Israelis and Arabs have for god's sake! From jkraska at san.rr.com Fri Dec 14 02:52:03 2001 From: jkraska at san.rr.com (Courageous) Date: Fri, 14 Dec 2001 07:52:03 GMT Subject: Wrap C function which takes variable lengthed parameters? References: <6p5j1u0oag2ofkam8o7fig5dvkfc2392hk@4ax.com> <3C19990E.BE0F3FA@alcyone.com> <3C19AC0B.7ABD04DF@xs4all.nl> Message-ID: <1gbj1u8pm1t63ao6bjq98jlh66glf78fnu@4ax.com> >> Yes. Varargs can be used to make a va_list and pass that into another >> function. Use of varargs and va_list are ANSI compliant. > >But you can't contstruct a va_list and pass it to a _vararg_ function; >or at least it's not standard, portable, etc. See eg. > > http://www.eskimo.com/~scs/C-faq/varargs/invvarargs.19920714.html > >Unless I missed something, I think this is what the OP wanted. I believe you are correct. If this absolutely _must_ be done, there's probably a way to munge the stack correctly to get it to work on a per-platform basis. I'm not sure, but I believe that most of the time, varargs are just additional stack pushes or some such. But counting on that, especially in today's age of compiler optimizations and so forth, could lead to some pretty nasty outcomes. Speaking of the problem, it might help the O.P. to post some more details of the larger problem to see if there is an additional way of achieving what is desired. He might also consider posting to comp.lang.c and not posting anything to do with Python. Python neither helps nor hinders, it's just its own layer in C. C// From gmcm at hypernet.com Sun Dec 9 13:53:47 2001 From: gmcm at hypernet.com (Gordon McMillan) Date: 09 Dec 2001 18:53:47 GMT Subject: Creating a "package" using C extensions? References: <4bo41u8de4r4njcchh4g3mcuvdhqohhu39@4ax.com> Message-ID: Courageous wrote: [wants to implement a package in C] >>You could probably hack something up by butchering the >>module object in some way, but the import code assumes that extension >>modules are just plain modules, not packages. > > This is liveable, but somewhat painful for me. Let me tell > you why. I am currently translating the back end of a system > originally written in Python to a hybridized C++/Python > implementation with a C++ core. The heart of the system has > a very high invocation frequency, so it makes sense to put > that into C++. However, I need to make the prior interface > to the Python programmer the same as it was before. So what > I am doing is, for every module in the prior package, creating > a C++ equivalent. > > That's a lot of .dlls, if you know what I mean. > > Perhaps I'll break down and write a makefile. Doing a couple > dozen .dlls in VC 6.0 is a bit of a pain. > > It's too bad there's not a way to create a package-level .dll > which responds to Python in such a way as to offer up its > internal modules, but all from within a single .dll. That would > be cool. Oh. If that's what you want, you asked the wrong question! Except for a few corner cases, there's no difference between package.module and module.attribute. Once the import is done, it's all object.attribute anyway. And when importing, there's no difference (except implementation, of course) between package.module and module.attribute. So implement .c as your extension module, and arrange for it to have module1, module2 etc. as attributes. Probably a dozen or two lines of perfectly kosher code in init. -- Gordon http://www.mcmillan-inc.com/ From bt98 at doc.ic.ac.uk Fri Dec 28 15:37:33 2001 From: bt98 at doc.ic.ac.uk (Benjamin Tai) Date: Fri, 28 Dec 2001 20:37:33 +0000 Subject: REPOST: Re: scripting on top of structural References: <3C2C7B6C.DB7EDC32@doc.ic.ac.uk> <1009569279.849331@rexx.com> Message-ID: <6$--$$_----_-%$$%$@news.noc.cabal.int> Hi Dave, > 6. Speed of development from the scripting language _and_ speed of > execution from the underlying C/C++ code. True, all the hotspot should be moved to the structural language. > You might also want to look at Chapter 2, "Scripting Languages" in > the SWIG manual, available at: > > http://www.swig.org/Doc1.1/HTML/Scripting.html The paper has described the situation clearly, "the two language view of the world". Apart from accessing to data structure and encapsulated C/C++ code at a higher level , would there be any more possibilities? Are there be any "two language" applications which have shown other benefits, apart from a higher level manipulation, a shorter development cycle, or a wide range of libraries? Thanks Ben ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Benjamin Tai Newsgroups: comp.lang.python Subject: cmsg cancel <3C2CD80D.4FAC2179 at doc.ic.ac.uk> Control: cancel <3C2CD80D.4FAC2179 at doc.ic.ac.uk> Date: Mon, 31 Dec 2001 04:59:12 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775070 27193 211.57.49.2 (31 Dec 2001 05:04:30 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:04:30 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From peter.milliken at gtech.com Sun Dec 23 14:59:21 2001 From: peter.milliken at gtech.com (Peter Milliken) Date: Mon, 24 Dec 2001 06:59:21 +1100 Subject: Book "python programming patterns". anybody read this?? References: Message-ID: Actually, I doubt there is any intersection - or perhaps I should qualify that by an intersection in the realms of code that you and only you will ever have to look at or maintain. I side with Roy's opinions purely because it is almost never the code author that has to maintain the code (at least on systems I have worked on over the last 20 years :-)). Generally the standard of maintenance programmer is just not as good as developers (otherwise they would be developing, wouldn't they? :-)) and so it is a well recognised tenant that I attempt to follow - code for the lowest common denominator. Code that is difficult to read will always be difficult to maintain - and you can end up with some real messes by people changing code they don't understand! :-) So if this book contains code and examples that require that kind of thought then it might not be such a good book to buy. I am Australian, the exchange rate is roughly 2:1, so whilst I noticed the book on the shelves of my local bookstore the other day, I doubt that I will purchase a copy after reading these comments :-). Shame, I was tempted to because of the sections on patterns....... Peter "Courageous" wrote in message news:tof92u86c40aja5s822kki621pkrefpidm at 4ax.com... > > >I havn't seen the book, but I have to wonder about the above. Over the 25 > >or so years I've been programming, I've gradually shifted my priorities > >from elegance, cleverness, and efficiency, to simplicity and ease of > >understanding. > > "As a younger programmer, I prided myself in the number of lines of > code I wrote. As an older programmer, I pride myself in the number > of lines of code that I reduce." > > There is a certain intersection of the two geometries of your life, > where elegance and cleverness overlap simplicity and comprehensibility. > Or so I believe, and strive for. > > C// > From sdm7g at Virginia.EDU Wed Dec 5 18:30:01 2001 From: sdm7g at Virginia.EDU (Steven Majewski) Date: Wed, 5 Dec 2001 18:30:01 -0500 (EST) Subject: Python - string to hexbytes conversion - HELP! In-Reply-To: <20011205181003.B994@node0.opengeometry.ca> Message-ID: On Wed, 5 Dec 2001, William Park wrote: > On Wed, Dec 05, 2001 at 08:48:39PM +0000, me wrote: > > I'm a newbie to Python and I am trying to convert a string of decimal > > numbers - read from raw_input to a series of hexbytes > > eg > > if I do a read and get a='1234567' > > I need an equivalent string to be > > b=Chr(0x01)+chr(0x23)+chr(x045)+chr(0x67) > > > > all this is to control a device from the serial port but I cannot seem > > to recall how to conver the input to my required output An hints or > > suggestion most appreciated! I've spend hours trying various built > > in's which I would prefer to use > > > > HELP! > > hex(int('1234567')) > If I understand the question, then I think he wants something more like: int('1234567',16) i.e. interpreting the string '1234567' as a string of hex digits (base 16). I'm a little confused by the rest of the example. I THINK what he wants as output could be produced by: >>> from array import array >>> ia = array( 'i', [ int('1234567',16) ] ) >>> ia array('i', [19088743]) >>> ia.tostring() '\x01#Eg' But if he really needs it broken up into bytes, he can equivalence it to a byte array: >>> ba = array( 'b' ) >>> ba.fromstring( ia.tostring() ) >>> ba array('b', [1, 35, 69, 103]) Verify: >>> ba.tostring() '\x01#Eg' >>> map( hex, ba ) ['0x1', '0x23', '0x45', '0x67'] -- Steve From kragen at pobox.com Sat Dec 1 06:50:12 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 01 Dec 2001 06:50:12 -0500 Subject: internet/form-handling References: Message-ID: <83vgfrrwgb.fsf@panacea.canonical.org> telianews writes: > Hi, here's the question : How can I write a program that will let me log > on to password-protected websites from a text-terminal (e.g. xterm). Just > to illustrate what I mean, right now I have to log on to my ISP server from > a javascript-enabled webclient, but I would really like to be able to check > my POP-mail without first starting a webbrowser. Any ideas for a script to > log on from the terminal? Just write a text-only Web browser. It probably won't take you more than two or three years, and then another three or four to get JavaScript working. Or you could use an existing one, like links, w3m, or lynx. From aahz at panix.com Mon Dec 31 15:15:18 2001 From: aahz at panix.com (Aahz Maruch) Date: 31 Dec 2001 12:15:18 -0800 Subject: Basic threading questions References: Message-ID: In article , John Lull wrote: > >If it matters, I'm using Python 2.2.0 under Win98 and Win2K, but I'd >prefer a more general discussion of the issues involved. > >Is there someplace that addresses Python-specific threading issues like >these more thoroughly? Doesn't really answer your questions directly, but take a look at http://starship.python.net/crew/aahz/ -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: TODAY! From bizopp2002us at yahoo.com Wed Dec 12 15:52:42 2001 From: bizopp2002us at yahoo.com (John McCuullen) Date: Wed, 12 Dec 2001 21:52:42 +0100 Subject: The Secret to Supercharge your MLM! Message-ID: <1044665-2200112312205242550@yahoo.com> Discover "The Secret to Supercharge your MLM!" A must read... Hi there, The secret is out! Here's the mail we've all been waiting for! Read carefully and take immediate action on it! I've discovered an amazing formula that will give your MLM an enormous enrollers explosion. You'll benefit hugely if you use it with YOUR primary MLM! -THE ULTIMATE RECRUITMENT FORMULA- So if you are already in MLM or about to get into one this will be the most important mail you will ever read. Right now I know people who enroll dozens in their downlines WEEKLY using the formula I'm about to reveal. Fred Stege, Founder of the company enrolled 127 people within 7 day's after launching! One of his enrollees from this batch has become top recruiter in his company within 90 days after using this incredible easy-to-use concept. The NEW Formula is meant as a Front End Program to enhance "YOUR" MLM. I'm NOT pitching you in any MLM. ____________________________________________ In fact you may try it for absolutely FREE and you'll get an electrifying stack of tools straight away! ____________________________________________ We've discovered that the majority of Qualified MLM Leads (Prospects) all have 1 thing in common... They all are looking for 3 things they desperately want and can't get in any one 100% generic System... I just know that you'll agree with these 3 things and they are all to your advantage! Let me reveal you the 3 most sought after topics first: ? Cutting Edge MLM Information. ? A Legitimate Proven Formula. ? Pre Qualified Leads. (And how to get them for FREE) Isn't that what everybody is looking for?.. Will these topics ever go out of style?.. Doesn't THAT Attract the Masses?.. Does 'OLD SCHOOL MLM' attract the masses?.. Discover "How you can EARN RESIDUAL INCOME While Recruiting on Auto Pilot whether they join your MLM or not!" Welcome to 21st Century Massive Recruitment. I encourage you to check the details and sign up immediately. That means NOW! For more info please mail to mccuullen47 at zonnet.nl and write your First Name + 'MORE INFO' in the subject line. You'll receive further instructions immediately. Sincerely, John McCuullen P.S. Don't forget to write your FIRST NAME + 'MORE INFO' In Subject line! P.P.S. On the given site you'll find a secret that every PRO in our industry knows and uses... It's called: S-L-L-G: Self Liquidating Lead Generation. It will Create a Huge, Electrifying Surge in Your Cash Flow. P.P.P.S. Find out the NEW 3 foot rule in MLM. "Why Old School MLM is nearly dead." From peter at engcorp.com Sun Dec 30 18:31:13 2001 From: peter at engcorp.com (Peter Hansen) Date: Sun, 30 Dec 2001 18:31:13 -0500 Subject: REPOST: Early Internet reminiscing (was Re: A new forum is up! Q: what means References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B941D.B1E45AA5@htp-tel.de> <3C2CA285.BE256C16@engcorp.com> Message-ID: <4$--$$_----__$__-$@news.noc.cabal.int> Laura Creighton wrote: > > Peter Hansen doubts he was reading netnews in 1980. Peter Hansen is in > Toronto, if I remember correctly, and so his doubts are probably wrong. > In 1980 Henry Spencer and I at utzoo made usenet international with > the 23rd or 28th usenet site (the lpr paper is too faded to tell now.) > We spread usenet to Canadian universities and companies all over > Canada. Very cool! I was actually at University of Guelph, with a couple of friends including Simon Gibson, getting in the way of university students and the sys admins (Barry Stahlbaum might remember me if he's still around :-) and the name Henry Spencer is synonymous in my mind with a lot of things relating to the early net. I'm afraid I have to say I don't recognize the name Laura Creighton, but let's just blame my terrible memory. :) I'm happy to meet one of the dedicated souls who were responsible for my early introduction to computers. Thank you, Laura. -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.cwix.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Peter Hansen Newsgroups: comp.lang.python Subject: cmsg cancel <3C2FA3C1.659C35A0 at engcorp.com> Control: cancel <3C2FA3C1.659C35A0 at engcorp.com> Date: Mon, 31 Dec 2001 02:37:35 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774023 27193 211.57.49.2 (31 Dec 2001 04:47:03 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:47:03 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From richard at bizarsoftware.com.au Tue Dec 4 22:51:23 2001 From: richard at bizarsoftware.com.au (Richard Jones) Date: Wed, 5 Dec 2001 14:51:23 +1100 Subject: Is Python suitable for some binary file editing? In-Reply-To: References: <1FD639F0.1DA46084@cns.net.au> Message-ID: <200112050350.fB53on347945@bigboy.bizarsoftware.com.au> On Wednesday 05 December 2001 13:54, Tim Hammerquist wrote: > David Rollo graced us by uttering: > > I am considering as a beginning Python project an iterative task > > involving conversion of a set of image files to an alternative format. > > The file conversion is simply making the same change to a handful of > > characters at a particular offset, and saving under a new filename. It > > would be repeated several thousand times, looping through a hierarchical > > directory structure in Windows, editing and renaming as it went. > > > > Does this sound like the sort of task that Python is suited to? I had > > planned to do it in Java, but wondered if this might be the time to cut > > teeth in Python. > > This not only sounds like a job better done in Python, it sounds like > _fun_ to do in Python. > > Remember to use binary mode on Win32! For this application, the programer would be advised to use binary mode regardless, and certainly not make the binaryness of the file open dependant on platform! A very simple example of replacing two bytes in a file, 100 bytes in: [richard at ike /tmp]% python Python 2.1.1 (#1, Aug 30 2001, 17:36:05) [GCC 2.96 20000731 (Mandrake Linux 8.1 2.96-0.61mdk)] on linux-i386 Type "copyright", "credits" or "license" for more information. >>> f = open('test_input', 'rb') >>> o = open('test_output', 'wb') >>> o.write(f.read(100)) >>> o.write(chr(123)) >>> o.write(chr(0x80)) >>> f.read(2) 'ri' >>> o.write(f.read()) Richard From wurmy at earthlink.net Sat Dec 29 02:23:05 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Sat, 29 Dec 2001 07:23:05 GMT Subject: REPOST: Re: odd problem, most likely stupid one too :-) References: Message-ID: <5$--$$_----_-%$_$$@news.noc.cabal.int> Dave Harrison wrote: > > Ive written a class named packet, and I have a list on values that I am using to create my packets by passing the values in as I instantiate the classes I am creating. > > I do the creation in a for loop, > > for item in itemlist: > PACKET = Packet(item) > paclist.append(PACKET) > > except that when I try to go back through and see the packets in my paclist they are all exactly the same as the final one that I store in the list. > As in I do, > > for pac in paclist: > print pac.getVal() > > and I get exactly the same value, despite the fact that I know for sure they are different. > > If I getVal as I create the packets I get the correct and unique values, but once stored I get the oddity. > > Any ideas ? Hmm... try printing the id() of every instance in paclist... if they are the same, then you have somehow added the same instance over and over again to the list. If not, then they somehow all ended up with the same value, *or* getValue is doing something wrong. Oh yeah, and post the code of the Packet class, that might give us some clues too. ^_^ --Hans ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Hans Nowak Newsgroups: comp.lang.python Subject: cmsg cancel <3C2D6DF6.64AE27FC at earthlink.net> Control: cancel <3C2D6DF6.64AE27FC at earthlink.net> Date: Mon, 31 Dec 2001 01:22:48 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774828 27193 211.57.49.2 (31 Dec 2001 05:00:28 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:00:28 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From dalke at dalkescientific.com Mon Dec 3 12:44:08 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Mon, 3 Dec 2001 10:44:08 -0700 Subject: Regular expression as dictionary key? References: <3C0B2DE9.5040308@home.com> Message-ID: <9ugdnp$8fe$1@slb0.atl.mindspring.net> Luke: >Let's say I'm given a singular form of a word and want to match it with >plurals still, but words["dog"] will obviously raise a KeyError. > >Without doing a linear substring search on every element in words.key(), >is there a way to take advantage of the dict's binary tree layout >properties (e.g. speed) like: > >words["dog*"] # where dog* is a Regex There's two issues here 1) supporting searches for a word given either the singular or plural form 2) allowing a regular expressions as the dictionary key. The first is the need, the second is the implementation. But that implementation won't work, since in English the plural of a given word cannot be determined using a simple regular expression pattern cat -> cats dress -> dresses sky -> skies mouse -> mice sheep -> sheep fish -> fish (if more than one fish of the same species) fish -> fishes (if multiple species are present) The only viable regular expression pattern is to use 'X|Y'. But if you're going to do that, the easiest solution to understand and optimize is one which creates a new dictionary-like object that implements singular/plural lookups directly, like: def guess_a_plural(s): if s[-1:] in "szx": return s + "es" if s[-1:] == "y": return s[:-1] + "ies" if s[-1:] == "f": return s[:-1] + "ves" return s + "s" class PluralDict: def __init__(self): self.singular_data = {} self.plural_data = {} def __setitem__(self, key, value): if isinstance(key, type( () )): singular, plural = key else: singular = key plural = guess_a_plural(key) self.singular_data[singular] = value self.plural_data[plural] = value def __getitem__(self, key): if self.singular_data.has_key(key): return self.singular_data[key] return self.plural_data[key] Assuming this code works, it can be used like this example, which takes the english name of some common animals and tells you the Latin/scientific name d = PluralDict() d["cat"] = "Felix domestica" d[ ("mouse", "mice") ] = "Mus musculus" d["fox"] = "Vulpes fulva" d["wolf"] = "Canis lupis" >>> print d["cats"] Felix domestica >>> print d["wolves"] Canis lupis >>> print d["mice"] Mus musculus >>> I suspect though that you really just want a way to use a regular expression as a key, and created this singular/plural example as justification. Andrew dalke at dalkescientific.com From kumo at bellsouth.net Mon Dec 24 13:14:14 2001 From: kumo at bellsouth.net (David Rush) Date: 24 Dec 2001 18:14:14 +0000 Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic References: <1009122972.599277@haldjas.folklore.ee> <1009135573.707384@haldjas.folklore.ee> Message-ID: Sander Vesik writes: > In comp.lang.scheme Anton van Straaten wrote: > > Sander Vesik wrote: > >>It would have been nice of you to actualy refute his claims, and not just > >>namecall. > > > Except that the troll's claims are self-fulfilling. By posting an > > essentially content-free rant under a pseudonym, he generated some annoyed > > responses. He then used that as "evidence" in his argument: > > Well... tthe original mail wasn't *THAT* bad - besides, trolls are > trolls, you don't have to feed them... Guilty. Gomen kudasaimasu. It's just that we've actually been having some amount of serious discussion on the same topic recently, and I felt that Mr. Hotmail.com was not actually helping the issue at all. I'd hoped to get him out of the closet (anger sometimes works) or to get him to shut up. david rush -- Java and C++ make you think that the new ideas are like the old ones. Java is the most distressing thing to hit computing since MS-DOS. -- Alan Kay From jhauser at ifm.uni-kiel.de Tue Dec 11 09:03:07 2001 From: jhauser at ifm.uni-kiel.de (janko hauser) Date: 11 Dec 2001 15:03:07 +0100 Subject: constructors for lists and tuples References: <1f5252d4.0112110519.2617d639@posting.google.com> Message-ID: one can not define empty list/tuples with a predefined length. it is possible to create a sequence of a given length by multiplying a one element sequence. >>> a=(1,)*3 >>> a (1, 1, 1) This is slighly more economic than appending or inserting to an empty list. >>> a=[] >>> a.append(1) >>> a [1] HTH, __Janko From peter at engcorp.com Mon Dec 3 23:41:25 2001 From: peter at engcorp.com (Peter Hansen) Date: Mon, 03 Dec 2001 23:41:25 -0500 Subject: Python evangelists unite! References: <3C07884E.75E18DF7@engcorp.com> <9ue2o2$b344@news1.gtech.com> <3C0B08F3.C9CDE885@engcorp.com> Message-ID: <3C0C53F5.9A7EBC08@engcorp.com> Fredrik Lundh wrote: > > > Or did you have some other point I missed? > > don't feed the troll. Doh! Who wrote the new regex library anyway? There must be a bug: >>> import re, list_util >>> re.findall('(troll)', list_util.get('')) [] I'm not sure how it missed that one... -Peter H From tatebll at aol.com Sat Dec 29 17:11:23 2001 From: tatebll at aol.com (Bill Tate) Date: 29 Dec 2001 14:11:23 -0800 Subject: REPOST: Re: Zope Documentation (was RE: Python Popularity: Questions and Comments) References: Message-ID: <1$--$$_----____$-$@news.noc.cabal.int> "A. Keyton Weissinger" wrote in message news:... > I have had similar experiences trying to get my head around Zope. I write > J2EE applications with a group of folks. I was expecting a Pet Shop or at > least an EJB-like spec of the lay of the land. > > If someone asked me -- someone who considers himself a huge Pythonista -- > what Zope was all about, I'd have to say I didn't have a real clue. > > Now, it just so happens that I also write on the side for O'Reilly and > others. If any of you guys at DC want to email me back, I would be happy to > help spread the gospel according to Zope/Python. But it needs to have > serious facts (comparisons between similar setups for J2EE/M$), more serious > specifications (an EJB-like container approach based in Python, for example, > would be huge -- difficult certainly, but huge), and even more serious > examples. I agree with Bill. I want to see the full thing broken into > pieces. > > Keyton Keyton, you raise a very good point. Right now, I CAN'T help even if I wanted to. I can guarantee you that the message that I would be communicating about zope would be greatly different from that espoused on zope.org. The kind of things you mention (comparisons with J2EE and MS alternatives) are precisely the kind of facts I would want plastered right where everyone can see them. Making a business case for Zope in clear, unambiguous quantitative terms that technical and non-technical people understand and want to know. I understand the "zen" thing, but it's not something that business people are going to care about when they making a decision about whether to use it or not. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: tatebll at aol.com (Bill Tate) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:47:49 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774530 27193 211.57.49.2 (31 Dec 2001 04:55:30 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:55:30 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From bill-bell at bill-bell.hamilton.on.ca Wed Dec 19 08:11:31 2001 From: bill-bell at bill-bell.hamilton.on.ca (Bill Bell) Date: Wed, 19 Dec 2001 08:11:31 -0500 Subject: Python equivalent to @lines = 'command' In-Reply-To: <1008737230.1115.31182.m8@yahoogroups.com> Message-ID: <3C204BB3.5490.4D7E984@localhost> Christer Frovik <013-139047 at telia.com> > I wish those pyTHON (giggle) tutorials would include more of > these 'neat recepies'. Maybe you haven't noticed the cookbook at http://aspn.activestate.com/ASPN/Cookbook/Python Since the tip was useful to you you might consider writing it up at ActiveState for the benefit of others. Cheers, Bill "It is the time that you have wasted for your rose that makes your rose so important."--St-Exupery From graz at mindless.com Mon Dec 3 15:38:41 2001 From: graz at mindless.com (Graham Ashton) Date: Mon, 03 Dec 2001 20:38:41 +0000 Subject: Finding strings with exceptions References: <87snasgn1w.fsf@moskau.hmotakef.homeip.net> Message-ID: In article <87snasgn1w.fsf at moskau.hmotakef.homeip.net>, "Henrik Motakef" wrote: > David Brady writes: > >> The old class name (changed to protect the innocent) is BarThingy. The >> new name is fooBarThingy. Because the new class name contains the old >> one, simple find-and-replace goes wonky. > > What you are looking for is called a "negative lookbehind assertion, and > looks like this: > >>>> import re >>>> re.compile("(?>>> re.search("fooBarThingie") >>>> re.search("BarThingie") > Indeed, or you could look for an empty string on a word boundary with \b; $ perl -p -i.bak -e 's/\bBarThingy/fooBarThingy/g' file.py # untested Python supports \b too, so I should have posted that really, but if I was in your shoes I'd type the above (mainly because I've not looked up the Python equivalent), probably feeding it into find -exec if you're on Unix. -- Graham From tjreedy at home.com Thu Dec 6 15:39:06 2001 From: tjreedy at home.com (Terry Reedy) Date: Thu, 06 Dec 2001 20:39:06 GMT Subject: Calling a generator multiple times References: Message-ID: "Bruce Eckel" wrote in message news:mailman.1007665994.20287.python-list at python.org... > I'm trying to create a clever way to call a generator multiple > times, but the only thing I've been able to come up with is: > > import random > rgen = random.Random() > def itemGenerator(dummy): > return rgen.choice(['one', 'two', 'three', 'four']) > > print map(itemGenerator, [None]* 25) > > This works, but it requires the 'dummy' argument which seems > inelegant. I'll bet someone has a better idea... Use for i in range(25): Terry J. Reedy From hoel at germanlloyd.org Fri Dec 21 06:08:51 2001 From: hoel at germanlloyd.org (Berthold Höllmann) Date: 21 Dec 2001 12:08:51 +0100 Subject: Anyone stil using CXX References: <874rmkc1l1.fsf@ifm.uni-kiel.de> Message-ID: Janko Hauser writes: > hoel at germanlloyd.org (Berthold H?llmann) writes: > > > Hello, > > > > Is there anyone out there using the CXX package for writing C++ > > extension for Python? I'm looking for some more examploes on the usage > > and for a mailinlist for sharing problems, solutions, and experiences. > > > > Cheers > > > > Don't know about the current usage of CXX, but a strong contender is > the boost framework. Just for the notes. I do know that, but installing it is a pain in the *** on our infrastructure. The make replacement used by boost is hiding so much information about the build process that I simply get to know that an error occured, but not really what the error was, nor where it occured. Tracking down the errors occured in the build process was too time consuming for me. Greetings Berthold -- Dipl.-Ing. Berthold H?llmann __ Address: hoel at germanlloyd.org G / \ L Germanischer Lloyd phone: +49-40-36149-7374 -+----+- Vorsetzen 32/35 P.O.Box 111606 fax : +49-40-36149-7320 \__/ D-20459 Hamburg D-20416 Hamburg From steve at ferg.org Fri Dec 14 10:14:25 2001 From: steve at ferg.org (Stephen Ferg) Date: 14 Dec 2001 07:14:25 -0800 Subject: age of new pythonistas [was: The Editor Poll results are in!] References: Message-ID: My age at the time that I discovered Python (about a year ago): 54 My pre-Python programming experience: PL/I, Cobol, Visual Basic, PowerBuilder, and REXX. IBM MVS, DOS, Windows, no Unix. It looks like many new Pythonistas are older, rather than younger. When you are younger, your whole universe consists of the language that you learned first -- it takes a while to learn that the universe contains many, many languages to choose from. Then, when you realize you have a choice, it takes a while to find Python in the welter of alternatives. And finally, it is only after you have been around a while, and seen the alternatives, that you can really appreciate how much better Python is than any of the alternatives. From shalehperry at attbi.com Fri Dec 14 11:58:05 2001 From: shalehperry at attbi.com (Sean 'Shaleh' Perry) Date: Fri, 14 Dec 2001 08:58:05 -0800 (PST) Subject: Unsung Python modules In-Reply-To: <3dsnad226b.fsf@ute.mems-exchange.org> Message-ID: > * PyQt/PyKDE, which doesn't seem to get much respect in the KDE > community. (Maybe my perception is wrong?) > last I looked, pyKDE was still in the 1.x KDE days when KDE is about to enter 3.0. From aahz at panix.com Fri Dec 28 11:37:37 2001 From: aahz at panix.com (Aahz Maruch) Date: 28 Dec 2001 08:37:37 -0800 Subject: REPOST: Re: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> Message-ID: <3$--$$_----_---%%$@news.noc.cabal.int> In article , Cameron Laird wrote: > >I don't know what you mean by the "official inauguration" >of the 'Net. I'm guessing Alex refers to the switchover from ARPAnet to NSFnet or from NSFnet to Internet. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 3 days and counting ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: aahz at panix.com (Aahz Maruch) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:49:36 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775249 27193 211.57.49.2 (31 Dec 2001 05:07:29 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:07:29 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From brian at sweetapp.com Thu Dec 6 21:46:40 2001 From: brian at sweetapp.com (Brian Quinlan) Date: Thu, 6 Dec 2001 18:46:40 -0800 Subject: Lists of attributes In-Reply-To: <200112061807440330.027C4383@mail.rdc1.sdca.home.com> Message-ID: Bruce wrote: > Right, missed that. Now it's even cleaner: > import random > rgen = random.Random() > flwrs = [Gladiolus(),Runuculus(),Chrysanthemum()] > flowers = [rgen.choice(flwrs) for i in range(10)] > > This produces a random selection of references to only three > objects. I'm happy that you like the pattern, though your application seems a bit odd :-) > I'd still like to not have to explicity enumerate flwrs. I may play > with Tim's suggestion: > class Flower(object): > ... > and > Flower.__subclasses__() > > Except that I haven't been able to locate any actual information on > how to get '__subclasses__()' to work. __subclasses__ was added very recently (8 weeks, 3 days to be exact) so it might not be in your Python build (when you start Python, it reports its build date so you can check). Cheers, Brian From richard at bizarsoftware.com.au Mon Dec 10 17:55:43 2001 From: richard at bizarsoftware.com.au (Richard Jones) Date: Tue, 11 Dec 2001 09:55:43 +1100 Subject: python log() In-Reply-To: <9v3dfg$jj3$1@neptunium.btinternet.com> References: <9v3dfg$jj3$1@neptunium.btinternet.com> Message-ID: <200112102258.fBAMwkk34267@bigboy.bizarsoftware.com.au> On Tuesday 11 December 2001 9:37 am, Ian wrote: > Hello I am new to python and am trying to use it to work out a sum > log(20/7) / log(2) > which gives result > 1.0 > > I am expecting to get 1.51 as a result, and using different langs such as > perl or php, I get the desired result of 1.51 > > It seems to me that python only goes to a certain decimal place, not as > much as the other compilers, can this be altered in anyway? > > Ta. Python does not currently convert the results of division to a non-integer number.... >>> 20/7 2 >>> 20.0/7 2.8571428571428572 >>> log(20/7) / log(2) 1.0 >>> log(20.0/7) / log(2) 1.5145731728297582 This has been changed in python 2.2, see: "Changing the Division Operator" http://python.sourceforge.net/peps/pep-0238.html Richard From jh at web.de Thu Dec 20 16:43:03 2001 From: jh at web.de (Jürgen Hermann) Date: Thu, 20 Dec 2001 22:43:03 +0100 Subject: Issues with Python 2.2. regex Message-ID: <9vtm2e$9fs$06$1@news.t-online.com> Hi! Are there any known changes/problems with named groups in Python 2.2 re? Given this: (?P^\s*(?P=+)\s.*\s(?P=hmarker) $) Python 2.2 reports groups for the nested named parens, while previous versions do not. If this is unexpected, I'll isolate this effect in a little script. Bye, J?rgen From nospam at bigfoot.com Fri Dec 21 10:42:13 2001 From: nospam at bigfoot.com (Gillou) Date: Fri, 21 Dec 2001 16:42:13 +0100 Subject: MimeWriter and smtplib: long list of 'To:' recipients Message-ID: <9vvks6$27qr$1@norfair.nerim.net> Hi, My application sends mail to a list of 'To' recipients but there are problems when the list is long. I have no access to the Postfix error log so I dunno what's the problem. All recipients addresses are OK. I use the MimeWriter like this: fullmail = StringIO() mw = MimeWriter(fullmail) mw.addheader('To', 'jdoe at mailme.com, sombody at somewhere.com, lotsofothers at lotsofdomains.com') # Add other headers ... mw.endheaders() ... Is there something I missed ? TIA for any hint. --Gilles From tatebll at aol.com Fri Dec 21 16:30:21 2001 From: tatebll at aol.com (Bill Tate) Date: 21 Dec 2001 13:30:21 -0800 Subject: Python on the desktop References: <94e3fce8.0112210053.2568529d@posting.google.com> Message-ID: Cliff Wells wrote in message news:... > > What do you people think? > > This is the Python-list. We all hate Python and secretly code in C/C++. We >only advocate Python in the hopes our competitors will adopt it and in doing >so, destroy themselves because people using their applications will quickly >realize that their first-to-market, easy-to-use, full-featured application >wasn't written in a "real" programming language ;-) This one absolutely made my day. I almost bust a gut laughing!!!!!!! cheers Bill Tate From jgardn at alumni.washington.edu Mon Dec 3 07:28:10 2001 From: jgardn at alumni.washington.edu (Jonathan Gardner) Date: Mon, 3 Dec 2001 21:28:10 +0900 Subject: Python-Vim Message-ID: <200112031235.fB3CZiJ22558@my.knctv.co.kr> I put up some code into the CVS tree for Python-Vim at sourceforge. http://python-vim.sourceforge.net/ http://sourceforge.net/projects/python-vim It is all written in python, using the python Xlib library. Get it from here: http://python-xlib.sourceforge.net/ http://sourceforge.net/projects/python-xlib I have only gotten the get-vim-names (equivalent to vim --serverlist) function implemented. Some of you wanted to know what happens and when, so here it is. Jonathan From barry at zope.com Thu Dec 27 22:35:16 2001 From: barry at zope.com (Barry A. Warsaw) Date: 27 Dec 2001 22:35:16 -0500 Subject: Mild bug: pipermail/python-dev References: Message-ID: >>>>> "SM" == Skip Montanaro writes: SM> This is a known problem. I believe Pipermail uses the SM> timestamp in the Date: header, which is generated by the SM> sender. If their clock is off (as /F's apparently was when he SM> sent the message in question), you get a bogus entry in the SM> archive. I believe the solution would be to use the timestamp SM> in the Date: field unless it appears to be too far in the SM> future or the past (probably using different thresholds for SM> future and past), in which case it should either use the the SM> timestamp in the From_ field or the current time. Exactly. I have some experimental code in Mailman 2.1 which should be able to retroactively fix such problems in an mbox archive file, along with problems with unquoted From_ lines. The downside: it requires regenerating the entire archive, and it messes up existing urls to articles. Upside: it should assign more permanent urls to articles, based on Message-IDs. -Barry From kevin at ctechservices.com Fri Dec 14 23:14:33 2001 From: kevin at ctechservices.com (Kevin Schaefer) Date: 14 Dec 2001 20:14:33 -0800 Subject: I would like Python book recommendations. Message-ID: <98d855eb.0112142014.782fbbab@posting.google.com> I have read the book "Quick Python". I have also been quite a few small sample exercises from various on-line books such as "How to Think like a Computer Scientist Python Edition" and a few others. What I would really like to see is a real application that uses various aspects of the language. It would be nice to see something that has been built up gradually and builds on many lessons. Also of interest would be Windows development using something like wxPython. I work as a network consultant and engineer so I don't get very many hours to practice python so the few that I do have need to be spent very effectively seeing what I can actually build with this very interesting language. If you have suggestions of books that you have read, especially ones that build a significant project preferably in Windows please post here or send me a direct e-mail. Thank you very much for your advice in advance, New Python Enthusiast Kevin Schaefer From usenet at thinkspot.net Sun Dec 9 23:22:40 2001 From: usenet at thinkspot.net (Sheila King) Date: Mon, 10 Dec 2001 04:22:40 GMT Subject: smtplib References: <_YUQ7.24843$ER5.305743@rwcrnsc52> Message-ID: <9v0h5e.3vv2k6f.1@kserver.org> On Mon, 10 Dec 2001 02:19:39 GMT, "Senthil Kumar" wrote in comp.lang.python in article <_YUQ7.24843$ER5.305743 at rwcrnsc52>: :I compiled and installed python 2.1.1 in my linux server, I tried to send an :e-mail using python. I wrote a script to import smptlib and send the test :message, I get the following error : :-- : import smtplib :Traceback (most recent call last): : File "", line 1, in ? : File "/usr/local/lib/python2.1/smtplib.py", line 42, in ? : import socket : File "/usr/local/lib/python2.1/socket.py", line 41, in ? : from _socket import * :ImportError: No module named _socket : :I am not sure if this is bug or or I missed something during my python :compilation. Sounds to me like an installation error, and one I had some experience with, also in 2.1.1. Here are my references/notes on the problem I dealt with installing it in my local web space on a linux web server, and how I "fixed" the problem: http://www.aota.net/forums/showthread.php?s=&threadid=8972 HTH, -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org/ From yfjohans at NOSPAMTHANKYOUMAM-siving.hia.no Sat Dec 1 18:02:37 2001 From: yfjohans at NOSPAMTHANKYOUMAM-siving.hia.no (Yngve F. Johansen) Date: Sun, 02 Dec 2001 00:02:37 +0100 Subject: Python, PyQT and QSpinBox Message-ID: <9ubnie$34b$1@snipp.uninett.no> Hello I'm rather new to Python, and to GUI programming as well. I've been fooling around with the QT toolkit, and find it extremely easy and intuitive to work with, short of one thing I can't figure out: I use a QSpinBox in my dialog, and it works, kind of. The problem is when I enter text rather than use the Up/Down buttons. The text isn't updated/converted to an integer-value automatically, but if I move the mouse-pointer over the widget buttons it gets converted. Is there a way to change this behavior? I've tried to subclass the QSpinBox and write my own functions, but it didn't help a whole lot. Thanks for any help in advance. Sincerly, Yngve From gry at ll.mit.edu Wed Dec 19 09:27:11 2001 From: gry at ll.mit.edu (george young) Date: Wed, 19 Dec 2001 09:27:11 -0500 Subject: ANN: ciphon 0.3.4 References: Message-ID: <20011219092711.31a8282a.gry@ll.mit.edu> Umm, just a suggestion that when posting an announcement of a "new version of XXX", one should mention briefly what XXX *is* -- I have no idea what ciphon is.... On Tue, 18 Dec 2001 16:45:19 GMT ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) wrote: > > I've uploaded a new version of ciphon to sourceforge.net and to > anonymous ftp at ftp.community.tummy.com. The recent changes to ciphon > are: > > Ciphon now supports distutils so it can be updated from within itself. > Packages that ciphon installs are now recorded so that they won't have to > be downloaded again if they are a dependency. > RPM should now work for modules that support the bdist_rpm option of distutils > > There were a few other minor changes but these are the biggest ones. -- I cannot think why the whole bed of the ocean is not one solid mass of oysters, so prolific they seem. Ah, I am wandering! Strange how the brain controls the brain! -- Sherlock Holmes in "The Dying Detective" From mdlch at altavista.net Tue Dec 25 20:15:00 2001 From: mdlch at altavista.net (marco) Date: 25 Dec 2001 20:15:00 -0500 Subject: Can't exit python with ^D under certain circumstances References: Message-ID: "wealthychef" writes: > Hi, this is weird to me, don't know how to fix. > On my local python installation on machine A in a normal shell, ^ > D works to exit Python as expected. On machine B on the > console, ^D also works fine, but if I ssh to machine B from > machine A and try to exit Python with ^D, Python does not exit, > instead I get the following strange error message: What sequence does "^v^d" show? -- mdlch at altavista.net Gunnm: Broken Angel http://reimeika.ca/ From david_j_dawkins at spamless.hotmail.com Thu Dec 13 13:40:29 2001 From: david_j_dawkins at spamless.hotmail.com (David Dawkins) Date: Thu, 13 Dec 2001 18:40:29 -0000 Subject: Calling member functions? References: Message-ID: <%y6S7.1552$Hf5.223804@news6-win.server.ntlworld.com> "Duncan Booth" wrote in message news:Xns9176803438443duncanrcpcouk at 127.0.0.1... > "David Dawkins" wrote in > news:U60S7.9819$hg1.986922 at news6-win.server.ntlworld.com: > > > I can't quite get this right. How can I give an object instance and a > > method as a callback for some other module/class to call at a later > > point? > > Generally you dont. You just pass the method on its own: > > class Handler: > def Callback(self): > print "Callback called" > > class Notifier: > def __init__(self, method): > self.m_method = method > > def notify(self): > self.m_method() > > h = Handler() > n = Notifier(h.Callback) > n.notify() # Calls h.Callback() > > > h.Callback is a bound method. If you call it, then it calls the Callback > method on the h instance. What you were doing was attempting to use it as > though it were an unbound method. Calls to h.Callback take no arguments. > > Handler.Callback would be the unbound method. Calls to Handler.Callback > take one argument. Your original code probably works if you pass in h and > Handler.Callback, but usually it is cleaner to pass a single object for the > callback rather than two. > > A third option is to pass in h and the name of the callback method as a > string and call it using getattr, but while this is sometimes useful it is > generally messy. OK, I see. It all makes sense now. It's like I curried the function with "h.Callback". Thanks for your help David From phil at river-bank.demon.co.uk Thu Dec 20 19:09:36 2001 From: phil at river-bank.demon.co.uk (Phil Thompson) Date: Fri, 21 Dec 2001 00:09:36 +0000 Subject: ANN: Python 2.2c1 Port to Sharp Zaurus Message-ID: <3C227DC0.CFEF4278@river-bank.demon.co.uk> A port of Python 2.2c1 to the Sharp Zaurus PDA is available for download at http://www.river-bank.demon.co.uk/software/Zaurus. This is an initial release - what's there should work fine, but not all modules have been ported. The modules have been packaged into related "collections". Some modules have been slightly (and transparently) changed to reduce inter-module dependencies. The selection of modules has been based on the assumption that the Zaurus will be used as a client rather than a server or development platform. All to do with reducing memory footprint. Proper website, mailing list etc. to follow. BTW, this is all preparation for the PyQt port in the New Year. Phil From tim.one at home.com Sun Dec 9 11:57:17 2001 From: tim.one at home.com (Tim Peters) Date: Sun, 9 Dec 2001 11:57:17 -0500 Subject: Calling a generator multiple times In-Reply-To: Message-ID: [Courageous] > What's bad about that is pointing people to the PEP and expecting > that it will settle a marked difference of opinion. Nobody (rational) expects that. A BDFL Pronouncement is called for precisely in those areas where extended debate has proved that consensus will never be reached. The choices then are eternal paralysis, or, if Guido wants something enough, he breaks the deadlock by Decree and life moves on. > Furthermore, I would suggest that if over time I am not alone in > raising my exasperation here in comp.lang.python If you feel alone, it's only because you're years late coming to this debate. > that the benevolent powers that be consider that for every poster > there exist a hundred in agreement who don't post, That cuts both ways, though, and there a hundred who agree with Just who haven't posted too. That's what "proved that consensus will never be reached" means, and this incarnation of this debate only confirms that we got an accurate reading about that from the last N incarnations. > and likewise that perhaps "language designer's intuition" can sometimes > be clouded by the myopathy that sometimes exists in those who are very > close to what it is they are passing judgement on. Guido isn't an idiot, and generators for Python have been debated since 1991. Trust me: he wasn't close to them at all . > ... > Something that was contentious enough to be discussed "1000 > times" in the mailing list is certainly something you are going > to be hearing more about again. The obviousness of that is *why* there's a BDFL Pronouncement: you're not going to convince anyone, and nobody else is going to convince you. Some people have convinced *themselves* to switch positions, though, based on experience with the new feature. I've only seen that switch go in one direction, though, tending to confirm that Guido's intuition was correct. From syver-en+usenet at online.no Thu Dec 13 00:22:57 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 13 Dec 2001 06:22:57 +0100 Subject: Which widget can read BMP file References: <9v979p$dtuud$1@ID-12869.news.dfncis.de> Message-ID: "Kick" writes: > It seems that BitmapImage class can only read ppm file, and Photoimage > class > > recognize gif file not bmp file. > > Is it true? If so, what class or widget allow me working with bmp > file? Get PIL from pythonworks, it supplies more able versions of the BitmapImage and PhotoImage, while having the same interface as the original tkinter classes. Indispensible stuff in my opinion. -- Vennlig hilsen Syver Enstad From jafo at tummy.com Sun Dec 30 00:04:03 2001 From: jafo at tummy.com (Sean Reifschneider) Date: Sat, 29 Dec 2001 22:04:03 -0700 Subject: Python 2.2 RPMs are here In-Reply-To: <19eb8d3d.0112270405.24ab492c@posting.google.com>; from kmilo0@hotmail.com on Thu, Dec 27, 2001 at 04:05:47AM -0800 References: <19eb8d3d.0112270405.24ab492c@posting.google.com> Message-ID: <20011229220403.A7419@tummy.com> On Thu, Dec 27, 2001 at 04:05:47AM -0800, Kmilo wrote: >What version of Tcl\tk y need for run tkinter? If you get the SRPM and build it, it'll use whatever version is on your system, or will disable tkinter if Tk is not installed. The binaries I sent to Guido were built on a KRUD 7.2 system, which is RedHat 7.2 plus all errata. The further you get away from that sort of platform, the more you likely you will be to want to use the SRPM. Sean -- "Engineering Tablets? Does that mean if I swallow one, I'll be an engineer?" -- Evelyn Mitchell Sean Reifschneider, Inimitably Superfluous tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python From sholden at holdenweb.com Mon Dec 17 09:58:03 2001 From: sholden at holdenweb.com (Steve Holden) Date: Mon, 17 Dec 2001 09:58:03 -0500 Subject: local variables in exec References: Message-ID: "Jeremy Lowery" wrote ... > a snipplet would be describe this. > >>> x = 100 > >>> def f(): > ... print x > ... > >>> f() > 100 > >>> lns = {x: '4500'} > >>> fc = 'def f(): print x' > >>> bc = compile(fc, '', 'exec') > >>> exec bc in lns > >>> lns['f']() > Traceback (most recent call last): > File "", line 1, in ? > File "", line 1, in f > NameError: global name 'x' is not defined > >>> > > why doesn't this work? Because you have stored 4500 in the lns dictionary under the key 100. Use the variable name as a string and it works as you expect (but realise you are doing things with a high horribleness quotient: while it is occasionally necessary to descend to such depths, one should avoid it where possible). >>> lns = {"x": "4500"} >>> fc = "def f(): print x" >>> bc = compile(fc, "", "exec") >>> exec bc in lns >>> lns['f']() 4500 >>> regards Steve -- http://www.holdenweb.com/ From dale at riverhall.NOTHANKS.co.uk Thu Dec 20 19:51:34 2001 From: dale at riverhall.NOTHANKS.co.uk (Dale Strickland-Clark) Date: Fri, 21 Dec 2001 00:51:34 +0000 Subject: Win32Service and Service Manager References: <52842usq62dho41m9i4lg15l8pgfc0h8m3@4ax.com> <3C226D30.5080902@skippinet.com.au> Message-ID: <30152u49q8p4nj467ijnho4v7jg15vj351@4ax.com> Mark Hammond wrote: >I am not too sure what you are asking. There are no generic Python >features in the Service Control Manager - each service using Python is >completely stand alone. > >win32serviceutil.py has code that interacts with the Service Control >Manager, including installing services using arbitary user names and >start modes. See win32serviceutil.HandleCommandLine(). Sorry, that wasn't very clear. The Services MMC snap-in, which controls services and lists all those installed, does not have my new service listed. My service must be registered because it stops and starts with the NET command. So how come it doesn't show up in the Services snap-in? I'm mystified how you can even create a service that doesn't show up here and yet still responds to NET STOP and START commands. There! Does that make more sense? -- Dale Strickland-Clark Riverhall Systems Ltd From syver-en+usenet at online.no Wed Dec 5 10:11:10 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 05 Dec 2001 16:11:10 +0100 Subject: COM servers from within a Python service (on Win2k) References: <83y9kiouf2.fsf@panacea.canonical.org> Message-ID: Kragen Sitaker writes: > Duncan Booth writes: > > Andrew Bennetts wrote in > > news:mailman.1007522528.18068.python-list at python.org: > > > Can anyone show me how to make this work? > > > > I have emailed you a working example. It is a minimal service which > > contains a COM server. > > Can you post it? > Yess, yess, preciousss, post for me too. Gollum. -- Vennlig hilsen Syver Enstad From chris.gonnerman at newcenturycomputers.net Sun Dec 2 19:07:04 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Sun, 2 Dec 2001 18:07:04 -0600 Subject: Newbie : Installing Python locally in acct on shared server References: <3C0A3F04.3090206@lophty.com> <3C0A5717.1040508@lophty.com> Message-ID: <00f001c17b8e$88c3f280$0101010a@local> Ahh... I just realized you aren't giving the web server the correct headers. Try this: -------------------------------------------- #!/home/luser/bin/python import sys print "Content-type: text/plain\n" print "path has", len(sys.path), "members" -------------------------------------------- and let me know what happens... ----- Original Message ----- From: "brian donovan" Newsgroups: comp.lang.python To: Sent: Sunday, December 02, 2001 10:30 AM Subject: Re: Newbie : Installing Python locally in acct on shared server > Hi Chris, > > Yes, the below should work, but it doesn't. :( I just did the steps as > outlined below and I'm getting the same bizarre result as previously. A > helloworld script composed of a few print statements and ointed at my > install executes without a hitch, but importing a module causes a "500 > Internal Server Error". :/ > > I tested with a number of extremely simple scripts using different > modules. An example : > > > --------------------------------- > #!/home/luser/bin/python > > import sys > > print "path has", len(sys.path), "members" > --------------------------------- > > another > > --------------------------------- > #!/home/luser/bin/python > > import base64 > > MESSAGE = "life of brian" > data = base64.encodestring(MESSAGE) > > original_data = base64.decodestring(data) > > print "original : ", repr(MESSAGE) > print "encoded data : ", repr(data) > print "decoded data : ", repr(original_data) > --------------------------------- > > > Any ideas? The installation went off seemingly without a hitch. and > everything seems to physically be "there", but scripts that import a > module die. > > -brian > > Chris Gonnerman wrote: > > > HMMMM... > > > > First, I'd recommend > > > > ./configure --prefix=/home/luser > > make > > make test > > make install > > > > Make sure any script you write has > > > > #!/home/luser/bin/python > > > > at the top. > > > > This really should work... > > -- > http://mail.python.org/mailman/listinfo/python-list > > From aahz at panix.com Fri Dec 21 22:32:17 2001 From: aahz at panix.com (Aahz Maruch) Date: 21 Dec 2001 19:32:17 -0800 Subject: vi or emacs for editing Python on Linux? References: Message-ID: In article , Steve Lamb wrote: > > Now, vi is completely different than the WS keyset is. Actually, I like vi precisely because it reminds me of WS (yes, I started with WS on CP/M 2.2), despite having a different layout. Like WS, but unlike emacs, the basic cursor control is built on the physical layout of the keyboard rather than a logical mapping of function name. PS: I don't remember you being on Netcom. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 10 days and counting From bkelley at wi.mit.edu Thu Dec 20 17:34:20 2001 From: bkelley at wi.mit.edu (Brian Kelley) Date: Thu, 20 Dec 2001 17:34:20 -0500 Subject: Speeding dictionary lookup of instances Message-ID: <3C22676C.3020606@wi.mit.edu> Sometimes one wants to use an instance as a key in a dictionary class Foo: pass f = Foo() d = {} d[f] = 1 It turns out that this is relatively slow. In a previous post I was using a unique integer handle as a hash key. class IDGenerator: def __init__(self): self.start = -1 def next(self): self.start += 1 return self.start class Foo: def __init__(self, generator=IDGenerator()): self.handle = generator.next() f = Foo() d[f.handle] = 1 This speeds up dictionary lookup by a factor of 20. Not that implementing a __hash__ method to return the handle won't speed up the lookup. Paul Foley pointed out the builtin id function which I had forgotten about could be used for the same purpose. d[id(f)] = 1 It turns out this the speed of this is identical to the speed of using the handle. I like using the handle because the dictionary is picklable with the instance. id(f) changes during different sessions. The drawback to using this method is that the keys of the dictionary are not actually the objects themselves, however it does dramatically increase the speed of dictionaries. So if you want faster lookups using instances as keys, use a handle or the id. Attached is some simple timing code showing these three methods. Brian Kelley -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: test_handles.py URL: From chrishbarker at attbi.com Mon Dec 17 15:33:46 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Mon, 17 Dec 2001 12:33:46 -0800 Subject: Idiomatic portable way to strip line endings? References: Message-ID: <3C1E56AA.B7A3C9C9@attbi.com> John Roth wrote: > > These are two different cases, although it does come > up in practice if you're importing files from the internet. > Some browsers will fix the line endings, and some won't. > I had a lot of files with Unix line endings that I had to > convert to Windows line endings because Notepad > will not handle Unix line endings. At all. It can be worse than that. If someone got a file off the web with the line endings that were not native to their system and then edited it in an editor that is not very smart, you could have mixed line endings. To deal with all these problems (which become perhaps more common on Mac OS-X), there was discussion on python-dev about creating a "Universal Text File" type that would read files with any mixed combination of *nix, DOS and Mac line endings (and maybe do something smart on VMS as well). The goal would be able to have it work with Python code as well as files opened with open(), and also on pipes and other text streams. I know Guido, Jack Jansen and I had some discussion about it, and I think Jack put a little work into it, but I'm not sure where it sits. I don't have the C skills to make it happen myself. My solution was to write a module in Python to handle this. It's not all that fast, not that well tested, and doesn't (yet) support xreadlines(), but it is working just fine for me in production code. My web page got killed when @home went out of business, but it's not too big so I'll include it here. Comments, bug reports, and especially improvements and fixes welcome. -Chris module TexFile.py: #!/usr/bin/env python """ TextFile.py : a module that provides a UniversalTextFile class, and a replacement for the native python "open" command that provides an interface to that class. It would usually be used as: from TextFile import open then you can use the new open just like the old one (with some added flags and arguments) or import TextFile file = TextFile.open(filename,flags,[bufsize], [LineEndingType], [LineBufferSize]) please send bug reports, helpful hints, and/or feature requests to: Chris Barker ChrisHBarker at attbi.com Copywrite/license is the same as whatever version of python you are running. """ import os ## Re-map the open function _OrigOpen = open def open(filename,flags = "",bufsize = -1, LineEndingType = "", LineBufferSize = ""): """ A new open function, that returns a regular python file object for the old calls, and returns a new nifty universal text file when required. This works just like the regular open command, except that a new flag and a new parameter has been added. Call: file = open(filename,flags = "",bufsize = -1, LineEndingType = ""): - filename is the name of the file to be opened - flags is a string of one letter flags, the same as the standard open command, plus a "t" for universal text file. - - "b" means binary file, this returns the standard binary file object - - "t" means universal text file - - "r" for read only - - "w" for write. If there is both "w" and "t" than the user can specify a line ending type to be used with the LineEndingType parameter. - - "a" means append to existing file - bufsize specifies the buffer size to be used by the system. Same as the regular open function - LineEndingType is used only for writing (and appending) files, to specify a non-native line ending to be written. - - The options are: "native", "DOS", "Posix", "Unix", "Mac", or the characters themselves( "\r\n", etc. ). "native" will result in using the standard file object, which uses whatever is native for the system that python is running on. - LineBufferSize is the size of the buffer used to read data in a readline() operation. The default is currently set to 200 characters. If you will be reading files with many lines over 200 characters long, you should set this number to the largest expected line length. """ if "t" in flags: # this is a universal text file if ("w" in flags or "a" in flags) and LineEndingType == "native": return _OrigOpen(filename,flags.replace("t",""), bufsize) return UniversalTextFile(filename,flags,LineEndingType,LineBufferSize) else: # this is a regular old file return _OrigOpen(filename,flags,bufsize) class UniversalTextFile: """ A class that acts just like a python file object, but has a mode that allows the reading of arbitrary formated text files, i.e. with either Unix, DOS or Mac line endings. [\n , \r\n, or \r] To keep it truly universal, it checks for each of these line ending possibilities at every line, so it should work on a file with mixed endings as well. """ def __init__(self,filename,flags = "",LineEndingType = "native",LineBufferSize = ""): self._file = _OrigOpen(filename,flags.replace("t","")+"b") LineEndingType = LineEndingType.lower() if LineEndingType == "native": self.LineSep = os.linesep() elif LineEndingType == "dos": self.LineSep = "\r\n" elif LineEndingType == "posix" or LineEndingType == "unix" : self.LineSep = "\n" elif LineEndingType == "mac": self.LineSep = "\r" else: self.LineSep = LineEndingType ## some attributes self.closed = 0 self.mode = flags self.softspace = 0 if LineBufferSize: self._BufferSize = LineBufferSize else: self._BufferSize = 100 def readline(self): start_pos = self._file.tell() ##print "Current file posistion is:", start_pos line = "" TotalBytes = 0 Buffer = self._file.read(self._BufferSize) while Buffer: ##print "Buffer = ",repr(Buffer) newline_pos = Buffer.find("\n") return_pos = Buffer.find("\r") if return_pos == newline_pos-1 and return_pos >= 0: # we have a DOS line line = Buffer[:return_pos]+ "\n" TotalBytes = newline_pos+1 break elif ((return_pos < newline_pos) or newline_pos < 0 ) and return_pos >=0: # we have a Mac line line = Buffer[:return_pos]+ "\n" TotalBytes = return_pos+1 break elif newline_pos >= 0: # we have a Posix line line = Buffer[:newline_pos]+ "\n" TotalBytes = newline_pos+1 break else: # we need a larger buffer NewBuffer = self._file.read(self._BufferSize) if NewBuffer: Buffer = Buffer + NewBuffer else: # we are at the end of the file, without a line ending. self._file.seek(start_pos + len(Buffer)) return Buffer self._file.seek(start_pos + TotalBytes) return line def readlines(self,sizehint = None): """ readlines acts like the regular readlines, except that it understands any of the standard text file line endings ("\r\n", "\n", "\r"). If sizehint is used, it will read a a maximum of that many bytes. It will never round up, as the regular readline sometimes does. This means that if your buffer size is less than the length of the next line, you'll get an empty string, which could incorrectly be interpreted as the end of the file. """ if sizehint: Data = self._file.read(sizehint) else: Data = self._file.read() if len(Data) == sizehint: #print "The buffer is full" FullBuffer = 1 else: FullBuffer = 0 Data = Data.replace("\r\n","\n").replace("\r","\n") Lines = [line + "\n" for line in Data.split('\n')] ## If the last line is only a linefeed it is an extra line if Lines[-1] == "\n": del Lines[-1] ## if it isn't then the last line didn't have a linefeed, so we need to remove the one we put on. else: ## or it's the end of the buffer if FullBuffer: self._file.seek(-(len(Lines[-1])-1),1) # reset the file position del(Lines[-1]) else: Lines[-1] = Lines[-1][:-1] return Lines def readnumlines(self,NumLines = 1): """ readnumlines is an extension to the standard file object. It returns a list containing the number of lines that are requested. I have found this to be very useful, and allows me to avoid the many loops like: lines = [] for i in range(N): lines.append(file.readline()) Also, If I ever get around to writing this in C, it will provide a speed improvement. """ Lines = [] while len(Lines) < NumLines: Lines.append(self.readline()) return Lines def read(self,size = None): """ read acts like the regular read, except that it tranlates any of the standard text file line endings ("\r\n", "\n", "\r") into a "\n" If size is used, it will read a maximum of that many bytes, before translation. This means that if the line endings have more than one character, the size returned will be smaller. This could be fixed, but it didn't seem worth it. If you want that much control, use a binary file. """ if size: Data = self._file.read(size) else: Data = self._file.read() return Data.replace("\r\n","\n").replace("\r","\n") def write(self,string): """ write is just like the regular one, except that it uses the line separator specified when the file was opened for writing or appending. """ self._file.write(string.replace("\n",self.LineSep)) def writelines(self,list): for line in list: self.write(line) # The rest of the standard file methods mapped def close(self): self._file.close() self.closed = 1 def flush(self): self._file.flush() def fileno(self): return self._file.fileno() def seek(self,offset,whence = 0): self._file.seek(offset,whence) def tell(self): return self._file.tell() -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From chilopoda at hotmail.com Tue Dec 11 11:28:14 2001 From: chilopoda at hotmail.com (Rene Jensen) Date: Tue, 11 Dec 2001 16:28:14 +0000 (UTC) Subject: Newbie: Exeinstaller on win32 can't find my python Message-ID: <341a25546b4c5ada3d4aec83d9cd1c64.45609@mygate.mailgate.org> This is probably the most commonly asked question, but I've searched in vain for the answer, so here goes.. Why can't any of the exe-installers find any of my python-distributions?? I am trying to install pyopengl and pynumeric, and it would be a lot easier, if I could just use exe-installer, but when I come to the part, where I should choose a python distribution, none are available for selection. I've installed both ActiveState and the python.org distribution (in c:\app\Python22 as well as in the root.( I've set both PATH, PYTHONPATH and PYTHONHOME variables (all to the same dir) still no luck. What am I doing wrong? chilopoda at hotmail.com -- Posted from 0xc3d76136.mrgnxr2.ras.tele.dk [195.215.97.54] via Mailgate.ORG Server - http://www.Mailgate.ORG From fperez528 at yahoo.com Sun Dec 9 23:11:55 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Tue, 11 Dec 2001 03:39:55 +2328 Subject: ANNOUNCE - IPython, a new interactive shell for Python. Message-ID: <9v4nru$7r0$1@peabody.colorado.edu> WHAT: I'd like to announce IPython, an enhanced interactive Python shell. WHERE: http://www-hep.colorado.edu/~fperez/ipython (no fancy page, just a readme and the tarballs). PLATFORM: Linux/Unix. It may work in other OSes, I just don't know and can't test it. Let me know. I did try to make it as portable as possible. VERSION: 0.2.0, first public release. A CAVEAT: if you look inside the code, you'll see big parts are a mess. I know. Before you flame me into oblivion for writing code put together with duct-tape and chewing-gum wrappers, please keep in mind this is my first Python program ever and my first object oriented code ever. And, the code grew out a 'let's see if this works' thing, more as a proof of concept than a planned project. What I hope to get is enough people interested so that later (it will be a while, personal constraints right now prevent me from working more on it) it can be impoved. But *for the user* it works quite well, so I figured it would be a good idea to put it out. Hopefully a few good OO people will kick in later and help with the badly needed internal restructuring. STABILITY: I'd say very usable beta (it is my everyday Python environment). Expect crashes every now and then, send bug reports and they'll get fixed (it auto-generates a full post-mortem which you can mail). No new features though until the rewrite (code is too fragile). But I think the current feature set is quite complete and useful for end users. LICENSE: Mainly LGPL, except for a few files under MIT and Python licenses. MAIN AUTHORS: Fernando P?rez (currently main contact, blame me for all the bugs), Janko Hauser, Nathan Gray (real email addresses in the code, never on spam-Usenet). Cheers, Fernando P?rez --------------------------------------------------------------------------- Part of the README follows for the curious: IPython tries to: i - provide a flexible, useful and powerful environment for interactive work in Python programming. It tries to address what we see as shortcomings of the standard Python prompt, and adds many features to make interactive work much more efficient. ii - offer a flexible framework so that it can be used as the base environment for other projects and problems where Python can be the underlying language. Specifically scientific environments like Mathematica, IDL and Mathcad inspired its design, but similar ideas can be useful in many fields. Python is a fabulous language for implementing this kind of system (due to its dynamic and introspective features), and with suitable libraries entire systems could be built leveraging Python's power. iii - serve as an embeddable, ready to go interpreter for your own programs. Features overview ----------------- - Dynamic object information: typing ?word or word? prints detailed information about an object. One can access docstrings, function definition prototypes, source code, source files and other details. Information is even provided about methods not currently defined as variables (as long as they are available to Python, such as {}.get?). - Numbered input/output prompts with command history (persistent across sessions) and full searching in this history (via readline). - Input prompts are cached, so old input can be processed as a string, exec'ed or printed (useful for pasting of multi-line code into an editor without prompt continuation garbage). Input line is always available as variable _i, and _i, _ii and _iii contain the last three inputs. - Output is also cached. IPython is meant to be extensible as an environment for all sorts of work using Python as the base language. In scientific work for example, one often needs easy access to previously computed results. Output result is available as _o, and _o, _oo and _ooo contain the last three results. - Session logging (you can then later use these logs as code in your programs). - Session restoring: logs can be replayed to restore a previous session to the state where you left it (this feature is not perfect yet, but works reasonably well). - 'Magic' commands. A set of commands prefixed with @ is available for controlling IPython itself and provides directory control, namespace information and others. Users can define their own magic functions. - Shell access. Lines starting with ! are passed directly to the system shell. - Shell aliases. You can define with a simple syntax magic commands which access the shell (so you don't have to type ! every time). With these features, most routine shell-type work can be accomplished from within IPython without special syntax. - Completion in the local namespace, by typing TAB at the prompt. This works for keywords, methods, variables and files in the current directory (python names have precedence over filenames). - Verbose and colored exception traceback printouts. Easier to parse visually, and in verbose mode they produce tons of useful debugging information (basically a terminal version of the cgitb module). - Auto-parentheses and auto-quotes. Callable objects can be executed without parentheses: sin 3 gets converted to sin(3). You can also force this with a '/' as the first character. Using ',' as the first character forces auto-quoting of the rest of the line: ,my_function a b becomes my_function("a","b") - Extensible input syntax. You can define filters that pre-process user input to simplify input in special situations. For example, a module is provided that allows using PhysicalQuantity objects (from Scientific Python) to be input as In [1]: v = 3 m/s instead of the normal (and clumsy for interactive use): In [2]: v = PhysicalQuantity(3,'m/s') These extensions can be done by the user without needing to touch any IPython internal code. - Flexible configuration system. It uses a configuration file which allows permanent setting of all command-line options, module loading, code and file execution. The system allows recursive file inclusion, so one can have a base file with defaults and layers which load other customizations for particular projects. Which file is to be loaded can be specified at the command line with a simple -profile option. This allows easy configuration with vastly more flexibility (easily) than Python's PYTHONSTARTUP. - Embeddable. You can call IPython as a python shell inside your own python programs. This can be used both for debugging code or for providing interactive abilities to your programs with knowledge about the local namespaces (very useful in data analysis situations, for example). From aleax at aleax.it Tue Dec 11 12:41:14 2001 From: aleax at aleax.it (Alex Martelli) Date: Tue, 11 Dec 2001 18:41:14 +0100 Subject: eGenix extensions / GMP References: <9v5df1$tla$1@newsg4.svr.pol.co.uk> Message-ID: <9v5gfs0a6h@enews4.newsguy.com> "Duncan Smith" wrote in message news:9v5df1$tla$1 at newsg4.svr.pol.co.uk... > I have recently installed the eGenix experimental extensions. This includes > a Windows port of GMP 3.1.1. That works fine. But I would also like to use > GMP via PyInline (or C++), but the C compiler doesn't seem to recognise that > GMP is present. I have also downloaded the Windows port separately from > http://www.lemburg.com/files/python/, but I'm not sure where to go from > here. Anyone any idea how to sort this out (step by step)? Python 2.1, > Visual Studio 6 on Win 2000. Thanks in advance. I've regularly used the Windows GMP port that comes with gmpy (see gmpy.sourceforge.net) on its own (not via PyInline -- never tried that). For that, you basically just need to have Visual C++ find the .h file (for compilation) and .lib (for linking), either by placing those files in existing VC++ recognized directories or by adding to your environment suitable variables. Take care, though: if you compile this way, each DLL you build will be using its own copy of GMP. I don't know if Lemburg's port exposes a C-API (to let other Python-extension DLL's/PYD's share just one GMP); gmpy's does, and there's an example distributed with it of another C-coded Python extension using that API. I don't know about PyInline, though. Alex From teg at redhat.com Fri Dec 7 18:10:01 2001 From: teg at redhat.com (Trond Eivind =?iso-8859-1?q?Glomsr=F8d?=) Date: 07 Dec 2001 18:10:01 -0500 Subject: GUI builder References: Message-ID: "Timothy Collins" writes: > Just wondering if anyone knows where I could get my hands on a gui builder > that would work with python. Glade works great. -- Trond Eivind Glomsr?d Red Hat, Inc. From mertz at gnosis.cx Sun Dec 30 02:37:19 2001 From: mertz at gnosis.cx (Dr. David Mertz) Date: Sun, 30 Dec 2001 02:37:19 -0500 Subject: REMOTE_IMPORT was[Re: The Fiery Bush Python One True Universal Web Server...] (fwd) Message-ID: "Jeff Hinrichs" wrote: |About a system were you could specify in your code a module, version and a |remotemodule server (ala cpan) something like this pseudo code popped in to |my head.... |moduleName = Remote_Import(genericName, version, remoteHost, useLatest,forceRefresh) |import moduleName as genericName |Where the remote_import function could specify a module and version and if |it wasn't installed fetch it from a remote host and install it. Versioning |could be done by naming conventions and then if the import command allowed In one of my _Charming Python_ articles, I discuss almost exactly this capability. While I give some examples, the basic moral is that this is already very easy in Python--nothing much extra is needed (mabye wrapping my examples into a very small module, or making your own variants on the idea). Take a look at: http://gnosis.cx/publish/programming/charming_python_7.html Yours, David... From famiglia.ballabio at fastwebnet.it Fri Dec 7 08:16:09 2001 From: famiglia.ballabio at fastwebnet.it (Luigi e Viviana Ballabio) Date: Fri, 7 Dec 2001 14:16:09 +0100 Subject: staticmethod and __call__ Message-ID: Bruce, > class ItemGenerator: > import random > rgen = random.Random() > items = [j for j in vars(Item).values() if isinstance(j, Item)] > def __call__(): > return ItemGenerator.rgen.choice(ItemGenerator.items) > __call__ = staticmethod(__call__) > items = [ItemGenerator() for i in range(5)] apart from the __call__-not-being-overridden issue: since you are trying to Think in Patterns, and since what you are after is some kind of random Item factory, it might make more sense to name the above correspondingly, as in: class Item: whatever class ItemFactory: import random etc def create(): return ItemFactory.rgen.choice(ItemFactory.items) create = staticmethod(create) items = [ItemFactory.create() for i in range(5)] principle-of-least-surprisely yours, Luigi -- From nbensa at yahoo.com Mon Dec 3 12:24:14 2001 From: nbensa at yahoo.com (Norberto Bensa) Date: Mon, 3 Dec 2001 14:24:14 -0300 Subject: Installing 2.1.1 (warnings) Message-ID: <008101c17c1f$5609d580$0200000a@home> I got these while installing: $ ./configure --prefix=/usr $ make $ su -c "make install" ... Compiling /usr/lib/python2.1/posixfile.py ... Compili File "/usr/lib/python2.1/test/nocaret.py", line 2 [x for x in x] = x SyntaxError: can't assign to list comprehension ng /usr/lib/python2.1/pprint.py ... ... Compiling /usr/lib/python2.1/test/test_copy_reg.py ... Compiling /usr/lib/python2.1/test/tesSyntaxError: from __future__ imports must occur at the beginning of the file (test_future3.py, line 3) SyntaxError: from __future__ imports must occur at the beginning of the file (test_future4.py, line 3) SyntaxError: from __future__ imports must occur at the beginning of the file (test_future5.py, line 4) SyntaxError: from __future__ imports must occur at the beginning of the file (test_future6.py, line 3) SyntaxError: from __future__ imports must occur at the beginning of the file (test_future7.py, line 3) t_cpickle.py ... Compiling /usr/lib/python2.1/test/test_crypt.py ... ... building 'bsddb' extension gcc -g -O2 -Wall -Wstrict-prototypes -fPIC -DHAVE_DB_185_H=1 -I. -I/home/nbe nsa/src/Python-2.1.1/./Include -I/usr/local/include -IInclude/ -c /home/nbensa/src/Python-2.1.1/Modules/bsddbmodule.c -o build/temp.linux-i586-2.1/bsddbmodule.o WARNING: building of extension "bsddb" failed: command 'gcc' failed with exit status 1 skipping 'mpz' extension (up-to-date) From davebutlerREMOVE at hotmail.com Sat Dec 15 14:16:40 2001 From: davebutlerREMOVE at hotmail.com (Dave Butler) Date: Sat, 15 Dec 2001 19:16:40 GMT Subject: Python Hosting Questions Message-ID: I am searching for a new hosting company because my existing host does not provides many services/technologies (like Python) that I would like to use. While I evaluate potential hosts, I am uncertain as to which questions I should be asking. Perhaps CLP can help me with my list of questions as it relates to Python. Here are my Python questions for the web hosting companies: 1) Which version of Python is installed (it seems it should be at least 2.0 or 2.1) 2) Is Mod_python supported? Here are some questions I have for CLP: 1) Is Mod_python important if the web site will be very low volume and activity? My understanding is Mod_python avoids starting a new process for each CGI execution. This may not be that important in my uses. Any other reasons to require Mod_python? 2) Is it important that the web host provide certain Python modules or is it just as easy to install those modules I need in my own directories and access them through PYTHONPATH? Are there certain Python-related technologies that must be installed by the host and cannot be installed by the user in their home directories? I have found a potential hosting company, http://www.hostignition.com , that offers Python, Perl, PHP4, and JSP/Servlets for $5/month. This seems almost too good to be true. Any thoughts? Any other advice on this search? Thanks, Dave Butler From km-list-python at miazine.net Fri Dec 21 05:02:50 2001 From: km-list-python at miazine.net (Kirill Miazine) Date: Fri, 21 Dec 2001 11:02:50 +0100 Subject: age of new pythonistas [was: The Editor Poll results are in!] In-Reply-To: <60c49aa9.0112202148.7218555b@posting.google.com> References: <60c49aa9.0112202148.7218555b@posting.google.com> Message-ID: <20011221110250.C9045@poff.miazine.net> * Dan Compton [20011220 21:48]: > Tk!). So now I come upon Python and it looks like it's going to stay. Me too. I used Perl for a quite long project (2 years, still ongoing). Now I quit there and start in a new job and Python is the language of choice in that company. So nice :-) > I use a laptop with linux (no internet) and a desktop with windows > (with internet and burner) and am glad to say that everything works > well cross-platform. I have already interfaced some of my C code with I still didn't try anything outside OpenBSD. Although I will probably try to run some of my apps on Windows some day. > Python on Windows but since I really HATE VC++ (no, it does not > compile C++, it compiles some made up stuff MS calls C++), I'm going > to do more of that in Linux. I think Python is great because it is > well designed (unlike Perl), it has many features and modules (unlike You can't say Perl is badly designed just because you found "it to be way too much of an intimidating mess of syntax and modules". > Tcl, but I might be wrong about that due to ignorance), and it has > great integration of C and C++! I hope to be able to create modules > to be used by the entire Python community sometime. > Dan -- Kirill Copyleft Software AS From bedge at troikanetworks.com Mon Dec 17 19:47:09 2001 From: bedge at troikanetworks.com (Bruce Edge) Date: Mon, 17 Dec 2001 16:47:09 -0800 Subject: webmin modules in python? Message-ID: I webmin docs really lean towards perl, hs anyone written one in python? -bruce. From mcherm at destiny.com Mon Dec 10 15:58:33 2001 From: mcherm at destiny.com (Michael Chermside) Date: Mon, 10 Dec 2001 15:58:33 -0500 Subject: Recursing into directories Message-ID: <3C1521F9.3050405@destiny.com> In addition to os.path.walk, I'm also somewhat partial to http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52664 but both are functions, not classes as you requested. Of course, it's simple enough to build a class that uses the function.... -- Michael Chermside > Hi, > > Is there a built-in class (in dircache, os.path????) that > recurses thru a directory tree? > > I've written one using dircache.listdir, but if there is some- > thing pre-written, I'd rather use that... > > Thanks, > Ron > -- > +-----------------------------------------------------------------+ > | Ron Johnson, Jr. Home: ron.l.johnson at home.com | > | Jefferson, LA USA http://ronandheather.dhs.org:81 | > +-----------------------------------------------------------------+ > > > > From nospam at mega-nerd.com Mon Dec 3 15:44:53 2001 From: nospam at mega-nerd.com (Erik de Castro Lopo) Date: Mon, 03 Dec 2001 20:44:53 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> Message-ID: <3C0BE445.2D4EDF72@mega-nerd.com> Courageous wrote: > > >Perhaps you might want to put some kind of processing step into your > >revision control procedures or tools. I think I raised this issue > >before on comp.lang.python but some people think it's more interesting > >to get religious about tabs vs. spaces instead. > > I've considered that on many occasions; one such step might be to > simply REJECT a commit of a .py file with tabs in it. How about a counter proposal? Reject all .py files with spaces for indentation. Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam at mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ "... the industrial-capitalist mode of software production was doomed to be outcompeted from the moment capitalism began to create enough of a wealth surplus for many programmers to live in a post-scarcity gift culture." -- Eric S. Raymond From dev1.gemodek at t-online.de Mon Dec 31 03:44:39 2001 From: dev1.gemodek at t-online.de (Stephane) Date: Mon, 31 Dec 2001 09:44:39 +0100 Subject: REPOST: Re: Fate of win32all? References: <7876a8ea.0112212116.2ebabc23@posting.google.com> <7$--$$_----_-$-_%$@news.noc.cabal.int> Message-ID: <3C302577.4283F1B6@t-online.de> once more ... Thanks for that great Soft Mark, I still use Win32all at home and at my company because its nice,fast and stable (I tried comodo 1.1, but it was to slow for me..) Have a happy new year and a happy new Job (or the money only :-) ), Bye Stephane Matamontero Mark Hammond wrote: > > Thanks to everyone who replied to this thread - I really appreciate the > supportive words. I am very sure I will land on my feet, so there is no > need to worry (now if someone would just tell that to my girlfriend :) > > I will be here for the forseeable future, so please don't write eulogies > for any Python related work I am involved in ;) > > FWIW, it is this very community spirit that makes Python such a pleasure > to be involved in - so that yourselves as much as me - if not for this > spirit I would not have been here in the first place! > > Thanks all! > > Now-back-to-a-win32all-release ly, > > Mark. > From dominikush at yahoo.com Wed Dec 12 07:38:28 2001 From: dominikush at yahoo.com (dominikush) Date: Wed, 12 Dec 2001 12:38:28 -0000 Subject: __getattr__ related question Message-ID: <9v7j44+8okt@eGroups.com> Dear Pythonics, the __getattr__ method causes me some headache. To prohibit unwanted method calls of an object, I shield it by an interface object. So, all method calls are addressed to the interface object. That means the user calls capsuleInterface.send("Hallo") instead of directly calling capsule.send("Hallo"), see example below. The __getattr__ in Port catches the call and returns the send() method of Capsule. However, evaluating the method fails >>> capsuleInterface.send("Hallo") Traceback (most recent call last): File "", line 1, in ? TypeError: not enough arguments; expected 2, got 1 Clearly, the send() method expects the arguments self and data, but self is missing! How do I get it right? How can I add the self value (it should be the capsule object) to the parameter list before the method retrieved by __getattr__ is evaluated? Gruss Dominikus --- Example --- class Port: def __init__(self,component): self.component = component self.methods = [] def registerMethod(self,methodName): self.methods.append(methodName) def __getattr__(self,name): if name in self.methods: try: return self.component.__class__.__dict__[name] except KeyError, error: raise AttributeError, error raise AttributeError, name+" is not known to port" class CapsuleInterface(Port): pass class Capsule: def send(self,data): print "Capsule sends",data capsule = Capsule() capsuleInterface = CapsuleInterface(capsule) capsuleInterface.registerMethod("send") From pythongeek at tradersdata.com Sun Dec 16 21:16:57 2001 From: pythongeek at tradersdata.com (pythongeek at tradersdata.com) Date: Sun, 16 Dec 2001 21:16:57 -0500 (EST) Subject: Update Oreilly books? Message-ID: <200112170216.fBH2GvN03114@vela.tradersdata.com> I am about to slowly transfer out of my newbie status, and I am going to purchase a Programming Python Book (an upgrade from learning python) and I wanted to know if anyone knows whether Oreilly will update the book with the upcoming 2.2 release or if the 2nd edition will last till 3.0 Python relase. Thank You Dan -- John 11:25 "Jesus said to her, I am the resurrection and the life. He who believes in me will live, even though he dies;" -- http://www.tddm.org/salvation.shtml From srumbalski at prodigy.net Sat Dec 29 10:51:41 2001 From: srumbalski at prodigy.net (Steven Rumbalski) Date: Sat, 29 Dec 2001 15:51:41 GMT Subject: age of new pythonistas [was: The Editor Poll results are in!] References: <60c49aa9.0112202148.7218555b@posting.google.com> Message-ID: Ville Vainio wrote: > Ditto with TCL. When I see 8 backslashes in a row, I look elsewhere Ditto with Python. When I see lines of code terminated by nothing but whitespace, I look elsewhere. asthetic-shock-a-poor-judge-ly yours, Steven Rumbalski From kfarmer at thuban.org Thu Dec 27 09:24:54 2001 From: kfarmer at thuban.org (Keith Farmer) Date: Thu, 27 Dec 2001 14:24:54 GMT Subject: REPOST: Re: The Python community needs a lighter heart to it. References: <40dbad98.0112261431.3e928cf2@posting.google.com> Message-ID: <1$--$$_----_%-%$%$@news.noc.cabal.int> "Chris Gonnerman" wrote in message news:mailman.1009459470.8426.python-list at python.org... > I just have one question: Who is Andrew Nguyen and why should we > follow him around anyway? Until he leaves us his shoe, you cannot take him seriously... ---------- Keith J. Farmer kfarmer at thuban.org http://www.thuban.org ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Keith Farmer" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:57:16 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775752 27193 211.57.49.2 (31 Dec 2001 05:15:52 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:15:52 +0000 (UTC) X-Auth-User: 453174101/4b3424e26a3ac51f X-Post-Time: Mon, 31 Dec 2001 02:30:26 GMT X-Problems-To: abuse at prodigy.com X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From BrianA at CoManage.net Fri Dec 21 11:02:08 2001 From: BrianA at CoManage.net (Brian Abercrombie) Date: Fri, 21 Dec 2001 11:02:08 -0500 Subject: test Message-ID: <157A4D97A88D7143B80E43C1B000B6E80D71E0@comail1.comanage.net> An HTML attachment was scrubbed... URL: From jgardn at alumni.washington.edu Thu Dec 13 10:48:01 2001 From: jgardn at alumni.washington.edu (Jonathan Gardner) Date: Fri, 14 Dec 2001 00:48:01 +0900 Subject: Games Made w/ Python In-Reply-To: <9v9gss$5hr$1@nntp9.atl.mindspring.net> References: <9v9gss$5hr$1@nntp9.atl.mindspring.net> Message-ID: <200112131551.fBDFpKJ10223@my.knctv.co.kr> On Thursday 13 December 2001 03:10 pm, nobody at nowhere wrote: > X-No-Archive: yes > > Is Python an appropriate language for game programming? > > TIA. http://bttotalcontrol.sf.net/ A little history, I've tried C++, I've tried perl, but I was only able to make progress with Python. The C++ and perl code eventually turned into a maintenance nightmare. Not to mention it was impossible to tweak. With Python, everything seems to runs smooth. Also, Python is so quick to run up and get working, I was able to replace important, complicated parts in a jiffy with experimental code. For instance, the 3D engine has been through extensive modifications. I think I have 6 or 7 different versions lying around on the cutting floor, and I am working on version 8 or 9. I have lost count. I plan to write some C or C++ code eventually, but only after the python code stabilizes and I am happy with what I see. Jonathan From mgerrans at ix.netcom.com Fri Dec 7 03:18:49 2001 From: mgerrans at ix.netcom.com (Matt Gerrans) Date: Fri, 7 Dec 2001 00:18:49 -0800 Subject: Help setting path on windows References: <3C0D1802.6D93D957@motorola.com> <9unvgl$p9a$1@serv1.iunet.it> Message-ID: <9upu1c$fr3$1@slb7.atl.mindspring.net> Interesting, it seems the paths in these pth files are searched, but they are not added to the python path (sys.path). - mfg Alex Martelli wrote in message news:9unvgl$p9a$1 at serv1.iunet.it... > "Stephen Boulet" wrote in message > news:3C0D1802.6D93D957 at motorola.com... > > Can someone help me? > > > > I'd like to be able to do: > > > > from someModule import * > > > > and have my someModule.py file imported. Thanks. > > Probably simplest: add to directory C:\Python21 (if that's where > you installed Python) a textfile named > anyname.pth > (any name, extension must be PTH). > > In this file, list, one per line, all directories you want to > be searched for modules you import. > > > Alex > > > From jeff at ccvcorp.com Wed Dec 5 14:11:25 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Wed, 05 Dec 2001 11:11:25 -0800 Subject: Draft PEP: string interpolation with backquotes References: <20011202080626.A76724@hishome.net> <20011202170805.A36879@hishome.net> <200112032307.fB3N78327930@bigboy.bizarsoftware.com.au> <9ujspb$777$1@news.island.liu.se> Message-ID: <3C0E715D.855DE84D@ccvcorp.com> Paul Svensson wrote: > Oren Tirosh writes: > > >As for the issue of interpolation with backticks being equivalent to str() > >rather than repr() - I believe most people won't even notice. When the > >system simply does the Right Thing according to the context it feels more > >consistent even if technically it isn't. > > Actually, > considering that quotes create strings, > having `foo` mean repr(foo) and "`foo`" mean str(foo) seems fairly natural... Having "`foo`" mean str(foo) and having "'foo'" meaning "'foo'" seems pretty confusing to me. Backticks are awkward, hard to find on the keyboard, and hard to visually differentiate from regular single-quotes. I strongly dislike using them. Then again, I never *would* use them, even if this proposal passes, because it seems *much* clearer to me to use "%s" % foo And the thought of reading through a string with 50 or more embedded expressions, exactly the situation that this proposal is being recommended for, and trying to keep straight what's text and what's code, gives me the willies. Jeff Shannon Technician/Programmer Credit International From jorjun at mac.com Sat Dec 15 06:41:07 2001 From: jorjun at mac.com (jorjun) Date: Sat, 15 Dec 2001 11:41:07 +0000 (UTC) Subject: distutils, shared libraries and Mac OS X References: <3C17C2B5.8060607@avaquest.com> <3C18D67B.6060505@avaquest.com> Message-ID: <3C1B36C3.3000106@mac.com> could you give a pointer on installing patches? Matthew King wrote: > > > Matthew King wrote: > >> this worked, but I'm curious if there was a better way to do it? > > > > update... > > there is a better way. patch #450862 in sourceforge already addresses this. > > - matt > > From jkraska at san.rr.com Fri Dec 14 18:31:58 2001 From: jkraska at san.rr.com (Courageous) Date: Fri, 14 Dec 2001 23:31:58 GMT Subject: "XXX undetected error" in python_d.exe References: <3C19DC19.6060107@skippinet.com.au> Message-ID: >This error occurs and properly returns NULL. An exception gets >delivered to the executable, but the "XXX undeteced error" message >still comes up. In retrospect, this appears to be a case of me not knowing exactly when to use the PyErr_Clear() call. This simply _must_ fall into the domain of extension authoring esoterica. :-) C// From bkc at Murkworks.com Sun Dec 30 11:43:06 2001 From: bkc at Murkworks.com (Brad Clements) Date: Sun, 30 Dec 2001 11:43:06 -0500 Subject: REPOST: Win32all and Mark. time to bring back win32-reg-users? Message-ID: <6$--$$_----__$-%%$@news.noc.cabal.int> Just a thought, worth it to me.. -- Brad Clements, DevNet Sysop 5 Developer Network Sysop Team -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Brad Clements" Newsgroups: comp.lang.python Subject: cmsg cancel <3c2f44b5_7 at news.newsgroups.com> Control: cancel <3c2f44b5_7 at news.newsgroups.com> Date: Mon, 31 Dec 2001 03:41:15 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774180 27193 211.57.49.2 (31 Dec 2001 04:49:40 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:49:40 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From cfelling at iae.nl Fri Dec 7 20:30:00 2001 From: cfelling at iae.nl (Carel Fellinger) Date: 8 Dec 2001 02:30:00 +0100 Subject: Hiding stuff like passwords in source? References: Message-ID: <9urqeo$36t$1@animus.fel.iae.nl> David Brady wrote: ... > directories and such. Because I'm too lazy to type in > my password every time, I've just jammed in the > password into the Python source. It's nice being able ... > The problem is, of course, security. If someone else Depending of your OS of choice and the security level wanted this can be dead simple or trully impossible:) But one thing to start with is to seperate the password info from your normal code. Put it in some file not readable by others (file protection wise, or by having it on a very privat floppydisk) and read the info in at the start of your program. -- groetjes, carel From breakfast at 10.am Tue Dec 18 11:22:33 2001 From: breakfast at 10.am (mallum) Date: Tue, 18 Dec 2001 16:22:33 +0000 Subject: pyexpat and unicode In-Reply-To: <20011217224808.D482@10.am> References: <9vlh7i$f4$1@peabody.colorado.edu> <002f01c18749$aca03f30$445d4540@Dell2> <20011217224808.D482@10.am> Message-ID: <20011218162233.C755@10.am> A friend with an international setup tried my test script ( with this fix ) with an actual accented char ( rather than the escape code ) and _still_ got the ascii not in ordinal range error from expats Parse call. Also Im still getting encoding errors in the script Im using this for, which involves reading xml from a network stream. Can anyone confirm that expat will parse utf8 encoded text ? -- mallum on Mon, Dec 17, 2001 at 10:48:08PM +0000, mallum wrote: > on Mon, Dec 17, 2001 at 02:25:03PM -0800, Brian Quinlan wrote: > > > > to have? Unicode objects, like strings, are immutable. What you probably > > meant is: > > > > data_uni = data_uni.encode('utf8') > > > Looks like I was doing something stupid and missing the obvious :) > > Many thanks for the help; > > -- mallum > > -- > http://mail.python.org/mailman/listinfo/python-list From max at alcyone.com Fri Dec 21 14:36:14 2001 From: max at alcyone.com (Erik Max Francis) Date: Fri, 21 Dec 2001 11:36:14 -0800 Subject: Bug in % string formatting? References: <9vtiev$no8$1@peabody.colorado.edu> <871yhp7guv.fsf@ifm.uni-kiel.de> <9vtk6h$ojk$1@peabody.colorado.edu> <3C225BBC.2D06CB8@alcyone.com> Message-ID: <3C238F2E.3A4CCCD1@alcyone.com> Michael Hudson wrote: > Which is in turn a reason for not overloading operators too much. > Anyone ever done this: > > cout << var ? "true" : "false"; > > in C++? It was *years* before I realised why that didn't work... It's a better reason for using parentheses when you're not sure about operator precedence. Parentheses never hurt. -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ Laws are silent in time of war. \__/ Cicero Esperanto reference / http://www.alcyone.com/max/lang/esperanto/ An Esperanto reference for English speakers. From rupert.kolb at med.uni-tuebingen.de Wed Dec 12 06:17:13 2001 From: rupert.kolb at med.uni-tuebingen.de (Rupert Kolb) Date: Wed, 12 Dec 2001 12:17:13 +0100 Subject: Interactive unbuffered STDOUT References: <9ulf58$1rr$1@license1.unx.sas.com> Message-ID: <3C173CB9.6060801@med.uni-tuebingen.de> Kevin Smith wrote: > Is there a way that sys.stdout can be switched to unbuffered during execution? > I know that you can set the PYTHONUNBUFFERED environment variable or > use the -u option, but those have to be done before the interpretter > is loaded. > > I see that there is a bufsize option on the open() function. If I > could recreate sys.stdout with bufsize=0, that would be great. [...] I'm interested in this too. I would like to mix (the normal) buffered print mode with unbuffered (print / sys.stdout.write) mode in an easy way. -- Rupert Kolb From aahz at panix.com Sat Dec 29 16:46:58 2001 From: aahz at panix.com (Aahz Maruch) Date: 29 Dec 2001 13:46:58 -0800 Subject: OT: Gender-based security? (was Re: Fate of win32all?) References: <7876a8ea.0112212116.2ebabc23@posting.google.com> Message-ID: In article , Sheila King wrote: > >Heck, maybe I'm a man in a woman's body???? I dunno. I'm sure that a ... thorough ... examination can be arranged. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 2 days and counting From jkraska at san.rr.com Mon Dec 24 13:01:34 2001 From: jkraska at san.rr.com (Courageous) Date: Mon, 24 Dec 2001 18:01:34 GMT Subject: Looping constructs References: <3c25d37e_9@news.newsgroups.com> <3c26fefc$1_10@news.newsgroups.com> Message-ID: <14re2u8salnkg99te2ngqcn1hm9euudvt8@4ax.com> >And I still maintain that in my eyey Perl's richness is an advantage. As is Python's simplicity. It's all a matter of perspective and desires. The world is not a homogenous place. C// From johnroth at ameritech.net Sat Dec 8 10:05:34 2001 From: johnroth at ameritech.net (John Roth) Date: Sat, 8 Dec 2001 07:05:34 -0800 Subject: finance programs References: <3c117b54$0$27197$afc38c87@news.optusnet.com.au> Message-ID: "djmitchell" wrote in message news:3c117b54$0$27197$afc38c87 at news.optusnet.com.au... > > > Are there any fnance packages being worked on that anyone knows about? > > Maybe something that I can at least get ideas from? > > In the book "Python Programming on Win32", one of the examples in the first > few chapters is a finance package. From memory (I haven't read this part > of the book for a while), it doesn't go into massive depth, but it covers > the initial app design and lots of specific bits in reasonable depth. > > I'm pretty sure the focus of this section is using Python to write the > functional parts of the app, then exposing these bits as COM objects for > use by a VB-coded GUI. Again, my memory might be playing tricks. > > Check out the book in your local bookshop to see if it covers what you want. It's more the core of an accounting toolset that can be used as a base for lots of specific analytical work. The actual code is on the CD that comes with the book. John Roth From zhangsc at neusoft.com Thu Dec 20 19:54:42 2001 From: zhangsc at neusoft.com (=?gb2312?B?1cXJ2bPb?=) Date: Fri, 21 Dec 2001 08:54:42 +0800 Subject: Is there a tool for python under Linux? Message-ID: <003b01c189ba$136a71f0$4301010a@sky> I want to know if there is a tool which can compile python's source code into a standalone EXE file under Red Hat Linux7.0 ,for example,compile my.py into my.exe under Linux. Regards, Edward -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin at cazabon.com Tue Dec 11 15:03:19 2001 From: kevin at cazabon.com (Kevin Cazabon) Date: 11 Dec 2001 12:03:19 -0800 Subject: jpeg files displayed in a loop References: Message-ID: <5a4226f0.0112111203.1d361fa0@posting.google.com> import Tkinter import Image, ImageTk import os dir="c:\\temp\\" def showimage(): image = pop(files) files.append(image) image = ImageTk.photoimage(Image.open(image)) #ok, do try/except b.configure(image=image) b.update_idletasks() b.after(1000, showimage) a = Tkinter.tk() b = Tkinter.label(a) b.pack() files = os.listdir(dir) # ok, check them for file types... while 1: showimage() # ok, probably a couple minor typos, but it should be that simple. Kevin Cazabon. kevin at cazabon.com Wolfgang Teschner wrote in message news:... > Hi, > I want to automatically display all jpeg files of a dir in a long > loop, with a wait time between the different displays. Just that. > No user input. > With PIL, it seems to be impossible because of TKinters mainloop. > > Are there other ways/packages for this purpose? Just displaying the > images as they are... > platform is win32, but I would be interested for independant > solutions, if they exist. > > Thanks, > wolfgang teschner From dalke at dalkescientific.com Fri Dec 7 13:22:39 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Fri, 7 Dec 2001 11:22:39 -0700 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C0FBAA8.F1A44304@attbi.com> <3C100EFF.6EEA6C7A@cosc.canterbury.ac.nz> Message-ID: <9ur204$9fp$1@slb7.atl.mindspring.net> Greg Ewing: >I suggest femtoseconds. It's the smallest time unit I've >heard anyone talk about. If you need something smaller >you're probably a bleeding-edge particle physicist with >more things to worry about than finding a time module... Some chemists work in attoseconds http://www.aip.org/enews/physnews/2001/split/567%2D1.html But I don't know if they need a time module. Andrew dalke at dalkescientific.com From donn at u.washington.edu Wed Dec 19 11:56:27 2001 From: donn at u.washington.edu (Donn Cave) Date: 19 Dec 2001 16:56:27 GMT Subject: pty/fork and SIGINT References: <1008650439.385033@yabetcha.sttl.drizzle.com> Message-ID: <9vqgrr$qc6$1@nntp6.u.washington.edu> Quoth bsturk at news.rcn.com (Brian Sturk): ... | I think you may have misunderstood my question. Sending the signal | to ping works fine, but sending it to the parent pid, which is all | I have after executing pty.fork() doesn't "forward" the signal. | I should probably have been more explicit. I guess I was expecting | the behavior I see when I run in an interactive shell when I sent the signal | to the controlling shell. If you use the terminal driver to send a signal (like ctrl-C -> SIGINT), it goes to the foreground process group. (Assuming Berkeley job control.) That may look like forwarding, but really is more of a limited broadcast. I believe pty.fork() is deliberately taking your child process out of reach of this, by putting the child process in a new process group with the slave tty as controlling terminal. You may be able to get it back afterwards with posix.setpgid(). If that works, the child process will still ignore signals sent like posix.kill(posix.getpid(), sig), but you could expect posix.kill(-posix.getpid(), sig) to reach it, if negative pid means process group in this context on your platform. Donn Cave, donn at u.washington.edu From pawelczyk at lucent.com Wed Dec 5 05:49:13 2001 From: pawelczyk at lucent.com (Lukasz Pawelczyk) Date: Wed, 05 Dec 2001 11:49:13 +0100 Subject: cursor option in Tkinter Message-ID: <3C0DFBA9.2F640288@lucent.com> Hello, I have found good documentation for Tkinter: "An introduction to Tkinter", but there are no available words for cursor option for widgets. I know only one dafault for Text widget: "xterm". There are the pictures of available cursors, but there are no any names for them. Could anyone tell me where can I find it? Thanks in advance, Lukasz From daniel.pote at xms.se Wed Dec 12 08:14:29 2001 From: daniel.pote at xms.se (Daniel Pote) Date: Wed, 12 Dec 2001 14:14:29 +0100 (CET) Subject: Import random In-Reply-To: References: Message-ID: <56299.192.168.146.2.1008162869.squirrel@portal.xms.se> Michael Hudson said: > "Daniel Pote" writes: > >> Hi, >> >> Just joined this group after trying to compile mailman on HP-UX 11.00. It seems to be >> something wrong when trying to import random. >> >> Compiling /opt/mailman/Mailman/versions.py ... >> Traceback (most recent call last): >> File "bin/update", line 31, in ? >> from Mailman import Utils >> File "/opt/mailman/Mailman/Utils.py", line 32, in ? >> import random >> File "/opt/python/lib/python2.1/random.py", line 93, in ? >> _verify('NV_MAGICCONST', 1.71552776992141) >> File "/opt/python/lib/python2.1/random.py", line 88, in _verify >> raise ValueError( >> ValueError: computed value for NV_MAGICCONST deviates too much (computed 0, expe cted >> 1.10415e+09) >> >> Same result if i run python and types: import random >> >> Can anyone help me on this ? >> >> I have installed python 2.1 package from hpux.connect.org.uk > > Someting is very, very wrong somewhere. > > What happens if you type > >>>> from math import exp, sqrt >>>> 4 * exp(-0.5)/sqrt(2.0) > Result is: 0.0 From tripp81 at yahoo.com Mon Dec 3 01:53:41 2001 From: tripp81 at yahoo.com (Tripp Scott) Date: Mon, 03 Dec 2001 13:53:41 +0700 Subject: executing .pyc file Message-ID: <5.1.0.14.2.20011203134639.03256bd8@202.95.131.154> thanks for the previous reply, now on to the next question :) has someone written a trick so i can directly execute .pyc in unix? my library has an 'if __name__=="main"' section and it would be neat if i could just chmod +x the .pyc file and invoke it with: $ ./file.pyc instead of $ python file.pyc adding a '#!/usr/bin/python' won't cut it. i believe we can do something like this--in essence--in perl with the source filter mechanism. t From vincent_a_primavera at netzero.net Sat Dec 29 04:03:58 2001 From: vincent_a_primavera at netzero.net (Vincent A. Primavera) Date: 29 Dec 2001 09:03:58 +0000 Subject: Authentication, urllib, and httplib... In-Reply-To: References: Message-ID: <1009616638.9901.11.camel@del-vap-bos.ralphpill.com> Hello, The good news is that with your help I was able to get past the authorization step which is a giant step. The bad news is that I now realize that there is a javascript button that calls a function to do a few things and submit the form. I doubt I will be able figure this one out soon but you never know. Any suggestions, anyone? Thank you, Vincent A. Primavera On Fri, 2001-12-28 at 21:19, Ryan Phillips wrote: > This should help: > http://www.zope.org/Members/peterb/http_auth > > -Ryan > > > "Vincent A. Primavera" wrote in message > news:mailman.1009571133.29349.python-list at python.org... > > Hello, > > Trying to write a program to pull several Excel format reports off of a > > website which we at my company are spending alot of time on doing > > manually once a week. The page has a form with several fields to be > > filled in before submitting. Here's the problem, I can access the page > > with urllib's urlopen() but not with httplib's HTTPConnection.request() > > as I am getting a 401 Authorization Required error. How can I be > > prompted for the user and password info as I am with urlopen()? Or > > better yet pass these parameters? > > > > Thanks in advance, > > Vincent A. Primavera > > > > P.S. I have all of the necessary field names with exception to the > > username and password... > > > > > > From dalke at dalkescientific.com Sun Dec 2 22:40:31 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Sun, 2 Dec 2001 20:40:31 -0700 Subject: Quick GC question References: Message-ID: <9uesmu$ebu$1@slb1.atl.mindspring.net> forgotten gentleman: >Am I guaranteed that the optional GC will be enabled by default, or >should I get into the habit of typing gc.enable() just in case? As I recall, before the final 2.0 release it want from disabled by default to enabled by default. It should be enabled on all 2.x released. You can check for yourself when you do a configure. There should be a line like this: checking for --with-cycle-gc... yes It comes from this code in 'configure' =============== # Check for GC support echo $ac_n "checking for --with-cycle-gc""... $ac_c" 1>&6 echo "configure:4483: checking for --with-cycle-gc" >&5 # Check whether --with-cycle-gc or --without-cycle-gc was given. if test "${with_cycle_gc+set}" = set; then withval="$with_cycle_gc" : fi if test -z "$with_cycle_gc" then with_cycle_gc="yes" fi if test "$with_cycle_gc" != "no" then cat >> confdefs.h <<\EOF #define WITH_CYCLE_GC 1 EOF =============== You can see if it isn't set on the configure command line then it defaults to 'yes'. Andrew dalke at dalkescientific.com From bob at kontactsoftware.com Sat Dec 15 18:21:37 2001 From: bob at kontactsoftware.com (Robert C. Kircher, Jr.) Date: Sat, 15 Dec 2001 15:21:37 -0800 Subject: cannot run makepy or COM browser Message-ID: <000101c185bf$3f36faa0$0200000a@gate350> When I try to run makepy or the com browser I get the following errors. Any ideas? Thanks >>> Failed to execute command: from win32com.client import makepy;makepy.main() Traceback (most recent call last): File "D:\Python21\Pythonwin\pywin\framework\toolmenu.py", line 103, in HandleToolCommand exec "%s\n" % pyCmd File "", line 1, in ? ImportError: cannot import name makepy >>> >>> Failed to execute command: from win32com.client import combrowse;combrowse.main() Traceback (most recent call last): File "D:\Python21\Pythonwin\pywin\framework\toolmenu.py", line 103, in HandleToolCommand exec "%s\n" % pyCmd File "", line 1, in ? ImportError: cannot import name combrowse -------------- next part -------------- An HTML attachment was scrubbed... URL: From oren-py-l at hishome.net Wed Dec 12 09:14:55 2001 From: oren-py-l at hishome.net (Oren Tirosh) Date: Wed, 12 Dec 2001 09:14:55 -0500 Subject: Whatever happened to String Interpolation? In-Reply-To: ; from vvainio@karhu.tp.spt.fi on Wed, Dec 12, 2001 at 09:25:24AM +0200 References: <9u6dbn$nsj$1@peabody.colorado.edu> <9ue35a$sbi$1@peabody.colorado.edu> <9uerd1$hbk$1@peabody.colorado.edu> Message-ID: <20011212091455.A40373@hishome.net> On Wed, Dec 12, 2001 at 09:25:24AM +0200, Ville Vainio wrote: > > > That already exists: type 'python Itpl' in google. > > So, it appears to be done already. What's the fuss, then? Wouldn't > having this in the standard library suffice? Looking at the relatively > concise syntax on Itpl, why on earth would one want an equivalent > thing encumbering the core language? Something that can be done in a module belongs in a module, not in the core language. Saving an import statement and a pair of parentheses does not justify changes to the core language. But the proposal in http://www.tothink.com/python/interpp cannot be implemented in a module. The embedded expressions are fully syntax-checked at compile time and generate real bytecode. There is no use of eval() or runtime parsing that are so common in so-called 'scripting' languages and contribute to their slow performance and security problems. I believe this is a worthy goal, and it can only be accomplished by extending the syntax of the language. The issue of whether it SHOULD be added to the language is, of course, open for debate but the only way it CAN be implemented is as part of the language syntax. Oren From jkraska at san.rr.com Wed Dec 12 13:09:36 2001 From: jkraska at san.rr.com (Courageous) Date: Wed, 12 Dec 2001 18:09:36 GMT Subject: more fun with PEP 276 References: Message-ID: <9p6f1ucqppcla9vj3kbn80mqod19f8v91c@4ax.com> >> > for i in -5 to 5: The limited number of Linguistic Forms in Python is an essential element of the Programmers Linguistic Weapons Treaty of 1980. Breaking the Treaty would certainly lead to a new Linguistic Forms Race. This could lead to a situation where a massive exchange of Linguistic Forms occurs, causing a chain reaction whereby the Mainframe is Shutdown until a new species of programs arises to rule the Mainframe. Perhaps it would look like Lisp. C// From dalke at dalkescientific.com Tue Dec 18 18:10:39 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Tue, 18 Dec 2001 16:10:39 -0700 Subject: DOM - some pointers References: Message-ID: <9voi51$fco$1@slb7.atl.mindspring.net> infotechsys.wayne at verizon.net: >Could someone point me to some documentation that show how to use >HTML ,Dom and Python together. I did a google search, but the only >thing I find is DOM, XML and Python. I confess to being confused as well. I give here an example of what I want to do and how I thought to do it. I have an /etc/passwd-like XML format like this dalke * < .... > /bin/tcsh root .... I want to change my shell entry to /bin/bash. I tried the following (with Python 2.0, but I doubt 2.2 has changed things): >>> from xml.dom import minidom >>> doc = minidom.parseString("" ... "dalke" ... "/bin/tcsh" ... "") >>> doc.normalize() >>> for entry in doc.getElementsByTagName("entry"): ... account = entry.getElementsByTagName("account")[0] ... if account.firstChild.nodeValue == "dalke": ... shell = entry.getElementsByTagName("shell")[0] ... shell.firstChild.nodeValue = u"/bin/bash" ... break ... else: ... print "dalke not found" ... >>> doc.toxml() u'dalke/bin/tcsh ' >>> shell >>> shell.firstChild.nodeValue u'/bin/bash' >>> shell.firstChild.data = u"/bin/bash" >>> doc.toxml() u'dalke/bin/bash ' My questions are: 1) why does it take so much work to do this? 2) why doesn't the XML output contain the new shell name when I change "nodeValue"? 3) why does the XML output change when I change 'data' -- and is that the right way to change the value? 4) is there any way to dump just the raw characters as text (not in XML)? How? I would prefer an API which is more like for entry in doc["entry"]: if entry["account"][0].text == "dalke": entry["shell"][0].text = "/bin/bash" break and not have to worry about the normalization and explicit use of firstChild. And I haven't seen any documentation which introduces Python programmers to using DOM (like AMK had for SAX parsing) - only docs for people who already know DOM from Java or other fields. So I too am looking for pointers. Andrew dalke at dalkescientific.com From dmallwitz at cox.rr.com Fri Dec 28 22:14:14 2001 From: dmallwitz at cox.rr.com (David Mallwitz) Date: Fri, 28 Dec 2001 22:14:14 -0500 Subject: ETA for Win32all under Python 2.2? References: Message-ID: <3c2d3360$1_4@goliath.newsgroups.com> David, Figuring out how to build Win32all from source sounded like an interesting challenge for the long holiday, so I hit Activestate and found a link to the build instructions: http://starship.python.net/crew/mhammond/win32/BuildingExtensions.html . Unfortunately, I'm stuck with VC++ 5.0 and apparently there are serious problems with the header files unless you have VC++ 6.0. Maybe there's a way to compile correctly from GCC under Cygwin - doubtful, but I'll give it a shot. Anyway, all the info you were looking for is off the link above. Best of luck. Dave "David Brady" wrote in message news:mailman.1009584512.27950.python-list at python.org... > > -----Original Message----- > > From: Martin von Loewis > > > > David Brady > > writes: > > > > > P.S. There's a longstanding rule in my family: > > you're > > > not allowed to complain about anything you could > > fix > > > yourself. > > > Did you even try to build the package from source??? > > Did you see the part where I said "anything you could > fix yourself"? You have apparently overlooked my vast > capacity for ignorance. It's vast. It's vaster > than... well, it's really vast, okay? Vast. > > I would *LOVE* to know how to build the package, but I > haven't got a clue where to even begin. I've got a > Windows box, Visual C++ 6.0 and an internet > connection. Where do I go from here? > > Where do I get the package to build? > > How do I build the package? > > If your reply has anything to do with CVS, how the > heck do I get at it from Win32? (Lots of people have > told me they've heard of other people doing this, but > I'm starting to think it's an urban legend.) > > > (if it doesn't, please submit a bug report). > > *sigh* Vast, man, vast. How do I submit a bug > report? > > Thank you kindly for your patience, > > -dB > P.S. Please note, I may be ignorant, but I'm not > stupid. If there is a good place that explains how to > get and build Python and its packages, I'll happily > wade through the documentation. It's *finding* the > documentation that's killing me. > > ===== > David Brady > daves_spam_dodging_account at yahoo.com > I'm feeling very surreal today... or *AM* I? > > __________________________________________________ > Do You Yahoo!? > Send your FREE holiday greetings online! > http://greetings.yahoo.com > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- From gh_pythonlist at gmx.de Fri Dec 28 09:27:23 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Fri, 28 Dec 2001 15:27:23 +0100 Subject: SSL Sockets in Windows In-Reply-To: References: Message-ID: <20011228142720.GA1241@lilith.hqd-internal> Le 28/12/01 ? 07:18, Syver Enstad ?crivit: > > Hi Al, I'm not exactly an expert on SSL :-). I know it's what goes on > behind the scenes when my browser uses an https url and communication > is encrypted and whatnot. > > Do you have (or can you refer me to) a quick > example to check that SSL is indeed working on Python? You can check pretty easily if your Python is compiled with SSL support: 'ssl' in dir(socket) If so, you should be able to fetch a HTML page with the urllib module: print urllib.urlopen("https://www.sf.net/").read() If you have a packet sniffer running while fetching the page, you should see only garbage instead of cleartext HTTP/HTML. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From jkraska at san.rr.com Fri Dec 28 13:16:44 2001 From: jkraska at san.rr.com (Courageous) Date: Fri, 28 Dec 2001 18:16:44 GMT Subject: [Q] Deepcopy with Python 2.2 ? References: <440c5c6a.0112280847.55c92de7@posting.google.com> Message-ID: >Any help would be appreciated! Use the source, Luke. C// From ws at mystrobl.de Sun Dec 30 17:03:40 2001 From: ws at mystrobl.de (Wolfgang Strobl) Date: Sun, 30 Dec 2001 23:03:40 +0100 Subject: Manipulating Win32 attributes; newbie question. References: Message-ID: On Sun, 30 Dec 2001 15:10:31 -0500, Peter wrote : >My problem is that I need to manipulate some Win32 specific file >attributes. In particular, I need to temporarly turn off the read-only >attribute on a directory. In C I could use the Win32 API functions >GetFileAttributes() and SetFileAttributes() to do this. I'm not sure how >to get the job done with Python. I looked around in both the generic and >Pythonwin documentation but I didn't see anything that addressed this >issue. http://groups.google.com/groups?selm=0kln0u0k2ivc3ehegq5m9lern9e9uut78r%404ax.com http://www.google.com/search?q=pythonwin+getfileattributes http://www.faqts.com/knowledge_base/view.phtml/aid/4706/fid/244 http://groups.google.com/groups?q=comp.lang.python+SetFileAttributes -- Thank you for observing all safety precautions From senux at senux.com Tue Dec 11 21:16:44 2001 From: senux at senux.com (Brian Lee) Date: Wed, 12 Dec 2001 11:16:44 +0900 Subject: XXX Message-ID: <20011212111644.A5144@jupiter.senux.com> Hi I'm newbie at Python programming. Sometimes I read ``XXX'' character as comments in Python source code file. Does that mean something special? -- Brian Lee - http://www.senux.com/ From phr-n2001d at nightsong.com Fri Dec 21 11:46:41 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 21 Dec 2001 08:46:41 -0800 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> <7xlmfxvbx7.fsf@ruckus.brouhaha.com> <3dbsgt7f0e.fsf@ute.mems-exchange.org> Message-ID: <7xheqkr05q.fsf@ruckus.brouhaha.com> "Fredrik Lundh" writes: > > Not bugs per se unless perfect backward compatibility was > > an overriding concern. > > it isn't. It's a bug if something is gratuitously, unnecessarily incompatible, like "rand" disappearing. What was the reason for that? From jkraska at san.rr.com Mon Dec 3 12:06:47 2001 From: jkraska at san.rr.com (Courageous) Date: Mon, 03 Dec 2001 17:06:47 GMT Subject: ANN: Pyro 2.2 is available References: Message-ID: >>What is Pyro? Pyro is an acronym for PYthon Remote Objects. >and it works :) I used Pyro a while back. I thought it was quite convenient and very easy to use. Furthermore, the developers seemed responsive. C// From flynt at gmx.ch Wed Dec 19 11:22:21 2001 From: flynt at gmx.ch (flynt) Date: Wed, 19 Dec 2001 17:22:21 +0100 Subject: [zope] looking for product for managing literature References: <3c20b5a4@netnews.web.de> Message-ID: <3C20BEBD.FEEDDD3C@gmx.ch> rainer knappe wrote: > > I am looking for a zope-product which helps me managing all kinds of literature. > I?m sure there MUST be one availanble on the net - but I can?t find. > Can anyone help? > > Thanks in advance, Rainer > -- Hello Rainer Reading your posting there is one product which comes into my mind: DocumentLibrary. Maybe, it's not quite what you are looking for, maybe it's a start. http://www.zope.org/Members/Kaivo/DocumentLibrary/ScreenShots http://www.zope.org/Members/Kaivo/DocumentLibrary/ReadMe http://www.zope.org/Members/Kaivo/DocumentLibrary Maybe you would like to ask your question also on the Zope Mailing List ? http://lists.zope.org/mailman/listinfo/zope Regards --- Flynt From rscrawford at mossroot.com Thu Dec 27 13:48:07 2001 From: rscrawford at mossroot.com (Richard Crawford) Date: 27 Dec 2001 10:48:07 -0800 Subject: Replacing Python 2.1 with 2.2 in Cygwin Message-ID: I have Cygwin running on my Windows 2000 computer. I have Python 2.1 installed, and would like to replace it with Python 2.2. I had assumed (wrongly, I guess) that when I installed 2.2 it would automatically overwrite 2.1, but that wasn't the case. How do I accomplish this, anyway? From MAILBOX-SA at nameconnector.com Mon Dec 3 02:19:46 2001 From: MAILBOX-SA at nameconnector.com (System Attendant) Date: Mon, 3 Dec 2001 02:19:46 -0500 Subject: ScanMail Message: To Recipient virus found and action taken. Message-ID: ScanMail for Microsoft Exchange has detected virus-infected attachment(s). Sender = Baunehoej Efterskole Recipient(s) = python-list at python.org Subject = Scanning Time = 12/03/2001 02:19:46 Action on virus found: The attachment docs.DOC.pif matched file blocking settings. ScanMail has Moved it. The attachment was moved to C:\Program Files\Trend\Smex\Alert\docs.DOC3c0b27924.pif_. Warning to recipient. ScanMail has detected a virus. From kragen at pobox.com Sat Dec 1 06:45:33 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 01 Dec 2001 06:45:33 -0500 Subject: A modest indentation proposal References: Message-ID: <83y9knrwo2.fsf@panacea.canonical.org> writes: > By their reasoning we should not use computers at all since it is possible > for them to lose power. We should not go to the store because it is > possible to get into an accident on the way. We should not breathe because > it is possible that the air is contaminated. These are all possible but > improbable events. Be aware that he works for NASA. Most NASA missions (except for expensive publicity stunts) do not, in fact, have anyone breathing on them, because it is possible the air is contaminated. Or missing. And many NASA missions use computers that are decades out of date because they are more radiation-tolerant and therefore less likely to fail. NASA's incentive structure also includes disproportionate punishments for doing the wrong thing. > In this specific case there is a nearly infinite list of more > probable sources of problems; your friends are concerned with the > wrong end of the list. :) I'm interested to hear what you find to be common causes of problems when you're programming in Python. From ajs at ix.netcom.com Mon Dec 3 07:50:16 2001 From: ajs at ix.netcom.com (Arthur Siegel) Date: Mon, 3 Dec 2001 07:50:16 -0500 Subject: Copy operator (was list.remove for Noivces) Message-ID: <001101c17bf9$100f5d00$a9e1fea9@carol> Andreas writes - >Actually, if you like it your way, you can add this to lines to your site.py: >import copy,__builtin__ >__builtin__.copy=copy.copy >Afterwards your python will have a copy function without needing import copy. Very cool. who knew. Art From joonas at olen.to Tue Dec 4 07:27:14 2001 From: joonas at olen.to (Joonas Paalasmaa) Date: Tue, 04 Dec 2001 12:27:14 GMT Subject: Using *just* the IDLE editor References: <3C0C4FE1.5B218CE0@st-annes.oxford.ac.uk> Message-ID: <3C0CC18B.6060103@olen.to> Michael Williams wrote: > Hi, > > I'd like to set up (or strip out components or rewrite, but hopefully > it won't be that complex) IDLE so that when I start it up with > > $ idle > > I just get the IDLE editor and not the interactive shell. (I need to > avoid starting the shell for uninteresting reasons). The -e option > allows the opening of the editor window, but doesn't prevent opening > of the interactive shell. I'm afraid I don't have enough experience of > Python (esp Tk) to go through the code and work out what's being done > by idle.py so I would be very grateful if someone could point me in > the direction of a command line argument to prevent the shell > appearing or module I could strip out of the IDLE directory to allow > me to just use the editor. > Use idlefork. http://idlefork.sourceforge.net/ From gat at jpl.nasa.gov Tue Dec 4 14:52:27 2001 From: gat at jpl.nasa.gov (Erann Gat) Date: Tue, 04 Dec 2001 11:52:27 -0800 Subject: A modest indentation proposal References: <3C0773C2.A12D0BAC@pacific.net.hk> Message-ID: In article , clgonsal at kami.com wrote: > I think this is the problem Erann is getting at: Python doesn't have any > (redundant) notation after a block closing that indicates that a block > was closed. It does however have redundant information before a block > opening (the colon). Because of this (the lack of redundant info at the > end of a scope), editors cannot always determine how to auto-indent > pasted chunks of code, because there are multiple "right answers" for > certain lines. That's exactly right. > I don't actually like Erann's semicolon suggestion though. The semicolon was a straw-man. I don't much care what the convention is as long as it exists and is standardized. I would much prefer not to use the # end ... convention because IMO it's too verbose, though making the end-block marker look like a comment may be the right answer. Maybe "#;" or "#." or "#:" or (God forbid!) "#}". E. From bkd69 at yahoo.com Tue Dec 18 08:27:44 2001 From: bkd69 at yahoo.com (bkd69) Date: Tue, 18 Dec 2001 13:27:44 -0000 Subject: webmin modules in python? In-Reply-To: Message-ID: <9vng8g+mhgh@eGroups.com> --- In python-list at y..., Benjamin Schollnick wrote: > > I webmin docs really lean towards perl, hs anyone written one in python? > > > > -bruce. > > Bruce.... Sorry, but this doesn't seem to make too much sense... > Probably because I've never heard of Webmin, nor do I program in perl. > > Could you elaborate a little bit more, and then maybe we can help... > > - Benjamin Another Bruce here...Webmin is a delightful little web based system admin tool. Think of it as something like Zope, except geared for system administration. It's primarily written in Perl, it contains its own builtin webserver, and it uses various modules (just like Zope products), most all written in Perl, some in Java, to control various parts of the server, such as DNS, mail services, Apache, a Java based file manager applet, etc. Visit http://www.webmin.com for some screenshots and more details. As far as Bruce1's query goes, I haven't really looked for Python stuff for it, and I think it's done almost entirely in Perl. But if the module development documentation is complete enough, and they've developed Webmin properly, it might only be as difficult as adding it like a CGI script. I wouldn't make any bets on that, however. Maybe when Parrot's ready for release it'll be loads simpler... An alternate tack may be to try loading Webmin's Perl modules into Zope as external methods, and using Zope as your Webmin engine... Yet Another Bruce From db3l at fitlinxx.com Wed Dec 19 20:06:12 2001 From: db3l at fitlinxx.com (David Bolen) Date: 19 Dec 2001 20:06:12 -0500 Subject: sys.path ordering question References: <3C207C52.8080700@skippinet.com.au> Message-ID: Mark Hammond writes: > Use a .pth file like these packages do. This is really what the Win32 > extensions should do too. But I thought one problem with .pth files is that they wouldn't work if Python was invoked from a COM object (and couldn't locate the executable location, and thus the .pth files), which would certainly affect the Win32 extensions. Or since that's been cleaned up in Python 2.2 (I think), is this a 2.2+ suggestion? -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l at fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/ From sholden at holdenweb.com Mon Dec 3 17:00:08 2001 From: sholden at holdenweb.com (Steve Holden) Date: Mon, 3 Dec 2001 17:00:08 -0500 Subject: Displaying multiple results in a list References: <741f261e.0112031331.75c2e1c6@posting.google.com> Message-ID: "Russell Briggs" wrote in message news:741f261e.0112031331.75c2e1c6 at posting.google.com... > Wanted to know if there was a way to specify ranges in a list such as: > > newlist = ["1", "2", "3", "4", "5", "6"] > > print newlist[1..3] #ie: print newlist[1], newlist[2], newlist[3] > > Can something like this be done? > Yes, but be careful! The first element of a list is element 0, NOT element 1. What you need is the so-called "slicing" notation, which creates a new list from a set of consecutive elements. For example: PythonWin 2.0 (#8, Mar 7 2001, 16:04:37) [MSC 32 bit (Intel)] on win32. >>> newlist = ["1", "2", "3", "4", "5", "6"] >>> newlist[0:2] ['1', '2'] >>> newlist[:2] ['1', '2'] >>> newlist[3:] ['4', '5', '6'] >>> newlist[-3:-1] ['4', '5'] >>> newlist[1:-1] ['2', '3', '4', '5'] >>> Negative indices can be useful if you want elements relative to the end of hte list rather than to the beginning. Play about a bit in the interactive interpreter and you'll soon find this notation feels quite natural. regards Steve -- http://www.holdenweb.com/ From chrishbarker at attbi.com Mon Dec 3 18:39:57 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Mon, 03 Dec 2001 15:39:57 -0800 Subject: Displaying multiple results in a list References: <741f261e.0112031331.75c2e1c6@posting.google.com> Message-ID: <3C0C0D4D.7405E97D@attbi.com> Russell Briggs wrote: > Wanted to know if there was a way to specify ranges in a list such as: > > newlist = ["1", "2", "3", "4", "5", "6"] > > print newlist[1..3] #ie: print newlist[1], newlist[2], newlist[3] This, and many other nifty things are possible with Python. Please read: http://www.python.org/doc/current/tut/tut.html and http://www.python.org/doc/Newbies.html you will find the answer to this and MANY other questions! -Chris -- Christopher Barker, Ph.D. ChrisHBarker at home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From sholden at holdenweb.com Mon Dec 17 17:59:37 2001 From: sholden at holdenweb.com (Steve Holden) Date: Mon, 17 Dec 2001 17:59:37 -0500 Subject: do not know what is wrong python under win2k References: <3C1E752E.8864E2E9@htp-tel.de> Message-ID: <5KuT7.15581$PA.12409@atlpnn01.usenetserver.com> "Tom Karas" wrote in ... > Hello folks, > > i went to the libary to get a copy of "Learning Python" where it > is written that i should write: > > import sys > print sys.argv > > into a file called "spam.py" and after that i should do the following: > > >>> python spam.py -i eggs -o bacon > > but i got the following error > > Traceback ( File "", line 1 > python spam.py -i eggs -o bacon > ^ > SyntaxError: invalid syntax > > although i saved the file "spam.py" into the same directory where the > python.exe is located. > > What did i made wrong - i am conviced i did exactly like it was written > in the book. > The line you entered into the Python interpreter should by typed to your operating system's command interpreter (in Windows, in a command window at the ">" prompt). regards Steve -- http://www.holdenweb.com/ From martin at v.loewis.de Thu Dec 13 01:13:32 2001 From: martin at v.loewis.de (Martin v. Loewis) Date: Thu, 13 Dec 2001 07:13:32 +0100 Subject: [XML-SIG] Pyana 0.2.0 released In-Reply-To: <003c01c182bf$7d7ad190$445d4540@Dell2> (brian@sweetapp.com) References: <003c01c182bf$7d7ad190$445d4540@Dell2> Message-ID: <200112130613.fBD6DW801317@mira.informatik.hu-berlin.de> > Pyana is an interface between the Apache Project's Xalan XSLT engine and > Python. Hi Brian, How does that compare to PIRXX? Regards, Martin From shiver at yubc.net Mon Dec 24 23:29:10 2001 From: shiver at yubc.net (I.J.) Date: Tue, 25 Dec 2001 05:29:10 +0100 Subject: custom split function Message-ID: Hi Is there a way to spit file content into list of individual bytes/characters. I know it could be done with substring manipulation but I hope there is more direct way. Bye From rdsteph at earthlink.net Sun Dec 30 10:26:49 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sun, 30 Dec 2001 15:26:49 GMT Subject: REPOST: Parrot aka Perl 6 info Message-ID: <5$--$$_----__$_$-$@news.noc.cabal.int> This is a follow on to thread from here that Dan Sugalski (perl implementer) posted over on comp.lang.ruby, that didn't show up here. I copy it here fyi only, just to show the firm intent of the Perl implementers to create a runtime that will run both ruby and Python as well as Perl. FWIW::: The folks over at comp.lang.ruby ae quite interested in this. I suppose if anyone has any follow up questions, they could be directed to Dan at his email address listed at the end of his post. I wonder how valuable such a "new runtime environment" for Python might be? I wonder if the Python core team is well aware of the Perl 6 efforts? At 07:57 PM 12/29/2001 -0800, ptkwt at aracnet.com wrote: >In article <5.1.0.14.2.20011229222259.0206fe80 at pop.sidhe.org>, >Dan Sugalski wrote: > >At 09:57 AM 12/30/2001 +0900, Ron Stephens wrote: > >>However, for what its worth, the PERL 6 implements, whom I met and > conversed > >>with at the MIT Lightweight Languages conference, are definitely > truing, as a > >>goal, to create a PERL 6 runtime environment that can easily and credibly, > >>someday later on, run Perl, Ruby, and Python. I suppose that could be > >>additional > >>runtime environments for these languages, just like Jython is an additional > >>runtime environment for Python. Maybe that could work, and give some of the > >>advantages of "bringing the tow (or , in this case, three) streams if > >>development back togethers into one mighty river. > >> > >>I am a doubter about this, btu who knows? > > > >Oh, don't doubt. We've pulled it off already, to an extent, with the perl 5 > >engine, and that's a mess as these things go. > > > >Technically, an engine capable of running all three languages (and more) is > >pretty trivial as these things go. Inter-language calling conventions are > >the toughest and that's not really tough at all. The politics involved are > >by far the biggest hurdle, and they exceed the technical difficulties by > >many orders of magnitude. > > > >Having said that, Parrot will be *capable* of running perl, python, and > >ruby. (Whether there's a full-blown language parser for python and ruby is > >up in the air--I'm all for the ruby parser in ruby, as that'd make my life > >really easy. > >So what do we have to do? Parse Ruby and spit out Parrot bytecode, right? For now, yep. Once we get things situated right, you won't even need to spit out bytecode. Spitting out a full AST would be sufficient, which then gets fed into the compiler module. >I think there is a project or two out there to create a Ruby parser in >Ruby. JRuby could always be modified, I suppose, to become PRuby - that >might be another option. Sure, and if you have a ruby parser in ruby, we can run it through the ruby engine as it stands now and spit out ruby bytecode. We run that through the ruby bytecode->parrot bytecode converter (which is already partially written) and get parrot bytecode which we then freeze to disk and poof! we have a working parser. > >We'll have full bytecode translators, but those are trivial > >compared to parsing the languages) Even if it's not fully used, it'll make > >Parrot a better engine. > > > >And anyway, at this point I can wave the "Hey, look, we have a JIT!" flag > >to entice people into writing a ruby parser for Parrot... :) > >I think that there are a lot of Rubyists out there who want to see a Ruby >parser for Parrot and some who would even be willing to work on it. Hey, >wouldn't it be cool if we could get there before the Pythonistas? Yep, darned cool. Heck, we don't have a full perl parser yet--you could even beat us! (Which, personally, I think would be amusing) Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai dan at sidhe.org have teddy bears and even teddy bears get drunk ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2F3307.B47C9E26 at earthlink.net> Control: cancel <3C2F3307.B47C9E26 at earthlink.net> Date: Mon, 31 Dec 2001 03:17:50 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774202 27193 211.57.49.2 (31 Dec 2001 04:50:02 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:50:02 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From cdewin at dingoblue.net.au Tue Dec 11 16:25:02 2001 From: cdewin at dingoblue.net.au (Another rookie) Date: 11 Dec 2001 21:25:02 GMT Subject: Some stupid questions References: <9v5ea4$d1ek8$1@ID-119882.news.dfncis.de> <9v5g8b09pq@enews4.newsguy.com> Message-ID: <9v5tjd$d81ug$1@ID-119882.news.dfncis.de> "Alex Martelli" wrote in news:9v5g8b09pq at enews4.newsguy.com: > > In both cases, of course, there will be a "hefty" runtime (in a Java > jar, or as Windows DLL's, etc) that your "stand-alone" applications > will have to carry -- just as if they were written in any other > language requiring significant runtime support, such as Visual Basic. > > > Alex > Do u mean that my executable will be slow? From uwe at rocksport.de Tue Dec 4 07:53:43 2001 From: uwe at rocksport.de (Uwe Schmitt) Date: 4 Dec 2001 12:53:43 GMT Subject: Numerical Python Question References: <9uieop$bncra$1@hades.rz.uni-sb.de> Message-ID: <9uih0n$bs948$1@hades.rz.uni-sb.de> Well, i fixed it: I have to use Matrix() in order to construct a Matrix whith appropriate __mult__()-method. Now I encountered another problem: from Numeric import * from Matrix import * from LinearAlgebra import * n=5 A=Matrix(zeros((n,n),Float)) for i in range(n): for j in range(n): A[i,j]=1.0/(i+j+1) x=Matrix(ones((n,1),Float)) b=A*x x = solve_linear_equations(A, b) print "x=", x print print "x'*x=", transpose(x)*x print print "x*x'=", x*transpose(x) print This program should output a vektor, then a scalar and finally a matrix. But it outputs a vektor and two matrices. I think this is a bug. Greetings, Uwe. -- Dr. rer. nat. Uwe Schmitt Uwe.Schmitt at num.uni-sb.de Universitaet des Saarlandes Angewandte Mathematik Building 36.1 Room 4.17 PO-Box 151150 D-66041 Saarbruecken Mobile:0177/6806587 Fax:+49(0)681/302-4435 Office:+49(0)681/302-2468 From mwh at python.net Tue Dec 11 10:02:36 2001 From: mwh at python.net (Michael Hudson) Date: Tue, 11 Dec 2001 15:02:36 GMT Subject: How to use pty.py? References: <3C161911.70607@xs4all_nospam.nl> Message-ID: iwk writes: > I need to pass input to a program at a customers' site which bypasses > stin/out and reads/writes to/from a terminal, just like ssh when it > asks for a password. So I cannot pipe the data to the program. To the > best of my knowledge I should be able to use pty.py to start the > program and provide it with the required input. But how? Does anyone > have some examples? Oh, something like this: />> def su(): |.. import os, time |.. def p(d=0.2): time.sleep(d) |.. pid, fd = os.forkpty() |.. if pid == 0: |.. os.execlp("su","su") |.. else: |.. p() |.. print `os.read(fd, 1000)` |.. p() |.. os.write(fd, "XXXX\r") |.. p(2) |.. print `os.read(fd, 1000)` \__ ->> su() 'Password: ' '\r\nsu: incorrect password\r\n' ->> It all gets a bit messy, because you have to let any write()s the child does finish by sucking stuff out of `fd' before *you* can write any data to it (otherwise the child will be blocked in its call to write() and will never call read()). This means you need to know pretty exactly how the child behaves, and perhaps can begin to understand why expect is called what it is. There are probably wrappers that make it all a bit less painful -- and maybe a touch more portable -- but I've never used them. Cheers, M. -- And then the character-only displays went away (leading to increasingly silly graphical effects and finally to ads on web pages). -- John W. Baxter, comp.lang.python From cfelling at iae.nl Thu Dec 6 20:01:34 2001 From: cfelling at iae.nl (Carel Fellinger) Date: 7 Dec 2001 02:01:34 +0100 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BD39F.D43D4FF7@mega-nerd.com> <3c0be454$1@207.229.64.20> <3C0BE5D5.4386B359@mega-nerd.com> <9umeoa$bmu$1@animus.fel.iae.nl> <6qr8q8fxpg.fsf@abnoba.intevation.de> Message-ID: <9up4de$70k$1@animus.fel.iae.nl> Bernhard Herzog wrote: > Carel Fellinger writes: >> alas, cut&past on an X display will not see those tabs, but only the >> spaces used to represent them at the moment:( > That's got nothing to do with X and everything with how your editor or > your terminal emulator as the case may be handles it. I can copy&paste > between e.g. different Emacs sessions just fine including tab > characters. You're right, it was flaky memory, shalow testing and the terminal emulator. Sorry for trying to end the tab-war with false arguments. -- groetjes, carel From philh at comuno.freeserve.co.uk Tue Dec 4 09:49:30 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Tue, 4 Dec 2001 14:49:30 +0000 Subject: a comment about PEPs References: Message-ID: On Tue, 4 Dec 2001 09:53:49 GMT, Michael Hudson wrote: >> Who decides whether PEPs are approved/rejected? The BDFL? > >More or less. From PEP 1: > > Once the authors have completed a PEP, they must inform the PEP > editor that it is ready for review. PEPs are reviewed by the BDFL > and his chosen consultants, who may accept or reject a PEP or send > it back to the author(s) for revision. > >Basically like any other language decision; Guido might listen to us, >but the D in his name means he doesn't have to. And of course, the fact that Python is open source keeps everyone honest. If Guido pissed off significant numbers of people, they would just fork the language. So he's not about to plan a migration to a Microsoft-platform-only Python# :-) -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From loewis at informatik.hu-berlin.de Sun Dec 23 19:04:04 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 24 Dec 2001 01:04:04 +0100 Subject: How can a module find its own module object? References: Message-ID: Michael Hudson writes: > > Is there any other way for a module to find itself other than searching > > sys.modules for a module whose __dict__ is globals()? > > What's wrong with __file__? That doesn't give you the module object. The module object is not readily accessible from the module itself, as that would create a cyclic reference. Looking for an entry in sys.modules that has the same __file__ might be more straight-forward than comparing __dict__ to globals(), though (there is no guarantee that globals() wouldn't return a fresh dictionary - although all current implementations do return __dict__). Regards, Martin From aahz at panix.com Thu Dec 20 17:00:03 2001 From: aahz at panix.com (Aahz Maruch) Date: 20 Dec 2001 14:00:03 -0800 Subject: Platform-independent GUID creation? References: Message-ID: <9vtn13$aq9$1@panix3.panix.com> In article , Steve Holden wrote: > >Does anyone have a readily-portable equivalent to the pythoncom.CreateGuid() >function? The problem is that the DCE/OSF GUID standard specifies using the MAC address of the network card as part of a GUID. There isn't a portable way to get that, unfortunately. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 11 days and counting From wolfson at uchicago.edu Thu Dec 6 14:23:30 2001 From: wolfson at uchicago.edu (Ben Wolfson) Date: Thu, 06 Dec 2001 13:23:30 -0600 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: On Thu, 06 Dec 2001 11:46:40 -0600, Bjorn Pettersen wrote: > Ps: Isn't it time for someone to call someone a space-nazi/tab-nazi so > this thread can die? Tabs damage code like the Blitzkrieg in Poland, man. You must be a nazi to support them. -- BTR Why does this Wolfson person see fit to clutter up Usenet with such absurd nonsense? -- Bob Cunningham in From jjl at pobox.com Mon Dec 10 14:07:19 2001 From: jjl at pobox.com (John J. Lee) Date: Mon, 10 Dec 2001 19:07:19 +0000 Subject: help with installing pymat on linux RH7.1 In-Reply-To: References: Message-ID: On Sun, 9 Dec 2001, Les Ander wrote: [...] > I did the following: [...] > step2: g++ -shared -o pymatmodule.so pymat.o > -L/usr/local/extern/lib/glnx86 -leng -lmx -lmat -lmi -lut > (matlab libraries are: libeng.so, libmx.so, libmat.so, libmi.so, libut.so) [...] > But in the python interpreter when i try to import pymat > i get : > ImportError: libeng.so: cannot load shared object file: No such file or > directory [...] You probably need to do one of: 1. set LD_LIBRARY_PATH to include /usr/local/extern/lib/glnx86, 2. compile the path into the .so (can't remember how) 3. run ldconfig, after adding /usr/local/extern/lib/glnx86 to its configuration file (/etc/ld.so.conf IIRC). You also need -fPIC in your first step, I think. see, for example: http://www.linuxdoc.org/HOWTO/GCC-HOWTO/ John From emile at fenx.com Sun Dec 30 14:00:08 2001 From: emile at fenx.com (Emile van Sebille) Date: Sun, 30 Dec 2001 11:00:08 -0800 Subject: Origin of ly y'rs signature style Message-ID: I know I've read a good article or post on the origin and adoption of the "xx-xx-xx ly y'rs" signoffs brought to the python group by Tim Peters. After some searching this morning I couldn't relocate that article/post. Does anyone have a link to it? Searchin-for-love-in-all-the-wrong-places ly y'rs, -- Emile van Sebille emile at fenx.com --------- From mertz at gnosis.cx Tue Dec 18 18:36:25 2001 From: mertz at gnosis.cx (Dr. David Mertz) Date: Tue, 18 Dec 2001 18:36:25 -0500 Subject: DOM - some pointers (fwd) Message-ID: <5L9H8kKkXMNS092yn@bellatlantic.net> "Andrew Dalke" wrote: |I would prefer an API which is more like |for entry in doc["entry"]: | if entry["account"][0].text == "dalke": | entry["shell"][0].text = "/bin/bash" | break |and not have to worry about the normalization and explicit |use of firstChild. You might want to look at my [xml_objectify] module. It wraps XML processing in more Pythonic feeling object structures, and is quite transparent to use. OTOH, [xml_objectify] is really about *reading* XML documents into Python objects... it doesn't write back changes particularly seamlessly. From ungrzr2 at ubatxbat.pbz Thu Dec 6 20:18:40 2001 From: ungrzr2 at ubatxbat.pbz ({-- Rot13 - Hateme) Date: 7 Dec 2001 01:18:40 GMT Subject: Is it possible to kill a thread ? References: <9unnfb$6fp$1@wanadoo.fr> <3C0FCD72.A5FA167C@ccvcorp.com> Message-ID: grante at visi.com (Grant Edwards) wrote in news:slrna0vkoe.u69.grante at grante.comtrol.com: > The problem with this is that one often creates a thread so > that it can do some possibly blocking operation without > stopping the rest of the program. If the thread is blocked, it > can't check the event. If the thread isn't going to block, > then why create a thread? [Yes, there are other reasons for > splitting something into a thread, but in many cases I create a > thread specifically because it's goign to block.] > exactly. It seems calling os._exit(1) kills everything under linux and windows include everything. :) Don't know how to kill one thread only. I use it when my threads are doing blocked socket operation. We can not tell a blocked socket that 'I want stop'. So there are situation where kill thread is needed. But I cannot catch the KeyboardInterrupt from my main thread under windows, so have to loop over a raw_input to get exit order. From Bruce at EckelObjects.com Thu Dec 6 22:15:12 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Thu, 06 Dec 2001 19:15:12 -0800 Subject: Lists of attributes In-Reply-To: References: Message-ID: <200112061915120890.02BA0C95@mail.rdc1.sdca.home.com> >__subclasses__ was added very recently (8 weeks, 3 days to be exact) so it >might not be in your Python build (when you start Python, it reports its >build date so you can check). Aha! Now, is it possible to install two different versions of Python on my Win98 machine at the same time? I ask because I need to run the ActiveState build for Python-COM stuff... Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From claird at starbase.neosoft.com Thu Dec 27 20:53:22 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 27 Dec 2001 19:53:22 -0600 Subject: REPOST: Re: State of the SysAd art (was: vi or emacs for editing Python on Linux?) References: <2E48C714A6E1FBA1.19DE5ADEBF7F088A.DF90F2C1E6CC9E7C@lp.airnews.net> Message-ID: <1$--$$_----_--$%_$@news.noc.cabal.int> In article , Emile van Sebille wrote: . . . >> Then how are you getting onto the machine? I hope not plain old >telnet. >> Furthermore there are other options of gettimg things onto that machine >than >> scp. That was, of course, an example to point out that one doesn't need >to >> edit on that machine to get work done. I have been on a machine where ssh >was >> available but scp out of it was not. >> >> cat > sift.pl >> >> Any other questions or can we finally put the bullshit argument to >rest? >> > >I still support clients running xenix, sco, hpux and aix on dial-in modem >lines running getty. Sometimes I have to go on site because they don't have >dial-in capabilities. The argument may be bullshit for recent installs, and >yes I'd certainly prefer they all upgraded immediately. OTOH, vi works just >fine for all those cases where one needs to edit on the machine to get work >done. . . . What--no Ultrix? I entirely agree that in-place editing is not strictly necessary. I was arguing for ssh, CVS, and IP reacha- bility while some readers were ... well, younger than they are now. At the same time, I ask for tolerance of our brethren who cope with more conservative computing regimes. vi happens to fit my personal style better than emacs, but I'm very, very wary of generalizing that experience at all. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: claird at starbase.neosoft.com (Cameron Laird) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:20:32 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775448 27193 211.57.49.2 (31 Dec 2001 05:10:48 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:10:48 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From linux at nkeller.de Sun Dec 23 13:22:25 2001 From: linux at nkeller.de (Nicolas Keller) Date: Sun, 23 Dec 2001 19:22:25 +0100 Subject: SQLBase - Support? Message-ID: Hi! I'm looking for a possibility to connect to a Gupta SQLBase Server with Python. As the application will run under Linux (and Zope for the frontend) I guess that it's not possible to use ODBC? Any hints? Thanks and merry xmas :) Nicolas Keller From mcfletch at rogers.com Sat Dec 8 18:04:55 2001 From: mcfletch at rogers.com (Mike C. Fletcher) Date: Sat, 08 Dec 2001 18:04:55 -0500 Subject: Parsing vrml into a tree References: <3C12838E.282BB653@olen.to> Message-ID: <3C129C97.9070702@rogers.com> Hmm, there really isn't a built-in mechanism for getting "a plain tree" of the type you describe. What you get from mcf.vrml is a directed graph of Node objects (that is, nodes can exist in multiple places within the tree): >>> from mcf.vrml import loader >>> sg = loader.load( r'Z:\worlds\temple\temple.wrl' ) Gives you the graph, which you can walk through fairly easily. The root node handed back is a sceneGraph Node (or None if the load failed), it's most interesting attribute is "children", which is the collection of root nodes in the graph. >>> sg.children [, , , , , , ] For each node described there, you can walk through dealing with whatever attributes you need: >>> sg.children[-1].children[0] >>> sg.children[-1].children[0].loop = 1 If you really wanted to, you could pull out the attributes from the node objects: >>> sg.children[-1].children[0].attributeDictionary {'loop': 1, 'cycleInterval': 3.3330000000000002} And could then figure out how you want the other information (node type, DEF name, etceteras) stored in your simple tree. Hope that helps, Mike Joonas Paalasmaa wrote: > How can I parse vrml into a plain > tree (dictionary or list) with mcf.vrml? > -- _______________________________________ Mike C. Fletcher http://members.rogers.com/mcfletch/ From DaveP at dpawsonNOSPam.freeserve.co.uk Sun Dec 30 02:47:17 2001 From: DaveP at dpawsonNOSPam.freeserve.co.uk (Dave Pawson) Date: 30 Dec 2001 07:47:17 GMT Subject: Reg-Ex and lambda optimization References: Message-ID: "MikeCrowe" wrote in news:mailman.1009670854.26405.python-list at python.org: > Hi folks, > > New to Python, and had this question. I couldn't figure out how to > read a directory and filter the results by what I wanted. I basically > wanted to read: > dir\db*.* Daft name, great module though, look for glob() in your documentation. Unsure how I found it with a name like that, but boy does it do the business! Keep the re package for file contents, and scour the documentation. HTH DaveP From dyoo at hkn.eecs.berkeley.edu Mon Dec 3 17:58:21 2001 From: dyoo at hkn.eecs.berkeley.edu (Daniel Yoo) Date: Mon, 3 Dec 2001 22:58:21 +0000 (UTC) Subject: A Python bytecode assember? References: <9uf0kd$1r4r$1@agate.berkeley.edu> Message-ID: <9uh02d$2lho$1@agate.berkeley.edu> Michael Hudson wrote: : : Jeremy Hylton's compiler package may be a better bet. Thank you! pycodegen.py is very cool; I'm glad that the compiler package will be a part of 2.2! I'm thinking of writing a Scheme -> Python bytecode compiler that preserves tail recursion. I have no idea how to do any of this stuff yet, so this will be a good winter project for me. *grin* From bbollenbach at home.com Sun Dec 9 15:49:56 2001 From: bbollenbach at home.com (Brad Bollenbach) Date: Sun, 09 Dec 2001 20:49:56 GMT Subject: join vs instances References: Message-ID: In article , Robin Becker wrote: > In article , Brad > Bollenbach writes > .... >>Hope that helps, >> >>Brad > it doesn't. When I have to use 'b'.data instead of 'b' it might. I'd be curious to know when this (.data vs. builtin) matters. You'll either be writing code in the scope in which the UserString was instianted (which means, you'll know when to use .data and when not to), or perhaps, writing a function which requires a string arg, in which case you still don't have to care. You just call that func with foo.data if the string arg is a UserString. I might be missing something, but I can't see a situation where you'll find a problem. Of course it's expected that you can't get away with simply referring to the instance directly and expecting a string to pop out, but can you give an example of a gotcha with a UserString vs. builtin (that is to say, a scenario where you the difference between the two will make it impossible for you to write code that won't break)? Brad From ws at mystrobl.de Fri Dec 7 15:14:44 2001 From: ws at mystrobl.de (Wolfgang Strobl) Date: Fri, 07 Dec 2001 21:14:44 +0100 Subject: string conversion and formatters References: Message-ID: On Fri, 07 Dec 2001 19:43:16 GMT, "Spiffy" wrote : >Hello! I am total newbie to programming and Python. I am teaching myself >with online tutes and documentaion. First, does anyone know where the list >of output formatters ( such as %d, %s, etc.) is in the reference material? 2.1.5.2 String Formatting Operations -- Thank you for observing all safety precautions From use-net at schabi.de Wed Dec 5 09:50:14 2001 From: use-net at schabi.de (Markus Schaber) Date: Wed, 5 Dec 2001 15:50:14 +0100 Subject: Jython thread safety References: <3C0E019E.BF5179C7@lucent.com> <3C0E1C11.1080300@gmx.net> <3C0E2E29.F3282764@accessforall.nl> Message-ID: <20011205155014.789e1d8f.use-net@schabi.de> Hi, On Wed, 05 Dec 2001 15:24:44 +0100 Ype Kingma wrote: > - jython has no central interpreter lock like cpython, it uses java's > synchronisation mechanisms instead. If you have more than one > processor, jython will allow you to use all of them. As long as the Java virtual machine is capable of using them. (Some JVMs use so-called "green threads", that means they emulate threads. You should make shure that your VM uses "native threads". I remember older blackdown jdk releases to use green threads only.) > - when you need faster synchronisation, you can use Doug Lea's > util.concurrent package for java as it is: > http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html > It's interface is remarkably similar to the python standard > synchronisation classes, and it has a lot more to offer. Goot hint, I'll have a look at this. markus -- "GPL software is not free - the cost is cooperation" From starx at pacbell.net Tue Dec 4 03:37:33 2001 From: starx at pacbell.net (Philip Swartzleonard) Date: 4 Dec 2001 08:37:33 GMT Subject: Tuples -> Function Params? Message-ID: Just a quick question, right now i'm doing this: self.color = afloat,bfloat,cfloat . . (change functions) . a,b,c = self.color glColor3f(a,b,c) [actual function dosen't mater except that it isn't something i can just change] Ok, the question is, is there a way to do this where i don't unpack the tuple and pass sepearte arugments? This would be most convienent. Function(tuple) doesn't work... and i couldn't seem to find any other info in the docs... -- Philip Sw "Starweaver" [rasx] :: From shriek at gmx.co.uk Tue Dec 18 19:24:17 2001 From: shriek at gmx.co.uk (Stephen) Date: 18 Dec 2001 16:24:17 -0800 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <1008303437.718558@cswreg.cos.agilent.com> <9vbvi5$cm0$1@peabody.colorado.edu> <7xhequjsgl.fsf@ruckus.brouhaha.com> <9vc581$g0h$1@peabody.colorado.edu> Message-ID: <97ae44ee.0112181624.2293a692@posting.google.com> Fernando P?rez wrote in message news:<9vc581$g0h$1 at peabody.colorado.edu>... > Paul Rubin wrote: > > > Fernando P?rez writes: > >> For some bizarre reason, redhat 7.2 includes two versions of pyhton with > >> 1.5 being the default. > > > > The reason may be that some of the red hat configuration scripts were > > written under python 1.5, and 2.1 broke backwards compatibility. > > In particular the "rand" module was renamed "random" and maybe changed. > > good point. just yesterday I found out about that b/c I screwed up the > firewalling rules when installing a 7.2 box. Lo and behold, when I went > digging looking for the installer package (named anaconda), what I found was > a bunch of python scripts! The entire RedHat installer is a python system > (hence the name!). This was great, in a few minutes I was able to dig out > what the name of the underlying firewall configurator (lokkit) was and fixed > my mistake. I'm sat on a RedHat 7.2 box too and am very hesitant to upgrade to Python 2.x for fear of breaking a lot of the RedHat-distributed scripts, including the firewall. The alternative seems to be to install Python 2.1.1 without symlinking it to /usr/bin/python ie. Leave Python 1.5.2 the default Python and then use the hash-bang to explicitly call python 2.x (#!/usr/bin/python2) in my scripts. Is this right ? On this note, I tried installing expat-1.1-4tummy.src.rpm and python2-2.1.1-3.src.rpm (following the instructions to 'rebuild' it, as per http://www.python.org/2.1.1/rpms.html) but where does the rebuilt python get installed ? Afterwards, it claims the RPM is not installed $ rpm -q python*rpm package python2-2.1.1-3.src.rpm is not installed Thanks for any help, Stephen From usenet at thinkspot.net Sat Dec 29 16:57:00 2001 From: usenet at thinkspot.net (Sheila King) Date: Sat, 29 Dec 2001 13:57:00 -0800 Subject: Was that to inpolite? Re: Call for a small program References: <3C2BAEF3.CC34B8DD@htp-tel.de> <3C2E0D55.9EC9B67F@htp-tel.de> Message-ID: On Sat, 29 Dec 2001 19:37:09 +0100, Tom Karas wrote in comp.lang.python in article <3C2E0D55.9EC9B67F at htp-tel.de>: > > A few quick questions: > > Was my "Call" to inpolite? > > Was it the wrong place / newsgroup to ask? I cannot find the post you are referring to. It did not appear on any of the three news servers from which I retrieve this newsgroup. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org/ From usenet at NOSPAM-irmen.cjb.net Sun Dec 30 20:18:25 2001 From: usenet at NOSPAM-irmen.cjb.net (Irmen de Jong) Date: Mon, 31 Dec 2001 02:18:25 +0100 Subject: REPOST: Re: pyro 2.3 remote.py windows fix. References: Message-ID: <5$--$$_----___%_$$@news.noc.cabal.int> Thanks, I'll have this fixed in the next version (2.4). Irmen de Jong ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Irmen de Jong" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:23:58 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009773971 27193 211.57.49.2 (31 Dec 2001 04:46:11 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:46:11 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From erik at naggum.net Sun Dec 23 02:25:38 2001 From: erik at naggum.net (Erik Naggum) Date: Sun, 23 Dec 2001 07:25:38 GMT Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic References: <3218013921984060@naggum.net> Message-ID: <3218081134224960@naggum.net> * markj+0111 at cloaked.freeserve.co.uk (MJ Ray) | Oh joy. I thought I saw the last Naggum post when I unsubbed from | comp.lang.lisp. It was one of your own (David Rush) who called on me, blaming me for his serious coping problems when that New Scheme fellow posted some heretical comments that could threaten to undo the universe as he knew it. I am sure that the Scheme religion needs a Devil figure and that you guys are so irrational as to blame the Devil when you need to explain some of the otherwise _inexplicable_ evil that happens to you (like reality invading your nice little theories), but if I wanted to undo the Scheme community, nobody would know it had even existed, OK? Such are my evil powers. I _let_ you insufferable little freaks continue to have your community, because you do less harm believing in and being preoccupied with Scheme than if you were roaming free. Or perhaps this Devil imagery that you guys seem to need is a bit stale and idiotic? | Are you still sore that Scheme is installed on far more computers than | oxymoronically-named "Common" Lisp? No, never was. On the contrary, I am quite happy that all those who install Common Lisp systems actually use them productively. Have you thought about how _necessary_ it is for you Scheme freaks to be hostile to those who do not agree with you? E.g., where _did_ the stupid need to attack Common Lisp now come from? So immature and vindictive! On the other hand, if you suffer form Perl envy, I am sure that it is natural to think that other language communities must suffer from similar problems, but so far, we have had a large number of Scheme freaks invade Common Lisp fora to tell us how superior Scheme is, while no Common Lisp programmers invade Scheme camps to tell you how good Common Lisp is. Why is this? Well, we know that Common Lisp is better than Scheme, and so do you, so there is no need to repeat the obvious, but any clueless Scheme freak who feels the urge to rebel against authority and common sense must try to provoke those better than him. That is why you had to include that stupid attack on Common Lisp, too. So immature. So Scheme. Incidentally, are you still raping preschool children? Scheme is the favorite language of pedophiles, who love the pure and small, you know. | The Scheme community is a warm and welcoming place compared to the Common | Lisp one, I think. Of course you think so. But let us ask this New Scheme fellow, or any of the other people that Scheme freaks routinely attack on no basis at all. Why did your David Rush need to attack me this time, for instance? Why did you have to attack Common Lisp? I have not done anything to you insane fucks, but you nutballs need no provocation to attack me. Why? Do you think normal, sane people behave the way you do? Anyone can see that a community of people who condone and support attacks on others behind their back is neither warm nor welcome, no matter how much you wish to be and lie that you are. Most religions have been warm and welcome to those likely to be duped by their gospel, and extremely hostile to those who would be a threat to them. Which one of them would say that some _other_ religion is more warm and welcoming than they are? So this vacuous phrase is sheer marketing. When you need to engage in such marketing, you must know that you have a shitty product that nobody would buy if they knew the truth about it. What a scheme! | The the open, academic-yet-practical, friendly spirit of Lisp lives on in | comp.lang.scheme and numerous general lisp mailing lists. Of course you believe this. You have chased away every free-thinking person who has ever discarded Scheme and you display _such_ hatred of non-believers that you are like the biological end result of in-breeding. The people who come to you in the first place are already converts and are unlikely to question the gospel. Those who do not like Scheme do not exactly have to deal with you -- which is also why you Scheme freaks have to come to Common Lisp groups and fora and make a stupid scene. | We just don't like anonymous posters saying that we got it all wrong. Are you sure that is what he said? Are you sure that those who do not believe in the Scheme religion would react the same way? Have you found a rational person you could ask how would react to that article? I would bet that not a single rational person would say that you got it all wrong -- on the contrary, a reasonable reading is you got it right _eons_ ago, but now you need do something more to keep doing the right thing. Of course, a card-carrying Scheme nutcase would feel all defensive only if he _knew_ that his favorite religion was all wrong, and therefore needs to stop people from figuring it out. That is how organized religions have reacted to "heretics" for ages. It is quite amazing how fanatic and stupid you Scheme freaks are. Of course you think you are friendly -- you only have people around you who are in complete agreement on something _really_ stupid, and _anybody_ is all friendly when they are never challenged by disagreement of any kind, but challenge you guys and one gets to see what you are really made of: Just watch David Rush in action, or your opening line. Just look at how you treat people who disagree with your beliefs! But trust me on this: Unless that psychotic David Rush character had been so amazingly stupid as to blame me for this, _and_ that New Scheme fellow had cross-posted it back to the newsgroups that coward little shit David Rush did _not_ post to, none of this would have happened. Perhaps you friendly Scheme freaks need to purge your own evils and excommunicate the worst among your own? I would have started by frying David Rushs' balls. It is increasingly obvious that Scheme is a mental disease, particularly since you mental cases always make a point out of attacking non-believers out of the blue. They do not even have to be posting to your newsgroup! /// -- The past is not more important than the future, despite what your culture has taught you. Your future observations, conclusions, and beliefs are more important to you than those in your past ever will be. The world is changing so fast the balance between the past and the future has shifted. From aleax at aleax.it Fri Dec 28 11:22:25 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 17:22:25 +0100 Subject: regex question: backreferences in brackets References: Message-ID: "Jeremy Jones" wrote in message news:mailman.1009552952.16557.python-list at python.org... ... """ match_string = 'XXX|1|22|333|4444:' test_compile = re.compile(r'XXX(.)[^|]{1}\1[^|]{2}\1[^|]{3}\1[^|]{4}(.)') mymatch = test_compile.match(match_string) if mymatch: print "Found a match" print mymatch.group(0) else: print "No match found" """ The format of the strings that I am trying to match are 3 specific characters followed by some delimter followed by N number of characters other than the delimiter followed by the delimiter, etc. The above code snipped works and matches the string perfectly. I guess my question is this: how can I match any other character except for the delimiter without knowing it beforehand (which I won't know what it is beforehand)? I am thinking use the backreference to the delimiter (i.e. Simplest might be something like: def clevermatch(match_string): try: myre = r'XXX(.)[^|]{1}\1[^|]{2}\1[^|]{3}\1[^|]{4}(.)'.sub('|', re.escape(match_string[3])) except IndexError: return None else return re.match(myre, match_string) i.e., tweak the re pattern appropriately before using it as a re. Alex From buzzard at urubu.freeserve.co.uk Tue Dec 4 01:38:21 2001 From: buzzard at urubu.freeserve.co.uk (Duncan Smith) Date: Tue, 4 Dec 2001 06:38:21 -0000 Subject: minidom Message-ID: <9uhr26$nfs$1@newsg1.svr.pol.co.uk> This may be a stupid question, but I'm struggling. I can retreive information from an XML file (using minidom) as long as it is a node attribute. But I cannot figure out how to get data otherwise. eg. EngineStart Leak good bad XPOS etc. no problem. But how (using minidom) do I retreive 'Engine Start Leak' and 'good' etc? Anyone know of any good documentation / worked examples for minidom? Thanks in advance. Duncan Smith From lac at strakt.com Fri Dec 28 12:20:16 2001 From: lac at strakt.com (Laura Creighton) Date: Fri, 28 Dec 2001 18:20:16 +0100 Subject: Games Made w/ Python In-Reply-To: Message from Gerhard =?iso-8859-1?Q?H=E4ring?= of "Thu, 13 Dec 2001 07:54:32 +0100." <20011213065432.GB897@lilith.hqd-internal> References: <9v9gss$5hr$1@nntp9.atl.mindspring.net> <20011213065432.GB897@lilith.hqd-internal> Message-ID: <200112281720.fBSHKGua023530@ratthing-b246.strakt.com> > Btw., your mail scored pretty high in my spam filter (SpamAssassin with > Vipul's Razor). > > X-Spam-Status: No, hits=3 required=5 tests=NO_REAL_NAME,NO_MX_FOR_FROM > > Please consider using a realname on Usenet. It's just nicer than talking > to nobody@'s, fish@'s and root@'s :-) > > Gerhard I have some friends who are Mathematical Ecologists. They were simulating the Grand Banks for the Canadian Department of Fisheries. They were finding lots and lots of bugs in S the Statistical package they were using. No matter how many times they reported them, they never seemed to get fixed, commented upon, or even noticed. They were quite annoyed Finally, I told them, 'Guys, you have got to stop sending your bug reports in from account names of bluefish, tunnyfish, and _especially_ fishee. Get nice account names from the university.' .... worked like a charm. Laura Creighton From loredo at astro.cornell.edu Fri Dec 21 10:59:26 2001 From: loredo at astro.cornell.edu (Tom Loredo) Date: Fri, 21 Dec 2001 10:59:26 -0500 Subject: ANN: eGenix.com mx BASE Extension Package 2.0.3 References: Message-ID: <3C235C5E.C4E2BB12@astro.cornell.edu> A dumb question I've long wondered about: What does the "mx" stand for in the various mx packages? -Tom Loredo From bror.johansson at avionics.saab.se Tue Dec 4 09:01:10 2001 From: bror.johansson at avionics.saab.se (Bror Johansson) Date: Tue, 4 Dec 2001 15:01:10 +0100 Subject: Where's the error? References: <9uibrc$199$1@newstoo.ericsson.se> Message-ID: <9uijjn$l69$1@newstoo.ericsson.se> "Duncan Booth" skrev i meddelandet news:Xns916D7AAC2704Dduncanrcpcouk at 127.0.0.1... ... > I suggest you either try using raw strings here, or you escape all the > backslashes. If you copy the string into a variable and print it you should > see the problem pretty quickly: ... and so I did, indeed! Duncan and 'raw strings', thank You! From pete at shinners.org Thu Dec 13 13:44:38 2001 From: pete at shinners.org (Pete Shinners) Date: Thu, 13 Dec 2001 10:44:38 -0800 Subject: Games Made w/ Python References: <9v9gss$5hr$1@nntp9.atl.mindspring.net> Message-ID: <3C18F716.5010803@shinners.org> > Is Python an appropriate language for game programming? it's awesome for game programming. you can check out my pygame package at http://www.pygame.org. it uses the SDL library, so your game will run on just about any platform. there's also a projects page so you can see what other folks have been up to for creating python games. http://www.pygame.org/projects From mrchameleon at hotmail.com Sat Dec 8 02:07:13 2001 From: mrchameleon at hotmail.com (Chris Reay) Date: 7 Dec 2001 23:07:13 -0800 Subject: finance programs References: <3c117b54$0$27197$afc38c87@news.optusnet.com.au> Message-ID: <7652139e.0112072307.1379eb10@posting.google.com> djmitchell wrote in message news:<3c117b54$0$27197$afc38c87 at news.optusnet.com.au>... > > Are there any fnance packages being worked on that anyone knows about? > > Maybe something that I can at least get ideas from? > Quantlib is good stuff. Point your browser at http://quantlib.org/ Yours Chris From loewis at informatik.hu-berlin.de Sun Dec 2 09:34:23 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 02 Dec 2001 15:34:23 +0100 Subject: Python 2.2b1 dicts, iteration, and subclassing References: <3C07D496.5040308@post.harvard.edu> Message-ID: Alexis Layton writes: > The question for all you Pythonistas out there is, should it? To > what extent should the built-in behavior of objects like > dictionaries be affected by subclassing? I would say that the documentation decides; if it is undocumented, the implementation may do whatever it feels like. In the specific case, it sounds reasonable that dict_repr uses the iteration of the dictionary (which one? probably iteritems). Currently, it uses the same back-end that the built-in dictionary iteration uses. That, of course, is because nobody thought of this application. If you are really interested in this, I recommend you work out a patch to dictobject.c, and to the documentation. If you are less interested, just file an SF bug report. In either case, it is, unfortunately, unlikely that something will change for 2.2. Regards, Martin From eppstein at ics.uci.edu Mon Dec 10 17:15:46 2001 From: eppstein at ics.uci.edu (David Eppstein) Date: Mon, 10 Dec 2001 14:15:46 -0800 Subject: PEP 276 Simple Iterator for ints (fwd) References: <9up46o$e2ost$1@fido.engr.sgi.com> <9v3b7u$f0ato$1@fido.engr.sgi.com> Message-ID: In article <9v3b7u$f0ato$1 at fido.engr.sgi.com>, pj at sgi.com (Paul Jackson) wrote: > Let me try this tack -- pray tell how does one verbalize > (read out loud or subverbally) the line: > > for 0 <= i < 10: I'd probably read it something like "for i between 0 and 10", throwing in appropriate "inclusive" and "exclusive" when it's important to be precise. Isn't x Message-ID: <3C2A0847.9030605@ua.ac.be> Igor Mozetic wrote: >A simple question from a newbie, sorry. > >I have functions defined normally, def fname(arg1,arg2): >and also represented as tuples (fname, arg1, arg2), >to use them by apply(fname, (arg1,arg2)) - no problem. > >How do I make a comparison: fname == 'string' ? >I found that I could use repr(fname) and parse the >resulting string, but I consider this ugly. >Is there a standard function to return a function name >as a string? > >I'm restricted to Python 1.5.2. >I'm not on the list, please reply to me. > >-Igor Mozetic > See: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52315 Richard Philips From mertz at gnosis.cx Tue Dec 18 14:23:46 2001 From: mertz at gnosis.cx (Dr. David Mertz) Date: Tue, 18 Dec 2001 14:23:46 -0500 Subject: PythonWare: Anyone using for real projects? (fwd) Message-ID: bernhard at intevation.de (Bernhard Reiter) wrote: > http://www.webreview.com/2001/07_20/developers/index02.shtml |First: The reviewer makes the mistake to equal "proprietory" |software with "commercial" software. In fact Free Software can be |commercial. As said reviewer, I have to protest that I make no such mistake. I wrote exactly what I meant, and used all the words accurately. Reiter is, of course, correct that Free Software can be commercial. The short review doesn't say anything about that one way or the other, because those issues simply were not topical. In practice--despite legal technicalities of licenses that certain "enthusiasts" like to observe--if some software is Free, I'm going to be able to obtain it without paying money. But it might well be worth paying the money either because of support that comes with that or out of principled support for the developers. In the above review, I don't mention Free Software at all. I *do* contrast PythonWorks with the *free* Idle, PythonWin and MacPython. That's not a comment on the license terms of the latter three; as Reiter should recognize, the lower case says that you don't pay money for the latter ones. For Webreview, that's exactly the contrast most readers are worried about. The site just isn't one that has a lot of interest in discussing freedom... and I write articles because I get paid money for doing so (although I subsequently make the articles Free, and obtainable from my own website). When I write for places where readers worry about the political principles of licenses, I mention those; when I don't, I don't. Yours, David... From tony at lsl.co.uk Thu Dec 6 05:08:06 2001 From: tony at lsl.co.uk (Tony J Ibbs (Tibs)) Date: Thu, 6 Dec 2001 10:08:06 -0000 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) In-Reply-To: <20011205062232.GA1595@lilith.hqd-internal> Message-ID: <00e201c17e3d$e6042260$545aa8c0@lslp862.int.lsl.co.uk> Gerhard H?ring wrote: > > > > ...deletia... > > and someone else said they weren't sure what to make of this. Well, my reactions were: 1. Laugh! 2. Wonder if he'd been using pypasax_ (one of my favourite "it's so silly it must be useful" projects). 3. Print it out for future reference... (I like the simplicity of his element naming) Of which (1) was the most important - thank you, Gerhard. .. _pypasax: http://www.logilab.org/pypasax/ Tibs -- Tony J Ibbs (Tibs) http://www.tibsnjoan.co.uk/ Marked up with reStructuredText: http://structuredtext.sf.net/ (sort of - we haven't defined "email mode" yet) My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.) From yuvale at radware.com Mon Dec 17 12:47:14 2001 From: yuvale at radware.com (yuval) Date: 17 Dec 2001 09:47:14 -0800 Subject: python win32 extensions: catching messages sent by win32api.PostThreadMessage Message-ID: <11f1fe5.0112170947.5f5df42e@posting.google.com> I would like to write a thread which receives messages sent to him by the win32api.PostThreadMessage function. I have in vain searched the win32 help files for a python equivalent of the well-known GetMessage/PeekMessage functions. Does anybody know how I can retrieve those messages from the thread's message queue. From qrczak at knm.org.pl Mon Dec 3 07:03:37 2001 From: qrczak at knm.org.pl (Marcin 'Qrczak' Kowalczyk) Date: Mon, 3 Dec 2001 12:03:37 +0000 (UTC) Subject: more on "Is this considered black magic?" References: <3C0B441C.8000608@vscht.cz> Message-ID: 3 Dec 2001 10:52:17 GMT, Philip Swartzleonard pisze: > Hm, is there something sane that can be done to make 'method' in this > situation a variable? The way i'm designing things, it would be useful to > have a 'call ArbitrayFunction of all X in container' function. I don't see how to make it simpler in Python. This looks less clear than a direct 'for' loop IMHO: def call_method_for(objects, method, *args): for o in objects: getattr(o, method)(*args) call_method_for(objects, 'method', args) There is little to abstract away because there is no good way to express "a method to call". Another approach is to express it with a function: def call_for(objects, f): for o in objects: f(o) call_for(objects, lambda o: o.method(args)) Not an improvement either. -- __("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ QRCZAK From bt98 at doc.ic.ac.uk Fri Dec 28 15:37:33 2001 From: bt98 at doc.ic.ac.uk (Benjamin Tai) Date: Fri, 28 Dec 2001 20:37:33 +0000 Subject: scripting on top of structural References: <3C2C7B6C.DB7EDC32@doc.ic.ac.uk> <1009569279.849331@rexx.com> Message-ID: <3C2CD80D.4FAC2179@doc.ic.ac.uk> Hi Dave, > 6. Speed of development from the scripting language _and_ speed of > execution from the underlying C/C++ code. True, all the hotspot should be moved to the structural language. > You might also want to look at Chapter 2, "Scripting Languages" in > the SWIG manual, available at: > > http://www.swig.org/Doc1.1/HTML/Scripting.html The paper has described the situation clearly, "the two language view of the world". Apart from accessing to data structure and encapsulated C/C++ code at a higher level , would there be any more possibilities? Are there be any "two language" applications which have shown other benefits, apart from a higher level manipulation, a shorter development cycle, or a wide range of libraries? Thanks Ben From kragen at pobox.com Sat Dec 1 18:50:53 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 01 Dec 2001 18:50:53 -0500 Subject: a long shot -> sending output to a browser question References: <28d73ad6.0112011316.25e17eb2@posting.google.com> Message-ID: <834rnasdnm.fsf@panacea.canonical.org> bigredlinux at yahoo.com (Dan Allen) writes: > This may be far out, but something I have always wondered because I > thought I once saw a page do this and couldn't figure out how. Is it > possible to trick the browser into thinking the whole page has been > sent and begin to display data on the page, and then send more. If > you are wondering where I got this crazy idea, it was with the > NuSphere installation, which seemed to load the page over a period of > time. The reason I ask here, is because they wrote it in perl (and I > didn't see any javascript on the page), and I figured it must have > been something they were doing with output buffering or something and > perhaps python had the same thing. Well, if you just want to display stuff at the bottom of the page, just continuing to send it will work fine. (I wish Python had autoflush, but it's not hard to emulate with a proxy, and you can always just flush manually. You'll need to flush, though, and make sure your web server and proxies aren't buffering either. (At least Apache 1.3 won't; some servers will buffer CGI output unless it's from an nph-script.) Then there's the browser; some browsers wait until they've received a few kilobytes before they start rendering, and others wait for a timeout or until they've received a few kilobytes. Most browsers wait until they've received a whole block-level element, such as a paragraph, before rendering anything, with the exception of tables, which IE 4+ and Netscape 6+ handle more or less cell by cell.) If you want to display it in the middle of the page, places you've already written stuff, you might need JavaScript. (Hmm, maybe you could use CSS absolute positioning?) One trick for this is to send a frameset rows="100%,*" that contains the page in a visible frame and a never-ending stream of JavaScript in another frame. "pushlets" was one approach to this, and there are some proprietary software products that do similar stuff. Hope this helps. Let me know what you end up implementing. From rdsteph at earthlink.net Sat Dec 29 19:33:37 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sun, 30 Dec 2001 00:33:37 GMT Subject: The Fiery Bush Python One True Universal Web Server... References: <3C2CBACB.FBF3C3C9@mindspring.com> <3C2D47F0.6DF7C8BE@mindspring.com> <3C2DF5FF.E332F4EE@mindspring.com> Message-ID: <3C2E61FD.4CA44C0@earthlink.net> You know its funny, but I was thinking about something very similar to what you propose. Would it be possible to create a module that could be plugged into a Python program, that would automatically, when called, go to a specific web site containing a Python interpreter and run the original Python program remotely, give the results track over the web (from the "one master Python server web site) and thus, one could always run Python applets by embedding them into any HTML page. The embedded Python applet could call out to the One Master Python Server, that it knows is always available. This would give Python the exact same capabilities as JavaScript for universal client side scripting WHETHER or not Python was installed on the machine, PLUS the same capabilities as Java applets embedded into HTML web pages. Someone would need to maintain One True Master Python Server web site, but that shouldn't be too hard. Add this to what you propose below, Dr. Ritchie, and what a powerful combination. I wonder if it is possible? We may be on shakey ground alright, but I seem to recall that Moses got some big info from such shakey, fiery ground that contained a certain bush. Maybe such a program and server could be called The Fiery Bush ;-)))) "Dr. David J. Ritchie, Sr." wrote: > "Dr. David J. Ritchie, Sr." wrote: > > > ...I am probably on shaky > > ground here due to ignorance... > > At least on topic in regard to the above anyway ;-} and somewhat > on the topic of what doex language X have that makes it more attractive (or > less attractive) than Python, I'd like to say that it almost seems like Python > is not that far away from allowing as a language feature: > > from module.python.org import * > > or > > from module.python.org import graphics > > where "module.python.org" is some internet node. > > It would seem that such a feature would embrace and > include as part of Python the Java capability of > incorporating classes over the net and up the ante on > the .net initiative (remember what I said > about ignorance here). > > Wouldn't this go some way towards solving the problem of > encouraging more module sharing a la Perl's CPAN but in a > Python-esque way...? > > -- > Dr. David J. Ritchie, Sr. > djrassoc01 at mindspring.com > http://home.mindspring.com/~djrassoc01/ From eppstein at ics.uci.edu Tue Dec 11 18:29:56 2001 From: eppstein at ics.uci.edu (David Eppstein) Date: Tue, 11 Dec 2001 15:29:56 -0800 Subject: PEP 276 Simple Iterator for ints (fwd) References: <3c169178.96189593@wa.news.verio.net> Message-ID: In article <3c169178.96189593 at wa.news.verio.net>, bokr at accessone.com (Bengt Richter) wrote: > How about if a bare [x:y:z] were interepreted as an abbreviation for > slice(x,y,z) > and you defined what one might expect as an iterator for the slice type? > > Then you could write > for i in [0:5]: # or [:5] > ... I don't know about the rest of the participants in this discussion, but I am not interested in a more concise notation for range() that repeats its drawbacks (limited to half-open intervals, non-Pythonists need to look it up in the manual in order to understand it). Why is that any better than what we have now? -- David Eppstein UC Irvine Dept. of Information & Computer Science eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/ From sfeil at io.com Sat Dec 22 20:34:39 2001 From: sfeil at io.com (Steven Feil) Date: Sun, 23 Dec 2001 01:34:39 GMT Subject: Why is Complex number notation the way it is? References: <23302360.0112142245.59089e4f@posting.google.com> <3C21173A.8E02D0A0@cosc.canterbury.ac.nz> Message-ID: I was schooled as a Physicists dammit!! The imaginary number is i!!! Electric current ALWAYS flows from Positive TO Negative. charge carrier may flow from negative to positive, such as e- and Cl- but Na+ flows from positive to negative. If you don't believe that Na+ and Cl- can flow, try taking a bath in salt water and throw in a toaster. IE=P is ALWAYS true, even with AC and a phase factor Because instantaneous current times instantaneous voltage is equal to instantaneous power! (in physics everything is instantaneous) In article <3C21173A.8E02D0A0 at cosc.canterbury.ac.nz>, "Greg Ewing" wrote: > Josh Yotty wrote: >> >> I've been coding Python for about a day now, and I can't 'see' why a >> complex number like 2+3i is represented as 2+3j in Python. > > Guido was apparently thinking like an engineer at the time. Electronic > engineers use j instead of i to avoid confusion with current. > -- ======================================================================== Steven Feil | Gram-pa, back at the turn of the .~. Programmer/Developer | century, why did people use an /V\ sfeil at io.com | operating system, when they were not // \\ | allowed to see the source code? (X_X) ======================================================================== From robin at jessikat.fsnet.co.uk Sun Dec 9 05:57:35 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Sun, 9 Dec 2001 10:57:35 +0000 Subject: join vs instances Message-ID: I had expected to be able to use things like UserStrings interchangeably with ordinary strings, but >>> from UserString import UserString >>> C=['a',UserString('B'),'c'] >>> ''.join(C) Traceback (most recent call last): File "", line 1, in ? TypeError: sequence item 1: expected string, instance found> >> C=['a','B','c'] >>> ''.join(C)'aBc' >>> what do I need in a class to get an instance to respect the string join? -- Robin Becker From robin at jessikat.fsnet.co.uk Mon Dec 17 07:00:05 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Mon, 17 Dec 2001 12:00:05 +0000 Subject: Why no match? References: Message-ID: In article , Robin Becker writes >I'm puzzled as to why the second of these pattern matches fails. They >only differ in that the second is supposed to match to the end of line. >Can any regexpert supply an answer? > >>>> import re >>>> re.compile(r'^self\s*\.\s*test\s*=\s*\d\s*').match('self.test=11') > >>>> re.compile(r'^self\s*\.\s*test\s*=\s*\d\s*$').match('self.test=11') >>>> my own stupidity the patter should be re.compile(r'^self\s*\.\s*test\s*=\s*\d+\s*$').match('self.test=11') ie to allow one or more digits grrrh :( -- Robin Becker From emile at fenx.com Sun Dec 30 00:49:40 2001 From: emile at fenx.com (Emile van Sebille) Date: Sat, 29 Dec 2001 21:49:40 -0800 Subject: How to do "ANN:"? References: Message-ID: "Harry George" wrote in message news:m3666py0b7.fsf at wilma.localdomain... > A couple of times I've tried to annouce package upgrades using "ANN:" > entries to c.l.p and c.l.p.a, but nothing shows up. Is there a magic > decoder ring? > > Most recently, updates for mkpythonproj, pdx, and pyperlish. You probably forgot the magic incantation: (Baaa baaa... flap flap flap... whoosh... thud.) Include that in an e-mail to the moderators at mailto:clpa-moderators-owners at python.org and you're sure to get in. Wondering-about-the-commercial-benefits-of-ovine-aviation-ly y'rs, -- Emile van Sebille emile at fenx.com --------- From phony_address at yahoo.com Thu Dec 6 06:38:22 2001 From: phony_address at yahoo.com (Phredd Phlintstone) Date: Thu, 06 Dec 2001 11:38:22 GMT Subject: Distant learning Python classes? References: <3c0e80f6.4856295@news> <3C0EF9A0.D37398BD@bellatlantic.net> Message-ID: <3c0f5804.3473985@news> Thanks. I was aware of this site, but gave it a second look and the newbie section does look excellent. I am not a mathematician, scientist, or computer geek and am not even sure why I want to learn to program. It fascinates me and I've wanted to do it for a few years now. So, it's time. I thought a class, with assignments, might be the way to go for me. I've been reading ABOUT Python for a week now and need to jump in at some point, thus the class. It's tough making up my own assignments. On Thu, 06 Dec 2001 04:52:43 GMT, David Lees wrote: >You might look at a link off the python.org home page: >http://www.python.org/doc/Newbies.html > >debl Please post any responses to this to this newsgroup. From marco.stagno at libero.it Wed Dec 12 13:48:29 2001 From: marco.stagno at libero.it (Marco Stagno) Date: Wed, 12 Dec 2001 18:48:29 GMT Subject: avoid a blocking operation on a (named) pipe / timeout on a pipe Message-ID: <538f1u0sjap1vpivsn3toc2qn5gh1qtn6f@4ax.com> Hi I'd like to build a module to manage a (named) pipe, without problems if the operation on the pipe is blocking my program. I already make a little module that use the "os.fork()" function to check the time/timeout on the "open(pipename,...)", (and it seems to work!) but I'm looking for something better. (if someone is interested in, I can post here my "safe_pipe.py" module) I'm searching for some info about select.select() but I'm not sure how to use it... or I'm looking for some hints/modules to make what I want. :) Someone can help me?! Thank you in advance. MAS! From greg at cosc.canterbury.ac.nz Wed Dec 19 17:44:38 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Thu, 20 Dec 2001 11:44:38 +1300 Subject: Strange behavior of weak references (weakref module) References: <6c92a8bc.0112180601.2ac4a6f0@posting.google.com> Message-ID: <3C211856.A75E8A7@cosc.canterbury.ac.nz> Tiberius Teng wrote: > > I found this behavior (bug?) when I want to create weak reference to a > instance method. Every time the expression A.test is evaluated, a *new* bound method object is created. If you don't store a strong reference to this object somewhere, it will immediately disappear. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From phr-n2001d at nightsong.com Mon Dec 10 17:47:30 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 10 Dec 2001 14:47:30 -0800 Subject: python log() References: <9v3dfg$jj3$1@neptunium.btinternet.com> Message-ID: <7xu1uyelq5.fsf@ruckus.brouhaha.com> "Ian" writes: > Hello I am new to python and am trying to use it to work out a sum > log(20/7) / log(2) > which gives result > 1.0 > > I am expecting to get 1.51 as a result, and using different langs such as > perl or php, I get the desired result of 1.51 > > It seems to me that python only goes to a certain decimal place, not as much > as the other compilers, can this be altered in anyway? Use 20.0 (or just "20.", ending with a decimal point) to signify a real number rather than an integer. So you'd say log(20./7.)/log(2.) This is common with most programming languages. From akuchlin at mems-exchange.org Wed Dec 12 16:44:36 2001 From: akuchlin at mems-exchange.org (Andrew Kuchling) Date: 12 Dec 2001 16:44:36 -0500 Subject: lost interest? References: <20011208001123.A5989@casa.parque> <3C14FEBD.AD52B516@attbi.com> <3c178a5c.36573229@news.laplaza.org> Message-ID: <3dlmg8p0zf.fsf@ute.mems-exchange.org> mats at laplaza.org (Mats Wichmann) writes: > The problem really comes in when you're trying to specify a Python > Environment that has designs on being as cross-platform as Python is, > and not all of the users care to be Python fans and keep up on > everything that's going on. Probably there aren't enough people in Someone could revive PEP 206, a plan for a "Batteries Included" distribution of Python; see http://python.sourceforge.net/peps/pep-0206.html. Moshe was working on it, but he seems to have dropped out of sight (hope he's OK). --amk (www.amk.ca) any-technology-indistinguishable-from-magic-is-too-mysterious- to- trust-ly y'rs -- Tim Peters, 16 Feb 1999 From aleax at aleax.it Thu Dec 6 11:52:53 2001 From: aleax at aleax.it (Alex Martelli) Date: Thu, 6 Dec 2001 17:52:53 +0100 Subject: Is it possible to kill a thread ? References: <9unnfb$6fp$1@wanadoo.fr> <3C0F9FF8.60207@home.com> Message-ID: <9uo7p2$dhb$1@serv1.iunet.it> If it WERE possible, do you think the "tabs vs spaces" one would still be going on?! Alex From mixo at beth.uniforum.org.za Thu Dec 6 02:30:47 2001 From: mixo at beth.uniforum.org.za (mixo) Date: Thu, 06 Dec 2001 09:30:47 +0200 Subject: 'ioctl ' call in python (serial port reading) References: <3C0C8FF3.7060500@beth.uniforum.org.za> <3C0CAE73.6060304@beth.uniforum.org.za> <20011205111542.5369dd87.use-net@schabi.de> Message-ID: <3C0F1EA7.8000205@beth.uniforum.org.za> Michael Hudson wrote: > > If he was using 1.5.2 or 2.0, then the constants should be in TERMIOS > instead. > > There was a release which had a crippled set of constants in termios, > but I can't remember which one it was/find it. > > At any rate, all the constants mentioned are in termios on the systems > I have access to in CVS at present. > > Cheers, > M. > > I am actually using 1.5.2, but I have 2.x installed as well. The constants are not in my TERMIOS. Thanks Mixo P.S 2.x, breaks a few projects that we / I have worked on which have string manipulation. Whatever happened to 're', really kills a few things. And,there is syntax which changed as well, which wouldn't be an issue if all we used this side was 'python'. (The last project we worked on, we had to use 'php', and then there is maintence of RT, which is in perl, and of course the reason for my original problem, the documentation for serial programming has examples/illustrations written in 'c' -- and that is the 2nd language I learned). In short,it may some time before we / I switch to 2.x, and I look forward to the day... From apeak_2000 at yahoo.com Sun Dec 23 18:32:50 2001 From: apeak_2000 at yahoo.com (Peak Allan) Date: Sun, 23 Dec 2001 15:32:50 -0800 (PST) Subject: Newbie question Message-ID: <20011223233250.16054.qmail@web20009.mail.yahoo.com> I copied this code from one of the tutorials on the python.org website, but when I tried to run it, I got an error. # Program FileTest out_file = open("test.txt", "w") out_file.write("This crap is going to out file\n") out_file.close() in_file = open("test.txt", "r") text = in_file.read() in_file.close() print text bash-2.05$ ./fileTest.py ./fileTest.py: line 3: syntax error near unexpected token `open("' ./fileTest.py: line 3: `out_file = open("test.txt", "w")' Can someone please tell me what I did wrong? Also, are the tutorials at python.org a good way to learn Python? If not, are there any other good online resources? __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com From krempp at trucs.en.trop.crans.ens-cachan.fr Fri Dec 28 13:56:27 2001 From: krempp at trucs.en.trop.crans.ens-cachan.fr (Samuel Krempp) Date: Fri, 28 Dec 2001 19:56:27 +0100 Subject: imaplib : password with accented chars in login commands Message-ID: when I try using "?" as a password in the login command, the imaplib command raises exceptions. import imaplib M=imaplib.IMAP4('imap.free.fr') M.login("toto", "bla?bla") imaplib.error: LOGIN command error: BAD ['Missing required argument to LOGIN'] It's quite a problem, since I wished I could use any french character in my passwords, But I am not sure whether this is a bug in imaplib or a 'feature' of the IMAP protocol, because the documentation http://www.python.org/doc/current/lib/imap4-objects.html says something I don't fully understand, about always quoting string used as password in the login command. Is this a bug, or am I doing something wrong ? Regards, -- Sam From jp at NOSPAMdemonseed.net Fri Dec 7 13:57:16 2001 From: jp at NOSPAMdemonseed.net (jason petrone) Date: Fri, 7 Dec 2001 18:57:16 +0000 Subject: Is it possible to kill a thread ? References: <9unnfb$6fp$1@wanadoo.fr> <3C0FCD72.A5FA167C@ccvcorp.com> Message-ID: Grant Edwards wrote: > The problem with this is that one often creates a thread so > that it can do some possibly blocking operation without > stopping the rest of the program. If the thread is blocked, it > can't check the event. I actually submitted a thread.kill patch, but the Pythoneers managed to convince me that the only clean way to do it is to throw an exception in the blocked code. Easy enough to do with posix threads, but a massive pain on less robust platforms(*ahem* win32). Now I just use non-blocking IO. Its a little more work, but I can do everything I need. jason From mkelly2002NOSPAM at earthlink.net Mon Dec 24 19:26:36 2001 From: mkelly2002NOSPAM at earthlink.net (Michael Kelly) Date: Tue, 25 Dec 2001 00:26:36 GMT Subject: Looping constructs References: <3c25d37e_9@news.newsgroups.com> <3C2602B3.47EA5685@engcorp.com> Message-ID: <8jhf2usjl77u6ucmo49r8lcnumh92dcm6l@4ax.com> On 24 Dec 2001 16:27:25 GMT, beej at piratehaven.org () wrote: >Do you ever have a "while 0:" loop? Of course not. So why is there >even a conditional in there at all? Shouldn't Python just have a: > >foreverloop Heh. I've even seen C guys do macros like #define FOREVER for(;;) (but they usually came over to C from Pascal or Modula or someplace) A bit silly after a while. AFAIC it doesn't really matter that much. One thing I did like about Quick Basic and now VB is that you can put the conditionals at the top or bottom of the loop and with positive and negative logic for both, but as long as you have break and continue type statements it doesn't really matter. What messed things up in C/C++ was any non-zero function return was "true" so then they figured it would be nice to return the error code and return 0 for "success" so everything stood on its head. Then they did exceptions so they really don't need the 0 success returns after all(unless you don't want to use exception handling.) Then of course there's COM with zero success and exceptions too. Ugh! :) The only thing that seems to stay the same is that as soon as you got something down they change it on ya'. :) Mike -- "I don't want to belong to any club that would have me as a member." -- Groucho Marx From kragen at pobox.com Wed Dec 5 05:13:22 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 05 Dec 2001 05:13:22 -0500 Subject: all process list on Linux? References: Message-ID: <83snaqotz1.fsf@panacea.canonical.org> Brian Lee writes: > How can I get all processes list on Linux OS? I need PID > and process name (like the result of ps command). Look in /proc for the pids, and "/proc/%d/cmdline" % pid for the command-line that started the process. /proc/%d/stat also gives you the command name. HTH. From syring at email.com Fri Dec 7 17:53:05 2001 From: syring at email.com (Karl M. Syring) Date: Fri, 7 Dec 2001 23:53:05 +0100 Subject: Hiding stuff like passwords in source? References: Message-ID: <9urh9b$ak0vj$1@ID-7529.news.dfncis.de> "David Brady" schrieb im Newsbeitrag news:mailman.1007761874.4238.python-list at python.org... > Hello, > > I have written a bunch of utilities for Python that > handle niggly things for me like synching ftp > directories and such. Because I'm too lazy to type in > my password every time, I've just jammed in the > password into the Python source. It's nice being able > to just double-click and have a thing run. > > The problem is, of course, security. If someone else > uses my machine, they could easily find my > username/passwords from my Python source. > Furthermore, I'm absent-minded and will occasionally > mail scripts to people, and though I have so far > managed to not accidentally send one with my password > in it, I'm sure it's only a matter of time. The only solution that is relatively safe is to have our own logon procedure. Your data and programs are generally encrypted and when you start working, you use the logon program to decrypt your data. If you logoff, everything gets encrypted again. For really sensitive applications, the logon/logoff program will be a persistent process with a dead woman switch that will encrypt everything if you do not contact it for 10 minutes or so. Of course, to be shure, you should carry the floppy disk with the logon program in your shirt pocket. This spares you the embarrassment if you forget your 25 character password. Karl M. Syring From tjreedy at home.com Sun Dec 2 17:10:19 2001 From: tjreedy at home.com (Terry Reedy) Date: Sun, 02 Dec 2001 22:10:19 GMT Subject: inline functions or macros? References: <87667pz60e.fsf@dgp.toronto.edu> <5l7l0ug2e32l8h5393t5s4ulg3jc4mhsp1@4ax.com> Message-ID: "Michael Kelly" wrote in message news:5l7l0ug2e32l8h5393t5s4ulg3jc4mhsp1 at 4ax.com... > On Sun, 02 Dec 2001 21:06:25 GMT, Maciej Kalisiak > wrote: > > >I seem to recall reading that function calls in Python are somewhat > >expensive. I come from a C++ background, and there this is usually > >dealt with by defining frequently used small functions as 'inline'. > >Is there something similar in Python? > > There's a "lamda" inline function definition > mechanism but I'm new to Python so I > don't know if it's run-time efficient or > just a syntactic convenience yet. The latter (syntax convenience). Terry J. Reedy From s.lorenz at release-it.de Mon Dec 3 11:02:51 2001 From: s.lorenz at release-it.de (.seshi) Date: Mon, 3 Dec 2001 17:02:51 +0100 Subject: zope newsgroup? Message-ID: <9ug7rq$86oo8$1@ID-84593.news.dfncis.de> hiho ng :) im lookin for a zope newsgroup... i have to work with this ***** and have several questions. or may i ask here? greetings seshi From syver-en+usenet at online.no Sun Dec 30 07:39:56 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 30 Dec 2001 13:39:56 +0100 Subject: pyro 2.3 remote.py windows fix. Message-ID: Due to weak support for the signals module under windows, I'll have to comment out two lines from remote.py that is provided in the quickstart example for Pyro 2.2 and 2.3 as these are not defined in the windows version of the signal module (python 2.1.1). signal.signal(signal.SIGINT, interrupt) #signal.signal(signal.SIGHUP, interrupt) #signal.signal(signal.SIGQUIT, interrupt) -- Vennlig hilsen Syver Enstad From akuchlin at mems-exchange.org Tue Dec 11 14:52:22 2001 From: akuchlin at mems-exchange.org (Andrew Kuchling) Date: 11 Dec 2001 14:52:22 -0500 Subject: lost interest? References: <20011208001123.A5989@casa.parque> <3C14FEBD.AD52B516@attbi.com> <3dzo4pputt.fsf@ute.mems-exchange.org> <3C16501E.D817323D@attbi.com> Message-ID: <3du1uxpma1.fsf@ute.mems-exchange.org> Chris Barker writes: > Isn't this only true if it's been built as a .deb? Sure, but some Debian developer has done that for the most important third-party modules such as Numeric, and that will be enough for most people. It would certainly be nice if someone would actually finish implementing a bdist_deb target for Distutils, though, so that all Python modules can be automatically turned into .debs. > The same is true for rpm based systems, but let's face it, distutils > was created for a reason. It would be very helpful if there could be ONE > way for people to do it, on ALL platforms. The community seems to disagree on this point. Has Suchandra gotten any comments on ciphon? Will Jason Petrone get any comments on the ports-style package manager that he just posted about? No comments on either have ever been posted to the catalog-sig, as far as I can see. (I downloaded ciphon and played with it for a while, but had no substantial comments and, since it's unlikely I'd ever use it, didn't examine it more closely.) --amk From robin at jessikat.fsnet.co.uk Mon Dec 10 06:14:08 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Mon, 10 Dec 2001 11:14:08 +0000 Subject: join vs instances References: <3C13F9D7.5091357@earthlink.net> Message-ID: In article <3C13F9D7.5091357 at earthlink.net>, Hans Nowak writes >I haven't looked at the C code, but I expect that it wants the types >of the list items to be , not "something that behaves >like a string". The latter can often be done in Python code, but I >guess this wasn't an option for built-in (C) functions. > >There are other examples of this in Python, for >example exec, that takes a dictionary but not a UserDict: > >>>> from UserDict import UserDict >>>> d = UserDict() >>>> exec 'print "Hello"' in d >Traceback (most recent call last): > File "", line 1, in ? > exec 'print "Hello"' in d >TypeError: exec: arg 2 must be a dictionary or None > >There are several workarounds possible, e.g. doing a map(str, lst) >where lst is your list that contains UserString instances, then >joining it. > >--Hans the map(str,lst) would be the easiest. It's strange, but I thought Python would allow some kind of coercion pretty well every where. -- Robin Becker From hgg9140 at seanet.com Sat Dec 29 20:13:45 2001 From: hgg9140 at seanet.com (Harry George) Date: 29 Dec 2001 17:13:45 -0800 Subject: REPOST: Re: UML/XMI et al References: Message-ID: <7$--$$_----___-_$$@news.noc.cabal.int> Martin von Loewis writes: > Harry George writes: > > > I'm working with several CASE tools, some of which have XMI > > interfaces. I want to drive code in and out of them (and generate SQL > > code for several DBMS's) using python. Anyone working in this area? > > Yes, I've been looking into XMI at one time. People also use XSLT to > process XMI. > > > I have already done a generator for UML/XMI DTD --> python classes, and > > MySQL and PostgreSQL SQL code generators. > > Sounds interesting. Are you going to publish that code? Does that use > a custom mapping, or a general one? > I've just put the "pycase" package on: http://www.seanet.com/~hgg9140/comp/index.html This is more like working notes than a finished product. Only the postgres binding is in this bundle. The mappings are generic in the sense that a) the UML/XMI can be regenerated whenever the DTD changes b) pg2py determines the DBMS's table definitons by itself. > Regards, > Martin > -- Harry George hgg9140 at seanet.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Harry George Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:03:15 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774605 27193 211.57.49.2 (31 Dec 2001 04:56:45 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:56:45 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From aahz at panix.com Mon Dec 31 09:25:40 2001 From: aahz at panix.com (Aahz Maruch) Date: 31 Dec 2001 06:25:40 -0800 Subject: Cancel messages References: Message-ID: [posted to c.l.py with cc to python-list-admin] In article , Gerhard =?iso-8859-1?Q?H=E4ring?= wrote: > >What's going on here? A mailman bug from the mail <-> news gateway, or >somebody coverage-testing their Mozilla?! Let's just say that the mental health profession is falling down on the job. Unfortunately, one of the side effects of these cancel floods is that we get counter-flooded by people resurrecting the original article. If you have any say over your netnews server, you should probably set it up to reject both cancels and resurrections. I don't think that cancels affect python-list, but the admins should probably set up a filter to ignore the REPOST: articles based on the X-Reposted-By: header. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: TODAY! From logiplexsoftware at earthlink.net Wed Dec 5 13:42:24 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Wed, 5 Dec 2001 10:42:24 -0800 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) In-Reply-To: <20011205062232.GA1595@lilith.hqd-internal> References: <01120417475903.01465@logiplex1.logiplex.net> <20011205062232.GA1595@lilith.hqd-internal> Message-ID: <01120510422400.03954@logiplex1.logiplex.net> On Tuesday 04 December 2001 22:22, Gerhard H?ring wrote: > > > > > > > > > > > > > > > > > > > > > > > > Better? Seperatation of representation and semantics? The obvious > disadvantage of an XML representation of sourc code would be that we > would need *really good* editors to make it not painful. I don't even know what to think of this, but since you obviously put some time into writing it I felt compelled to reply. -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From laz at strakt.com Thu Dec 13 11:50:57 2001 From: laz at strakt.com (Fredrik Juhlin) Date: Thu, 13 Dec 2001 17:50:57 +0100 Subject: Problems with Tkinter and menus In-Reply-To: <7s4S7.3800$uR5.1208563727@newssvr10.news.prodigy.com> References: <9v9vu2$r6g$1@norfair.nerim.net> <7s4S7.3800$uR5.1208563727@newssvr10.news.prodigy.com> Message-ID: <20011213165057.GA3112@strakt.com> On Thu, Dec 13, 2001 at 04:13:11PM +0000, Bill Melcher wrote: [snipped beginning of code] What if you try: menu0 = Tkinter.Menu(root, tearoff=0) menu1 = Tkinter.Menu(menu0, tearoff=0) rather than: menu0 = Tkinter.Menu(root, tearoff=0) menu1 = Tkinter.Menu(root, tearoff=0) [snipped remaining code] > No hello, no menus and no errors reported. The origional version posted by > Fredrik Juhlin showed the same behavior. Of course, if absolutely nothing happened and you didn't even get a menu when you right-clicked on the window, then something seems even more broken for you. //FJ From pinard at iro.umontreal.ca Mon Dec 17 15:44:41 2001 From: pinard at iro.umontreal.ca (=?iso-8859-1?q?Fran=E7ois?= Pinard) Date: 17 Dec 2001 15:44:41 -0500 Subject: request: more samples for Pymacs, please In-Reply-To: References: Message-ID: [Syver Enstad] > I am using win2k and python2.1, GNU Emacs and pymacs works great. Thanks for telling. Are you using Windows-NT? I was not expecting Pymacs to work on Windows-9x, as so far that I know, there are now sub-processes there. About Windows-2000 or -XP, I just do not know. I would adjust the documentation to (very briefly) report success stories! > It would be nice with some more samples on how to do things though. Yes, this aspect surely could be improved. Do you feel like contributing some code for examples? I do use Pymacs for myself, of course, but I do not see what I could easily borrow from my own code into the documentation, as my applications are not simple and not very suited for mere illustration. > I had to do some tweaks to the installation of pymacs to get it to > run on a win2k box, but nothing intrusive. Once again, I could reflect your suggestions, at least in the documentation. And thanks for your interest in Pymacs. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From bwilk_97 at yahoo.com Wed Dec 19 10:03:08 2001 From: bwilk_97 at yahoo.com (Bill Wilkinson) Date: Wed, 19 Dec 2001 15:03:08 GMT Subject: Dictionaries as records References: <7_XT7.28652$t07.4042756@twister.midsouth.rr.com> Message-ID: "Steve Holden" > > Try using copy.deepcopy() in place of d.copy() in your first section to see > whether it changes the memory requirements significantly. A copy of a > dictionary does not need to copy the values of the keys or the items, since > they are held as references. Using deep copying might duplicate more data > (though I have not read the interpreter source to verify this...). No difference in copy and deepcopy here. I checked. Each record is a new copy as it is. I was sort of suspecting that the first one was smaller because the strings were being interned. They are all the same. > Basically, though, I'm afraid you might have to accept that you have passed > some limit of usefulness for the programming technique you originally chose. Yes sir, I have accepted that. Now I am just trying to understand what is happening. Thank you for your assistance. Bill From tim at vegeta.ath.cx Sun Dec 16 10:42:57 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Sun, 16 Dec 2001 15:42:57 GMT Subject: Populating a list References: <32c382ad.0112091404.6cfe4a56@posting.google.com> Message-ID: mlorfeld graced us by uttering: > I am new to python (about 72 hours into learning), and am having > problems with reading a file (sate abbreviations) with one item per > line and populating each line into a list. The problem is that each > item ends with \012 after each state ie WI\012. This is intended and it's explained in the Python Library Reference. The following is from the documentation on built-in file objects: < http://www.python.org/doc/current/lib/bltin-file-objects.html > A trailing newline character is kept in the string (footnote 2.7) (but may be absent when a file ends with an incomplete line). Footnote 2.7 The advantage of leaving the newline on is that an empty string can be returned to mean EOF without being ambiguous. Another advantage is that ... you can tell whether the last line of a file ended in a newline or not... > Here is the code that I am using: > > f=open('/home/mlorfeld/states.txt', 'r+') 'r+' mode not necessary as you're only reading the file. 'r' is sufficient and is the default. > states=f.readlines()#populates a list from file > f.close f.close is a method, but to call it you must use: f.close() > print states As long as your script will be staying on operating systems whose line separators (eg, '\012') is only one byte, try the following. # classic Python f = open('/home/mlorfeld/states.txt') states = [] for line in f.readlines(): states.append(line[:-1]) f.close() print states # Python >= 2.2 f = open('/home/mlorfeld/states.txt') states = [ line[:-1] for line in f ] f.close() print states HTH Tim Hammerquist -- Love belongs to Desire, and Desire is always cruel. -- Old Man, The Sandman From grey at despair.dmiyu.org Fri Dec 28 13:29:41 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Fri, 28 Dec 2001 18:29:41 -0000 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2C8A86.50C74E60@earthlink.net> Message-ID: On Fri, 28 Dec 2001 15:12:20 GMT, Hans Nowak wrote: > Hey, you guys, stop dissing my box like that! >=) > (900 MHz, bought last month...) Hey, I'm allowed. Winbox for games: 667mhz, 512Mb RAM. Linux server/workstation: 450Mhz, 384Mb RAM (although I can drop another 450 in) Linux Laptop: 667Mhz, 128Mb RAM. You trump me on all three. -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From ssthapa at classes.cs.uchicago.edu Wed Dec 19 21:59:30 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Thu, 20 Dec 2001 02:59:30 GMT Subject: CGI form repost from browser--how to prevent? References: Message-ID: Chris wrote: >Thanks to all for input. Unfortunately, the Javascript solution is >not working for me. I think maybe I did not state the issue clearly >enough, or maybe my meager Javascript knowledge is a problem. The >issue is not preventing a submit while a current sumbit is processing. > The issue is preventing a browser refresh (F5 in IE, eg) causing a >completely new submit after the user has hit the submit button and >that submit processing is complete. I.e., here's the scenario: >User enters data into form. >User hits submit button. >Cgi script invoked and does submit work. >Cgi script returns, user presented with new page stating "submit >done--all ok!" >User hits refresh in the browser (or "reload"). >Browser reposts the form data. >Cgi script runs anew and repeats the same work it just did. > >That last step is what I want to be able to prevent. I tried the >Javascript and it doesn't prevent that scenario. At least *my* >Javascript doesn't prevent that scenario :-). Try this instead. Immediately after doing your processing, redirect the browser to another page. You can do this by sending a location header with the new page (e.g. "Location: http://new.address.com"). This prevents a refresh from resubmitting the parameters. For protection against the user going back using the history, set a cookie with a value like processed=myform.py by the script that does the processing. And have any scripts that generate forms reset this value. That way, if your form processing script sees this value it'll know that the user came back to the page using the browser's history. Another thing you can try is to use get form actions since those will be cached. This won't work for forms with a large amount of variables or things like file uploads, but it also doesn't need cookies to be enabled. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From tboyle at NoSMAProsehill.net Fri Dec 21 20:23:58 2001 From: tboyle at NoSMAProsehill.net (Todd Boyle) Date: Sat, 22 Dec 2001 01:23:58 GMT Subject: Convernt ebXML Core Components to XSD schemas Message-ID: <3c28df91.30855562@news.cortland.com> For my first python program I took the ebXML core components out of the table format and put them into XSD schemas, yee haaa! I havent had this much fun since they took away my Clipper 5.2, here is where it is, http://www.arapxml.net/GLcoreComponentsV091.htm Is anybody else here doing work with ebXML or the core components? TOdd Todd Boyle CPA 9745-128th Ave NE Kirkland WA tboyle at rosehillnospam dotnet 425-827-3107 website www.gldialtone.com employer www.netaccount.com project www.arapxml.net "... most of us have a natural tendency and an incredible talent for processing new facts in such a way that our prior conclusions remain intact." -Horngren From oren-py-l at hishome.net Mon Dec 17 07:15:30 2001 From: oren-py-l at hishome.net (Oren Tirosh) Date: Mon, 17 Dec 2001 07:15:30 -0500 Subject: Take 2: PEP draft for expression embedding In-Reply-To: <9vj0eq$593$2@peabody.colorado.edu>; from fperez528@yahoo.com on Sun, Dec 16, 2001 at 01:31:52PM +2328 References: <9vj0eq$593$2@peabody.colorado.edu> Message-ID: <20011217071530.A67893@hishome.net> On Sun, Dec 16, 2001 at 01:31:52PM +2328, Fernando P?rez wrote: > Sorry for being lazy, but since you've already done the search homework, > would you mind pointing to Frederik's post on i()? I've never seen it and I'm > quite intrigued. It's ridiculously, why-didn't-we-think-of-this-before-ly simple: i = lambda *args: ''.join(map(str,args)) Example: print i("X=",x," Y=",calc_y(x)) The argument list of this function behaves just like the argument list of the print statement, the only difference is that no spaces are added automatically. IMHO, it's much more friendly than % formatting. A version of this function implemented in C should be about as fast as formatting with the % operator and almost two orders of magnitude faster than any form of interpolation that scans for expressions inside a string and evaluates them at runtime with eval(). The name 'i' should probably be changed to something short but descriptive. Here is an interesting idea from a posting by Marcin Kowalczyk: > It could be nice to have str() working like this instead. > It's backwards compatible with current 0- and 1-argument cases. > > Except it doesn't work with unicode() which uses positional arguments > for other things (encoding) :-( Mandating that they are keyword > arguments would break compatibility. Oren From opengeometry at yahoo.ca Wed Dec 5 18:10:03 2001 From: opengeometry at yahoo.ca (William Park) Date: Wed, 5 Dec 2001 18:10:03 -0500 Subject: Python - string to hexbytes conversion - HELP! In-Reply-To: ; from dhhnews0@hotmail.com on Wed, Dec 05, 2001 at 08:48:39PM +0000 References: Message-ID: <20011205181003.B994@node0.opengeometry.ca> On Wed, Dec 05, 2001 at 08:48:39PM +0000, me wrote: > I'm a newbie to Python and I am trying to convert a string of decimal > numbers - read from raw_input to a series of hexbytes > eg > if I do a read and get a='1234567' > I need an equivalent string to be > b=Chr(0x01)+chr(0x23)+chr(x045)+chr(0x67) > > all this is to control a device from the serial port but I cannot seem > to recall how to conver the input to my required output An hints or > suggestion most appreciated! I've spend hours trying various built > in's which I would prefer to use > > HELP! hex(int('1234567')) -- William Park, Open Geometry Consulting, . 8 CPU cluster, NAS, (Slackware) Linux, Python, LaTeX, Vim, Mutt, Tin From cliechti at gmx.net Fri Dec 28 21:47:57 2001 From: cliechti at gmx.net (Chris Liechti) Date: 29 Dec 2001 03:47:57 +0100 Subject: REPOST: Re: [Q] how to use IDLE in linux References: Message-ID: <9$--$$_----_--_%_$@news.noc.cabal.int> "Young-Jin Lee" wrote in news:vA3X7.5252$tg4.66909 at vixen.cso.uiuc.edu: > Hi, I have problem using IDLE in Linux. I installed Python 2.2 and > tried to launch IDLE, but it didn't work. > I read the on-line document for IDLE and it says that I needed to just > type "idle", but it didn't work for me. > What am I supposed to do to use IDLE in Linux? > TIA. > > YJ tell us more about the error message you get. is the command "idle" not recognized or is it a python error complaining about missing tkinter? -- Chris ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Chris Liechti Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:38:31 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774907 27193 211.57.49.2 (31 Dec 2001 05:01:47 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:01:47 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From grey at despair.dmiyu.org Thu Dec 27 20:08:02 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Fri, 28 Dec 2001 01:08:02 -0000 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: On Thu, 27 Dec 2001 17:48:13 +0000, phil hunt wrote: > Python runs quickly on my 300 MHz box, which is 3 times slower > than the slowest PC you can buy today. It can only get more popular. Well, if you take the measure of just pure Mhz.... 4 times slower. ;) -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From peoter_veliki at hotmail.com Sun Dec 2 19:28:09 2001 From: peoter_veliki at hotmail.com (Peoter Veliki) Date: Sun, 2 Dec 2001 16:28:09 -0800 Subject: forcing import without execution? Message-ID: This may sound a little strange, but the software that I use (which uses Python as the scripting language) automatically loads modules according to the name of the module, which means if I want to import a module it gets executed twice, once by the software and the second time when I import it. However, if I don't use the import statement then the module isn't visible even though it has been executed once. So, my question is: can you import a module (make the namespace available) without actually executing the code? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From wurmy at earthlink.net Sat Dec 29 15:57:36 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Sat, 29 Dec 2001 20:57:36 GMT Subject: Was that to inpolite? Re: Call for a small program References: <3C2BAEF3.CC34B8DD@htp-tel.de> <3C2E0D55.9EC9B67F@htp-tel.de> Message-ID: <3C2E2D00.A8E511EB@earthlink.net> Tom Karas wrote: > > Hello out there. > > A few quick questions: > > Was my "Call" to inpolite? > > Was it the wrong place / newsgroup to ask? > > I just wonder, because there wasn?t even a reaction like "Go away" or > "Plonk / Killfile" > > This may sound odd, but i would be even willing to pay for a solution > that would > fit the basic needs (running on windows and linux and some features) I don't see the message you're referring to. When did you post it? --Hans From jwbaxter at spamcop.net Fri Dec 28 10:11:39 2001 From: jwbaxter at spamcop.net (John W. Baxter) Date: Fri, 28 Dec 2001 07:11:39 -0800 Subject: REPOST: Re: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B5E9F.FF1C2CC@bellatlantic.net> <3C2B941D.B1E45AA5@htp-tel.de> Message-ID: <2$--$$_----_-$%_$$@news.noc.cabal.int> In article , DeepBleu wrote: > NNTP is an internet protocol like SMTP, POP3 and HTTP for communication. > Also, it is the oldest one and it used to be the most instructive before AOL > hit the scene along with the 'gold rush' :) Old enough to include transfer of messages on reels of magnetic tape aboard ships to get them to, eg, Australia and back. > Ask your ISP if they offer NNTP support through their own server. "Own server" seems a little strong these days. ISPs are increasingly outsourcing the news server operation. I know my life became MUCH simpler--and our range of news groups much larger--after we outsourced. Even given the provider changes which have happened since, the network issues, etc. Not only is NNTP quite old...the server implementations tend to be rather cantankerous. Now, if your ISP offers shell access (we stopped doing that in 1994), there's more advantage to "own server." --John ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "John W. Baxter" Newsgroups: comp.lang.python Subject: cmsg cancel <281220010711395869%jwbaxter at spamcop.net> Control: cancel <281220010711395869%jwbaxter at spamcop.net> Date: Mon, 31 Dec 2001 04:08:33 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775353 27193 211.57.49.2 (31 Dec 2001 05:09:13 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:09:13 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From junkster at rochester.rr.com Fri Dec 21 06:59:07 2001 From: junkster at rochester.rr.com (Benjamin Schollnick) Date: Fri, 21 Dec 2001 11:59:07 GMT Subject: Python on the desktop References: <94e3fce8.0112210053.2568529d@posting.google.com> Message-ID: In article <94e3fce8.0112210053.2568529d at posting.google.com>, sarat_venugopal at yahoo.com (Sarat Venugopal) wrote: > 1. If python is to permeate the realm of commercial desktop (in > whatever scope), we need the ability to convert it into a native > executable(I have taken a look at some of the limited solutions > available from individuals). I read somewhere, it may never be > possible in Python. Can anyone throw light on this? > Most commercial applications wouldn't want to expose the source code > or even leave it as byte-code(Note: ActiveState has announced a > compiler for Perl) There is at least two different solutions... For the PC Platform... 1) Gordon Mcmillian's Installer, quite a nice package.... (Supports *nix, & Windows) 2) PY2exe On the Macintosh, you don't even need anything in addition. They include a complete freeze system, that allows you to create binaries... On the unix side, you should also be able to use the freeze package that's included with Python?? > 2. Absence of a standard GUI, which really fits the major platforms. > For a lanuage like Python, this is really a handicap. Would I do it in > Tkinter on Windows? No way. I guess that's why there are so many other > independent implementations out there. There is so much fragmentation > of effort here(Analogous to KDE, GNOME,...on Linux). Tkinter works reasonably well... But there are other packages out there with interfaces available for python. The main reason, I've used Tkinter is it works cross platform with my Macintosh & PC programming. It does of course matter where you are cross-platforming to & from... Check out the Vaults of Parnassus : Python Resources web site.. Most of the GUI projects should be listed there... > 3. Does the community see Python as a full-fledged programming > language? I remember Zope being projected as the killer app for > Python. Does that mean Python is going to hide behind web servers, be > yet another general/web scripting language and probably a rapid > prototyping tool? I guess the language deserves a better treatment. I use python as a full & complete programming language, because it is....Ask 100 people, and get 50 different answers....Everyone has their own answer... - Benjamin From akuchlin at mems-exchange.org Fri Dec 14 11:31:56 2001 From: akuchlin at mems-exchange.org (Andrew Kuchling) Date: 14 Dec 2001 11:31:56 -0500 Subject: Unsung Python modules Message-ID: <3dsnad226b.fsf@ute.mems-exchange.org> There are some Python modules that deserve to be more widely known outside of the Python community, because they're such handy timesavers. My list of modules that don't get enough publicity would include: * The Python Imaging Library, which reads and writes a large number of different image formats and can perform a number of different operations on images. I find it indispensible for writing little utility scripts that resize all the images in a directory or generate an HTML image gallery. * Reportlab, for generating PDF files: I can't believe that people would wrestle C code for pdflib when they could just write Python code. * PyQt/PyKDE, which doesn't seem to get much respect in the KDE community. (Maybe my perception is wrong?) * Perhaps also the ZODB, as it's just so neat and convenient to use, but it's also quite Python-specific. What's your favorite unsung module? --amk (www.amk.ca) Oh, those are my subconscious thoughts. I shouldn't listen to them too hard if I were you; I'm not all that proud of some of them. -- The Doctor, in "The Time Monster" From fperez528 at yahoo.com Sun Dec 2 13:13:54 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Mon, 03 Dec 2001 17:41:54 +2328 Subject: Draft PEP: string interpolation with backquotes References: <9uern5$hbk$2@peabody.colorado.edu> Message-ID: <9uh67a$eoe$1@peabody.colorado.edu> phil hunt wrote: >>>> "x is $x, f(x) is $f(x)" >>>> >>>>This to me is readable, unambiguous and very useful. >>> >>> To me it implies the same as: >>> >>> "x is %(x)s, f(x) is %(f)s(x)" % { 'x': x, 'f': f} >>> >>No. > > Wrong. Read what I said closely. I am right on this, beleive me. Well, no. But no point arguing, here's code to prove it means what I said, not what you did: In [1]: from Itpl import itpl In [2]: def f(x): return x**2 ...: In [3]: x=5 Here's what I said it meant, $f(x) would evaluate f(x): In [4]: itpl('x is $x, f(x) is $f(x)') Out[4]= 'x is 5, f(x) is 25' And here's your expression, copied verbatim: In [5]: "x is %(x)s, f(x) is %(f)s(x)" % { 'x': x, 'f': f} Out[5]= 'x is 5, f(x) is (x)' Not the same thing. Ping's Itpl module is, IMHO, *very* well done. >> $_whatever_ means: fully evaluate _whatever_, as far as it can be >>evaluated, and put its value in there. So it gives an interpolation >>syntax which is in fact much cleaner than perl's, with much less >>need for braces and name protection. > > If you want Perl-like features, you can always use Perl. What's wrong in this group every time someone suggests something that even remotely resembles perl there's a fanatic response to it? Cool down. I've used perl a lot, and am sick of it. I don't want python to become perl, but I simply keep an open mind to situations where in real, everyday work, I find it lacking. And I think the beauty of an open language is precisely that these discussions can be had. But obviously if everytime someone suggests something different (even if they are wrong) your response is to tell them 'if you don't like it get out of here', progress isn't exactly going to be very fast... > Easy: > > "some %s expression" % really_complex_expression() > > What's wrong with that? Nothing, for *one* expression. What if there's 50 evaluations that need to be done? As I said, *scalability* of the tool is the issue here. > > Anyway, having complex espressions interleaved with static text, > whether you do it the Perl way or the C++ way, makes the code less > readable, IMO. Or in certain cases, more readable. I'm not thinking of writing web pages here (which I know zilch about). But I often write code which analyzes a lot of scientific data and generates text file summaries of it. It's vastly clearer to be able to write: " Pos: ($i,$j,$k), Dist = $sqrt(i**2+j**2+k**2), Corr = $C[i][j][k]" than *any* of the existing alternatives in python. Here it is: In [23]: itpl(" Pos: ($i,$j,$k), Dist = $sqrt(i**2+j**2+k**2), \ ....: Corr = $C[i][j][k]") Out[23]= ' Pos: (1,2,3), Dist = 3.74165738677, Corr = 5' I read that line and I can know exactly what it's doing, what it evaluates and what data it will show. And I can dig out examples where things are 100 times more complicated than this. > I've re-read your whole post, and still don't see any problem. You > mention long strings with lots of lines and lots of values to fill > in. I've done that with the % oprator, with no problems. I disagree > that using a temporary variable here is a problem, to me it doesn't > reduce clarity at all. Let's see if the example I gave above shines some light on this. Think of a case like that, multiply by 100, and now spend three days building your table of temporary variables to make it work. No thanks. That's why I want clean string interpolation. Anyway, I'm trying to push the discussion simply because I've yet to see an argument that convinces me it's a bad idea. But I can always keep on using the Itpl module as I have until now. I honestly think python would be better off with the feature. But that's just my opinion, nothing else. Cheers, f. From aleax at aleax.it Tue Dec 11 12:37:13 2001 From: aleax at aleax.it (Alex Martelli) Date: Tue, 11 Dec 2001 18:37:13 +0100 Subject: Some stupid questions References: <9v5ea4$d1ek8$1@ID-119882.news.dfncis.de> Message-ID: <9v5g8b09pq@enews4.newsguy.com> "Another rookie" wrote in message news:9v5ea4$d1ek8$1 at ID-119882.news.dfncis.de... > > Hi I'm an old fart and a newbie. So I hope you'll bear with me and answer a > few basic questions for me. Feel free as patronizing as you want. > > I've just downloaded the latest version of Python 2.2, and have started > learning to program from the web tutorials. If I stick with it ...... > > ... Will I be able to compile my progs as executables, so that they can run > on anybodies machine, whether or not they have a version of Python > installed? There are separate tools that let you do that, py2exe (Windows-only) and McMillan's Installer (also-Linux, as well as Windows, I believe). > ... If not, does jpython or jython allow me to compile my progs as java > apps, so that they will run on any machine with java? Yes, Jython does allow that. Take care: Jython is currently 2.1, so don't start using features specific of Python 2.2 if you want to use Jython right now!!! In both cases, of course, there will be a "hefty" runtime (in a Java jar, or as Windows DLL's, etc) that your "stand-alone" applications will have to carry -- just as if they were written in any other language requiring significant runtime support, such as Visual Basic. Alex From dalke at dalkescientific.com Fri Dec 21 13:35:22 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Fri, 21 Dec 2001 11:35:22 -0700 Subject: Mild bug: pipermail/python-dev References: Message-ID: <9vvv85$gbk$1@slb5.atl.mindspring.net> Terry Reedy: >http://mail.python.org/pipermail/python-dev/ >has a link to an archive for a message mis-dated (one hopes) February >2005! > >Seems like mild bug somewhere but I have no idea where or where to >report. That's no bug report. It was part of the test of the time machine. Didn't you read the last PSU From greg at cosc.canterbury.ac.nz Sun Dec 9 23:55:06 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Mon, 10 Dec 2001 17:55:06 +1300 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C100BB2.6446E896@cosc.canterbury.ac.nz> <7da8d8f8.0112070206.49e1bef4@posting.google.com> <3C114F6D.D1E2D291@attbi.com> Message-ID: <3C14402A.A643702A@cosc.canterbury.ac.nz> Harald Hanche-Olsen wrote: > > What should the module do if you ask it to do the conversion? > It might silently assume today's rule will be in effect, it might > print a warning, or it might raise an exception. I think using the current rules is reasonable. Any sane program is going to keep the time in some standard absolute format internally, and use DST only for input & display purposes. The user enters the time assuming the current rules are in effect. If the rules change, the program will start displaying it using the new rules. DST does bother me for another reason, though: it makes some date-times ambiguous. Suppose something is scheduled to happen at 1:30am on the day DST ends. Okay... is that when my clock reads 1:30am for the first or second time that day? :-) -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From jwbaxter at spamcop.net Sat Dec 29 00:36:06 2001 From: jwbaxter at spamcop.net (John W. Baxter) Date: Fri, 28 Dec 2001 21:36:06 -0800 Subject: Is this a bug? References: <33e9b770.0112281857.563a36d4@posting.google.com> Message-ID: <281220012136066403%jwbaxter@spamcop.net> In article <33e9b770.0112281857.563a36d4 at posting.google.com>, Gilbert wrote: > Hi! > > I am wondering if the following results below imply any bug in Python > 2.2 or 2.1? > When I try to use float numbers, python 2.2 and 2.1.1 shows a little > bit different results (I think it is incorrect) from what I enter. > But python 1.5.2 seems to be okay? What is wrong? > > If you know why and how they are different, please let me know. > > Thanks! > > ----------------------------------- > > Python 2.2 (#1, Dec 23 2001, 09:30:32) > [GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-98)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> 653.34 > 653.34000000000003 > >>> > > ----------------------------------- > > Python 1.5.2 (#1, Oct 13 2001, 09:06:03) [GCC 2.96 20000731 (Red Hat > Linux 7.1 2 on linux-i386 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> 653.34 > 653.34 > >>> Python 1.5.2 is lying to you (by rounding off). Later versions are telling you the unpleasant truth. 653.34 doesn't exist in the representation used. [653.00, 653.25, 653.50, and 653.75 do exist...the other 96 are approximated.] YAPDFP --John From shalehperry at attbi.com Sun Dec 30 00:44:20 2001 From: shalehperry at attbi.com (Sean 'Shaleh' Perry) Date: Sat, 29 Dec 2001 21:44:20 -0800 (PST) Subject: Paramaterized local variable name In-Reply-To: <3C2EA509.63ACDDC9@earthlink.net> Message-ID: > > You probably want > > start = getattr(data[key][i], local_name) > > Now you can set local_name to a string "name" or "rev" > or whatever attribute of data[key][i] you want to > access. > I always forget about getattr (-; From timr at probo.com Sun Dec 30 17:17:06 2001 From: timr at probo.com (Tim Roberts) Date: Sun, 30 Dec 2001 14:17:06 -0800 Subject: regex question: backreferences in brackets References: Message-ID: Jeremy Jones wrote: > >I want to be able to match any character other than a character that I already matched and have a named (or numbered) group for. For example: > >""" >match_string = 'XXX|1|22|333|4444:' >test_compile = re.compile(r'XXX(.)[^|]{1}\1[^|]{2}\1[^|]{3}\1[^|]{4}(.)') >mymatch = test_compile.match(match_string) >if mymatch: > print "Found a match" > print mymatch.group(0) >else: > print "No match found" >""" > >The format of the strings that I am trying to match are 3 specific >characters followed by some delimter followed by N number of characters >other than the delimiter followed by the delimiter, etc. For this specific problem, wouldn't a string.split solution be more efficient and understandable? matches = match_string.split( match_string[3] ) -- - Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From ahimsa at inext.co.za Wed Dec 26 02:54:03 2001 From: ahimsa at inext.co.za (Ahimsa Consulting) Date: Wed, 26 Dec 2001 09:54:03 +0200 Subject: Python2.2 in Linux RH7.2 - Newbie Message-ID: <002301c18de2$8169bb80$0100000a@aeon2k> Hi folks I am dealing with a double whammy here: I am new to both Python and Linux. I have been able to call Python up in the Linux console in interactive mode i.e. '>>>'. I don't seem able to call up tkinter. Now I am probably doing something incorrectly. If someone could be kind enough to walk me through this process in baby steps bearing in mind my newbie status. Thanks Andrew From grante at visi.com Thu Dec 6 15:14:53 2001 From: grante at visi.com (Grant Edwards) Date: Thu, 06 Dec 2001 20:14:53 GMT Subject: Is it possible to kill a thread ? References: <9unnfb$6fp$1@wanadoo.fr> <3C0FCD72.A5FA167C@ccvcorp.com> Message-ID: In article <3C0FCD72.A5FA167C at ccvcorp.com>, Jeff Shannon wrote: > > guignot wrote: > >> I have a prog which launches a server, using thread.start_new >> call. When I destroy the gui, it keeps stuck, probably because >> the server thread is still running... Can the main prog cleanly >> die, or is there a way to kill the thread ? > > Create a threading.Event object, and pass it to the thread at startup. When > you want to close the application, set the event, and then join() the thread. > In the thread, you periodically check the event. When the event becomes set, > then the thread terminates itself. At that point, your main thread returns > from join() and you can finish shutting down. The problem with this is that one often creates a thread so that it can do some possibly blocking operation without stopping the rest of the program. If the thread is blocked, it can't check the event. If the thread isn't going to block, then why create a thread? [Yes, there are other reasons for splitting something into a thread, but in many cases I create a thread specifically because it's goign to block.] -- Grant Edwards grante Yow! .. are the STEWED at PRUNES still in the HAIR visi.com DRYER? From bernhard at intevation.de Tue Dec 18 06:48:06 2001 From: bernhard at intevation.de (Bernhard Reiter) Date: 18 Dec 2001 11:48:06 GMT Subject: PythonWare: Anyone using for real projects? References: Message-ID: <9vnadm$ghtj3$2@ID-89274.news.dfncis.de> In article , "A. Keyton Weissinger" writes: > Besides the pythonworks team, of course... (Somebody even answered to your post after reading this comment of yours.) > I read this review: > http://www.webreview.com/2001/07_20/developers/index02.shtml > > and have stayed away. First: The reviewer makes the mistake to equal "proprietory" software with "commercial" software. In fact Free Software can be commercial. In quality and in that professionals develop, maintain and support it for money. Having said that you can understand my following statement: I did not touch pythonworks yet and I know a lot of people who won't, because it is not Free Software. I prefer commercial Free Software to keep my independence from a vendor. I am happy to pay a reasonable amount to a Free Software project, but I cannot pay for the proprietory development of pythonworks. Regards, Bernhard -- Professional Service around Free Software (intevation.net) The FreeGIS Project (freegis.org) Association for a Free Informational Infrastructure (ffii.org) FSF Europe (fsfeurope.org) From logiplexsoftware at earthlink.net Fri Dec 21 19:18:39 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Fri, 21 Dec 2001 16:18:39 -0800 Subject: Python on the desktop In-Reply-To: <3C23CF6E.CD4BF4D3@engcorp.com> References: <3C23CF6E.CD4BF4D3@engcorp.com> Message-ID: <20011221161839.3bd8490e.logiplexsoftware@earthlink.net> On Fri, 21 Dec 2001 19:10:22 -0500 Peter Hansen wrote: > That would make the "standard GUI for the vast majority of platforms" > an LED and a power switch.... > > So why doesn't Python support LEDs and power switches? How can it > compete in the embedded marketplace?!? Actually, power switch support is built-in. You can test it by starting the Python interpreter and then pressing the power button on the front of your PC. Notice that the interpreter shuts down as one would expect ;-) Actually there are embedded applications that use Python - the Empeg mp3 player for one uses Python to control the user interface (which is, of course, an LCD). -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From logiplexsoftware at earthlink.net Fri Dec 28 16:12:59 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Fri, 28 Dec 2001 13:12:59 -0800 Subject: Book "python programming patterns". anybody read this?? In-Reply-To: References: Message-ID: <20011228131259.511686e7.logiplexsoftware@earthlink.net> On Mon, 24 Dec 2001 06:59:21 +1100 "Peter Milliken" wrote: > Generally the standard of maintenance programmer is just > not as good as developers (otherwise they would be developing, wouldn't > they? :-)) and so it is a well recognised tenant that I attempt to follow - > code for the lowest common denominator. Ugh! That hits a little too close too home for me. While it sounds reasonable, it flies in the face of my current situation: I'm forced to maintain thousands of lines of C code written by a man who was clearly very intelligent but a horrible programmer. He knew what he needed to do but didn't bother to learn the common idioms of C. I understand he learned C by reading a book on an airplane trip. Worse, since he was "developing" this system, he of course ran into unexpected customer demands (as will anyone), but rather than rework the system to support these extensions, he hacked them into place using #if defined(SOME_CUSTOMER). These often appear in the middle of functions that span literally hundreds of lines. Global variables abound. Maybe one-third of the functions have correct prototypes. When I started work porting this mess to gcc, I got over 7000 warnings and errors. Fixing many of these resulted in /more/ warnings. I discovered that he was simply redirecting any non-fatal warnings in his build process to a file so they wouldn't clutter his screen. Anyway, my point is, I think your statement is unfounded. There are undoubtedly cases where what you said is true, but to assume it's the common case is wrong - especially when you consider that many people (myself included) learned to program by developing applications, so the quality of coding in those apps is poor (I would probably cringe if I were to review code I wrote 10 years ago - some poor sod is probably cursing me right now as he tries to decipher some mess I wrote =) Besides, applications are often written without a good specification (or only a very basic one) so the developer is left winging it, adding features, learning new toolkits, etc, until the original architecture is obscured beyond comprehension. Take a look at many of the open-source projects around and you'll often find that one of the first things "maintainers" do upon acquiring a system is recode large portions of it to make it more readable/maintainable, etc. That said, I don't disagree with your tenant of coding for the LCD. While not always possible, it's good to keep in mind when one is tempted to write "clever" code =) Regards, -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From chrishbarker at attbi.com Fri Dec 21 12:46:26 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Fri, 21 Dec 2001 09:46:26 -0800 Subject: Files References: Message-ID: <3C237572.F6C0FBF9@attbi.com> Mark McEahern wrote: > > Q: Where can I get information about managing files > A: http://www.python.org/doc/Newbies.html for a bit more focus... -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From wolfson at uchicago.edu Tue Dec 4 21:04:47 2001 From: wolfson at uchicago.edu (Ben Wolfson) Date: Tue, 04 Dec 2001 20:04:47 -0600 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: On Tue, 04 Dec 2001 19:47:59 -0600, Cliff Wells wrote: > After reading this entire thread, I think there are valid arguments on > both sides, so I'll be avoiding both tabs and spaces in all my code. I understand several successful Perl and C programs are written that way. -- BTR Why does this Wolfson person see fit to clutter up Usenet with such absurd nonsense? -- Bob Cunningham in From jbell at iinet.net.au Fri Dec 21 17:15:54 2001 From: jbell at iinet.net.au (John Bell) Date: Sat, 22 Dec 2001 06:15:54 +0800 Subject: RELEASED - Python 2.2 final References: Message-ID: <3C23B499.F601B20D@iinet.net.au> Great! Will the RPM's be released pre Xmas too? John Bell Guido van Rossum wrote: > On December 21, just in time to be placed under the Christmas tree, > we're issuing the final release of Python 2.2. We're proud of this > release, and expect that you'll like it. Please check it out here: > > http://www.python.org/2.2/ > > Our thanks to everyone who helped test Python 2.2 during the alpha, > beta and release candidate phases, and to everyone who contributed > patches, feedback, and suggestions! Please continue to report any > bugs you find to the bug tracker: > > http://sourceforge.net/bugs/?group_id=5470 > > Highlights of what's new for this release are outlined below. For a > more complete list, please see: > > http://sf.net/project/shownotes.php?release_id=?????? > > What's new since 2.1 > -------------------- > > In brief (for PEPs, see http://www.python.org/peps/): > > - type/class unification (PEP 252 and 253) > - iterators (PEP 234) and generators (PEP 255) > - nested scopes standard (PEP 227) > - int overflows return longs (PEP 237) > - new operator // to future-proof int division (PEP 238) > > Andrew Kuchling has written a gentle introduction to the most important > changes, titled "What's New in Python 2.2": > > http://www.amk.ca/python/2.2/ > > A thorough introduction to the type/class unification is at: > > http://www.python.org/2.2/descrintro.html > > Status of the type/class unification > ------------------------------------ > > With a set of changes as large as this, it's unavoidable that after > the release we'll find that there are certain things that would work > better if we did them a little differently. Also, it is clear that > some of the new features (e.g. class and static methods, properties, > super, and slots, to mention a few) could use additional syntactic > sugar to make their use easier and more intuitive. > > This will almost certainly require us to make changes in future > releases. However, with the release of these features as part of the > Python 2.2 release, we are committed to the same standard of > release-to-release compatibility that we have used in the past, as > explained in PEP 5. > > When we feel the need to change things, we'll use the PEP system to > propose changes, and we'll provide warnings and backwards compatiblity > for at least a year -- or more in cases where a year is deemed too > short by the user community. > > In the meantime, we'll work on completing the documentation for these > features (both in Python and in the C API) as they are found in Python > 2.2. This documentation will clarify the status of individual > features. > > What's new since 2.2c1 > ---------------------- > > (Adapted from the Misc/NEWS file.) > > Type/class unification and new-style classes > > - pickle.py, cPickle: allow pickling instances of new-style classes > with a custom metaclass. > > Core and builtins > > - weakref proxy object: when comparing, unwrap both arguments if both > are proxies. > > Extension modules > > - binascii.b2a_base64(): fix a potential buffer overrun when encoding > very short strings. > > - cPickle: the obscure "fast" mode caused stack overflows on the Mac. > We fixed this by setting the recursion limit much smaller. If the > limit is too low (it only affects performance), you can change it by > defining PY_CPICKLE_FAST_LIMIT when compiling cPickle.c (or in > pyconfig.h). > > Library > > - dumbdbm.py: fixed a dumb old bug (the file didn't get synched at > close or delete time). > > - rfc822.py: fixed a bug where the address '<>' was converted to None > instead of an empty string (also fixes the email.Utils module). > > - xmlrpclib.py: version 1.0.0; uses precision for doubles. > > - test suite: the pickle and cPickle tests were not executing any code > when run from the standard regresssion test. > > Windows > > - distutils package: fixed broken Windows installers (bdist_wininst). > > - tempfile.py: prevent mysterious warnings when TemporaryFileWrapper > instances are deleted at process exit time. > > - socket.py: prevent mysterious warnings when socket instances are > deleted at process exit time. > > - posixmodule.c: fix a Windows crash with stat() of a filename ending > in backslash. > > Mac > > - The Carbon toolbox modules have been upgraded to Universal Headers > 3.4, and experimental CoreGraphics and CarbonEvents modules have > been added. All only for framework-enabled MacOSX. > > --Guido van Rossum (home page: http://www.python.org/~gu From pj at sgi.com Fri Dec 7 19:52:46 2001 From: pj at sgi.com (Paul Jackson) Date: 8 Dec 2001 00:52:46 GMT Subject: list comprehensions to effect visitors References: <3C1162D5.570DCEC6@engcorp.com> Message-ID: <9uro8u$ec0q0$1@fido.engr.sgi.com> Peter Hansen writes: > I'm not sure whether there is sarcasm in your posting, or not, > without a smiley, so I have to assume there was some objection. My definite sense in reading Jeremy's post was that it was tongue in cheek, meant in good humour. -- I won't rest till it's the best ... Manager, Linux Scalability Paul Jackson 1.650.933.1373 From eppstein at ics.uci.edu Wed Dec 5 14:01:09 2001 From: eppstein at ics.uci.edu (David Eppstein) Date: Wed, 05 Dec 2001 11:01:09 -0800 Subject: PEP 276 Simple Iterator for ints (fwd) References: <3C02E8FD.740D82FE@cosc.canterbury.ac.nz> Message-ID: I redid my lecture notes using Greg Ewing's "for lb <= var < ub" syntax in place of my previous "for var in [lb, lb+1, ... ub]". I'm happy with the result -- it's both more concise and (I think) more readable. I found to my surprise that, even though my previous syntax used closed intervals, what I really wanted were either half-open intervals (but half-open on the opposite side to that produced by range) or in one case a fully open interval. Greg's syntax handles this nicely. Note also that in one case I am using the "for" within a list comprehension, and the lack of nested brackets there is a further boost to readability. I'd be even happier if this could be made to work in actual Python instead of just Python-like pseudo-code. -- David Eppstein UC Irvine Dept. of Information & Computer Science eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/ From chrishbarker at attbi.com Tue Dec 4 14:01:49 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Tue, 04 Dec 2001 11:01:49 -0800 Subject: redistributing Python runtime with an application References: <3c0cf241$0$13459$39cecf19@nnrp1.twtelecom.net> Message-ID: <3C0D1D9D.A6400F33@attbi.com> Eric Cifreo wrote: > I've seen posts and websites saying that the license allows for > redistribution of Python's core, but I was wondering if there was a smaller > package or subset (analogous to Java's runtime environment, or JRE) of the > distribution. I suppose I could start copying files selectively to a clean > machine and figure it out that way but didn't want to reinvent the wheel if > someone has already done this, or at least doumented how one does it. > Anything out there already? check out McMillian's installer for Windows and *nix, and py2exe for windows. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From gleki at gol.ge Thu Dec 13 14:16:33 2001 From: gleki at gol.ge (Giorgi Lekishvili) Date: Thu, 13 Dec 2001 11:16:33 -0800 Subject: neral networks References: <3C17DA8F.931CAE22@gol.ge> Message-ID: <3C18FE91.A0B66DAB@gol.ge> Thank you all! Giorgi Lekishvili wrote: > hello all! > > I wonder if someone could indicate on a Python-written Neural Netowork > resources... > > Will SciPy ever contain it? > > Thank you, > Giorgi From jason at jorendorff.com Thu Dec 20 13:09:56 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Thu, 20 Dec 2001 12:09:56 -0600 Subject: tp_free and tp_dealloc? In-Reply-To: <20011219.123319.1139068338.8495@localhost.localdomain> Message-ID: Robert Nikander wrote: > I am writing my first extension types and am having a couple problems. One > is that I and am confused about the tp_free vs the tp_dealloc slots in > PyTypeObject. [...] So: 'tp_free' is opposite 'tp_alloc' > and 'tp_new' is opposite 'tp_dealloc' I think you are right. * tp_dealloc is the general-purpose destructor, and Python calls it when the object needs to be deallocated. tp_dealloc should destroy or dereference the object's members, then deallocate the memory for the object itself. If your object implements tp_free, then tp_dealloc should use tp_free to do the final deallocation. That is, the last line of tp_alloc should be: self->ob_type->tp_free(self); * tp_free only deallocates the memory that Python allocated for the object. It seems the core Python types only implement this when Py_TPFLAGS_BASETYPE is defined. They use either _PyObject_Del or _PyObject_GC_Del in this slot. > Also a Dog works fine but a Python subclass segfaults when the object is > dealloc'd. When you use PyArg_ParseTuple("s"), the pointer you get is a pointer to internal data in the string object. Don't free it and don't store it that way; instead you can either (a) maintain a reference to the string object or (b) strdup() the buffer and keep your own copy. ## Jason Orendorff http://www.jorendorff.com/ From dcarr1 at hotmail.com Thu Dec 27 07:21:57 2001 From: dcarr1 at hotmail.com (Dudley Carr) Date: 27 Dec 2001 04:21:57 -0800 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <35fda446.0112270421.7082ff87@posting.google.com> First and foremost, the rate at which a language is growing, especially in terms of industry acceptance, is always difficult to tell since rarely is a survey done to find out how many people are using a particular language across all industries. Personally, I use the following metric to see how a language is progressing: 1. Look at the number of Oreilly books (possibly books by other publishers) that have been or are going to be released in relation to the language. 2. Number of articles on programming websites using / explaining the language. 2. Look the support for new technologies in the language and its libraries. 3. Activity in the newsgroup is also very indicative esp. with the number of newbie questions flowing-in (mention in an earlier post). With that said, super-spectacular growth is not always the greatest thing. If we learned anything from the dot-com bust is that growing too fast has its consequences. Python, I believe, prides itself on its evolutionary rather than revolutionary approach to getting things done; and that's exactly how it ought to be (my Darwinian opinion of course). Another issue to address is this business of corporations adopting Python and/or producing Python products. Aside from ActiveState's Visual Python, Zope, Blender, and a handful of other products, people generally have a tough time regurgitating the list of Python products. This is probably due to the fact that Python manages to do so much out of the box, and if it doesn't its not that difficult to get Python to do what you want it to do. Regardless of all of this, it actually doesn't matter that a new Python product isn't introduced on a daily basis. Take C-shell or the Bash shell for example, how many companies are producing products with those languages featuring on the front of the box? Does that mean that C-shell and Bash are not widely used? So where does Python stand in relation to Perl, PHP, Ruby or Javascript in terms of popularity? Who cares?! Python, although not the fastest beast on the block, scratches the itch that none of the other scripting languages seem to be able to do. Oh yeah, and Python is also fun. From philh at comuno.freeserve.co.uk Thu Dec 27 18:59:54 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Thu, 27 Dec 2001 23:59:54 +0000 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9901.998345FB@earthlink.net> Message-ID: On Thu, 27 Dec 2001 21:53:41 GMT, Ron Stephens wrote: >Also, one more thing: Guido was interviewed recently in a magazine and he >conjectured that programming for handholds and PDA's might be a huge niche for >Python in the future. Does anyone have any thoughts on this? I think Python has a lot of potential here. -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From kmilo0 at hotmail.com Thu Dec 27 07:05:47 2001 From: kmilo0 at hotmail.com (Kmilo) Date: 27 Dec 2001 04:05:47 -0800 Subject: Python 2.2 RPMs are here References: Message-ID: <19eb8d3d.0112270405.24ab492c@posting.google.com> Guido van Rossum wrote in message news:... > Sean Reifschneider made RPMs for Python 2.2. Go get 'em at: > > http://www.python.org/2.2/rpms.html > > --Guido van Rossum (home page: http://www.python.org/~guido/) What version of Tcl\tk y need for run tkinter? From justin at iago.org Thu Dec 27 13:31:11 2001 From: justin at iago.org (Justin Sheehy) Date: Thu, 27 Dec 2001 13:31:11 -0500 Subject: Python Popularity: Questions and Comments In-Reply-To: <3C2A9D33.67FEC261@earthlink.net> (Ron Stephens's message of "Thu, 27 Dec 2001 03:58:52 GMT") References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: Ron Stephens writes: > Furthermore, Ruby is aimed right at the heart of Python's niche. What niche is that? More importantly, why does this matter? The "aimed right at the heart" phrasing makes it sounds as though one must defeat and replace another. There's no reason why Ruby can't do just fine without this meaning anything negative about Python. > If we view Microsoft's Visual Studio, especially Visual Studio.net's C# > and VB, as the official 800 lb. gorilla of software development; and if > we view Java as the 400 lb. gorilla pretender to the throne; and if we > view Borland's Delphi and Kylix as no more than a smart leader of a > chimp; then everything else is the pack of open source chimps. Oh, you live in a windows-only world. Those are definitely all big players, but a lot of large and significant software happens in environments where VB et al are simply not viable options due to the fact that they tie you so tightly to one vendor's platform. Python runs in more places than any of the products/languages that you mention, and this matters a lot to a large number of people. > Ruby folks include those who like its more Perl-like syntax They can keep it. I love not having line noise mixed in with my programs. > They see Python as a compromise between object oriented and > procedural programming. So? Idealists are fun to talk to, but compromises get work done just fine. > What so you all think of Ruby, and its impact on Python? Ruby - seems decent enough, but I have no reason to use it other than playing around and because I like seeing how new and different language implementations work Ruby's impact on Python - Not much. For a while the biggest impact was that a few people would yell about Ruby's superiority at inappropriate times in various non-Ruby-related forums. That seems to have died off, and now Ruby seems to be doing just fine for a young language. This doesn't really mean all that much to Python, as it is extremely unlikely that either of these two languages will fully supplant the other. > 2. The economy is hurting Python's open source development model. It is? From my observations, Python itself has seen far more aggressive development in the past year or so than in any of the previous several years. Other than the one comment about Mark Hammond's situation, what makes you say this? -Justin From postmaster at sict.stc.sh.cn Mon Dec 24 04:42:26 2001 From: postmaster at sict.stc.sh.cn (postmaster at sict.stc.sh.cn) Date: Mon, 24 Dec 2001 17:42:26 +0800 Subject: Delivery Status Notification (Failure) Message-ID: <8C7wyfwjH00000c11@infocenter.sict.stc.sh.cn> This is an automatically generated Delivery Status Notification. Delivery to the following recipients failed. johncthompson at earthlink.com crocker3 at earthlink.com deen1 at earthlink.com brucemason at earthlink.com cajeska at earthlink.com jeepaddict at earthlink.com development1 at earthlink.com hestr at earthlink.com -------------- next part -------------- An embedded message was scrubbed... From: python-list at cwi.nl Subject: Do some research to determine what is true and what isn't. Date: Mon, 24 Dec 2001 02:27:31 -0800 Size: 4804 URL: From gh_pythonlist at gmx.de Sun Dec 23 07:02:19 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Sun, 23 Dec 2001 13:02:19 +0100 Subject: [distutils] [win32] Where to put support DLL? Message-ID: <20011223120218.GA2870@lilith.hqd-internal> Some of the installers I build with distutils need "support DLLs", for example the pyPgSQL win32 installer needs a DLL for PostgreSQL client library. I used to dump these into the Python directory itself, but recently I noticed that this only works if the Python directory (where python.exe is located) is in the PATH. I always do this, but it looks like the Python installer (up to 2.1.1 at least) doesn't put the Python directory in the PATH itself. Now, where's the best location to put such support DLLs. Putting the DLL in the same directory as the .pyd seems to work on Windows NT 5.x, but I'm not sure about the inferior flavours of Windows or even NT4 ... I don't like putting them into the System(32) directory of Windows, because I'd need to query environment variables or the registry for its location at the time the installer *runs*, and I don't think distutils has support for this. So it must be somewhere in the $PYTHONROOT hierarchy. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From michael.amrhein at t-online.de Wed Dec 26 09:03:29 2001 From: michael.amrhein at t-online.de (Michael Amrhein) Date: Wed, 26 Dec 2001 15:03:29 +0100 Subject: How best to check for existance of an attribute? References: Message-ID: "Roy Smith" schrieb im Newsbeitrag news:roy-A5844A.17044425122001 at news1.panix.com... > Michael Hudson wrote: > > By using hasattr? > > Doh! Thanks. I probably knew about hasattr() once (I first learned python > about 4 years ago), but forgot about it. > > It's kind of wierd -- I just "discovered" the insert() and pop() list > methods the other day, browsing the docs. I'm sure I read about them when > I was just learning the language, but they didn't seem to get bound to any > brain cells. I wonder what else I've forgotten about the language? Perhaps Mark Lutz' "Python Pocket Reference" (O'Reilly, ISBN 0-596-00189-4, $11.95) would be a good investment for you. :-) Michael From lucio at movilogic.com Fri Dec 21 17:51:57 2001 From: lucio at movilogic.com (Lucio Torre) Date: Fri, 21 Dec 2001 19:51:57 -0300 Subject: vi or emacs for editing Python on Linux? References: Message-ID: <3C23BD0D.6020709@movilogic.com> maxm wrote: > >One of my biggest problems in switching is my editor. On windows I use >Ultraedit as a general editor, and i type really fast in it. Knowing the >shortcuts and all. Every time I boot up one of my Linux machines I have a >hard time editing files under the arcane unix editors. I have tried both >emacs and vim and I disklike both! > >I know this is close to religion. But are there any rational reasons to use >one instead of the other for Python? > > > > When programming in Linux i usually use vim, mainly because im used to it, and because i use virtual consoles a lot. i can have 5 vims in memory and i wont notice it. but i think that if you have the oportunity to learn emacs, thats something you should do. emacs is really powerfull. and i think there is a version (commercial) of slickedit for linux. its a great editor if you want to pay for one. lucio ps: i still hit escape on word. > From martin at tactilis.co.uk Thu Dec 6 15:04:27 2001 From: martin at tactilis.co.uk (Martin Armstrong) Date: Thu, 6 Dec 2001 20:04:27 +0000 Subject: [ANNOUNCE] timeoutsocket.py version 1.21 References: Message-ID: In article , Timothy O'Malley writes >I've updated timeoutsocket.py to version 1.21. >Where: > http://www.timo-tasi.org/python/timeoutsocket.py > >This module enables a timeout mechanism on all TCP connections. It >does this by inserting a shim into the socket module. After this module >has been imported, all socket creation goes through this shim. As a >result, every TCP connection will support a timeout. > >The beauty of this method is that it immediately and transparently >enables the entire python library to support timeouts on TCP sockets. Is there any reason that this has not been included in the standard library? -- Martin Armstrong From wurmy at earthlink.net Sat Dec 29 03:26:20 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Sat, 29 Dec 2001 08:26:20 GMT Subject: posting the code - further to odd problem References: Message-ID: <3C2D7CDB.4E3CC449@earthlink.net> Dave Harrison wrote: > However the packet class code is as follows : > > import string > pdic = {} > > class Packet: > def __init__(self, info): > self.buildDic(info) > > def buildDic(self, info): > for item in info: > split = string.split(item,"=") > if (len(split) > 1): > pdic[split[0]] = split[1] > > def getVal(self, key): > if pdic.has_key(key): > result = pdic[key] > else: > result = '' > return result It puzzles me how you can do for pac in paclist: print pac.getVal() (as quoted from your previous post) and not get an error, since getVal takes a key as its argument. Which leads me to suspect that this wasn't actual code. :-) Anyway, I don't know what kind of items Packet takes (I got it to work with a list of strings like "a=1" etc), so I cannot do much there. However, I do notice that all packet instances share the same dictionary (pdic). Maybe this has something to do with it? Packet has no attributes, so I wonder where it takes its value from. --Hans From frankimmich at gmx.de Fri Dec 7 03:30:17 2001 From: frankimmich at gmx.de (F.Immich) Date: 7 Dec 2001 00:30:17 -0800 Subject: How to use win32.NetUseGetInfo() Message-ID: Hello there, I have a question concerning the win32net module. I want to map the networkpath (UNC) to the corresponding network resource within Python. E.g. E: = \\server1\dr1\dir2 Therefore I think I have to use NetUseGetInfo() ? But I get the following error thread: import win32net > dict = win32net.NetUseGetInfo( None, 'E:' , 0 ) > > Traceback (most recent call last): > File "C:\info.py", line 4, in ? > dict = win32net.NetUseGetInfo( None, 'E:' , 0 ) > pywintypes.api_error: (2250, 'NetUseGetInfo', 'Die Netzwerkverbindung > konnte > nicht gefunden werden. This tells me that the Network connection couldn’t be found... But the DOS command: net use E: works fine !!! What’s wrong. Am I using the .NetUseGetInfo() command correct ? Thanks for Help Ciao Frank From phd at phd.pp.ru Fri Dec 21 09:03:00 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Fri, 21 Dec 2001 17:03:00 +0300 Subject: SMPP module in Python ? In-Reply-To: <3c233408$1@news.mt.net.mk>; from gdamjan_DELETE_@on.net.mk on Fri, Dec 21, 2001 at 02:06:47PM +0100 References: <3c233408$1@news.mt.net.mk> Message-ID: <20011221170300.B8259@phd.pp.ru> On Fri, Dec 21, 2001 at 02:06:47PM +0100, Damjan Georgievski wrote: > > I have SMPP module in my archive. It is not mine, I downloaded it (3-4 > > Can you send it to me please, my e-mail is Sorry, I found it is SNPP, not SMPP. Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From rscrawford at mossroot.com Thu Dec 27 13:48:07 2001 From: rscrawford at mossroot.com (Richard Crawford) Date: 27 Dec 2001 10:48:07 -0800 Subject: REPOST: Replacing Python 2.1 with 2.2 in Cygwin Message-ID: <1$--$$_----_%_-$_$@news.noc.cabal.int> I have Cygwin running on my Windows 2000 computer. I have Python 2.1 installed, and would like to replace it with Python 2.2. I had assumed (wrongly, I guess) that when I installed 2.2 it would automatically overwrite 2.1, but that wasn't the case. How do I accomplish this, anyway? ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: rscrawford at mossroot.com (Richard Crawford) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:37:25 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775675 27193 211.57.49.2 (31 Dec 2001 05:14:35 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:14:35 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jason at tishler.net Tue Dec 18 08:15:02 2001 From: jason at tishler.net (Jason Tishler) Date: Tue, 18 Dec 2001 08:15:02 -0500 Subject: Cygwin socket library status enquiry In-Reply-To: References: Message-ID: <20011218131502.GA2268@dothill.com> On Tue, Dec 18, 2001 at 03:45:46AM +0000, Andy Todd wrote: > "Steve Holden" wrote in > >Can anyone tell me what's going on? Not really. All that I can offer is that Cygwin Python passes test_socket with the Cygwin (i.e., not Python) caveat below. > I believe that there are still some socket problems with Cygwin, although > most have been addressed by recent versions of the DLL. In particular there > were problems with Win98 that have now been resolved on my installation. Andy brings up a good point -- What platform are you using? 9x/Me or NT/2000/XP? If 9x/Me, then try under NT/2000/XP. If NT/2000/XP., then try to post a minimal C test program that exhibits the problem to cygwin at cygwin.com. > I don't think everything is solved with the current port of Python though. > By searching the Cygwin mailing list for 'python' and 'socket'; > > http://cygwin.com/cgi-bin/htsearch?method=and&format=builtin- > long&sort=time&config=htdig&restrict=%2Fml%2Fcygwin%2F&exclude=&words=pytho > n+socket > > (excuse wrapping of URL) it looks like Jason is still ironing out socket > problems and has been working on them as recently as a couple of days ago; > > http://sources.redhat.com/ml/cygwin/2001-12/msg00639.html The root cause of the above problems are completely unrelated to sockets. They are actually caused by Cygwin's fork() which requires all DLLs in children to be based at the same address as in the parent. Otherwise, the Cygwin DLL causes the child to abort during fork(). Python's test_socket just happens to be one way of tickling this problem. In fact, the situation has been recently exacerbated since many libraries that were previously static have just been updated to be shared (e.g., OpenSSL). Hopefully, a DLL rebasing technique will solve this fork() problem for Python and other applications. Jason From jadestar at idiom.com Sat Dec 29 10:45:15 2001 From: jadestar at idiom.com (James T. Dennis) Date: 29 Dec 2001 15:45:15 GMT Subject: REPOST: Re: Newbie Programming References: <84fd22ef.0112192032.14c75f8a@posting.google.com> <7xwuziv3st.fsf@ruckus.brouhaha.com> Message-ID: <0$--$$_----___%$%$@news.noc.cabal.int> Paul Rubin wrote: > manutd8611 at softhome.net (Evan Roman) writes: >> I have just begun programming in Python a couple months ago. While i >> feel like i am doing OK, i don't think im getting any better. The >> problem is i can't think of anything to program... I think I have most >> of the fundamentals down, but i can't think of any ways to use them. >> I was just wondering if there was some website that gives ideas of >> little projects to do so that one could sharpen his programming >> skills. Thanx in advance for all the help. > Think of some other area that interests you--photography, flying, > music, or whatever. Then think of some programs you'd like to have, > that are related to that subject. Then write the programs. Get any old college programming textbook (for any high-level programming language like C, Pascal, even Cobol, or whatever). Skip all the stuff about programming in "those" languages and go right for the "Exercises" sections (usually at the end of each chapter). Just do the exercises. Advantage: really old textbooks can be had pretty cheaply. That's O.K. for your purposes since you're only interested in the excercises and problems. Of course you can also work on translating any of the code snippets they give in their examples from "their" programming language into Python. Disadvantage: these are likely to focus on procedural programming rather than OO (object oriented) design. Personally I think people should have a firm foundation in procedural programming before they muddy their minds with lots of OO terminology and concepts --- but others disagree with me and say that learning a procedural approach will make adopting OO harder later. (That is basically parallel to the argument that even older "unstructured" programming techniques impaired one from learning "proper" structured techniques). If you do go through something like a book on Pascal or C, it will help if you think of "classes" (implementations of objects) whenever you see Pascal records or C structs (user defined data types). The big conceptual difference is that you have to think not only of the data's structure (the fields and types of components to your aggregate data types) but also of the operations that are valid for instances of that data type. For example if you have a record of people, and a member (field, element, whatever) called "gender" then it stands to reason that you'll need functions to set a given person's gender --- presumably as new instances of this type of variable are created (or "instantiated" to use the OO terminology). Of course there is the (somewhat unusual) case of a person's gender changing sometime after they are born so you might need to also account for that possibility. In traditional, procedural, programming you'd just worry about the data structures and you'd have to have all of your code that used those records/types enforce any rules about the validity values that might get assigned to them. (Gender might be constrained to "" (unknown) "M" for "Male" and "F" for "Female" or "G" for "Garcon" and "F" for "Fils" or whatever). In OO you'd be encouraged to provide "methods" as part of the data type (the class). Thus the enforcement of data validity checking is conceptually localized to the type of data that's being manipulated. (That's why we might see a code fragment like: person.setGender("Male") in Python). Of course we could apply OO principles in writing our programs in non-OO languages. Some Pascal and C programmers might have provided a person_setGender() function and applied the discipline to perform *all* assignment operations on their person.gender data "member" (field, element, whatever the language at hand calls it) through this function. However, this does get more difficult as the number of structures gets larger and they start to form complex hierarchies of similar but variant types. Thus the main "objective" of an object oriented language is to allow this encapsulation of methods and members (parts of a complex data structure bound to the ways in which they can be manipulated) and to manage variant types (subclasses) in a reasonable way. You might say that OO tries to impose methods on our madness. (O.K., maybe we shouldn't say that). To give a mildly ludicrous example of how one might need such a subclass consider the future when we achieve intersteller travel and we start interacting with hypothetical Thoradians, which as I'm sure you know have nine different genders. In most other respects they have they same characteristics as human "persons" (at least in all the ones that are relevant to our equally hypothetical software application). Naturally we could list all of the Thoradians as being of "unknown" gender, or we could assign two or their nine genders to "male" and "female" and leave the rest as "unknown." Heck, we could even arbitrarily assign any number of their nine genders to each of our three categories. However, if other parts of our object rely on valid values for this field (let us say that we have a person.salutation() method which returns the appropriate form of address for Mr. Mrs. Ms. etc. based, in part, perhaps, on the person's gender), if that is the case then our software's inability to handle the multiplicity of Thoradian sexual variants might actually have some business impact on us. Rather than being mired in our legacy of software, we should be able to provide a new subclass of persons. In that case most of the software that was written to handle persons, even most of it that deals with gender and salutations wouldn't have to be modified. The setGender() and salutation() methods on the Thoradian persons could over-ride the simpler and more limited ones on our plain old Human (Vulcan and Minbari, etc) persons. We can then blithely call on: new_customer.setGender("Glarn") to handle that new Thoradian and address our bill thereto using new_customer.salutation() and the software that was using these data types (objects) would (hopefully) need little or no modification to support them. Two other disadvantages to the "old textbook" approach is that it will provide "toy" problems. That is a set of well-worn old exercises that are easy enough for a first or second year college (or high school) student to do alone in less than a week. (That's how homework works). Also many of these well-worn example problems have been solved by python modules (Hurrah for software re-use) and thus can be trivially done with one or two lines of Python. (For example most of the discussions about building and traversing lists, sorting lists of strings, and that sort of thing are trivial in Python even if they are interesting to first year students of Pascal or C). Even something as simple and innocuous as the old "compute the average of a sequence of numbers" (which is one of the oldest and most basic introductory programming exercises) can have subtle solutions in Python. Here's and example of two different functions which define "averages" (simple arithmetic means): #!/usr/bin/python def average(list): total = 0; count = 0 for each in list: count = count + 1 # or count += 1 in Python 2.x total = total + float(each) # or total += each '' return total/count def avg(l): return reduce(lambda x,y: x+y, map(lambda z: float(z), l)) / len(l) if __name__ == "__main__": import sys args=sys.argv del(args[0]) print average(args) print avg(args) Here we see one version, which is trivially readable and consists of six lines of code, and another which does the same thing in a single line of gobbledygook. A subtlety in this example is that I decided to use sys.argv as my test data set. That returns a list of strings, so I end up needing to use the float() function to coerce each element of this list from a string into a number. (Otherwise I'll build a long string called "total" and try to divide a string by a number which will throw an exception. If I make a simple change to my test suite (and require that the list passed to my functions be numbers rather than strings or anything else) then the comparison of these two versions of the averaging function (arithmetic mean, technically) isn't as lopsided: #!/usr/bin/python def average(list): total = 0; count = 0 for each in list: count = count + 1 # or count += 1 in Python 2.x total = total + each # or total += each '' return total/count def avg(l): return reduce(lambda x,y: x+y, l) / len(l) if __name__ == "__main__": import sys args=sys.argv del(args[0]) ### convert each to a number args = map(lambda x: float(x), args) print average(args) print avg(args) ... moving the map()'ing into __main__ has allowed a trivial simplification of the first version (float(each) simply becomes each) but makes the second one much simpler (to anyone familiar with lambda functions). Of course neither of these is object oriented. The problem hardly lends itself to OO approaches. We could create a class average with two members (current total and current count) and a few methods (constructor/initializer that detects the initialization arguments and (if it's a number) sets the total to that, count = 1 else if it's a sequence (list or tuple) attempts to coerce each into a float, add that to the total and keep incrementing the count. Objects of this class would always return their current value as total / count. They might also overload some common arithmetic and assignment operators such that code like: a = Average(6) a += 2 print a ... would print 4.0 (for example). In some OO languages we could do something like this. However, it would count as abusive mangling of operator overloading. About the only advantage to some "averaging" class would be that objects in that class could keep track of their own count, so that functions calling on them could add values to them, and get the current "running" average without regard for how many values have been added to the average. (This, in general, describes the problem with introducing OO too early in teaching programming: it imposes an additional layer of complexity and abstraction which becomes useful as problems scale beyond one point, but are an impediment up until then). ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "James T. Dennis" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:03:01 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774730 27193 211.57.49.2 (31 Dec 2001 04:58:50 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:58:50 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From mwh at python.net Fri Dec 21 16:16:59 2001 From: mwh at python.net (Michael Hudson) Date: Fri, 21 Dec 2001 21:16:59 GMT Subject: Distutils question References: <9vu28t$4g9$1@peabody.colorado.edu> Message-ID: Fernando =?ISO-8859-1?Q?P=E9rez?= writes: > Steve Holden wrote: > > > > Erm, Fernando means, of course, "...bug those folks a bit". At least, I hope > > he does. Otherwise see the recent post under "Huge dicts..." > > thanks for the correction. You know, us foreigners... > > Anyway, I looked up the 'huge dict' posts and didn't see anything distutils > related. What did you have in mind? A terrible pun. I would explain, but then I wouldn't have to shoot you because it would have already killed you. > btw, the recent postings to the distutils mailing list seem to point > to improvements, and the current docs (on the web, not the ones from > python 2.1) are indeed better. So I might wait out for 2.2 to come > out before complaining too loudly. Feel free (hurrah!). > I really hope distutils fully matures, it seems very nice but > yesterday trying to do things outside of the very narrowly defined > options of stetup() felt like a huge PITA. Maybe I'm just dumb. I think that's fair enough. The code for distutils is generally quite nice, though, so once you've got some idea how it works, sticking your head into the source becomes an option. At least that's what I've found (although I don't actually *use* distutils much, I just try to close bug reports on it :). Cheers, M. From joshm at taconic.net Thu Dec 27 23:20:46 2001 From: joshm at taconic.net (Joshua Muskovitz) Date: Thu, 27 Dec 2001 23:20:46 -0500 Subject: REPOST: using codecs for encryption? Message-ID: <8$--$$_----_-%__%$@news.noc.cabal.int> This just in, from the top of my head... Has anyone thought about implementing encryption libraries (des, pgp, &c) as codecs in 2.2? Would there be a way to pass a key (or keypair) to the codec? The codec would also have to maintain some sort of state somehow. I just think it would be really cool to be able to say something like: c = DESCodec(key) plaintext = 'shh, here's the secret formula...' ciphertext = plaintext.encode(c) ... c.resetState() plaintext = ciphertext.decode(c) -- josh -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Joshua Muskovitz" Newsgroups: comp.lang.python Subject: cmsg cancel <3c2bf123_2 at corp.newsgroups.com> Control: cancel <3c2bf123_2 at corp.newsgroups.com> Date: Mon, 31 Dec 2001 04:49:38 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775426 27193 211.57.49.2 (31 Dec 2001 05:10:26 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:10:26 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From matt at mondoinfo.com Wed Dec 12 16:22:51 2001 From: matt at mondoinfo.com (Matthew Dixon Cowles) Date: Wed, 12 Dec 2001 21:22:51 GMT Subject: time() returns strange message... References: <9v8gu9$44e$1@news.hccnet.nl> Message-ID: On Wed, 12 Dec 2001 22:07:20 +0100, Johan Barelds wrote: Dear Johan, >I am trying to use the time() function which strange results. My >code is the following: >import time >print time() >the result is: >TypeError: object of type 'module' is not callable The time() funcion is one of the various things in the time module: >>> import time >>> time.time() 1008192094.3810509 >>> time.ctime(time.time()) 'Wed Dec 12 15:21:52 2001' Regards, Matt From dmallwitz at cox.rr.com Sat Dec 22 00:41:17 2001 From: dmallwitz at cox.rr.com (David Mallwitz) Date: Sat, 22 Dec 2001 00:41:17 -0500 Subject: Comunicating through COM ports References: Message-ID: <3c24fa94_4@goliath.newsgroups.com> FW: Comunicating through COM ports Ah, ok. Two possibilities here - 1) download a Python distro that has the Serial package already incorporated (I know Activestate comes with it, not sure about PythonWare) or 2) figure out how to make the Serial module work with the plain vanilla Python install from python.org. Since 2.2 was just released I downloaded it from python.org and installed, then copied the Serial package over to libs/site-packages. This imports the Serial module just fine, but fails on the 'Serial.Serial' function apparently because 'elapsedTimer' can't be found. I'm guessing that it's just a PYTHONPATH issue, but I don't have time to work through it right now. I'll post the Serial module if you want to try the second option, but the fastest/easiest choice would be to download the Activestate distro (www.activestate.com). On the other hand, I'm kind of down on Activestate right now since the lastest release of their IDE 'Komodo' won't honor my home-user license so maybe it's time to give PythonWare a try (www.pythonware.com). Best, Dave "Alves, Carlos Alberto - Coelce" wrote in message news:mailman.1008962966.22789.python-list at python.org... I'm using Python 2.1 and I installed it through .exe installer from www.python.org -----Original Message----- From: David Mallwitz [mailto:dmallwitz at cox.rr.com] Sent: Friday, December 21, 2001 4:12 PM To: python-list at python.org Subject: Re: Comunicating through COM ports FW: Comunicating through COM portsWhich Python distribution are you using? Or did you compile from source? Dave "Alves, Carlos Alberto - Coelce" wrote in message news:mailman.1008955468.30561.python-list at python.org... Sorry, but as I said before, I'm under windows98 and I haven't such directory. Do I need to download that module from anywhere?!If so, give me an URL. -----Original Message----- From: David Lees [mailto:deblnonospammyno at raqia.com] Sent: Friday, December 21, 2001 1:46 PM To: python-list at python.org Subject: Re: FW: Comunicating through COM ports Python21/scripts/PythonSerial david lees > "Alves, Carlos Alberto - Coelce" wrote: > > Thanks for the example. But, where can I find such module Serial?! > > -----Original Message----- > From: David Mallwitz [mailto:dmallwitz at cox.rr.com] > Sent: Thursday, December 20, 2001 10:26 PM > To: python-list at python.org > Subject: Re: Comunicating through COM ports > > Comunicating through COM portsChapter 19 of Mark Hammond and Andy > Robinson's > 'Python Programmingon on Win32' covers this quit well, and with the > Activestate Python distro there is a multithreaded demo called > 'win32comport_demo.py'. But here's what I do - example is from a > console > connection to an old Cisco router. > > >>> from Serial import Serial > >>> ### open the COM1 port > >>> serialconfig = Serial.PortDict() > >>> serialconfig['port'] = Serial.COM1 > >>> serialconfig['rxBufSize'] = 4096 > >>> port = Serial.Port(serialconfig) > >>> port.open() > >>> port.write('show conf \r') > >>> x = port.read() > >>> x > 'show conf \r\nUsing 768 out of 32762 bytes\r\n!\r\nversion 11.1\r\nno > > service u > dp-small-servers\r\nno service tcp-small-servers\r\n!\r\nhostname > Router\r\n!\r\ > n!\r\nip subnet-zero\r\nno ip domain-lookup\r\n!\r\nhub ether 0 1\r\n > link-test\ > r\n auto-polarity\r\n!\r\nhub ether 0 2\r\n link-test\r\n > auto-polarity\r\n!\r\n > hub ether 0 3\r\n link-test\r\n auto-polarity\r\n --More-- ' > > Best, > Dave > > "Alves, Carlos Alberto - Coelce" wrote in > message > news:mailman.1008852145.28654.python-list at python.org... > Anybody could give me an example code of how connect/comunicate > through COM > ports (i.e. COM1, COM2). I'm under windows 98. > Thanks!!! > Carlos Alberto > COELCE/DPRON-Departamento de Projetos e Obras Norte > Fone: 677- 2228 > e-mail: calves at coelce.com.br > \|||/ > (o o) > --ooo0-(_)-0ooo-- > > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- > http://www.newsfeeds.com - The #1 Newsgroup Service in the World! > Check out our new Unlimited Server. No Download or Time Limits! > -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- > -- > http://mail.python.org/mailman/listinfo/python-list -- debl -- http://mail.python.org/mailman/listinfo/python-list -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- -- http://mail.python.org/mailman/listinfo/python-list -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- From DaveP at dpawson.freeserve.co.uk Thu Dec 6 00:55:50 2001 From: DaveP at dpawson.freeserve.co.uk (Dave Pawson) Date: 6 Dec 2001 05:55:50 GMT Subject: mp3info and python References: Message-ID: "Brett g Porter" wrote > I can't get the mp3info.tar file that's on the Vaults to expand > correctly, so I can't venture how they handle things, but I do have a > lot of experience with MP3 data. I think its a tgz file with a .tar extension, or the mime type is screwing it up. Only managed to get it via a linux download. > > Can you get the bit rate from mp3info? yes (neat) Assuming that you can, and it's > a constant bit rate file, the length in seconds is filesize / (bitrate > / 8). Nice to know, thanks. > > If there's ID3 data at the end of the file, subtract that from the > filesize before calculating. Is that of a fixed size please? the functions imply that the header info is stored in the id3 'header' if thats the right term. > > If it's a variable bit rate file, you will need to scan through the > file and count frames, multiplying by the constant # of milliseconds > per frame. No, its not vbr, and I've not seen such a constant in the file. Re my original question, is the total time of the file fixed in this id3 data, or is it the sum of each frame, possibly where each frame might be a song on a CD album? Other id3 heading stuff implies that might be the case. In which case, how do I skip from one set of header data to another? regards DaveP From philh at comuno.freeserve.co.uk Sun Dec 30 19:44:10 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Mon, 31 Dec 2001 00:44:10 +0000 Subject: REPOST: Re: Is learning Python "extraordinary"? References: <3C2E5706.5880983E@engcorp.com> Message-ID: <8$--$$_----__-%%%$@news.noc.cabal.int> On Sun, 30 Dec 2001 02:27:04 GMT, Courageous wrote: > >>I think that you're answering with the wrong comparison group as your >>background sample. Certainly I'd expect any professional developer to be >>able to pick up Python in a week. But, among the set of all students >>applying for university admission, how many of them have taught themselves >>Python? I think this is an important distinction. > >When I was in highschool, those individuals who self-taught themselves >computer programming languages I taught myself programming. (From the book "Illustrating BASIC")... > were of the rare breed who were destined >to later be technical wizards in their field. ...hmmm. >Passionately caring about >something above and beyond what you're made to do and having the >initiative to carry it out is a remarkable thing at any age; in a >young mind, it is spectacular. It shows initiative, and is to be applauded, but I wouldn't say spectacular. >Usenet urban legendry would have it that those who hang out in >computer programming language groups are generally taken from the >top 1% of their peers. This is true of comp.lang.python, at least :-) -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: philh at comuno.freeserve.co.uk (phil hunt) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:37:52 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009773992 27193 211.57.49.2 (31 Dec 2001 04:46:32 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:46:32 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From sholden at holdenweb.com Thu Dec 27 14:06:31 2001 From: sholden at holdenweb.com (Steve Holden) Date: Thu, 27 Dec 2001 14:06:31 -0500 Subject: REPOST: Re: Access Problem References: <3c289e2f$1_2@nopics.sjc> Message-ID: <2$--$$_----_%__%%$@news.noc.cabal.int> "John Yeager" wrote in message news:3c289e2f$1_2 at nopics.sjc... > Useing the following code to access a Access Database, I run into a problem > getting the Database to Autonumber the primary key > > Here is my code what am I missing > import time > import odbc > > Time = time.ctime(time.time()) > connection = odbc.odbc('Everquest') > cur = connection.cursor() > sql = "Insert into Member VALUES( '(Autonumber goes here )','test', > 'test','NULL','p','R300478','Testuser','Test','%s')" % ( Time ) > cur.execute( sql ) > connection.commit() > cur.close() > connection.close() > > So what am I doing wrrong here? > It would have been more helpful to supply the *actual* code (which I hope the above wasn't), along with the *actual* error message. I assume that the first field in the table's definition is the autonumbered one, but it's always dangerous to assume a particular column ordering in SQL - someone can modify the table definition later without your knowing, and your statement suddenly becomes invalid - or, even worse, puts values in the wrong columns! I'm thinking you probably need something like either: sql = """INSERT INTO Member VALUES (NULL, 'test', 'test', NULL, 'p', 'R300478', 'Testuser', 'Test', '%s')""" % ( Time, ) # Note this is now a tuple or something which uses explicit names for the database columns, and explicitly omits the key field (which then has NULL provided for it, which Access will replace with an autonembered value). Like: sql = """INSERT INTO Member (Field2, Field3, Field4, Field5m Field6, Field7) VALUES ('test', 'test', NULL, 'p' 'R300478', 'Testuser', 'Test', '%s')""" % Time # Tuple not needed with one substitution You should also note that you can supply the variable data as a tuple second argument to the execute if you use parameter substitution, whcih you should look up in the DBI documentation. regards Steve -- http://www.holdenweb.com/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!news.kigam.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Steve Holden" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:33:30 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775640 27193 211.57.49.2 (31 Dec 2001 05:14:00 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:14:00 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From stephen at theboulets.net Wed Dec 19 03:26:33 2001 From: stephen at theboulets.net (Stephen Boulet) Date: Wed, 19 Dec 2001 02:26:33 -0600 Subject: Complex numbers and division by zero errors Message-ID: Is there any package that handles division by zero errors in complex numbers gracefully? Thanks. -- Stephen From sdm7g at Virginia.EDU Wed Dec 19 20:31:56 2001 From: sdm7g at Virginia.EDU (Steven Majewski) Date: Wed, 19 Dec 2001 20:31:56 -0500 (EST) Subject: was: Take 2: PEP draft for expression embedding In-Reply-To: Message-ID: On Wed, 19 Dec 2001, Steven Majewski wrote: > I'm just pasting this from a python session: the class needs a descriptive > name: class EvaluatingDict ? > > >>> e = D(locals()) > >>> e['sin'] > > >>> e['x'] > 0.5 > >>> e['sin(x)'] > 0.47942553860420301 And if you tried to reproduce that example, I hope it was obvious that the lines that I left out were: >>> from math import * >>> x = 0.5 -- Steve From Scott.Daniels at Acm.Org Sat Dec 1 18:40:22 2001 From: Scott.Daniels at Acm.Org (Scott David Daniels) Date: Sat, 01 Dec 2001 23:40:22 GMT Subject: Converting an integer to base 2 References: Message-ID: <1103_1007250022@WanderLust> On Sat, 1 Dec 2001 16:44:40 -0300, "Alves, Carlos Alberto - Coelce" wrote: > Yeah, it works. But not for n=0, when we get the wrong result '' intead '0'. > >>> def ito2(n): > if n < 1: > return '' > else: > return itoa2(n / 2) + str(n & 1) > > > >>> ito2(0) > '' How about: def ito2(n): if n < 2: return str(n) else: return ito2(n / 2) + str(n & 1) From wolfson at uchicago.edu Thu Dec 6 12:57:34 2001 From: wolfson at uchicago.edu (Ben Wolfson) Date: Thu, 06 Dec 2001 11:57:34 -0600 Subject: Is it possible to kill a thread ? References: <9unnfb$6fp$1@wanadoo.fr> Message-ID: On Thu, 06 Dec 2001 12:10:11 -0600, guignot wrote: > Can the main prog cleanly die, or is there a way to kill the thread ? Maybe if you get it to mention Nazis? -- BTR Why does this Wolfson person see fit to clutter up Usenet with such absurd nonsense? -- Bob Cunningham in From kragen at pobox.com Sat Dec 1 05:45:30 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 01 Dec 2001 05:45:30 -0500 Subject: Using Python with a webserver References: Message-ID: <83bshjte0l.fsf@panacea.canonical.org> "Sam Scholey" writes: > I was interested in the prospect of using python with my webserver but a > search on the python site and on deja produced virtually zero results. Can > it be done? is it as easy as editing a few lines of code in the apache > httpd.conf file? Of course it can be done. Why would you have to edit httpd.conf? What do you want to do with Python anyway? Write CGI scripts? Use mod_snake? Use mod_python? From LLoeffler at home.com Mon Dec 3 21:27:26 2001 From: LLoeffler at home.com (Luke) Date: Mon, 03 Dec 2001 20:27:26 -0600 Subject: A pretty dumb newbie question References: <20011203212412.12737.00000727@mb-cs.aol.com> Message-ID: <3C0C348E.7000805@home.com> N64fan2017 wrote: > How would you calculate square root? I've tried > x**1/2 > Which doesn't work > Anbody? > from math import sqrt sqrt(x) From grey at despair.dmiyu.org Sun Dec 2 13:02:21 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Sun, 02 Dec 2001 18:02:21 -0000 Subject: The Ideals of a Python Hacker (was: Poll Results) References: <3bfd7f87@news.airtel.net> Message-ID: On Fri, 30 Nov 2001 10:38:00 +0900, Jonathan Gardner wrote: > They'd have to be. I can't seem to find a place to get paid to work in > Python yet. I can't imagine a guy with 3 kids trying to make a living by > programming python unless he is the rare guy that has a job in it. What does 3 kids have to do with it? You are aware that 25% of the female population in the US these days does not and will not have children? Why mention 3 rugrats at all? Just say "I can't imagine someone trying to make a living..." -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From geos at bigfoot.com Fri Dec 7 13:28:21 2001 From: geos at bigfoot.com (George Song) Date: 7 Dec 2001 10:28:21 -0800 Subject: Problems with PythonService.exe Message-ID: <2653ed03.0112071028.7d7585ba@posting.google.com> I'm just getting into making Python Windows Services and am having problems. I first started with the pipeTestService from both ActiveState 2.1 and 2.2 to no avail. Then tried Zope 2.4.3 and got the same result. The service installs ok, but when I try to start this is the Microsoft Management Console message I get: Could not start the Zope service on Local Computer. The service did not return an error. This could be an internal Windows error or an internal service error. If the problem persists, contact your system administrator. Any help would be greatly appreciated. Thank you. From sag at hydrosphere.com Thu Dec 13 13:26:37 2001 From: sag at hydrosphere.com (Sue Giller) Date: Thu, 13 Dec 2001 11:26:37 -0700 Subject: Difference in formatting list and tuple values In-Reply-To: Message-ID: <20011213182446134.AAA278@mail.climatedata.com@SUEW2000> For those who wonder why I use this construct, it's because it is a simple example taken from a more complicated one (taken from python module code - normalDate). I wanted to extend the formatting to accept a list as well as a tuple. self.normalDate = int("%04d%02d%02d" % normalDate[:3]) where normalDate is expected to be at least a 3-item tuple. I was surprised when I extended my case from normalDate being a tuple to normalDate also being a list, and got an error. I just wanted to understand what was going on, cuz I'm somewhat new to python. I knew that the list slice returned a list, and the tuple slice returned a tuple, and that the list was causing the problem but I couldn't figure out why.I had forgotten that % operator needs a tuple for its input. Thanks for the explanations. On 13 Dec 01, at 17:25, Dr. Des Small wrote: > sag at hydrosphere.com (Sue Giller) writes: > > > I am trying to format values from either a list or a tuple, and I am > > getting the following odd (to me) behavior. > > Well, you're doing an odd (to me) thing... From eoeqz at aol.com Sun Dec 9 18:51:14 2001 From: eoeqz at aol.com (eoeqz at aol.com) Date: 9 Dec 2001 23:51:14 -0000 Subject: whats up 199348867 Message-ID: <20011209235114.13542.qmail@vs00.tvsecure.com> Below is the result of your feedback form. It was submitted by (eoeqz at aol.com) on Sunday, December 9, 2001 at 15:51:14 --------------------------------------------------------------------------- : Hey! It's Heather. My livecam is starting in 20 minutes, so click below to watch me live and chat with me. Also, the membership and everything is free, and after you're done watching mine, you can watch 70,000 other guys and gals!
http://lllil.com/livewebcam



970995784 --------------------------------------------------------------------------- From samuel.siren at mailbox.swipnet.se Sun Dec 9 00:13:14 2001 From: samuel.siren at mailbox.swipnet.se (Samuel Siren) Date: Sun, 09 Dec 2001 05:13:14 GMT Subject: ftp upload with urllib or ftplib? Message-ID: This is my first posting to c.l.p. It it possible to _upload_ a file using urllib? E.g. to post the file contents, the username, and the password in the 'data', or something? Downloading an URL is done this way: contents = urllib.urlopen("http://x.com/f.html").read() So, can I _upload_ (i.e. write) a file, using ftp, with something like e.g.: status = urllib.urlopen("ftp://x.com/f.txt", [ username, password, open("t.txt","r").read() ]) Or, do I need to use the "ftplib" module to _upload_ a file? In that case, are there any good exemples on how to do that? I looked at the ftplib documentation on the web page http://www.python.org/doc/current/lib/module-ftplib.html but I didn't quite understand how to upload a file. (I'm no FTP expert, BTW, my FTP experience is limited do uploading and downloading files to my personal web page using FTP Voyager ...) Regards, /Samuel Sir?n, Stockholm, Sweden - - - - - - - - - - - - - - - / From cliechti_spam at gmx.net Fri Dec 7 15:12:20 2001 From: cliechti_spam at gmx.net (Chris Liechti) Date: 7 Dec 2001 21:12:20 +0100 Subject: string conversion and formatters References: Message-ID: [posted and mailed] "Spiffy" wrote in news:oZ8Q7.253287$W8.9366851 at bgtnsc04-news.ops.worldnet.att.net: > Hello! I am total newbie to programming and Python. I am teaching > myself with online tutes and documentaion. First, does anyone know > where the list of output formatters ( such as %d, %s, etc.) is in the > reference material? here: http://python.org/doc/2.1.1/lib/typesseq-strings.html >I know I have seen this list, but I cannot find it. > By the way, I'm using Python2.2 on Windows 98. > Secondly, here is my first real program.... > #Decimal/Hex Convertor > > def print_options(): > print "Options:" > print " 'a' decimal to hex" > print " 'b' hex to decimal" > print " 'c' print options" > print " 'd' quit" ever tried long strings?: """blah blah""" with this you could simply write one print and the string over multiple lines. > choice = "c" > while choice != "d": > if choice == "a": > dec = input("Decimal: ") > print "Hex: %X" % (dec) > elif choice == "b": > hex = raw_input("Hex: ") > print "Decimal: %d" % (hex) > elif choice != "d": > print_options() > choice = raw_input("option: ") > > Please dont laugh. It is supposed to convert decimals to hex numbers > and vice-versa. It works fine until you try to convert hex to decimal > and then here's what I get.... > Options: > 'a' decimal to hex > 'b' hex to decimal > 'c' print options > 'd' quit > option: b > Hex: A > Traceback (most recent call last): > File "C:\Program Files\Python2\convertor.py", line 17, in ? > print "Decimal: %d" % (hex) ^^^^^ these parentheses don't do anything useful here. if you want a single element tuple use "(hex,)". note also that your variable "hex" shadows the built in function "hex". i would sugest a difrent name. > TypeError: an integer is required > Why doesn't this work? raw_input returns a string. convert it with int(s,16) > I have tried using "string.atoi" and some other > things, but no luck. I am stumped. Please, if you have an explanation > or any hints to point me in the right direction, I would very much > appreciate it. ...just dont laugh at me...I'm a newbie! > Thanks, > Spiffy > > -- Chris From ajs at ix.netcom.com Sun Dec 2 11:24:00 2001 From: ajs at ix.netcom.com (Arthur Siegel) Date: Sun, 2 Dec 2001 11:24:00 -0500 Subject: variable scoping across imports? Message-ID: <002301c17b4d$c076e480$a9e1fea9@carol> Arthur Siegel wrote: > > I don't think things work this way, actually > > Fredick Lundh - > > >assuming Hans meant to write "reference to" instead > >of "copy of", it does work that way. > > Ahem. Fredick Lundh (copy/paste is safest to get it correct) writes - >apart from showing that you cannot be bothered to >spell my name correctly, what's your point? Just a quip - though your reaction doesn't shock me. 'Reference to/copy of' confusion of the novice being an issue I happen be to trying to get on some agenda. If you were already aware of the extent of it, or the issues of novice confusion is not high on your radar, I apologize for wasting bandwidth. Though someone suggested in that thread that a particular document of yours, moved into the tutorial level documentation, might contribute to a fix. I know you didn't respond publicly. but I would assume you would have no objection. >exercise: explain why Hans' statement is correct even >if you interpret "copy of" as "copy of" (hint: define "x") Clueless what you are getting at. When I become convinced that I have nothing to contribute to python.list discussions, I will go away. I am not there yet. But if you have an interest in contributing to that end, help me understand why this reference/copy confusion should *not*, at this time, be near the top on an agenda for anyone interested in Python as a learning language. Embarrass me. Art From Bruce at EckelObjects.com Sat Dec 8 21:09:32 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Sat, 08 Dec 2001 18:09:32 -0800 Subject: Calling a generator multiple times In-Reply-To: <9uu6rr01bna@enews2.newsguy.com> References: <9uu6rr01bna@enews2.newsguy.com> Message-ID: <200112081809320870.02588663@mail.rdc1.sdca.home.com> On 12/9/01 at 12:14 AM Alex Martelli wrote: >Bruce Eckel wrote: > ... >> I believe that this is too restrictive a definition. My experience >> of generators (from C++/STL) is that a generator is simply a >> callable entity that returns an object every time you call it; this >> call takes no arguments so it is "generating" objects rather than > >...so a Python generator such as: > >def imageneratorhonest(sequence1, sequence2): > for item in sequence1: yield item > for item in sequence2: yield item > >isn't a generator...? Exactly! It's actually the factory that creates the generator! The code makes my point: from __future__ import generators def gen(): while 1: yield 'spam' g = gen() print g for i in range(5): print g.next() This produces: spam spam spam spam spam 'g' is the generator object, and when you call next() (which takes no arguments, as I asserted), you get objects popping out. It's a generator in exactly the sense that I described (perhaps not so clearly): you don't give it any arguments when you call it, so it's creating using some internal algorithm. The factory that creates the generator can take arguments for its initialization. This is just like creating a generator class that has a constructor that probably takes arguments, and then using an object of that class with some kind of argument-less call to create the objects. It's just slicker using yield. Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From ggrp at quitte.de Wed Dec 5 07:36:39 2001 From: ggrp at quitte.de (Tim Goetze) Date: 5 Dec 2001 04:36:39 -0800 Subject: 'static' class properties in extension types References: Message-ID: ggrp at quitte.de (Tim Goetze) wrote in message news:... > class C: > const = 1 > > can somebody tell me if, and how I can create the equivalent of > 'C.const' if C is not a Python class, but a type implemented in a C > extension module? no question shall ever remain unanswered: PyType_Ready (my_type) PyDict_SetItemString (my_type->tp_dict, "const", PyInt_FromLong (1)); in case somebody else wonders, too ;) From jeff at ccvcorp.com Tue Dec 4 17:27:43 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Tue, 04 Dec 2001 14:27:43 -0800 Subject: more fun with PEP 276 References: Message-ID: <3C0D4DDF.AAA24655@ccvcorp.com> James_Althoff at i2.com wrote: > The (claimed) advantages with this scheme include: > - no syntax changes required (!!!) > - handles all combinations of closed/open intervals > - handles descending as well as ascending intervals > - allows step size to be specified > - reuses the "i in iterator" paradigm of existing for-loops > - supports shortcuts for the common case of indexing from 0 to len-1 > - works outside of for-loops ("in" statement, list & tuple functions) > - no confusion with or overloading of list or tuple syntax > - no list versus iterator confusion > - is reasonably transparent (once you get used to it ;-) > - is straightforward to implement > > On the down side: > - not as immediately transparent as "-5 <= i <= 5" > Nor is it immediately more transparent, or shorter, or in much of any other way (that I can see) preferable to "range(10)" for i in 0 / span / len(mylist): #or even.. for i in span/len(mylist): versus for i in range(len(mylist): Hmmm... what's the advantage again? Seems like a lot of work for not much difference.... Jeff Shannon Technician/Programmer Credit International From rdsteph at earthlink.net Thu Dec 27 18:36:15 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Thu, 27 Dec 2001 23:36:15 GMT Subject: Two languages, too similar, competing in the same space. References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> Message-ID: <3C2BB10D.BD5002C7@earthlink.net> I find this very interesting. Thanks for sharing it, it sounds very useful! HarryO wrote: > On Fri, 28 Dec 2001 09:56:29 +1100, Ron Stephens wrote: > > > ... But > > now that Ruby is out there, it absorbs enormous mind share, and > > development time to recreate libraries etc., which are already available > > in Python, thus hurting Python. > > I have only tried it in a very minimal way, just to see that it did > basically what was advertised, but you might be interested in this. > > There's a Ruby library that allows you to do things like: > > require 'python' > require 'python/httplib' > > h = Py::Httplib::HTTP.new(host) > > h.putrequest('GET', path) > h.putheader('Accept', 'text/html') > h.putheader('Accept', 'text/plain') > h.endheaders() > > Ie, the "require 'python'" makes pulling in Python libraries > as simple as ... > > require 'python/SOME_PYTHON_LIB' > > which is almost as easy as doing it in Python. > > Similarly, referencing elements of such a library simply > requires prefixing them with "Py::". Once you have a > handle to a Python object, you call it the same way you > would in Python. I don't think one could make it much simpler. > > So, to some extent, it's possible to avoid reinventing the > wheel. How well this works, I can't say, just that the > examples I played with worked as advertised. > > Obviously, there's some overhead, in that it's running a copy > of the Python interpreter to execute the Python code, but so > long as the work the library is doing for one is larger than > the actual overhead of the call to it, that shouldn't be a > problem. From aleax at aleax.it Fri Dec 28 11:14:32 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 17:14:32 +0100 Subject: How best to check for existance of an attribute? References: <3c28f373$0$79558$6e49188b@news.goldengate.net> Message-ID: "Greg Krohn" wrote in message news:3c28f373$0$79558$6e49188b at news.goldengate.net... > "Roy Smith" wrote in message > news:roy-DD8C6B.16193025122001 at news1.panix.com... > > I've got a function which augments an object passed to it by adding a new > > attribute. Something like this: > > > > def addStuff (obj): > > obj.newAttr = "stuff" > > > > I want it to be an error to call addStuff() more than once for a given ... > This is what I would do: > > def addStuff (obj): > if hasattr(obj, 'stuff'): > raise MultipleCallError > else: > setattr(obj, 'stuff', None) class Tricky: newAttr = "aDefault" dick = Tricky() Now, addStuff(dick) would fail. Is this what the OP wants? Maybe (some of his examples "ways to do it" would behave the same way) but it doesn't quite sound right given the specs of "calling more than once". The point is just that hasattr also finds the attributes in the object's class. If you only want attributes _in the object itself_, NOT ones the object gets from its class, it's a bit trickier, depending on what exact range of cases you want to handle (e.g., can obj be assumed to have a __class__ attribute, as in Python 2.2, or do you have to check for that, too?). Assuming only objects with a __class__ are of interest (or that only Python 2.2 and up is of interest), then, maybe, a sentinel-like approach might be simplest: def addStuff(obj): class Unique: pass inclass = getattr(obj.__class__, 'stuff', Unique()) inobject = getattr(obj, 'stuff', inclass) if inobject is inclass: obj.newAttr = "stuff" else: raise MultipleCallError, obj This might still fail, depending on interning of "stuff", for: addStuff(obj.__class__) addStuff(obj) where the second call would be wrongly diagnosed as multiple. Is there a need to support this usage? Testing if obj.__dict__.has_key('stuff') might often help, but would still fail in 2.2 if obj didn't have a __dict__. Is THIS a problem? Only the OP knows... Alex From shriek at gmx.co.uk Fri Dec 21 09:19:16 2001 From: shriek at gmx.co.uk (Stephen) Date: 21 Dec 2001 06:19:16 -0800 Subject: Debugging Python serial I/O errors References: <97ae44ee.0112210043.5fc0421b@posting.google.com> Message-ID: <97ae44ee.0112210619.76fb0ff8@posting.google.com> > Having a hell of a time trying to read serial I/O on my > redhat 7.2 machine, with a variety of methods ~ Doh, what a dork. I forgot the CRLF at the end of each command ! The USPP version works fine now but raises a question of whether to use blocking comms or not (see below). PosixSerial also works sweet. The f=open("/dev/ttyS1", "rw") still doesn't work and I'm starting to think that the post I saw that used such syntax was perhaps a bit dubious :) Playing with USPP did raise a question though ~ should one use blocking comms on a serial port ? It seems to be the only way to get fast response, derived as follows ~ Let's say you use a timeout of say 1000 ms and read() from the port. >>> p = uspp.SerialPort("/dev/ttyS1", 1000, 19200) >>> p.write("AT\015\012") >>> p.read() '\015' >>> p.read() '\012' >>> p.read() 'O' >>> p.read() 'K' You get the idea, p.read() is tiresome, getting one char at a time.' So, let's get several characters at once ? How many ? We don't know yet, so let's be safe and get 64 chars. >>> p.write("AT\015\012") >>> p.read(128) Bang, it hangs. The only way to get around this seems to be to use a timeout of 0 which denotes blocking. >>> p = uspp.SerialPort("/dev/ttyS1", 1000, 19200) >>> p.write("AT\015\012") >>> p.read(128) '\015\012OK\015\012' And this is by far the easiest way to interact with the serial port. >From my previous work with socket servers last month, it seemed that blocking was frowned upon. Using a serial RS-232, performance is never an issue since it's crap period, but if the hardware connected to the serial port should fail for some reason, I that a blocking call could be left waiting indefinitely. Is this correct ? Anyway, sorry for disturbing you all with such a trivial original query ~ the error messages I got in response made me think it was a comms problem. I'm sure there's an axiom that says you'll always spot the bug after posting to the mailing list ! Stephen. From danielk at aracnet.com Fri Dec 28 21:35:51 2001 From: danielk at aracnet.com (Daniel Klein) Date: Fri, 28 Dec 2001 18:35:51 -0800 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2CBACB.FBF3C3C9@mindspring.com> Message-ID: <1$--$$_-----$$--%$@news.noc.cabal.int> On Fri, 28 Dec 2001 12:32:49 -0600, "Dr. David J. Ritchie, Sr." wrote: >On the other hand, just to stir the pot a little and because I believe you should be able >to argue both sides of an issue, I would say when it comes to semi-critical >and critical applications, there are features of Java (like strong typing) >that at least mandate a certain level of consistency between all execution paths. Python is as type-safe as Java, it's just that the type is not checked until runtime whereas Java checks it at compile time. But Java certainly cant check _everything_ at compile time so it also has to do some measure of runtime checking. Sheesh, what a hack! All that extra coding just to achieve about a 1% gain in checking for errors. Blech!! Daniel Klein ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Daniel Klein Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:36:50 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774910 27193 211.57.49.2 (31 Dec 2001 05:01:50 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:01:50 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From fredrik at pythonware.com Fri Dec 21 11:28:19 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 21 Dec 2001 16:28:19 GMT Subject: Issues with Python 2.2. regex References: <9vtm2e$9fs$06$1@news.t-online.com> Message-ID: J?rgen Hermann wrote: > Given this: > > (?P^\s*(?P=+)\s.*\s(?P=hmarker) $) > > Python 2.2 reports groups for the nested named parens, while previous > versions do not. If this is unexpected, I'll isolate this effect in a little > script. what previous versions did you try this on? if I apply the above expression to the string "=== hello === ", groupdict() returns the same dictionary for all versions I have installed (1.5.2 through 2.2) { 'hmarker': '===', 'heading': '=== hello === ' } what did you get? From qrczak at knm.org.pl Sun Dec 9 16:52:43 2001 From: qrczak at knm.org.pl (Marcin 'Qrczak' Kowalczyk) Date: Sun, 9 Dec 2001 21:52:43 +0000 (UTC) Subject: Multi-isinstance idiom (Re: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)) References: <9urd59$ilt$1@peabody.colorado.edu> Message-ID: Fri, 07 Dec 2001 14:42:27 +2328, Fernando P?rez pisze: > Can you comment on list comprehensions vs. map? I tend to shy away > from the convenience of comprehensions because I'm afraid of their > cost and --at the expense of clarity-- pretty much anything can be > written with map(). I think (and a quick test confirms) that [ for x in L] is faster than map(lambda x: , L) but [(x) for x in L] is slower than map(, L) IOW map is faster when you have the function ready and apply it for the LC case, and LC is faster when you have the body ready and wrap it in a function for the map case. This may even be a reasonable guide for choosing either variant for readability. The dictinction is quite well-defined: usually you either begin with an expression and can wrap it in a function, or begin with a function and call it. There is no confusion between these cases, which may not be obvious but it's true. The only doubt is when you have *different* optimal sources for the body and the function. For example Class.method as the function wrt. x.method() as the body (of course they don't behave identically but they can be exchangable in the given case), or the operator module wrt. the expression with an operator. They are not comparable using this criterion. -- __("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ QRCZAK From jkraska at san.rr.com Mon Dec 10 01:11:17 2001 From: jkraska at san.rr.com (Courageous) Date: Mon, 10 Dec 2001 06:11:17 GMT Subject: Calling a generator multiple times References: <0gn21usqeasqa1bp4sveh0vjagtmbmfpof@4ax.com> <3C11FE92.1218662@letterror.com> <3C144BFE.F0D3659@cosc.canterbury.ac.nz> Message-ID: <96k81u4fltftg3kl540be5n27452vqnppg@4ax.com> > In practice (how you think about them), generators *are* > functions, but with the twist that they're resumable. >This could perhaps do with some elaboration. Maybe more like a revision. Thinking about them as functions isn't right. When you call a function, it's code executes. When you call a generator, something else executes which prepares the code the programmer wrote for execution. While people will get to used to it just fine, let's just say I happen to agree with the listing of this as a "wart". >It's at *that* point that some of us get the very >strong feeling that there is something wrong with >declaring a generator just like a function. Telling >us to go read the discussions or the PEP does >nothing to dispel that feeling. We've been there, >and have come to a different conclusion. Word. C// From henrik at moskau.hmotakef.homeip.net Tue Dec 18 11:05:57 2001 From: henrik at moskau.hmotakef.homeip.net (Henrik Motakef) Date: 18 Dec 2001 16:05:57 +0000 Subject: pymacs and rlcompleter References: Message-ID: <87bsgw1pju.fsf@moskau.hmotakef.homeip.net> o polite writes: > I miss a couple of things in emacs python-mode. > > 1) Folding a la pythonwin, scite > 2) command completion a al rlcompleter, pythonwin, scite > > Any hope of getting these functions with the promising pymacs? As I understood pymacs, it is not what you are looking for, but a possiblity to use python instead of emacs-lisp for configuration and extension. However, the "folding" question is easy: Use the "Outline" minor mode. It has a variable "outline-regexp" to specify what it should consider a collapsable "header". Setting this to "\t*.*:" works for me. hth Henrik From preben_er_t0ff at hotmail.com Tue Dec 18 16:38:38 2001 From: preben_er_t0ff at hotmail.com (Preben) Date: Tue, 18 Dec 2001 21:38:38 GMT Subject: Reading files Message-ID: I've noticed when I read/make a file on linux-based systems, they get messed up on win-systems. Sombody told me that it's the 'end-string' char thats different... Is this true? And how can I easily make a converter? just chop the endline char and replace it? From robin at jessikat.fsnet.co.uk Fri Dec 7 13:47:37 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Fri, 7 Dec 2001 18:47:37 +0000 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C100BB2.6446E896@cosc.canterbury.ac.nz> <7da8d8f8.0112070206.49e1bef4@posting.google.com> <3C110867.5263E6E6@attbi.com> Message-ID: In article <3C110867.5263E6E6 at attbi.com>, Chris Barker writes ..... > >Are there other technical issues with mxDateTime that make it unsuitable >for the standard lib? > .... the only problem with mx datetime is that the individual objects require quite a lot of storage. Last time I heard it was 32 bytes, but I'm not sure whether that is over and above what python needs for an object or includes it. Some business time series have thousands of entries and for intra day stuff there is no obvious frequency which would allow a convenient sparse representation of the times. Is storage an issue? Certainly time series analysis nerds think so, but if it's only a factor of 4 I guess it won't matter to pythoneers. -- Robin Becker From db3l at fitlinxx.com Sat Dec 22 00:44:48 2001 From: db3l at fitlinxx.com (David Bolen) Date: 22 Dec 2001 00:44:48 -0500 Subject: Python on the desktop References: <3C23CF6E.CD4BF4D3@engcorp.com> Message-ID: Peter Hansen writes: > That would make the "standard GUI for the vast majority of platforms" > an LED and a power switch.... And often we have to fight hard for that LED... -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l at fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/ From adina_levin at mindspring.com Sat Dec 8 23:14:25 2001 From: adina_levin at mindspring.com (adina_levin at mindspring.com) Date: Sat, 8 Dec 2001 22:14:25 -0600 Subject: Tinker vs wxPython ?- Opinions/Views References: <3ReQ7.21098$2Fd.14596@news1.bloor.is> <87elm62luf.fsf@speeder.org> <3C12E168.91F9129A@engcorp.com> Message-ID: <9uuoqt$cj9$1@slb3.atl.mindspring.net> For experienced programmers who are familiar with the basic GUI toolkit pattern, the Wx code examples are probably pretty obvious. For new programmers, the Tk tutorials will explain basic concepts such as a hierarchy of widgets, configuration with parameters, assigning callback options, and visual layout using constraints, grid, or page positioning. Wrote my first GUI app last weekend and struggled mightily with Wx, then gave up -- I wasn't able to pick out the patterns from the sample code. Then I read through the "Programming Python" chapters on Tkinter, and was enlightened. a-liberal-arts-major-who-learns-quicker-from-sentences-than-raw-code "Peter Hansen" wrote in message news:3C12E168.91F9129A at engcorp.com... > Roman Milner wrote: > > > > Tkinter Pros: > [...] > > Tkinter Cons: > [...] > > wxPython Pros: > [...] > > wxPython Cons: > [...] > > Difficult to learn [...] > > Less stable than Tkinter [...] > > I have to disagree with these two. > > I was able to create several attractive, simple interfaces > which looked like I wanted them much more quickly with > wxPython, and I have never had any stability problems with either. > > I found I had to fight with Tkinter at every turn, however, > to make my interface look like I wanted it to, and often > had to give up my ideal and go with something rudimentary. > With wxPython, I pictured what I wanted and created it. > Studying the demo app code went a long way towards making > the documentation acceptable. In fact, I think I would say > once I learned to use the source examples, I found wxPython > *better* documented for my needs than Tkinter was. > > Clearly this is a case of YMMV... > > -- > ---------------------- > Peter Hansen, P.Eng. > peter at engcorp.com From johannh at uclink.berkeley.edu Mon Dec 3 01:23:20 2001 From: johannh at uclink.berkeley.edu (Johann Hibschman) Date: 02 Dec 2001 22:23:20 -0800 Subject: splitting using '\' as a delimiter References: <200112030021.fB30LCM01808@mail.swissonline.ch> Message-ID: "Peoter Veliki" writes: > So the string.split and the re.split swap the order of the arguments??!! > What was the logic behind this decision? I think it was just that, for string.split, the string that you're splitting is the primary object, so it comes first. i.e. string.split(x, y) = x.split(y). Meanwhile, for re.split, the primary object is the re, so re.split(y, x) = y.split(x). Well, to be correct, re.split(y, x) = re.compile(y).split(x). -J From oren-py-l at hishome.net Sun Dec 16 11:34:41 2001 From: oren-py-l at hishome.net (Oren Tirosh) Date: Sun, 16 Dec 2001 11:34:41 -0500 Subject: Take 2: PEP draft for expression embedding In-Reply-To: ; from fredrik@pythonware.com on Sun, Dec 16, 2001 at 12:50:59PM +0000 References: Message-ID: <20011216113441.A1829@hishome.net> On Sun, Dec 16, 2001 at 12:50:59PM +0000, Fredrik Lundh wrote: > when you can get *exactly* the same advantages in a way that works with > *all* existing python versions and *all* existing syntax-aware tools. I was wondering what 'way' you are referring to so I searched for your previous postings and found the nice little i() function. It's a pity that it almost got lost amidst all the noise and flames. I guess I can live with an overhead of 4 characters per embedded expression. It is readable, compact and thankfully does not make use of eval() hacks like the Itpl module. So why is this technique not exactly common knowledge? All I see in Python sources is the ugly '%' formatting. Sure, it works, but the the fact that this issue keeps coming up from time to time shows that some people are not entirely happy about it. Some of them even write silly PEPs about string interpolation :-) Oren From matt at lorfeld.com Sun Dec 9 17:04:05 2001 From: matt at lorfeld.com (mlorfeld) Date: 9 Dec 2001 14:04:05 -0800 Subject: Populating a list Message-ID: <32c382ad.0112091404.6cfe4a56@posting.google.com> I am new to python (about 72 hours into learning), and am having problems with reading a file (sate abbreviations) with one item per line and populating each line into a list. The problem is that each item ends with \012 after each state ie WI\012. Here is the code that I am using: f=open('/home/mlorfeld/states.txt', 'r+') states=f.readlines()#populates a list from file f.close print states From loewis at informatik.hu-berlin.de Mon Dec 17 04:40:36 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 17 Dec 2001 10:40:36 +0100 Subject: Compiling Python with Tkinter References: Message-ID: Ben Ocean writes: > I do not have headers. I presume I could, and should, build the X > libraries. Not at all. You already have X libraries installed, so you should get the corresponding header files. > >Since you still did not mention what system you are using, it is hard > >to suggest a procedure for installing the headers. > > Sorry. RH71. Ok. 'rpm -i XFree86-devel-..rpm' should give you the header files; fill in version and arch as appropriate. > I don't use a GUI on my Linux box: I prefer the command line. I do serve > Web pages. I don't even know what X11 is used for so I don't guess I > develop any apps for it. Then you can't use Tkinter, either - it requires an X server for use on Linux. > > What do you want Tkinter for if you don't use X Windows? > > I'm building PIL into my python to use the libraries. That doesn't really answer the question: if you don't have X, you don't need Tkinter, either - not even if you use PIL. Regards, Martin From b_mcerlean at yahoo.com Fri Dec 7 11:26:58 2001 From: b_mcerlean at yahoo.com (Brian McErlean) Date: 7 Dec 2001 08:26:58 -0800 Subject: Multi-isinstance idiom (Re: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)) References: <3C0EAEBF.61858076@cosc.canterbury.ac.nz> Message-ID: "Mike C. Fletcher" wrote in message news:... > That doesn't seem to keep the semantics, it only works if the tested > class is an actual sub-class of your combination class, not if it's a > child of just one of the parents (that is, it's an "and" test with an > extra class added as well). If you want an or test, how about: > > try: > raise f > except (future.Step, yada, yada): > blah > except: > stuffWhenNotSubClass > > Problem is that it's nothing like intuitive, an explicit function like: > > def ismultiinstance( test, classes ): > for classObject in classes: > if isinstance( test, classObject): > return 1 > return 0 > > Would be much easier to read, though not very computationally efficient > (extra function call, loop overhead) compared to letting the C exception > machinery handle the project. > Since an empty list is false, how about: classes = [future.Step, future.Status, future.Announce, possibility.Observe, future.Incarnate, future.Start] if filter(lambda c,test=test: isinstance(test,c), classes): # body It should be reasonably fast, since the actual looping is in C, though its probably ugly enough that you should still put it in its own ismultiinstance function. Alternatively the list comprehension equivalent: if [c for c in classes if isinstance(test,c)]: # do something. Brian McErlean. From teyc at bigfoot.com Thu Dec 27 05:48:21 2001 From: teyc at bigfoot.com (Chui Tey) Date: Thu, 27 Dec 2001 20:48:21 +1000 Subject: A new message board is up References: <40dbad98.0112262232.1868734e@posting.google.com> Message-ID: Well, I guess this sounds the death knell of c.l.py. Chui Andrew Nguyen wrote in message news:40dbad98.0112262232.1868734e at posting.google.com... > A new message board (that doesn't have the Usenet delay) is up! > Xutilla is the admin. it is at > http://pub19.ezboard.com/fthepythonmessageboard95602frm1 > > Hope to see you! From kosatab at vscht.cz Mon Dec 3 04:21:32 2001 From: kosatab at vscht.cz (Beda Kosata) Date: Mon, 03 Dec 2001 10:21:32 +0100 Subject: more on "Is this considered black magic?" Message-ID: <3C0B441C.8000608@vscht.cz> More than 2 weeks ago there was a debate on how to call a method for each object in list. Because I missed it I'm replaying now. I personaly use map() for this: map( lambda o: o.method( args), objects) The solution is not very error prone, but when you know what you have in your list it works just fine. As a side effect you also get list of results. results = map( lambda o: o.method( args), objects) BEDA From gminick at hacker.pl Wed Dec 12 16:47:58 2001 From: gminick at hacker.pl (Wojtek Walczak) Date: Wed, 12 Dec 2001 21:47:58 +0000 (UTC) Subject: time() returns strange message... References: <9v8gu9$44e$1@news.hccnet.nl> Message-ID: Dnia Wed, 12 Dec 2001 22:07:20 +0100, Johan Barelds napisa?(a): >My code is the following: >========================================== >import time >print time() >========================================== >anyone any clues?? When you're using functions from modules, you must mark function as it is a part of module. So you're using following syntax modulename.function_from_module() So here it'll be: time.time() Take a look at Python's howtos and the one, about import's dangers. It should help you. -- [ Wojtek gminick Walczak ][ http://hacker.pl/gminick/ ] [ gminick (at) hacker.pl ][ gminick (at) klub.chip.pl ] From jkraska at san.rr.com Sat Dec 29 18:29:19 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 29 Dec 2001 23:29:19 GMT Subject: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> <3C2E498B.6DC757E0@stroeder.com> Message-ID: >> C and programmers who like C should die a slow and painful death for >> holding back the computer industry for two decades. > >Fully agree with that. *shrug* C's AT&T-approved follow-on turned into a textbook case of pathological creeping featurism. The few features which increased the language's expressiveness and clarity were overcome by dozens of elements of complexity and obfuscation that ruin any chance of the language being any more clear or understandable than what it replaces. I would venture a guess that was one of the driving forces of Java. Mass defection from an unwieldy monstrosity that droves of programmers would rather not use. C remains in use because it's a better portable assembly than its unnamed younger decendent, and likewise is quite clear. What I'm trying to say is that you're accusing C programmers of holding back the industry, without aknowledging that the good alternatives have been fairly scarce and polluted in and of their own right. Perhaps the Children of Bjarne should die a slow and painful death for the horror they've inflicted upon us and two decades of misdirection down entirely the wrong path. >:-/ C// From mwh at python.net Mon Dec 3 06:15:44 2001 From: mwh at python.net (Michael Hudson) Date: Mon, 3 Dec 2001 11:15:44 GMT Subject: a comment about PEPs References: Message-ID: philh at comuno.freeserve.co.uk (phil hunt) writes: > Whenever I have a peek at c.l.p, there are usually several threads going > suggesting improvements to the langauge. > > Why is this? Because threads that start with "Python's fantastic!!" don't usually garner many followups? Same sort of thing as "no news is good news". The advantage of PEPs is if someone writes one and it gets rejected there's a chance (and only a chance) of heading off the discussion the next time around. Cheers, M. -- (Unfortunately, while you get Tom Baker saying "then we were attacked by monsters", he doesn't flash and make "neeeeooww-sploot" noises.) -- Gareth Marlow, ucam.chat, from Owen Dunn's review of the year From bsturk at news.rcn.com Wed Dec 12 01:04:10 2001 From: bsturk at news.rcn.com (Brian Sturk) Date: 12 Dec 2001 06:04:10 GMT Subject: Python Vim Module - works References: <283adf56.0112110943.24784aad@posting.google.com> Message-ID: On 11 Dec 2001 09:43:20 -0800, Kevin Dahlhausen wrote: >> >> http://www.nh.ultranet.com/~bsturk/vim.html > > It looks sounds great. I'm having some trouble running it under NT > 4.0, SP 6, Gvim 6.0u though. It gives this error when :pyf vimsh.py > > line 181, in read > r,w,e = select.select([self.outd], [], [], self.delay ) > select.error: (2, 'No such file or directory') > > > Any ideas? Yeah, in the notes in the script I mentioned select() only works w/ sockets. Hopefully tonight I'll be uploading a new version which works much better under Windows, or better put, actually works under Windows. :) -- .-----------------------------------------------------,-------. | Brian M. Sturk - http://www.nh.ultranet.com/~bsturk \ C/C++ | .> )\,^a__ |--------------------------| bsturk at nh.ultranet.com | Java | ( _ _)/ /-." ~ | http://www.telengard.com `---------------------------`------| `( )_ )/ | Telengard Technologies Inc. - NT/*nix UI & device drivers | _<_s_<_s '-------------------------------------------------------------' From issac at myfirstlink.net Sun Dec 30 18:21:35 2001 From: issac at myfirstlink.net (Issac) Date: Sun, 30 Dec 2001 17:21:35 -0600 Subject: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) References: <3C2A9D33.67FEC261@earthlink.net><3C2BA7B8.35286DE3@earthlink.net><3c2de385.9780406@news.t-online.de><3c2deb81.11823921@news.t-online.de><871yhd7red.fsf@kursk.kassube.de><87ellcrfs3.fsf@kursk.kassube.de><20011230145819.59aa99a2.logiplexsoftware@earthlink.net><00c201c19182$61e3ce60$6401a8c0@mojave> <20011230154832.30814990.logiplexsoftware@earthlink.net> Message-ID: <010e01c19188$b9f8e1c0$6401a8c0@mojave> > On Sun, 30 Dec 2001 16:36:09 -0600 > "Issac" wrote: > > > Begging the question means assuming what you've set out to prove: > > > > http://skepdic.com/begging.html > > > > It doesn't mean leaving an obvious question unanswered. > > Interesting. I'll update my idiom collection =) This is one of those grey-area topics where it's not clear whether to go with common usage or with Webster's. Being a precision-monger, I prefer Webster's. > > He's probably trying to drive home the point that sizeof(int) isn't > > well-defined in the C language. On C implementations with 16-bit > integers, the > > function call results in an overflow. In this case, the answer is 23575. > > Indeed, that was all I could see (hence my point of saying > "machine-word-size" rather than "integer"), but it seemed too obvious (this > being the sort of thing C programmers deal with on a daily/hourly/minutely > basis), so I assumed I was missing some more obscure point. Whew. I was > worried for a second ;-) > > Regards, > > -- > Cliff Wells > Software Engineer > Logiplex Corporation (www.logiplex.net) > (503) 978-6726 x308 > (800) 735-0555 x308 > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.310 / Virus Database: 171 - Release Date: 12/19/2001 From brian.j.geddes at intel.com Tue Dec 4 13:47:37 2001 From: brian.j.geddes at intel.com (Brian Geddes) Date: Tue, 4 Dec 2001 10:47:37 -0800 Subject: DOS, Socket support? Message-ID: <9uj5ed$55m@news.or.intel.com> All - I'm searching for a version of Python (1.5.2 or newer, preferably) compiled for DOS, that has includes support for TCP/IP sockets (socket.py). After a bit of searching on the web I'm almost convinced that such a version does not exist, but I thought I'd check here before I gave up my search, as you've all been quite helpful in the past. :) I have found Python 1.5.2 compiled for DOS, but it was the executable only. I don't know the internals of socketmodule.c, but does anyone have an idea how difficult it would be to modify and recompile it for DOS? Thanks, - Brian Geddes From sholden at holdenweb.com Mon Dec 3 17:10:10 2001 From: sholden at holdenweb.com (Steve Holden) Date: Mon, 3 Dec 2001 17:10:10 -0500 Subject: Python, Glade and portability? References: <9ug2da$dqd$1@hermes.shef.ac.uk> Message-ID: wrote ... > Hi, > I have written some Python software in the past for my own > consumption in Linux. Now, there is a need to use that softare in other > "lesser" :-) OS, and I have been asked to port it to windows. > > I had written the software using Glade and python (and several Python > extensions), and I now realise that I'd need to re-write the GUI to > accomodate for windows. While this is easy enough to do (I'd just have > to re-write the UI module, probably using wxwindows or somesuch), I'd > rather not spend time on it, and I was wondering whether anyone knows of > an easier solution that might translate the XML produced by glade to > something which is useable in Windows. > > Any help appreciated Well I don't know whether this will help, but wxDesigner will produce XML descriptions of interfaces, so perhaps it might import them as well. So an XSLT transformation or similar might do. wxDesigner can be obtained under a trial license if you want to do some experimentation. regards Steve -- http://www.holdenweb.com/ From jeff at ccvcorp.com Thu Dec 27 13:16:00 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Thu, 27 Dec 2001 10:16:00 -0800 Subject: REPOST: Re: Range of characters? References: <3C2A074D.8214E5E0@earthlink.net> Message-ID: <8$--$$_----_%_-%_$@news.noc.cabal.int> Chris Dutton wrote: > in article 3C2A074D.8214E5E0 at earthlink.net, Mari Mcdade at > wurmy at earthlink.net wrote on 12/26/01 12:27 PM: > > > You don't need the string module, really, but using the literal > > string "ABCDEFGHIJKLMNOPQRSTUVWXYZ" seemed a bit ugly. ;-) > > Well, this is even less ugly then. > > from string import uppercase as u > for c in u: > print "%sython" % c I disagree that this is less ugly--it needlessly obfuscates the code, since at the for-loop, it's totally opaque as to what it is that you're iterating over. I *much* prefer having it read the very explicit 'string.uppercase' to having it only cryptically refer to 'u'. Jeff Shannon Technician/Programmer Credit International ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Jeff Shannon Newsgroups: comp.lang.python Subject: cmsg cancel <3C2B655F.92E3896E at ccvcorp.com> Control: cancel <3C2B655F.92E3896E at ccvcorp.com> Date: Mon, 31 Dec 2001 03:10:04 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775691 27193 211.57.49.2 (31 Dec 2001 05:14:51 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:14:51 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From marklists at mceahern.com Thu Dec 20 16:03:30 2001 From: marklists at mceahern.com (Mark McEahern) Date: Thu, 20 Dec 2001 13:03:30 -0800 Subject: Bug in % string formatting? In-Reply-To: <9vtiev$no8$1@peabody.colorado.edu> Message-ID: Try this: print format_string % (names['John'][:] + names['Jane'][:]) // mark From pieter.claerhout at pandora.be Sun Dec 30 15:29:46 2001 From: pieter.claerhout at pandora.be (Pieter Claerhout) Date: Sun, 30 Dec 2001 21:29:46 +0100 Subject: Manipulating Win32 attributes; newbie question. In-Reply-To: Message-ID: <000201c19170$b95589c0$893676d5@tsjernochill> These functions are declared in the win32api module. For more information, you can check the Python Win32 Extensions help file. You can also find this info online. Just check the following URLs: http://aspn.activestate.com//ASPN/Reference/Products/ActivePython/PythonWin3 2Extensions/win32api__GetFileAttributes_meth.html http://aspn.activestate.com//ASPN/Reference/Products/ActivePython/PythonWin3 2Extensions/win32api__SetFileAttributes_meth.html Cheers, Pieter -----Original Message----- From: python-list-admin at python.org [mailto:python-list-admin at python.org]On Behalf Of Peter Sent: Sunday, December 30, 2001 9:11 PM To: python-list at python.org Subject: Manipulating Win32 attributes; newbie question. Hello! I'm new to Python although I have a fair amount of experience with other languages (C++, Java, some Perl). I'm working on the Windows platform with Python 2.0. I have Pythonwin installed. My problem is that I need to manipulate some Win32 specific file attributes. In particular, I need to temporarly turn off the read-only attribute on a directory. In C I could use the Win32 API functions GetFileAttributes() and SetFileAttributes() to do this. I'm not sure how to get the job done with Python. I looked around in both the generic and Pythonwin documentation but I didn't see anything that addressed this issue. TIA Peter -- http://mail.python.org/mailman/listinfo/python-list From Bruce at EckelObjects.com Thu Dec 6 21:49:35 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Thu, 06 Dec 2001 18:49:35 -0800 Subject: list comprehensions to effect visitors In-Reply-To: <3C0FF014.CE683AA4@bioreason.com> References: <3C0FD573.B1EB891E@bioreason.com> <200112061337430460.01850546@mail.rdc1.sdca.home.com> <3C0FF014.CE683AA4@bioreason.com> Message-ID: <200112061849350910.02A297C8@mail.rdc1.sdca.home.com> >I thought "list comprehensions" was a typo >(should've been "...incomprehensions") until I discovered that >the leftmost element was evaluated anew for each element. >Suddenly it became easy to invoke the same method on a whole >collection of objects, without lambda: > > [foo.asTabSeparatedValue() for foo in selection] Whoa! (slaps forehead). I've wanted to do this very thing a bunch of times. And the gods of Python clearly anticipated my needs. >With list comprehensions many applications of the visitor design >pattern can be reduced to a single statement. Based on this, I fooled around with my visitor example until I got it to work in some fashion with list comprehensions. It cleaned up nicely. Note the last line, in particular: # Using list comprehensions to effect visitors. class Flower: def pollinate(self, pollinator): print `self`, "pollinated by", `pollinator` def eat(self, predator): print `self`, "eaten by", `predator` def __repr__(self): return self.__class__.__name__ class Gladiolus(Flower): pass class Runuculus(Flower): pass class Chrysanthemum(Flower): pass class Bug: def __repr__(self): return self.__class__.__name__ class Pollinator(Bug): pass class Predator(Bug): pass class Bee(Pollinator): pass class Fly(Pollinator): pass class Worm(Predator): pass import random rgen = random.Random() flwrs = [Gladiolus(),Runuculus(),Chrysanthemum()] flowers = [rgen.choice(flwrs) for i in range(10)] bee = Bee() fly = Fly() worm = Worm() [(f.pollinate(bee), f.pollinate(fly), f.eat(worm)) for f in flowers] At this point I'm trying to figure out (A) what does multiple dispatching mean in Python? (B) does Python already, in effect, *do* multiple dispatching, or perhaps just remove the need for it? >Sorry for the spewage. It's just that I see many posts from you >today, and am assuming you're working on "Thinking in Python" >(or something like it) and am hoping that you plan to cover >the foregoing therein. If you do, I'll have an *intelligible* >explanation of list comprehensions :) I am in fact feverishly translating "Thinking in Patterns" into "Thinking in Python" to prepare for my tutorial at the Python conference, which is due monday. I was certain it would be an enormous job as it was with C++ and Java to write these examples, but as usual Python changes everything, and I might even hit the deadline. Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From fperez528 at yahoo.com Fri Dec 21 12:45:26 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Sat, 22 Dec 2001 17:13:26 +2328 Subject: sys.excepthook and syntax errors References: Message-ID: Ben Wolfson wrote: > Occasionally when I'm in the python prompt and want to change working > directories, I forget where I am and type "cd whatever" instead of > "os.chdir(whatever)". Obviously this doesn't work. So I tried overriding > sys.excepthook so that when I did try the former, it would have the same > effect as the latter, but would otherwise report the error correctly. To > my surprise, it still wouldn't work most of the time. That is, I could do > this: > [snip] Try IPython (just announced an update) at http://www-hep.colorado.edu/~fperez/ipython It does what you want (and lots more). cheers, f From MarkH at ActiveState.com Mon Dec 10 21:29:48 2001 From: MarkH at ActiveState.com (Mark Hammond) Date: Tue, 11 Dec 2001 02:29:48 GMT Subject: FW: Win32all documentation? References: Message-ID: <3C157035.7020602@ActiveState.com> David Brady wrote: > Three things, again: > 1 - Finding the start menu folder so the script can > put itself there to continue running after each > reboot. win32com.shell.shell.GetSpecialFolderEx() - look up SHGetSpecialFolderEx in MSDN. > 2 - Launching an app and then monitoring it, waiting > for it to die. If you want to start the application, simply use win32process.CreateProcess(), then wait on the returned process handle. If an arbitary process, look at killprocname.py for an example of getting a process ID. > 3 - Walking through the start menu shortcuts and > renaming them. SHGetSpecialFolderPath, then simply using os.rename. > P.S. Bonus question. How can I change the desktop > background image in Win32 from Python? Thanks again! Not sure - hitting the registry directly I imagine. Possible also requires broadcasting a WM_SETTINGCHANGED message to all top-level windows. > P.P.S. No disrespect is intended towards Hammond & > Robinson, their book, or their documentation as > presented on the ActiveState site. None taken. I would *love* to fix this, but have about 500 things higher on the todo list. All contributions gratefully accepted :) Mark. From nospam at mega-nerd.com Tue Dec 4 03:05:23 2001 From: nospam at mega-nerd.com (Erik de Castro Lopo) Date: Tue, 04 Dec 2001 08:05:23 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <3C0BE492.5DACEA18@mega-nerd.com> <3C0C07DD.AD717FCF@ccvcorp.com> Message-ID: <3C0C8399.C2B27EB0@mega-nerd.com> Jeff Shannon wrote: > > David Bolen wrote: > > > Erik de Castro Lopo writes: > > > > > You really ought to try using nothing but tabs for indentation and > > > setting the tab width in your editor to whatever you prefer. > > > > > > This is so easy and works **SO** well. > > > > Always curious about this in an "all tab" world - how do you align > > continuation lines that aren't on a tab stop? > > And even if you *do* so, then how are they going to stay aligned when the > next person to look at it uses a different tab size? If all the indentation is all tabs it really doesn't matter. The **ONLY** problem is with mixed tabs and spaces and that should be caught as soon as possible. Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam at mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ "He who writes the code gets to choose his license, and nobody else gets to complain" -- Linus Torvalds From jason at jorendorff.com Sun Dec 9 17:34:41 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Sun, 9 Dec 2001 16:34:41 -0600 Subject: list comprehension performance vs. map() and filter() Message-ID: I read some code and ran some off-the-cuff benchmarks. And the winner is... well, it depends. map() and filter() pros: - Inner loop is C instead of Python bytecode. (Negligible.) - map() predicts the size of the result list and allocates it all at once. List comprehensions use list.append() instead. - map(F, L) only performs the name lookup for F once. [F(x) for x in L] puts the name lookup inside the loop. List comprehension pros: - Better-looking - In many situations, using map() means writing a lambda. The resulting loop, then, contains an additional function call. A list comprehension may compile to bytecode that doesn't perform any function calls at all. This is good because function calls are relatively expensive in Python. It looks like the last consideration is the most important. If using map() means extra function calls, the list comprehension wins. Usual benchmark disclaimers apply. Times given were measured using time.clock() on Win2000. Smaller numbers indicate faster code. Column 1: 10000 loops, len(L) == 100. Column 2: 100 loops, len(L) == 10000. Column 3: 1 loop, len(L) == 1000000. ---1--- ---2--- ---3--- Test one-argument map() 1.29 1.78 1.48 : map(lambda x: x%9*x, L) 1.09 1.54 1.59 : [x%9*x for x in L] 1.36 1.91 1.76 : map(F, L) 2.01 2.48 2.73 : [F(x) for x in L] Test one-argument filter() 1.53 1.77 1.67 : filter(lambda x: x%7 == 1, L) 0.80 1.05 0.98 : [x for x in L if x%7 == 1] 1.75 1.90 1.79 : filter(P, L) 1.74 1.89 1.87 : [x for x in L if P(x)] Test map(F, filter(P, L)) 1.75 2.01 1.96 : map(lambda x: x%9*x, filter(lambda x: x%7 == 1, L)) 0.86 1.12 1.07 : [x%9*x for x in L if x%7 == 1] 2.02 2.13 2.02 : map(F, filter(P, L)) 1.95 2.12 2.07 : [F(x) for x in L if P(x)] Test filter(P, map(F, L)) 2.84 3.47 3.29 : filter(lambda x: x%7 == 1, map(lambda x: x%9*x, L)) 1.28 1.56 1.45 : [x%9*x for x in L if (x%9*x)%7 == 1] 3.17 3.74 3.62 : filter(P, map(F, L)) 3.23 3.41 3.30 : [F(x) for x in L if P(F(x))] Test two-argument map(F, L, L2) 0.65 1.53 1.43 : map(add, L, L2) 1.37 14.28 34.08 : [x+y for x, y in zip(L, L2)] -- Jason Orendorff http://www.jorendorff.com/ From mkelly2002NOSPAM at earthlink.net Sun Dec 30 13:05:26 2001 From: mkelly2002NOSPAM at earthlink.net (Michael Kelly) Date: Sun, 30 Dec 2001 18:05:26 GMT Subject: REPOST: Re: win32all-141 for Python 2.2 References: <3C2D4676.5060700@skippinet.com.au> <3C2E6515.6A957604@bellatlantic.net> Message-ID: <2$--$$_----_%-__-$@news.noc.cabal.int> On Sun, 30 Dec 2001 00:51:24 GMT, David Lees wrote: >An >error occurs during win32all-141 installation saying that an AXScripting >Engine can not be registered. For what it's worth when I installed the python 2.1 from python.org the registration for WSH didn't work on my machine(Win98 2nd. ed.) so I downloaded the ActivePython 2.1 and it worked out of the box. I dunno' if it's the same issue on your system. Mike -- "I don't want to belong to any club that would have me as a member." -- Groucho Marx ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!easynet-tele!easynet.net!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Michael Kelly Newsgroups: comp.lang.python Subject: cmsg cancel <1olu2ucng1gn5gkl6p4vh2354evfgp7khk at 4ax.com> Control: cancel <1olu2ucng1gn5gkl6p4vh2354evfgp7khk at 4ax.com> Date: Mon, 31 Dec 2001 03:07:10 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774140 27193 211.57.49.2 (31 Dec 2001 04:49:00 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:49:00 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From mxp at dynalabs.de Thu Dec 13 05:09:57 2001 From: mxp at dynalabs.de (Michael Piotrowski) Date: Thu, 13 Dec 2001 11:09:57 +0100 Subject: Platform-independent GUID creation? References: Message-ID: "Steve Holden" writes: > Does anyone have a readily-portable equivalent to the pythoncom.CreateGuid() > function? On UNIX platforms that have DCE (most do, I think) you can use the uuid_* functions; on Linux you can use the UUID functions from e2fsutils or FreeDCE. I haven't used them from Python, but I've just written a Perl XS module that uses either DCE or e2fsutils. HTH -- Michael Piotrowski, M.A. From phd at phd.pp.ru Mon Dec 3 04:34:41 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Mon, 3 Dec 2001 12:34:41 +0300 Subject: executing .pyc file In-Reply-To: <5.1.0.14.2.20011203134639.03256bd8@202.95.131.154>; from tripp81@yahoo.com on Mon, Dec 03, 2001 at 01:53:41PM +0700 References: <5.1.0.14.2.20011203134639.03256bd8@202.95.131.154> Message-ID: <20011203123441.E2490@phd.pp.ru> On Mon, Dec 03, 2001 at 01:53:41PM +0700, Tripp Scott wrote: > has someone written a trick so i can directly execute .pyc in > unix? http://www.lyra.org/greg/python/#dev Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From eppstein at ics.uci.edu Tue Dec 11 12:25:03 2001 From: eppstein at ics.uci.edu (David Eppstein) Date: Tue, 11 Dec 2001 09:25:03 -0800 Subject: PEP 276 Simple Iterator for ints (fwd) References: <9uomtp$e1cbj$1@fido.engr.sgi.com> <9up46o$e2ost$1@fido.engr.sgi.com> <3C150188.C31AC4B8@ccvcorp.com> <30949732.1008057189@[192.168.1.100]> Message-ID: In article , com-nospam at ccraig.org (Christopher A. Craig) wrote: > > I said, the INTEGERS between x and y. > > > I know it's what you said you wanted, but it's not what y > i >= x > indicates for a float. Sure, the only reasonable default step size > for floats is 1, but that doesn't mean I have to accept that y > i >= x for > floats y and x means "integers such that y > i >= x". Your loop To me, "for y > i >= x" indicates that i should take on every possible value that makes y > i >= x true, just like "for i in L" indicates that i should take on every possible value that makes i in L true. This is only a reasonable thing to do if you restrict "every possible value" to integer. The set of floats that make the inequalities true is just too big, and it doesn't make sense to me to restrict to the floats that happen to be an integer plus one of the bounds. In other words, "step size" is a red herring, it happens to be true that what I mean by "for y > i >= x" can be implemented by a range with stepsize one, but that's not something I consider a primary part of the definition. Maybe the suggestion of "for i in y > ints >= x" is better because it makes the type declaration more explicit? -- David Eppstein UC Irvine Dept. of Information & Computer Science eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/ From dpj at world.std.com Sun Dec 9 21:37:31 2001 From: dpj at world.std.com (David P Jablon) Date: Mon, 10 Dec 2001 02:37:31 GMT Subject: CryptKit 0.9: cryptsock References: <7x667pw8ap.fsf@ruckus.brouhaha.com> Message-ID: In article , Peter Gutmann wrote: >... but [SPEKE] is itself patented, thus making it of academic interest only. Actually, there is commercial interest too, despite the resistance of those who dislike cryptography patents. >(Seems like half the password-assisted PKCs around exist mostly to avoid > patents on other password-assisted PKCs). This might also be interpreted as a sign of healthy competition in a capitalist system. ;-) -- dpj From ph.wuidart at wol.be Sat Dec 8 17:57:09 2001 From: ph.wuidart at wol.be (ph wuidart) Date: Sat, 8 Dec 2001 23:57:09 +0100 Subject: Python and MS SQL server 7.0 Message-ID: <9uu5rr$8ed$1@news.worldonline.be> Hello, I am beginner to Python and Tkinter.I interested to have module to connect MS SQL server 7.0 with Python (not ODBC) Thank you for your help. ph.w at caramail.com From wall at adinet.com.uy Sat Dec 8 12:08:38 2001 From: wall at adinet.com.uy (Walter Moreira) Date: Sat, 8 Dec 2001 14:08:38 -0300 Subject: lost interest? In-Reply-To: ; from johnroth@ameritech.net on Sat, Dec 08, 2001 at 07:07:50AM -0800 References: Message-ID: <20011208140838.C5989@casa.parque> On Sat, Dec 08, 2001 at 07:07:50AM -0800, John Roth wrote: > "Walter Moreira" wrote in message > news:mailman.1007781383.30878.python-list at python.org... > > Hi. > > > > I've been reading some of the catalog-sig archives and I wonder why > the > > interest of the community about something like CPAN is so small. When > a > > message about this thing pops up in c.l.py, it receives only one or > two > > answers and the thread dies, and in catalog-sig usually happens > something > > similar. > > What's the difference between the Vaults of Parnassus and CPAN? > I can usually find what I want on the Vaults. The Vaults are indeed great. But you cannot automatically download and install a module and its dependencies. That's the nice thing with siphon, for example. I don't understand yet the absence of interest in this topic. Walter -- -------------- Walter Moreira <> Centro de Matematica <> Universidad de la Republica email: walterm at cmat.edu.uy <> Home Page: http://www.cmat.edu.uy/~walterm From spahievi at vega.bg Sun Dec 30 06:30:53 2001 From: spahievi at vega.bg (Niki Spahiev) Date: Sun, 30 Dec 2001 13:30:53 +0200 Subject: Python Popularity: Questions and Comments In-Reply-To: References: <3C2A9D33.67FEC261@earthlink.net> <458b194a.0112282052.1123341@posting.google.com> Message-ID: <614456034.20011230133053@vega.bg> There is Python SQL engine which uses Metakit as storage. -- Best regards, Niki Spahiev ______________________________________ VEGA(TM) Internet Service Provider Scanned and protected by Inflex Tova pismo e provereno i zashtiteno ot programite "Inflex/Antivir". From aahz at panix.com Mon Dec 31 11:27:55 2001 From: aahz at panix.com (Aahz Maruch) Date: 31 Dec 2001 08:27:55 -0800 Subject: Cancel flood (was Re: REPOST: Re: Python Popularity: Questions and Comments) References: <3C2A9D33.67FEC261@earthlink.net> <2$--$$_----_-%$%%$@news.noc.cabal.int> Message-ID: NOTE: if you're going to followup to one of the resurrected articles, please remove the "REPOST: " from the Subject: line. I generally ignore all such articles (and may even stick them in my killfile); I'm sure I'm not the only one. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: TODAY! From philh at comuno.freeserve.co.uk Thu Dec 27 15:01:10 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Thu, 27 Dec 2001 20:01:10 +0000 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <35fda446.0112270421.7082ff87@posting.google.com> Message-ID: <9$--$$_-----$%$%-$@news.noc.cabal.int> On 27 Dec 2001 04:21:57 -0800, Dudley Carr wrote: >First and foremost, the rate at which a language is growing, >especially in terms of industry acceptance, is always difficult to >tell since rarely is a survey done to find out how many people are >using a particular language across all industries. > >Personally, I use the following metric to see how a language is >progressing: > >1. Look at the number of Oreilly books (possibly books by other >publishers) that have been or are going to be released in relation to >the language. > >2. Number of articles on programming websites using / explaining the >language. > >2. Look the support for new technologies in the language and its >libraries. > >3. Activity in the newsgroup is also very indicative esp. with the >number of newbie questions flowing-in (mention in an earlier post). 5. look at the number of projects using that language on Sourceforge. -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: philh at comuno.freeserve.co.uk (phil hunt) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:50:55 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775590 27193 211.57.49.2 (31 Dec 2001 05:13:10 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:13:10 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From vvainio at karhu.tp.spt.fi Thu Dec 13 03:47:36 2001 From: vvainio at karhu.tp.spt.fi (Ville Vainio) Date: 13 Dec 2001 10:47:36 +0200 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> Message-ID: "Fredrik Lundh" writes: > why not issue a WhitespaceTrollWarning whenever your name > is found in Python source code? Sure wouldn't break any of my > code. except CheapAdHominemAttack: pass -- Ville Vainio - http://www.tp.spt.fi/~vvainio - ICQ #115524762 Wild geese have no intention to cast a reflection Water has no mind to assume their form From jason at jorendorff.com Wed Dec 5 13:51:45 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Wed, 5 Dec 2001 12:51:45 -0600 Subject: dictionary question In-Reply-To: Message-ID: =?gb2312?B?1cXJ2bPb?= wrote: > Hello! > I have a question about python's dictionary,I have a dictionary > type variable, such as > dbs={'xk.dhs.org': '166.111.177.77', > 'www.symantec.com':'202.112.237.39', 'ftp.happynet.org':'166.111.160.7'} > When I input dbs['www.symantec.com']='202.112.237.15',I want to > get the result like that: > dbs={'xk.dhs.org': '166.111.177.77', > 'www.symantec.com':['202.112.237.39','202.112.237.15'],'ftp.happyn > et.org':'166.111.160.7'} > How to realize this function? Python's built-in dictionary doesn't behave this way. But you could write your own dictionary that does this. In particular, if you have Python 2.2b2 (the very latest), you can just write a subclass of dict: class multidict(dict): def __setitem__(self, key, value): if self.has_key(key): existing = self[key] if isinstance(existing, list): existing.append(value) else: dict.__setitem__(self, key, [existing, value]) else: dict.__setitem__(self, key, value) This changes the behavior of __setitem__ in the way you want. Try it out: x = multidict() x['alarmist.org'] = '199.93.70.6' x['jorendorff.com'] = '208.177.33.252' x['yahoo.com'] = '64.58.76.223' x['yahoo.com'] = '64.58.76.229' x['yahoo.com'] = '64.58.76.177' print x > When I input dbs['www.symantec.com']='202.112.237.39',how to > determine if this item has exists in dbs,if item has existed, the > result is still like this: [...snip...] > if item doesn't exist,then insert new value into dbs,How to > realize this function? It's a minor tweak to the above code. Instead of this... existing.append(value) you'll want to write this... if value not in existing: existing.append(value) > When I print dbs,I like the result as follows: > 'xk.dhs.org': '166.111.177.77' > 'www.symantec.com':'202.112.237.39' > 'www.symantec.com':'202.112.237.15' > 'ftp.happynet.org':'166.111.160.7' > How to realize these function? Override __str__(). I suggest something like this... class multidict(dict): ... same as above ... ... but add these methods ... def iteritems(self): for k, v in dict.iteritems(self): if isinstance(v, list): for item in v: yield k, item else: yield k, v def items(self): return list(self.iteritems()) def __str__(self): pieces = ["%r: %r" % item for item in self.iteritems()] data = ', '.join(pieces) return "{%s}" % data To really flesh out the class, you'll eventually want to override itervalues(), values(), popitem(), update(), and maybe a few more. If you're using an older version of Python, check out the UserDict module. -- Jason Orendorff http://www.jorendorff.com/ From tiberius at ms28.hinet.net Sat Dec 22 10:24:00 2001 From: tiberius at ms28.hinet.net (Tiberius Teng) Date: 22 Dec 2001 07:24:00 -0800 Subject: Strange behavior of weak references (weakref module) References: Message-ID: <6c92a8bc.0112220724.3eead183@posting.google.com> Thanks for your help, now I think I understand how function/method reference works ... Also for that neat WeakMethod() class ;) From dan at cgsoftware.com Sun Dec 2 02:29:57 2001 From: dan at cgsoftware.com (Daniel Berlin) Date: Sun, 2 Dec 2001 02:29:57 -0500 (EST) Subject: InterScan NT Alert In-Reply-To: Message-ID: On Sat, 1 Dec 2001 virus_catcher at oceanic.com wrote: > Receiver, AntiVirus Catcher has detected virus(es) in the e-mail > attachment. The Sender has been notified. Good thing, too. I was really worried it wouldn't notify *everyone it could find in a 8 million square mile area*. Ya know, this crap reminds me of the old days where we had losing mailers telling people about failures that they could do nothing about, and wouldn't affect delivery of mail (Like telling me that some machine 5000 miles away suffered a power failure, and thus, was temporarily not accepting mail, but I shouldn't worry, because it was queued up.) It's like these pieces of software are so damn proud they actually caught a virus for once, they feel they need to tell everyone they did it. I'm surprised it didn't start picking out every site along the mail route, and emailing everyone it could find at that site, telling them too. Of course, they'll probably just marry it to spam mail software, to get this type of effect. Hey, look! Component reuse! God forbid this piece of crap antivirus software be smart enough to just log this, tell only the sender, and move on. Maybe if someone was really paranoid, it could alert the administrator. Does it really need to alert everyone (And what exactly is the receiver supposed to do, since they don't have a virus anyway)? I'm half expecting to be watching CNN, and see "AntiVirus Catcher detected viruses, The World has been notified" scroll across the bottom. Apparently, the component to take care of notifying only the right people hasn't been written yet. But don't worry, they'll get to it right after they figure out how to count the number of viruses it found in the message, and change the output text. --Dan From hgg9140 at seanet.com Fri Dec 28 16:01:04 2001 From: hgg9140 at seanet.com (Harry George) Date: 28 Dec 2001 13:01:04 -0800 Subject: ANN: Pdx 1.4.1 (markup language) Message-ID: Pdx (POD Extended) is a markup language with backends for HTML, Latex, and Docbook. See: http://www.seanet.com/~hgg9140/comp/pdx-1.4.1/doc/index.html It is available at: http://www.seanet.com/~hgg9140/comp/ Recent changes: 2001-12-28: v1.4.1 - Revised documentation structure (GNU style README, INSTALL, etc.) 2001-09-03: v1.4.0 - Numbered_heads now provides final "." - C<...> preserves spaces. - Design History decomposed by releases. - Tables no longer require a caption. -- Harry George hgg9140 at seanet.com From kevin at cazabon.com Tue Dec 18 19:50:37 2001 From: kevin at cazabon.com (Kevin Cazabon) Date: 18 Dec 2001 16:50:37 -0800 Subject: Python CGI & File Permissions References: <6456b489.0112181009.3407d52b@posting.google.com> Message-ID: <5a4226f0.0112181650.6a954d5e@posting.google.com> I had a similar problem when trying to create a directory with os.mkdir(path, mode). Even though I passed 0777 as mode, it only created it as -rwxrw-rw-. The documentation says that should work, but it didn't for me (Python 1.5.2 and 2.1) I ended up giving up and using os.system("mkdir -m 777 path"). Kevin. bwaskiew at indiana.edu (Brian Waskiewicz) wrote in message news:<6456b489.0112181009.3407d52b at posting.google.com>... > I'm trying to use a Python CGI script to write a text file on a > Unix/Apache webserver. The problem is that the file created is owned > by 'nobody' and has permissions '-rw-r--r--'. I need to read and > append to the file in other scripts, so I need some way of changing > the file permissions. I tried os.chmod() and that didn't work. > > Thanks. From ulf.magnusson at ubm-computing.com Sun Dec 30 03:39:55 2001 From: ulf.magnusson at ubm-computing.com (Ulf Magnusson) Date: Sun, 30 Dec 2001 08:39:55 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <4VlX7.6657$l93.1694996@newsb.telia.net> <6o6s2u4pa4kvqben6ftatrfttu9s78ee1k@4ax.com> Message-ID: <6$--$$_----__-%--$@news.noc.cabal.int> "Courageous" wrote > >and to defeat the speed problem: an OPTIMIZING NATIVE CODE COMPILER > > You're not the first person to think of this. One of the problems > is that designing an optimizing native code compiler for a fully > dynamic language like Python is quite a difficult task. Yes I would be, personally I like to think of Python as the Inverse of C. C is: Easy to learn Genrates fast code and you have to write many lines of code to accomplish something. Python is: Hard to learn (well relativly to C) Generates piss pore performance code (I am sorry to say) A few lines of code does almost anything you want. I have been a dedicated C programmer for as long as I can remember, and a while back I realised that I had to adopt a *second* language a second default language that is. uhm, you know what I mean, we (community folks) learn a lot of languages to find one or two to stick with and to do our projects in. For me it is C and Python I am glad to say! Where was I, oh yes, we were discussing how difficult a task it would be to implement a compiler, Well I guess this will follow the C Inverse theory as well C in relativly easy and.... > > >1. Since the language is currently evolving very rapidly it is probably > > a bad time to start such a project, > > Not really. The basic parts of Python which the compiler needs to > support properly have been present for years. It has to do with > first class language access to the dictionary which exists in every > namespace, and how this first class access intertangles semantically > with Python itself. Or at least that is one major element of the > picture. IIRC, the generation of execution frames plays another role, > and these likewise offer first class accessibility in Python. Again, > they are intertwined. Good point. /U. Magnusson ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Ulf Magnusson" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:39:11 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774296 27193 211.57.49.2 (31 Dec 2001 04:51:36 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:51:36 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From gioco at nekhem.com Thu Dec 13 12:08:28 2001 From: gioco at nekhem.com (Corrado Gioannini) Date: Thu, 13 Dec 2001 18:08:28 +0100 Subject: Difference in formatting list and tuple values In-Reply-To: <20011213165905322.AAA289@mail.climatedata.com@SUEW2000> References: <20011213165905322.AAA289@mail.climatedata.com@SUEW2000> Message-ID: <20011213180828.D1802@zephyr> that's because the string formatting syntax requires a tuple (and not a list) as the argument after the "%". t[:1] is a tuple, l[:1] is a list. corrado. On Thu, Dec 13, 2001 at 10:00:56AM -0700, Sue Giller wrote: > I am trying to format values from either a list or a tuple, and I am > getting the following odd (to me) behavior. I can format the tuple > entry using %d, but I get an error when I use the same formatting > for the same data in a list. > Why does this happen? > > >>> l = [1,2,3] # list > >>> t = (1,2,3) # tuple > >>> print "%02d" % t[:1] # format first entry in tuple ok > 01 > >>> print "%02d" % l[:1] # get error with list > Traceback (most recent call last): > File "", line 1, in ? > TypeError: an integer is required > >>> print "%02d" % tuple(t[:1]) # cast to a tuple works ok > 01 > > -- > http://mail.python.org/mailman/listinfo/python-list -- Corrado Gioannini "Thought is only a flash between two long nights, but this flash is everything." (H. Poincar?) From schneiker at jump.net Sat Dec 29 15:47:05 2001 From: schneiker at jump.net (Conrad Schneiker) Date: Sat, 29 Dec 2001 14:47:05 -0600 Subject: Python and Ruby: a comparison References: <3C2B9A61.EE1618DB@earthlink.net> Message-ID: <2WpX7.1145$0s5.714029@news20> "Ron Stephens" wrote: > I initiated a thread over on comp.lang.python which has turned into > somewhat of a comparison between Ruby and Python, their relative > strengths and weaknesses. The thread is titled Python Popularity: > Questions and Comments. [...] > By teh way, I admire Ruby. Although I am a Python hacker at heart, I > enjoy this newsgroup, the Ruby community, and I think Matz is doing an > outstanding job. I do believe though, that Python and Ruby are aimed at > a very similar problem domains with similar philosophies; and that is > what I began to talk about on comp.lang.python and that got the thread > going. [In this and other somewhat related threads] Some people have (in different words) lamented the "language fork" (as it were) with respect to providing the major dynamic OO alternative to Perl (and Java and C++). Others have pointed out that Python and Ruby appeal to somewhat different tastes and that they draw newcomers from only partially overlapping pools of people. Nevertheless, there is some inevitable division of potential resources and mind share. Othes have pointed out various relatively moderate but nagging problems in Ruby and Python which persist due to backwards compatibility, which won't be fixed until the (highly speculative) advent of major overhalls where full backwards compatibility is not completely manditory--i.e. Ruby.next and Python 3000. So my question is: at such a presently entirely hypothetical future juncture, is there any practical and desirable middle ground for a common single successor language to the current generations of Python and Ruby? Conrad From tdickenson at devmail.geminidataloggers.co.uk Wed Dec 5 09:40:17 2001 From: tdickenson at devmail.geminidataloggers.co.uk (Toby Dickenson) Date: Wed, 05 Dec 2001 14:40:17 +0000 Subject: httplib slow read References: Message-ID: <48cs0u0a88eef5sacpbo12k1qappf9kodp@4ax.com> John Hunter wrote: > >I am using httplib to make GET requests. httplib is *very* low level. If you just want an ordinary GET then urllib is probably a better choice. >The problem is that the read command is slow; much slower than if I >make the same request via my browser. It could well be a problem with your hand-crafted http request. I suggest you go with urllib. Toby Dickenson tdickenson at geminidataloggers.com From claird at starbase.neosoft.com Tue Dec 18 18:02:17 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 18 Dec 2001 17:02:17 -0600 Subject: SOAP public server anywhere ? References: <9voag4$21n3$1@norfair.nerim.net> Message-ID: <5288516A42A65B1C.38D34784F392C1C9.37DCD55633A612A7@lp.airnews.net> In article <9voag4$21n3$1 at norfair.nerim.net>, Gillou wrote: >Hi, > >Is there some SOAP public server available somewhere for test purposes. >I mean something like Meerkat that provides IT news to XML-RPC clients. . . . Scores of them. See . For other getting-started-with-SOAP help, try . -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From guido at python.org Mon Dec 17 22:55:38 2001 From: guido at python.org (Guido van Rossum) Date: Tue, 18 Dec 2001 03:55:38 GMT Subject: Idiomatic portable way to strip line endings? References: <3C1E56AA.B7A3C9C9@attbi.com> Message-ID: Chris Barker writes: > To deal with all these problems (which become perhaps more common on > Mac OS-X), there was discussion on python-dev about creating a > "Universal Text File" type that would read files with any mixed > combination of *nix, DOS and Mac line endings (and maybe do > something smart on VMS as well). The goal would be able to have it > work with Python code as well as files opened with open(), and also > on pipes and other text streams. > > I know Guido, Jack Jansen and I had some discussion about it, and I > think Jack put a little work into it, but I'm not sure where it > sits. http://sourceforge.net/tracker/index.php?func=detail&aid=476814&group_id=5470&atid=305470 --Guido van Rossum (home page: http://www.python.org/~guido/) From DeepBleu at DeepBleu.org Fri Dec 28 10:46:55 2001 From: DeepBleu at DeepBleu.org (DeepBleu) Date: Fri, 28 Dec 2001 09:46:55 -0600 Subject: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B941D.B1E45AA5@htp-tel.de> Message-ID: "Aahz Maruch" wrote in message news:a0i027$dl2$1 at panix3.panix.com... > In article , > DeepBleu wrote: > > > >NNTP is an internet protocol like SMTP, POP3 and HTTP for > >communication. Also, it is the oldest one and it used to be the most > >instructive before AOL hit the scene along with the 'gold rush' :) > > Really? NNTP is older than SMTP? Mind telling me where you found that > little gem? I have a special cache of little gems somewhere around. I meant to say "one of the oldest." I personally do not care what is the oldest anyway. But thanks for the correction. DeepBleu From altis at semi-retired.com Sat Dec 1 15:02:14 2001 From: altis at semi-retired.com (Kevin Altis) Date: Sat, 1 Dec 2001 12:02:14 -0800 Subject: preserving namespaces with sub-packages Message-ID: <8FaO7.331$S82.263817@news.uswest.net> I have a module file in a package that has gotten quite large and I would like to split it up. Since I don't want to include the whole file, I've created something that should be equivelant which I'll call 'widgie.py' and is shown below. I'll call the package 'framework' --- file: widgie.py class BaseWidgie: def __init__( self ): self.name = 'BaseWidgie instance' class Button(BaseWidgie): def __init__( self ) : self.name = 'Button instance' --- If I refer to class Button in the current framework, the reference is: framework.widgie.Button So, what I would like to do is create a directory in the current package named 'widgie' that acts as a sub-package and the classes such as Button above will be referenced the same way. The directory structure looks like: framework directory __init__.py various module files for the framework widgie directory __init__.py basewidgie.py button.py And the split files look like: --- file: basewidgie.py class BaseWidgie: def __init__( self ): self.name = 'BaseWidgie instance' --- --- file: button.py from basewidgie import BaseWidgie class Button(BaseWidgie): def __init__( self ) : self.name = 'Button instance' --- So the question is what should the imports in __init__.py look like so that the sub-package effectively looks exactly the same as when there was a single widgie.py module file in the framework package? I must not be manipulating the namespaces right because so far I end up with stuff like: framework.widgie.button.Button In addition, it would be nice have __init__.py automatically load all the files in the widgie directory rather than having to hard-code each filename. Hopefully I'm explaining the problem correctly. Any suggestions or solutions? ka From deweese at usc.edu Thu Dec 20 00:22:13 2001 From: deweese at usc.edu (John DeWeese) Date: Wed, 19 Dec 2001 21:22:13 -0800 Subject: stackless python References: <9vpjds$due$1@usc.edu> Message-ID: <9vrsnu$e6n$1@usc.edu> Bill Tate wrote: > What do you want to know? As you see development on stackless seems > largely to be stalled, but I believe there are plenty of people still > using it. > > OTOH, the chances of seeing stackless python or something like it in > the core are currently in the vanishing-to-nil range. We went round > with this one on the newsgroup a few weeks back -- google is your > friend here -- and the conclusion was there was noone willing and able > to do the enormous amount of work required. CT has done the first 90% > of the work, but there's still the other 90% to go, and even if the > work was done, it's far from certain that Guido would accept the > changes anyway. Hmm, that's disappointing that it's falling away without any word from Christian Tismer since May (at least, his page). I've read that google thread. Do you think there's enough support to carry concurrent versions forward to the latest python versions, at least? It would suck if Stackless is at 2.x and some new modules start requiring Python 2.(x+1). So my goal is to see how I can take the stackless idea of micro-threading and use it to drive all my simulation objects, to get the non-spaghetti benefits of threading with sufficiently low overhead to support perhaps 100 object scripts. I've found Gordon McMillan's socket example (thanks Bill), which appears to very similar in theory... very cool. Now I just have to learn Python! Do you guys know of more example code for micro-threads? Hungry for info! - John From hamstermumke at xs4all.nl Wed Dec 5 08:23:30 2001 From: hamstermumke at xs4all.nl (christinA eijkhout) Date: Wed, 05 Dec 2001 14:23:30 +0100 Subject: Arrgh (re: ANN: Simple Newsgroup Searchterm Monitor) References: <3c20bba2.19642734@127.0.0.1> Message-ID: <9ulacu.3vv5ieh.1@mumke.nl> comp.lang.python, root at 127.0.0.1 ((Five Fresh) Fish) carved: . > > Anyone who wants it, follow-up this message and I'll *email* it to you. > I'm giving up on using Agent to post a zipfile. :-) I'm very interessed. Please use my Reply-to. -- christinA ff sigloos From nospam at mega-nerd.com Mon Dec 3 15:51:34 2001 From: nospam at mega-nerd.com (Erik de Castro Lopo) Date: Mon, 03 Dec 2001 20:51:34 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BD39F.D43D4FF7@mega-nerd.com> <3c0be454$1@207.229.64.20> Message-ID: <3C0BE5D5.4386B359@mega-nerd.com> Peter Bismuti wrote: > > So much for cooler heads prevailing....(deep sigh). Maybe my post was not the best way to deal with this matter. However, the people who like me prefer using tabs (and nothing but tabs) for indentation need to speak up. Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam at mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ Running MS-Windows on a Pentium is like having a brand new Porsche but only being able to drive backwards with the handbrake on. From loewis at informatik.hu-berlin.de Fri Dec 21 17:31:20 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 21 Dec 2001 23:31:20 +0100 Subject: Another distutils question References: <9vumpp$hn2$1@peabody.colorado.edu> Message-ID: Fernando =?ISO-8859-1?Q?P=E9rez?= writes: > Thanks Martin. I actually have PyXML and did see the setupext/ > stuff, I just didn't want to add yet another extraneous module to my > package. I'm trying to stick to the standard tools when possible, > and my case was simple enough that an ugly kludge allowed me to make > it work (but *really* ugly). Please understand that I'm still using standard tools. distutils was specifically designed to allow commands to be overridden, and this is what I'm doing (thanks to Rene Liebscher, BTW, for providing the original version of install_data). > I did like a lot the enhanced install though. It seems like the kind > of functionality that's badly needed in distutils. Any chance of > that making it into the standard for new releases? distutils is currently unmaintained. Volunteer contributions are greatly appreciated. Regards, Martin From waalp at pissed.co.uk Tue Dec 11 06:43:11 2001 From: waalp at pissed.co.uk (waalp) Date: Tue, 11 Dec 2001 12:43:11 +0100 Subject: O_APPEND & O_WRONLY Message-ID: <9v4o5l$1h75$1@colo.mobo-it.nl> I'm trying to open a file in append mode (using python under ms windows) if i use the O_APPEND parameter i get a errormessage from the interpreter like this: OSError: [Errno 9] Bad file descriptor But if i use the O_WRONLY parameter everything goes write. But i want to append the file, not overwrite it? am i doing something wrong here? my code: #!/usr/bin/python from os import * def writeLog(logMSG): logfd = open('event.log',O_APPEND) write(logfd, logMSG) close(logfd) writeLog('hello world') Thanks in advance, Peter From pzw1 at cornell.edu Fri Dec 7 14:33:54 2001 From: pzw1 at cornell.edu (pzw1 at cornell.edu) Date: Fri, 7 Dec 2001 14:33:54 -0500 (EST) Subject: cmd module documentation lying? In-Reply-To: Message-ID: On Fri, 7 Dec 2001, Michael Hudson wrote: > [I'm sending this back to the list, 'cause it might be helpful to others] > > Do you speak TeX at all? The Python docs are in LaTeX, and are part of > the source documentation or CVS. > > If you can do TeX, then great; send patches as described in > > http://www.python.org/patches/ i'm on it. i do speak, er, write, LaTeX - did it back in my undergrad physics days. i don't know how long it will take, but a patch is forthcoming. -peter From loewis at informatik.hu-berlin.de Fri Dec 14 08:56:09 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 14 Dec 2001 14:56:09 +0100 Subject: what is self._base? References: <3C19EC50.153B76A1@doc.ic.ac.uk> Message-ID: Benjamin Tai writes: > import stacktype > class Stack: > def __init__(self, start=None): > self._base = start or stacktype.Stack() > > However I can't find any documents/explanation for the following: > > 1) What is "_base" It just is an arbitrary member name; it has no pre-defined meaning in Python. > 2) What is "start=None" start is the parameter, None is the default value. > 3) Why can't I just write "self = stacktype.Stack()" self is also a parameter (of __init__). So if you assign to self, this assignment loses its meaning once __init__ returns. Regards, Martin From fperez528 at yahoo.com Wed Dec 19 09:12:25 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Thu, 20 Dec 2001 13:40:25 +2328 Subject: Bug in % string formatting? Message-ID: <9vtiev$no8$1@peabody.colorado.edu> If this is not a bug in % string formatting, I'd love to understand what is going on. The example code is: names = {'John' : ('John Doe','jodoe at nowhere'), 'Jane' : ('Jane Doe','jadoe at nowhere'), } format_string = '%s <%s>\n%s <%s>' format_list = names['John'][:] + names['Jane'][:] # This works ok print 'With prebuilt list:' print format_string % format_list # but this fails. The format string is copied verbatim from above print 'Explicit list construction:' print format_string % names['John'][:] + names['Jane'][:] Upon executing this, the output is: $ python test.py With prebuilt list: John Doe Jane Doe Explicit list construction: Traceback (most recent call last): File "test.py", line 15, in ? print format_string % names['John'][:] + names['Jane'][:] TypeError: not enough arguments for format string This is all under Python 2.1.1, Mandrake 8.0. Any insight would be greatly appreciated. Regards, Fernando. From brbprz at westoleyourmoney.com Thu Dec 6 22:01:25 2001 From: brbprz at westoleyourmoney.com (brbprz at westoleyourmoney.com) Date: Fri, 07 Dec 2001 03:01:25 GMT Subject: BREAKING NEWS ON PAYPAL SCAM!!!!! 149 Message-ID: <9iWP7.6689$Yy.278711@rwcrnsc53> IF YOU HAVE A PAYPAL ACCOUNT YOU MAY WANT TO CLOSE IT AFTER YOU READ THIS BREAKING NEWS FROM ZDNET, CNN AND NEWYORK TIMES! CLICK HERE: http://www.paypalwarning.com/Default.htm qprzxkqhuy From pbeck at ciberbit.pt Thu Dec 6 15:01:30 2001 From: pbeck at ciberbit.pt (Pedro B. Gomes Costa) Date: Thu, 6 Dec 2001 20:01:30 -0000 Subject: Class equivalence? References: <200112061149540390.01224BA2@mail.rdc1.sdca.home.com> Message-ID: <000c01c17e90$ccaacaa0$0cc8a8c0@pedro> Hi! "is" is used to check for object identity (if they reference the same physical memory location). >>>class Flower: pass >>>class Daisy(Flower): pass >>>aDaisyInstance = Daisy() >>>anotheraDaisyInstance = aDaisyInstance >>>anotheraDaisyInstance is aDaisyInstance 1 Comnparing with Java (btw, I have all your books...): String str1, str2; str1 == str2 - > str1 is str2 (in python) str1.equals(str2) -> str1 == str2 (in python) Hope it helps Pedro Costa ----- Original Message ----- From: "Bruce Eckel" To: Cc: ; Sent: Thursday, December 06, 2001 7:49 PM Subject: Class equivalence? > >>> class Flower: pass > >>> class Daisy(Flower): pass > >>> Daisy is Flower > 0 > > What am I missing here? > > Most current information can be found at: > http://www.mindview.net/Etc/notes.html > =================== > Bruce Eckel http://www.BruceEckel.com > Contains free electronic books: "Thinking in Java 2e" & "Thinking > in C++ 2e" > Please subscribe to my free newsletter -- just send any email to: > join-eckel-oo-programming at earth.lyris.net > My schedule can be found at: > http://www.mindview.net/Calendar > =================== > > > > -- > http://mail.python.org/mailman/listinfo/python-list From tim at vegeta.ath.cx Wed Dec 5 04:38:57 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Wed, 05 Dec 2001 09:38:57 GMT Subject: Is Python suitable for some binary file editing? References: <1FD639F0.1DA46084@cns.net.au> Message-ID: Richard Jones graced us by uttering: [ snip ] > A very simple example of replacing two bytes in a file, 100 bytes in: > > [richard at ike /tmp]% python > Python 2.1.1 (#1, Aug 30 2001, 17:36:05) > [GCC 2.96 20000731 (Mandrake Linux 8.1 2.96-0.61mdk)] on linux-i386 > Type "copyright", "credits" or "license" for more information. >>>> f = open('test_input', 'rb') >>>> o = open('test_output', 'wb') >>>> o.write(f.read(100)) >>>> o.write(chr(123)) >>>> o.write(chr(0x80)) >>>> f.read(2) > 'ri' >>>> o.write(f.read()) I'd have preferred: Replace 2 bytes in place beginning at offset 100 (101st byte): f = open('text_input', 'r+b') f.seek(100) f.write(chr(123) + chr(0x80)) f.seek(0,2) f.close() Tim Hammerquist -- scanf() is evil. From andrew at puzzling.org Mon Dec 10 05:03:19 2001 From: andrew at puzzling.org (Andrew Bennetts) Date: Mon, 10 Dec 2001 21:03:19 +1100 Subject: questions about of writing python scripts In-Reply-To: References: Message-ID: <20011210210319.A1071@frobozz.local> On Sun, Dec 09, 2001 at 05:26:14PM -0800, ed wrote: > but c is floating and has not value and a got assgined to it. ... in > other compiation lang, this type of error will be caught in > compilaiton time, but I can't using python.. is ther any utility or > way to catch this type of error way ahead? I think what you are looking for is a static analysis tool... try pychecker. http://pychecker.sourceforge.net/ -Andrew. From tdelaney at avaya.com Wed Dec 12 18:28:48 2001 From: tdelaney at avaya.com (Delaney, Timothy) Date: Thu, 13 Dec 2001 10:28:48 +1100 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) Message-ID: > From: Ville Vainio [mailto:vvainio at karhu.tp.spt.fi] > Courageous writes: > > > But this is all academic, because the defacto and near > dejure standard > > for Python is 4 spaces per indentation level. Tabs are deprecated. > > Why don't issue a DeprecationWarning whenever tabs are found in the > source file? That wouldn't "break" things, but it would surely > motivate tab-using people to learn the right way of doing things. I've kept out of this until now, because I didn't want to add to the flames ... However, I would be heavily opposed to this. Firstly, it's a tool issue - the best editor I have found on Windows (i.e. most similar to BBEdit on the Mac ;) is EditPlus - however, I cannot find a way to force it to delete multiple spaces (to the previous tab stop) with a single keypress. So I use hard tabs for indents (and indeed, have *always* used hard tabs on every platform). The other main issue is mixing spaces and tabs. There are again two issues involved - mixing spaces and tabs for indent levels, and mixing spaces and tabs to line things up. Spaces and tabs should *never* be mixed up for indent levels. T statement TT statement T SSSSstatement SSSST statement is *bad* However, using hard tabs for indenting, then spaces for lining things up is not such a bad thing. T statement TT callable(param, TT SSSSSSSSSparam) leaves layout perfectly fine, no matter what someone has set their tabstops to. You may (if you prefer) replace the above tabs with spaces ... SSSSstatement SSSSSSSScallable(param, SSSSSSSSSSSSSSSSSparam) perfectly well. The problem as I see it one of retraining. I refuse to retrain myself to backspace through multiple spaces simply to reduce indentation (although I would normally use block dedent anyway). I refuse to change from an editor which in all other ways suits my purposes, since changing to another editor would involve retraining to get used to its idiosyncracies, and I have not found an editor in Windows which is a pleasing on the eyes as EditPlus (and that is a major consideration). Unix is the only platform which has maintained the "4 space indent, 8 space tabstop". Macs have always had a four-space-equivalent tabstop as standard (for text editors and IDEs). Windows has always been a mess. My solution is to set the tabstop at what it should be (mandated by the project - in my current project, 3 spaces per tabstop for Java), convert leading spaces to tabs after checking out a file, convert tabs to spaces before checking in a file. I wish it were easier, but this works for me. Tim Delaney From jkraska at san.rr.com Thu Dec 27 18:04:47 2001 From: jkraska at san.rr.com (Courageous) Date: Thu, 27 Dec 2001 23:04:47 GMT Subject: REPOST: Re: Two languages, too similar, competing in the same space. References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> Message-ID: <4$--$$_-----$%%-$$@news.noc.cabal.int> >And I like and respect Matz and the whole Ruby community. I wish them well. >But I recognize that their success may, on the margins at least, slow down >Python. I would think it more likely that Matz will simply pick up many folks who know Japanese but not English fluently. The world is a very large place, where even niche variants of programming languages can attract followings sizeable enough to give languages for those niches momentum. This would characterize Python's early history, as a matter of fact. C// ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!nnxp1.twtelecom.net!newsfeed.cs.wisc.edu!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Courageous Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:07:53 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775516 27193 211.57.49.2 (31 Dec 2001 05:11:56 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:11:56 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From wtr at hannover.sgh-net.de Tue Dec 11 15:45:42 2001 From: wtr at hannover.sgh-net.de (Wolfgang Teschner) Date: Tue, 11 Dec 2001 21:45:42 +0100 Subject: jpeg files displayed in a loop References: <5a4226f0.0112111203.1d361fa0@posting.google.com> Message-ID: <8nrc1uob943td41j54oodslj3vh3lm3ntl@4ax.com> Hello, Kevin, thank you very much for your long example! I should try that immediately (well, now I seem to have even TWO ways of doing it!). It looks promising! Thank you all, wolfgang On 11 Dec 2001 12:03:19 -0800, kevin at cazabon.com (Kevin Cazabon) wrote: >import Tkinter >import Image, ImageTk >import os > >dir="c:\\temp\\" > > >def showimage(): > image = pop(files) > files.append(image) > image = ImageTk.photoimage(Image.open(image)) #ok, do try/except > b.configure(image=image) > b.update_idletasks() > b.after(1000, showimage) > >a = Tkinter.tk() >b = Tkinter.label(a) >b.pack() > >files = os.listdir(dir) # ok, check them for file types... >while 1: > showimage() > > > ># ok, probably a couple minor typos, but it should be that simple. > >Kevin Cazabon. >kevin at cazabon.com > > >Wolfgang Teschner wrote in message news:... >> Hi, >> I want to automatically display all jpeg files of a dir in a long >> loop, with a wait time between the different displays. Just that. >> No user input. >> With PIL, it seems to be impossible because of TKinters mainloop. >> >> Are there other ways/packages for this purpose? Just displaying the >> images as they are... >> platform is win32, but I would be interested for independant >> solutions, if they exist. >> >> Thanks, >> wolfgang teschner From loewis at informatik.hu-berlin.de Fri Dec 21 12:09:15 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 21 Dec 2001 18:09:15 +0100 Subject: DOM - some pointers References: <9voi51$fco$1@slb7.atl.mindspring.net> <9vrm5n$dni$1@slb3.atl.mindspring.net> Message-ID: "Andrew Dalke" writes: > Still, it would be nice to have a short document on-line > which at least provides a few hints that beginning users > of DOM are at least on the right track. That certainly would be nice. Please send contributions to sf.net/projects/pyxml. Regards, Martin From joshm at taconic.net Sun Dec 30 14:36:31 2001 From: joshm at taconic.net (Joshua Muskovitz) Date: Sun, 30 Dec 2001 14:36:31 -0500 Subject: REPOST: Re: Video Programming References: <3C2E89DD.F3304EA9@earthlink.net> Message-ID: <9$--$$_----__$-%%$@news.noc.cabal.int> Personally, the thought of using a VR system to write code is an extremely unpleasant thought. However, I *have* seen some fun come of the idea of using First Person Shooters as unusual interfaces. I saw a version of doom where the monsters were all representations of the currently running processes, and you could shoot them to kill the process. Rather cathartic, and there is a certain amount of justice in having an ill behaved app able to shoot back at you. :-) -- j -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!shot.codefab.com!news-out.spamkiller.net!propagator-la!news-in-la.newsfeeds.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Joshua Muskovitz" Newsgroups: comp.lang.python Subject: cmsg cancel <3c2f6ac4_3 at corp.newsgroups.com> Control: cancel <3c2f6ac4_3 at corp.newsgroups.com> Date: Mon, 31 Dec 2001 02:31:38 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774107 27193 211.57.49.2 (31 Dec 2001 04:48:27 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:48:27 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From neil_butterworth at lineone.net Mon Dec 10 09:27:34 2001 From: neil_butterworth at lineone.net (Neil Butterworth) Date: Mon, 10 Dec 2001 14:27:34 -0000 Subject: Is c or c ++ my language for this task... Or is it Python? References: Message-ID: <3c14c628$3_1@mk-nntp-1.news.uk.worldonline.com> "google account" wrote in message news:e84f5d12.0112092155.34389e1a at posting.google.com... > Hi guys. > > I have just recently purchased for myself a Pioneer DVD-Rom drive. I > was hoping that there would be a piece of software available that > would give me some added info about movie titles that I placed in it. Standard C++, the topic of this newsgroup, has no facilities to do what you want. You need to post this question to a newsgroup that supports your operating system and/or your hardware - you are off-topic in comp.lang.c++. And please don't cross-post to completely unrelated newsgroups. NeilB From LLoeffler at home.com Sun Dec 2 04:02:24 2001 From: LLoeffler at home.com (Luke) Date: Sun, 02 Dec 2001 03:02:24 -0600 Subject: a long shot -> sending output to a browser question References: <28d73ad6.0112011316.25e17eb2@posting.google.com> Message-ID: <3C09EE20.7040609@home.com> Dan Allen wrote: > This may be far out, but something I have always wondered because I > thought I once saw a page do this and couldn't figure out how. Is it > possible to trick the browser into thinking the whole page has been > sent and begin to display data on the page, and then send more. If > you are wondering where I got this crazy idea, it was with the > NuSphere installation, which seemed to load the page over a period of > time. The reason I ask here, is because they wrote it in perl (and I > didn't see any javascript on the page), and I figured it must have > been something they were doing with output buffering or something and > perhaps python had the same thing. Not exactly sure what you're asking, but you can flush the output buffer before it is full so the browser can get the data earlier than it would have and thus render it earlier and piece by piece (like what you'd want for a status indicator. You can't trick the browser into thinking the whole page has been sent. Once the socket is closed, it is closed... You would have to reload the page from scratch. From aleax at aleax.it Fri Dec 28 06:27:35 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 12:27:35 +0100 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <8$--$$_--__-%$__$$@news.noc.cabal.int> "Steve Lamb" wrote in message news:slrna2nhfo.nme.grey at teleute.dmiyu.org... > On Thu, 27 Dec 2001 17:48:13 +0000, phil hunt > wrote: > > Python runs quickly on my 300 MHz box, which is 3 times slower > > than the slowest PC you can buy today. It can only get more popular. > > Well, if you take the measure of just pure Mhz.... 4 times slower. ;) FIVE or more. 1.5 GHz desktop machines are hardly news these days. Alex ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail Message-ID: Control: cancel Subject: cmsg cancel From: "Alex Martelli" Newsgroups: comp.lang.python X-No-Archive: yes Lines: 2 NNTP-Posting-Host: wonenara.ozemail.com.au X-Trace: ozemail.com.au 1009643047 203.108.164.177 (Sun, 30 Dec 2001 03:24:07 EST) NNTP-Posting-Date: Sun, 30 Dec 2001 03:24:07 EST Organization: OzEmail Ltd, Australia Distribution: world Date: Sat, 29 Dec 2001 12:41:18 GMT This message was cancelled from within Mozilla. From keyton at weissinger.org Fri Dec 28 17:00:21 2001 From: keyton at weissinger.org (A. Keyton Weissinger) Date: Fri, 28 Dec 2001 17:00:21 -0500 Subject: Zope Documentation (was RE: Python Popularity: Questions and Comments) In-Reply-To: Message-ID: I have had similar experiences trying to get my head around Zope. I write J2EE applications with a group of folks. I was expecting a Pet Shop or at least an EJB-like spec of the lay of the land. If someone asked me -- someone who considers himself a huge Pythonista -- what Zope was all about, I'd have to say I didn't have a real clue. Now, it just so happens that I also write on the side for O'Reilly and others. If any of you guys at DC want to email me back, I would be happy to help spread the gospel according to Zope/Python. But it needs to have serious facts (comparisons between similar setups for J2EE/M$), more serious specifications (an EJB-like container approach based in Python, for example, would be huge -- difficult certainly, but huge), and even more serious examples. I agree with Bill. I want to see the full thing broken into pieces. Keyton > -----Original Message----- > From: python-list-admin at python.org > [mailto:python-list-admin at python.org]On Behalf Of Bill Tate > Sent: Friday, December 28, 2001 9:31 AM > To: python-list at python.org > Subject: Re: Python Popularity: Questions and Comments > > > Ron Stephens wrote in message > news:<3C2B9E04.9957801F at earthlink.net>... > > I recently read an interview with a Digital Creations top > manager where he said > > that he hopes someone starts a successful business based solely > on providing > > ISP services using Zope, with full technical support. Is anyone > looking into > > this? Does anyone think this could be a successful business model? I am > > interested in opinions on this. > > This past spring, I spent a full month pouring over Zope in detail. I > pulled every example product I could find that I thought would be > relative to the purpose of setting up a commercial-based application. > I downloaded the tutorial and the draft zope book. I pulled down > every bit of documentation I could find for developers. In so many > cases, I found whatever documentation was available that key aspects > of the implementation took the "assumed facts-already-in-evidence" > approach; omitting key details that would were critical to improving > my understanding of using Zope. I consider myself a masochist in the > sense that I'm willing to go through various contortions to figure > something out, but like many others, I reached a point of saying that > I still don't get it. I won't even touch the issue of ZOPE's CMF or > Zope Templates - the documentation on that couldn't be more confusing > if it tried. > > My point is, the product may be perfect for my needs, but please do > away with tutorial examples referring to using zoo animals to > illustrate object navigation or elvis sightings to solidfy > understanding of the product. There were simply too many disjointed > pieces in the documentation to allow me to pull all the pieces > together and believe me when I say I'm a person who will go to great > lengths to try to "get something." If I'm having trouble, than I > suspect more than a few others are as well. > > Any commercial enterprise is likely to be supported by either some > data model or object-class model that almost invariably has a RDBMS on > the back-end for persistent storage (I've also worked with ODBMS so > ZODB isn't an issue for me). If you want to gain converts to zope, > build a tutorial that follows some resemblance of a what a normal web > site has to provide by way of example - perhaps something akin to the > Pet Store example in Zope would be useful??? How about building an > example auction site from scratch? I would be more than happy to > devote time and energy contributing to Zope but I can't until I figure > out how Zope works. To some degree, I think my confusion with Zope > increased AFTER I went through the documentation. Truthfully, I don't > even know whether Zope would be even a reasonable candidate for doing > something akin to the Pet Store example or even an auction site for > that matter. > > PHP has virtually exploded on the scene by providing a everything > including the kitchen sink - it appears to have taken little > convincing to gain converts to PHP and accordingly to the latest web > surveys, its implementation is huge. I much rather see tools like > Zope achieve that kind of status. But I don't imagine that too many > folks are going to be willing to work that hard to achieve Zope Zen > when other alternatives exists and that's a damn shame because I > suspect Zope is an excellent product. > > I truly do commend and appreciate DC's contribution's to Python, but I > hope somebody can point to something (either examples or > documentation) that gives me a reason to try again. > > Truthfully, I just don't think its me. > > Bill Tate > -- > http://mail.python.org/mailman/listinfo/python-list > > From emile at fenx.com Wed Dec 5 18:10:21 2001 From: emile at fenx.com (Emile van Sebille) Date: Wed, 5 Dec 2001 15:10:21 -0800 Subject: Python - string to hexbytes conversion - HELP! References: Message-ID: <9um9q9$9gav9$1@ID-11957.news.dfncis.de> Here's one way: import string s = '0'[:len(a)%2]+a ''.join([chr(string.atoi(s[x:x+2],16)) for x in range(0,len(s),2)]) HTH, -- Emile van Sebille emile at fenx.com --------- "me" wrote in message news:HKvP7.17239$2Fd.11985 at news1.bloor.is... > I'm a newbie to Python and I am trying > to convert a string of decimal numbers - read from raw_input > to a series of hexbytes > eg > if I do a read and get a='1234567' > I need an equivalent string to be > b=Chr(0x01)+chr(0x23)+chr(x045)+chr(0x67) > > all this is to control a device from the serial port > but I cannot seem to recall how to conver the input to my required output > An hints or suggestion most appreciated! I've spend hours trying various > built in's > which I would prefer to use > > HELP! > > From aahz at panix.com Wed Dec 26 19:09:59 2001 From: aahz at panix.com (Aahz Maruch) Date: 26 Dec 2001 16:09:59 -0800 Subject: REPOST: Re: try-except-finally question References: Message-ID: <0$--$$-$$$$%_%__-$@news.noc.cabal.int> In article , Igor V. Rafienko wrote: > >The skeleton code looks something like this: > >def updateDB(): > > # some initializing > > try: > > try: > > > > > > except ExternalFactorError: > > except DBError: > except: raise > # yrt > # od > finally: > > > # yrt ># end updateDB > >The outermost try-finally is needed to free the initialized resources. > >I have 2 questions: > >* In the innermost try-except there is a possibility for other > exceptions than ExternalFactorError and DBError. How can I catch > _all_ other exceptions than these two[*]? I'm not so much interested > in error itself, but rather whether it occured. I.e. I'm looking for > C++'s "catch (...)" construct in Python. Note the addition of "except:" above. You need the "raise" to make sure the error gets re-raised (you *want* to abort if the user hits ^C). -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 5 days and counting ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: aahz at panix.com (Aahz Maruch) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:08:54 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009776004 27193 211.57.49.2 (31 Dec 2001 05:20:04 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:20:04 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From tripps81 at yahoo.com Fri Dec 21 12:13:45 2001 From: tripps81 at yahoo.com (Tripp Scott) Date: Sat, 22 Dec 2001 00:13:45 +0700 Subject: marshalling data structures between perl <-> php <-> python In-Reply-To: <7x1yho20fk.fsf@ruckus.brouhaha.com> References: Message-ID: <5.1.0.14.2.20011222001255.0733b220@202.95.131.154> On 21/12/2001 19:59, Paul Rubin wrote: >Tripp Scott writes: > > aside from using XML-RPC, what python module can i use to marshall > > data structures (possibly a combination of lists, dictionaries, and > > scalars of ints, floats, ascii strings, and null values) between these > > three languages? i prefer a compact, common binary format rather than > > XML. > >XDR, maybe. unfortunately, i haven't sighted a php class that is the equivalent of xdrlib. t From python_only at yahoo.com Fri Dec 28 04:27:14 2001 From: python_only at yahoo.com (Goh S H) Date: 28 Dec 2001 01:27:14 -0800 Subject: Python Enterprise ??? Message-ID: <184fbd02.0112280127.159247b5@posting.google.com> Check it out ! http://www.gnuenterprise.org/ From keyton at weissinger.org Fri Dec 7 18:23:22 2001 From: keyton at weissinger.org (A. Keyton Weissinger) Date: Fri, 7 Dec 2001 18:23:22 -0500 Subject: GUI builder In-Reply-To: Message-ID: I'm using Black Adder (from thekompany.com) on a Win2K box. It works OK, but it's GUI builder is Qt-based. Not sure what its Tkinter support really is (if it exists). For Qt, though, it's excellent. Keyton -----Original Message----- From: python-list-admin at python.org [mailto:python-list-admin at python.org]On Behalf Of Timothy Collins Sent: Friday, December 07, 2001 6:08 PM To: python-list at python.org Subject: GUI builder Just wondering if anyone knows where I could get my hands on a gui builder that would work with python. I have tried "Boa Constructor" and it works, but only to a point - if I try to open the frame build it coughs up errors until it just stops. Any other free or nearly free visual IDE's out there? -- http://mail.python.org/mailman/listinfo/python-list From aroach at electriceyeball.com Mon Dec 3 00:39:20 2001 From: aroach at electriceyeball.com (Anthony Roach) Date: Mon, 03 Dec 2001 05:39:20 GMT Subject: os.spawnve and threads Message-ID: I'm working on the scons project (www.scons.org) and we are having trouble using spawnve with a parallel build. From a single Python instance containing N threads, we want to execute spawnve N times so we get N parallel processes. On UNIX we use os.fork() followed by os.execve(), but on Windows we must use os.spawnve() because there is no fork. The problem with os.spawnve() is that it seems to block the interpreter so no other threads can run, thus destroying our parallelism. I took a look at posixmodule.c (where spawnve is implemented for Windows) and the problem appears to be that Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS is not being used around the call to _spawnve(). Is this a known bug? Any chance of getting it fixed for Python 2.2? Should I submit a patch? On a related note, the doc string for spawnve says "Execute a path with arguments and environment, replacing current process", which is incorrect. It should say "Execute a path with arguments and environment in a new process". All of the above problems also apply to os.spawnv(). From tatebll at aol.com Fri Dec 28 09:31:06 2001 From: tatebll at aol.com (Bill Tate) Date: 28 Dec 2001 06:31:06 -0800 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: Ron Stephens wrote in message news:<3C2B9E04.9957801F at earthlink.net>... > I recently read an interview with a Digital Creations top manager where he said > that he hopes someone starts a successful business based solely on providing > ISP services using Zope, with full technical support. Is anyone looking into > this? Does anyone think this could be a successful business model? I am > interested in opinions on this. This past spring, I spent a full month pouring over Zope in detail. I pulled every example product I could find that I thought would be relative to the purpose of setting up a commercial-based application. I downloaded the tutorial and the draft zope book. I pulled down every bit of documentation I could find for developers. In so many cases, I found whatever documentation was available that key aspects of the implementation took the "assumed facts-already-in-evidence" approach; omitting key details that would were critical to improving my understanding of using Zope. I consider myself a masochist in the sense that I'm willing to go through various contortions to figure something out, but like many others, I reached a point of saying that I still don't get it. I won't even touch the issue of ZOPE's CMF or Zope Templates - the documentation on that couldn't be more confusing if it tried. My point is, the product may be perfect for my needs, but please do away with tutorial examples referring to using zoo animals to illustrate object navigation or elvis sightings to solidfy understanding of the product. There were simply too many disjointed pieces in the documentation to allow me to pull all the pieces together and believe me when I say I'm a person who will go to great lengths to try to "get something." If I'm having trouble, than I suspect more than a few others are as well. Any commercial enterprise is likely to be supported by either some data model or object-class model that almost invariably has a RDBMS on the back-end for persistent storage (I've also worked with ODBMS so ZODB isn't an issue for me). If you want to gain converts to zope, build a tutorial that follows some resemblance of a what a normal web site has to provide by way of example - perhaps something akin to the Pet Store example in Zope would be useful??? How about building an example auction site from scratch? I would be more than happy to devote time and energy contributing to Zope but I can't until I figure out how Zope works. To some degree, I think my confusion with Zope increased AFTER I went through the documentation. Truthfully, I don't even know whether Zope would be even a reasonable candidate for doing something akin to the Pet Store example or even an auction site for that matter. PHP has virtually exploded on the scene by providing a everything including the kitchen sink - it appears to have taken little convincing to gain converts to PHP and accordingly to the latest web surveys, its implementation is huge. I much rather see tools like Zope achieve that kind of status. But I don't imagine that too many folks are going to be willing to work that hard to achieve Zope Zen when other alternatives exists and that's a damn shame because I suspect Zope is an excellent product. I truly do commend and appreciate DC's contribution's to Python, but I hope somebody can point to something (either examples or documentation) that gives me a reason to try again. Truthfully, I just don't think its me. Bill Tate From paul at svensson.org Fri Dec 7 10:37:15 2001 From: paul at svensson.org (Paul Svensson) Date: Fri, 7 Dec 2001 15:37:15 +0000 (UTC) Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> Message-ID: <9uqnna$pn8$1@news.island.liu.se> Robin Becker writes: >It seems odd to define dates as a duration in days from a fixed time and >then define durations in a different scale ie seconds. Wouldn't it be >better to adopt the integers to represent days and the fraction to >represent fractions of a day which is what various proprietary date >formats do already (although with different origin). Dates and durations >could then have a common underlying representation. Another possibility would be to represent the MJD interally as (integer, float), holding the day and seconds since midnight. /Paul From wurmy at earthlink.net Thu Dec 27 14:18:02 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Thu, 27 Dec 2001 19:18:02 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <3C2B7276.88339BE7@earthlink.net> Ron Stephens wrote: > How is Python doing popularity wise? After such a meteoric growth > thought the nineties, and a spectacular climax in 2000 and early 2001, > is Python leveling out, going dot.bust, or still not yet at the knee of > the software world's most spectacular growth curve? I should hope it's still growing. :) I want more books, more Python jobs, more programs, more everything! :-) > Python, while fabulously successful, is at an interesting point in its > growth curve. It will be difficult to maintain the extremely high rate > of growth exhibited so far; new contenders are possible problems; and > the recessionary economy could also negatively impact Python's growth. Commercial growth, yes. A recession doesn't stop anyone from sitting down and writing some Python code for fun. (Assuming the recession isn't so bad that they cannot do even this anymore.) > But Ruby is also a more general purpose, object oriented, relatively > easy to read, language. Ruby folks include those who like its more > Perl-like syntax, but Ruby's core converts believe that its pure, > absolute object oriented nature exceeds those of Python and make it more > worthy to long term success. They seem to see Ruby as a more modern, > up-to-date version of Python. They see Python as a compromise between > object oriented and procedural programming. It is... and functional programming, and possibly some other paradigms. I don't see how Ruby can be more modern, unless it does that new stuff like aspect-oriented programming. It may be perceived as cleaner by some, but Python is rapidly removed its warts, like mending the type/class dichotomy. (And gaining lots of other features of dubious utility along the way... but that's a different story... ;-) > a. Usage on the Ruby newsgroup is growing much faster than on > comp.lang.python in the last year that I have been observing it. A year > ago, Python got typically three times as many posts per day as Ruby. > Now, its more like a 4:3 ratio, with Python getting say, 4000 per month, > and Ruby 3000. At this rate, Ruby could pass Python is afew months, by > this measure! (Rest assured, Ptyhonis fdoing much better if mesured by > Sourceforge projects, about 1300 to 80). By the way, Just van Rossum's > http://starship.python.net/~just/comp.lang.python/ graph of Python > newsgroup coverage seems to show a slight decline from over 6000 per > month in late-middle 2001 to the current 3500 or so I see on here. Mr. > van Rossum said he may not be able to update these any more due to some > Yahoo change; anyway, am I interpreting these numbers and trends > accurately? Will the Python newsgroup usage turn upwards again? Does it > matter? I don't know, but remember that there are many SIGs, mailing lists etc, besides this newsgroup. So the more specialized discussions are done elsewhere. I don't know if Ruby has a lot of mailing lists comparable to Python's, but it would seem to me that the number of messages in c.l.py isn't all there is to it. > 2. The economy is hurting Python's open source development model. It was > bad enough when the core Python coders were jerked around by Be Open; > now I am very sad to hear of Mark Hammond's not being with ActiveState > anymore? [...] I think PythonLabs, or Zope Corp., should hire him. That would seem like a smart move. > Ten years from now, will Python still be Relevant? Oh, I know that > Python will still be being used, and the community will still exist, but > will it really be a thing that seems to Matter, like it does now. Ten years is a long time. Maybe by then, we won't even *want* to program in Python, because there's something better out, based on insights from working with other languages, possibly including Python. Or maybe in ten years Python will look nothing like it is right now. Who knows... Regards, --Hans From cjensen at bioeng.ucsd.edu Thu Dec 27 20:02:17 2001 From: cjensen at bioeng.ucsd.edu (Curtis Jensen) Date: 27 Dec 2001 17:02:17 -0800 Subject: REPOST: Re: affects on extended modules References: <3C051775.A8D4FD66@bioeng.ucsd.edu> <83pu5zrvbl.fsf@panacea.canonical.org> Message-ID: <2$--$$_----__--$%$@news.noc.cabal.int> Kragen Sitaker wrote in message news:<83pu5zrvbl.fsf at panacea.canonical.org>... > Curtis Jensen writes: > > We have created a python interface to some core libraries of our own > > making. We also have a C interface to these same libraries. However, > > the the python interface seems to affect the speed of the extended > > libraries. ie. some library routines have their own benchmark code, > > and the time of exection from the start of the library routine to the > > end of the library routine (not including any python code execution), > > takes longer than it's C counterpart. > > In the Python version, the code is in a Python extension module, > right? A .so or .dll file? Is it also in the C counterpart? (If > that's not it, can you provide more details on how you compiled and > linked the two?) > > In general, referring to dynamically loaded things through symbols --- > even from within the same file --- tends to be slower than referring > to things that aren't dynamically loaded. > > What architecture are you on? If you're on the x86, maybe Numeric is > being stupid and allocating things that aren't maximally aligned. But > you'd probably notice a pretty drastic difference in that case. > > ... or maybe Numeric is being stupid and allocating things in a way > that causes cache-line contention. > > Hope this helps. I have been unable to find any references to dynamically loaded objects being slower than statically linked objects. I understand that there is an initial cost when the library is loaded that wouldn't be there in the static case, though, I don't know why it would be slower after that. Can you please provide some references for this, or explain why this would be? Thanks. -- Curtis Jensen ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: cjensen at bioeng.ucsd.edu (Curtis Jensen) Newsgroups: comp.lang.python Subject: cmsg cancel <1be8d8b.0112271702.69a599a at posting.google.com> Control: cancel <1be8d8b.0112271702.69a599a at posting.google.com> Date: Mon, 31 Dec 2001 03:54:32 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775464 27193 211.57.49.2 (31 Dec 2001 05:11:04 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:11:04 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From aahz at panix.com Wed Dec 26 19:07:21 2001 From: aahz at panix.com (Aahz Maruch) Date: 26 Dec 2001 16:07:21 -0800 Subject: references for shifting from Py1.5.2 to Py2.2? References: <3c2a5cd1_2@corp.newsgroups.com> Message-ID: In article <3c2a5cd1_2 at corp.newsgroups.com>, Joshua Muskovitz wrote: > >After a long hiatus, I'm returning to the Python community. I haven't >touched Python since 1.5.2, and I'd like to climb the curve to 2.2 as >quickly as possible. What are the definitive references for making the >transition? No beginner books, please. I'm a proficient developer, and I >really understood 1.5.2 pretty well. http://www.amk.ca/python/ Read the articles on 2.0, 2.1, and 2.2. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 5 days and counting From LLoeffler at home.com Tue Dec 4 13:28:08 2001 From: LLoeffler at home.com (Luke) Date: Tue, 04 Dec 2001 12:28:08 -0600 Subject: Script at boot References: Message-ID: <3C0D15B8.8090205@home.com> If python is in the system path, just put a link to "python spam.py" in your startup folder. Or just put the script there and if python is registered to handle py scripts, it should run (I haven't tried this). From bwilk_97 at yahoo.com Wed Dec 19 10:13:41 2001 From: bwilk_97 at yahoo.com (Bill Wilkinson) Date: Wed, 19 Dec 2001 15:13:41 GMT Subject: Dictionaries as records References: <7_XT7.28652$t07.4042756@twister.midsouth.rr.com> Message-ID: "John Roth" > In this case, you have one copy of each of your input > strings, not 15000 copies! The memory usage should be > pretty close to pure dictionary overhead. I don't see how that can be. If they were all copies of the same reference, wouldn't a change in one record be reflected in all? Below I make a change to one record and the others remain the same: >>>tbl[1]["g11"] #original value 'ldjfljdfkjdf' >>> tbl[1]["g11"] = "f" #change rec one to 'f'/ >>> tbl[1]["g11"] #it's value is different now. 'f' >>> tbl[2]["g11"] #rec 2 remains the same. 'ldjfljdfkjdf' Now the question. Am I misunderstanding what is happening above? Thank you for your assistance Bill From ajs at ix.netcom.com Sun Dec 2 10:22:00 2001 From: ajs at ix.netcom.com (Arthur Siegel) Date: Sun, 2 Dec 2001 10:22:00 -0500 Subject: More assignment/copy novice confusion Message-ID: <000701c17b45$17f55b00$a9e1fea9@carol> Given a class: >>> class p: def __init__(self,a): self.a=a Then - >>> m=p([1,2,3]) >>> r=m >>> m.a=([1,2,4]) >>> m.a [1, 2, 4] >>> r.a [1, 2, 4] clear enough. But - >>> m=p([1,2,3]) >>> r=p([]) >>> r.a=m.a >>> m.a=[1,2,4] >>> m.a [1, 2, 4] >>> r.a [1, 2, 3] And - >>> m=p([1,2,3]) >>> r=m >>> r.a=m.a >>> m.a=[1,2,4] >>> m.a [1, 2, 4] >>> r.a [1, 2, 4] I know this isn't the tutorial list. But - on the theory that my confusion on these kinds of issues is widely shared among novices - I thought it worth bringing up for discussion, clarification. Is anything here affected by the new style classes? Art From python_only at yahoo.com Wed Dec 26 04:09:47 2001 From: python_only at yahoo.com (Goh S H) Date: 26 Dec 2001 01:09:47 -0800 Subject: set decimal place References: <3c291037.4684696@news.tm.net.my> <3C292938.ED322C60@bellatlantic.net> Message-ID: <184fbd02.0112260109.4392423@posting.google.com> OR use built-in function round if you're expecting float instead of string Goh S H David Lees wrote in message news:<3C292938.ED322C60 at bellatlantic.net>... > >>> print '%8.1f' % (17.0/4) > 4.3 > >>> print '%8.4f' % (10.0/4) > 2.5000 > >>> print '%8.2f' % (20.0/7) > 2.86 > >>> print '%8.5f' % (20.0/7) > 2.85714 > > David Lees > > > kwsiew at tm.net.my wrote: > > > > is there a way(or any function) to set decimal place in python(to any > > decimal place I want) > > example : > > 1)17.0/4 = 4.25 (but I want it to be 4.3) > > 2)10.0/3 = 3.3333333333333335 (I want 3.3333 - 4 decimal place) > > 3) 20.0/7 = 2.8571428571428572( I want 2.86 or 2.85714) > > > > thank you > > rgds, > > SKW From tim.one at home.com Mon Dec 10 01:07:07 2001 From: tim.one at home.com (Tim Peters) Date: Mon, 10 Dec 2001 01:07:07 -0500 Subject: Draft PEP: string interpolation with backquotes In-Reply-To: <20011202170805.A36879@hishome.net> Message-ID: [Tim] >> Seems overspecified: "U" and "R" are also legit prefixes, so >> "I" should be too. The order of prefixes shouldn't matter (just as it >> doesn't matter now for mixing 'u'/'U' and 'r'/'R'). [Oren Tirosh] > The order of prefixes does matter. Try it. ur"foo" is valid, > but ru"foo" isn't. Woo hoo! So it is(n't). I stand humiliated yet enlightened. I'm a little disturbed that you knew this, though . > I don't know the original rationale for this decision but I tried > to keep it. Do you have any special arguments one way or the other? When in Rome ... > Naturally, the "i" prefix should be case insensitive, just like > "r" and "u". Cool. > ... > I meant str(). repr() isn't very useful when embedding strings > because of the quotes. Bingo. > I should have been more specific. Yes, this is inconsistent with > the standard use of backquotes which is equivalent to repr(), not > str(). I believe this is an acceptable compromise since it does the > Right Thing for formatting. I wonder how ABC's backquotes worked inside > strings. ABC didn't have the str-vs-repr distinction; backtick interpolation was *the* ABC gimmick, and produced a string the same as ABC's WRITE stmt given the same expression. This was like Python's "print" stmt, more str()-like than repr()-like. Backtick expressions could nest. That Python already uses `` for something else remains a hangup, > ... > A possible approach I have considered is to allow nested backticks > inside interpolations as long as they are surrounded by at least one > level of parens/braces etc. Ack -- support it fully, or not at all. The user's view of syntactic complexity derives from the lumpiness of the grammar. From aleax at aleax.it Tue Dec 11 09:03:28 2001 From: aleax at aleax.it (Alex Martelli) Date: Tue, 11 Dec 2001 15:03:28 +0100 Subject: jpeg files displayed in a loop References: Message-ID: <9v53nf02hm6@enews4.newsguy.com> "Wolfgang Teschner" wrote in message news:rp8a1u82me3g8v8ievtfjve9llbodq6rau at 4ax.com... > Hi, > I want to automatically display all jpeg files of a dir in a long > loop, with a wait time between the different displays. Just that. > No user input. > With PIL, it seems to be impossible because of TKinters mainloop. Why impossible? Doesn't Tkinter's "after()" method provides just what you need -- sheduling some action (in your case, moving to the next image) for X seconds from now? Alex From gmcm at hypernet.com Sun Dec 9 11:20:46 2001 From: gmcm at hypernet.com (Gordon McMillan) Date: 09 Dec 2001 16:20:46 GMT Subject: py2exe question References: Message-ID: Syver Enstad wrote: > My question on py2exe is: Is it possible to make an exe that searches > the normal sys.path for modules that doesn't exist in the exefile > itself? > > When I create a barebones py2exe exe by --excluding all modules I get > import error because py2exe overrides the import mechanism in python > to only search in the py2exe file itself, at least that's how I have > understood it. Does anybody have any tips for accomlishing this? First of all, the whole point of py2exe / Installer is to be able to run a "frozen" app from one Python version on a system that may have another Python version installed. If a Python 1.5 app tried to use the lib from a Python 2.1 installation, it would probably die. Second, Python figures out sys.path by starting a search based on the location of the exe. That's not going to work either. Not positive about py2exe, but I would guess that if you filled in sys.path with appropriate values yourself, it would search it (at least Installer will). But given the above 2 problems, I doubt you'll find a satisfactory solution. -- Gordon http://www.mcmillan-inc.com/ From karthikg at aztec.soft.net Tue Dec 11 00:32:31 2001 From: karthikg at aztec.soft.net (karthik Guru) Date: Tue, 11 Dec 2001 11:02:31 +0530 Subject: Can't import from mx.ODBC In-Reply-To: <8f8ffe67.0112101027.24a3dcaf@posting.google.com> Message-ID: okay am a newbie but i'm doubtful about something here. why is the sys.path showing 'C:\\Python21\\mx\\ODBC'? i mean the path s'd be set only upto c:\\Python21 i guess bcos the module mx.ODBC.Windows starts from the root (c:\\Python21). so when we do a import mx.ODBC.Windows, it should work fine without tweaking the sys.path i guess. karthik. -----Original Message----- From: python-list-admin at python.org [mailto:python-list-admin at python.org]On Behalf Of Sunit Joshi Sent: Monday, December 10, 2001 11:58 PM To: python-list at python.org Subject: Can't import from mx.ODBC Hello I'm trying to imort from mx.ODCB.Windows but I keep getting an error saying "ImportError: No module named mx.ODBC.Windows". I checked the sys.path and I do have the following: 'C:\\Python21\\mx\\ODBC' Could someone please tell me what is wrong here..?? thanks Sunit sjoshi at ingr.com -- http://mail.python.org/mailman/listinfo/python-list From dalke at dalkescientific.com Sat Dec 8 02:03:40 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Sat, 8 Dec 2001 00:03:40 -0700 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C100BB2.6446E896@cosc.canterbury.ac.nz> <7da8d8f8.0112070206.49e1bef4@posting.google.com> <3C114F6D.D1E2D291@attbi.com> Message-ID: <9use41$si0$1@slb4.atl.mindspring.net> Chris Barker wrote: >That sounds to me like a really good reason why we don't have to worry >about femtoseconds. Resolving time down to units that small is simply >incompatable with calender dates. "I started my molecular simulation at 13:28 using a timestep site of 0.75 femtoseconds." But in truth, when I did molecular modelling we used two units of time. One was standard unix time, for when the program started and stopped, and the other was simulation time, which was a floating point number of femtoseconds. We didn't try to use the same time system for both numbers, since that would be silly generalization. Still, perhaps someday it wouldn't be silly, like when we're using 128 bit machines, so we could keep track of the number of zeptoseconds (10**-21 sec) since the start of the Universe. Andrew dalke at dalkescientific.com From philh at comuno.freeserve.co.uk Sun Dec 30 19:39:54 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Mon, 31 Dec 2001 00:39:54 +0000 Subject: Is learning Python "extraordinary"? References: Message-ID: On Sat, 29 Dec 2001 13:29:35 -0800, Jesse F. W wrote: > > I am a high school senior, and like many others, I am applying >to college. I am applying to MIT (as well as many other schools). >MIT describes what they are looking for as students who do or have >done "extraordinary things". My question is this, Is teaching myself >Python (with the aid of the Python tutorials and some help from the >various lists) an "extraordinary thing"? Since (just about) everyone here has learned Python, why would we think it was extraordinary? -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From ben at wblogan.net Sun Dec 9 06:51:06 2001 From: ben at wblogan.net (Ben Logan) Date: Sun, 9 Dec 2001 06:51:06 -0500 Subject: It's hard to find documentation In-Reply-To: ; from justin@iago.org on Sun, Dec 09, 2001 at 12:33:49AM -0500 References: <200112081328040980.0156CC2B@mail.rdc1.sdca.home.com> Message-ID: <20011209065106.B15984@newcreature.org> My two cents: The main reason that I picked learning Python over Perl was the documentation. Sure, Perl is documented, but the readily available docs (installed on my system) were in the form of manpages. Manpages are great, but when you're learning a language and you need to jump to a certain function's documentation, it's very handy to have a hypertext reference manual such as HTML or info. The other reason was the tutorial that came with Python. It made it a whole lot easier to get started. Of course, now I like Python for reasons other than its docs. :) Regards, Ben On Sun, Dec 09, 2001 at 12:33:49AM -0500, Justin Sheehy wrote: > "Bruce Eckel" writes: > > > So let's try to find "Extending and Embedding the Python > > Interpreter". Using 'search,' using 'advanced search,' nothing > > comes up with that title. Maybe it doesn't exist. Who knows. I have > > this struggle a lot when hunting for python information. > > The Python documentation is great and well-organized. On the other > hand, the search mechanism on the python.org website is utterly useless. > > If I start at http://www.python.org/doc/ I can usually find what I'm > looking for very quickly... I gave up on the search interface years > ago. I try the above doc location first, and Google second. That > combination has worked quite well for me. > > -Justin -- Ben Logan: ben at wblogan dot net OpenPGP Key KeyID: A1ADD1F0 From wurmy at earthlink.net Mon Dec 3 16:44:55 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Mon, 03 Dec 2001 21:44:55 GMT Subject: Problem when calling __init__() in base class References: Message-ID: <3C0BF25F.97FD6A0B@earthlink.net> "S?bastien Cabot" wrote: > > (With Python2.1.1, on Debian, with Python megawidget) > > We have the following in the class 'ScrolledFrame' of the Pmw. > > class ScrolledFrame(Pmw.MegaWidget): > def __init__(self, parent = None, **kw): > ... > > In my inherited class, I call __init__() of the base class > 'Pmw.ScrolledFrame.' > > class MyScrolledFrame(Pmw.ScrolledFrame): > def __init__(self, parent, **kw): > Pmw.ScrolledFrame.__init__(self, parent, kw) > ... I think this should be: Pmw.ScrolledFrame.__init__(self, parent, **kw) These are keyword arguments. If you pass them to another function as 'kw', then you pass a dictionary. If you pass them as **kw, to you act like you called the other function with the same keyword arguments. It's syntactic sugar for the apply() function. --Hans From debl2nonospammywhammy at bellatlantic.net Thu Dec 27 12:47:08 2001 From: debl2nonospammywhammy at bellatlantic.net (David Lees) Date: Thu, 27 Dec 2001 17:47:08 GMT Subject: A new forum is up! References: <40dbad98.0112262238.73fc14f9@posting.google.com> Message-ID: <3C2B5E9F.FF1C2CC@bellatlantic.net> It is a bit hard to tell what the 'feel' is, with only 1 message(containing 4 words) posted in the whole forum. Reading the privacy statement, cookies are used by this site, if anyone cares. david lees Andrew Nguyen wrote: > > A new forum for Python is up. It has a better feel to it than this > forum (in my opinion) > it is at ezboard at: > http://pub19.ezboard.com/bthepythonmessageboard95602! From wilfartg at hotmail.com Tue Dec 18 06:52:17 2001 From: wilfartg at hotmail.com (Geoffrey Wilfart) Date: 18 Dec 2001 03:52:17 -0800 Subject: Passing object arguments to C functions exposed to Python layer Message-ID: <67060007.0112180352.6e3008a4@posting.google.com> Hello I have created a new object type as described in Python documentation, that I use as a wrapper for a C structure. The object is like : typedef struct { PyObject_HEAD my_c_struct my_struct; } MyObject I have then a "constructor" function, that creates a new MyObject and initializes the C structure. It returns the newly created object. I use it from Python as: my_obj = open() Then, I would like to "close" the object, i.e. delete the C structure, and then deallocate it. However, if I use a call like: close(my_obj), the "args" value is not "my_obj". Could someone tell me what I should do in this case ? Thanks a lot. Geoffrey From joost_jacob at hotmail.com Fri Dec 14 20:27:56 2001 From: joost_jacob at hotmail.com (J.Jacob) Date: 14 Dec 2001 17:27:56 -0800 Subject: Unsung Python modules References: <3dsnad226b.fsf@ute.mems-exchange.org> Message-ID: <13285ea2.0112141727.515390d2@posting.google.com> [amk] > > What's your favorite unsung module? > Besides the ones you mention i would like to add pygame. It can sing itself be cause it has sound too ! It is the best thing if have found to easily do fast graphics, just 2D style with pixel perfect (.GIF or .BMP or whatever) images and still 100 frames per second. Not the ugly realtime computer rendered 3D stuff, but it can do openGL too, didnt test it myself. You can make a game with pygame but also anythin else that needs to do things with .GIFs moving around your screen. Makes SDL available for Python programmers (try SDL in C, argh:) From mixo at beth.uniforum.org.za Tue Dec 4 03:57:23 2001 From: mixo at beth.uniforum.org.za (mixo) Date: Tue, 04 Dec 2001 10:57:23 +0200 Subject: 'ioctl ' call in python (serial port reading) Message-ID: <3C0C8FF3.7060500@beth.uniforum.org.za> I am current trying to drop 'RTS' (Request To Send) on a serial port. In 'c' I do the following : ++++++++++++++++++++++++++++++++++++++++++++++++ . . int fd, mdlns;//fd is a file discriptor . . ioctl (fd, TIOCMGET, &mdlns); mdlns &= ~TIOCM_RTS; ioctl (fd, TIOCMSET, &mdlns); . . . +++++++++++++++++++++++++++++++++++++++++++++++ What would the equivilent code in 'python' be? How can I disable 'RTS' on a serial port? From mwh at python.net Wed Dec 12 09:13:07 2001 From: mwh at python.net (Michael Hudson) Date: Wed, 12 Dec 2001 14:13:07 GMT Subject: Import random References: Message-ID: "Daniel Pote" writes: > >>>> from math import exp, sqrt > >>>> 4 * exp(-0.5)/sqrt(2.0) > > > Result is: 0.0 Congratulations, you have a seriously broken installation. Did you compile it yourself? Which compiler did you use? I believe python 2.2 will work better on HP-UX than any previous release, so you may want to wait a few weeks for that to be released. Or you could try compiling floatobject.c without optimizations; that seems to help sometimes (but not on HP-UX, I thought). Cheers, M. -- I'm okay with intellegent buildings, I'm okay with non-sentient buildings. I have serious reservations about stupid buildings. -- Dan Sheppard, ucam.chat (from Owen Dunn's summary of the year) From wurmy at earthlink.net Thu Dec 6 23:16:52 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Fri, 07 Dec 2001 04:16:52 GMT Subject: Why doesn't this work? References: Message-ID: <3C1040B2.16D65AEF@earthlink.net> Courageous wrote: > > Python 2.2b2 (#26, Nov 16 2001, 11:44:11) [MSC 32 bit (Intel)] on > win32 > Type "copyright", "credits" or "license" for more information. > IDLE 0.8 -- press F1 for help > >>> def f(): return [1,2,3] > > >>> f() > [1, 2, 3] > >>> f().append(4) > >>> l=f().append(4) > >>> l > >>> > > Obviously I can fix this, but I'm wondering why it doesn't work > the way I expected it to? Because append() doesn't return a value... it changes the list in place. (Well, actually, it returns None.) --Hans From aleax at aleax.it Fri Dec 28 11:25:14 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 17:25:14 +0100 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <889C110F5BBBFAFD.A03B35C232EA2760.70B0892CB9479323@lp.airnews.net> Message-ID: <1$--$$_----_---%%$@news.noc.cabal.int> "Cameron Laird" wrote in message news:DAB7DC5D2F730DD9.72339FF5F625AF55.12461E9D1E9E52F3 at lp.airnews.net... > In article , Alex Martelli wrote: > >"Cameron Laird" wrote in message > >news:889C110F5BBBFAFD.A03B35C232EA2760.70B0892CB9479323 at lp.airnews.net... > . > . > . > >Maybe, but Python could be usable as an extension language > >even if the application was implemented otherwise, in the > >right environments (JVM: Jython always usable where Java > >is; Microsoft COM/Automation). > . > . > . > Yikes! Let me make this perfectly clear: YES, > Python deserves consideration as an extension > language even in applications largely implemented > in other languages such as C and Java. I apolo- > gize for making that obscure, for it definitely > was one of the points I intended to make. > > As usual, Alex and I agree. Hmmm, yes, but my point was slightly "skewed" -- I was playing devil's advocate here. Even if the customer agrees that, yes, Python is what they surely want to use for extending and tweaking the application, this doesn't force you to code the application in Python -- you may still (although you shouldn't:-) code it in other languages (partly depending on platform issues). Alex ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!newsfeed.berkeley.edu!ucberkeley!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Alex Martelli" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:08:24 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775279 27193 211.57.49.2 (31 Dec 2001 05:07:59 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:07:59 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From sholden at holdenweb.com Tue Dec 4 08:46:54 2001 From: sholden at holdenweb.com (Steve Holden) Date: Tue, 4 Dec 2001 08:46:54 -0500 Subject: Help with COM example from the PPWin32 book References: Message-ID: "Will Ganz" wrote ... > Platform: > Windows 98SE, Excel2000, PythonWin 2.1.1 (#20, Jul 26 2001, 11:38:51) > HP-6648C(K6-2 550 w/192megs RAM, 20gig hd w/11gig free) > > Problem: > The COM example on pages 68/69 from the 'caiman' book doesnt work. Gives a > error of 438 when VBA code from Excel is executed. > > Discussion: > >>>>>> SimpleCOMServer.py <<<<<<<<<<<<<< > #simple COM Server demo > > class PythonUtilities: > _public_methods_ = [ 'SplitString' ] > _reg_progid_ = "PythonDemos.Utilities" > _reg_clsid_ = "{B91A4120-E716-11D5-9D0B-FFFFFF000000}" > > def SplitString( self, val, item=None ): > import string > if item != None: item = str(item) > return string.split(str(val), item) > > if __name__ == '__main__': > print "Registering COM server . . . . . . . ." > import win32com.server.register > win32com.server.register.UseCommandLine(PythonUtilities) > > Invoked with c:\>python SimpleCOMServer.py > Output: > Registering COM server . . . . . . . . > Registered: PythonDemos.Utilities > > In PythonWin Editor goto > Tools > COM browser > Registered Categories > Python COM Server > IID: PythonDemos.Utilities, double click to get > {B91A4120-E716-11D5-9D0B-FFFFFF000000} > > So, I know that this is registered. Right?? > > In Excel's VBA Editor the following code is entered > > Sub TestPython() > > Set PyUtil = CreateObject("PythonDemos.Utilities") > response = PyUtil.SplitString("Hello from Python") > > For Each Item In response > MsgBox Item > Next > > End Sub > > Invoked by clicking on the Run button on the toolbar and it gives an error > of, > > Run-time error '438' > Object doesn't support this property or method > > When Debug is clicked, the yellow highlight is on this line: > > response = PyUtil.SplitString("Hello from Python") > > Yes, I have RTFM, RTFFAQ, STFA(Searched the archive), BMFB(Bought more > books), RTFT(Read those too), used Google, looked at Mark Hammond's site & > looked at his ppt files, and all to no avail. > > Does anyone know what is going on here?? If you look more carefully at the Python source in the book you will notice that the SplitString method is not indented far enough. This makes it a function in the main program rather than a method of class PythonUtilities. regards Steve -- http://www.holdenweb.com/ From emile at fenx.com Tue Dec 11 19:31:12 2001 From: emile at fenx.com (Emile van Sebille) Date: Tue, 11 Dec 2001 16:31:12 -0800 Subject: Getting at an item in a list of tupples References: <9v66mi$17mi$1@newshost.nmt.edu> Message-ID: <9v68qp$da5j6$1@ID-11957.news.dfncis.de> "Bob Greschke" wrote in message news:9v66mi$17mi$1 at newshost.nmt.edu... > Here's what I've got > > a = [] > a.append((ints, floats, strings)) > a.append((ints, floats, strings)) > a.append((ints, floats, strings)) > a.append((ints, floats, strings)) > ... > > I want to do something like > > print max(of all of the floats) > print min(of all of the floats) > > In general, how do you get at the floats (or ints, or strings)? We > can see doing something with map() calling a function that returns the > second item, but isn't there something a little simpler? > Assuming you've got tuples of length 3 where index 1 is always a float: >>> a = [] >>> a.append((1,2.,'3')) >>> a.append((11,12.,'13')) >>> a.append((21,22.,'23')) >>> a [(1, 2.0, '3'), (11, 12.0, '13'), (21, 22.0, '23')] >>> max([i[1] for i in a]) HTH, -- Emile van Sebille emile at fenx.com --------- From dean.hall at computer.org Mon Dec 3 10:26:14 2001 From: dean.hall at computer.org (Dean Hall) Date: 3 Dec 2001 07:26:14 -0800 Subject: A Python bytecode assember? References: <9uf0kd$1r4r$1@agate.berkeley.edu> Message-ID: <998474b8.0112030726.642a3c8c@posting.google.com> Daniel Yoo wrote in message news:<9uf0kd$1r4r$1 at agate.berkeley.edu>... > Hi everyone, > > I'm planning to do a small project with Python's bytecode, and I'd > like to know if anyone's written a bytecode assember for it? > > I've taken a look at Michael Hudson's 'bytecodehacks' package at: > > http://bytecodehacks.sourceforge.net/ > > but the code looks like it hasn't been touched since March 2000. Can > anyone talk about their experiences with bytecodehacks? I need a > bytecode assember that supports jumps, so if someone's hacked up > bytecodehacks to support this, I'll be a very happy person. I wrote a tool that helps study code objects; it doesn't assemble, but it will help you look in and around a code string. See: http://sourceforge.net/project/showfiles.php?group_id=32525 The file dismantle.py and the doc co_info.pdf might be helpful to you. It seems like it wouldn't be too difficult to make an assembler using dis. Just make a reverse dict from dis.opname for the translator. Python has the bytecodes 113 JUMP_ABSOLUTE and 110 JUMP_FORWARD that you want. I've searched for ways to take a Python code object and substitue the co_code string; but the code object is static, so I didn't get far. The simple hack would happen in the .pyc file. !!Dean From ktilton at nyc.rr.com Thu Dec 27 04:09:50 2001 From: ktilton at nyc.rr.com (Kenny Tilton) Date: Thu, 27 Dec 2001 09:09:50 GMT Subject: REPOST: Re: age of new pythonistas [was: The Editor Poll results are in!] References: <60c49aa9.0112202148.7218555b@posting.google.com> Message-ID: <7$--$$-$$$$%%-$$-$@news.noc.cabal.int> Tim Hammerquist wrote: > > Dan Compton graced us by uttering: > > Wait, didn't you give up on Perl before you knew it well enough to make > that kind of statement? Intelligence is all about dealing with partial information. Experience is all about needing less and less information all the time to make accurate judgments. Got those from fortune cookies, FWIW. kenny clinisys ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Kenny Tilton Newsgroups: comp.lang.python Subject: cmsg cancel <3C2AE63A.24D736F2 at nyc.rr.com> Control: cancel <3C2AE63A.24D736F2 at nyc.rr.com> Date: Mon, 31 Dec 2001 05:19:38 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775874 27193 211.57.49.2 (31 Dec 2001 05:17:54 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:17:54 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From sasoft at gmx.de Sun Dec 2 13:41:14 2001 From: sasoft at gmx.de (cruciatuz) Date: Sun, 2 Dec 2001 13:41:14 -0500 Subject: url-string transformation: from relative to absolute Message-ID: <20011202134114.A12397@blackscarab> it's a little bit embarassing to ask this question, but ... :( Question: I got a little script for fetching news from a website (attached) My problem is that the links in the fetched site are all relative. example: i want to prepend: http://www.pro-linux.de/ not a very complicated thing, i know. but i couldn't figure out HOW. anybody knows a solution? -- thx in advance, Stefan Antoni -------------- next part -------------- #!/usr/bin/env python import httplib, string class plNEWS: def __init__(self): pass def _fetchSiteData(self): # connecting to server and checking for problems http = httplib.HTTP('www.pro-linux.de') http.putrequest('GET', '/') http.putheader('Accept', 'text/html') http.putheader('Accept', 'text/plain') http.endheaders() httpcode, httpmsg, headers = http.getreply() """ print "<<< Server Says: >>>\n\n", httpcode, httpmsg, headers print "<<< End >>>" """ if httpcode != 200: raise "Server Said %i, this means something is wrong" % httpcode # actual retrieving the site site = http.getfile() siteData = site.read() site.close() return siteData def _parseSiteData(self): siteData = self._fetchSiteData() siteLines = siteData.splitlines() i = 0 # a counter slice_start = 0 slice_end = 0 for line in siteLines: i = i+1 if line.strip() == 'NEWS': slice_start = i elif line.strip() == 'AKTUELL': slice_end = i # make absolute links from relative links in "mehr" # is to implement return siteLines[slice_start+4:slice_end-9] def _showSite(self): site = self._parseSiteData() #print site for line in site: print line def run(self): self._showSite() if __name__ == '__main__': pl = plNEWS() pl.run() -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 240 bytes Desc: not available URL: From tjreedy at home.com Mon Dec 3 22:12:48 2001 From: tjreedy at home.com (Terry Reedy) Date: Tue, 04 Dec 2001 03:12:48 GMT Subject: Handling division by zero References: <3C0C15AF.E1441FBF@motorola.com> Message-ID: "Stephen Boulet" wrote in message news:3C0C15AF.E1441FBF at motorola.com... > I have some math operations going on where sometimes the divisor will be > zero. > > Is this an acceptable way to handle this: > 1. test if the divisor is zero > 2. if so, instead of dividing by it, multiply by a large number > ? 1. is okay, but see below. 2. depends on application. Alternative. try: z= x/y except ZeroDivisionError: #or whatever its called z=x*big If y = 0 is rare (say < 10% of cases), this is on average faster Terry J. Reedy From matt at avaquest.com Wed Dec 12 15:48:53 2001 From: matt at avaquest.com (Matthew King) Date: Wed, 12 Dec 2001 15:48:53 -0500 Subject: distutils, shared libraries and Mac OS X Message-ID: <3C17C2B5.8060607@avaquest.com> Hi. I was just installing Sketch on Mac OS X 10.1.1 and ran into the following problem with Python 2.1.1 distutils. Shared libraries on OS X have the .dylib extension and because of this find_library_file() was failing to find my tcl/tk libraries... As a fix, in distutils/unixccompiler.py I made the following change: 76c76,78 < --- > import sys > if sys.platform[:-1] == "darwin": # Mac OS X > shared_lib_extension = ".dylib" this worked, but I'm curious if there was a better way to do it? any advice would be appreciated. - matt From henrik at moskau.hmotakef.homeip.net Sat Dec 29 16:19:55 2001 From: henrik at moskau.hmotakef.homeip.net (Henrik Motakef) Date: 29 Dec 2001 21:19:55 +0000 Subject: values of sys.platform? for a serial port lib References: Message-ID: <873d1tiv0k.fsf@moskau.hmotakef.homeip.net> Chris Liechti writes: > i'm interested in values for "sys.platform" and, if possible, the name of > the serial port (an how the ports are numbered ttyS0, ttyS1 etc.) > e.g "linux2" and "/dev/ttyS%d" % port, numbering starting at zero. I don't really know where sys.platform is defined (I ended up with a "grep -r "PLATFORM" * in the source tree, resulting in a line "Makefile.pre.in: $(CC) -c $(CFLAGS) -DPLATFORM='"$(MACHDEP)"'...", so I think it's defined by autoconf/automake; maybe that helps...), but FYI: # python -c "import sys; print sys.platform" openbsd3 # ls /dev/tty* /dev/tty /dev/ttyC5 /dev/ttyc2 /dev/ttyp4 /dev/ttype /dev/ttyq8 /dev/tty00 /dev/ttyC6 /dev/ttyc3 /dev/ttyp5 /dev/ttypf /dev/ttyq9 /dev/tty01 /dev/ttyC7 /dev/ttyc4 /dev/ttyp6 /dev/ttyq0 /dev/ttyqa /dev/tty02 /dev/ttyC8 /dev/ttyc5 /dev/ttyp7 /dev/ttyq1 /dev/ttyqb /dev/tty03 /dev/ttyC9 /dev/ttyc6 /dev/ttyp8 /dev/ttyq2 /dev/ttyqc /dev/ttyC0 /dev/ttyCa /dev/ttyc7 /dev/ttyp9 /dev/ttyq3 /dev/ttyqd /dev/ttyC1 /dev/ttyCb /dev/ttyp0 /dev/ttypa /dev/ttyq4 /dev/ttyqe /dev/ttyC2 /dev/ttyCcfg /dev/ttyp1 /dev/ttypb /dev/ttyq5 /dev/ttyqf /dev/ttyC3 /dev/ttyc0 /dev/ttyp2 /dev/ttypc /dev/ttyq6 /dev/ttyC4 /dev/ttyc1 /dev/ttyp3 /dev/ttypd /dev/ttyq7 # w 9:18PM up 16:54, 5 users, load averages: 1.17, 1.24, 1.23 USER TTY FROM LOGIN@ IDLE WHAT henrik C0 - 4:24AM 0 xemacs http.ml henrik p2 :0.0 8:04PM 1:06 gimp devel/yeah/docs/request_process hth Henrik From chris.gonnerman at newcenturycomputers.net Sat Dec 29 12:39:42 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Sat, 29 Dec 2001 11:39:42 -0600 Subject: pty.spawn() and friends References: Message-ID: <002d01c1908f$d28a8120$0101010a@local> ----- Original Message ----- From: "James T. Dennis" > I've been trying to learn more Python and I've been sticking with > the somewhat obscure kinds of things that I've routinely needed to > do as a system administrator. I came across the pty module as a > primitive alternative to using expect and it seems like I should > be able to so simple work with it. > > So naturally I tried to implement the simplext expect script > (autopasswd) as a Python script using the pty.spawn() function. > > This doesn't work as I'd expect. I about pulled a cranial muscle understanding the pty.spawn() code; evidently it runs a subprocess which communicates via callbacks. If you give no callback arguments, it does indeed behave much like os.system(). > ... well it certainly baffles the programmer that tries to use it. No kidding. Ouch. > My expectation was that this would spawn the program in question > ("/usr/bin/passwd" for my tests) and allow me to print to its > input and read from its output; under programmatic control. I > would thus have to cross-wire the inputs and outputs of the child > process with some sort of handle, object, or file descriptor on > my (parent) process. To do this, you need to roll a wrapper function using pty.fork(). > However it seem like pty.spawn() doesn't do any cross-wiring. It does, if you use the callbacks. > It seems to simply start a sub-process that interacts with my > terminal, basically like the os.system() function. (The > difference is that pty.spawn() takes a tuple of arguments while Huh? Three arguments does not a tuple make (at least from the caller's point-of-view. > os.system() takes a string and passes it to a shell for parsing > and execution). > > That seems pretty lame. It's like the author of the pty module > didn't know what the author of the os module was doing and > provided a gratuitously similar function with no actual relevance > to psuedo-ttys and no additional functionality. In so doing, > they've raised (my) expectations and failed to satisfy them. Explained above. > What pty.spawn() *should* do (to meet with reasonable expectations > that it would have something to do with spawning subprocesses > *UNDER THE CONTROL OF A psudo-tty*) is return a file-like object > to which one can write (commands or "keystrokes") and from which > one could read (responses, prompts, potentially screen updates). Also explained above. I'm not real sure why it was done this way; the callback method is not my first choice. It might interact well with GUI code, though. > Ideally this would come with some convenience methods, and > members/constants (possibly inherited from a common module with > curses, and/or tty, to allow one to send keystrokes by their > symbol names (rather than having to manually fuss with escape > sequences) and receive data as structures of character/attribute > data). (Imagine being able to run a child ncurses monitoring > process and automatically programmatically respond to a specific > bit of text "turning red" or "going on the blink"). Sounds good. When will you post the code? :-) :-) [humor,ar,ar] > None of this would be nearly so irritating if USAGE EXAMPLES had > been provide to explain what the programmer should expect of the > program. Ditto here! > Naturally I had to fuss with it for some time before figure out > that it really was a lame and redundant function rather than my > own lack of skill. The fact that the reference docs give a couple > of optional arguments: [,master_read[,stdin_read]] which are > supposed to be: > > functions which read from a file-descriptor > > ... complicates it further. What kind of function could I write > that "reads from a file-descriptor" but which takes no arguments > telling it *which* file-descriptor! CALLBACKS. You implement a function like so: def my_read_callback(fd, nbytes): # your code here. and the pty.spawn() function calls it, assuming you do this: pty.spawn(my_argv, my_read_callback, my_std_read_callback) (for instance). > At first I thought this was trying to say to call pty.spawn() with > one argument to act sort of like os.system(), or two arguments > (a tuple and a function invocation) to spawn a process under the > control of that function. (Envisioning something where *that > function's* stdin and stdout where wired up to the spawned > process' stdout and stdin respectively). (If that was the case > I'd expect that the optional third argument would be another > controlling function for handling the child process' stderr; > communications between the two would be "merely a matter of > programming"). Hopefully my explanation makes this clearer. Handling stderr *would* be nice... (or does handling stdout also handle stderr with pty's? I haven't tried it.) > Ugh! Between this and the equally frustrating Python curses docs > I'm pretty grumpy. curses is called that for a reason. ;-) If you aren't a curses programmer at the C level it is certainly hard to understand. From danielk at aracnet.com Thu Dec 27 11:08:19 2001 From: danielk at aracnet.com (Daniel Klein) Date: Thu, 27 Dec 2001 08:08:19 -0800 Subject: Where to post Jython questions? References: Message-ID: On 27 Dec 2001 01:38:24 +0100, Martin von Loewis wrote: >Oleg Broytmann writes: > >> On Wed, Dec 26, 2001 at 09:45:22AM -0800, Daniel Klein wrote: >> > Is the the proper place to post questions/conversations for Jython? If >> > not, please advise. >> >> http://www.jython.org/, Resources, Mailing Lists. > >Nevertheless, I think questions on Jython are welcome, here, too. Some >may turn out to be Python questions proper. > >Regards, >Martin Ok then... The question is: Is there a Jython equivelant of '.pythonrc' (or '.idlerc') to automatically load modules on startup? Dan From Tom.Karas at htp-tel.de Sat Dec 29 13:37:09 2001 From: Tom.Karas at htp-tel.de (Tom Karas) Date: Sat, 29 Dec 2001 19:37:09 +0100 Subject: Was that to inpolite? Re: Call for a small program References: <3C2BAEF3.CC34B8DD@htp-tel.de> Message-ID: <3C2E0D55.9EC9B67F@htp-tel.de> Hello out there. A few quick questions: Was my "Call" to inpolite? Was it the wrong place / newsgroup to ask? I just wonder, because there wasn?t even a reaction like "Go away" or "Plonk / Killfile" This may sound odd, but i would be even willing to pay for a solution that would fit the basic needs (running on windows and linux and some features) Best regards Tom Karas -- The early bird catches the worm. If you want something else for breakfast, get up later. From kmilo0 at hotmail.com Wed Dec 26 13:56:09 2001 From: kmilo0 at hotmail.com (Kmilo) Date: 26 Dec 2001 10:56:09 -0800 Subject: Problems with tkinter in python 2.2 Message-ID: <19eb8d3d.0112261056.2227760e@posting.google.com> I download today to the python ftp and install python2-2.2-2.i386.rpm python2-devel-2.2-2.i386.rpm python2-docs-2.2-2.i386.rpm python2-tkinter-2.2-2.i386.rpm here I have a dependence problem by libtcl.so.0 libtk.so.0 python2-tools-2.2-2.i386.rpm python work very good, until I run Tkinter.py bash-2.04# python2 /usr/lib/python2.2/lib-tk/Tkinter.py Traceback (most recent call last): File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 35, in ? import _tkinter # If this fails your Python may not be configured for Tk ImportError: shared object not open I have Tcl8.3.2-16.rpm Tk8.3.2-16.rpm tix8.1-5.rpm in SuSe Linux 7.1 Somebody know what i have to do for run, tkinter.py? From Tom.Karas at htp-tel.de Sun Dec 16 10:38:11 2001 From: Tom.Karas at htp-tel.de (Tom Karas) Date: Sun, 16 Dec 2001 16:38:11 +0100 Subject: How 2 invoke python 2 read from text file under W2k References: <3C1BBECF.E460DBEC@htp-tel.de> <3C1BCA57.C5E59D9B@bellatlantic.net> Message-ID: <3C1CBFE3.B106A192@htp-tel.de> David Lees wrote: > You might find it easier to use an IDE for writing code, such as > PythonWin. I like PythonWin, but that is personal preference. Hello folks, Thanks for your help David. It worked quite from the beginning - help at its best. But unfortunatley i still have some problems: I tried to compile the following code: temperature = input("What is the temperature of the spam?") if temperature > 50: print "The salad is properly cooked." else: print "Cook the salad some more." After Hitting the "run" button the script started with a little "popup" window to insert the temperature - but after inserting the temperature i got the error code: returned exit code 0 A search at groups.google.com for the error gave the following result: "The script contains only definitions, but there's no function-call. So you have to import the module ("import dlgtest") and then call one of the defined functions, maybe "dlgtest.demo()" or something like that (you have to look in the source)." This answer may be sufficient for some one with more programming skills than me - but i do not what to do but to wild guessing and inserting "import dlgtest" here an there in my source. Could you or any one give me some hints of this modules (link would be cool ) and / or change my little script so that i will run ? Thanks again for all your help. Best regards Tom Karas From rdsteph at earthlink.net Thu Dec 27 18:44:15 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Thu, 27 Dec 2001 23:44:15 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA4D3.5F0BC994@earthlink.net> Message-ID: <9$--$$_----_-$-_%$@news.noc.cabal.int> Thanks, Dave. I suspect you are right about this. When I went searching for a "scripting" language to learn, about 10 months ago, (after becoming frustrated with Java as a "hobby" language) I really narrowed down the field to just Python and Ruby. I was quite torn because I liked what I saw of Ruby from the Pickaxe book, its a great book! But I ultimately chose Python because I perceived it might be a little easier for me to learn. After all, I have no "C" background at all and no Perl experience either; and rightly or wrongly, what I could find on the web and in the two newsgroups helped me make a close decision to try Python. Dave Thomas wrote: > Ron Stephens writes: > > > Thus, while I admire Ruby, I suspect that it divides the pool of > > developers who might otherwise be all in the Python *camp*. > > From personal experience, I have to disagree. I tried many times to > like Python. I used it on projects and for personal work, but it > never clicked. I couldn't tell you why, and I know it isn't a failing > of the language. It's just that Python and my brain have some kind of > impedance mismatch. > > When I tried Ruby, I fell in love within an hour, so much so that I > was driven to write a book about it. > > This isn't a "Ruby is better than Python" response. It's just an > observation. Ruby and Python are different, and I suspect there is a > substantial body of developers out there who, like me, have a > preference for one over the other. I don't believe that Ruby is > raiding the Python camp. I believe that Ruby is attracting people to > OO scripting who would not otherwise be doing it. > > Regards > > Dave ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2BB2E8.737556A5 at earthlink.net> Control: cancel <3C2BB2E8.737556A5 at earthlink.net> Date: Mon, 31 Dec 2001 01:51:53 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775494 27193 211.57.49.2 (31 Dec 2001 05:11:34 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:11:34 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From andreas at mtg.co.at Sun Dec 2 15:50:42 2001 From: andreas at mtg.co.at (Andreas Kostyrka) Date: Sun, 2 Dec 2001 21:50:42 +0100 Subject: A modest indentation proposal In-Reply-To: References: Message-ID: <200112022050.fB2Kol117086@lap1.mtg.at> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am Samstag, 1. Dezember 2001 08:25 schrieb Erann Gat: > No, I'm not asking for a fundamental change to the language syntax. I'm > asking for the functionality of pindent.py to be packaged up as an emacs > mode, and for the parser to warn me when there's a discrepancy between the > indentation that pindent.py would produce and what's actually in the > file. I'm also asking that "# end for" be spelled ";". That's all. This a FUNDAMENTAL change how it would work. It would generate Warnings for existing source code (find/grep are your friends here). Basically it would change how the Interpreter behaves: It would emit extra data on some file descriptor. Probably stderr, which might make some environment consider a script broken. ;) If there would be a real problem, this might be acceptable. To solve a non-problem (believe me, I've been hacking Python since 1.3), this is not acceptable. Alternativly, one could add an switch to the python interpreter to have "; indent" mode. But because of the legacy problem (see below) one would have to maintain 2 languages indefinitly. You are basically saying (because you try to manipulate it this way), that your incompetent bosses are thinking is more important than millions other users? Actually, going thru our old Python cvs archives, I've noticed that I personally produced ";" at the line end code mostly in 1996/1997. Do you propose that I should change my quite legal code for your fancy? (Well, it would be just 1-2kLOCs that I'd have to correct and recheck manually.) > > Did you manage to convince the lispers that the compilers should support > > an optional ()-less infix syntax to make your boss happy? They'd > > probably say "so write a read macro" :) > > It turns out that what made the bosses unhappy about Lisp was not the Well, actually, open source is here where it is, because it mostly doesn't give a damn what PHB (see www.dilbert.com) think about it's merits. Your proposal doesn't have technical merit. Don't except that it will be done. Additionally, YOU could implement YOUR changes, make a nice patch, and then it might be considered to be included with the mainstream python. Even then I wouldn't count on it, because it would require all Python programmers to learn a new Syntactic WART (because your proposal is a WART) to understand others source code. > syntax but the fact that no one uses it. And before you protest and tell > me that it's not true that no one uses Lisp, yes, I *know* it's not true. > I also know that indentation is not much of a problem in practice. You basically know that your proposal doesn't have merit. So why are you still trying to argue it? Andreas - -- Andreas Kostyrka; Raiffeisenstr. 16/9; 2320 Zw?lfaxing Tel: +43/676/4091256; Fax: +43/1/7065299 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8CpQlHJdudm4KnO0RAlI6AJ429u+pqnLFqdzTacZYjtoOXlmzfACgm7JJ 3ljCwjCtc1l67QR1w6t/ZwQ= =BZD8 -----END PGP SIGNATURE----- From coca at houston.rr.com Sat Dec 22 01:48:18 2001 From: coca at houston.rr.com (Dan Compton) Date: Sat, 22 Dec 2001 06:48:18 GMT Subject: Troubleshoot: Problem getting Tkinter to work with Python 2.2C1 on Linux References: <60c49aa9.0112202125.520fd62@posting.google.com> Message-ID: Nevermind this post. I figured out what I had done wrong. Dan "Dan Compton" wrote in message news:60c49aa9.0112202125.520fd62 at posting.google.com... > I built python 2.2 release candidate 1 on my Linux laptop (Mandrake > 8.0 distro) after reading everything in the README file in the root of > the source tree. I tried importing Tkinter after testing other > modules successfully and found that it wasn't able to be found by the > interpreter so I backtracked and read the README regarding Tkinter > again. I had already uncommented the relevant lines in the > Modules/Setup file but I went back and double checked everything > looked correct and it was. I read that you should try to perform a > "make install libinstall" under the Tkinter section if it was > recognized and so I did that but it pretty much looked as if it was > the same process as "make install" and after it finished and I tested > it, Tkinter was still no where to be found. The make process built > _tkinter to my knowledge and the make install or make install > libinstall should have linked the Tkinter module to _tkinter. Then I > noticed that _tkinter wasn't able to found either when I tried > importing it. Well I am lost now and don't know what to do to get > this to work... help, please :) > > Dan From grahamd at dscpl.com.au Wed Dec 19 00:08:56 2001 From: grahamd at dscpl.com.au (Graham Dumpleton) Date: 18 Dec 2001 21:08:56 -0800 Subject: SOAP.py References: <9vnpn1$t45$1@pea.uk.research.att.com> Message-ID: Duncan Grisby wrote in message news:<9vnpn1$t45$1 at pea.uk.research.att.com>... > I've just started trying some experiments with SOAP.py 0.9.7. I'm > having a problem with the server side that is so fundamental that I'm > sure I must be doing something wrong, but I can't see what. > > ... > > Not exactly complicated. Now, when I try a client, I get: > > --------------- > Python 2.2c1 (#1, Dec 17 2001, 19:20:56) > [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import SOAP > >>> server = SOAP.SOAPProxy("http://localhost:8000/") > >>> server.echo("Duncan") > "{'Result': 'Hello Duncan'}" > --------------- > > Note that that is a _string_ containing the Python representation of a > dictionary. Looking at the XML sent by the server: > > *** Outgoing SOAP ****************************************************** > > > > {'Result': 'Hello Duncan'} > > > ************************************************************************ Your example code works fine with Python 2.0. > I'm sure that can't be right. The parsing code doesn't seem to > understand "xsd:dict". I'm sure it must be wrong to be transmitting a > dictionary using its Python representation. SOAP.py has some code in it which when generating a SOAP element, defaults to the following when indicating what type the element is: t = self.genns(ns_map, self.config.typesNamespaceURI)[0] + \ type(sample).__name__ Ie., it uses Python introspection functionality to get the name of the type as a string. This is the only place I can think of where "dict" is coming from as "dict" is not a standard type in the XML Schema Datatypes specification and there is nothing in the code that hard codes that string as a type. But the question is why isn't it "dictionary" in that case instead of "dict". Has something changed in this respect in 2.2? Now one has to ask why it even runs this particular code, as it would only get there after failing: if (isinstance(sample, structType)) or \ type(sample) == DictType: # force to urn struct if that is the case. I know I've seen the following generated by SOAP.py: 1 2 3 Like "dict" use of "list" is also wrong and seems to be because it is dropping down and getting the name of the type for the list objects it is encoding. This BTW is with Python 2.0 and is reasonable as the code doesn't check for list or tuple types whereas it does for a dict type. That it doesn't check for list or tuple types and generate some other SOAP type is wrong in my mind. Anyway, that is the best idea I can come up with. > If I apply the following patch, everything behaves the way the > documentation claims it should: > > --- old_SOAP.py Mon Dec 17 20:26:09 2001 > +++ SOAP.py Mon Dec 17 20:24:42 2001 > @@ -3769,7 +3769,7 @@ > config = self.server.config) > else: > resp = buildSOAP(kw = > - {'%sResponse' % method: {'Result': fr}}, > + {'%sResponse' % method: fr}, > encoding = self.server.encoding, > config = self.server.config) > except Exception, e: > > > Is this the right thing to do? Am I barking up the wrong tree? I think such a change is possibly masking the real problem, something being caused by Python 2.2c1. I don't have 2.2c1 to try anything out though. Can you try an older version of Python or try instrumenting the code in the area I indicate above. Note that the problem may still be elsewhere, but start with the code in that area. > Does anyone have a suggestion of any other Python SOAP implementation > that is as simple to use as SOAP.py? If the simplicity is that you only want to deal with positional argument style remote procedure calls, rather than named parameters and named returned values, you might look at OSE. OSE isn't strictly another implementation as it uses ZSI underneath, and can also be made to use SOAP.py although you are then stuck with the various shortcomings of SOAP.py again. In short, what OSE does is provide an alternate API for using these packages which fits within a bigger framework for implementing such systems. Specifically in respect of ZSI, it makes it a bit more useful because it provides some Python classes and encoders for basic types such as Boolean, Date, Time etc. If using ZSI direct, you would need to implement them yourself. I have provided some standalone versions of these classes and encoders which will work with ZSI outside of OSE to Rich Salz (ZSI author), whether he will include them as an demo example I don't know. Do note however that OSE is much more than just a framework for implementing a SOAP server. In that respect it may be much more than what you actually require. OSE as a whole provides a C++ library framework for writing event driven and distributed applications. It has its own messaging framework as well as bridges for XML-RPC and SOAP. Coding in Python is possible through Python wrappers around major functionality provided by the library. For more information on OSE see: http://ose.sourceforge.net There is an up to date manual on the Python wrappers (more than can be said for the C++ interfaces :-)), with various Python examples on the web site as well. Do make sure however you pick up the patch related to the SOAP gateway from the bug reports area of the OSE site though. Without the fix, you can use the ZSI SOAP based client, but other clients such as Perl::Lite don't work with the server. BTW, below is how you would write your example with OSE. Use the URL: http://localhost:8000/example import netsvc import signal class Service(netsvc.Service): def __init__(self,name="service"): netsvc.Service.__init__(self,name) self.joinGroup("web-services") self.exportMethod(self.echo) def echo(self,s): return "Hello " + s dispatcher = netsvc.Dispatcher() dispatcher.monitor(signal.SIGINT) daemon = netsvc.HttpDaemon(8000) import netsvc.soap gateway = netsvc.soap.RpcGateway("web-services") daemon.attach("/",gateway) daemon.start() service = Service("example") dispatcher.run() From friend4allin at yahoo.com Fri Dec 21 16:42:39 2001 From: friend4allin at yahoo.com (friend4allin) Date: Fri, 21 Dec 2001 21:42:39 -0000 Subject: text file Message-ID: Hi Friends, I need some help regarding this one.I am reading contents from a textfile and then putting the same into data structures say a list. can any one you help me with this... tips or if anyone of you have built in codes that will be of great help Thanks and regards Maddy From jpt.d at rogers.com Sun Dec 30 22:40:22 2001 From: jpt.d at rogers.com (Jeffrey Drake) Date: Mon, 31 Dec 2001 03:40:22 GMT Subject: REPOST: Re: Python Popularity, python at sourceforge References: <3C2FBA84.490E5D7E@chello.nl> Message-ID: <7$--$$_----__$-__$@news.noc.cabal.int> I believe your statistic draw the wrong conclusion as well. >From what I saw you don't make any notice to what the languages are commonly used for. (this list maybe wrong, or a little off) PHP is primarily a web language. Java is primarily used for user interfaces on websites and gui. Perl is both web language and console, but usually not gui interface. C++ and C are completely general in their scope, however usually aren't used for web Python is also quite general, save the purpose of including it in other programs (like inside C/C++ programs) As said before Ruby is growing popularity, I believe it is also general. Lua isn't mentioned either, its purpose is almost exclusively for inclusion in programs If your statistics were based on types of usage, they may mean more Regards, Jeffrey Drake ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.tele.dk!small.news.tele.dk!134.75.7.11!nntp.kreonet.re.kr!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: jpt.d at rogers.com (Jeffrey Drake) Newsgroups: comp.lang.python Subject: cmsg cancel <3c2fdce9.28535902 at nntp> Control: cancel <3c2fdce9.28535902 at nntp> Date: Mon, 31 Dec 2001 04:00:43 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009773939 27193 211.57.49.2 (31 Dec 2001 04:45:39 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:45:39 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From brueckd at tbye.com Thu Dec 6 17:25:45 2001 From: brueckd at tbye.com (brueckd at tbye.com) Date: Thu, 6 Dec 2001 14:25:45 -0800 (PST) Subject: Detection of subsequent data by poll() In-Reply-To: <79179cf5.0112061416.48ce89c5@posting.google.com> Message-ID: On 6 Dec 2001, Rupert Scammell wrote: > Donn Cave wrote in message news:<9um3qr$d20$1 at nntp6.u.washington.edu>... > > Quoth rupe at metro.yak.net (Rupert Scammell): > > | I recently wrote a program that uses the select.poll() method in order > > | to > > | check for incoming data on multiple listening sockets. When I open a > > | connection to one of the listening sockets (e.g. via telnet), the > > | program accepts the first item of data sent (a character string with a > > | trailing CRLF). However, subsequent calls to poll() never appear to > > | detect more strings sent in the same connection to this socket. The > > | file descriptors for the sockets are all correctly registered with the > > | poll object. > > | > > | Is there a way to make poll() detect this incoming data without having > > | to close and re-open a connection to the socket in question each time? > > | > > | Any suggestions would be appreciated! > > > > Suggestion: post a program that shows the problem. Also suggest > > you mention your platform. > > > > Donn Cave, donn at u.washington.edu > > Per Donn Cave's request, the source of the program that's producing > the problem is provided below. The system in use is a RH Linux 6.2 > machine (x86 architecture), running kernel version 2.4.13. Again, any > assistance or insight into why the poll() call made against the poll > object is failing to return more than the first sent line of data > would be greatly appreciated. Hi Rupert, It looks like the new sockets never get registered with the poller. The original listener sockets do, but not the ones you're getting from the call to accept(). HTH, Dave P.S. - it'd be safer to not call recv on the newly-accepted sockets until after you've registered them with the poller, called poll, and then received a data-ready-to-be-read (select.POLLIN) event for that socket, otherwise you could end up blocking everything waiting for data. Or, make the new sockets nonblocking (s.setblocking(0)) and try the read but be sure to catch the associated exception if no data is ready. From jamescalthoff at yahoo.com Thu Dec 13 13:58:05 2001 From: jamescalthoff at yahoo.com (James Althoff) Date: Thu, 13 Dec 2001 10:58:05 -0800 (PST) Subject: (no subject) Message-ID: <20011213185805.59992.qmail@web20008.mail.yahoo.com> Michael Chermside wrote: >Yeah. Is there a way to express my support for the >limited and >well-reasoned proposal that is in PEP 276 itself >without commiting >myself at all on the broad flurry of OTHER proposals >folks have made here? Absolutely! In fact, you just did (thanks :-). I am going to update PEP 276 based on all the recent discussions. But it will stay focused on its current theme of just adding an iterator to class int. If I have time, I will try to put the other suggestions into a separate PEP (unless someone else would rather take the lead) since they all address the broader issue of dealing with intervals in a general way. Jim __________________________________________________ Do You Yahoo!? Check out Yahoo! Shopping and Yahoo! Auctions for all of your unique holiday gifts! Buy at http://shopping.yahoo.com or bid at http://auctions.yahoo.com From virus_catcher at oceanic.com Sun Dec 2 07:47:47 2001 From: virus_catcher at oceanic.com (virus_catcher at oceanic.com) Date: Sun, 02 Dec 2001 02:47:47 -1000 Subject: InterScan NT Alert Message-ID: Receiver, AntiVirus Catcher has detected virus(es) in the e-mail attachment. The Sender has been notified. Date: Sun, 02 Dec 2001 02:47:47 -1000 Method: Mail From: <_larakalliri at bel.gr> To: File: info.DOC.scr Action: clean failed - deleted Virus: WORM_BADTRANS.B From maxm at mxm.dk Sun Dec 30 05:18:56 2001 From: maxm at mxm.dk (maxm) Date: Sun, 30 Dec 2001 11:18:56 +0100 Subject: REPOST: Re: Video Programming References: <3C2E89DD.F3304EA9@earthlink.net> Message-ID: <1$--$$_----__-%_%$@news.noc.cabal.int> "Ron Stephens" wrote in message news:3C2E89DD.F3304EA9 at earthlink.net... > Please forgive me for this rambling post, but there it is, food for > thought, or for speculation, or for...??? You are certainly not the first to think of this. The problem is that graphics takes up too much screen estate. Also it is hard to make meaningfull metaphors and icons on a large system. Imagine if your windowed computer only had icons and no text. It would be extremely hard to navigate it, and find a specific piece of data. On the other hand it would not be a problem to navigate a windowed computer with no icons, but only words. It sort of the same problem one has when designing websites. Those icons and small graphics snippets gives a feel, and can enhance memory, but the words are what is really important. Zooming in and out of 3D graphics is also a nice idea, but actually it is allready implemented in Python. It's called function and classes, which does essentially the same thing. Imagine how an object oriented databse would look on screen in 3D graphics. And then compare with: odb = Odb() # pretty simple representation after all isn't it? Also the number of errors rises exponentially with the amount of logic outside the visible screen area. this would be a problem when graphics takes up much more screen estate than text. A language like Python is actually pretty effecient in conveying it's meaning and logic. A graphical interface shines in small specialized domains like image-processing, layout, text-processiing etc. Not in general programming. No I believe what is needed is a better programming enviroment or ide if you please. It should teach you the language while using it, and it should make it easy to make self documenting code. Now that would be a great new invention! regards Max M ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "maxm" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:57:18 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774293 27193 211.57.49.2 (31 Dec 2001 04:51:33 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:51:33 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From israelrt at optushome.com.au Sat Dec 22 09:12:05 2001 From: israelrt at optushome.com.au (IsraelRT) Date: Sun, 23 Dec 2001 01:12:05 +1100 Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic References: <3218013921984060@naggum.net> <3218018853244911@naggum.net> Message-ID: <92592u85pq0t8hvhklgq5jjojiuldtv7dr@4ax.com> On Sat, 22 Dec 2001 14:07:35 GMT, Erik Naggum wrote: >* IsraelRT >| And an infamous Common Lisp user gives popularity as a reason to >| choose a language? > > No. That would be a rather spectacularly invalid conclusion. Since you > obviously have no idea what Tengwar is You are either delusional or sadly lacking in rationality if you believe that the second statement follows as a consequence of the first. Go take your medication. From s.thuriez at quantaflow.com Wed Dec 12 02:27:58 2001 From: s.thuriez at quantaflow.com (sebastien) Date: 11 Dec 2001 23:27:58 -0800 Subject: how to tranlate a data from win32com in StringIO ? (unicode problem) Message-ID: <69e00d8d.0112112327.48bbc6f9@posting.google.com> I have been looking to translate the output of caractere=mondoc.Words.Item(numero_caractere) into a memory file object using stringIO. Doing file=StringIO.StringIO(first_word) raises the exeption : "...\win32com\client\__init__.py", line 348, in __getattr__ raise attributeError, attr AttributeError:__len__. Do you have an idea of the problem ? + I was doing this in order to use the codec module to translate from unicode to readeable format. Do you know off something more efficient? Sebastien. Here is the full code. The print mot really print the word that is read from word provided that there is no ?? caracters. ________________________________________________________ from win32com.client import constants, Dispatch import StringIO import codecs word= Dispatch('Word.Application') mondoc=word.Documents.Open(r"c:\testseb6.doc") number_word=mondoc.Words.Count for numero_word in range (1,int(number_word)+1): file=StringIO.StringIO() mot=mondoc.Words.Item(numero_word) print mot file.write(mot) ______________________________________________________ From jwbaxter at spamcop.net Sat Dec 29 00:40:45 2001 From: jwbaxter at spamcop.net (John W. Baxter) Date: Fri, 28 Dec 2001 21:40:45 -0800 Subject: REPOST: Re: Two languages, too similar, competing in the same space. References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> Message-ID: <4$--$$_----_-$%_$$@news.noc.cabal.int> In article , Paul Prescod wrote: > When programmers ask to write code in a scripting language, managers > will say: "You want us to write in one of those flavour-of-the-month > languages?" It seems the curse of the scripting language world to > forever fork off new languages just as older ones gain a little bit of > acceptance. My manager (the company owner) says "you want to write in something other than Python??? You better have a darn good reason." ;-) --John ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "John W. Baxter" Newsgroups: comp.lang.python Subject: cmsg cancel <281220012140453133%jwbaxter at spamcop.net> Control: cancel <281220012140453133%jwbaxter at spamcop.net> Date: Mon, 31 Dec 2001 04:23:12 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774862 27193 211.57.49.2 (31 Dec 2001 05:01:02 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:01:02 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From gh_pythonlist at gmx.de Tue Dec 11 16:21:30 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Tue, 11 Dec 2001 22:21:30 +0100 Subject: input In-Reply-To: <60FB8BB7F0EFC7409B75EEEC13E20192158C94@admin56.narex.com> References: <60FB8BB7F0EFC7409B75EEEC13E20192158C94@admin56.narex.com> Message-ID: <20011211212130.GA7342@lilith.hqd-internal> Le 11/12/01 ? 14:13, Bjorn Pettersen ?crivit: > > From: Preben [mailto:preben_er_t0ff at hotmail.com] > > > > How do I make a unbufferedinput from the user? > > (So they don't have to hit enter to send) > > > > Is it possible to make it so that you don't see what you're > > typing.. e.g. to logins? or maybe replacing the output with * ?? > > If you're on Windows the msvcrt module is your friend And the getpass module is made for - you guessed it - password entry :-) Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From wurmy at earthlink.net Fri Dec 28 10:04:12 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Fri, 28 Dec 2001 15:04:12 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <32c382ad.0112272324.4c78689b@posting.google.com> Message-ID: <4$--$$_----_-$--_$@news.noc.cabal.int> mlorfeld wrote: > In its 1.5.2 iteration, Python was intriguing, > yet it lacked some essential things (such as a Perlesque chomp), then > I took a look at 2.x and the strip function was implemented - saving > me a great deal of repetition in programming. I'm pretty sure 1.5.2 had strip already... --Hans ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Hans Nowak Newsgroups: comp.lang.python Subject: cmsg cancel <3C2C88A6.9D13A3D6 at earthlink.net> Control: cancel <3C2C88A6.9D13A3D6 at earthlink.net> Date: Mon, 31 Dec 2001 02:30:41 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775363 27193 211.57.49.2 (31 Dec 2001 05:09:23 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:09:23 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From borcis at geneva-link.ch Sat Dec 22 16:11:59 2001 From: borcis at geneva-link.ch (Boris Borcic) Date: Sat, 22 Dec 2001 22:11:59 +0100 Subject: MimeWriter and smtplib: long list of 'To:' recipients References: <9vvks6$27qr$1@norfair.nerim.net> Message-ID: <3C24F71F.FC44FBAE@geneva-link.ch> Gillou wrote: > > Hi, > > My application sends mail to a list of 'To' recipients but there are > problems when the list is long. Are you sure the SMTP server doesn't put an upper bound on the number of recipients ? BB From giqqh at benjq.chinahot.net Sun Dec 2 04:11:09 2001 From: giqqh at benjq.chinahot.net (giqqh at benjq.chinahot.net) Date: Sun, 02 Dec 2001 03:11:09 -0600 Subject: Is your mortgage APR as low as 4.13? -pdha Message-ID: <612c4t78vf.qenm6l238aeb85kg4aqc@erate.savingszone.com> >>>> FINANCING A PROPERTY CAN BE A TRYING EXPERIENCE! >>>> LEVEL THE PLAYING FIELD TO YOUR ADVANTAGE!!! >>>> PUT OUR TECHNOLOGY TO WORK FOR YOU!!! >>>> FIND BEST LOANS AMONG 500,000 LOAN PROGRAMS FROM 500 OF THE BEST LENDERS IN THE COUNTRY. Visit : http://www.doyousave.com and get all that for FREE!! With literally over 500,000 variety of loans available from hundreds of lenders, finding the best one for your need is difficult at best. Your ORDINARY LOAN OFFICERS can not deal with the issue effectively either. It is just not humanly possible to search through that many loan programs to find the one you need! That's why WE HAVE DONE THE EXTRA-ORDINARY! We have developed a specialized loan search engine which zips through all available loan products in the country in seconds to locate what could be most beneficial loan program for you. >>>> HERE IS THE WHAT YOU CAN EXPECT: 1- Mortgage Loan for EVERY credit situation 2- The most competitive interest rates 3- Purchase loans with Zero down payment 4- No Equity, 2nd Trust Deeds, up to 135% LTV 5- Cash Back Refinances 6- Debt Consolidation 7- No Income Verification 8- Stated income Visit http://www.doyousave.com to take advantage of all this for FREE! **************************************************************** If you wish to be removed please reply to: mailto:west4563 at yahoo.com?subject=remove **************************************************************** From bt98 at doc.ic.ac.uk Thu Dec 20 13:30:25 2001 From: bt98 at doc.ic.ac.uk (Benjamin Tai) Date: Thu, 20 Dec 2001 18:30:25 +0000 Subject: argument type checking before parsing Message-ID: <3C222E41.7BC90F78@doc.ic.ac.uk> Hi, Based on the stacktype extension from "Programming Python", I am trying overload the constructor to either accept nothing, or a string (and integer in the future). static PyObject * stacktype_new(self, args) PyObject *self; PyObject *args; { char* tmp_str; /* original function to create an empty stack */ if (PyArg_ParseTuple(args, "")) return (PyObject *)newstackobject(); /* accept a string and create an occupied stack */ else if (PyArg_ParseTuple(args,"s",&tmp_str) ) return (PyObject *)newstackobject_s(tmp_str); else return NULL; } The following is the Python script. String is push onto the first stack as it is created. import stacktype x = stacktype.Stack("1") y = stacktype.Stack() y.push('2') print x print y print x > y However the trace is complaing about the comparison. pixel12% python stack.py [Stack: 0: '1' ] [Stack: 0: '2' ] Traceback (most recent call last): File "stack.py", line 8, in ? print x > y TypeError: function requires exactly 0 arguments; 1 given pixel12% I have the impression that I have upset the interpreter, by calling PyArg_ParseTuple more than once? Do I need to check the type before I parse the argument? Any comments would be great. Ben From store_li at sina.com Wed Dec 19 21:54:29 2001 From: store_li at sina.com (Kick) Date: Thu, 20 Dec 2001 10:54:29 +0800 Subject: Can I change a unicode char to gb2312 using python? References: <9vq6d9$gvc5p$1@ID-12869.news.dfncis.de> Message-ID: <9vrk0m$h6rua$1@ID-12869.news.dfncis.de> One piece additional, the python said unknown encoding. :-< "Oleg Broytmann" wrote in message news:mailman.1008770961.5358.python-list at python.org... > On Wed, Dec 19, 2001 at 09:46:41PM +0800, Kick wrote: > > I know that Java have a method that can manually encode string, like that, > > System.out.println(new String("some chinese char".getBytes()"GB2312")) > > > > Is there any python function or method can do the same work? > > http://www.python.org/doc/current/lib/string-methods.html > > Python strings has method "encode": > > u'sigma'.encode('gb2312') > > Oleg. > -- > Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru > Programmers don't die, they just GOSUB without RETURN. > From gh_pythonlist at gmx.de Tue Dec 4 17:21:02 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Tue, 4 Dec 2001 23:21:02 +0100 Subject: license key validation - encryption/decryption In-Reply-To: <9ujgam$a1e$1@news1.xs4all.nl> References: <9ujgam$a1e$1@news1.xs4all.nl> Message-ID: <20011204222101.GA2795@lilith.hqd-internal> On Tue, Dec 04, 2001 at 10:48:05PM +0100, Irmen de Jong wrote: > > How do i validate it at the customer site that the > > "key" installed is valid? > > You're looking for a secure hash of your license file, to protect the > contents of the file from tampering. The sha module can do this for > you. The next problem is where to store the hash. > Now somehow you need to encode information about that > unique customer into your license, so that another customer > cannot also use that license file. > > Perhaps some sort of public-private key scheme would work? Which doesn't help at all if both keys are available to the potential cracker. > It's quite a task to create a Python application that can't be tricked > (hacked) to think that the license is valid for *all* features. Not possible IMO. But one can make it quite hard to crack it. I'd go with symmetric encryption (might be a simple one, like the rotor module) in combination with some clever "security thru obscurity". For the fun of it, you could embed the pickled check routine in a CDATA section of the XML file. Or encrypt the .pyc files. This would at least make cracking a matter of days or weeks instead of hours. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From wtanksley at bigfoot.com Mon Dec 10 16:05:37 2001 From: wtanksley at bigfoot.com (William Tanksley Google) Date: 10 Dec 2001 13:05:37 -0800 Subject: more fun with PEP 276 References: Message-ID: James_Althoff at i2.com wrote: > I think not. A compelling argument. > >>> for i in -5 // span // 5: # closed-closed > ... print i, > -5 -4 -3 -2 -1 0 1 2 3 4 5 Intriguing. Odd. Perverted. Words would fail me, but doggone it, I find myself liking it. > >>> mylist = [0,1,2,3,4,5,6,7,8,9] > >>> for i in span / len(mylist): > ... print mylist[i], > 0 1 2 3 4 5 6 7 8 9 The scary thing is that despite the ENORMOUS gap between the purpose of the / operator and your abuse of it (help! I'm being repressed!), I can still read this naturally: "span over length of myList". > The (claimed) advantages with this scheme include: > - no syntax changes required (!!!) > - handles all combinations of closed/open intervals Minor niggle: how would users remember which operator represents which type of range ending? Do you have a proposed mnemonic? > Now, that *was* fun, wasn't it. Actually, it was. I dunno if this should go in, but for its purposes I like it more than any of the other ideas, including my own. > Jim -Billy From bup.schaefer at freenet.de Wed Dec 19 06:21:49 2001 From: bup.schaefer at freenet.de (bup_schaefer) Date: Wed, 19 Dec 2001 11:21:49 -0000 Subject: my unanswered question: copy clipboard to a widget Message-ID: <9vpt8d+ejit@eGroups.com> I have posted this two times, but I hve no answer yet: Hello, with "clipboard_append" (Tkinter) I can copy the text content of a widget in the clipboard. My question: How is it possible to copy (by the program,not with ctrl-V)the content of the clipboard to a widget? Many thanks for your answer, Bruno Sch?fer From syver-en+usenet at online.no Wed Dec 26 06:57:51 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 26 Dec 2001 12:57:51 +0100 Subject: Pyro, two way remoting. Message-ID: Hi, I've been using some Christmas time at looking at object remoting. I have spent most of the time looking at Pyro, which seems to date, very friendly to get along with indeed. Judging by examples and documentation Pyro is optimized for a simple client server relationship were the client access the servers object remotely, and the objects passed to the server from the client are copied instead of remoted. This is cool but I wanted to see how/if I could also get the server to remote calls to the client. The solution I came up with was the following: --- begin pyrtest.py ---- import remote import Pyro.core import threading ## The server class look like this: ## class Subject: ## def register(self, object): ## self._observer = object ## def doStuff(self): ## self._observer.update() class Client(Pyro.core.ObjBase): def __init__(self): Pyro.core.ObjBase.__init__(self) self.status = 'Alone and hungry' def update(self): self.status = 'got update' #pdb.set_trace() cl = Client() daemon = Pyro.core.Daemon() daemon.connect(cl) class DaemonThread(threading.Thread): def run(self): daemon.handleRequests() threadedDaemon = DaemonThread() threadedDaemon.start() assert cl.status == 'Alone and hungry', cl.status subj = remote.get_remote_object('Subject') subj.register(cl.getProxy()) subj.doStuff() # this method calls update on the object passed to register print 'doStuff returned' assert cl.status == 'got update', cl.status print 'the update was okay' -- end pyrtest.py -- Some clarifications: If you pass the client object to the *register* method of *subj* without setting it up as a proxy by inheriting from *Pyro.core.ObjBase* and calling the *getProxy* method, the last assert statement will trigger because the client object has been copied over to the Pyro server and executed there instead of being remoted back to the client which is what happens in my example. Is this the "way" to do it? Any suggestion, criticism is very much appreciated. PS: The remote module that is used, is provided with Pyro but is not by default put in a location so that it is accessible for importing (it's in the Pyro/examples/quickstart directory). The remote module just takes care of some Pyro boilerplate code for setting up and accessing a Pyro server. -- Vennlig hilsen Syver Enstad From harryo at zipworld.com.au Thu Dec 27 18:22:56 2001 From: harryo at zipworld.com.au (HarryO) Date: Thu, 27 Dec 2001 23:22:56 GMT Subject: REPOST: Re: Two languages, too similar, competing in the same space. References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> Message-ID: <6$--$$_-----$$--%$@news.noc.cabal.int> On Fri, 28 Dec 2001 09:56:29 +1100, Ron Stephens wrote: > ... But > now that Ruby is out there, it absorbs enormous mind share, and > development time to recreate libraries etc., which are already available > in Python, thus hurting Python. I have only tried it in a very minimal way, just to see that it did basically what was advertised, but you might be interested in this. There's a Ruby library that allows you to do things like: require 'python' require 'python/httplib' h = Py::Httplib::HTTP.new(host) h.putrequest('GET', path) h.putheader('Accept', 'text/html') h.putheader('Accept', 'text/plain') h.endheaders() Ie, the "require 'python'" makes pulling in Python libraries as simple as ... require 'python/SOME_PYTHON_LIB' which is almost as easy as doing it in Python. Similarly, referencing elements of such a library simply requires prefixing them with "Py::". Once you have a handle to a Python object, you call it the same way you would in Python. I don't think one could make it much simpler. So, to some extent, it's possible to avoid reinventing the wheel. How well this works, I can't say, just that the examples I played with worked as advertised. Obviously, there's some overhead, in that it's running a copy of the Python interpreter to execute the Python code, but so long as the work the library is doing for one is larger than the actual overhead of the call to it, that shouldn't be a problem. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: HarryO Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:29:34 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775503 27193 211.57.49.2 (31 Dec 2001 05:11:43 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:11:43 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jeff at ccvcorp.com Tue Dec 18 13:45:57 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Tue, 18 Dec 2001 10:45:57 -0800 Subject: Inheriting Python modules? References: <%LKT7.2764$NB2.64678@news2.nokia.com> Message-ID: <3C1F8EE5.668EF8C6@ccvcorp.com> Timo Linna wrote: > Hi, > > How should "dynamic module inheritance" be implemented with Python? > > Example: > > It should be possible to write: "import defaults" so that it would first > import everything from common.defaults -module and after that other stuff > from product.defaults-module. Content of both modules should be accessible > through one common (defaults) interface so that the caller wouldn't have to > know from which module the code is actually accessed. This is untested, but ISTM that if, inside your defaults.py, you import the other module(s) using "from othermodule import *", it will have the effect you want. (I'm pretty sure that wxPython, at least, uses this technique.) Of course, you'll have to be careful to not cause any namespace conflicts amongst your modules. This is, however, one of the few legitimate uses of "from module import *" (IMHO). Jeff Shannon Technician/Programmer Credit International From mailer at mailer.ru Mon Dec 17 07:39:21 2001 From: mailer at mailer.ru (mailer) Date: Mon, 17 Dec 2001 18:39:21 +0600 Subject: =?windows-1251?B?zvIg5O7x8u7p7e7pIP3q7u3u7OjoIC0g6iDk7vHy8+/t7ukg8O7x6g==?= =?windows-1251?B?7vjoIS4u?= Message-ID: <000901c186f7$da1a8620$32c8a8c0@webmaster> ???????? ?????? ????????? ????????? ?????????, ?????????? ?? ??????? ?? ?????? ?????? ????? ?? ???? ??? ?????? ?? ?????? ? ????????: - ??? ???, ????? ?????, ??????, ?????? ? ????????. - ????????? ????? ?????? ?? ??????. -------------------------------------------------------------------------------- ???? ??? ?? ?????????????? ???? ??????????? ? ?? ?????? ?? ?????? ???????? ??? ???????? - ???????? ???? ???????? ?????????. ?????? ??????? ?????? ?????? ? ????? E-Mail ?? ????? major-pain at yandex.ru ? ?? ?????? ????????? ?? ??????? ??????????????? ??????? ??????????. -------------- next part -------------- An HTML attachment was scrubbed... URL: From roy at panix.com Sun Dec 23 20:15:50 2001 From: roy at panix.com (Roy Smith) Date: Sun, 23 Dec 2001 20:15:50 -0500 Subject: Embedding TCL in Python? Message-ID: I've got a device I want to control, and a set of TCL routines which talk the device's (proprietary) protocol over the network. I'm building an automated test system in Python, and one of the things I need to do is control this device. Seems to me I've got three choices: First, I could build a native Python module to control the device directly. I've discounted this as being way too much work, even though the end result would probably be the cleanest way to do things. Second, I could start a separate TCL interpreter process, and have my Python program drive it with some sort of send/expect type interface. Possible, but ugly, and probably a real mess to code. Lastly, I could just embed a TCL interpreter right in my Python process. This seems like it has promise, but I don't have much of a clue how to go about doing it. Has anybody done anything like that before? From timcera at earthlink.net Sun Dec 30 00:15:56 2001 From: timcera at earthlink.net (Tim Cera) Date: 29 Dec 2001 21:15:56 -0800 Subject: Paramaterized local variable name Message-ID: <9c3f2e9c.0112292115.6a4e22af@posting.google.com> Hello, I have the following code: def paging(data, key, query_dict): for i in range(0, len(data[key]), use_pagesize): start = data[key][i].name ...etc. which works fine for data[key][i].name, but sometimes I want this function to process data[key][i].rev. So, if local_name is equal to 'name' or 'rev' or 'whatever', what I want is something like: def paging(data, key, query_dict, local_name): for i in range(0, len(data[key]), use_pagesize): start = data[key][i]. # What goes here ^^^^ ? Thanks Tim Cera From kragen at pobox.com Wed Dec 5 05:03:45 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 05 Dec 2001 05:03:45 -0500 Subject: COM servers from within a Python service (on Win2k) References: Message-ID: <83y9kiouf2.fsf@panacea.canonical.org> Duncan Booth writes: > Andrew Bennetts wrote in > news:mailman.1007522528.18068.python-list at python.org: > > Can anyone show me how to make this work? > > I have emailed you a working example. It is a minimal service which > contains a COM server. Can you post it? From philh at comuno.freeserve.co.uk Thu Dec 27 15:44:55 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Thu, 27 Dec 2001 20:44:55 +0000 Subject: REPOST: Re: A new forum is up! References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B5E9F.FF1C2CC@bellatlantic.net> Message-ID: <0$--$$_-----$%$__$@news.noc.cabal.int> On Thu, 27 Dec 2001 12:14:19 -0600, DeepBleu wrote: > >> Andrew Nguyen wrote: >> > >> > A new forum for Python is up. It has a better feel to it than this >> > forum (in my opinion) > >It depends on how you view this 'forum.' As far as I am concerned, >**nothing** beats NNTP newsgroups viewed in a dedicated NNTP viewer. Ditto -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: philh at comuno.freeserve.co.uk (phil hunt) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:26:56 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775594 27193 211.57.49.2 (31 Dec 2001 05:13:14 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:13:14 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From peter at engcorp.com Sat Dec 29 22:06:05 2001 From: peter at engcorp.com (Peter Hansen) Date: Sat, 29 Dec 2001 22:06:05 -0500 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2CBACB.FBF3C3C9@mindspring.com> <3C2D47F0.6DF7C8BE@mindspring.com> <3C2DF5FF.E332F4EE@mindspring.com> Message-ID: <5$--$$_----__$%--$@news.noc.cabal.int> "Dr. David J. Ritchie, Sr." wrote: > > I'd like to say that it almost seems like Python > is not that far away from allowing as a language feature: > > from module.python.org import * > or > from module.python.org import graphics > > where "module.python.org" is some internet node. The idea is sound, but for now I think really practical only on a company intranet. Internet connectivity is still too unreliable to make this very effective except for strictly Internet-related applications (i.e. those which have no intrinsic purpose when an Internet connection is not available.) That said, I suppose a little local caching would provide a reliable backup after the first invocation had succeeded. And none of this would be in any way difficult to implement even now, since you can just substitute your own implementation of __import__(). -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Peter Hansen Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E849D.8242B65D at engcorp.com> Control: cancel <3C2E849D.8242B65D at engcorp.com> Date: Mon, 31 Dec 2001 02:32:01 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774418 27193 211.57.49.2 (31 Dec 2001 04:53:38 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:53:38 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From mwh at python.net Mon Dec 24 05:11:33 2001 From: mwh at python.net (Michael Hudson) Date: Mon, 24 Dec 2001 10:11:33 GMT Subject: distutils lib path References: <1FBV7.3347$bE5.1290856513@twister1.starband.net> Message-ID: "Daniel Wexler" writes: > Is there a way to get the name of the platform-specific > subdirectory name of the build/lib*** directory in my > setup.py file? Erm, probably, but if what you want to do what you describe below, there's a better way. [snip] > Also, is there a way to have distutils perform some arbitrary > commands after building each extension module? Or perhaps to > callback to a python function that I can define (which then can do > arbitrary things)? In my case I want to move or create links to the > resulting .lib or .so files that are built by distutils. Probably the best thing to do is derive your own subclass from distutils.command.build_ext and override build_extension() to do what you want, eg: from distutils.core import setup from distutils.command.build_ext import build_ext class MyBuildExt(build_ext): def build_extension(self, ext): build_ext.build_extension(self, ext) # your stuff goes here setup(.... cmd_class = {'build_ext': MyBuildExt}) You'll probably want to read the source of build_ext.build_extension to find out how to get the information you need. HTH, M. From aahz at panix.com Thu Dec 20 18:04:18 2001 From: aahz at panix.com (Aahz Maruch) Date: 20 Dec 2001 15:04:18 -0800 Subject: threading module oddness References: Message-ID: <9vtqpi$n2l$1@panix3.panix.com> In article , Jason Orendorff wrote: > >2. Principle of least surprise. I think a guy who's done some > thread programming on Linux before, would likely expect Condition > to behave as though it had a pthread cond object inside -- on > Linux anyway. ("Surely they're not duplicating kernel-level > features in Python...") I'm no guru, but I'm guessing this > assumption could lead to the occasional subtle bug. Possibly. But any other way of working would likely be detrimental to Python's cross-platform capabilities. Also, it's my experience that 90% of the time that people think they want to use any thread synchronization primitives other than RLock() and Queue.Queue(), they're wrong. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 11 days and counting From peoter_veliki at hotmail.com Sun Dec 2 17:13:46 2001 From: peoter_veliki at hotmail.com (Peoter Veliki) Date: Sun, 2 Dec 2001 14:13:46 -0800 Subject: making a file hidden in win32? Message-ID: Is there anyway I can use python to make a file hidden in windows? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From fjiihyy at 21cn.com Mon Dec 3 04:25:30 2001 From: fjiihyy at 21cn.com (charles huang) Date: Mon, 3 Dec 2001 17:25:30 +0800 Subject: about using httplib on apache with virtual host Message-ID: hi! I write a program to get shtml with httplib. I found that it is ok if apache do not with virtual host,but it do not work if apache with virtual host. this is my code: import httplib,os,string,sys fj_www = httplib.HTTP('www.fjii.com') fj_www.putrequest('GET', '/index.shtml') fj_www.putheader('Accept', 'text/html') fj_www.endheaders() #fj_www.send() errcode, errmsg, headers = fj_www.getreply() if (errcode!=200): print "it error!\n" sys.exit() www_f = fj_www.getfile() data = www_f.read() # Get the raw HTML www_f.close() print data my code is error or httplib do not support virtual host? charles huang fjiihyy at 21cn.com From tatebll at aol.com Sat Dec 1 08:21:37 2001 From: tatebll at aol.com (Bill Tate) Date: 1 Dec 2001 05:21:37 -0800 Subject: Using Python with a webserver References: Message-ID: "Sam Scholey" wrote in message news:... > Hey Folks > > I was interested in the prospect of using python with my webserver but a > search on the python site and on deja produced virtually zero results. Can > it be done? is it as easy as editing a few lines of code in the apache > httpd.conf file? > > I am using Windows xp pro, apache 1.3.22 (for windows) > > Thanks Very Much Sam, Suggest you check out Mod_Python - do a google search and you should get right to it. It configures like most apache modules and yields a substantial performance boost over conventional CGI. Some examples are provided with the distribution and there is documentation with it. If you are interested in doing servlet programming and taking advantage of a persistence database connection pool - then you might want to check out webware for python (on sourceforge). I believe most are targeting Apache for their webware configuration as opposed to IIS. The plug-in architecture of webware is nice and there are numerous examples to help solidfy things. It also has an active discussion group to answer any questions you might have. I don't know if there are any issues with running python 2.x on XP - perhaps others might comment on that. Bill From sholden at holdenweb.com Fri Dec 28 11:33:43 2001 From: sholden at holdenweb.com (Steve Holden) Date: Fri, 28 Dec 2001 11:33:43 -0500 Subject: Can't exit python with ^D under certain circumstances References: Message-ID: <1c1X7.79465$7l5.52086@atlpnn01.usenetserver.com> "wealthychef" wrote in message news:mailman.1009322789.23019.python-list at python.org... > Hi, this is weird to me, don't know how to fix. > On my local python installation on machine A in a normal shell, ^ > D works to exit Python as expected. On machine B on the > console, ^D also works fine, but if I ssh to machine B from > machine A and try to exit Python with ^D, Python does not exit, > instead I get the following strange error message: > > >>> ^D > File "", line 1 > c > ^ > SyntaxError: invalid syntax > > What is printing here as a little 'c' is showing up in the terminal > as maybe > > E > F > > crammed into one character, or > > F > F > > I can't quite read it. > Can anyone help me? I'm no xmodmap dude, but i suspect > some sort of keyboard confusion. The two systems are different. > Machine A is running one flavor of Unix, and machine B is > running another, each with radically different hardware. > Is there another way to exit Python? Workaround? Fix? Thanks. > The "E and F rammed into a single character" sounds like a representation of "EOF" as a graphic. The real question is why the end of file you send to your local ssh client doesn't make it through to the Python interpreter as an EOF, but instead (apparently) gets transmitted as a character. In the meantime, you can terminate the interpreter with something like: import sys sys.exit("No more Python!") regards Steve -- http://www.holdenweb.com/ From peter at engcorp.com Mon Dec 3 23:57:50 2001 From: peter at engcorp.com (Peter Hansen) Date: Mon, 03 Dec 2001 23:57:50 -0500 Subject: the purpose of this list??? References: Message-ID: <3C0C57CE.CF1A1596@engcorp.com> Gabe Newcomb wrote: > > So I just joined the list an hour ago. I've read 4 of the messages and half > of them involve some form of flaming. If you use a reader which shows the threads in the conversation, it probably supports a convenient "kill" function which would eliminate the rest of the messages in that thread. That would be a good way to find the meat and avoid the (relatively few) threads which get into flame wars over religious topics. By the way, stick around a little longer and you'll come to realize that comp.lang.python is well known as one of the *most* friendly newsgroups around. Four messages is just a little too few on which to base a valid conclusion... Welcome! -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From aleax at aleax.it Fri Dec 28 07:16:01 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 13:16:01 +0100 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: "Patrick" wrote in message news:u2oo84bc39ujb7 at corp.supernews.com... ... > They DO ask what compilers and linkers we use! They even > make suggestions! We make very customized software. > Some customers write parts of their own code through > 'user exits'. I stand corrected. In this case, I guess you do have to care about your customers' software preferences. If you were working in a JVM environment, Jython and Java might be considered nearly equivalent (hard to tell from the outside what language a .jar or .class was coded in); if you were working in a COM environment, this would hold in an even stronger way (again, a COM server is a COM server, "from the outside" it little matters if it's written in C++, VB, Python or what else); this is also a particular strength of the .NET Framework; but few other environments give you such high transparency. Alex From rdsteph at earthlink.net Sat Dec 29 19:33:37 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sun, 30 Dec 2001 00:33:37 GMT Subject: REPOST: The Fiery Bush Python One True Universal Web Server... References: <3C2CBACB.FBF3C3C9@mindspring.com> <3C2D47F0.6DF7C8BE@mindspring.com> <3C2DF5FF.E332F4EE@mindspring.com> Message-ID: <8$--$$_----__$%_-$@news.noc.cabal.int> You know its funny, but I was thinking about something very similar to what you propose. Would it be possible to create a module that could be plugged into a Python program, that would automatically, when called, go to a specific web site containing a Python interpreter and run the original Python program remotely, give the results track over the web (from the "one master Python server web site) and thus, one could always run Python applets by embedding them into any HTML page. The embedded Python applet could call out to the One Master Python Server, that it knows is always available. This would give Python the exact same capabilities as JavaScript for universal client side scripting WHETHER or not Python was installed on the machine, PLUS the same capabilities as Java applets embedded into HTML web pages. Someone would need to maintain One True Master Python Server web site, but that shouldn't be too hard. Add this to what you propose below, Dr. Ritchie, and what a powerful combination. I wonder if it is possible? We may be on shakey ground alright, but I seem to recall that Moses got some big info from such shakey, fiery ground that contained a certain bush. Maybe such a program and server could be called The Fiery Bush ;-)))) "Dr. David J. Ritchie, Sr." wrote: > "Dr. David J. Ritchie, Sr." wrote: > > > ...I am probably on shaky > > ground here due to ignorance... > > At least on topic in regard to the above anyway ;-} and somewhat > on the topic of what doex language X have that makes it more attractive (or > less attractive) than Python, I'd like to say that it almost seems like Python > is not that far away from allowing as a language feature: > > from module.python.org import * > > or > > from module.python.org import graphics > > where "module.python.org" is some internet node. > > It would seem that such a feature would embrace and > include as part of Python the Java capability of > incorporating classes over the net and up the ante on > the .net initiative (remember what I said > about ignorance here). > > Wouldn't this go some way towards solving the problem of > encouraging more module sharing a la Perl's CPAN but in a > Python-esque way...? > > -- > Dr. David J. Ritchie, Sr. > djrassoc01 at mindspring.com > http://home.mindspring.com/~djrassoc01/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E61FD.4CA44C0 at earthlink.net> Control: cancel <3C2E61FD.4CA44C0 at earthlink.net> Date: Mon, 31 Dec 2001 04:47:15 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774466 27193 211.57.49.2 (31 Dec 2001 04:54:26 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:54:26 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From philh at comuno.freeserve.co.uk Thu Dec 27 18:59:54 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Thu, 27 Dec 2001 23:59:54 +0000 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9901.998345FB@earthlink.net> Message-ID: <2$--$$_-----$%$__$@news.noc.cabal.int> On Thu, 27 Dec 2001 21:53:41 GMT, Ron Stephens wrote: >Also, one more thing: Guido was interviewed recently in a magazine and he >conjectured that programming for handholds and PDA's might be a huge niche for >Python in the future. Does anyone have any thoughts on this? I think Python has a lot of potential here. -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newsengine.sol.net!news-feed.riddles.org.uk!sn-xit-03!supernews.com!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: philh at comuno.freeserve.co.uk (phil hunt) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:40:49 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775473 27193 211.57.49.2 (31 Dec 2001 05:11:13 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:11:13 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From des.small at bristol.ac.uk Thu Dec 13 12:25:17 2001 From: des.small at bristol.ac.uk (Dr. Des Small) Date: Thu, 13 Dec 2001 17:25:17 GMT Subject: Difference in formatting list and tuple values References: Message-ID: sag at hydrosphere.com (Sue Giller) writes: > I am trying to format values from either a list or a tuple, and I am > getting the following odd (to me) behavior. Well, you're doing an odd (to me) thing... > I can format the tuple > entry using %d, but I get an error when I use the same formatting > for the same data in a list. > Why does this happen? > >>> print "%02d" % l[:1] # get error with list > Traceback (most recent call last): > File "", line 1, in ? > TypeError: an integer is required > >>> print "%02d" % tuple(t[:1]) # cast to a tuple works ok > 01 > The right hand side of the % operator must be either a tuple or a single item. I would probably write print "%02d" % t[0] to do this, since it works for both lists and tuples. But if you're secretly doing something fancy like print len(l)*"%02d " % tuple(l) then you will need the cast. The only weirdness here is that % doesn't single elements to be tuplified, which is a concession to readability; print "%d" % (12,) is also legal, but a little peculiar to look at. Des. -- Dr Des Small, Scientific Programmer, School of Mathematics, University of Bristol, Tel: 0117 9287984 From Bruce at EckelObjects.com Thu Dec 6 21:07:44 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Thu, 06 Dec 2001 18:07:44 -0800 Subject: Lists of attributes In-Reply-To: References: Message-ID: <200112061807440330.027C4383@mail.rdc1.sdca.home.com> >Anyway, why can't you just stick each instance in a global variable >(preferably a dictionary or dictionary-like object)? If you really like the >attribute assignment syntax, you can make a class that allows element >reference both through attributes (yuck) and through item indexing . Right, missed that. Now it's even cleaner: import random rgen = random.Random() flwrs = [Gladiolus(),Runuculus(),Chrysanthemum()] flowers = [rgen.choice(flwrs) for i in range(10)] This produces a random selection of references to only three objects. I'd still like to not have to explicity enumerate flwrs. I may play with Tim's suggestion: class Flower(object): ... and Flower.__subclasses__() Except that I haven't been able to locate any actual information on how to get '__subclasses__()' to work. Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From afabbro at indoctrination.com Fri Dec 14 18:29:07 2001 From: afabbro at indoctrination.com (afabbro) Date: 14 Dec 2001 15:29:07 -0800 Subject: compile() question Message-ID: <2bbda179.0112141529.49f816ce@posting.google.com> I am parsing a stream of colon-delimited fields (field:value) where the field is an attribute for an object. Since there are a few dozen fields and I don't want to handle each field separately, I used exec to make it easy (after splitting): exec ( 'volume.' + field + ' = "' + value + '"' ) which means the exec'd python code is something like: volume.barcode = 'T00123' So far, so good. Unfortunately, there is a lot of data to process and I'd like to speed it up. I'm thinking that I could possible compile() the command ahead of time? Unfortunately, I can't find a decent example of what I want to do anywhere (-Learning Perl-, the Python docs, etc.) I'm new to Python and am wondering how I can pass variables into a compile() so that everytime I exec it, it does the substitution? Thanks! - andrew fabbro afabbro at indoctrination.com From bokr at accessone.com Tue Dec 11 18:15:23 2001 From: bokr at accessone.com (Bengt Richter) Date: Tue, 11 Dec 2001 23:15:23 GMT Subject: PEP 276 Simple Iterator for ints (fwd) References: Message-ID: <3c169178.96189593@wa.news.verio.net> On Tue, 27 Nov 2001 10:27:31 -0800, James_Althoff at i2.com wrote: > >Greg Ewing wrote: >>While trying to think of a range syntax that looks >>unambiguously half-open without clashing with list >>or tuple constructors, the following blindingly >>obvious solution occurred to me: >> >> for 0 <= i < 5: >> ... > >Greg, > >Since this looks like a suggestion for replacing xrange in the general >case, did you have any thoughts on how one might specify a step value? > How about if a bare [x:y:z] were interepreted as an abbreviation for slice(x,y,z) and you defined what one might expect as an iterator for the slice type? Then you could write for i in [0:5]: # or [:5] ... From phr-n2001d at nightsong.com Mon Dec 24 03:49:54 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 24 Dec 2001 00:49:54 -0800 Subject: Web Collaboration References: <32c382ad.0112240012.462d9daa@posting.google.com> Message-ID: <7xu1uh2ea5.fsf@ruckus.brouhaha.com> You may get more flexibility having a little client side application that navigates the users' browser on command. Under Windows you'd probably use the MSIE Automation interface (IWebBrowser2 COM object) for that. With Linux browsers there's probably something comparable. The client side navigating app could itself be a little http listener, using the python library class for that. From phd at phd.pp.ru Wed Dec 19 09:07:56 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Wed, 19 Dec 2001 17:07:56 +0300 Subject: Can I change a unicode char to gb2312 using python? In-Reply-To: <9vq6d9$gvc5p$1@ID-12869.news.dfncis.de>; from store_li@sina.com on Wed, Dec 19, 2001 at 09:46:41PM +0800 References: <9vq6d9$gvc5p$1@ID-12869.news.dfncis.de> Message-ID: <20011219170756.B14533@phd.pp.ru> On Wed, Dec 19, 2001 at 09:46:41PM +0800, Kick wrote: > I know that Java have a method that can manually encode string, like that, > System.out.println(new String("some chinese char".getBytes()"GB2312")) > > Is there any python function or method can do the same work? http://www.python.org/doc/current/lib/string-methods.html Python strings has method "encode": u'sigma'.encode('gb2312') Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From r.b.rigilink at chello.nl Mon Dec 31 06:38:27 2001 From: r.b.rigilink at chello.nl (Roeland Rengelink) Date: Mon, 31 Dec 2001 11:38:27 GMT Subject: REPOST: Re: Python Popularity, python at sourceforge References: <3C2FBA84.490E5D7E@chello.nl> <7$--$$_----__$-__$@news.noc.cabal.int> Message-ID: <3C304E81.7E0F4F27@chello.nl> Hi Jeffrey, Be carefull not to read too much in what I said, which, despite the length of the post, was very little. Jeffrey Drake wrote: > > I believe your statistic draw the wrong conclusion as well. > I had 4 general conclusions: 1. Python is the smallest of the 6 languages discussed here. 2. Python is currently growing slower than PHP and Java, but faster than C and Perl. - Python has only been gaining on Perl for the last 6 months - the difference in growth w.r.t PHP and Java may be getting smaller 3. Java is more cross-platform than Python. Perl, C, C++ are less. 4. There is no clear evidence for Python's ease of development. I admitted in a previous post that 4 was very carelessly worded. From your post however, it's difficult to see which of these conclusions you think is wrong. > From what I saw you don't make any notice to what the languages are > commonly used for. > Nope, I haven't said anything about this. Which makes it difficult to be wrong about it (even though 99% of what I don't say is nonsense) > (this list maybe wrong, or a little off) > PHP is primarily a web language. > Java is primarily used for user interfaces on websites and gui. > Perl is both web language and console, but usually not gui interface. > C++ and C are completely general in their scope, however usually > aren't used for web > > Python is also quite general, save the purpose of including it in > other programs (like inside C/C++ programs) > > As said before Ruby is growing popularity, I believe it is also > general. > > Lua isn't mentioned either, its purpose is almost exclusively for > inclusion in programs > Well, I didn't mention a lot of languages, many of which have far more sourceforge projects than Ruby Lua isn't mentioned on sourceforge at all. For a list of languages see: http://sourceforge.net/softwaremap/trove_list.php?form_cat=160 > If your statistics were based on types of usage, they may mean more > Definitely. Unfortunately it is somewhat difficult to get an indication of project type from the summary given in the sourceforge trove. Not impossible by any means, just more work than I cared to put into this. > Regards, > Jeffrey Drake > Regards, Roeland -- r.b.rigilink at chello.nl "Half of what I say is nonsense. Unfortunately I don't know which half" From werme at mediaone.net Mon Dec 3 23:14:12 2001 From: werme at mediaone.net (Ric Werme) Date: Tue, 04 Dec 2001 04:14:12 GMT Subject: Linux Kernel Design and Why Python is Rad References: Message-ID: Jonathan Gardner writes: >Check out this link: http://kerneltrap.org/article.php?sid=398 >Linus Torvalds on design: "Nothing successful has every been designed. It has >evolved." >Everyone else: "No wait a minute, that's not what this book says! And that's >not what my teacher said!" Everyone else has not read "The Mythical Man-Month"? It states quite clearly that you should "Plan to throw one away." It's still one of the few books on system design that's worth reading. Jeez, kids these days.... -- "When we allow fundamental freedoms to be sacrificed in the name of real or perceived emergency, we invariably regret it. -- Thurgood Marshall Ric Werme | werme at nospam.mediaone.net http://people.ne.mediaone.net/werme | ^^^^^^^ delete From mhammond at skippinet.com.au Thu Dec 20 01:22:12 2001 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 20 Dec 2001 06:22:12 GMT Subject: sys.path ordering question References: <3C207C52.8080700@skippinet.com.au> Message-ID: <3C218392.9090400@skippinet.com.au> David Bolen wrote: > Mark Hammond writes: > > >>Use a .pth file like these packages do. This is really what the Win32 >>extensions should do too. >> > > But I thought one problem with .pth files is that they wouldn't work > if Python was invoked from a COM object (and couldn't locate the > executable location, and thus the .pth files), which would certainly > affect the Win32 extensions. Or since that's been cleaned up in > Python 2.2 (I think), is this a 2.2+ suggestion? This has been fixed in 2.2. In some embedding situations, sys.prefix was not set correctly, and hence Python could not locate the .pth files. Python 2.2 correctly identifies it's home in all (reasonable) scenarios) So yeah, this is a 2.2+ suggestion - the installer could simply change the way it registers these path entries based on the version it is built for. I also believe the COM work could benefit from some other 2.2 work, particularly the way COM properties work - this is something I will delve into over the next few months. Mark. From aleax at aleax.it Fri Dec 28 10:04:32 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 16:04:32 +0100 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: "Fredrik Juhlin" wrote in message news:mailman.1009544733.30338.python-list at python.org... > On Fri, Dec 28, 2001 at 12:27:35PM +0100, Alex Martelli wrote: > > "Steve Lamb" wrote in message > > news:slrna2nhfo.nme.grey at teleute.dmiyu.org... > > > On Thu, 27 Dec 2001 17:48:13 +0000, phil hunt > > > > > wrote: > > > > Python runs quickly on my 300 MHz box, which is 3 times slower > > > > than the slowest PC you can buy today. It can only get more popular. > > > > > > Well, if you take the measure of just pure Mhz.... 4 times slower. ;) > > > > FIVE or more. 1.5 GHz desktop machines are hardly news these days. > I'm afraid you missed the word "slowest" in the original statement, Alex :) Ooops yes -- so did Steve, I think. You CAN still buy PCs whose CPU's are claimed to run at 900 MHz *AND LESS* (so even the "3 times" in the OP was incorrect:-). Alex From tim at vegeta.ath.cx Mon Dec 24 13:37:33 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Mon, 24 Dec 2001 18:37:33 GMT Subject: vi or emacs for editing Python on Linux? References: <231220011915029251%jwbaxter@spamcop.net> Message-ID: Bud Rogers graced us by uttering: [ snip ] > Inside [Emacs] is an astonishing collection of tools all > cleverly packed together in the smallest space possible. Ok, you're article up until here was relatively unbiased... ...but what bias could cause you to use "Emacs" and any inflection of the word "small" in the same paragraph, no matter how true the rest of the text? Sorry. Could resist. =) Cheers and Merry Christmas! Tim Hammerquist -- If the human mind was simple enough to understand, we'd be too simple to understand it. -- Emerson Pugh From qrczak at knm.org.pl Tue Dec 4 03:01:13 2001 From: qrczak at knm.org.pl (Marcin 'Qrczak' Kowalczyk) Date: Tue, 4 Dec 2001 08:01:13 +0000 (UTC) Subject: PEP 276 Simple Iterator for ints (fwd) References: <3C0C5E21.24228E2E@cosc.canterbury.ac.nz> Message-ID: Tue, 04 Dec 2001 18:24:49 +1300, Greg Ewing pisze: >> There is another question: should the upper bound be reevaluated each >> time? > > I'd say no. Most of the time I wouldn't want that, > and would object to paying for it when I didn't > need it. When I wanted it, I'd write a while loop. I agree. -- __("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ QRCZAK From sholden at holdenweb.com Thu Dec 13 19:42:33 2001 From: sholden at holdenweb.com (Steve Holden) Date: Thu, 13 Dec 2001 19:42:33 -0500 Subject: Where can you find the Python ODBC modual References: Message-ID: "maxm" wrote ... > Try this: > http://www.google.com/search?q=python+odbc+access > > regards Max M > > "John Yeager" wrote in message > news:Uc4S7.1806$M3.864398 at newsrump.sjc.telocity.net... > > This thing is driveing me nuts I am trying to connect to an Access > > Database,( boss will not let me use Mysql ), so I am in need of figureing > > out how to connect to Microsoft access.. > > In fact that particular Google search won't be that helpful. There is an odbc module with the Win32all extensions, that come as a part of ActiveState's Active Python implementation. I would recommend Marc-Andre Lemburg's mxODBC module, however, available vie www.lemburg.com/python/ - you will need the mxBase package and the mxCommercial extensions. regards Steve -- http://www.holdenweb.com/ From James_Althoff at i2.com Tue Dec 11 13:42:46 2001 From: James_Althoff at i2.com (James_Althoff at i2.com) Date: Tue, 11 Dec 2001 10:42:46 -0800 Subject: PEP 276 Simple Iterator for ints (fwd) Message-ID: Christopher A. Craig wrote: >I may be wrong, there may be some class of problems where you really >want to use a foreach style "for" loop to iterate over a set of >integers (other than a half-open, increment by one range for sequence >indexing), but I can't think of what that might be. Go right back to David's example and let's suppose that instead of just printing each integer I need to make a list of such numbers and pass them off somewhere else. With David's scheme you can use list comprehensions. With the while-loop approach you have to revert to the mylist.append() idiom. Adding list comprehensions to Python wasn't a necessity, but some feel that it is a nice mechanism for certain situations. The same goes with intervals. Sometimes it isn't best to look at things in strict isolation. Jim From ajs at ix.netcom.com Tue Dec 4 21:05:32 2001 From: ajs at ix.netcom.com (Arthur Siegel) Date: Tue, 4 Dec 2001 21:05:32 -0500 Subject: ANN: PyGeo V.6 Message-ID: <000001c17d31$ba0b5960$c747f6d1@ArtSiegel> "Why don't you guys go do some coding!" Fredrik Lundh, python-list, Dec 2, 2001 (quote :approximate, spelling: exact) And so I have. BETTER CODE, REFRESHED SITE http://home.netcom.com/~ajs (check out the animation on the "links" page) NEWS PyGeo is a selected site at the Math Forum http://mathforum.org/library/topics/projective_g >From the PyGeo readme: PyGeo is a 3d Dynamic Geometry toolset, written in Python, with dependencies on Python's Numeric and VPython extensions. It defines a set of geometric primitives in 3d space and allows for the construction of geometric models that can be interactively manipulated, with defined geometric relationships remaining invariant. It was created for, and is therefore particularly suitable for, the visualization of concepts of Projective Geometry. But it can used in more basic ways to create simple constructions illustrating Euclidian principles. And to create colorful designs from geometric ideas. Fun (for all ages) as well as educational for both the mathematically and *artistically* inclined. It is also, hopefully: A take apart toy for folks trying to learn programming A dig at the "Old Dog,New Tricks" adage - having been created by a middle-ager without significant prior programming background. (It took work, it took time) A work-in-process. Art -------------- next part -------------- An HTML attachment was scrubbed... URL: From 013-139047 at telia.com Tue Dec 18 09:09:36 2001 From: 013-139047 at telia.com (Christer Frovik) Date: Tue, 18 Dec 2001 14:09:36 GMT Subject: Python equivalent to @lines = 'command'; Message-ID: Is is possible to spawn a command (any command not just ls) and have all the lines that the command outputs stored in a list? In PERL this is done quite nicely in a single statement: @files = `ls -1`; and you can then iterate over @files and do whatever you want. Any ideas, or should i stick with Perl for my mindless scripts? From use-net at schabi.de Wed Dec 5 05:12:12 2001 From: use-net at schabi.de (Markus Schaber) Date: Wed, 5 Dec 2001 11:12:12 +0100 Subject: 'ioctl ' call in python (serial port reading) References: <3C0C8FF3.7060500@beth.uniforum.org.za> <20011204110657.139799b7.use-net@schabi.de> <3C0CA72D.7040304@beth.uniforum.org.za> Message-ID: <20011205111212.3b9c391e.use-net@schabi.de> Hi, On Tue, 04 Dec 2001 12:36:29 +0200 mixo wrote: > Yes, "unixoid Python incarnations" have the functions. But, here is the > thing, in the above code, the variable "mdlns" is an integer, but > "&mdlns" is an address. How do I get around that? That's documented in the fnctl docu (at least the 2.1 version I read). You pass a string containing the byte array you want to input. The module then copies the string to a new memory array, and passes this array's address. The modified memory array then is converted back to a string which is returned by the fnctl as function result. You could convert your integers by hand, or use the struct module to do this. markus -- "GPL software is not free - the cost is cooperation" From rdsteph at earthlink.net Sat Dec 29 19:56:26 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sun, 30 Dec 2001 00:56:26 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: <3C2E6756.79817679@earthlink.net> Paul, I'm just wondering if you could possibly add any of the "ideas", (such as they are ;_))) from the two posts that I copy below from a thread above here??? My comments come from a clueless brain dead newbie (*me*) about a Fiery Bush Python Server, could Zope maintain such a Master Python (Zope) server as a public utility in addition to Zope's other capabilities? Dr. Ritchie's comments are probably more sane, but even he wondered if he was on "shakey ground" ;-))) Anyway, keep up the great work. I am interested someday in learning and using Zope, but I admit I am a little intimidated by stories on the list of its difficulty. Still,, someday ;-)) I imagine the blood , sweat, and tears already incorporated into Zope make it a work of great beauty. Good luck on Zope3, maybe I'll get around to running my Great Zope-based web site about the time you launch Zope 3, I hope, if not before ;-))) Ron Stephens http://www.awaretek.com/plf.html Paul Everitt wrote: > I think there's a lot of merit to what you (Bill) say below. Zope is a > big project in scope, and though there is a lot of documentation, it is > scattered and not organized as it should be. > > The current Zope (2.x) also suffers from more of a "one size fits all" > approach, where content authors, web designers, and site developers are > all wedged into the same basic box. Thus, documentation and GUI suffer > from having different audiences. All in all, Zope has a higher learning > curve than it should. > > Tackling this basic issue is the goal of Zope3: > > http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/ > > In particular, read "VisionStatement" on that page for a pretty blunt > statement showing we're in tune with your points. Zope3 actually has > documentation, interface files, and unit tests being written *before* > code. All in all, Zope3 is proving to be much more Pythonic, more > modular, more explicit than implicit, etc. > > This doesn't preclude the need to do this for Zope2. I'm interested in > hearing more about the Pet Shop example you mentioned. Is it a > canonical example that is written up somewhere else for a different system? > > All in all, Zope is doing quite well. I'd say, with all the books out > and coming out, we're ahead of where PHP was at a similar age. Also, > it's important to note that around half of the people using Zope had > never used Python before. It's a significant achievement. Like Python, > Zope has a large and active community with bright and pleasant people > all around the world. > > I'd also like to point out that Zope isn't a straight-up competitor to > J2EE. In many ways, Zope competes more with Vignette, Interwoven, and > other content management systems as much as it competes with application > servers. This explains why appealing to content authors and site > designers has been on our radar. > > It also explains why I think WebWare, Quixote, and other Python web > systems are complementary to Zope. It's a big market with lots of > audiences. And we all need Python to succeed. > > In fact, with Zope3 I'd like to see more ways for us to collaborate with > other Python web systems, as there is a lot of good work going on. With > Zope3 being more Pythonic and more modular, there's a better basis for > two-way sharing. But only if other projects are also interested. > > 2002 is going to be a critical year for Zope. On the one hand, we have > the validation from multiple books and some nice customer success > stories (hooray, we can finally talk about CBS!). Also, Zope3 combined > with Python 2.2 will make Zope more friendly to Python developers. On > the other hand, we either win back people like you this year, or we face > the thought that we've peaked. > > Bill, can you send me an offline note and explain the Pet Shop example? > > --Paul > > Bill Tate wrote: > > > Ron Stephens wrote in message news:<3C2B9E04.9957801F at earthlink.net>... > > > >>I recently read an interview with a Digital Creations top manager where he said > >>that he hopes someone starts a successful business based solely on providing > >>ISP services using Zope, with full technical support. Is anyone looking into > >>this? Does anyone think this could be a successful business model? I am > >>interested in opinions on this. > >> > > > > This past spring, I spent a full month pouring over Zope in detail. I > > pulled every example product I could find that I thought would be > > relative to the purpose of setting up a commercial-based application. > > I downloaded the tutorial and the draft zope book. I pulled down > > every bit of documentation I could find for developers. In so many > > cases, I found whatever documentation was available that key aspects > > of the implementation took the "assumed facts-already-in-evidence" > > approach; omitting key details that would were critical to improving > > my understanding of using Zope. I consider myself a masochist in the > > sense that I'm willing to go through various contortions to figure > > something out, but like many others, I reached a point of saying that > > I still don't get it. I won't even touch the issue of ZOPE's CMF or > > Zope Templates - the documentation on that couldn't be more confusing > > if it tried. > > > > My point is, the product may be perfect for my needs, but please do > > away with tutorial examples referring to using zoo animals to > > illustrate object navigation or elvis sightings to solidfy > > understanding of the product. There were simply too many disjointed > > pieces in the documentation to allow me to pull all the pieces > > together and believe me when I say I'm a person who will go to great > > lengths to try to "get something." If I'm having trouble, than I > > suspect more than a few others are as well. > > > > Any commercial enterprise is likely to be supported by either some > > data model or object-class model that almost invariably has a RDBMS on > > the back-end for persistent storage (I've also worked with ODBMS so > > ZODB isn't an issue for me). If you want to gain converts to zope, > > build a tutorial that follows some resemblance of a what a normal web > > site has to provide by way of example - perhaps something akin to the > > Pet Store example in Zope would be useful??? How about building an > > example auction site from scratch? I would be more than happy to > > devote time and energy contributing to Zope but I can't until I figure > > out how Zope works. To some degree, I think my confusion with Zope > > increased AFTER I went through the documentation. Truthfully, I don't > > even know whether Zope would be even a reasonable candidate for doing > > something akin to the Pet Store example or even an auction site for > > that matter. > > > > PHP has virtually exploded on the scene by providing a everything > > including the kitchen sink - it appears to have taken little > > convincing to gain converts to PHP and accordingly to the latest web > > surveys, its implementation is huge. I much rather see tools like > > Zope achieve that kind of status. But I don't imagine that too many > > folks are going to be willing to work that hard to achieve Zope Zen > > when other alternatives exists and that's a damn shame because I > > suspect Zope is an excellent product. > > > > I truly do commend and appreciate DC's contribution's to Python, but I > > hope somebody can point to something (either examples or > > documentation) that gives me a reason to try again. > > > > Truthfully, I just don't think its me. > > > > Bill Tate > > From bhoel at web.de Fri Dec 7 13:43:13 2001 From: bhoel at web.de (Berthold Höllmann) Date: 07 Dec 2001 19:43:13 +0100 Subject: strict python? References: <3C1060E4.756F33B2@earthlink.net> <3C107172.6866DC18@alcyone.com> <9ups92$ers$1@peabody.colorado.edu> <3C10776C.8BB710EF@alcyone.com> <9upu2a$g4v$1@peabody.colorado.edu> Message-ID: Fernando P?rez writes: > Erik Max Francis wrote: > > > Fernando P?rez wrote: > > > >> I honestly don't see any reason for something like that not to be > >> included in python (other than perhaps 'if perl has it it can't be > >> good' :) > > > > Agreed. For the record, I wasn't suggesting something mandatory. > > Certainly not. In perl, it's the -w switch, in gcc the -W family > (with -Wall the max). And that's as it should be, an option (sort of > a builtin pychecker). Just for the record: -Wall isn't the max for gcc. There are more warnings, not covered by the -Wall option as -Wfloat-equal: Warn if floating point values are used in equality comparisons. and several more Greetings Berthold -- bhoel at web.de / http://starship.python.net/crew/bhoel/ It is unlawful to use this email address for unsolicited ads (USC Title 47 Sec.227). I will assess a US$500 charge for reviewing and deleting each unsolicited ad. From fperez528 at yahoo.com Wed Dec 12 18:42:57 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Thu, 13 Dec 2001 23:10:57 +2328 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <1008303437.718558@cswreg.cos.agilent.com> <9vbvi5$cm0$1@peabody.colorado.edu> <7xhequjsgl.fsf@ruckus.brouhaha.com> Message-ID: <9vc581$g0h$1@peabody.colorado.edu> Paul Rubin wrote: > Fernando P?rez writes: >> For some bizarre reason, redhat 7.2 includes two versions of pyhton with >> 1.5 being the default. > > The reason may be that some of the red hat configuration scripts were > written under python 1.5, and 2.1 broke backwards compatibility. > In particular the "rand" module was renamed "random" and maybe changed. good point. just yesterday I found out about that b/c I screwed up the firewalling rules when installing a 7.2 box. Lo and behold, when I went digging looking for the installer package (named anaconda), what I found was a bunch of python scripts! The entire RedHat installer is a python system (hence the name!). This was great, in a few minutes I was able to dig out what the name of the underlying firewall configurator (lokkit) was and fixed my mistake. cheers, f From tmagna at online.no Thu Dec 27 04:20:55 2001 From: tmagna at online.no (Brandvik) Date: Thu, 27 Dec 2001 10:20:55 +0100 Subject: REPOST: Re: Pascal's triangle (beginner) References: <2oqj2ucmbo2658uq1dq3v8quc6f116d8tq@4ax.com> Message-ID: <4$--$$-$$$$%_-$$_$@news.noc.cabal.int> On Wed, 26 Dec 2001 17:23:25 +0100, "Karl M. Syring" wrote: >Look at http://www.inetarena.com/~pdx4d/ocn/python/series.html for the >answer on this and several related questions that my come up. > >Karl M. Syring Thanks for the link. I know my question sounds like homework, but it's not (still three years until I can take computer science). Anyway, thanks again for your help. -Brandvik ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Brandvik Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:14:34 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775866 27193 211.57.49.2 (31 Dec 2001 05:17:46 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:17:46 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From mwh at python.net Fri Dec 21 06:36:10 2001 From: mwh at python.net (Michael Hudson) Date: Fri, 21 Dec 2001 11:36:10 GMT Subject: Where is time module? References: Message-ID: "Jason Orendorff" writes: > Jeff Sandys wrote: > > I can't import the time module or find it anywhere in the > > Python-2.1.1.tgz distribution. > > It's written in C; source code is in "src/Modules/timemodule.c". > > Try this: > > >>> import sys > >>> print sys.builtin_module_names > > What does it say? Or look in $(prefix)/lib/python2.1/lib-dynload/ for timemodule.so. Cheers, M. From glchapman at earthlink.net Wed Dec 26 13:33:33 2001 From: glchapman at earthlink.net (Greg Chapman) Date: Wed, 26 Dec 2001 18:33:33 GMT Subject: Properties fun with 2.2 References: Message-ID: On Mon, 24 Dec 2001 09:27:11 +0000, Robin Becker wrote: >very nice. I wondered if this stuff would be easy and it seems it can >be. One of the things I need is a collection of properties ie a property > >P > >with its own attributes (probably properties themselves) which can be >accessed as > >P[0] > >ie a thing similar to P, but allowed individual values where these >differ from the aggregate. I wonder whether this is more easily done in >2.2. It's quite hard in 2.1. This farily easy in 2.2 (and also possible in earlier versions using a __getattr__ handler), as long as you're willing to put up with the overhead of a proxy class. Specifically, getting a property P from an object returns a proxy class which defines a __getitem__ which, when called, makes a call to a method of the original object to get the actual result. Here's an example from some property extensions I've been experimenting with to try to incorporate some Delphi-esque qualities to the new properties: def _indexpropgeterr(proxy, key): raise TypeError("unindexable property") def _indexpropseterr(proxy, key, value): raise TypeError("property doesn't support item assignment") def _indexpropdelerr(proxy, key): raise TypeError("property doesn't support item deletion") class _indexedPropProxy(object): def __init__(self, obj, indexedprop): self.obj = obj self.ifget = indexedprop.ifget or _indexpropgeterr self.ifset = indexedprop.ifset or _indexpropseterr self.ifdel = indexedprop.ifdel or _indexpropdelerr # __iter__ gets special treatment because, if ifiter is not provided, # it may still be possible to iterate over this property using __getitem__ # (provided that the property works with integer keys). ifiter = indexedprop.ifiter if ifiter: self.ifiter = ifiter self.__iter__ = lambda this: this.ifiter(this.obj) else: self.ifiter = None def __getitem__(self, key): return self.ifget(self.obj, key) def __setitem__(self, key, value): self.ifset(self.obj, key, value) def __delitem__(self, key): self.ifdel(self.obj, key) class indexedproperty(property): def __init__(self, ifget=None, ifset=None, ifdel=None, ifiter=None, doc=None): property.__init__( self, fget=(lambda this: _indexedPropProxy(this, self)), doc=doc ) self.ifget = ifget self.ifset = ifset self.ifdel = ifdel self.ifiter = ifiter ################################# class Test(object): def __init__(self, items): self.__items = items def __getitem__(self, index): return self.__items[index] Items = indexedproperty(__getitem__) # indexed properties which use __getitem__ (like above) are the equivalent of a # default array property in Delphi: test[0] is test.Items[0] def RunTest(): items = [1,2,3] test = Test() #the following three loops all print the same thing for n in test.Items: print n for i in range(len(items)): print test.Items[i] for i in range(len(items)): print test[i] --- Greg Chapman From grante at visi.com Tue Dec 18 16:46:06 2001 From: grante at visi.com (Grant Edwards) Date: Tue, 18 Dec 2001 21:46:06 GMT Subject: Newbie Wondering About Database Support? References: Message-ID: In article , Richard Kessler wrote: > I have recently discovered Python and am excited about the > possibility of developing with the language. Unfortunately, I > develop database centric applications, MS SQL Server, etc. and > I do not see much talk about Python and access to databases. Apparently it works so well that there's not much to talk about! If people did spend a lot of time talking about database access methods, then you'd have something to worry about... -- Grant Edwards grante Yow! I have a very good at DENTAL PLAN. Thank you. visi.com From borcis at geneva-link.ch Tue Dec 25 17:09:01 2001 From: borcis at geneva-link.ch (Boris Borcic) Date: Tue, 25 Dec 2001 22:09:01 GMT Subject: [OT] Season's Greetings References: <3C27D50E.DF248491@geneva-link.ch> Message-ID: <3C28F917.4C14C8DF@geneva-link.ch> I mistakenly wrote : > Note that 2002 = 2 * 7 * 11 * 13, an early pqrs number - > the 12th exactly : > > 210, 330, 390, 462, 546, 770, 858, 910, 1155, 1365, 1430, 2002 That's a pure lie that God knows why survived "cancel", 2002 is about the 45th pqrs number. BB From pieter.claerhout at pandora.be Mon Dec 31 10:05:17 2001 From: pieter.claerhout at pandora.be (Pieter Claerhout) Date: Mon, 31 Dec 2001 16:05:17 +0100 Subject: mv command In-Reply-To: <96c7b7dc.0112310652.2e8c1101@posting.google.com> Message-ID: <000d01c1920c$8f34f580$893676d5@tsjernochill> Hi Peter, you can use the os.rename function for this. Pieter -----Original Message----- From: python-list-admin at python.org [mailto:python-list-admin at python.org]On Behalf Of Peter Sent: Monday, December 31, 2001 3:53 PM To: python-list at python.org Subject: mv command I'm new to Python, and can't find the way to move a file individually from a for loop to another directory. Regards Peter #!/usr/bin/python import os, sys, commands, string lscmd = 'ls ' lsdir = '/home/pk/old' lsmask = '*.txt' mvdir = 'home/pk/new' cmdtxt = lscmd + lsdir + '/' + lsmask print cmdtxt f = commands.getstatusoutput(cmdtxt) print f print '[', f[0],']', f[1] if f[0] == 0: f_split = string.split(f[1],'\n') print f_split for x in f_split: print '-->', x else: print 'no file corresponding to lsmask' -- http://mail.python.org/mailman/listinfo/python-list From freebird317 at hotmail.com Mon Dec 24 20:10:08 2001 From: freebird317 at hotmail.com (~Jason~) Date: Tue, 25 Dec 2001 01:10:08 GMT Subject: Learning how question Message-ID: I am able to run the hello world, how do I put it into the form of an .exe? -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If GOD be for us, who can be against us? ~ Romans 8:31~ Jason Lehman freebird317 at hotmail.com From logiplexsoftware at earthlink.net Thu Dec 20 14:04:48 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Thu, 20 Dec 2001 11:04:48 -0800 Subject: /usr/bin/env: python: No such file or directory In-Reply-To: <3C222B16.C1B1BC8D@attbi.com> References: <915a998f.0112161542.2ab07235@posting.google.com> <3C222B16.C1B1BC8D@attbi.com> Message-ID: <20011220110448.3425cdb1.logiplexsoftware@earthlink.net> On Thu, 20 Dec 2001 10:16:54 -0800 Chris Barker wrote: > I suppose, if we all, as a community, start using: > > #!/use/bin/env python2.1 > > Then the problem will be solved, at least on *nix... > > Then what do you do with a script that will run on either 1.5 or 2.0 or > 2.1 ????? and you don't know which of these might be installed? > It seems reasonable that if your script requires a particular version of Python to append the version to the executable name (i.e. python2.1), and if your script doesn't care, then just use "python" which could be a symbolic link to the default python interpreter (much as redhat has it now). It might be helpful if the python interpreter took a flag such as --required-version or --minimum-version so that a warning could be printed if the script requires a version different than what is available on the system. -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From tchur at optushome.com.au Sat Dec 29 04:12:37 2001 From: tchur at optushome.com.au (Tim Churches) Date: Sat, 29 Dec 2001 20:12:37 +1100 Subject: PythonCard, ease of use, and the GUI problem/opportunity/niche References: <3C2A9D33.67FEC261@earthlink.net> <458b194a.0112282052.1123341@posting.google.com> <3C2D620C.2E67414D@earthlink.net> Message-ID: <3C2D8905.EF867362@optushome.com.au> Ron Stephens wrote: > > Bingo! Boy, oh, boy, do I agree with you on this. I think you hit the nail right on the head. > > Building a gui now using Python, compared to using VB, really sucks. Yes, it's that bad. > My experience with VB5 on a fairly complex application was that it was easy to lay out the forms and bind the data-aware controls to a database, but as soon as you attempted anything fancy you started to get into trouble, either in terms of maintainability, memory and other resource consumption and quite often outright crashes. The semi-OO features in VB6 might have improved matters - I don't know because I subsequently discovered Python. My limited experience so far with wxPython is that the screen design is definitely more fiddly than with VB, and binding controls to a database is a more manual process (more work), but because everything is done with Python, there is a strong tendency for things to just work, first time. Of course, maintainability is vastly better than VB, mainly due to wxPython's insistance that everything is a subclass of the basic wxPython classes. > Whichever reasonably easy to use language (right now I'm thinking either Python, Ruby, or a yet-to-be created > language) first gets an open source gui builder built on top of it that is as easy to learn and use as VB will > dominate the world. I would suggest that world domination will only come when there is an open-source application which matches the ease of use and, given that ease-of-use, very broad capabilties of MS Access, which is MS Window's killer app in my view. To programmers, Access is just "dumbed-down VB" - indeed it is, but it is that dumbing-down that makes it so wildly popular - there must be orders of magnitude more MS Access databases in daily use than there are VB apps - at least that is my experience. Most of those Access application are, to the eyes of an experienced programmer, a complete dog's breakfast, but the alternative is having end users managing their data in Excel spreadsheets, which is even worse. But Access is also powerful - you can create some very sophisticated, elegant, easy-to-maintain and powerful application in Access which are almost completely code-free (and therefore almost self-documenting). Indeed, I regard Access so highly that it even goes some way to assuaging the sins and excesses of Microsoft (but not enough for them to be forgiven!). > > It must, in my opinion, be as easy to use as VB for building simple input and output forms. That's the key. It > doesn't have to be any more powerful or anything else. Just easy. This is a crying out loud need that anyone > can see; someone will solve it, I am sure. It's too big an opportunityto be forever ignored. Unfortunately, I > am beginning to hae my doubts that it will be a Python-based solution. I sure hope I'm wrong. > The Recall product being developed by The Kompany looks promising - it is an Access clone (that's good), uses Python as its scripting language and provides automated binding to the popular open source SQL engines and to dBase files. However, it has a long way to go before it is as slick and as capabable as Access, and is currently limited to the KDE environment (although it is being ported to Windows). However, it is not free, and for Windows users who already have MS Word and Excel on their PCs, the choice between paying one or two hundred dollars for Access versus a bit under $100 for Rekall is a no-brainer, given the widely available support and huge knowledge-base which Access has built up over the last 10 years (yes, it has been around in it current form with only cosmetic and other minor changes for that long). For an Access alternative to gain a foothold, it needs to be cost-free and very easy to install, so that people will at least evaluate it as an Access alternative. > The only hope that I know of right now is PythonCard, only a six month old project led by Kevin Altis. I > really admire Kevin and his team and I admire this project. I think they are ace coders (especially Kevin ) > who are capable of doing what needs getting done. But I am afraid they will miss the mark, partly for the same > reason as Zope has its detractors, namely, lack of good, easy to use documentation for learning and using the > language. > > Now, I know it's not fair to compare Pythoncard to Zope, as PythonCard is only six months old and pre-alpha, > for heavens sake ;-))) But when you love something, .. > > I am really like a cranky old uncle that only dotes from afar on a precocious child. I have nothing to do with > PythonCard, have contributed nothing, etc. But I admire it from afar like a doting uncle. > > But I haven't tried to use PythonCard in many weeks, a fact I hope to remedy this weekend. But I stopped > trying because, while I could see the brilliance of design and implementation, and potential for ease of use, > I couldn't get much farther due to lack of documentation. > > What's a resource file anyway? What's an application framework? Yes I'm a clueless newbie, but that's what the > winner in this battle must do, create something as easy to learn and use as VB is for a clueless newbie. For > now, unfortunately, I find it easier to use Tkinter because I have tutorials, online documentation, and even > books. PythonCard actuall seems harder to me as it stands. > > Maybe some of us could actually *help* create some documentation for PythonCard???? It's home page is at > SourceForge at http://pythoncard.sourceforge.net/ > > So go check it out. I really believe this is important. I'm going to try to use it this weekend. Lets discuss > it, then, OK????? The main things which PythonCard needs are: a) A drag-and-drop form editor (I believe this is being worked on) b) Automated bindings of data-aware controls to underlying databases. c) A drag-and-drop SQL query editor. d) A banded report writer like Access or Crystal reports. e) A really easy installation routine which handles the database installation/adminstration as well. f) Excellent documentation. Not a small ask, but that's what it will take to become a real competitor to Access. Most of these things are being worked on in one part of the Python world or another, but I suspect it will take several years and a conscious effort at co-operation between various projects for the various parts to make a whole which can rival and possibly outstrip MS Access. Tim C From usenet at NOSPAM-irmen.cjb.net Fri Dec 28 19:38:33 2001 From: usenet at NOSPAM-irmen.cjb.net (Irmen de Jong) Date: Sat, 29 Dec 2001 01:38:33 +0100 Subject: REPOST: [ANN] Pyro 2.3 available Message-ID: <7$--$$_----__-$%_$@news.noc.cabal.int> You can get the latest Pyro version (2.3) at http://pyro.sourceforge.net What's new: Event server fixes (not all problems yet, but many) Speed improvements. Documentation updates. Name Server resolving by hostname config item. What is Pyro? Pyro is an acronym for PYthon Remote Objects. It is a basic Distributed Object Technology system written entirely in Python. It is extremely easy to implement a distributed system with Pyro, because all network communication code is abstracted and hidden from your application. You just get a remote Python object and invoke methods on the object on the other machine. Pyro offers you a Name Server, an Event Service, mobile objects, remote exceptions, dynamic proxies, remote attribute access, automatic reconnection, a detailed manual, and many examples to get you started right away. Irmen de Jong ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.cwix.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Irmen de Jong" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:41:26 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774269 27193 211.57.49.2 (31 Dec 2001 04:51:09 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:51:09 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From johngrayson at home.com Wed Dec 5 06:46:19 2001 From: johngrayson at home.com (johngrayson42) Date: Wed, 05 Dec 2001 11:46:19 -0000 Subject: Cursors in Tkinter Message-ID: <9ul1eb+mfco@eGroups.com> Appendix F, Python and Tkinter Programming (Manning) I forget the author... :-) If not get tk source and look at: tk8.n.n/xlib/X11/cursorfont.h You'll find defines: #define XC_gumby 56 Drop the 'XC' and you're all set... John From laurent.pointal at laposte.net Fri Dec 7 15:52:50 2001 From: laurent.pointal at laposte.net (Laurent Pointal) Date: 07 Dec 2001 20:52:50 GMT Subject: Python on MVS, existing classes toolset ? Message-ID: Hello, does anybody have links about Python and MVS, and about an existing set of classes to use/manage resources under MVS. Thanks to cc to Jean.Brugerolle at wanadoo.fr Thanks for him. A+ L. Pointal From zhangsc at neusoft.com Mon Dec 17 00:37:13 2001 From: zhangsc at neusoft.com (=?gb2312?B?1cXJ2bPb?=) Date: Mon, 17 Dec 2001 13:37:13 +0800 Subject: socket question:socket.error:(4,'Interrupted system call') Message-ID: <030501c186bc$e1a75ca0$4301010a@sky> I have compiled a program to deal with Zombie process which caused by child process,it follows: ... ipsock=socket.socket(socket.AF_INET,10,8) while 1: recvpack=ipsock.recv(1024) ... def sig_chld(signum, frame): os.waitpid(-1,os.WNOHANG); signal.signal(signal.SIGCHLD,sig_chld); ret=os.fork() if ret==0: #child process ..... It raise a error: Traceback (most recent call last): File "d88.py", line 26, in ? recvpack=ipsock.recv(1024) socket.error: (4, 'Interrupted system call') Why is error? How to correct it? Any ideas will be appreciated. Thanks! Edward -------------- next part -------------- An HTML attachment was scrubbed... URL: From gminick at hacker.pl Thu Dec 20 12:34:24 2001 From: gminick at hacker.pl (Wojtek Walczak) Date: Thu, 20 Dec 2001 17:34:24 +0000 (UTC) Subject: age of new pythonistas [was: The Editor Poll results are in!] References: Message-ID: ** Since micro$oft is stupid it doesn't mean ** that you should be stupid too - do NOT toppost!!! Dnia 14 Dec 2001 07:14:25 -0800, Stephen Ferg napisa?(a): >My pre-Python programming experience: PL/I, Cobol, Visual Basic, >PowerBuilder, and REXX. IBM MVS, DOS, Windows, no Unix. Me: C, Perl on Linux. I've also touched C++, Lisp, Haskell, PHP, ADA, but only for a while, when I was looking for something to learn after C and Perl. I've chosen Python :> >It looks like many new Pythonistas are older, rather than younger. I'm breaking that rule, since I'm 17 :) I'm programming in Python for about a year, but at first it was only a short meeting, only since Python 2.1c2 it's love :> >When you are younger, your whole universe consists of the language >that you learned first -- it takes a while to learn that the universe >contains many, many languages to choose from. Not if you are able to read opinions of people with skills better than yours. On one of the polish news groups Marcin 'Qrczak' Kowalczyk was often recommending Python. I trusted in his rights and now I'm here ;) -- [ Wojtek gminick Walczak ][ http://hacker.pl/gminick/ ] [ gminick (at) hacker.pl ][ gminick (at) klub.chip.pl ] From aahz at panix.com Sun Dec 23 12:41:21 2001 From: aahz at panix.com (Aahz Maruch) Date: 23 Dec 2001 09:41:21 -0800 Subject: Search the difference: Why this function defenition does'nt work? References: <3C260A92.5030907@student.kun.nl> Message-ID: In article <3C260A92.5030907 at student.kun.nl>, husam wrote: > >I'm not trying to add string to a list of integeres. What I wanted to do >is to add each argument of func2('a','b','c') to sum=['e']. Since sum is >a list of chars, and the arguments are accessable as a sequence, one >would expect that the addition operation would be correct. On the >interactive shell, it is a trivial operation. But, only when i use it in >the function defenition i get problems. Adding 'a' to ['b'] does not >work, but adding list('a') to ['b'] it does, so, i thought that this >might help my code, but converting the args to a list did not helpe >either . I really didn't get yet! use list.append() -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 8 days and counting From aleax at aleax.it Fri Dec 28 12:41:02 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 18:41:02 +0100 Subject: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> <2419401F9FA44C22.520DBCE4218C0223.5487885783B69E22@lp.airnews.net> Message-ID: "Cameron Laird" wrote in message news:2419401F9FA44C22.520DBCE4218C0223.5487885783B69E22 at lp.airnews.net... > In article , > Cameron Laird I approximated: > > . > > . > > . > >RFC 765 FILE TRANSFER PROTOCOL June 1980 > >RFC 821 SIMPLE MAIL TRANSFER PROTOCOL August 1982 > >RFC 854 TELNET PROTOCOL SPECIFICATION May 1983 > >RFC 850 Standard for Interchange of USENET Messages June 1983 > >RFC 977 Network News Transfer Protocol February 1986 > . > . > . > Oops; substitute the earlier > RFC 788 SIMPLE MAIL TRANSFER PROTOCOL November 1981 That had the same _name_, but I don't think it would interoperate with the one specified in late '82 (and widely implemented in '83), so I don't think they should be considered the same _protocol_. Alex From blessed at mail.com Fri Dec 28 21:57:08 2001 From: blessed at mail.com (Gilbert) Date: 28 Dec 2001 18:57:08 -0800 Subject: Is this a bug? Message-ID: <33e9b770.0112281857.563a36d4@posting.google.com> Hi! I am wondering if the following results below imply any bug in Python 2.2 or 2.1? When I try to use float numbers, python 2.2 and 2.1.1 shows a little bit different results (I think it is incorrect) from what I enter. But python 1.5.2 seems to be okay? What is wrong? If you know why and how they are different, please let me know. Thanks! ----------------------------------- Python 2.2 (#1, Dec 23 2001, 09:30:32) [GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-98)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> 653.34 653.34000000000003 >>> ----------------------------------- Python 1.5.2 (#1, Oct 13 2001, 09:06:03) [GCC 2.96 20000731 (Red Hat Linux 7.1 2 on linux-i386 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> 653.34 653.34 >>> ----------------------------------- From fperez528 at yahoo.com Mon Dec 17 06:25:32 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Tue, 18 Dec 2001 10:53:32 +2328 Subject: /usr/bin/env: python: No such file or directory References: <9vivft$593$1@peabody.colorado.edu> <171220010818339518%jwbaxter@spamcop.net> Message-ID: <9vnvue$m5d$1@peabody.colorado.edu> John W. Baxter wrote: > > Doing which, a few weeks ago and with a 2.2 alpha and RH 7.1, caused > printing to stop working due to an expected module not being in the 2.2 > alpha (which one...I don't know). > Right. Just discovered that yesterday: I also broke printing! At this point I'm fully willing to say that RedHat has simply put out a broken python setup. I fail to see one good reason for the current mess, with system-level things (like printing) needing python 1.5 to be the default and be called python. It is NOT practical to expect users to write their scripts using #!/usr/bin/env python2, simply because that's a weird, redhat only default that breaks everywhere else. And what of code they download? Now they have to manually inspect every script they get from the web to replace python->python2? That's plain moronic. If redhat is too lazy to upgrade their code in anaconda and other tools to use python2, at least they could have the courtesy of putting explicitly python1.5 calls in their OWN stuff, instead of forcing upon their users a broken convention. I normally use mandrake (had been away from redhat for years) and only last week was forced to deal with redhat again. What an ugly, messy excuse for a linux distribution. cheers, f From ron.l.johnson at home.com Wed Dec 12 22:36:35 2001 From: ron.l.johnson at home.com (Ron) Date: Thu, 13 Dec 2001 03:36:35 GMT Subject: capturing output of os.system() into a list? References: Message-ID: <7nVR7.173216$SF4.5886167@news1.rdc1.sdca.home.com> Richard Jones wrote: > On Thursday 13 December 2001 12:06 pm, Ron wrote: >> Is there a built-in method of doing this? I can write a function >> to do it, but would rather use the standard method. > > something like: > >>>> import os >>>> os.popen('ls').readlines() > ['addDataManager.dtml\n', 'addExtDataContainer.dtml\n', [snip] > 'VERSION.txt\n', 'www\n'] Thanks to both of you. I knew there had to be something. It's just that there's *so many* libraries that us hobbiests (and who aren't C/Unix weenies) don't have a chance to learn it all. -- +------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson at home.com | | Jefferson, LA USA http://ronandheather.dhs.org | | | ! Thanks to the good people in Microsoft, a great deal of | ! the data that flows is dependent on one company. That is | ! not a healthy ecosystem. The issue is that creativity gets | ! filtered through the business plan of one company. | ! Mitchell Baker, "Chief Lizard Wrangler" at Mozilla | +------------------------------------------------------------+ From logiplexsoftware at earthlink.net Thu Dec 13 16:53:48 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Thu, 13 Dec 2001 13:53:48 -0800 Subject: Fallen Angels, Originators of Evil on Planet Earth? In-Reply-To: References: Message-ID: <01121313534802.01518@logiplex1.logiplex.net> On Thursday 13 December 2001 15:22, news at originsofevil.com wrote: > Terrible wars. Religious fanaticism. Destruction of the environment. > Exploitation of natural resources. Political and economic manipulation > on a planetary scale? What about clogging mailing lists with drawn-out arguments over tabs-vs-spaces for indenting code? Evil is very thorough. -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From jkraska at san.rr.com Thu Dec 6 23:06:53 2001 From: jkraska at san.rr.com (Courageous) Date: Fri, 07 Dec 2001 04:06:53 GMT Subject: Why doesn't this work? Message-ID: Python 2.2b2 (#26, Nov 16 2001, 11:44:11) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. IDLE 0.8 -- press F1 for help >>> def f(): return [1,2,3] >>> f() [1, 2, 3] >>> f().append(4) >>> l=f().append(4) >>> l >>> Obviously I can fix this, but I'm wondering why it doesn't work the way I expected it to? C// From boud at rempt.xs4all.nl Sun Dec 2 14:58:16 2001 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 2 Dec 2001 19:58:16 GMT Subject: Python, PyQT and QSpinBox References: <9ubnie$34b$1@snipp.uninett.no> <9uco14$3cb$1@news1.xs4all.nl> <9udb9l$g9h$1@snipp.uninett.no> Message-ID: <9ue14o$5fn$1@news1.xs4all.nl> Yngve F. Johansen wrote: > I'm not to familiar with the signal-slot mechanism, and it could be that I > have to do something with this? I don't have a single connect() statement > defined relating to the QSpinBox widget. In this case you don't need signals and slots, since you're not combining two objects. If you don't feel familiar with PyQt, you might like to start reading the second part of my book on PyQt, which gives quite a detailed explanation of the concept: http://www.opendocs.org -- Boudewijn Rempt | http://www.valdyas.org From keyton at weissinger.org Wed Dec 26 11:57:49 2001 From: keyton at weissinger.org (A. Keyton Weissinger) Date: Wed, 26 Dec 2001 11:57:49 -0500 Subject: Pascal's triangle (beginner) In-Reply-To: Message-ID: Good stuff in here, Karl. What are these examples from? Keyton > -----Original Message----- > From: python-list-admin at python.org > [mailto:python-list-admin at python.org]On Behalf Of Karl M. Syring > Sent: Wednesday, December 26, 2001 11:23 AM > To: python-list at python.org > Subject: Re: Pascal's triangle (beginner) > > > "Brandvik" schrieb im Newsbeitrag > news:2oqj2ucmbo2658uq1dq3v8quc6f116d8tq at 4ax.com... > > I've just started learning Python and I'm wondering how one could > > write a function that would print pascals triangle up to a certain > > number. It would be great if some of you guys could give me some hints > > on how such a script would look. It is not important that the output > > is in the form of a triangle -- I'm just wondering how to calculate > > the values and print them like this: > > 1 > > 11 > > 121 > > 1331 > > 14641 > > etc... > > > > BTW, this is my first post here... > > Look at http://www.inetarena.com/~pdx4d/ocn/python/series.html for the > answer on this and several related questions that my come up. > > Karl M. Syring > > > -- > http://mail.python.org/mailman/listinfo/python-list > > From rdsteph at earthlink.net Fri Dec 28 23:41:14 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sat, 29 Dec 2001 04:41:14 GMT Subject: win32all-141 for Python 2.2 References: <3C2D4676.5060700@skippinet.com.au> Message-ID: <3C2D49E6.39FD96BE@earthlink.net> Thanks, Mark. I really appreciate your efforts. I also suggest that *anyone* and everyone* using Python and Windows rush out and buy your book, Python Programming on Win32. Do you have any other book projects in mind? Mark Hammond wrote: > I have made a new win32all release for Python 2.2. > > Hrmm - it seems I can't login to starship :( So I have temporarily > placed it at: > > http://users.bigpond.net.au/mhammond/win32all-141.exe > > The only new known issue is that "Active Debugging" will probably not > work - using the Microsoft Debuggers when using Python in an ASP or IE > page will fail. > > I will move this to starship, including details of exactly what has > changed, ASAP. > > Mark. From postmaster at sict.stc.sh.cn Mon Dec 17 02:50:51 2001 From: postmaster at sict.stc.sh.cn (postmaster at sict.stc.sh.cn) Date: Mon, 17 Dec 2001 15:50:51 +0800 Subject: Delivery Status Notification (Failure) Message-ID: This is an automatically generated Delivery Status Notification. Delivery to the following recipients failed. jason.dilday at ncmail.net -------------- next part -------------- An embedded message was scrubbed... From: python-list at cwi.nl Subject: CD-ROM. This will include a variety of recipients Date: Mon, 17 Dec 2001 00:15:49 -0800 Size: 4865 URL: From grey at despair.dmiyu.org Mon Dec 3 04:21:48 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Mon, 03 Dec 2001 09:21:48 -0000 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: On Sun, 2 Dec 2001 20:13:37 -0600, Jeff Hinrichs wrote: > my 0.02$US: > Actually, spaces are the problems not tabs. A tab is a tab, where is > indenting by spaces....hmm. No, a tab isn't a tab. > You should be able to configure your editor to display tabs in a width that > is to your liking WITHOUT mucking with the data. As you just said, "You should be able to configure your editor to display tabs..." Oh, so a tab isn't a tab. I like indention of 4 so my tab is 4 spaces. You like 8 so yours is 8 spaces. A tab is not a tab. A tab is a collection of spaces, visually. Now, if you had read my post you would have seen where your whole "a tab is a tab" bubbub breaks down. Here it is AGAIN since you missed it the first time. some_dict = {'Jane':{'Age':'21', 'Dept':'0001', 'Ext':'1234'}, 'John':{'Age':'22', 'Dept':'0010', 'Ext':'5678'}, 'Jeff':{'Age':'23', 'Dept':'0100', 'Ext':'9009'}, 'Jody':{'Age':'24', 'Dept':'1000', 'Ext':'8765'}, 'Jeny':{'Age':'25', 'Dept':'0110', 'Ext':'4321'} } With spaces that always comes out the same. With tabs set to different lengths you get different results. The only constant when it comes to indention is a space. A space is a space. A tab is not constant and therefore should NOT be used for indention. Ever. Indention isn't about preference, it is about making the code readable. And as the above example shows, readable code could be rendered unreadable by tab "preferences". -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From uwe at rocksport.de Tue Dec 4 05:26:24 2001 From: uwe at rocksport.de (Uwe Schmitt) Date: 4 Dec 2001 10:26:24 GMT Subject: Numerical Python Question Message-ID: <9ui8cg$bqkt6$1@hades.rz.uni-sb.de> Hi, I tried the following code: from Numeric import * import LinearAlgebra n=5 hilb=zeros((n,n),Float) for i in range(n): for j in range(n): val= 1.0/(i+j+1) hilb[i,j]=val x=ones((n,1),Float) b=hilb*x print "x= ", x print "b= ", b As hilb is a n x n matrix and x is n x 1 the result b should be n x 1. But the program outputs a n x n matrix !!! Is this a bug, or did I miss something ? Greetings, Uwe. -- Dr. rer. nat. Uwe Schmitt Uwe.Schmitt at num.uni-sb.de Universitaet des Saarlandes Angewandte Mathematik Building 36.1 Room 4.17 PO-Box 151150 D-66041 Saarbruecken Mobile:0177/6806587 Fax:+49(0)681/302-4435 Office:+49(0)681/302-2468 From mwh at python.net Mon Dec 10 10:51:04 2001 From: mwh at python.net (Michael Hudson) Date: Mon, 10 Dec 2001 15:51:04 GMT Subject: Can't catch SIGUSR1 References: <3C14CB36.F857A0E6@snakefarm.org> Message-ID: Carsten Gaebler writes: > Hi there, > > I'm experiencing a strange problem with this short test script which > is supposed to catch a SIGUSR1: [snip] > Any ideas? Is one Python built with threading and the other not? I thought pthreads used SIGUSR1 for something. Just A Guess. Cheers, M. -- You have run into the classic Dmachine problem: your machine has become occupied by a malevolent spirit. Replacing hardware or software will not fix this - you need an exorcist. -- Tim Bradshaw, comp.lang.lisp From as1496 at ezlink.com.tw Fri Dec 14 21:44:25 2001 From: as1496 at ezlink.com.tw (¨È¬PÄË­¸) Date: Sat, 15 Dec 2001 10:44:25 +0800 Subject: TOP International Software Outsourcing Service Company Message-ID: An HTML attachment was scrubbed... URL: From lull at acm.org Sat Dec 22 21:09:04 2001 From: lull at acm.org (John Lull) Date: 22 Dec 2001 20:09:04 -0600 Subject: Fate of win32all? References: <7876a8ea.0112212116.2ebabc23@posting.google.com> <3C242A7F.2060805@skippinet.com.au> Message-ID: (mailed & posted) Mark Hammond wrote (with possible deletions): > stalin wrote: > > > I've used win32all occasionally--always in noncommercial settings--and > > have found it helpful. I'd like to thank Mr. Hammond for developing > > the packages > > My pleasure. I too wanted to thank you for all your work on win32all -- a great package, very useful, and very reliable. It has been of great assistance in my Python work. Regards, John Lull From danielk at aracnet.com Fri Dec 28 21:35:51 2001 From: danielk at aracnet.com (Daniel Klein) Date: Fri, 28 Dec 2001 18:35:51 -0800 Subject: Python Popularity: Questions and Comments References: <3C2CBACB.FBF3C3C9@mindspring.com> Message-ID: On Fri, 28 Dec 2001 12:32:49 -0600, "Dr. David J. Ritchie, Sr." wrote: >On the other hand, just to stir the pot a little and because I believe you should be able >to argue both sides of an issue, I would say when it comes to semi-critical >and critical applications, there are features of Java (like strong typing) >that at least mandate a certain level of consistency between all execution paths. Python is as type-safe as Java, it's just that the type is not checked until runtime whereas Java checks it at compile time. But Java certainly cant check _everything_ at compile time so it also has to do some measure of runtime checking. Sheesh, what a hack! All that extra coding just to achieve about a 1% gain in checking for errors. Blech!! Daniel Klein From francois-regis.chalaoux at sanofi-synthelabo.com Wed Dec 19 11:04:28 2001 From: francois-regis.chalaoux at sanofi-synthelabo.com (copter24) Date: 19 Dec 2001 08:04:28 -0800 Subject: bug : XmlprocDriver instance has no attribute 'feed' ???? Message-ID: <85e27928.0112190804.f85a284@posting.google.com> Hi, I parse a xml file with xml_objectify.py module. It is a very nice module transforming a xml file in python objects. You need to install PyXML to use the minidom module. Everything is ok on NT with python console or with an Apache server environment. But now, with a Sun machine, I only can run the same program on the console **but not through the Apache server** !!! For both OS I have PyXML-0.6.6 and Python 2.1.1 installed. On Sun got this error : Traceback (most recent call last): File "/usr/Micromass/GlobalServer/V1.1/WebServer/Apache/cgi-bin/masse/sgxml/test_xml.py", line 49, in ? py_obj = XML_Objectify(file).make_instance() File "../../lib/xml_objectify.py", line 218, in __init__ self._dom = minidom.parseString(self._fh.read()) File "/home/fr15903/lib/python2.1/site-packages/_xmlplus/dom/minidom.py", line 913, in parseString return _doparse(pulldom.parseString, args, kwargs) File "/home/fr15903/lib/python2.1/site-packages/_xmlplus/dom/minidom.py", line 900, in _doparse toktype, rootNode = events.getEvent() File "/home/fr15903/lib/python2.1/site-packages/_xmlplus/dom/pulldom.py", line 251, in getEvent self.parser.feed(buf) AttributeError: XmlprocDriver instance has no attribute 'feed' Any idea, FR. From cdewin at dingoblue.net.au Tue Dec 11 12:04:05 2001 From: cdewin at dingoblue.net.au (Another rookie) Date: 11 Dec 2001 17:04:05 GMT Subject: Some stupid questions Message-ID: <9v5ea4$d1ek8$1@ID-119882.news.dfncis.de> Hi I'm an old fart and a newbie. So I hope you'll bear with me and answer a few basic questions for me. Feel free as patronizing as you want. I've just downloaded the latest version of Python 2.2, and have started learning to program from the web tutorials. If I stick with it ...... ... Will I be able to compile my progs as executables, so that they can run on anybodies machine, whether or not they have a version of Python installed? ... If not, does jpython or jython allow me to compile my progs as java apps, so that they will run on any machine with java? From fperez528 at yahoo.com Sat Dec 1 13:00:41 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Sun, 02 Dec 2001 17:28:41 +2328 Subject: Draft PEP: string interpolation with backquotes References: Message-ID: <9ueh23$9e8$1@peabody.colorado.edu> John Roth wrote: > > "Oren Tirosh" wrote in message > news:mailman.1007298422.20078.python-list at python.org... > > I don't see what I could do with this that I couldn't do with the > '%' operator. > Someone help me out on this? > > John Roth Here's a copy of an older post of mine. It concerned another pep implementing the same idea with $ instead of ``. But the discussion is the same: --------------# begin paste Exactly my point. I think when I mentioned my need of inserting % in strange dynamic strings I inadvertedly set the discussion off-course. That was just a side comment, and by no means the meat of my point. My important point is that Ping's PEP allows a clear way of saying "x is $x, f(x) is $f(x)" This to me is readable, unambiguous and very useful. Currently we have a few options. Please keep in mind that this is really important only when the string and evaluations to handle grows dramatically in size and complexity. Think of 50 line strings with 100 complex expression evaluations embedded (and yes, things like that can happen fairly easily): 1) "x is %s, f(x) is %s" % (x,f(x)) Comment: this is very fragile and only works for a few %s. Beyond that it's asking for trouble. Plus visually parsing it is a pain, as you have to go back and forth between the string and the format tuple. 2) tmp = f(x) "x is %(x)s, f(x) is %(tmp)s" % locals() A little better than 1. But requires temporary variables. Again, for complex, long cases it gets fragile quickly. 3) class Eval: def __getitem__(self, key): return eval(key) "x is %(x), f(x) is %(f(x))s" % Eval() The best option, but the Eval trick, though very clever (when I saw it I immediately made a copy of it for future use), is quite deep 'black magic' for a language that prides itself on clarity. ------------ #end paste hope this helps, f From wzdd at lardcave.net Mon Dec 3 22:39:27 2001 From: wzdd at lardcave.net (Nicholas FitzRoy-Dale) Date: Tue, 4 Dec 2001 14:39:27 +1100 (EST) Subject: Regular expression as dictionary key? In-Reply-To: Message-ID: On 3 Dec, Martin von Loewis wrote: > Luke writes: > >> So you add a few lines to go exhaustively through the keys and >> accumulate matches... Still linear. I admitedly don't know much about >> the C implementation of dicts, but it seems there should be a way to >> leverage the dict's arrangement for fast regex keys. > > You mean, you can inspect every element of a set in sub-linear time? Ber. :) It's pretty easy to think of a data structure that could be used to provide the (very specific type of) regex search that he's after without inspecting every element of the set. It's just that Python dicts can't do this. :) -- - Nicholas FitzRoy-Dale http://www.lardcave.net Feel my three-toed wrath! - Catie From joshyotty at hotmail.com Wed Dec 26 23:27:22 2001 From: joshyotty at hotmail.com (Josh Yotty) Date: 26 Dec 2001 20:27:22 -0800 Subject: REPOST: Re: The Python community needs a lighter heart to it. References: <40dbad98.0112261431.3e928cf2@posting.google.com> Message-ID: <9$--$$-$$$$%%_%_$$@news.noc.cabal.int> pythonnet at hotmail.com (Andrew Nguyen) wrote in message news:<40dbad98.0112261431.3e928cf2 at posting.google.com>... > The python community is a bunch of people who can't take a joke. (Or > at least make one:)) You have got to be a) kidding b) lying or c) dense. Or maybe the humor doesn't make sense to you because you've never seen Monty Python before (Nudge, nudge). ...wake up and smell the dead parrot. > Also, usenet SUXXOR (sucks) because itttt issss > soooo cunfuseeeng... Ack! Moronic l337 5P34K! Do not poison my eyes! Shoo! Go play with QBasic! ...it's not that hard to use Usenet. > I bet you, that if we put a link on the python homepage with a link to > an EZBoard, python would be Much more popular. How does a $100 dollar bet sound? Seriously, though, Python is 'popular' right now. Imagine if the uninspired non-hacker programmers came and poisoned Python forever. ...the thought makes me want to vomit. > The most exciting topic > I have seen to date is 'Fun with Classess in Python 2.2'. Well, the newsgroup appears to have been more fun a couple years back. http://python.org/doc/Humor.html --Josh Yotty ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: joshyotty at hotmail.com (Josh Yotty) Newsgroups: comp.lang.python Subject: cmsg cancel <23302360.0112262027.4ff23468 at posting.google.com> Control: cancel <23302360.0112262027.4ff23468 at posting.google.com> Date: Mon, 31 Dec 2001 05:32:01 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775927 27193 211.57.49.2 (31 Dec 2001 05:18:47 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:18:47 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From ibmackey at hotmail.com Sun Dec 23 10:59:56 2001 From: ibmackey at hotmail.com (IBMackey) Date: 23 Dec 2001 09:59:56 -0600 Subject: vi or emacs for editing Python on Linux? References: <200112231119.fBNBJAJ02753@my.knctv.co.kr> Message-ID: <87sna253lv.fsf@hillcountry.net> Bas van Gils writes: > On Sun, Dec 23, 2001 at 08:19:56PM +0900, Jonathan Gardner wrote: > > Bottom line: You have to spend at least a week using both editors before you > > can make a good decision. > > I agree with Jonathan. I started of on linux/unix using pico, and moved > on towards vim, mainly because my co-workers used it. After a while I > tried using Emacs and found it a nice editor as well, after struggling > with the key-strokes :-) > I dabble a bit with python. But I spend a whole lot of time with editors. The closest I've found for ms users is nedit. The nedit manual is perhaps 50 pages long, but nedit does everything Emacs/Xemacs does. It's logical. Macros, recordable and programmable are easily mastered. I took a half day after reading the manual to setup an auctex-latex environment, lisp debugger and program cycle, python, python-docs, debug cycle. Nedit is also available for ms. BUT, and this is why I use xemacs, it doesn't have gnus. Not a problem for most ms people, but gnus is phenomenal. It automatically downloads mail and news, sorts it, plus scores with artificial intelligence your most read authors and subjects. It can kill with precision. If it wasn't for gnus, I would still use nedit... ib From use-net at schabi.de Wed Dec 5 05:15:42 2001 From: use-net at schabi.de (Markus Schaber) Date: Wed, 5 Dec 2001 11:15:42 +0100 Subject: 'ioctl ' call in python (serial port reading) References: <3C0C8FF3.7060500@beth.uniforum.org.za> <3C0CAE73.6060304@beth.uniforum.org.za> Message-ID: <20011205111542.5369dd87.use-net@schabi.de> Hi, On Tue, 04 Dec 2001 13:07:31 +0200 mixo wrote: > P.S I had to change > "i &=~ termios.TIOCM_RTS" to "i = (i) & ~TIOCM_RTS" It seems that you're using python 1.5.2. Maybe 2.1 is worth an upgrade. :-) > For one reason or another I don't "TIOxxxx" defined > in "termios" module,so I also had to define them > > #from /usr/include/asm/termios.h > TIOCMGET =0x5415 > TIOCMSET =0x5418 > TIOCM_RTS =0x004 Maybe you should contact the termios author about this, so this might be corrected in future versions? (or a new module with the termios.h constants added?) markus -- "GPL software is not free - the cost is cooperation" From ungrzr2 at ubatxbat.pbz Fri Dec 14 03:52:04 2001 From: ungrzr2 at ubatxbat.pbz ({-- Rot13 - Hateme) Date: 14 Dec 2001 08:52:04 GMT Subject: Wrap C function which takes variable lengthed parameters? References: <6p5j1u0oag2ofkam8o7fig5dvkfc2392hk@4ax.com> <3C19990E.BE0F3FA@alcyone.com> <3C19AC0B.7ABD04DF@xs4all.nl> <1gbj1u8pm1t63ao6bjq98jlh66glf78fnu@4ax.com> Message-ID: "{-- Rot13 - Hateme" wrote in news:Xns9177A9C5E8F6AYouAreNotMeYouKnow at 218.102.23.34: > Courageous wrote in > news:1gbj1u8pm1t63ao6bjq98jlh66glf78fnu at 4ax.com: > >=============================================== > char *IMGetIMValues(XIMS ims,...) > char *IMSetIMValues(XIMS ims,...) > > ims specifies the input method service. > ... specifies the variable length argument list to set > IMValues. > >============================================= > > I was thinking to pass a dictionary to the wrapper function > and the wrapper function will call IMSetIMValues() accordingly. > Since I cannot construct a va_list at the runtime, I don't > know how to call the IMSetIMValues(). > oh, I think I can change the C source to take single va_list arguement instead of a list of variable length arguements. But still I have no idea how to construct a list of arguements passed in from python. There are no standard function calls to create a va_list by handle. From vvainio at karhu.tp.spt.fi Wed Dec 12 02:37:16 2001 From: vvainio at karhu.tp.spt.fi (Ville Vainio) Date: 12 Dec 2001 09:37:16 +0200 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> Message-ID: Courageous writes: > But this is all academic, because the defacto and near dejure standard > for Python is 4 spaces per indentation level. Tabs are deprecated. Why don't issue a DeprecationWarning whenever tabs are found in the source file? That wouldn't "break" things, but it would surely motivate tab-using people to learn the right way of doing things. -- Ville Vainio - http://www.tp.spt.fi/~vvainio - ICQ #115524762 Wild geese have no intention to cast a reflection Water has no mind to assume their form From jslowery at hotmail.com Mon Dec 17 23:46:43 2001 From: jslowery at hotmail.com (Jeremy Lowery) Date: Mon, 17 Dec 2001 22:46:43 -0600 Subject: local variables in exec References: Message-ID: Yes, I saw the silly mistake after I had posted it. Always happens that way. Well, I agree that it is horrible, but it is the only way I've figured out how to create function objects from user code running in the app. I attempted to use new.function for a while but without any success. After getting the function name from analysis the source with the parser module, it doesn't seem too bad. Of course, the code I posted was a minimalistic example, excluding the rexec, bastions, etc.The client code is really stored in Method objects and compiled on the fly. Jeremy "Steve Holden" wrote in message news:DGnT7.7648$PA.6490 at atlpnn01.usenetserver.com... > "Jeremy Lowery" wrote ... > > a snipplet would be describe this. > > >>> x = 100 > > >>> def f(): > > ... print x > > ... > > >>> f() > > 100 > > >>> lns = {x: '4500'} > > >>> fc = 'def f(): print x' > > >>> bc = compile(fc, '', 'exec') > > >>> exec bc in lns > > >>> lns['f']() > > Traceback (most recent call last): > > File "", line 1, in ? > > File "", line 1, in f > > NameError: global name 'x' is not defined > > >>> > > > > why doesn't this work? > > Because you have stored 4500 in the lns dictionary under the key 100. Use > the variable name as a string and it works as you expect (but realise you > are doing things with a high horribleness quotient: while it is occasionally > necessary to descend to such depths, one should avoid it where possible). > > >>> lns = {"x": "4500"} > >>> fc = "def f(): print x" > >>> bc = compile(fc, "", "exec") > >>> exec bc in lns > >>> lns['f']() > 4500 > >>> > > regards > Steve > -- > http://www.holdenweb.com/ > > > > > From ykingma at accessforall.nl Sun Dec 16 06:36:49 2001 From: ykingma at accessforall.nl (Ype Kingma) Date: Sun, 16 Dec 2001 12:36:49 +0100 Subject: Recursive update of arbitrarily nested dicts References: <3C1B9E80.FB732387@accessforall.nl> Message-ID: <3C1C8748.EB44D9DD@accessforall.nl> maxm wrote: > > "Ype Kingma" wrote in message > news:3C1B9E80.FB732387 at accessforall.nl... > > > In this case there is only one smaller problem, and there is no > > solution to be assembled from the solutions to the smaller problem. > > (warning: untested code) > > > > def rUpdate(nestedDict, keys, value): # keys should be a tuple or a list > > firstKey, remainingKeys = keys[0], keys[1:] # divide the problem > > if len(remainingKeys) == 0: # non recursive case > > # Evt. raise an exception when nestedDict[firstKey] is a dict > > nestedDict[firstKey] = value # actual update. > > else: > > if not nestedDict.has_key[firstKey]: # make sure there is sub dict Should be: if not nestedDict.has_key(firstKey): # make sure there is sub dict > > nestedDict[firstKey] = {} > > rUpdate(nestedDict[firstKey], remainingKeys, value) # recurse on > smaller problem. > > whoa ... thats a pretty complex solution. I was hoping for something a bit > simpler ;-) The solution you give below is a bit more complex, although it does not show up in the number of lines of code. I never got the hang of setdefault(), so I basically coded it in full. Your solution needs a dictionary to update from, mine allows only a single key set. It also has a self argument, which I avoided. > > In fact I do belive that I have found it myself, after an hour of fun. ;-) > > def rUpdate(self, targetDict, itemDict): > for key, val in itemDict.items(): > if type(val) == type({}): > newTarget = targetDict.setdefault(key,{}) > self.rUpdate(newTarget, val) > else: > targetDict[key] = val > > I allways find it amusing that recursive functions in Python ends up so > relatively simple, even though I usually have a bit of a problem finding the > right solution. > In Python it is natural to avoid a lot of recursion by using a for loop instead. > I have read somewhere that thinking in pointers is something a programmer > either can or cannot do. I have no trouble with pointers. But perhaps it's > the same with recursion ... I don't know. I can usually find a solution, but > it often takes me far to long. I guess if I do it more I will get better at > it. Perhaps I should study some Lisp to get some more experience in it. > There's a nice overview here: http://www.cs.sfu.ca/~cameron/Teaching/384/99-3/recursion.html > Anyhoo ... Thanks for the answer. > My pleasure, Ype From dcinege at psychosis.com Sat Dec 22 00:24:44 2001 From: dcinege at psychosis.com (Dave Cinege) Date: Sat, 22 Dec 2001 00:24:44 -0500 Subject: Building C modules static to the interpreter? Message-ID: Before I try to think too hard on my own (dangerous) is there an easy way to build a static python interpreter that includes some of the C modules? I've got an embedded application I'd like to not require libc.so, (by compiling -static) but need some additional python modules like socket available directly in the interpreter. Dave -- The time is now 22:54 (Totalitarian) - http://www.ccops.org/ From mertz at gnosis.cx Fri Dec 21 19:53:27 2001 From: mertz at gnosis.cx (Lulu of the Lotus-Eaters) Date: Fri, 21 Dec 2001 19:53:27 -0500 Subject: age of new pythonistas (fwd) Message-ID: Me wrote: > Guessing the MA came right after a college degree, he was probably around 23 > in 1977. "Tim Peters" wrote: |Stuff and nonsense. I know for a fact that Guido recently had his first child. |Given the notorious and shameful lack of self-restraint among the Dutch, *I* |figure that proves he was about 13 years old approximately 10 months ago. Well... sure. But I only suggested how old he was in 1977. I didn't say anything about how old he was 10 months ago. Time-machines-are-tricky-ly yours, Lulu... From mkelly2002NOSPAM at earthlink.net Sun Dec 2 16:36:47 2001 From: mkelly2002NOSPAM at earthlink.net (Michael Kelly) Date: Sun, 02 Dec 2001 21:36:47 GMT Subject: inline functions or macros? References: <87667pz60e.fsf@dgp.toronto.edu> Message-ID: <5l7l0ug2e32l8h5393t5s4ulg3jc4mhsp1@4ax.com> On Sun, 02 Dec 2001 21:06:25 GMT, Maciej Kalisiak wrote: >I seem to recall reading that function calls in Python are somewhat >expensive. I come from a C++ background, and there this is usually >dealt with by defining frequently used small functions as 'inline'. >Is there something similar in Python? There's a "lamda" inline function definition mechanism but I'm new to Python so I don't know if it's run-time efficient or just a syntactic convenience yet. Mike -- "I don't want to belong to any club that would have me as a member." -- Groucho Marx From nikander at mindspring.nospamcom Tue Dec 25 12:43:44 2001 From: nikander at mindspring.nospamcom (Robert Nikander) Date: Tue, 25 Dec 2001 12:43:44 -0500 Subject: C++ throw causes abort in extension? Solved! References: <20011224.123518.378096161.2956@localhost.localdomain> <2ZKV7.13654$PO5.2163087@newsread1.prod.itd.earthlink.net> Message-ID: <20011225.124343.150236566.6777@localhost.localdomain> Chris Tavares" wrote: > In the Windows world, the solution is to compile main with a C++ > compiler, not a C compiler. No clue what to do under GCC/Linux, though. And Guido Goldstein wrote: > With the Python-2.2 comes a switch for configure which is named: > --with-cxx= Thanks guys, this advice has helped. The problem is completely solved! It turns out that the --with-cxx=g++ option doesn't do the right thing. It compiles the interpreter source file with g++ but _links_ the program using "gcc." I edited the makefile to link using g++ and now exceptions work in my extension modules. -Rob From gat at jpl.nasa.gov Sat Dec 1 02:25:34 2001 From: gat at jpl.nasa.gov (Erann Gat) Date: Fri, 30 Nov 2001 23:25:34 -0800 Subject: A modest indentation proposal References: Message-ID: In article , quinn at chunder.ugcs.caltech.edu (Quinn Dunkan) wrote: > If you want the OFMPM, it's basically like pindent.py. So I wasn't actually aware of the existence of pindent.py. Can it be easily rolled into an emacs mode? > If that's not enough, and you think there needs to be a fundamental change to > the language syntax, No, I'm not asking for a fundamental change to the language syntax. I'm asking for the functionality of pindent.py to be packaged up as an emacs mode, and for the parser to warn me when there's a discrepancy between the indentation that pindent.py would produce and what's actually in the file. I'm also asking that "# end for" be spelled ";". That's all. > Did you manage to convince the lispers that the compilers should support an > optional ()-less infix syntax to make your boss happy? They'd probably say > "so write a read macro" :) It turns out that what made the bosses unhappy about Lisp was not the syntax but the fact that no one uses it. And before you protest and tell me that it's not true that no one uses Lisp, yes, I *know* it's not true. I also know that indentation is not much of a problem in practice. E. From tim at vegeta.ath.cx Thu Dec 13 06:18:30 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Thu, 13 Dec 2001 11:18:30 GMT Subject: lost interest? References: <20011208001123.A5989@casa.parque> <3C14FEBD.AD52B516@attbi.com> <7xn10oz330.fsf@ruckus.brouhaha.com> Message-ID: Paul Rubin graced us by uttering: > Chris Barker writes: >> A big problem I have seen is people not wanting to use exactly the >> module they really nedd because it is "not part of the standard >> distirubion". If it was a whole lot easier to find, get and install >> third-party packages, perhaps this concern would go away. > > No, not really. It's annoying to to have to install any 3rd party > package no matter how easy it is, plus it's a security risk. I try to > avoid depending on any 3rd party modules if I possibly can. I really > dislike the way so many Perl applications depend on CPAN stuff. One > of Python's selling points is "batteries included", which means NOT > having to depend on 3rd party modules. Please to read following quote: You're quite free to convert your strings to byte arrays and do the entire pattern tree by hand in pure logic code if you'd like. By the time you finish most of the rest of us will be doing contract work on Mars. -- Zenin, comp.lang.perl.misc CPAN is so large because there are thousands of Perlers who've logged literally hundreds and thousands of hours working on robust, quality modules. To completely disregard this kind of selfless, tireless effort and stick to "standard" modules is exactly the kind of foolishness the above quote refers to. The same could be said of Parnassus. Python and Perl both have an enormous amount of functionality "out of the box", but there are no batteries in the world that can tackle _ANY_ kind of task. Tim Hammerquist -- : Why Bible quotes exclusively? What happened to the Eastern religions? I'm still working on the Unicode mods. -- Larry Wall in <199807021924.MAA05380 at wall.org> From aleax at aleax.it Fri Dec 28 12:06:23 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 18:06:23 +0100 Subject: Wine applicability (was: Python Popularity: Questions and Comments) References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9901.998345FB@earthlink.net> <200112281405.IAA20884@starbase.neosoft.com> <200112281642.KAA24897@starbase.neosoft.com> Message-ID: "Cameron Laird" wrote in message news:200112281642.KAA24897 at starbase.neosoft.com... ... > >that's my primary need -- Word with O'Reilly customized macros &c, > >as that's what I'm required to use for one of the books. So, I > O'REILLY MAKES YOU USE WORD MACROS?!??!!? > I've got to talk with those boys. That > strikes me as an atrocity. "makes" is probably an overbid. The Cookbook I'm doing in XML with a custom DTD, and that's just fine - I get to use VIM:-). But for the Nutshell, that wasn't an option. > >did not try Wine extensively on other tasks. I did try VMWare (a > >beta) and found it somewhat clunky, ponderous, and slow, although > >maybe that was its beta nature; anyway, I wasn't motivated to plunk > >down several hundred dollars for the final version to find out. > I have acquaintances who swear by VMWare. So do I, and it was on their hearty recommendation that I gave that beta a good try. If the problems are indeed all related to it BEING a beta, then VMWare's producers had better make some sort of time-limited try-it-out or something like that, without the speed and resource-consumption problems -- I think my machine is adequate (Athlon 1.2 GHz, 256 M DDRAM PC2100), yet I was not happy with interactive performance (Word '97 subjectively running worse than on my ultralight laptop, which has a Pentium III-600 and just 64 MB of slower RAM -- I tried the two MS OS's for which I have licenses, Win98 and NT/4; maybe Win/2K and/or Office/2K work better with VMWare, but I'm not going to splurge for those in addition to VMWare itself -- that's running to well over 1K euros for something a few tens of euros for win4lin, plus my already-paid-for Win98 and Office97 licenses, already give me quite satisfactorily). > >some files with the Windows Media Player. I do get occasional > >"crashes" (of the simulated Win98 environments), but roughly as > >often as a real Win98 crashes under similar usage, so I don't > >think that's win4lin's fault. > Interesting testimony. Thanks. You're welcome! Alex From MarkH at ActiveState.com Tue Dec 11 23:39:14 2001 From: MarkH at ActiveState.com (Mark Hammond) Date: Wed, 12 Dec 2001 04:39:14 GMT Subject: win32service win32pipe question References: <93wR7.6168$Rw2.4468272@newssrv26.news.prodigy.com> <3C1695A2.30103@ActiveState.com> Message-ID: <3C16E00E.6040905@ActiveState.com> dsavitsk wrote: > when i try to stop the version i downloaded, however, the stop command only > sort of works. when issued, the service hangs for about 30 seconds, then > responds ... > > Stopping service PythonPipeService > Error stopping service: The service did not respond to the start or control > requ > est in a timely fashion. (1053) > > it does stop, though. > > is this something to worry about? Probably :) It should stop cleanly. My guess is an exception in the shutdown processing. Check the Windows Event Log and see if an exception has been reported. Or try running the service in debug mode (as per the book) and see if any exceptions are reported to the console. Mark. From jjl at pobox.com Mon Dec 17 13:06:13 2001 From: jjl at pobox.com (John J. Lee) Date: Mon, 17 Dec 2001 18:06:13 +0000 Subject: Update Oreilly books? In-Reply-To: References: <9vkiln$61d$1@mozo.cc.purdue.edu> <20011217125507.C6285@poff.miazine.net> Message-ID: On Mon, 17 Dec 2001, Gerhard H?ring wrote: > Le 17/12/01 ? 12:55, Kirill Miazine ?crivit: [...] > What I can recommend for an advanced Python programmer is "Python > Essential Reference" 2nd ed. from David M. Beazley. The only things that the standard Python documentation doesn't cover well (that come to mind) are writing extensions, and distutils. Does this have anything useful on those? I presume yes and no, respectively? John From rdsteph at earthlink.net Mon Dec 31 13:46:16 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Mon, 31 Dec 2001 18:46:16 GMT Subject: Cancel flood (was Re: REPOST: Re: Python Popularity: Questions and Comments) References: <3C2A9D33.67FEC261@earthlink.net> <2$--$$_----_-%$%%$@news.noc.cabal.int> Message-ID: <3C30B399.DB1AAB5F@earthlink.net> Aieee, what caused all this ungodly flood of REPOSTS? It messes up the newsgroup. I don't even know how they are caused. Is there a way to stop them or even eliminate tem (kill file I guess ???) From chris.gonnerman at newcenturycomputers.net Sat Dec 29 10:55:46 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Sat, 29 Dec 2001 09:55:46 -0600 Subject: posting the code - further to odd problem References: <20011229083348.GA1244@dave@isetroc.com> Message-ID: <00ab01c19081$493251e0$0101010a@local> ----- Original Message ----- From: "Dave Harrison" > However the packet class code is as follows : > > import string > pdic = {} What is the purpose of the above line? > class Packet: > def __init__(self, info): > self.buildDic(info) > > def buildDic(self, info): > for item in info: > split = string.split(item,"=") > if (len(split) > 1): > pdic[split[0]] = split[1] > > def getVal(self, key): > if pdic.has_key(key): > result = pdic[key] > else: > result = '' > return result Here all instances use the global pdic. This appears to be an error to me. Try this: import string class Packet: def __init__(self, info): self.pdic = {} self.buildDic(info) def buildDic(self, info): for item in info: split = string.split(item,"=") if (len(split) > 1): self.pdic[split[0]] = split[1] def getVal(self, key): if self.pdic.has_key(key): result = self.pdic[key] else: result = '' return result From edcjones at erols.com Mon Dec 24 09:48:46 2001 From: edcjones at erols.com (Edward C. Jones) Date: Mon, 24 Dec 2001 09:48:46 -0500 Subject: f(n=4) works; bug or feature? References: <3C26B3DA.4000102@erols.com> Message-ID: <3C27404E.8030601@erols.com> Aahz Maruch wrote: > In article <3C26B3DA.4000102 at erols.com>, > Edward C. Jones wrote: > >>In Python 2.2, the following code prints a "4". >> >>def fun(n): >> print n >> >>fun(n=4) >> >>Bug or feature? >> > > Feature. You're using the ability of Python to define keyword arguments > to functions. > Embarrassment. In this minimal context, it looked like an assignment. From martin.kuchlmayr at abri.une.edu.au Thu Dec 13 21:57:02 2001 From: martin.kuchlmayr at abri.une.edu.au (DoggyKennel) Date: Fri, 14 Dec 2001 02:57:02 GMT Subject: Python beginner: Downloading a pdf file from a web server on VMS. Message-ID: <3c1964a5.352410439@129.180.1.4> I am asking this as much to get an idea of what Python is capable of and how one goes about things in python rather than just solving the problem. So any replies about how I should go about it, or if I have the wrong idea, would be appreciated. Basically I want to download a pdf file from a web server and print it. So I would need a http class that is given a URL and can return whatever is returned from that URL. Does such a class exist? Would such a class return the docuemnt as a file handle. The second part of this is that I would like to do this under VMS. I am hoping that if a "http" class as I have described above exists and that it would be built on top of a socket class and could be ported to any python environment that has a socket class. And that a socket class is a part of standard python and has been ported to any environment that python has been ported to. Is that right? I beleive python has been ported to VMS? Any advice on how to search for this info would also be appreciated. I would also be interested in any introduction to Python. I have looked for this before and the consenus seems to be the tutorials referenced in python.org. I didn't really find much else. Is there anything else? Does anyone know of good overview of Python - things like what it can do. If everything can be compiled. How portable it is? Any help gratefully received, Martin From aahz at panix.com Fri Dec 21 01:19:17 2001 From: aahz at panix.com (Aahz Maruch) Date: 20 Dec 2001 22:19:17 -0800 Subject: threading.py -> winthreading.c : Call for benchmark code References: Message-ID: <9vuk95$3l$1@panix3.panix.com> In article , Jason Orendorff wrote: > >[Technical note: I discovered something neat. Everything I do, >or check, or set, or increment in C code is protected by the global >interpreter lock. This eliminates a lot of the complexity of writing >good threading code, because I don't have to worry about doing >anything atomically! I can avoid functions like InterlockedIncrement() >and InterlockedExchange(). The resulting code is clearer and faster.] Well, sort of. Problem is, if you're not careful to release the GIL at the right moment, you get a deadlock when you can't acquire a lock. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 11 days and counting From maxm at mxm.dk Sun Dec 30 05:18:56 2001 From: maxm at mxm.dk (maxm) Date: Sun, 30 Dec 2001 11:18:56 +0100 Subject: Video Programming References: <3C2E89DD.F3304EA9@earthlink.net> Message-ID: "Ron Stephens" wrote in message news:3C2E89DD.F3304EA9 at earthlink.net... > Please forgive me for this rambling post, but there it is, food for > thought, or for speculation, or for...??? You are certainly not the first to think of this. The problem is that graphics takes up too much screen estate. Also it is hard to make meaningfull metaphors and icons on a large system. Imagine if your windowed computer only had icons and no text. It would be extremely hard to navigate it, and find a specific piece of data. On the other hand it would not be a problem to navigate a windowed computer with no icons, but only words. It sort of the same problem one has when designing websites. Those icons and small graphics snippets gives a feel, and can enhance memory, but the words are what is really important. Zooming in and out of 3D graphics is also a nice idea, but actually it is allready implemented in Python. It's called function and classes, which does essentially the same thing. Imagine how an object oriented databse would look on screen in 3D graphics. And then compare with: odb = Odb() # pretty simple representation after all isn't it? Also the number of errors rises exponentially with the amount of logic outside the visible screen area. this would be a problem when graphics takes up much more screen estate than text. A language like Python is actually pretty effecient in conveying it's meaning and logic. A graphical interface shines in small specialized domains like image-processing, layout, text-processiing etc. Not in general programming. No I believe what is needed is a better programming enviroment or ide if you please. It should teach you the language while using it, and it should make it easy to make self documenting code. Now that would be a great new invention! regards Max M From jeff at ccvcorp.com Mon Dec 10 13:50:51 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Mon, 10 Dec 2001 10:50:51 -0800 Subject: questions about of writing python scripts References: Message-ID: <3C15040A.F19949B3@ccvcorp.com> ed wrote: > Hi I have a question regarding writing python scripts.. > for large program written i python,, One thing i notice is it needs to > run to the specifc piece of code i order to detect error. let's say > the valaue is assigned to a wrong variables, I cannot know in advance, > > ............. > > but c is floating and has not value and a got assgined to it. ... in > other compiation lang, this type of error will be caught in > compilaiton time, but I can't using python.. is ther any utility or > way to catch this type of error way ahead? > thankx PyChecker may catch some (or most) of this sort of error for you, but in general, the way to catch this sort of error is to test your code. You need to test the code anyhow--compilers can catch some errors, but not logic/algorithm errors, so the fact that your code compiles does not make it "right". (Although many people seem to think it does... a problem in and of itself.) If you test your code even marginally, you're almost guaranteed to find that sort of assignment error. To many people it seems wrong to "wait until runtime" to find these errors, but really, you'll be able to write, test, and correct a Python program faster than you'd be able to get to the point of even *trying* to compile a C++ program... Just remember that compile-time checks vs run-time checks is a cultural issue; statically-typed languages have a culture that strongly favors compile-time, while dynamic languages have a culture favoring run-time. Jeff Shannon Technician/Programmer Credit International From dav-nospam-id at westco-nospam-ntrol.com Tue Dec 4 03:35:44 2001 From: dav-nospam-id at westco-nospam-ntrol.com (David Brown) Date: Tue, 4 Dec 2001 09:35:44 +0100 Subject: Printing from Windows Message-ID: <9ui1ki$lfv$1@news.netpower.no> It doesn't look like there is much hope for using Tkinter for printing, so I'm generalising my original question. Are there any good ways to make a printout from a Python program? I'll be running mostly on Windows, but I'd much prefer a cross-platform solution for later migration to Linux. Sure, I could use the Win32 api directly - but that is the sort of thing I am trying to avoid with Python + Tkinter. There must surely be thousands of developers out there with the same problem. Any hints or ideas would be much appreciated. From greg at cosc.canterbury.ac.nz Mon Dec 3 23:48:40 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Tue, 04 Dec 2001 17:48:40 +1300 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <3C0BE492.5DACEA18@mega-nerd.com> Message-ID: <3C0C55A8.EAD03FD5@cosc.canterbury.ac.nz> Steve Lamb wrote: > > some_dict = {'Jane':{'Age':'21', 'Dept':'0001', 'Ext':'1234'}, > 'John':{'Age':'22', 'Dept':'0010', 'Ext':'5678'}, > 'Jeff':{'Age':'23', 'Dept':'0100', 'Ext':'9009'}, > 'Jody':{'Age':'24', 'Dept':'1000', 'Ext':'8765'}, > 'Jeny':{'Age':'25', 'Dept':'0110', 'Ext':'4321'} > } > > You get it yet? You finally understand that preference SCREWS UP THE > INTENT AND READABILITY OF THE ABOVE EXAMPLE WHICH IS NOT ALL THAT UNCOMMON? > Yeesh. 3 days now and you still haven't address that real and valid concern! This concern *has* been addressed, by suggesting the above be written as some_dict = { 'Jane':{'Age':'21', 'Dept':'0001', 'Ext':'1234'}, 'John':{'Age':'22', 'Dept':'0010', 'Ext':'5678'}, 'Jeff':{'Age':'23', 'Dept':'0100', 'Ext':'9009'}, 'Jody':{'Age':'24', 'Dept':'1000', 'Ext':'8765'}, 'Jeny':{'Age':'25', 'Dept':'0110', 'Ext':'4321'} } Also, there seems to be some confusion in this discussion about two quite different kinds of formatting: Python block-indentation on the one hand, and cosmetic lining-up on the other. People arguing in favour of tabs are talking only about the former, not the latter. If you need to do cosmetic lining-up, the best thing is to use whatever your current convention is for block indentation up to the syntactic level of the statement, and then use spaces-only after that. It still won't work if viewed with a proportional font, but it's the best that can be done using plain ASCII. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From russell_turpin at hotmail.com Tue Dec 4 12:34:12 2001 From: russell_turpin at hotmail.com (Russell Turpin) Date: 4 Dec 2001 09:34:12 -0800 Subject: Embedding Python in C++ application: Question #1 References: <8a12e538.0112031616.674f37e8@posting.google.com> <3C0C3B3E.9030302@ActiveState.com> Message-ID: <8a12e538.0112040934.17df3790@posting.google.com> Mark Hammond wrote in message news:<3C0C3B3E.9030302 at ActiveState.com>... > Py_BuildValue is a convenience function. OK. I'm finding the relevant interfaces in Python/C API. Do I read this right, that all new objects are created with a refcount of 1 , so that a called function can pass them to the caller without ref-count manipulation? Thus, I can call PyList_New() to create the list that will be returned to the calling Python procedure, iteratively pass the results of PyTuple_New() directly to PyList_SetItem(), which "steals" the reference to the tuple, and then return the list, all without a single INCREF or DECREF? Which, of course, is the way it *ought* to work, and that seems to be what it says .. Russell From doug at hellfly.net Sun Dec 30 08:26:48 2001 From: doug at hellfly.net (Doug Hellmann) Date: Sun, 30 Dec 2001 08:26:48 -0500 Subject: ANN: HappyDoc 2.0 Message-ID: <200112301326.IAA13679@branagan.hellfly.net> Announcing the latest version of HappyDoc, a Python documentation extraction tool. HappyDoc is a tool for extracting documentation from Python source code. It differs from other such applications by the fact that it uses the parse tree for a module to derive the information used in its output, rather that importing the module directly. This allows the user to generate documentation for modules which need special context to be imported. More details are available on the HappyDoc home page at http://happydoc.sourceforge.net. !!! NOTICE !!! Before installing HappyDoc 2.0+, any version earlier than 2.0 must be removed. This includes the file 'happydoc.pth' and directory 'happydoc' in site-packages, as well as the executable 'happydoc' in the 'bin' directory. Version 2.0 -- - **New Features** - Rearranged much of the code base to create 'happydoclib' package. This package protects the namespace for HappyDoc related code, and makes it easier to reuse HappyDoc components in other projects. - Package descriptions can now come from the docstring of the '__init__.py' module, instead of always having to be in a README file. - **Bug Fixes** - Fixed a problem with the HTMLTable formatter that caused pages to look odd in browsers which don't handle width attributes the same way as Netscape. - Upgraded to newer version of StructuredText package from Zope CVS, resolving several rendering issues for the HTML formatter. - **Other Changes** - Changed command line argument handling to use '-' character in names in addtition to underscore. That is, defining an optionHandler_long_opt will allow the app to accept '--long-opt' or '--long_opt'. The help text uses the '-' form, but both are allowed on the command line for backwards compatability. - Updated test cases to streamline regression testing. - Rearranged some of the documentation from the root 'README.txt' into sub-packages. Download Download the latest version of HappyDoc from the home page on SourceForge: http://sourceforge.net/projects/happydoc From robin at jessikat.fsnet.co.uk Mon Dec 3 11:03:17 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Mon, 3 Dec 2001 16:03:17 +0000 Subject: ANN: Pyro 2.2 is available References: Message-ID: In article , Irmen de Jong writes >You can get the latest Pyro version (2.2) at http://pyro.sourceforge.net > >What is Pyro? >Pyro is an acronym for PYthon Remote Objects. It is a basic Distributed > Object Technology system written entirely in Python. > >It is extremely easy to implement a distributed system with Pyro, because >all network communication code is abstracted and hidden from >your application. You just get a remote Python object and invoke methods >on the object on the other machine. > >Pyro offers you a Name Server, an Event Service, mobile objects, remote >exceptions, dynamic proxies, remote attribute access, automatic >reconnection, a detailed manual, and many examples to get you started >right away. > >Irmen de Jong and it works :) -- Robin Becker From nospam at mega-nerd.com Mon Dec 3 15:46:10 2001 From: nospam at mega-nerd.com (Erik de Castro Lopo) Date: Mon, 03 Dec 2001 20:46:10 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: <3C0BE492.5DACEA18@mega-nerd.com> Steve Lamb wrote: > > On Sat, 01 Dec 2001 23:14:04 -0000, Lee Harr wrote: > > > > If using tab can cause trouble when moving source files from one > > editor to another (or one person's configuration of an editor to > > another) why not just get rid of using tab for indentation > > altogether? > > > > You'll not find tabs in any code that I touch. Literally. I've got my > editor configured to save spaces, not tabs. You really ought to try using nothing but tabs for indentation and setting the tab width in your editor to whatever you prefer. This is so easy and works **SO** well. Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam at mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ "I would rather spend 10 hours reading someone else's source code than 10 minutes listening to Musak waiting for technical support which isn't." - Dr. Greg Wettstein, Roger Maris Cancer Center From Bruce at EckelObjects.com Sat Dec 8 22:03:12 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Sat, 08 Dec 2001 19:03:12 -0800 Subject: Does 'super' exist? Message-ID: <200112081903120380.0289A8A4@mail.rdc1.sdca.home.com> It's a little hard to tell, does 'super' exist in 2.2? If so, where might I find the syntax? Thanks. Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From m.bless at gmx.de Sun Dec 30 18:52:36 2001 From: m.bless at gmx.de (Martin Bless) Date: Sun, 30 Dec 2001 23:52:36 GMT Subject: REPOST: Re: Manipulating Win32 attributes; newbie question. References: Message-ID: <4$--$$_----__$-__$@news.noc.cabal.int> [Peter ]: >My problem is that I need to manipulate some Win32 specific file >attributes. Here's the route I'm exploring to address the same issue: if 1: import win32file print win32file.FILE_ALL_ACCESS print win32file.FILE_ATTRIBUTE_ARCHIVE print win32file.FILE_ATTRIBUTE_COMPRESSED print win32file.FILE_ATTRIBUTE_HIDDEN print win32file.FILE_ATTRIBUTE_NORMAL print win32file.FILE_ATTRIBUTE_OFFLINE print win32file.FILE_ATTRIBUTE_READONLY print win32file.FILE_ATTRIBUTE_SYSTEM print win32file.FILE_ATTRIBUTE_TEMPORARY fattr = win32file.GetFileAttributes( fname) print win32file.SetFileAttributes( fname, fattr ^ win32file.FILE_ATTRIBUTE_READONLY) # & and # | or # ^ xor # - # + # ~ invert = -(x+1) # reset readonly bit fattr = fattr & (win32file.FILE_ATTRIBUTE_READONLY ^ -1) Martin ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: m.bless at gmx.de (Martin Bless) Newsgroups: comp.lang.python Subject: cmsg cancel <3c2fa7ac.4031975 at news.muenster.de> Control: cancel <3c2fa7ac.4031975 at news.muenster.de> Date: Mon, 31 Dec 2001 04:29:19 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774016 27193 211.57.49.2 (31 Dec 2001 04:46:56 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:46:56 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jkraska at san.rr.com Fri Dec 28 19:17:59 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 29 Dec 2001 00:17:59 GMT Subject: REPOST: Re: Python on the desktop References: <94e3fce8.0112210053.2568529d@posting.google.com> <3C238618.9F54E5CA@attbi.com> Message-ID: <9$--$$_-----$$$-$$@news.noc.cabal.int> >See? It's still not working... why would someone deliberately misspell >something? Well, see, hegemoney is a play on words see. On one hand, you have hegemony. On the other, you have money. Together, you get hegemoney. This would make the comment a jab at Microsoft, see? :) ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!newspeer.cwnet.com!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Courageous Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:08:29 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774955 27193 211.57.49.2 (31 Dec 2001 05:02:35 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:02:35 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From ullrich at math.okstate.edu Tue Dec 4 13:23:54 2001 From: ullrich at math.okstate.edu (David C. Ullrich) Date: Tue, 04 Dec 2001 18:23:54 GMT Subject: Do 2.2 and 2.1.1coexist well? References: Message-ID: <3c0d12a6.339627816@news> On Mon, 3 Dec 2001 14:32:37 -0500, "Tim Peters" wrote: >[David C. Ullrich, about Python on Windows] >> I've been meaning to ask about this, didn't want to sound stupid: > >I've meaning to answer this, but likewise didn't want to sound stupid. Just append something about floating point or better yet indentation... you always sound like a smart guy when you talk about that stuff. >> ... >> File associations is no problem - people who enjoy such things can >> have great fun arranging trick ways to send a .py file to various >> different python.exe's (adding various shell commands, and/or >> associating .py with something that reads the first line of the >> file for the name of the executable as in UNIX...) >> ... >> But Python itself seems to use the registry, for example it appears >> that that's where it reads PYTHONPATH from. > >It's complicated. You can read the comments at the start of PC\getpathp.c, Nope, don't know any C... >and I know of know way to summarize that usefully. In fact, Python on >Windows normally never reads the registry for anything, Fabulous. This business of programs that aren't smart enough to run themselves has always seemed stupid. (The install just writes stuff to the registry for the sheer thrill of it, eh?) > not even for >PYTHONPATH. You can verify that by changing the PYTHONPATH in your >registry, and then noting that sys.path doesn't change as a result. The >PYTHONPATH in the registry is a backup in case all other attempts to locate >Python's home directory fail (which can happen if, e.g., Python components >are invoked via COM by some other app). Oh. >(OTOH, it could be the rules have >changed since the ancient version of Python you're still torturing yourself >with .) Well, it still works... >> So sissys like me get nervous installing a new version if we hope to >> keep the old one... Right now it looks like all the Python stuff is >> under HKEY_LOCAL_MACHINE/Software/Python/PythonCore/1.5. Presumably >> if a person installed 2.x that would appear under PythonCore/2.x >> without making any changes to PythonCore/1.5? > >Yes, although, as above, these registry entries normally aren't used. Thanks. Oh boy, 2.x. David C. Ullrich From sholden at holdenweb.com Fri Dec 21 12:12:12 2001 From: sholden at holdenweb.com (Steve Holden) Date: Fri, 21 Dec 2001 12:12:12 -0500 Subject: Mild bug: pipermail/python-dev References: Message-ID: <96KU7.34098$pc4.1509@atlpnn01.usenetserver.com> "Terry Reedy" wrote in message news:wlJU7.322334$5A3.123903839 at news1.rdc2.pa.home.com... > This page > http://mail.python.org/pipermail/python-dev/ > has a link to an archive for a message mis-dated (one hopes) February > 2005! > > Seems like mild bug somewhere but I have no idea where or where to > report. > Not at all. You will notice that the posting come from the effbot and concerns ParadoxErrors, a feature that will not be introduced into the language for another couple of years. So the software is simply indexing mail correctly, albeit somewhat in advance. /F was attempting to ensure that future functionality wasn't compromised by early access via this newsgroup. [This is what happens when people (and bots) borrow the time machine when Guido isn't looking. Can someone in python-dev please reprogram the effbot to raise a TorturedTachyon exception next time it tries this? This would be caught by the MoveForward() method of the time machine and handled appropriately, and hopefully rather painfully for the offender.] Since you have now brought this whole messy situation to the attention of all c.l.py readers, you should clearly be prepared to explain your behavior. In your shoes I'd be expecting a visit from the PS From mike at spam.block.primeval.demon.co.uk Sun Dec 23 12:18:39 2001 From: mike at spam.block.primeval.demon.co.uk (Michael Thompson) Date: Sun, 23 Dec 2001 17:18:39 -0000 Subject: vi or emacs for editing Python on Linux? References: Message-ID: <1009127729.9271.0.nnrp-12.c2de51d8@news.demon.co.uk> Hi, I don't think the 'learn vi as it is everywhere' argument to be bogus. If you work in a large company and support UNIX machines scattered all over the world then the availability of vi is something you can depend on. Furthermore it is a powerful efficient editor and works well over slow network connections! Obviously one can configure their own personal workstation to their own tastes. Reconfiguring company or even customer machines usually isn't an option! Regards, Mike Thompson "Steve Lamb" wrote in message news:slrna27sdn.5ek.grey at teleute.dmiyu.org... > I know this is a large quote but the context is needed. The problem with > this suggestion is, as you said, you need your bindings. Now I'm not going to > pull the typical "learn vi since it is everywhere" schtick. I found it bogus > when it was spit in my face and I most certainly will not fire it off against > anyone else. No, what I want to do is tell my path on getting to vim. What > is important is the path, not the final destination. > > [snipped] From thomas.sturm at alcatel.de Mon Dec 3 07:17:31 2001 From: thomas.sturm at alcatel.de (Thomas Sturm) Date: Mon, 03 Dec 2001 13:17:31 +0100 Subject: findbug Message-ID: <3C0B6D5B.AC819723@alcatel.de> Hallo Uwe, es gibt eine DDTS Einstellung, die den "Read Access" einschraenkt. Ich habe sie herausgenommen: sturm at slbh88 (~) 56> findbug -ANO -u krutschi | bugval Identifier Headline SLBtb01034 HW description for VMS machine SLBtb01037 Code review of proc-sw sturm at slbh88 (~) 57> -- Thomas Sturm ALCATEL SEL Berlin ALCA-Tel. 2520 3731 Colditzstrasse 34-36 Tel. +49 30 7002 3731 D 12099 Berlin, Germany From eddie at holyrood.ed.ac.uk Mon Dec 3 07:34:11 2001 From: eddie at holyrood.ed.ac.uk (Eddie Corns) Date: Mon, 3 Dec 2001 12:34:11 +0000 (UTC) Subject: How to compare text? References: Message-ID: <9ufrg3$sub$1@scotsman.ed.ac.uk> "A" writes: >Hello, >How can I compare of one parragraph of text with another >paragraph?Each paragraph can have about 100 words. >For example I have the first paragraph >I want to be very good at Python programming. Better than in Perl. >THe second paragraph might look loke this: >She works all day long to master Perl. >All that I need is to find out if any of word from the second is in the >first paragraph. For the example above I should find out word >Perl >What is the best and quickest way? Depends a lot on how fussy you are but here's a possible starting point. [a for a in re.split(r'\W*',para1) if a in re.split(r'\W*',para2)][:-1] --> ['to', 'Perl'] Makes some assumptions about how paragraphs are formatted. Eddie From roy at panix.com Fri Dec 28 09:40:21 2001 From: roy at panix.com (Roy Smith) Date: Fri, 28 Dec 2001 09:40:21 -0500 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: <7$--$$_-----$%$$_$@news.noc.cabal.int> tatebll at aol.com (Bill Tate) wrote: > This past spring, I spent a full month pouring over Zope in detail. I > pulled every example product I could find that I thought would be > relative to the purpose of setting up a commercial-based application. > I downloaded the tutorial and the draft zope book. I pulled down > every bit of documentation I could find for developers. In so many > cases, I found whatever documentation was available that key aspects > of the implementation took the "assumed facts-already-in-evidence" > approach; omitting key details that would were critical to improving > my understanding of using Zope. Unfortunately, I have to agree. I've looked at Zope a few times, because the hype sounded really cool (as all good hype should). But, every time I ever tried to understand it to the level of, "OK, so how do I actually write an application using this", I was stumped. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Roy Smith Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:27:51 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775378 27193 211.57.49.2 (31 Dec 2001 05:09:38 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:09:38 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From borcis at geneva-link.ch Sat Dec 29 20:05:58 2001 From: borcis at geneva-link.ch (Boris Borcic) Date: Sun, 30 Dec 2001 02:05:58 +0100 Subject: Python and Ruby: a comparison References: <3C2B9A61.EE1618DB@earthlink.net> <2WpX7.1145$0s5.714029@news20> Message-ID: <3C2E6876.4CBF45D4@geneva-link.ch> Conrad Schneiker wrote: > > So my question is: at such a presently entirely hypothetical future > juncture, is there any practical and desirable middle ground for a common > single successor language to the current generations of Python and Ruby? What would be fun is to have library interoperability completed with interlingual source-to-source conversion from adequately constrained style... premitting more or less, to use one's language superficial idioms to mean corresponding idioms in the other language. Could even dream this evolve to "truly robust" programming (against the risk of expertise disappearance);-) dream... we'd have a standard of coding, requiring two equivalent sources, in different languages... with components interoperable and inter-substitutable; the sync being mechanically maintained - the main point, would be to be able to retort, to the question : "what's the source language of the code", "there's no piece of code, that has a single source language, programmers from both communities can take over the code, in their own language". I guess what I mean to say, exactly, is that the weakest form for an analogue to a "middle ground for a single successor language" might be not a single successor language, but a pair of parallel subsets of each language that can be automatically translated source-to-source while preserving a smack of idiomatical expression. BB From loewis at informatik.hu-berlin.de Thu Dec 6 06:08:47 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 06 Dec 2001 12:08:47 +0100 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: "Tim Peters" writes: > > One solution that has been proposed long ago (and many time since) is > > end-block keywords like shell. > Yup, that works. I'll add > > from __future__ import shell > > to 2.2 if it will stop this discussion . ROTFL From eeskoe at yahoo.com Sun Dec 16 15:54:33 2001 From: eeskoe at yahoo.com (Erika Skoe) Date: Sun, 16 Dec 2001 14:54:33 -0600 Subject: dictionary viewer Message-ID: <9vj1db$fpa$1@news.doit.wisc.edu> are there any tools for viewing a dictionary and its contents in some formatted form? i have pickled dictionaries which are made of several layers of nested dictionaries, and would like a way to view the whole thing at once. From peter at engcorp.com Tue Dec 4 00:09:51 2001 From: peter at engcorp.com (Peter Hansen) Date: Tue, 04 Dec 2001 00:09:51 -0500 Subject: D-H, buffered socket and ssh wrapper modules in pure python References: <9ugne1$7ot$1@news.service.uci.edu> <3C0C56BC.DEEFF2C2@engcorp.com> Message-ID: <3C0C5A9F.22343B51@engcorp.com> Peter Hansen wrote: [deleted] Ooops. Sorry, meant to send that one directly by email. :-( From josegomez at gmx.net Tue Dec 4 08:58:29 2001 From: josegomez at gmx.net (josegomez at gmx.net) Date: Tue, 4 Dec 2001 13:58:29 +0000 (UTC) Subject: Python, Glade and portability? References: <9ug2da$dqd$1@hermes.shef.ac.uk> <9uh6ai$mcc$1@nntp6.u.washington.edu> Message-ID: <9uikq5$cvi$1@hermes.shef.ac.uk> Frank Miles wrote: > In article <9ug2da$dqd$1 at hermes.shef.ac.uk>, wrote: > Is there some reason why the Windows ports of libglade et al. won't work > for you? (Granted, getting all the right pieces to work together can be > a challenge)... That was a very good suggestion. In fact, there seems to be a port of libglade to Win32! I had never heard of it, but it seems to be available. Hans Breuer has worked on many a port, and among them, pygtk and libglade: Cheers, Jos? -- Jos? L G?mez Dans PhD student Tel: +44 114 222 5582 Radar & Communications Group FAX; +44 870 132 2990 Department of Electronic Engineering University of Sheffield UK From philh at comuno.freeserve.co.uk Tue Dec 4 09:57:01 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Tue, 4 Dec 2001 14:57:01 +0000 Subject: Draft PEP: string interpolation with backquotes References: <9uhfb2$l98$1@peabody.colorado.edu> Message-ID: On Mon, 03 Dec 2001 20:17:26 +2328, Fernando P?rez wrote: > >By the way, the docs comment is a general one. While I *love* the >python documentation and think it's in general top notch, if there's >one minor comment I'd make it is that in the more basic parts it >would't hurt to mention (and hyperlink) a bit more of the >functionality available in the standard library. Currently one tends >to read the basic docs and miss a lot of functionality unless one >deliberately runs through the stdlib docs. I agree. Hyperlinks would help a lot. >Minor gripe though, and not meaning to disparage the great work of >the doc team. Indeed. BTW, is the available documentation for Tkinter going to be included in the standard socumentation at some point? -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From joshm at taconic.net Wed Dec 26 18:35:41 2001 From: joshm at taconic.net (Joshua Muskovitz) Date: Wed, 26 Dec 2001 18:35:41 -0500 Subject: REPOST: references for shifting from Py1.5.2 to Py2.2? Message-ID: <9$--$$-$$$$%%-_$$$@news.noc.cabal.int> Hi all, After a long hiatus, I'm returning to the Python community. I haven't touched Python since 1.5.2, and I'd like to climb the curve to 2.2 as quickly as possible. What are the definitive references for making the transition? No beginner books, please. I'm a proficient developer, and I really understood 1.5.2 pretty well. I really liked Beazley's _Python Essential Reference_, as it got me up to speed on 1.5.2 exactly as I needed. (It was essentially the equivalent of K&R's book on C in structure and brevity.) Is there a new edition, or are there other places where one can find the interim information? I know there have been a lot of enhancements to the language, and I'd like to not be stuck in the 1.x paradigms, but on the other hand, there are a lot of really terrible tech books in the universe, and I don't have the cash to buy blind. One thing I *don't* need is a porting guide -- I'm not trying to move *code* from 1.5.2 to 2.2, just my own understanding of the language for my own future projects. Help! -- josh -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed1.earthlink.net!newsfeed.earthlink.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Joshua Muskovitz" Newsgroups: comp.lang.python Subject: cmsg cancel <3c2a5cd1_2 at corp.newsgroups.com> Control: cancel <3c2a5cd1_2 at corp.newsgroups.com> Date: Mon, 31 Dec 2001 02:50:06 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009776047 27193 211.57.49.2 (31 Dec 2001 05:20:47 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:20:47 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From wurmy at earthlink.net Sun Dec 2 01:41:27 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Sun, 02 Dec 2001 06:41:27 GMT Subject: Errors and their messages References: <3c09a403.91845196@news.tesco.net> Message-ID: <3C09CD12.79E9BE83@earthlink.net> seb wrote: > Hi all, > > i think i've only ever followed up here before, but here goes: > > The python error messages presented on the command line seem to me to > be particularly gregious. > > Say someone is looking to get schoolkids to be involved in programming > (and python seems to be a reasonable choice here so i understand), > then something like: > > Traceback (innermost last): > File "", line 1, in ? > File "win32com\client\__init__.py", line 13, in Dispatch > dispatch, userName = > dynamic._GetGoodDispatchAndUserName(dispatch,userName,c > lsctx) > File "win32com\client\dynamic.py", line 67, in > _GetGoodDispatchAndUserName > return (_GetGoodDispatch(IDispatch, clsctx), userName) > File "win32com\client\dynamic.py", line 58, in _GetGoodDispatch > IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, > pythoncom.II > D_IDispatch) > > doesn't make it easy. > > OK, i might be trying to do a bit more here, but even > > >>> lala > Traceback (innermost last): > File "", line 1, in ? > NameError: lala > >>> > > is cryptic. It's not so cryptic anymore if you read the fine tutorial: http://www.python.org/doc/current/tut/node10.html Error messages consist of a traceback, that tells you in what code the exception occured, plus the exception being raised (type and a message, e.g. NameError and "lala", in your example above). Tracebacks are often nested, and can therefore look impressive; they're not that difficult to figure out though. --Hans From tim.one at home.com Sun Dec 16 00:50:41 2001 From: tim.one at home.com (Tim Peters) Date: Sun, 16 Dec 2001 00:50:41 -0500 Subject: CPython internal design question In-Reply-To: Message-ID: [Courageous] > ... one convention that Python uses internally that really annoys the > devil out of me is defining functions like this: > > ReturnType > MyFunction ( ... ); > > Why? Greppying through the file will fail to yield the return > type of the function. > > BLEACH. I HATE that. :) I believe all the Python developers do greps (or workalikes) from within editors that know how to parse grep output, making it easy to jump to the source of the matching lines. Then, as Daniel Berlin said, doing an anchored grep on the function name cuts way down on irrelevant hits. I expect this also makes life simpler for etags (and workalikes). Whatever, this is Guido's convention and it's always been that way, so you know how much good it will do to dislike it . From bryan at eevolved.com Sun Dec 2 10:11:49 2001 From: bryan at eevolved.com (Bryan) Date: Sun, 2 Dec 2001 10:11:49 -0500 Subject: CryptKit 0.9: cryptsock In-Reply-To: <7xpu5y2szk.fsf@ruckus.brouhaha.com> References: <7xpu5y2szk.fsf@ruckus.brouhaha.com> Message-ID: On Saturday 01 December 2001 10:36 pm, Paul Rubin wrote: > Bryan writes: > > When you say "shared secret key" do you mean that the remote and local > > hosts both have apriori knowledge of the symmetric key? Or are you > > referring to some other mutually shared token, like a password? If you > > meant the latter, then I agree with you completely and you should see > > that feature appear in the next release :) > > I mean a shared random symmetric key (i.e. something like 32 hex > digits), known a priori to both ends. If it's a low entropy token > like a password, you need a fairly complicated protocol like SRP to > stop it from being found by dictionary attacks against recorded > traffic. Including SRP (http://srp.stanford.edu) is a reasonable idea > though, since it's good for other things as well. Thanks for the link, it lead me to research other password-based key-agreement schemes. I found Authentication and Key Agreement via Memorable Password ( http://citeseer.nj.nec.com/kwon00authentication.html ) which claims to be the most efficient of all of them ( EKE, PAK, SRP, GXY, AuthA ). I believe I will implement AMP. Your input would be appreciated. -- <==================================> Bryan Mongeau eEvolved Real-Time Technologies Inc. Website: http://www.eevolved.com Public key: http://pgp.mit.edu <==================================> "Reality is merely an illusion, albeit a very persistent one."-- Einstein From serviciosudt at hotmail.com Thu Dec 20 17:35:12 2001 From: serviciosudt at hotmail.com (Jenkins Velez) Date: Thu, 20 Dec 2001 18:35:12 -0400 Subject: Files Message-ID: Where can I get information about managing files _________________________________________________________________ MSN Photos es la manera m?s sencilla de compartir, editar e imprimir sus fotos favoritas. http://photos.latam.msn.com/Support/WorldWide.aspx From rupe at metro.yak.net Thu Dec 6 17:16:35 2001 From: rupe at metro.yak.net (Rupert Scammell) Date: 6 Dec 2001 14:16:35 -0800 Subject: Detection of subsequent data by poll() References: <79179cf5.0112051303.24daac96@posting.google.com> <9um3qr$d20$1@nntp6.u.washington.edu> Message-ID: <79179cf5.0112061416.48ce89c5@posting.google.com> Donn Cave wrote in message news:<9um3qr$d20$1 at nntp6.u.washington.edu>... > Quoth rupe at metro.yak.net (Rupert Scammell): > | I recently wrote a program that uses the select.poll() method in order > | to > | check for incoming data on multiple listening sockets. When I open a > | connection to one of the listening sockets (e.g. via telnet), the > | program accepts the first item of data sent (a character string with a > | trailing CRLF). However, subsequent calls to poll() never appear to > | detect more strings sent in the same connection to this socket. The > | file descriptors for the sockets are all correctly registered with the > | poll object. > | > | Is there a way to make poll() detect this incoming data without having > | to close and re-open a connection to the socket in question each time? > | > | Any suggestions would be appreciated! > > Suggestion: post a program that shows the problem. Also suggest > you mention your platform. > > Donn Cave, donn at u.washington.edu Per Donn Cave's request, the source of the program that's producing the problem is provided below. The system in use is a RH Linux 6.2 machine (x86 architecture), running kernel version 2.4.13. Again, any assistance or insight into why the poll() call made against the poll object is failing to return more than the first sent line of data would be greatly appreciated. Sincerely, --- Rupert Rupert Scammell rupe at arrow.yak.net http://arrow.yak.net/ Polling code source: import sys, socket, select # Create polling object. poll_obj = select.poll() # List of ports to open port_list = [8555, 8556, 8557, 8558] # List of associated file descriptor numbers. These match up # by subscript with the values in port_list, above. fileno_list = [] # List of socket objects. sock_obj_list = [] # Number of sockets to create: num_sockets = len(port_list) # Create socket objects for each port in port_list, append to sock_obj_list, # then bind and listen on each. for i in range(num_sockets): print 'entering socket addition FOR, port: ', port_list[i] sock_obj_list.append(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) sock_obj_list[i].setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock_obj_list[i].bind(('',port_list[i])) sock_obj_list[i].listen(1) # Add the file descriptor to fileno_list: fileno_list.append(sock_obj_list[i].fileno()) # Register the fd with poll_obj. poll_obj.register(sock_obj_list[i]) # Poll for data on each of the registered socket objects. print 'fileno_list: ', fileno_list print 'sock_obj_list: ', sock_obj_list while 1: # Start with an empty list that'll contain data from # our sockets that have events. data_list = [] # Poll for data on each of the sockets. print 'Polling...' event_list = poll_obj.poll() print 'event_list', event_list # Number of socket objects returned. event_count = len(event_list) print 'event count: ', event_count """ Match the file descriptor values returned by .poll() into event_list with the socket that has that file descriptor value in sock_obj_list. Once we know the socket, call .accept() on it, then read 1024 bytes of data from it. Then print the list of retrieved data. Each item in the list is a two item tuple in the form (port_number, retrieved_data). """ for i in range(event_count): current_fd = event_list[i][0] for b in range(num_sockets): if (current_fd == fileno_list[b]): (cur_conn_obj, cur_addr) = sock_obj_list[b].accept() data_list.append([port_list[b], cur_conn_obj.recv(1024)]) print data_list From logiplexsoftware at earthlink.net Fri Dec 21 13:56:04 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Fri, 21 Dec 2001 10:56:04 -0800 Subject: Python on the desktop In-Reply-To: References: <94e3fce8.0112210053.2568529d@posting.google.com> <3C238618.9F54E5CA@attbi.com> Message-ID: <20011221105604.04c7e5f1.logiplexsoftware@earthlink.net> On Fri, 21 Dec 2001 18:42:57 GMT Courageous wrote: > > >Does C++ have a standard GUI?? > > Well, in effect, yes. Since the vast majority of all platforms > are x86 windows platforms, and the vast majority of C++ developers > use Visual C++, it would follow that the standard GUI for C++ is > MFC. :) :) :) > I suppose it's a bit like saying that N'Sync and Britney Spears represent the tastes of the vast majority of music listeners - arguable but unfortunate =) -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From borcis at geneva-link.ch Sat Dec 29 20:05:58 2001 From: borcis at geneva-link.ch (Boris Borcic) Date: Sun, 30 Dec 2001 02:05:58 +0100 Subject: REPOST: Re: Python and Ruby: a comparison References: <3C2B9A61.EE1618DB@earthlink.net> <2WpX7.1145$0s5.714029@news20> Message-ID: <5$--$$_----_-%$_-$@news.noc.cabal.int> Conrad Schneiker wrote: > > So my question is: at such a presently entirely hypothetical future > juncture, is there any practical and desirable middle ground for a common > single successor language to the current generations of Python and Ruby? What would be fun is to have library interoperability completed with interlingual source-to-source conversion from adequately constrained style... premitting more or less, to use one's language superficial idioms to mean corresponding idioms in the other language. Could even dream this evolve to "truly robust" programming (against the risk of expertise disappearance);-) dream... we'd have a standard of coding, requiring two equivalent sources, in different languages... with components interoperable and inter-substitutable; the sync being mechanically maintained - the main point, would be to be able to retort, to the question : "what's the source language of the code", "there's no piece of code, that has a single source language, programmers from both communities can take over the code, in their own language". I guess what I mean to say, exactly, is that the weakest form for an analogue to a "middle ground for a single successor language" might be not a single successor language, but a pair of parallel subsets of each language that can be automatically translated source-to-source while preserving a smack of idiomatical expression. BB ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Boris Borcic Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E6876.4CBF45D4 at geneva-link.ch> Control: cancel <3C2E6876.4CBF45D4 at geneva-link.ch> Date: Mon, 31 Dec 2001 01:48:55 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774824 27193 211.57.49.2 (31 Dec 2001 05:00:24 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:00:24 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From shriek at gmx.co.uk Fri Dec 21 03:43:08 2001 From: shriek at gmx.co.uk (Stephen) Date: 21 Dec 2001 00:43:08 -0800 Subject: Debugging Python serial I/O errors Message-ID: <97ae44ee.0112210043.5fc0421b@posting.google.com> Having a hell of a time trying to read serial I/O on my redhat 7.2 machine, with a variety of methods ~ ======================================== First attempt ~ using the USPP module ~ ======================================== >>> from uspp import * >>> s = SerialPort("/dev/ttyS1", 1000, 9600) >>> s.write("AT") >>> s.read() Exception exceptions.AttributeError: '_SerialPort__handle' in ignored Traceback (innermost last): File "", line 1, in ? File "SerialPort_linux.py", line 217, in read s=s+SerialPort.__read1(self) File "SerialPort_linux.py", line 204, in __read1 raise SerialPortException('Timeout') SerialPort_linux.SerialPortException: Timeout It seems to be recognizing the port OK, otherwise it would have thrown up one of these errors termios.error: (5, 'Input/output error') or SerialPort_linux.SerialPortException: Unable to open port * btw, if USPP is 'universal', shouldn't it be called with the same parameters on all platforms ? I tried SerialPort("COM2", 1000, 9600) and it really didn't like that, preferring "/tty/devS1") ======================================== Second attempt ~ write straight to the file ======================================= >>> f = open("/dev/ttyS1", "rw") >>> f.write("AT") Traceback (innermost last): File "", line 1, in ? IOError: [Errno 9] Bad file descriptor That's very strange because f is a file descriptor as shown by ~ >>> f I was surprised that it ======================================== Third attempt ~ using PosixSerial.py ======================================= >>> import PosixSerial >>> p = PosixSerial.Port() >>> p.open("/dev/ttyS1") >>> p.write("AT") >>> p.read() and then it just hangs. All of this points to my device being the problem but it's just a modem and the above AT works fine when I use Python on windows with the SerialIO module. Note that all of the above errors would also apply if I used /dev/ttyS0 and COM1 instead of /dev/ttyS1 and COM2. Is there any way I can check the exact status of my COM port and what python is sending, or get more of an idea how to debug this ? Thanking you all. Stephen From musk_ben at yahoo.com Tue Dec 25 22:25:22 2001 From: musk_ben at yahoo.com (Ben Graham) Date: 25 Dec 2001 19:25:22 -0800 Subject: Check in for an instance of a class Message-ID: <59f8895f.0112251925.26c43cc@posting.google.com> Hi, I need to check whether an instance of a particular class exists, in its __init__(...). Assuming that the module containing the class may or may not be imported, what are the my options? (As far as possible, I would like to contain the test in the class completely). And, yes, I need a pre-2.2 solution. Cheers, Ben From david at dataovation.com Mon Dec 17 13:04:49 2001 From: david at dataovation.com (David A McInnis) Date: Mon, 17 Dec 2001 10:04:49 -0800 Subject: CONVERTING TIFF FILES TO JPEG FILES In-Reply-To: <9vkuk2+8a3i@eGroups.com> Message-ID: Do you want a module to do this through python? If so, I don't know. If not, just open any image editing program (Photoshop, PSP, etc) and you should be able to convert it. David McInnis -----Original Message----- From: python-list-admin at python.org [mailto:python-list-admin at python.org]On Behalf Of kmarkie2002 Sent: Monday, December 17, 2001 6:14 AM To: python-list at cwi.nl Subject: CONVERTING TIFF FILES TO JPEG FILES Hello- I'm looking for a way to convert a TIFF file to a JPEG file. Is there a free program that I can download for this? -- http://mail.python.org/mailman/listinfo/python-list From sab at NOSPAM.freeuk.com Sat Dec 29 13:25:34 2001 From: sab at NOSPAM.freeuk.com (G. Willoughby) Date: Sat, 29 Dec 2001 18:25:34 -0000 Subject: Correct use of Classes? Message-ID: Hi, Can someone please point me to any docs on the net that deal with correct useage of classes in python. I have been coding with python now for nearly a year but i haven't really touched on using classes, I know how to code them but i need a little guidance for when to use them in the real world. Thanks, G. Willoughby From fperez528 at yahoo.com Sun Dec 2 12:18:03 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Mon, 03 Dec 2001 16:46:03 +2328 Subject: the purpose of this list??? References: Message-ID: <9uh2ui$c6g$1@peabody.colorado.edu> Gabe Newcomb wrote: > So I just joined the list an hour ago. I've read 4 of the messages > and half of them involve some form of flaming. If we're going to > argue about how to do something, that's one thing, but please, > people, if you're trying to make points just to preserve your image, > give it a rest. It's a waste of all our time. Well, not trying to sound snotty or anything, but: you've read 4 messages in a list that generates around 400 per day, 'half' (that is, a wholesome *2*) are flames and you conclude this is a flamer's list? One simple suggestion: spend a few days on it, see if you get useful information concerning Python questions, and *then* decide. It's called 'collecting statistics': from a sample of 4 messages you can not say *absolutely anything statistically meaningful* concerning the traffic on a list of this volume. In the long term, chances are you'll find (as most of us seem to) that this list provides *a lot* of very informative, intelligent discussion, useful python tricks and debate on the language at large. But you'll have to read more than 4 messages to notice that. Cheers, f. From rupe at metro.yak.net Wed Dec 5 16:03:58 2001 From: rupe at metro.yak.net (Rupert Scammell) Date: 5 Dec 2001 13:03:58 -0800 Subject: Detection of subsequent data by poll() Message-ID: <79179cf5.0112051303.24daac96@posting.google.com> I recently wrote a program that uses the select.poll() method in order to check for incoming data on multiple listening sockets. When I open a connection to one of the listening sockets (e.g. via telnet), the program accepts the first item of data sent (a character string with a trailing CRLF). However, subsequent calls to poll() never appear to detect more strings sent in the same connection to this socket. The file descriptors for the sockets are all correctly registered with the poll object. Is there a way to make poll() detect this incoming data without having to close and re-open a connection to the socket in question each time? Any suggestions would be appreciated! Thanks, --- Rupert Rupert Scammell rupe at arrow.yak.net http://arrow.yak.net From jkraska at san.rr.com Mon Dec 10 13:31:02 2001 From: jkraska at san.rr.com (Courageous) Date: Mon, 10 Dec 2001 18:31:02 GMT Subject: Creating a "package" using C extensions? References: <4bo41u8de4r4njcchh4g3mcuvdhqohhu39@4ax.com> <3C14FFDE.97DA740A@attbi.com> Message-ID: >IF you figure out how to do this, I'd love to see an example. It owuld >be prettyhandy for me as well. Maybe even a cookbook entry? I've figured it out. It's not hard at all, however there is a small amount of repetitive labor involved. Here is the init method for my "package" that I'm developing: void _declspec(dllexport) initlrammp() { PyObject* m = Py_InitModule3("lrammp", LrammpModuleMethods, LrammpModuleDocs ); PyObject* d = PyModule_GetDict(m); PyDict_SetItemString(d, "simulator", __LRAMMP__SimulatorModuleInit()); PyDict_SetItemString(d, "agent", __LRAMMP__AgentModuleInit()); } Note the specific mutations on the "lrammp" module's dictionary at init time. I am adding modules, as defined in the __LRAMMP__* forms directly to the dictionary. These are taken from seperate source files that have "pseudo init" methods of their own. They're not _declspecd and aren't intended to invoked directly by Python. This seems to work in testing my .py file. For example, the following seems to work as expected: from lrammp import simulator from lrammp import agent Likewise what is imported appears to be a proper module. This functionality seems to fit the bill for me. Not having to produce a couple dozen .dlls is a relief. :) C// From webbmaster2001 at directvinternet.com Thu Dec 13 10:56:35 2001 From: webbmaster2001 at directvinternet.com (John Yeager) Date: Thu, 13 Dec 2001 09:56:35 -0600 Subject: Where can you find the Python ODBC modual Message-ID: This thing is driveing me nuts I am trying to connect to an Access Database,( boss will not let me use Mysql ), so I am in need of figureing out how to connect to Microsoft access.. Please help From greg at cosc.canterbury.ac.nz Mon Dec 10 00:02:14 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Mon, 10 Dec 2001 18:02:14 +1300 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C100BB2.6446E896@cosc.canterbury.ac.nz> <7da8d8f8.0112070206.49e1bef4@posting.google.com> <3C114F6D.D1E2D291@attbi.com> Message-ID: <3C1441D6.A648257F@cosc.canterbury.ac.nz> Harald Hanche-Olsen wrote: > > Most > of the items on my to do list, if they have a deadline associated with > them at all, need to be done before a special date, not some specific > hour or minute on that day. Lots of things need finer resolution, though, such as appointment calendars. People are very used to the idea of a date and a time of day going together and specifying a point in time. Having separate Date and TimeOfDay classes may be a good idea, but many people are going to be disappointed if there isn't also a DateTime class that blends them smoothly together somehow. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From coca at houston.rr.com Fri Dec 21 00:48:02 2001 From: coca at houston.rr.com (Dan Compton) Date: 20 Dec 2001 21:48:02 -0800 Subject: age of new pythonistas [was: The Editor Poll results are in!] References: Message-ID: <60c49aa9.0112202148.7218555b@posting.google.com> 17 I started coding Python about a week ago but began coding 2 years ago with C++ (in actuality it was C using iostream and some other C++ libraries :-P) and then later learned C itself and true C++. I expirimented with Java (and disliked it's feature-less nature, although they recently took after C++ with templates) and C# (don't even remind me, please!) but obviously didn't approve of them. I tried some Perl but found it to be way too much of an intimidating mess of syntax and modules. I also learned Tcl and found it to be a better alternative to Perl but not quite "there" if you know what I mean, although I loved Tk (and it's great that other languages can use Tk!). So now I come upon Python and it looks like it's going to stay. I use a laptop with linux (no internet) and a desktop with windows (with internet and burner) and am glad to say that everything works well cross-platform. I have already interfaced some of my C code with Python on Windows but since I really HATE VC++ (no, it does not compile C++, it compiles some made up stuff MS calls C++), I'm going to do more of that in Linux. I think Python is great because it is well designed (unlike Perl), it has many features and modules (unlike Tcl, but I might be wrong about that due to ignorance), and it has great integration of C and C++! I hope to be able to create modules to be used by the entire Python community sometime. Dan From aleax at aleax.it Fri Dec 28 09:35:26 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 15:35:26 +0100 Subject: Wine applicability (was: Python Popularity: Questions and Comments) References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9901.998345FB@earthlink.net> <200112281405.IAA20884@starbase.neosoft.com> Message-ID: "Cameron Laird" wrote in message news:200112281405.IAA20884 at starbase.neosoft.com... ... > >I don't do much gaming, but I still have to use Windows (mostly in win4lin > >under Linux) for a few needs (e.g., SOME durned webpages that I need won't > >show correcty under any browser except Internet Explorer). Not to mention > >that think3 is a mostly-Windows shop, too. > > > >Linux is my preferred platform for most tasks, except that my firewall/etc > >machine runs OpenBSD (sometimes security is more important than richness > >of features, support for strange hardware, and so on). > . > I'm a tiny surprised; I sincerely thought you > were most comfortable with Windows for COM and > ADO riches. I do love COM and COM-based technologies, and for the last few years I've had to immerse myself almost exclusively in Windows to develop some of the expertise for which I was (and am) gainfully employed. But, out of all the operating systems and environments I've tried (including also Vax/VMS, IBM mainframe OS's such as VM/SP and MVS, Apollo Domain, and quite a few others) Unix-like ones have always been my personal preference for most tasks. I used Linux at home in '92-'95, before the switch to Windows for "total immersion/gain expertise" purposes, and this year I've been able to switch back to Linux at home (and OpenBSD for the firewall/etc -- now THAT is stability, solidity, and security; upon reviewing most all available environments, OpenBSD struck me as heads and shoulders above the crowd -- but, behind the firewall, I find Linux preferable, given typical "consumer" needs such as Windows emulation, viewing Realmedia files, and so on). > Alex, do you have any sense of how well "SOME > durned webpages ..." look when viewed with IE > under Wine on Linux? Are you saying that they > *are* acceptable through win4lin-plus-IE? I was unable to make Microsoft Word run perfectly under Wine, and that's my primary need -- Word with O'Reilly customized macros &c, as that's what I'm required to use for one of the books. So, I did not try Wine extensively on other tasks. I did try VMWare (a beta) and found it somewhat clunky, ponderous, and slow, although maybe that was its beta nature; anyway, I wasn't motivated to plunk down several hundred dollars for the final version to find out. Then I discovered, carefully hidden on a CD of my favorite Linux Distribution (Mandrake 8.1 powerpack), a demo/trial version of NeTraverse's Win4Lin. Half an hour after starting to try it out I had purchased the full unlimited license online (after trying to do so, without success, directly at Mandrake Store, I just got to NeTraverse's site, and, there, it was a snap) -- 1/4 the price of VMWare and more usable for my purposes. Lots of limitations that may be important to some: you only get to run Windows98 on top of Linux, and your Windows "machine" doesn't get to see any strange hardware you may have (in my case, a durned Winmodem by Conexant, really win-only; fortunately I was later able to have it exchanged with a Lucent-chipset one, which does run fine under Linux, it appears). But those limitations were not important for my own specific purposes. All webpages show up just fine under IE 5.5 (haven't bothered downloading 6, I'm told it plays havoc with CSS handling), Word runs, and so does Visual Studio when I need to compile/try out something in Windows version. I have occasionally used Excel, Powerpoint, the OKbridge Windows clent, and a few minor things -- for each of those I'd have good Linux side alternatives too, but, since I had win4lin already, why bother. I believe the only failure was when trying to examine some files with the Windows Media Player. I do get occasional "crashes" (of the simulated Win98 environments), but roughly as often as a real Win98 crashes under similar usage, so I don't think that's win4lin's fault. Alex From jkraska at san.rr.com Mon Dec 3 20:45:37 2001 From: jkraska at san.rr.com (Courageous) Date: Tue, 04 Dec 2001 01:45:37 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <3C0BE492.5DACEA18@mega-nerd.com> <3C0C07DD.AD717FCF@ccvcorp.com> Message-ID: >> Always curious about this in an "all tab" world - how do you align >> continuation lines that aren't on a tab stop? > >And even if you *do* so, then how are they going to stay aligned when the >next person to look at it uses a different tab size? A: you can't, and they won't. We have more experience than they do and just don't understand us. I might have made the "leave my tabs the fuck alone" argument 4 or 5 years ago. Not any longer. Perhaps they simply haven't worked on a shared CVS tree. C// From tdelaney at avaya.com Wed Dec 12 21:29:23 2001 From: tdelaney at avaya.com (Delaney, Timothy) Date: Thu, 13 Dec 2001 13:29:23 +1100 Subject: more fun with PEP 276 Message-ID: > From: philh at comuno.freeserve.co.uk > > Another possibility would be to make .. part of the syntax > for lists, i.e.: > > a = [ -5 .. 5, 10, 20 ] > > a is [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 10, 20] > > Maybe instead we should be looking at implementing a clever > macro system > as a preprocessor to Python. Something that could cope with > ...to...step... > would have to be quite complex, but a macro system that used > function-call > like syntax would be simpler. And we come full circle ... again ... Tim Delaney From jason at jorendorff.com Mon Dec 31 14:31:52 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Mon, 31 Dec 2001 13:31:52 -0600 Subject: Basic threading questions In-Reply-To: Message-ID: > 1. The library reference for the thread module says "Not all > built-in functions that may block waiting for I/O allow other > threads to run." Is there a list of the built-in blocking > operations that either block nicely, or do not block nicely? No. Most block nicely. If you find one that doesn't, it's (almost certainly) a bug. > can I at least assume that the dictionary and list objects are > thread-safe, and that adding, deleting, replacing, and accessing > attributes of a class are thread-safe? Yes. > If it matters, I'm using Python 2.2.0 under Win98 and Win2K, but > I'd prefer a more general discussion of the issues involved. This page starts with a very technical discussion: http://www.python.org/doc/current/api/threads.html Other than the Global Interpreter Lock, Python threads behave just like native Win32 threads, because that's what they are. ## Jason Orendorff http://www.jorendorff.com/ From fperez528 at yahoo.com Sat Dec 1 16:10:50 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Sun, 02 Dec 2001 20:38:50 +2328 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: <9ues6n$i0a$1@peabody.colorado.edu> Jeff Hinrichs wrote: > my 0.02$US: > Actually, spaces are the problems not tabs. A tab is a tab, where > is indenting by spaces....hmm. > let's see, I like 4 spaces, he like 8 and she likes 6 and so on. > That causes more grief than tabs. > Where as tabs, 1 tab = 1st level block, 2 tabs = 2nd level block and > so on. > > Maybe if people didn't use such brain dead editors that actually > replaced > tabs with spaces this would be a complete non-issue. You should be > able to configure your editor to display tabs in a width that is to > your liking > WITHOUT mucking with the data. As it is, we are doomed to listen to > this argument go on ad nauseum. > In theory, I agree with you. Reality, as always, is more complicated. But not because of brain-dead editors. Even if you could rid the world of those, and were left with only god-fearing, tab-respecting editors, you'd still have a problem: *not all code is typed by hand*. Pasting. There's the breaker for this issue. One of the beauties of python is the interactive prompt, right? You type some code, if it works you highlight, middle click and off you go. Well, try it and see where your tabs go. Or the web, or newsgroups, or email... There are *many* situations which don't preserve tabs as tabs, and code flows through them. So forget about it. Again, in an ideal world where not only editors but *every conceivable piece of software that can display text* respected tabs as tabs, your idea would work. Welcome to reality. f. From ykingma at accessforall.nl Sat Dec 22 15:00:29 2001 From: ykingma at accessforall.nl (Ype Kingma) Date: Sat, 22 Dec 2001 21:00:29 +0100 Subject: python threads References: <96c7f32.0112210450.174f6914@posting.google.com> Message-ID: <3C24E646.1CF22B03@accessforall.nl> curt finch wrote: > > We ship a web application completely written in python. > > The application server daemon that sits between apache/IIS and the > dbserver would like to take advantage of multi-chip architectures > and have many threads. Each thread would be owned by a logged > in user with it's own db connection and share cached db data with > other threads. I assume you select on sockets. > > My understanding is that python's current threads implementation > does not really allow for this in the sense that only one thread > can be running at a time, regardless of the number of chips on > the machine, and additionally that the threads cannot really > interrupt each other and still maintain correct state. > > Is that all correct? > It is correct for CPython, as others explained. It is not correct for Jython. which uses java threads. You might consider porting to Jython in case you have the non blocking I/O in java available (java 1.4 iirc). This will require a rewrite of the socket and socket select using code on top of java's non blocking I/O package, so it might not be feasible now. Perhaps someone from Zope has some experience doing this... Regards, Ype From schneiker at jump.net Sat Dec 29 15:47:05 2001 From: schneiker at jump.net (Conrad Schneiker) Date: Sat, 29 Dec 2001 14:47:05 -0600 Subject: REPOST: Re: Python and Ruby: a comparison References: <3C2B9A61.EE1618DB@earthlink.net> Message-ID: <6$--$$_----_%--_-$@news.noc.cabal.int> "Ron Stephens" wrote: > I initiated a thread over on comp.lang.python which has turned into > somewhat of a comparison between Ruby and Python, their relative > strengths and weaknesses. The thread is titled Python Popularity: > Questions and Comments. [...] > By teh way, I admire Ruby. Although I am a Python hacker at heart, I > enjoy this newsgroup, the Ruby community, and I think Matz is doing an > outstanding job. I do believe though, that Python and Ruby are aimed at > a very similar problem domains with similar philosophies; and that is > what I began to talk about on comp.lang.python and that got the thread > going. [In this and other somewhat related threads] Some people have (in different words) lamented the "language fork" (as it were) with respect to providing the major dynamic OO alternative to Perl (and Java and C++). Others have pointed out that Python and Ruby appeal to somewhat different tastes and that they draw newcomers from only partially overlapping pools of people. Nevertheless, there is some inevitable division of potential resources and mind share. Othes have pointed out various relatively moderate but nagging problems in Ruby and Python which persist due to backwards compatibility, which won't be fixed until the (highly speculative) advent of major overhalls where full backwards compatibility is not completely manditory--i.e. Ruby.next and Python 3000. So my question is: at such a presently entirely hypothetical future juncture, is there any practical and desirable middle ground for a common single successor language to the current generations of Python and Ruby? Conrad ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Conrad Schneiker" Newsgroups: comp.lang.python Subject: cmsg cancel <2WpX7.1145$0s5.714029 at news20> Control: cancel <2WpX7.1145$0s5.714029 at news20> Date: Mon, 31 Dec 2001 04:37:17 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774599 27193 211.57.49.2 (31 Dec 2001 04:56:39 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:56:39 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jeff at ccvcorp.com Mon Dec 10 13:40:08 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Mon, 10 Dec 2001 10:40:08 -0800 Subject: PEP 276 Simple Iterator for ints (fwd) References: <9uomtp$e1cbj$1@fido.engr.sgi.com> <9up46o$e2ost$1@fido.engr.sgi.com> Message-ID: <3C150188.C31AC4B8@ccvcorp.com> Paul Jackson wrote: > Oh, and that brings up another fine point. Whereas I can > say: > > for (a,b) in ((1,10), (2,11)): > > I suspect you wouldn't want me to be able to say: > > for (1,10) <= (a,b) <= (2,11): > > Or perhaps you would ?? This starts to get complicated again. I think that this doesn't apply. The proposed x < i < z notation replaces range(), whereas your example doesn't use range (it explicitly provides its own sequence). (I still strongly dislike the proposed notation, though.... Maybe it's a style thing--I'd usually much rather have a clear function call than clever operator tricks.) Jeff Shannon Technician/Programmer Credit International From bwilk_97 at yahoo.com Wed Dec 19 03:12:51 2001 From: bwilk_97 at yahoo.com (Bill Wilkinson) Date: Wed, 19 Dec 2001 08:12:51 GMT Subject: Dictionaries as records References: Message-ID: <7_XT7.28652$t07.4042756@twister.midsouth.rr.com> "John Roth" > Your records seem to average around 250 bytes, so that's about 16 > characters per field. Object overhead for each object is roughly the > same as this (it might be larger, I haven't looked at the headers > recently.) Yes sir, about 250 bytes. Here is some code that shows what I am confused about. (Hoping my spaces don't get stripped out while being posted) There is a big difference between the memory usage of the two sections of code below. I can work around this, but I am a bit curious now. It would be nice to know why the second part below takes up so much ram (I think about 1.2k per rec?). #A sample record that looks like the ones I use. Data obfuscated. d = {"f":"kdfkjdkfjdkj", "g":"ldjfljdfkjdf", "u":"dkfkjdfkjdfj", "t":"kdjfkjdfkjdkjfkjdf", "u1":"kdjfkjdjdkjfkjdfjkdjf", "ii2":"kjdfkjdfjkdjfkjdfjdfj", "g3":"ldjfljdfkjdf", "u4":"dkfkjdfkjdfj", "g5":"ldjfljdfkjdf", "u6":"dkfkjdfkjdfj", "g7":"ldjfljdfkjdf", "u8":"dkfkjdfkjdfj", "g9":"ldjfljdfkjdf", "u10":"dkfkjdfkjdfj", "g11":"ldjfljdfkjdf", "u12":"dkfkjdfkjdfj",} #Method 1 #Just make a bunch of copies of the same record again and again. tbl = [] for x in range(15000): tbl.append(d.copy()) raw_input("Check your Ram usage then press enter") #Method 2 #Ok, now change each record just a little bit. #Hack off the last two chars from each field and #add one new character. Then append the new record #to the table. tbl = [] for x in range(15000): t = d.copy() for k in t.keys(): t[k] = t[k][:-2] + str(x)[-1] tbl.append(t.copy()) print "Now check your memory usage again." From jkraska at san.rr.com Sun Dec 30 01:07:22 2001 From: jkraska at san.rr.com (Courageous) Date: Sun, 30 Dec 2001 06:07:22 GMT Subject: Is learning Python "extraordinary"? References: <3C2E5706.5880983E@engcorp.com> <3C2EAD4D.77564075@engcorp.com> Message-ID: >I think my perspective is somewhat tainted from being one of the >freaks (back then) who was rather self-taught. By the end of >high school I knew BASIC, C, APL, 6502 assembly, and others. >By *no* means exceptional compared to many of the real wizards >of the industry, but... But, by all means exceptional, likely with an IQ over 130, perhaps edging to 145, placing you smack into the range of individuals which are at a minimum smarter than ~97.5% of all the rest of humanity. So pat yourself on the back and engage in some well- deserved emotional masturbation. You're likely better than you give yourself credit for. Moreover, in this case, a little acceptance of your own lofty capabilities may do you some good, because when you learn to aknowledge yourself, you may begin to see the signficance of similar accomplishment in others. OM, HARI SHIVA, and all that. :-P C// From skip at pobox.com Mon Dec 24 12:30:11 2001 From: skip at pobox.com (Skip Montanaro) Date: Mon, 24 Dec 2001 11:30:11 -0600 Subject: vi or emacs for editing Python on Linux? In-Reply-To: <20011224075512.E10496@0xx0.net> References: <20011224075512.E10496@0xx0.net> Message-ID: <15399.26147.610824.696209@12-248-41-177.client.attbi.com> Siegmund> i used emacs for a long time, but last year my little finger Siegmund> on the left hand began hurting (pressing STRG/META 100 times Siegmund> per minute was to much) Siegmund> than i switched to vim. some hours later my little finger an i Siegmund> loved vim :) While it may have helped you to switch from emacs to vi (this really has nothing to do with Python - what the heck), I suspect more important than your choice of editors are your keyboard posture, work/rest habits, and the layout of keys on the keyboard you use most often. If you have good keyboard posture and take breaks from the computer frequently enough, I suspect your left pinky and your wrists will hold up just fine, no matter what editor you use. O.P.N. I once wrote a Tkinter-based typing watcher. I even created a SF project: http://sourceforge.net/projects/watch/ I rarely use it anymore myself, but people with repetitive strain problems may find it helpful. -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From greg at cosc.canterbury.ac.nz Thu Dec 6 19:22:10 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Fri, 07 Dec 2001 13:22:10 +1300 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> Message-ID: <3C100BB2.6446E896@cosc.canterbury.ac.nz> sebastien wrote: > > I feel this solution better than the POSIX convention to count the > elapsed time in seconds because not all the days have the same length. What?!? This sounds more like an argument for NOT using days as the basic unit. Otherwise you can't meaningfully take the difference between two dates and express it in the same units. > We can define a few numbers of constants: > seconds = 1.0 > minutes = 60.0 > hours = 3600.0 > days = 86400.0 > weeks = 604800.0 > > We can't introduce higher constants because we deal here with absolute > duration. Length of month or year isn't absolute but relative to the > starting date. Because of what you said above about leap seconds, the same thing applies to days and weeks, too! Although I'll concede that for most purposes the difference won't matter. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From missive at frontiernet.net Sat Dec 1 18:14:04 2001 From: missive at frontiernet.net (Lee Harr) Date: Sat, 01 Dec 2001 23:14:04 -0000 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: If using tab can cause trouble when moving source files from one editor to another (or one person's configuration of an editor to another) why not just get rid of using tab for indentation altogether? From DeepBleu at DeepBleu.org Thu Dec 27 13:14:19 2001 From: DeepBleu at DeepBleu.org (DeepBleu) Date: Thu, 27 Dec 2001 12:14:19 -0600 Subject: A new forum is up! References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B5E9F.FF1C2CC@bellatlantic.net> Message-ID: > Andrew Nguyen wrote: > > > > A new forum for Python is up. It has a better feel to it than this > > forum (in my opinion) It depends on how you view this 'forum.' As far as I am concerned, **nothing** beats NNTP newsgroups viewed in a dedicated NNTP viewer. DeepBleu From aerkalov at irb.hr Sat Dec 1 18:43:54 2001 From: aerkalov at irb.hr (Erkalovic Aleksandar) Date: 1 Dec 2001 23:43:54 GMT Subject: A: Python Depo (In Croatian) Message-ID: <9ubpvq$snn$3@bagan.srce.hr> http://www.python-depo.f2s.com/ -- to su te male sitnice........... From josegomez at gmx.net Fri Dec 7 09:48:26 2001 From: josegomez at gmx.net (josegomez at gmx.net) Date: Fri, 7 Dec 2001 14:48:26 +0000 (UTC) Subject: Reading mixed ASCII/bin file-HOW? References: <9uilvj$djm$1@hermes.shef.ac.uk> <3C0D1D15.CA38A24B@attbi.com> Message-ID: <9uqkrq$f4e$1@hermes.shef.ac.uk> In article <3C0D1D15.CA38A24B at attbi.com> you wrote: > josegomez at gmx.net wrote: > What's wrong with that way?? A bunch of readline() calls is exactly what > you want. For example: The problem being that I am more used to Fortran than python :-) It does indeed make sense to parse it in the way you mention (it's less than a hundred lines, so it is quick enough). So, to sum up: 1.- Open file in binary mode 2.- Process header by judicious readline() calls 2.5.- Decide whether the data in the main body is binary or ASCII. 3.- Once the data header is found, either 3.5a.- read binary bytes (and convert using fromstring in Numeric) 3.5b.- read ASCII data using one of the many extensions (either SciPy, Scientific Python), or plain vanilla readline() (might take a long time, though) 3.5c.- Use a SWIG-ed C function :-) Thanks a lot, i have got round most problems by now, and it's only a question of choosing the most efficient method! Thanks Jos? -- Jos? L G?mez Dans PhD student Tel: +44 114 222 5582 Radar & Communications Group FAX; +44 870 132 2990 Department of Electronic Engineering University of Sheffield UK From ryan.phillips at csus.edu Fri Dec 28 16:19:55 2001 From: ryan.phillips at csus.edu (Ryan Phillips) Date: 28 Dec 2001 21:19:55 GMT Subject: Authentication, urllib, and httplib... References: Message-ID: This should help: http://www.zope.org/Members/peterb/http_auth -Ryan "Vincent A. Primavera" wrote in message news:mailman.1009571133.29349.python-list at python.org... > Hello, > Trying to write a program to pull several Excel format reports off of a > website which we at my company are spending alot of time on doing > manually once a week. The page has a form with several fields to be > filled in before submitting. Here's the problem, I can access the page > with urllib's urlopen() but not with httplib's HTTPConnection.request() > as I am getting a 401 Authorization Required error. How can I be > prompted for the user and password info as I am with urlopen()? Or > better yet pass these parameters? > > Thanks in advance, > Vincent A. Primavera > > P.S. I have all of the necessary field names with exception to the > username and password... > > From daniel.dittmar at sap.com Thu Dec 13 12:28:06 2001 From: daniel.dittmar at sap.com (Daniel Dittmar) Date: Thu, 13 Dec 2001 18:28:06 +0100 Subject: ftpwalf function References: <9vajkq$7kk$1@mail1.wg.waii.com> Message-ID: <9vaof6$ob1$1@news1.wdf.sap-ag.de> > Just came up with this function, don't know where else to put it so ...... You could put it into the Python Cookbook: http://aspn.activestate.com/ASPN/Cookbook/Python or at faqts: http://www.faqts.com/knowledge_base/index.phtml/fid/545. Daniel From jdf at pobox.com Fri Dec 28 00:43:04 2001 From: jdf at pobox.com (Jonathan Feinberg) Date: Fri, 28 Dec 2001 05:43:04 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: Message-ID: <3$--$$_--_-$$%$$-$@news.noc.cabal.int> "A. Keyton Weissinger" writes: > If it is as "X" as we all say/know/feel-in-our-hearts that it is, why is > there so very little real commercial appeal? [snip] > OK. At this point, I will get probably 3-10 messages public or private > saying that Python does not attempt to answer the same niche. It has nothing whatsoever to do with the merits. It's entirely about marketing. It's about pointy-headed Chief Technical Officers who have heard that Java is a good "enterprise" language, etc. -- Jonathan Feinberg jdf at pobox.com New York, NY http://pobox.com/~jdf ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail Message-ID: Control: cancel Subject: cmsg cancel From: Jonathan Feinberg Newsgroups: comp.lang.python X-No-Archive: yes Lines: 2 NNTP-Posting-Host: wonenara.ozemail.com.au X-Trace: ozemail.com.au 1009643099 203.108.164.177 (Sun, 30 Dec 2001 03:24:59 EST) NNTP-Posting-Date: Sun, 30 Dec 2001 03:24:59 EST Organization: OzEmail Ltd, Australia Distribution: world Date: Sat, 29 Dec 2001 13:29:58 GMT This message was cancelled from within Mozilla. From aleax at aleax.it Fri Dec 28 12:06:23 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 18:06:23 +0100 Subject: REPOST: Re: Wine applicability (was: Python Popularity: Questions and Comments) References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9901.998345FB@earthlink.net> <200112281405.IAA20884@starbase.neosoft.com> <200112281642.KAA24897@starbase.neosoft.com> Message-ID: <6$--$$_----_---%%$@news.noc.cabal.int> "Cameron Laird" wrote in message news:200112281642.KAA24897 at starbase.neosoft.com... ... > >that's my primary need -- Word with O'Reilly customized macros &c, > >as that's what I'm required to use for one of the books. So, I > O'REILLY MAKES YOU USE WORD MACROS?!??!!? > I've got to talk with those boys. That > strikes me as an atrocity. "makes" is probably an overbid. The Cookbook I'm doing in XML with a custom DTD, and that's just fine - I get to use VIM:-). But for the Nutshell, that wasn't an option. > >did not try Wine extensively on other tasks. I did try VMWare (a > >beta) and found it somewhat clunky, ponderous, and slow, although > >maybe that was its beta nature; anyway, I wasn't motivated to plunk > >down several hundred dollars for the final version to find out. > I have acquaintances who swear by VMWare. So do I, and it was on their hearty recommendation that I gave that beta a good try. If the problems are indeed all related to it BEING a beta, then VMWare's producers had better make some sort of time-limited try-it-out or something like that, without the speed and resource-consumption problems -- I think my machine is adequate (Athlon 1.2 GHz, 256 M DDRAM PC2100), yet I was not happy with interactive performance (Word '97 subjectively running worse than on my ultralight laptop, which has a Pentium III-600 and just 64 MB of slower RAM -- I tried the two MS OS's for which I have licenses, Win98 and NT/4; maybe Win/2K and/or Office/2K work better with VMWare, but I'm not going to splurge for those in addition to VMWare itself -- that's running to well over 1K euros for something a few tens of euros for win4lin, plus my already-paid-for Win98 and Office97 licenses, already give me quite satisfactorily). > >some files with the Windows Media Player. I do get occasional > >"crashes" (of the simulated Win98 environments), but roughly as > >often as a real Win98 crashes under similar usage, so I don't > >think that's win4lin's fault. > Interesting testimony. Thanks. You're welcome! Alex ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Alex Martelli" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:55:12 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775200 27193 211.57.49.2 (31 Dec 2001 05:06:40 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:06:40 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From fperez528 at yahoo.com Sun Dec 9 17:21:46 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Mon, 10 Dec 2001 21:49:46 +2328 Subject: strict python? References: <3C1060E4.756F33B2@earthlink.net> Message-ID: <9v43b9$o54$1@peabody.colorado.edu> Brian Sturk wrote: > I've been following this thread since I started it and now I > understand why it is legal etc, but I still wish that it could, even > if optionally, > be flagged as a warning. I imagine that 8 times out of 10 it was > unintentional. However, I am new to python so maybe this is more > common than I think This is why I think a -w flag would be great. Something with levels of 'paranoidness' (is that a word?). > I've downloaded PyChecker and hope to try it soon. Basically pychecker can do a lot of what my hypothetical -w flag would, but I still think that kind of language control belongs inside, not as an add-on. As I said before, perl's -w and 'use strict' are some of the *very few* things I actually miss from good ole'executable line noise. Cheers, f. From skip at pobox.com Fri Dec 28 15:02:37 2001 From: skip at pobox.com (Skip Montanaro) Date: Fri, 28 Dec 2001 14:02:37 -0600 Subject: pth files - can they prepend to sys.path? In-Reply-To: References: Message-ID: <15404.53213.910261.64205@12-248-41-177.client.attbi.com> Skip> Is it possible to force a directory mentioned in a .pth file to be Skip> inserted at the beginning of sys.path instead of appended to the Skip> end? Martin> By means of a dirty trick, perhaps.... You are one sly dog, Martin... ;-) Thx, Skip From danielk at aracnet.com Tue Dec 4 20:49:23 2001 From: danielk at aracnet.com (Daniel Klein) Date: Tue, 04 Dec 2001 17:49:23 -0800 Subject: Any magazines about Python? References: <3c0cd177.5568479@news> Message-ID: <56vq0uc8rp5s110c6loj8el2jt8ukcq6ql@4ax.com> Dr Dobbs Journal publishes Python related articles on a fairly regular basis :--) , but you might go 2 or 3 issues without seeing anything too. :-( Daniel Klein On Tue, 04 Dec 2001 13:39:22 GMT, phony_address at yahoo.com (Phredd Phlintstone) wrote: >I like to read away from my computer, and am wondering if any of the >popular computer magazines have regular articles/columns about Python? >I am very newbie, and starting to understand just the most basic >programming principles from the Gauld book, "Learn to Program Using >Python." I know about online resources but am wondering if my local >magazine rack has any promise. Thanks >Please post any responses to this to this newsgroup. From jdhunter at nitace.bsd.uchicago.edu Sun Dec 30 13:21:45 2001 From: jdhunter at nitace.bsd.uchicago.edu (John Hunter) Date: Sun, 30 Dec 2001 12:21:45 -0600 Subject: Call for a small program - willing to give a bonus References: <3C2F2186.52BF5D0C@htp-tel.de> Message-ID: >>>>> "Tom" == Tom Karas writes: Tom> Later the program should also be able to play sound. I heard, Tom> this could be difficult with python !? I do not think this is true. The built-in python library supports wave, aif and raw audio formats, among others. Other audio formats such as mp3 are available via extension modules. So you'll have no problem here, I suspect. Guido van Rossum, the inventor of python, worked in the multimedia biz in his life prior to python and I think worked with audio codecs, so it is not surprising that python has multimedia serves built in. Cheers, John Hunter From osuchw at ecn.ab.ca Thu Dec 20 14:20:35 2001 From: osuchw at ecn.ab.ca (waldekO) Date: 20 Dec 2001 11:20:35 -0800 Subject: How to generate XML References: <3c21e330@news.opennet.it> Message-ID: Fabrizio wrote in message news:<3c21e330 at news.opennet.it>... > Does anybody know if there are modules to generate XML? > I know there is SAX, but it is only for parsing, isn't it? > Thank. > Fab Another module not mentined is saxutils and XMLGenerator class I use it to generate XML from python structures. >>> import xml.sax.saxutils >>> from xml.sax import saxutils >>> gen = saxutils.XMLGenerator() Check the source for methods waldekO From fperez528 at yahoo.com Tue Dec 18 11:59:13 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Wed, 19 Dec 2001 16:27:13 +2328 Subject: Why is Complex number notation the way it is? References: Message-ID: <9vr7s1$2sh$1@peabody.colorado.edu> Delaney, Timothy wrote: > Because there are two representations for complex numbers, depending on > whether you're a mathematician or a physicist. Mathematicians use 'i', > physicists (and engineers I think) use 'j'. just being nitpicky here. I think the 'j' convention is more one coming from the electrical engineers, who use what they call 'phasors' (if my memory doesn't fail me) to quickly analyze phase relations in signals using basic complex algebra. In every physics book I've been through in my life, 'i' is the imaginary unit. > 'j' is more easily distinguished from the surrounding characters (such a > '1') because it dips below the baseline. > I do think that for computing purposes, 'j' is probably a better choice, less likely to be confused on screen with a 1 (especially in certain fonts). cheers, f From chrishbarker at attbi.com Mon Dec 10 13:00:01 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Mon, 10 Dec 2001 10:00:01 -0800 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C0FBAA8.F1A44304@attbi.com> <3C100EFF.6EEA6C7A@cosc.canterbury.ac.nz> <3C1438B0.B1C6D749@cosc.canterbury.ac.nz> Message-ID: <3C14F821.DEE44D5@attbi.com> Greg Ewing wrote: > Yes. Once you've solved that problem down to the level > of seconds, smaller units aren't any harder. So we > might as well choose a unit smaller than anything > anyone is likely to need. OK, if you really have seconds correct, then yes, 10**-whatever seconds would only be a matter of storage. But... That means you have to have seconds correct to 10**-whatever. The leapsecond rule someone posted stated that you waited until you were off by more that some fraction of a second (.75, .5? I don't remember), anyway, that means that you will be off by a monsterous amount in terms of nanoseconds, but by a negligable amount in terms of seconds. Indeed, if you ignore leap seconds, you can still resolve hundreds of years, and only be off by a few seconds at most. That would be absolutely fine for most non-physics applications. I suppose it would be more honest to only display minutes (or decaseconds?), so you would be accurate to the sigfigs you presented. Think of this as a significant figure issue. If you wanted to know how many seconds it was since Jan 23th, 1856, you would get a whole lot of significant figures, even if the last digit was wrong. (and only the last one would be wrong) Any of these would be fine with me, and, I think, I whole lot more useful than just dates. Trying to resolve particle physics level time and dates in the same package would be a whole lot more work (if even possible), and have limited usefullness. When I do any kin dof time series analysis, I convert everything to units if delta-t from the start of the record (or something like that) anyway, that way I can use standard FFT and other routines. Anything that relied on a Python DateTime module would have to do all the analysis in Python, and be dreadfully slow. Would any of you actually use a DateTime module for an application that would require incredably small resolution?? By the way, the only technical objection I have heard to the mxDateTime module is that it take 32 bytes (or maybe more) per DateTime object. Is this a problem for the kind of applications you all forsee using such a package for? -Chris -- Christopher Barker, Ph.D. ChrisHBarker at home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From jason at jorendorff.com Sat Dec 15 16:43:37 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Sat, 15 Dec 2001 15:43:37 -0600 Subject: Recursive update of arbitrarily nested dicts In-Reply-To: Message-ID: > I am writing a module where I am updating nested dicts, and it has this > method: > > def addDayToTrack(self, trackId, year, theDay, day): > if not self.tracks.has_key(trackId): > self.tracks.update({trackId:{year:{theDay:day}}}) > elif not self.tracks[trackId].has_key(year): > self.tracks[trackId].update({year:{theDay:day}}) > elif not self.tracks[trackId][year].has_key(theDay): > self.tracks[trackId][year][theDay] = day def addDayToTrack(self, trackId, year, theDay, day): """ Not the recursive solution you're seeking, but better anyway """ trackDict = self.tracks.setdefault(trackId, {}) yearDict = trackDict.setdefault(year, {}) yearDict[theDay] = day -- Jason Orendorff http://www.jorendorff.com/ From printers at sendme.cz Mon Dec 3 05:06:04 2001 From: printers at sendme.cz (A) Date: Mon, 3 Dec 2001 11:06:04 +0100 Subject: How to compare text? Message-ID: <3C0B5C9C.10969.755101@localhost> Hello, How can I compare of one parragraph of text with another paragraph?Each paragraph can have about 100 words. For example I have the first paragraph I want to be very good at Python programming. Better than in Perl. THe second paragraph might look loke this: She works all day long to master Perl. All that I need is to find out if any of word from the second is in the first paragraph. For the example above I should find out word Perl What is the best and quickest way? Thank you for help. Ladislav From wurmy at earthlink.net Fri Dec 28 22:10:30 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Sat, 29 Dec 2001 03:10:30 GMT Subject: REPOST: Re: Is this a bug? References: <33e9b770.0112281857.563a36d4@posting.google.com> Message-ID: <6$--$$_----_-%$%%$@news.noc.cabal.int> Gilbert wrote: > > Hi! > > I am wondering if the following results below imply any bug in Python > 2.2 or 2.1? > When I try to use float numbers, python 2.2 and 2.1.1 shows a little > bit different results (I think it is incorrect) from what I enter. > But python 1.5.2 seems to be okay? What is wrong? This behavior is explained here: http://www.python.org/doc/current/tut/node14.html --Hans ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Hans Nowak Newsgroups: comp.lang.python Subject: cmsg cancel <3C2D32DC.CE188A04 at earthlink.net> Control: cancel <3C2D32DC.CE188A04 at earthlink.net> Date: Mon, 31 Dec 2001 03:39:46 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774902 27193 211.57.49.2 (31 Dec 2001 05:01:42 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:01:42 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From aahz at panix.com Sun Dec 23 13:39:44 2001 From: aahz at panix.com (Aahz Maruch) Date: 23 Dec 2001 10:39:44 -0800 Subject: Looping constructs References: <3c25d37e_9@news.newsgroups.com> Message-ID: In article , Courageous wrote: > >Comparing Python to Perl. For shame. Perl is a write only language. That's not really true. OTOH, to make it not true, one has to stay away from Perl esoterica.... -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 8 days and counting From mkelly2002NOSPAM at earthlink.net Sun Dec 2 15:34:41 2001 From: mkelly2002NOSPAM at earthlink.net (Michael Kelly) Date: Sun, 02 Dec 2001 20:34:41 GMT Subject: COM "out" Variant Array params and such Message-ID: I like to roll my own COM and ActiveX components and I've been experimenting with using them(they are mostly written with Delphi 5 as "automation server" or ActiveX inprocess dlls or ocxs) with ActivePython version of Python 2.1. I have an Ini File component that wraps the Delphi TIniFile class that works fine for D5, VB6 and VC++6 but in Python I get some strange errors and also a quandry. The quandry is I can't figure how to make a call that has an "out" parameter that is not a retval and is a Variant Array. When I make the call in Python as in MyIniFile.ReadSections("Section name", VariantArrayofStrings) whatever I put for VariantArrayofStrings never get assigned anything. I read some stuff in the docs about coercing PyObject and Variants but with no real pointers where to see how this is done. The weird behavior is if I use the method WriteDate to write a date and then ReadDate to read it back I get an exception: type: exceptions.SystemError value: error return without exception set I have no idea what this means except maybe the exception mechanism has a problem. I used makepy.py to make a coclass that I import to use the Ini File COM object. At any rate neither of these seem to be an issue in Delphi 5, VB 6 or VC++6. I even tried the underlying TIniFile type is a Delphi test program to make sure it reads correctly dates written with WriteDate method. I seem to be able to Write dates and times to the ini file ok. Reading them back causes this exception, but I can read them in as strings I suppose and then convert the string by some means back to a Date or Time but that kind of kills off the convenience of using this nifty component(TIniFile that I wrapped up in COM.) Any ideas appreciated. :) Mike -- "I don't want to belong to any club that would have me as a member." -- Groucho Marx From James_Althoff at i2.com Thu Dec 6 16:57:39 2001 From: James_Althoff at i2.com (James_Althoff at i2.com) Date: Thu, 6 Dec 2001 13:57:39 -0800 Subject: more fun with PEP 276 Message-ID: Jeff Shannon wrote: >If you *always* have half-open intervals (in the same direction), then you will >know, almost without thinking about it, which way any corrections have to be >made. If you sometimes have half-open, sometimes closed, sometimes >reversed-half-open, sometimes fully open, etc... then you will constantly be >having to check what you're doing in *this* case, look back at what you've >done, think through in detail what the effects are, etc, etc. (There should be >one, and preferably *only* one, obvious way to do it.) >In most cases, I'd expect the underlying source of the data to behave according >to 0-based half-open intervals. If it doesn't, I'd correct it at the >interface, instead of in the range()-- > >left = getLeftSide() - 1 >right = getRightSide() - 1 >for i in range(left, right): ... > >Not perfect, perhaps, but at least explicit. >They are *always* the same, therefore no visual mechanism is needed. The fact >that it says "range" tells me that it's closed left and open right. I don't >have to worry about any other possibility. >This is a recipe for confusion. If you can't rely on the half-open interval >being always the same, then it *will* bite you eventually, and a lot worse than >people currently get bit by range()'s behavior (which is at least predictable). Yes, "closed on the left, open on the right" intervals are very common. In fact, that is what helped motivate PEP 276 -- making it *really* easy to deal with such intervals when accessing items in a structure by index: for i in table.rowcount: for j in table.colcount: print table.value(i,j) Here, i and j both use "closed on the left, open on the right" intervals (0 to "len"-1). But "very common" is not "always" and some of the posters in the PEP 276 thread seemed to be interested in making it more convenient and *explicit* when one deals with other types of intervals. As in, for example, David Eppstein's: for n > i >= 0: for i < j <= n: if i == j-1: V[i,j] = id else: V[i,j] = min([q(i,k,j) @ V[i,j] @ V[j,k] for i < k < j]) or the equivalent: for i in n > ... >= 0: for j in i < ... <= n: if i == j-1: V[i,j] = id else: V[i,j] = min([q(i,k,j) @ V[i,j] @ V[j,k] for k in i < ... < j]) I believe that many Python users think it would be good to have some mechanism that is *more explicit* than range/xrange when dealing with intervals. I don't think -5 // span // 5 is the ideal syntax. I think it would be much better if one could write: -5 <= ... <= 5 I would like to see a class Interval (named IteratorBounds in my posted example implementation) that contains start, stop, step, left, and right values where you could create interval instances using the syntax of relational operators. Such intervals could be specified in any context where expressions are valid and would yield iterators in for-loops and other places where iterators are called for. Python, as is, doesn't support this (unless I'm missing something). So I showed how this could be approximated with the -5 // span // 5 equivalent. I found it very handy when playing around with it. Again, if -5 <= ... <= 5 could be made to work, it would be *really* nice (in my view). Even for "closed on the left, open on the right" intervals I would prefer: for i in ... < table.rowcount: for j in ... < table.colcount: print table.value(i,j) over: for i in xrange(table.rowcount): # yes, I have a *lot* of rows for j in range(table.colcount): print table.value(i,j) Jim From tim.one at home.com Sat Dec 15 13:57:19 2001 From: tim.one at home.com (Tim Peters) Date: Sat, 15 Dec 2001 13:57:19 -0500 Subject: Printing complex numbers In-Reply-To: Message-ID: [Stephen Boulet] > I know that for floats you can do: > > print '.3f' % x > > or > > print '.3e' % x You need "%" signs in there. > But how do you do the same for complex numbers? There isn't a special format code for complex; so print x.real and x.imag separately, e.g. >>> x = 12.5+3.24j >>> print "%.3f%+.3fj" % (x.real, x.imag) 12.500+3.240j >>> If you want "the usual" str() or repr() form of a complex number, just use %s or %r (respectively) in the format. >>> print "%s" % x (12.5+3.24j) >>> From logiplexsoftware at earthlink.net Tue Dec 4 20:47:59 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Tue, 4 Dec 2001 17:47:59 -0800 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) In-Reply-To: References: Message-ID: <01120417475903.01465@logiplex1.logiplex.net> On Tuesday 04 December 2001 16:58, Tim Peters wrote: > I've lost track, but I'm pretty sure it was either because the example > used tabs, or because it used spaces. After reading this entire thread, I think there are valid arguments on both sides, so I'll be avoiding both tabs and spaces in all my code. -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From aleax at aleax.it Fri Dec 28 11:00:14 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 17:00:14 +0100 Subject: REPOST: Re: strange Tkinter problem References: Message-ID: <8$--$$_----_---$_$@news.noc.cabal.int> "tjiit" wrote in message news:a0baad$vu4$01$1 at news.t-online.com... > I have an application using a Tkinter GUI which starts a network > connection if you click on a button. The strange thing is that the GUI > freezes and the connection is established. Does this mean that Tkinter > executes the functions bound do an event and then returns when the > function has ended? I thought it would to kinda multi-threading so it No! If threads were generated "behind your back", you'd have a very hard time handling the resulting mess. > could handle large events and keep interactive while doing it. > Can anyone give me a (some) hints? http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82965 The Recipe is about the other, harder half of the problem -- a thread different from the GUI-controlling one wants to talk with the GUI-thread. Starting a new thread from the GUI one (e.g. from a callback: all callbacks run on the GUI thread!) is easy, with module threading; the problem is coordinating multiple threads, and the recipe helps with that part. Alex ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Alex Martelli" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:52:03 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775263 27193 211.57.49.2 (31 Dec 2001 05:07:43 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:07:43 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From huaiyu at gauss.almadan.ibm.com Mon Dec 3 14:06:48 2001 From: huaiyu at gauss.almadan.ibm.com (Huaiyu Zhu) Date: Mon, 3 Dec 2001 19:06:48 +0000 (UTC) Subject: What's the value of "None" between 2.1.1 and 1.5.2 References: Message-ID: On Fri, 30 Nov 2001 13:10:37 -0500, Tim Peters wrote: > After that, backward compatibility kicked in (e.g., there are many >complaints that non-equality comparison of complex numbers now raises an >exception, and despite that the result we used to return didn't make much >sense). Maybe I'm reading too much into this (backward compatibility): does it imply that sort() works with complex numbers in 2.2? (I have not tried 2.2 and I have not found it in the overview docs.) That would be good. Excluding complex numbers in sort() does not sound right when the following is regarded necessary evil (happens often when a number is read from file): >>> if a < b: print a, '<', b ... 1 < 0 It seems to me that the opposite rule is more reasonable: - sort() works for any objects (using default total order when necessary). - '<' and friends only work for explicitly defined types (a partial order). Huaiyu From buzzard at urubu.freeserve.co.uk Mon Dec 10 10:59:19 2001 From: buzzard at urubu.freeserve.co.uk (Duncan Smith) Date: Mon, 10 Dec 2001 15:59:19 -0000 Subject: A pretty dumb newbie question References: <20011203212412.12737.00000727@mb-cs.aol.com> <20011210091906.16346.00001379@mb-ma.aol.com> Message-ID: <9v2m4c$bdl$1@newsg3.svr.pol.co.uk> "davewesterman" wrote in message news:20011210091906.16346.00001379 at mb-ma.aol.com... > sqrt(x) > Return the square root of x. > > >How would you calculate square root? I've tried > >x**1/2 > >Which doesn't work > >Anbody? > How about, >>> x**(1/2.0) 2.8284271247461903 What you have will raise x to the power 1, then divide the result by 2. Also, note the float in the denominator. 1/2 will return the floor (the result rounded down to the nearest integer), ie 0, and x**0 is 1. > > *)(*()*)(*()*)(*()*)(*()*)(*()*)(*()*)(*()*)(*()*)(*()*)(*()*)(*()*)(*()*) > (*()*)(*()*)(*()*)(*()*)(*()*)(*()*) From rdsteph at earthlink.net Thu Dec 27 17:15:04 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Thu, 27 Dec 2001 22:15:04 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <3$--$$_----_-$-_%$@news.noc.cabal.int> I just think that it is difficult for for-profit corporations to justify hiring and keeping highly paid developers to work on Python development. Granted Python was originally and primarily developed by open source volunteers, as are most such languages. But it is sure nice having the support of Digital Creations, ActiveState, etc. I am not "knocking" ActiveState, really I can understand their dilemna. How do they generate enough revenues with a Python development team to pay for itself and make a profit? Not easy, I fear; and the economy, which is definitely slowing, sure doesn't help. I hope Digital Creations can make money on Zope, the more the better. I urge us all to support Zope in any way we can (and for that matter, to support any ActiveState Python products we can, and Secret Labs, PythonWare, etc. etc. etc. Python will do better if it has commercial support, in addition to open source volunteers. Of course we need the open source community; without Guido and the rest of the community, there would be no Python. But enthusiastically support any commercial enterprise that supports Python, I say. I especially hope that Zope can be a big money maker for Digital Creations. But I suspect that it is a tough business model they have. I think we should be grateful to them for supporting Python so vigorously and in such important ways. I recently read an interview with a Digital Creations top manager where he said that he hopes someone starts a successful business based solely on providing ISP services using Zope, with full technical support. Is anyone looking into this? Does anyone think this could be a successful business model? I am interested in opinions on this. Ron Stephens http://www.awaretek.com/plf.html Justin Sheehy wrote: > Ron Stephens writes: > > > Furthermore, Ruby is aimed right at the heart of Python's niche. > > What niche is that? > > More importantly, why does this matter? The "aimed right at the heart" > phrasing makes it sounds as though one must defeat and replace another. > > There's no reason why Ruby can't do just fine without this meaning > anything negative about Python. > > > If we view Microsoft's Visual Studio, especially Visual Studio.net's C# > > and VB, as the official 800 lb. gorilla of software development; and if > > we view Java as the 400 lb. gorilla pretender to the throne; and if we > > view Borland's Delphi and Kylix as no more than a smart leader of a > > chimp; then everything else is the pack of open source chimps. > > Oh, you live in a windows-only world. > > Those are definitely all big players, but a lot of large and > significant software happens in environments where VB et al are simply > not viable options due to the fact that they tie you so tightly to one > vendor's platform. > > Python runs in more places than any of the products/languages that you > mention, and this matters a lot to a large number of people. > > > Ruby folks include those who like its more Perl-like syntax > > They can keep it. I love not having line noise mixed in with my programs. > > > They see Python as a compromise between object oriented and > > procedural programming. > > So? Idealists are fun to talk to, but compromises get work done just fine. > > > What so you all think of Ruby, and its impact on Python? > > Ruby - seems decent enough, but I have no reason to use it other than > playing around and because I like seeing how new and different > language implementations work > > Ruby's impact on Python - Not much. For a while the biggest impact > was that a few people would yell about Ruby's superiority at > inappropriate times in various non-Ruby-related forums. That > seems to have died off, and now Ruby seems to be doing just > fine for a young language. This doesn't really mean all that > much to Python, as it is extremely unlikely that either of > these two languages will fully supplant the other. > > > 2. The economy is hurting Python's open source development model. > > It is? From my observations, Python itself has seen far more > aggressive development in the past year or so than in any of the > previous several years. Other than the one comment about Mark > Hammond's situation, what makes you say this? > > -Justin > > ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2B9E04.9957801F at earthlink.net> Control: cancel <3C2B9E04.9957801F at earthlink.net> Date: Mon, 31 Dec 2001 01:36:36 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775552 27193 211.57.49.2 (31 Dec 2001 05:12:32 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:12:32 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From fperez528 at yahoo.com Sun Dec 2 16:17:12 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Mon, 03 Dec 2001 20:45:12 +2328 Subject: Draft PEP: string interpolation with backquotes References: <9uh67a$eoe$1@peabody.colorado.edu> Message-ID: <9uhgv5$mhr$1@peabody.colorado.edu> phil hunt wrote: >> >>than *any* of the existing alternatives in python. Here it is: >> >>In [23]: itpl(" Pos: ($i,$j,$k), Dist = $sqrt(i**2+j**2+k**2), \ >> ....: Corr = $C[i][j][k]") >>Out[23]= ' Pos: (1,2,3), Dist = 3.74165738677, Corr = 5' >> >>I read that line and I can know exactly what it's doing, what it >>evaluates and what data it will show. And I can dig out examples >>where things are 100 times more complicated than this. > > I have *no problem* with this at all. It doesn't involve extending > the syntax of python, and incidently demonstrates that Python > already does what you want. I know it does, as I've said, I'm already using Itpl extensively. And if there is consensus on the unreasonability of extending the language I can live with that and continue to use Itpl. See my other post a few minutes ago on this same thread for details. > > At the moment, when you see a quoted string in Python source code > you know it is a string literal, whose value is fixed at compile > time. Well, that still leaves a lot of room for interesting behavior. The value of the string is fixed, but what really happens with it when you run it through % isn't (and ultimately that's what matters, since the internal value of the format string is rarely of interest). Any class that implements __str__ can still give you interesting run-time surprises: In [28]: class BlowUp: ....: def __str__(self): ....: 1/0 ....: In [29]: x=BlowUp() In [30]: s='x is %s' In [31]: s Out[31]= 'x is %s' In [32]: s % (x,) --------------------------------------------------------------------------- ZeroDivisionError Traceback (most recent call last) ? ? in __str__(self=<__main__.BlowUp instance>) ZeroDivisionError: integer division or modulo by zero See? Python is a dynamic language through and through, whether we like it or not. By the way, that last thing wasn't meant to defend my interpolation idea, just to show that Python's dynamic behavior is very much at the core of the language, for better or worse. I happen to like it, actually, but I know it can open the door to very crazy things. Cheers, f From jafo at tummy.com Tue Dec 18 21:20:17 2001 From: jafo at tummy.com (Sean Reifschneider) Date: Tue, 18 Dec 2001 19:20:17 -0700 Subject: ANN: ciphon 0.3.4 In-Reply-To: ; from andy47@halfcooked.com on Wed, Dec 19, 2001 at 12:55:36AM +0000 References: Message-ID: <20011218192017.A20068@tummy.com> On Wed, Dec 19, 2001 at 12:55:36AM +0000, Andy Todd wrote: >I managed to download the tar.gz from ftp.community.tummy.com but I had to >use command line ftp. Every time I tried to access this from a web browser >it crashed. Just FYI. Oops. Some browsers don't deal very with with a certain format of response in the "ls" data. I have made a patch to the FTP server so that it writes the data in the "old" format which some browsers, in particular Netscape, can handle better. Sean -- Read error: 666 (Connection reset by Satan) Sean Reifschneider, Inimitably Superfluous tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python From mickey at tm.informatik.uni-frankfurt.de Tue Dec 11 07:43:21 2001 From: mickey at tm.informatik.uni-frankfurt.de (Michael 'Mickey' Lauer) Date: 11 Dec 2001 14:43:21 +0200 Subject: pyCFontz.py on Windows Message-ID: <3c160d79@nntp.server.uni-frankfurt.de> FYI: I have added Windows support to the pyCFontz module from Ben Wilson. The pyCFontz module drives the serial port CrystalFontz LCD modules - it used to work only on linux, now it also works on windows - mainly because of the fine Serial module by Roger Burnham. If you need the module right now, contact me. I will supply a patch to Ben Wilson ASAP. Yours, :M: From MarkH at ActiveState.com Tue Dec 11 18:21:42 2001 From: MarkH at ActiveState.com (Mark Hammond) Date: Tue, 11 Dec 2001 23:21:42 GMT Subject: win32service win32pipe question References: <93wR7.6168$Rw2.4468272@newssrv26.news.prodigy.com> Message-ID: <3C1695A2.30103@ActiveState.com> dsavitsk wrote: > i followed the example of making a win32service in Mark Hammond's book. > when i run the client i get the following error. does anyone know what this > might be from? > > X:\epsp2\server\bin>PipeServiceClient.py hello there service > Traceback (most recent call last): > File "X:\epsp2\server\bin\PipeServiceClient.py", line 8, in ? > data = win32pipe.CallNamedPipe(pipeName, message, 512, 0) > pywintypes.api_error: (2, 'CallNamedPipe', 'The system cannot find the file > spec > ified.') CallNamedPipe assumes some other process has opened the pipe and is reading from it. It appears this has not happened - ie, the pipe does not exist. Mark. From Tom.Karas at htp-tel.de Sat Dec 15 16:21:19 2001 From: Tom.Karas at htp-tel.de (Tom Karas) Date: Sat, 15 Dec 2001 22:21:19 +0100 Subject: How 2 invoke python 2 read from text file under W2k Message-ID: <3C1BBECF.E460DBEC@htp-tel.de> Hello World, in the tutorial: "Instant Hacking" theres is this little programm: "# Area calculation program". Which apparently must be written into a text file and then somehow the python interpreter as to "compile" this file. My problem is, that i do not know how to tell python to read a text.file and to "compile" it. I read the following lines of the "Python Tutorial" from Guido van Rossum a.o. and tried both solutions under Windows 2000 to use a text.file as input source - but none of them worked. Quotation from the tutorial: "Note that there is a difference between "python file" and "python Message-ID: <20011204110657.139799b7.use-net@schabi.de> Hi, On Tue, 04 Dec 2001 10:57:23 +0200 mixo wrote: > I am current trying to drop 'RTS' (Request To Send) > on a serial port. In 'c' I do the following : > > ++++++++++++++++++++++++++++++++++++++++++++++++ > . > . > > int fd, mdlns;//fd is a file discriptor > . > . > > ioctl (fd, TIOCMGET, &mdlns); > mdlns &= ~TIOCM_RTS; > ioctl (fd, TIOCMSET, &mdlns); > . > . > . > +++++++++++++++++++++++++++++++++++++++++++++++ > > What would the equivilent code in 'python' be? > How can I disable 'RTS' on a serial port? Usually, on unixoid Python incarnations, you have the fcntl module which provides an ioctl call. The os module allows you to work with fd filedescriptors. With those, you should be able to translate your example 1:1 to python. Just look into the documentation for the os and fnctl module. markus -- "GPL software is not free - the cost is cooperation" From syver-en+usenet at online.no Sat Dec 22 02:37:20 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 22 Dec 2001 08:37:20 +0100 Subject: RELEASED - Python 2.2 final References: Message-ID: Thanks, that is a mighty nice christmas present. A very merry christmas to all the people who have worked hard to get it out to us. A new years wish: How nice it would be to have a CPAN/Ciphon system working now and so that I could check that I could swiftly download and install all the modules I need in 2.2 versions orquickly check that they are not available yet and then wait some before installing 2.2. -- Vennlig hilsen Syver Enstad From sill at sill.silmarill.org Tue Dec 4 09:27:52 2001 From: sill at sill.silmarill.org (Andrei Kulakov) Date: Tue, 04 Dec 2001 14:27:52 GMT Subject: age of new pythonistas [was: The Editor Poll results are in!] References: <3bfd7f87@news.airtel.net> <9u4cbu$2ts$1@news.xmission.com> <9udn1g$64c$1@brokaw.wa.com> Message-ID: In article <9udn1g$64c$1 at brokaw.wa.com>, Alan Winston wrote: >> it'd also be cool to see the relative age of new pythonistas -- I suspect >> that they're young, but this is completely unfounded. I'm 22. Python is the only language I'd code for pleasure, but it might be just that I don't have enough experience coding perl or c. - Andrei -- Cymbaline: intelligent learning mp3 player - python, linux, console. get it at: cy.silmarill.org From starx at pacbell.net Tue Dec 4 01:32:03 2001 From: starx at pacbell.net (Philip Swartzleonard) Date: 4 Dec 2001 06:32:03 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: Steven Majewski || Mon 03 Dec 2001 06:03:29p: > > > On Mon, 3 Dec 2001, Steve Lamb wrote: > >> On 3 Dec 2001 23:17:22 GMT, Quinn Dunkan >> wrote: >> > Not for me it doesn't, when I use proportional fonts. >> >> Anyone who uses proportional fonts for programming gets what they >> deserve > > Less eye strain ? > Fewer headaches ? Switch fonts when it matters? Any reasonable macroable editor should hopefully be scriptable for this... Xnews and Eudora each have a button to toggle proportional/nonproportional mode so you can use whatever is appropriate, that kind of thing would be nice. (I just use shift-mouse1 in ntemacs, and pick what i feel like at the time :) -- Philip Sw "Starweaver" [rasx] :: From beej at piratehaven.org Mon Dec 24 11:49:51 2001 From: beej at piratehaven.org (beej at piratehaven.org) Date: 24 Dec 2001 16:49:51 GMT Subject: os.fork() References: <3C26FD03.4050301@beth.uniforum.org.za> Message-ID: In article <3C26FD03.4050301 at beth.uniforum.org.za>, mixo wrote: >What does 'os.fork' return? To the parent process, it returns the child's PID. To the child, it returns 0. To get the exit status of the child, you have to have the parent os.wait() for it to complete. (Also see os.waitpid()). Here's a barebones example with really bad error checking: import os pid = os.fork() if pid == 0: print "I'm the child, and my pid is %d!" % (os.getpid()) os._exit(2) else: print "I'm the parent, and I just forked pid %d!" % (pid) (rpid, status) = os.wait() # reap the zombie child print "I'm the parent, and my child %d exited with status %d" % \ (rpid, os.WEXITSTATUS(status)) -Beej From wall at adinet.com.uy Fri Dec 7 22:11:23 2001 From: wall at adinet.com.uy (Walter Moreira) Date: Sat, 8 Dec 2001 00:11:23 -0300 Subject: lost interest? Message-ID: <20011208001123.A5989@casa.parque> Hi. I've been reading some of the catalog-sig archives and I wonder why the interest of the community about something like CPAN is so small. When a message about this thing pops up in c.l.py, it receives only one or two answers and the thread dies, and in catalog-sig usually happens something similar. The arguments about not having a working prototype, I think, are not good. Suchandra Tappa has set up a server with siphon, but nobody has made comments. Why do you think people is not interested? Didn't the community should try to encourage something like siphon? Walter -- -------------- Walter Moreira <> Centro de Matematica <> Universidad de la Republica email: walterm at cmat.edu.uy <> Home Page: http://www.cmat.edu.uy/~walterm From aleax at aleax.it Fri Dec 28 06:22:49 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 12:22:49 +0100 Subject: REPOST: Re: base64.decodestring gives binascii.error References: <3C2C03CB.7030000@pacific-shores.com> Message-ID: <1$--$$_--__-%$__$$@news.noc.cabal.int> "Erik Myllymaki" wrote in message news:3C2C03CB.7030000 at pacific-shores.com... > should base64.decodestring give a binascii.error if it encounters > special chars like '_' and '!' ? Makes sense to me; after all, such characters should never be in a string produced by base64, so the data must have been damaged in transit -- raising an exceptions seems appropriate. Alex ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!nycmny1-snh1.gtei.net!cpk-news-hub1.bbnplanet.com!news.gtei.net!newsfeed1.cidera.com!Cidera!netnews.com!newspeer.cwnet.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail Message-ID: Control: cancel Subject: cmsg cancel From: "Alex Martelli" Newsgroups: comp.lang.python X-No-Archive: yes Lines: 2 NNTP-Posting-Host: wonenara.ozemail.com.au X-Trace: ozemail.com.au 1009643052 203.108.164.177 (Sun, 30 Dec 2001 03:24:12 EST) NNTP-Posting-Date: Sun, 30 Dec 2001 03:24:12 EST Organization: OzEmail Ltd, Australia Distribution: world Date: Sat, 29 Dec 2001 14:51:20 GMT This message was cancelled from within Mozilla. From altis at semi-retired.com Sat Dec 29 03:05:15 2001 From: altis at semi-retired.com (Kevin Altis) Date: Sat, 29 Dec 2001 00:05:15 -0800 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <458b194a.0112282052.1123341@posting.google.com> Message-ID: I couldn't agree more. Thus you won't be surprised that in many ways that is the sweet spot that PythonCard is aiming at. You'll need wxPython 2.3.2 or higher and Python 2.x to give it a try, but you can at least look at screen shots if nothing else. http://pythoncard.sourceforge.net/ We are moving towards a component model, which will give you many of the capabilities you are familiar with from using COM. There is a layout editor (the resourceEditor sample) and automatic event binding and event handlers that should look a lot like what you have used with VB. You can already build standalone Windows executables using py2exe. Input and criticism are welcome. ka "Resty Cena" wrote in message news:458b194a.0112282052.1123341 at posting.google.com... > The real source of growth for both Python and Ruby are the 3M VB > developers worldwide. Whichever can provide what it is that VB > developers like about VB on top of what Python and Ruby natively offer > will hit the jackpot. To me these are: (a) Visual drag-and-drop > application builder with data aware controls, and (b) good support for > the big databases (Oracle, Sybase, Informix). I'm going through the > gui chapters of Mark Lutz' PP2E, and while I can see that handcrafting > gui this way gives me a lot of control, I'm thinking I don't want to > do this -- I'm a database application developer. I want to write a > dynamic work order system and I have no ambition to become a system > tool maker. And so do the 3M VB developers. > > VB used to be a toy language. Not too long ago no respectable company > would use VB for their corporate systems. It did not start to become > an enterprise solution until VB3. What happened there? > > VB 6 will be retired in favor of VB.NET. Personally I think that the > direction VB has taken, towards a verbose C#, is misguided. VB should > have evolved into something like Python or Ruby. With VB.NET, VB > programmers will ask, "What's the point?" Might as well dive into C#. > Or look around for something else. > > Hopefully by that time -- 18 months from now? -- Python and/or Ruby > will have what it is VB programmers cannot live without. > > Folks, come up with (a) and (b) above, then start posting at c.l.vb. > > > Paul Prescod wrote in message news:... > > Dave Thomas wrote: > > > > > > ... Instead, Ruby will attract folks from outside the > > > Python world. Ruby and Python differ in philosophy and _feel_. Some > > > folks like one, some the other. I don't see it as competition. I see > > > it as choice. > > > > Is there really a difference? Pepsi and Coke are choices. They are also > > in competition. They have a somewhat different taste but are more > > similar than different. In the long run, there will come a day when > > they've taken as much of the market share of other drinks away as they > > will, and the primary competition will be between the two of them. > > > > Paul Prescod From tripps81 at yahoo.com Fri Dec 21 12:08:05 2001 From: tripps81 at yahoo.com (Tripp Scott) Date: Sat, 22 Dec 2001 00:08:05 +0700 Subject: marshalling data structures between perl <-> php <-> python In-Reply-To: <83y9jw93i5.fsf@panacea.canonical.org> References: Message-ID: <5.1.0.14.2.20011222000623.0772bd20@202.95.131.154> On 21/12/2001 19:11, Kragen Sitaker wrote: >Tripp Scott writes: > > aside from using XML-RPC, what python module can i use to > > marshall data structures (possibly a combination of lists, > > dictionaries, and scalars of ints, floats, ascii strings, and > > null values) between these three languages? i prefer a compact, > > common binary format rather than XML. > >"common"? Well, there's pickle, but it's not very "common". Can you >give an example of a format you'd like? perhaps i should say something like "is there a php/perl implementation of pickle, or is there a php/python implementation of Storable. or is there another format that already has a perl & php & python implementation." t From LLoeffler at home.com Mon Dec 3 21:40:50 2001 From: LLoeffler at home.com (Luke) Date: Mon, 03 Dec 2001 20:40:50 -0600 Subject: A pretty dumb newbie question References: <20011203212412.12737.00000727@mb-cs.aol.com> Message-ID: <3C0C37B2.7090301@home.com> oops. sorry. You question is really why isn't 1/2 = .5 / is floor division in python. 1.0/2 works as expected or 1/2.0... or 1 * 1.0/ 2 In 3.0, / will be 'normal' division and // will be floor with 2.2 you can "from __future__ import division" to make / behave as expected. (or just multiply by 1.0 to convert to a float before dividing.) 2**.5 will work as expected. 2**0 is obviously 1. Luke From mwh at python.net Fri Dec 7 05:17:03 2001 From: mwh at python.net (Michael Hudson) Date: Fri, 7 Dec 2001 10:17:03 GMT Subject: getting the name of a variable References: Message-ID: James_Althoff at i2.com writes: > It seems though, for the narrow purpose requested here, if you are willing > to turn things around and pass the *name* of the variable instead of its > value then -- using nested scopes -- one could write something like: Which nested scopes? Scopes only nest lexically in Python... > >>> def prvar(x): > ... print x, ':', eval(x) > ... > >>> z = 1 > >>> prvar('z') > z : 1 > >>> > > Might save a little bit of typing. > > >>> def prvar(*varnames): > ... for name in varnames: > ... print name, ':', eval(name), ';', > ... > >>> a = 1 > >>> b = 2 > >>> c = 3 > >>> prvar('a','b','c') > a : 1 ; b : 2 ; c : 3 ; This will only work if you call prvar in the scope which defines it, which is probably a bit too inflexible... Cheers, M. -- I'll write on my monitor fifty times 'I must not post self-indulgent wibble nobody is interested in to ucam.chat just because I'm bored and I can't find the bug I'm supposed to fix'. -- Steve Kitson, ucam.chat From bigredlinux at yahoo.com Sat Dec 1 16:16:04 2001 From: bigredlinux at yahoo.com (Dan Allen) Date: 1 Dec 2001 13:16:04 -0800 Subject: a long shot -> sending output to a browser question Message-ID: <28d73ad6.0112011316.25e17eb2@posting.google.com> This may be far out, but something I have always wondered because I thought I once saw a page do this and couldn't figure out how. Is it possible to trick the browser into thinking the whole page has been sent and begin to display data on the page, and then send more. If you are wondering where I got this crazy idea, it was with the NuSphere installation, which seemed to load the page over a period of time. The reason I ask here, is because they wrote it in perl (and I didn't see any javascript on the page), and I figured it must have been something they were doing with output buffering or something and perhaps python had the same thing. Dan From simonb at webone.com.au Tue Dec 4 21:25:02 2001 From: simonb at webone.com.au (simonb at webone.com.au) Date: Wed, 05 Dec 2001 13:25:02 +1100 Subject: Are there any PEPs for typed arguments? References: Message-ID: <3C0D857E.7080907@webone.com.au> I have found these assertions help sometimes: (1) When the data is used somewhere else to where it is made, this means you have a tough time working out where you goofed, since exceptions are thrown elsewhere. (2) when only one kind of peg goes in each kind of hole, ie. you aren't trying to overload the holes, which maybe happens when (3) you are developing/prototyping/testing, so you want it to fall over as soon as something is wrong, which brings us back to (1). shall i write a song ? -simon > >I think that a better question is why are you adding these asserts in >the first place? > >Are you claiming that "meth" would not work correctly if I passed a >small long for "a" or that I could not use a instance that supports >__getitem__ (that always returns a length 1 string), __len__ and a few >other string methods for "b"? > >So why restrict the use of compatible types? > >Cheers, >Brian > > From drew_csillag at geocities.com Mon Dec 17 11:43:20 2001 From: drew_csillag at geocities.com (Drew Csillag) Date: Mon, 17 Dec 2001 11:43:20 -0500 Subject: Tar for python? Better compressed file archives 'r us? In-Reply-To: <200112170639.fBH6dpk26965@bigboy.bizarsoftware.com.au>; from richard@bizarsoftware.com.au on Mon, Dec 17, 2001 at 05:40:58PM +1100 References: <200112170639.fBH6dpk26965@bigboy.bizarsoftware.com.au> Message-ID: <20011217114320.A1411@localhost.localdomain> On Mon, Dec 17, 2001 at 05:40:58PM +1100, Richard Jones wrote: > Does anyone have tar written in python? I've just compared the difference > between a .zip and .tgz of the same directory structure, and the sizes are: > > -rw-rw-r-- 1 builder builder 3796376 Dec 17 15:39 zope.zip > -rw-rw-r-- 1 builder builder 2270562 Dec 17 15:55 zope.tgz > > (the zip is a zope source tree with the C objects built) > > Having looked at the ZipFile source, I gather that zip compresses the stored > files individually, whereas gzip'ing tar files will take advantage of the > large amount of similarity between the files in the archive. The result being > a loss of 1.5Mb of extraneous download :) > > In the meantime, I'm creating the zip file with ZIP_STORED and compressing > the result... > > -rw-rw-r-- 1 builder builder 2635321 Dec 17 16:20 zope.zip.gz > > ... strange, it's still bigger than zope.tgz... but it's still much better > than the zip file. Can't be read by unzip, but I don't care in this instance. > > Anyone else had any fun in this area? Any ideas why .zip.gz is so much bigger > than .tgz? > > > Richard I've got some code that will read a tar file (it's not pretty, but it's enough to step through it for now). It's at the end of this message. As to why zip files tend to be larger than tar files it's because each of the files in a zip file are compressed separately, whereby in a tar.gz, the whole tar file is compressed as a single unit. Thus the compression in a tar.gz can make use of redundancies across files in the tarball (at least up to the size of the compression block IIRC, but I don't want to get too deep) to improve compression, whereby zip files cannot take advantage of this. As to why the .zip.gz is still considerably larger than the tar.gz, it's because zip files (this holds for .gz files too) don't compress well, if at all because *most* of the redundany has been eliminated already, and since the way it is encoded -- the deflate algorithm in zlib is a mixture of LZ77 and huffman encoding and huffman encoding doesn't generally use full bytes, i.e. it often encodes 1 byte in less than 8 bits (or else it wouldn't be compressing -- duh) -- so the byte boundaries don't necessarily line up and IIRC, neither the LZ77, nor huffman try to find redundancies on a sub-byte level. Cheers, Drew #------------cut here----------- import string import struct def cvtnulloctal(f, k=None): zi = f.find('\0') if zi > -1: f = f[:zi] try: return string.atoi(f, 8) except: return 0 def tarstr(f): zi = f.find('\0') if zi > -1: f = f[:zi] return f def readTar(fileObj): while 1: header = fileObj.read(512) if len(header) != 512: raise EOFError, 'Unexpected end of tar stream' (name, mode, uid, gid, size, mtime, cksum, typeflag, linkname, ustar_p, ustar_vsn, uname, gname, devmaj, devmin, prefix) = struct.unpack( '100s8s8s8s12s12s8s1s100s6s6s32s32s8s8s155s', header[:504]) name, linkname, uname, gname, prefix = map(tarstr, ( name, linkname, uname, gname, prefix)) mode, uid, gid, size, mtime, cksum, devmaj, devmin = map( cvtnulloctal, (mode, uid, gid, size, mtime, cksum, devmaj, devmin)) blocks_to_read = size / 512 if size - (blocks_to_read * 512): blocks_to_read += 1 contents = fileObj.read(blocks_to_read * 512) contents = contents[:size] if name: ecount = 0 else: ecount += 1 if ecount == 2: break if name: #null name fields are normal in tar files, so have to check #here you would do whatever you wanted with the information #in: name, linkname, uname, gname, mode, uid,gid,size,mtime,devmaj #devmin, contents print name, size if __name__ == '__main__': import gzip, sys f = readTar(gzip.GzipFile(sys.argv[1])) #------------cut here----------- From newscheme at hotmail.com Sun Dec 23 02:25:23 2001 From: newscheme at hotmail.com (New Scheme) Date: 22 Dec 2001 23:25:23 -0800 Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic References: <3218013921984060@naggum.net> Message-ID: markj+0111 at cloaked.freeserve.co.uk (MJ Ray) wrote in message > The Scheme community is a warm and welcoming place compared to the Common > Lisp one, I think. Say what?? Let me just repeat Mr Rush's "warm and welcoming" post: --------------------------------------------- David Rush wrote in message news:... > So who the fuck are you anyway? [...] > This is such bullshit... [...] > This is such bullshit, it has to be a troll. You're secretly Erik > Naggum aren't you? [...] > I did it in Scheme because I don't have to fuck around with > a lot of stupid mis-features from 'advanced' languages like > Perl, Python, Tcl, Ruby, or (God help us) C++ and Java [...] > the current generation of no-talent simps graduating into > the CS business. > > Solicit help from the Common Lisp community [...] > They're a bunch of losers who have bought and sold the > lambda-nature for a profit. [...] > So who the fuck are you, Mr. Hotmail.com? -------------------------------------------- > The the open, academic-yet-practical, friendly spirit of > Lisp lives on in comp.lang.scheme and numerous general lisp mailing lists. > We just don't like anonymous posters saying that we got it all wrong. hahaha the "friendly spirit" lives on does it?? hahaha From pythonnet at hotmail.com Thu Dec 27 01:38:39 2001 From: pythonnet at hotmail.com (Andrew Nguyen) Date: 26 Dec 2001 22:38:39 -0800 Subject: A new forum is up! Message-ID: <40dbad98.0112262238.73fc14f9@posting.google.com> A new forum for Python is up. It has a better feel to it than this forum (in my opinion) it is at ezboard at: http://pub19.ezboard.com/bthepythonmessageboard95602! From quinn at chunder.ugcs.caltech.edu Mon Dec 3 18:17:22 2001 From: quinn at chunder.ugcs.caltech.edu (Quinn Dunkan) Date: 3 Dec 2001 23:17:22 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: Just to fan the flames :) On Mon, 03 Dec 2001 09:21:48 -0000, Steve Lamb wrote: > As you just said, "You should be able to configure your editor to display >tabs..." Oh, so a tab isn't a tab. I like indention of 4 so my tab is 4 >spaces. You like 8 so yours is 8 spaces. A tab is not a tab. A tab is a >collection of spaces, visually. > > Now, if you had read my post you would have seen where your whole "a tab >is a tab" bubbub breaks down. Here it is AGAIN since you missed it the first >time. > >some_dict = {'Jane':{'Age':'21', 'Dept':'0001', 'Ext':'1234'}, > 'John':{'Age':'22', 'Dept':'0010', 'Ext':'5678'}, > 'Jeff':{'Age':'23', 'Dept':'0100', 'Ext':'9009'}, > 'Jody':{'Age':'24', 'Dept':'1000', 'Ext':'8765'}, > 'Jeny':{'Age':'25', 'Dept':'0110', 'Ext':'4321'} > } > > With spaces that always comes out the same. With tabs set to different Not for me it doesn't, when I use proportional fonts. >lengths you get different results. The only constant when it comes to >indention is a space. A space is a space. A tab is not constant and >therefore should NOT be used for indention. Ever. A space is not constant either. > Indention isn't about preference, it is about making the code readable. >And as the above example shows, readable code could be rendered unreadable by >tab "preferences". In a proportional font, spaces are usually pretty narrow. Code that uses two spaces to indent is hard to read. Four is sort of ok, but hard to edit. Code that insists on trying to line stuff up with spaces is very hard to read. Code that uses tabs to indent is always readable. Indentation is not the issue, it's the cute formatting. My solution is: 1 - Use tabs to indent. 2 - Lose the cute formatting. The above becomes: some_dict = { 'Jane' : { ... 'John' : { ... } That should come out ok no matter what people do with their tabs or spaces. As long as you stay away from lisp and haskell type indentation. (and in haskell I use real tabs anyway, because the editor gets misled by the literate birdtracks and puts in not-enough spaces) From epovazan at NO-SPAM-ME-telus.net Tue Dec 4 01:57:51 2001 From: epovazan at NO-SPAM-ME-telus.net (Edward Povazan) Date: Tue, 04 Dec 2001 06:57:51 GMT Subject: packages and __init__.py abuse Message-ID: Hello, Being quite new to python, I want to make sure that what I am thinking of doing is considered ok in the python world. Say I have a module mymodule.py and I decide that I could regroup some things to create a "submodule": mymodule mymodule.mysubmodule The only way I see I can do this is by having folders: /mymodule/mysubmodule, and by placing the contents of the original mymodule.py into /mymodule/__init__.py This works, but is this considered bad? Is there an alternative? From my testing (using Jython btw), I haven't found one. Thanks -Ed From dyoo at hkn.eecs.berkeley.edu Thu Dec 27 15:42:31 2001 From: dyoo at hkn.eecs.berkeley.edu (Daniel Yoo) Date: Thu, 27 Dec 2001 20:42:31 +0000 (UTC) Subject: REPOST: Re: cmp [__eq__] References: Message-ID: <7$--$$_----_--_-_$@news.noc.cabal.int> Mark McEahern wrote: :> Perhaps then could someone explain to me how one compares classes :> useing the == operator, or indeed if this bad programming practice. : By overloading the __cmp__ method. Don't confuse the return value of : __cmp__ with whether or not the result of the comparison is that the two : instances being compared are equal. Examine this sample and note that : __cmp__ isn't merely used to determine equality. It is also used to : determine sort order. And if you just want to be able to compare two things for equality, it's probably better to write an __eq__ method instead. Unlike __cmp__, __eq__ is meant to be a boolean function, so it should be more familiar to use. There's more information on __eq__ and the other rich comparison methods here: http://www.python.org/doc/current/ref/customization.html Good luck! ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Daniel Yoo Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:36:47 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775587 27193 211.57.49.2 (31 Dec 2001 05:13:07 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:13:07 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jeff at ccvcorp.com Mon Dec 10 16:04:49 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Mon, 10 Dec 2001 13:04:49 -0800 Subject: PEP 276 Simple Iterator for ints (fwd) References: <9uomtp$e1cbj$1@fido.engr.sgi.com> <9up46o$e2ost$1@fido.engr.sgi.com> <3C150188.C31AC4B8@ccvcorp.com> Message-ID: <3C152371.417CE582@ccvcorp.com> David Eppstein wrote: > In article <3C150188.C31AC4B8 at ccvcorp.com>, > Jeff Shannon wrote: > > > (I still strongly dislike the proposed notation, though.... Maybe > > it's a style thing--I'd usually much rather have a clear function call > > than clever operator tricks.) > > The two objections I have to the current "clear function call" (range and > friends) are first, you can't understand it unless you crack that manual > and have it tell you what the arguments mean and what the difference is > between range and xrange, which is no good for writing code that > non-Python-literate programmers can quickly and easily understand, and > second, even for Pythonists, it doesn't lead to clear code unless what you > need is half-open-on-the-right intervals with integer bounds, which only > cover some of the uses of range. > > For example, suppose you want to loop over the set of integers i satisfying > x <= i < y (the usual half-open interval), but you need them in reverse > order, and x and y may be non-integer. As far as I can tell, the "one > right way" of doing this is > import math > for i in range(int(math.ceil(y-1)),int(math.ceil(x-1)),-1): ... > Despite having some idea how range works I checked this in the interpreter > and had to correct multiple mistakes: forgot the "math.", misspelled "ceil" > as "ceiling", and incorrectly used floor(x+1) instead of ceil(x-1) in the > second argument. And there's still a possible bug when integer unification > comes around and makes long an acceptable argument for a range. This is a > "clear function call" compared to > for y > i >= x: ... I would suspect that, for most Python programmers (you are likely an exception), 99% of the for-loops they will write will have integer bounds and be most useful with half-open (closed lower, open upper) ranges. As far as range() being unclear, when I first started learning Python, I could guess almost immediately that "for i in range(10)" would iterate 10 times. The only catch is learning the zero-based-half-open rule--which fits *so* perfectly into list-indexing rules that it is the only sensible default. And to my mind, providing syntactic support to make it easy to generate ranges in any variety of open/half-open/closed intervals, will only increase the confusion. I would suggest that the reasons that you dislike range(), are that your applications of it are far from typical. 1. It's rare to need range() or an equivalent in anything other than for-loop context. 2. It's rare to need to use anything other than integers to base your for-loops on. Needing to specifically get the ceiling of two floating-point values in order to determine your starting and ending points is *very* rare. 3. It's fairly rare to need to use anything other than 0 as a lower bound. Having to explicitly state "0 <= ..." adds typing to the common case, whereas with range() it becomes a convenient default. 4. Even though it is very rare to need a step size other than 1, adding that to range() is fairly clear and simple. All of the suggestions for adding a step size to the "x < .... < y" syntax have been ugly and unworkable, to the point where everyone has agreed that it's not worthwhile. Which leaves anyone wanting such a step size having to seek out range() anyhow... 5. It's rare to need anything other than closed lower, open upper intervals, especially since the most common use of the for-loop index is to index into a list. I think that range(len(list)) is more clear than 0 <= i <= len(list) -- oh, wait, should that be 0 < i < len(list)? or 0 <= i < len(list)? (Yes, I know, it's the last one, but I had to think about it for a bit--and the asymmetry of the operators involved creates a mental clash, for me.) I admit that the proposed notation more closely resembles mathematical standards. However, I submit the notion that relatively few Python programmers are mathematicians. I think that it is far more sensible to have Python syntax make sense to non-mathematicians--those who *are* mathematicians are probably better equipped to figuring out the details than those who aren't. ;) In short, I see this proposal as complicating the most common cases ( "for i in range(10)", "for i in range(len(mylist)" ), with only small gains for most less-common cases. While pathological cases for range() can be found, as you've demonstrated, those cases seem like they'd be extremely rare (for most problem domains). Jeff Shannon Technician/Programmer Credit International From bup.schaefer at freenet.de Fri Dec 14 02:43:26 2001 From: bup.schaefer at freenet.de (bup_schaefer) Date: Fri, 14 Dec 2001 07:43:26 -0000 Subject: question: clipboard in Tkinter? Message-ID: <9vcaiu+7h5g@eGroups.com> Hello, with clipboard_append I can copy the text content of a widget in the clipboard. My question: How is it possible to copy (by the program,not with ctrl-V)the content of the clipboard to a widget? Many Thanks for your answer, Bruno Sch?fer From Kevin.Smith at sas.com Wed Dec 5 10:40:24 2001 From: Kevin.Smith at sas.com (Kevin Smith) Date: Wed, 05 Dec 2001 15:40:24 GMT Subject: Interactive unbuffered STDOUT Message-ID: <9ulf58$1rr$1@license1.unx.sas.com> Is there a way that sys.stdout can be switched to unbuffered during execution? I know that you can set the PYTHONUNBUFFERED environment variable or use the -u option, but those have to be done before the interpretter is loaded. I see that there is a bufsize option on the open() function. If I could recreate sys.stdout with bufsize=0, that would be great. Kevin Smith Kevin.Smith at sas.com From jafo-pythonlist at tummy.com Tue Dec 18 05:37:49 2001 From: jafo-pythonlist at tummy.com (Sean Reifschneider) Date: Tue, 18 Dec 2001 03:37:49 -0700 Subject: lost interest? In-Reply-To: <20011208001123.A5989@casa.parque>; from wall@adinet.com.uy on Sat, Dec 08, 2001 at 12:11:23AM -0300 References: <20011208001123.A5989@casa.parque> Message-ID: <20011218033749.B2101@tummy.com> On Sat, Dec 08, 2001 at 12:11:23AM -0300, Walter Moreira wrote: >I've been reading some of the catalog-sig archives and I wonder why the >interest of the community about something like CPAN is so small. When a The problem is largely related to a lack of critical mass. Nobody uses it because nobody uses it. This was my opinion in March of 2000 at Python 9 when I showed off my working prototype of a client and server CPAN-like system, and it would still seem to be the case. The system I showed back then had the ability to catalog packages based on their version, platform, and type. For example, it could keep track of a package's distutils source, i386 binary RPM, HP-PA binary .deb, etc. It also tracked the idea of a cluster of mirrors. The client I had would allow you to searcn, download, and/or install the specified packages. It would repeatedly try random machines in the list of mirrors automatically, download, build RPMs from distutils source, and install them. A fairly complete system... I demonstrated it at Python 9, and then we got together in the cataloging SIG to speak about packaging further. Active State promised to open up their tool, which doesn't seem to have happened. I expressed the idea that I thought packages should, as much as possible, be handled using the native system packaging format (using RPMs and .debs, for example), and the idea of needing critical mass. We also talked about making a python-specific packaging system, which had some benefits and some drawbacks. On the way home from the conference and the week following it (the week or so leading up to the 2.1 release), I worked to add code to make the distutils package upload packages to the server I had set up. It, however, was never integrated into Distutils... For example, if you'd normally do: ./setup.py sdist you could do: ./setup.py --submit sdist and the source package would be uploaded to my server. AMK had created a PEP for including basic package information into the dist file, which my server could read and use for cataloging. About the only thing that my system didn't include was a security mechanism to prevent the submission of bogus new versions of existing packages, and testing on a range of platforms. After publicizing the implementation and the "--submit" patches to the the main python list and the distutils/catalog sigs, I got exactly *ONE* package upload. So, is it that the people who want it aren't the people who can make it happen? Are the people who want it to happen not motivated enough to actually do something about it? Is it just not really that interesting of a problem? I wish I had an answer there. So, currently the system I built is gathering dust. I've set up resources for Suschandra to host his code. I hope it goes better. So, if you want to see it happen, I'd have these words of advice: Get Involved. Get some packages uploaded, use it, advocate it... Sean -- Examine what is said, not who speaks. (Arabian Proverb) Sean Reifschneider, Inimitably Superfluous tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python From syver-en+usenet at online.no Fri Dec 14 19:20:56 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 15 Dec 2001 01:20:56 +0100 Subject: Does httplib support keep-alive connections? References: <3C18CD59.4030100@fake.nl> Message-ID: Use the source luke, lib/httplib.py there pretty good documentation on how to use keep alive. (Though I've never actually tried) -- Vennlig hilsen Syver Enstad From philh at comuno.freeserve.co.uk Thu Dec 27 12:48:13 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Thu, 27 Dec 2001 17:48:13 +0000 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: On Thu, 27 Dec 2001 03:58:52 GMT, Ron Stephens wrote: >OK, so its between the holidays and the newsgroup is quiet, so maybe I >dare waste a little bandwidth with that most useless (but fun) >commodity: gossip. > >How is Python doing popularity wise? After such a meteoric growth >thought the nineties, and a spectacular climax in 2000 and early 2001, >is Python leveling out, going dot.bust, or still not yet at the knee of >the software world's most spectacular growth curve? > >I'd be interested in some comments and observations and opinions from >others. Meanwhile, here are a few of my own: > >Python, while fabulously successful, is at an interesting point in its >growth curve. It will be difficult to maintain the extremely high rate >of growth exhibited so far; new contenders are possible problems; and >the recessionary economy could also negatively impact Python's growth. > >1. Ruby is an especially interesting competitor to Python. I have been >monitoring the Ruby newsgroup, and it shows incredible growth and >vitality. Furthermore, Ruby is aimed right at the heart of Python's >niche. >From what I've seen of it, Ruby is quite similar to Python; however, Python has more developers, more libraries, etc. I see no compelling reason for me to switch to Ruby. >If we view Microsoft's Visual Studio, especially Visual Studio.net's C# >and VB, as the official 800 lb. gorilla of software development; and if >we view Java as the 400 lb. gorilla pretender to the throne; and if we >view Borland's Delphi and Kylix as no more than a smart leader of a >chimp; then everything else is the pack of open source chimps. Just as Python can compile to the JVM, I'm sure it will compile to Microsoft's .net platform. >The open source world is still led by PERL, but PERL is truly more of a >text processing, web CGI, scripting specialist; not so much of a direct >threat to Python. Perl is OK for small programs. I dislike its syntax, however. > PHP is a server side scripting specialist. If Python solutions for serving web pages were more mature/available, this would cause a good deal of growth for Python. PHP as a programming language isn't anything special, but for making dynamic web pages it's a very good tool, as it is easy to use. > Even >JavaScript is strong in its narrow niche of client side web scripting. >Lisp and Scheme dominate thier academic world. But Python aims to be >much more than these; Python aims to be a powerful general purpose >programming language, in addition to being a very easy to learn and easy >to use scripting language. And who can say that Python does not succeed >very well in all of the above? > >But Ruby is also a more general purpose, object oriented, relatively >easy to read, language. Ruby folks include those who like its more >Perl-like syntax, but Ruby's core converts believe that its pure, >absolute object oriented nature exceeds those of Python and make it more >worthy to long term success. They seem to see Ruby as a more modern, >up-to-date version of Python. They see Python as a compromise between >object oriented and procedural programming. I don't want programming to be forcibly OO. In Ruby, can you write a procedure which isn't part of a class? (Like you can in Python, but can't in Java). If not, then Ruby is forcing you to hammer square pegs into round holes. >c. Ruby actually seems to be a nice language to me. Its object oriented >features seem well thought out and yet its still easy to comprehend. I >will never leave Python behind, but will others? What can I do in Ruby that I cannot just as easily do in python? Until that\ question is answered, Ruby will stay behind python in popularity. >Ten years from now, will Python still be Relevant? I think so. I expectb Python to keep growing. As computers get faster, programming in C++ makes less and less sense. People will move over to more high level langauges, such as Java, C#, Perl and Python. Java and C# are roughly on the same level, faster than Perl/Python but slower to code in. Python offers the fastest coding time, as it is "executable pseudocode", so I expect more and more stuff to be done in it. Python runs quickly on my 300 MHz box, which is 3 times slower than the slowest PC you can buy today. It can only get more popular. -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From luruguaya at yahoo.com Tue Dec 11 15:15:36 2001 From: luruguaya at yahoo.com (Lu Ruguaya) Date: 11 Dec 2001 12:15:36 -0800 Subject: NT Service client to Python COM LOCAL_SERVER Message-ID: <30f17542.0112111215.10dd2ccb@posting.google.com> We are having the following problem. We wrote a Python COM Server (CLSCTX_LOCAL_SERVER) and packaged it with py2exe (call it theserver.exe) We have written clients in VB, Python and one in VC++ which is also an NT service. When any of the VB or Python clients run, only ONE instance of the theserver.exe runs. When the VC++ client is run from the Debugger, it uses the running theserver.exe. But, when it is installed as a service and run, then it starts a SECOND copy of theserver.exe (I see 2 in the Task Manager). We tried changing the account under which the service starts to the same account used in the debugger test with the same results (second executable started). Two copies of the theserver.exe is not acceptable for our application (the server is meant to be a singleton). Any ideas? Lu From kragen at pobox.com Sat Dec 1 13:41:32 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 01 Dec 2001 13:41:32 -0500 Subject: PHP vs. Python/comp.lang.php? References: <9tia10$43o$1@dahlia.singnet.com.sg> <3bfcce0b$0$89809$edfadb0f@dspool01.news.tele.dk> <20011129.151831.971899228.1845@hp.com> <83vgfru4la.fsf@panacea.canonical.org> Message-ID: <83itbqsrz7.fsf@panacea.canonical.org> ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) writes: > Kragen Sitaker wrote: > >"%s" % foo in Python is a templating feature. In PHP the whole > >language is a templating feature. What am I missing? > > By templating features, I was refering to a way to separate the html > and code into separate files, one for the html with tags indicating where > to substitute values and one for the code. This is primarily so that > the web designers/graphic artists can fiddle around with the look and feel > without having to know php or python. Likewise, the developers can write > the code without having to worry about the appearance. Doesn't PHP let you call routines defined in another file? That sounds to me like exactly what you're asking for. And Python certainly lets you %-interpolate into strings read from another file. Of course, neither of these really answer when you have blocks of HTML that repeat under programmatic control, unless they're in a third file; but I can't think of a reasonable solution to that. From dalke at dalkescientific.com Wed Dec 19 22:32:38 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Wed, 19 Dec 2001 20:32:38 -0700 Subject: DOM - some pointers References: <9voi51$fco$1@slb7.atl.mindspring.net> Message-ID: <9vrm5n$dni$1@slb3.atl.mindspring.net> Martin von Loewis, on my question of where to learn more about using DOM in Python: >You may want to try getting a copy of "Python & XML", by Jones and >Drake. I don't know whether it is already available; but it certainly >offers lots of examples - small ones and large ones. ORA says it was released this month. The local bookstore has it in the computer system but not on the shelves (would need to order). Bookpool says it's not in stock but can be ordered. So I figure it's just now getting into the system. I've ordered it. Still, it would be nice to have a short document on-line which at least provides a few hints that beginning users of DOM are at least on the right track. Andrew dalke at dalkescientific.com From aahz at panix.com Thu Dec 20 22:59:19 2001 From: aahz at panix.com (Aahz Maruch) Date: 20 Dec 2001 19:59:19 -0800 Subject: Unsung Python modules References: <3dsnad226b.fsf@ute.mems-exchange.org> Message-ID: <9vuc2n$9o2$1@panix3.panix.com> In article <3dsnad226b.fsf at ute.mems-exchange.org>, Andrew Kuchling wrote: > >What's your favorite unsung module? Queue. This should be tattooed on the forehead of every thread programmer. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 11 days and counting From db3l at fitlinxx.com Tue Dec 11 01:07:34 2001 From: db3l at fitlinxx.com (David Bolen) Date: 11 Dec 2001 01:07:34 -0500 Subject: __init__ concerns References: Message-ID: pzw1 at hotmail.com (Peter Wang) writes: > however, the bigger question of properly calling parent classes' > constructors still remains. i figured you can always put a line into > the subclass's constructor: > > def __init__(self, *args): > apply(BASECLASS.__init__, (self,) + args) > > but i thought this was kind of a kludge. what is the proper python > idiom (or, failing that, the proper technique) for ensuring that a > subclass instance is properly initialized, especially when details of > the base class are unknown? As Erik points out, it's sort of unlikely that you would not know what the constructor of one of your base classes needs. However, yes, if you are just subclassing to add functionality and need to override the constructor but are leaving the signature completely alone and want to be as "pass-thru" as possible, the above use of apply() is fairly common. In fact, doing something like this is useful enough that Python 2.0 added support for using *args and **kwargs notation when making a function call in addition to declaring a function. So in Python 2.0+, the above could also be written as: def __init__(self, *args, **kwargs): BASECLASS.__init__(self,*args,**kwargs) (dropping the kwargs part if you know there aren't any) -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l at fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/ From syver-en+usenet at online.no Sat Dec 1 15:44:47 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 01 Dec 2001 21:44:47 +0100 Subject: IOError when printing in Python service after 2 days References: <9TYN7.189006$IR4.70920026@news1.denver1.co.home.com> Message-ID: "Jason R. Coombs" writes: > I'm getting an exception in my code in a print statement. > > I'm running my program as a service using the service classes provided in > ActivePython. > > It's possible that in writing services, I'm supposed to do something with > the output, but I'm not. I have experienced similar things with Python services. Try to redirect stdout with, sys.stdout = something. The something has to have a write method at least as far as I can remember. I you want to reproduce you could just put a couple of print statements in your code and run it as a service. -- Vennlig hilsen Syver Enstad From pete at shinners.org Thu Dec 13 20:54:22 2001 From: pete at shinners.org (Pete Shinners) Date: Thu, 13 Dec 2001 17:54:22 -0800 Subject: Games Made w/ Python References: <9vb0lq$mp3$1@nntp9.atl.mindspring.net> Message-ID: <3C195BCE.4020609@shinners.org> nobody at nowhere wrote: > Thanks for all of the great replies. > I downloaded Python & SDL . > Will Pygame still work with Python 2.2? > And which files do I download? > There's so many of 'em! pygame works with python2.2. there isn't an official binary package for it yet, but i've put together a quick zip file you can install that should work with 2.2. (for windows) http://www.pygame.org/ftp/contrib/pygame-1.2.1-win32-py2.2.zip unzip to your C:\PYTHON22 folder and you should be ready to go. this zip comes with SDL and all the pygame dependencies. you may also want to grab the windows-ed version of the docs and examples, which makes it easy to play with on the start menu. http://www.pygame.org/ftp/pygame-docs-1.2.exe if you have any more questions, feel free to email me direct. From vvainio at karhu.tp.spt.fi Thu Dec 27 07:56:41 2001 From: vvainio at karhu.tp.spt.fi (Ville Vainio) Date: 27 Dec 2001 14:56:41 +0200 Subject: age of new pythonistas [was: The Editor Poll results are in!] References: <60c49aa9.0112202148.7218555b@posting.google.com> Message-ID: Tim Hammerquist writes: > > I think Python is great because it is well designed (unlike Perl), > > Wait, didn't you give up on Perl before you knew it well enough to make > that kind of statement? One really doesn't have to know all that much about perl to make that statement - reading "Programming Perl" or some other perl book is enough. Ditto with TCL. When I see 8 backslashes in a row, I look elsewhere ;-). -- Ville Vainio - http://www.tp.spt.fi/~vvainio - ICQ #115524762 Wild geese have no intention to cast a reflection Water has no mind to assume their form From sholden at holdenweb.com Tue Dec 18 10:56:23 2001 From: sholden at holdenweb.com (Steve Holden) Date: Tue, 18 Dec 2001 10:56:23 -0500 Subject: Cygwin socket library status enquiry References: <20011218131502.GA2268@dothill.com> Message-ID: <2JJT7.22497$PA.5674@atlpnn01.usenetserver.com> "Michael Hudson" wrote in message news:un10gk0v6.fsf at python.net... > "Steve Holden" writes: > > > ----- Original Message ----- > > From: "Jason Tishler" > > To: "Andy Todd" > > Cc: "Steve Holden" ; > > Sent: Tuesday, December 18, 2001 8:15 AM > > Subject: Re: Cygwin socket library status enquiry > [snip[ > > > Andy brings up a good point -- What platform are you using? 9x/Me > > > or NT/2000/XP? > > You didn't answer this question (hint, hint). > OK, I'll 'fess up: this was on Win 98. I'll be trying the same tricks on NT when I can get my network stable enough to make it practical -- at present everything's being reinstalled and/or upgraded. regards Steve -- http://www.holdenweb.com/ From aleaxit at yahoo.com Sun Dec 9 17:44:55 2001 From: aleaxit at yahoo.com (Alex Martelli) Date: Sun, 9 Dec 2001 23:44:55 +0100 Subject: Populating a list References: <32c382ad.0112091404.6cfe4a56@posting.google.com> Message-ID: <9v0ph70g4v@enews1.newsguy.com> mlorfeld wrote: > I am new to python (about 72 hours into learning), and am having > problems with reading a file (sate abbreviations) with one item per > line and populating each line into a list. The problem is that each > item ends with \012 after each state ie WI\012. Yes, the \n character, also known as \012, is indeed part of each line. > Here is the code that I am using: > > f=open('/home/mlorfeld/states.txt', 'r+') > states=f.readlines()#populates a list from file > f.close > print states Perfectly correct code. If you prefer to remove the last character of each line, or perform other alterations, try: states = [ line[:-1] for line in f.readlines() ] instead of just using "states = f.readlines()", which does no alterations. Akex From gh_pythonlist at gmx.de Mon Dec 31 01:18:42 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Mon, 31 Dec 2001 07:18:42 +0100 Subject: Cancel messages Message-ID: <20011231061840.GA5348@lilith.hqd-internal> Le 28/12/01 ? 07:18, Syver Enstad ?crivit: > [...] > ========= WAS CANCELLED BY =======: > Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail > Message-ID: > Control: cancel > Subject: cmsg cancel > From: Syver Enstad > Newsgroups: comp.lang.python > X-No-Archive: yes > Lines: 2 > NNTP-Posting-Host: wonenara.ozemail.com.au > X-Trace: ozemail.com.au 1009643103 203.108.164.177 (Sun, 30 Dec 2001 03:25:03 EST) > NNTP-Posting-Date: Sun, 30 Dec 2001 03:25:03 EST > Organization: OzEmail Ltd, Australia > Distribution: world > Date: Sat, 29 Dec 2001 13:32:11 GMT > > This message was cancelled from within Mozilla. Just curious. What's going on here? A mailman bug from the mail <-> news gateway, or somebody coverage-testing their Mozilla?! Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From kragen at pobox.com Sat Dec 1 05:17:10 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 01 Dec 2001 05:17:10 -0500 Subject: which is best for a singleton, module or class? References: <9sbd8i$680$1@wanadoo.fr> <3BFFACFB.36AF1DB2@engcorp.com> <3C005692.173907B3@engcorp.com> <3C03275E.2C4D8149@engcorp.com> <3C045C07.BA7B3FE6@engcorp.com> <3C05AE56.E2261313@engcorp.com> <3c05b472$1@207.229.64.20> <3C05C9C3.ADC96FB5@engcorp.com> <8ef9bea6.0111290932.4afa618a@posting.google.com> Message-ID: <83elmftfbt.fsf@panacea.canonical.org> hungjunglu at yahoo.com (Hung Jung Lu) writes: > You can simply put your object into the __builtins__ namespace: Please don't do that, except as a joke. Programs have bugs enough without obnoxious people deliberately making them harder to understand. From peter at engcorp.com Fri Dec 28 22:26:12 2001 From: peter at engcorp.com (Peter Hansen) Date: Fri, 28 Dec 2001 22:26:12 -0500 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> <3C2D1833.1D481943@earthlink.net> Message-ID: <3C2D37D4.F06C779C@engcorp.com> Ron Stephens wrote: > > Does anyone know how old PHP is? I'd really like to know. I have not been aware of PHP for much > more than two years, but then I wasn't paying any attention before that. When was PHP "launched"? A quick check with google and "history of php" leads to: http://www.php-center.de/en-html-manual/intro-history.html ... which points out that "PHP was conceived sometime in the fall of 1994" (about a year after the author graduated from an engineering program). It didn't get popular until 95-96 and became more than just the author's personal project in 1997. > How did it grow so fast? Can the Python community learn anything from this phenomenon? Can we even > incorporate some of the good points from PHP for web programming into Python, or Python add-on > "products"? It filled a specialized niche and, for the technology of the time, filled it well. I don't think anything about this applies to Python, since it is neither trying to fill the same niche, nor does it need rapid growth. As for incorporating parts from PHP... what *are* the good points? From the little I know, I'd much prefer Python for web programming, let alone all the other areas where Python shines and PHP doesn't even exist. (By the way, Ron, when quoting material in your reply, could you please find some way to include markers for the quoted lines, like >> or something? It's very hard to read some of your replies without these.) -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From grante at visi.com Tue Dec 4 12:22:30 2001 From: grante at visi.com (Grant Edwards) Date: Tue, 04 Dec 2001 17:22:30 GMT Subject: The Ideals of a Python Hacker (was: Poll Results) References: <3bfd7f87@news.airtel.net> Message-ID: In article , Steve Lamb wrote: > On Fri, 30 Nov 2001 10:38:00 +0900, Jonathan Gardner > >> They'd have to be. I can't seem to find a place to get paid to work in >> Python yet. I can't imagine a guy with 3 kids trying to make a living by >> programming python unless he is the rare guy that has a job in it. > > What does 3 kids have to do with it? You are aware that 25% of the female > population in the US these days does not and will not have children? Why > mention 3 rugrats at all? In my experience people with children tend to make more conservative choices with respect to jobs: they'll choose a less "risky" job in order to provide guaranteed income and benefits for their dependants. People without children are free to choose more "speculative" options where there is a higher risk of intermittent income or health benefits. For example: I have no dependants. I can actually live off of unemployment benefits (I can pay rent, pay bills, pay for COBRA benefits and have enough left over to go golfing once a week). Therefore, choosing a career path that might involve more "fun" or higher peak pay but also risk periods of unemployment is a more viable option for me than it would be for somebody with three children to support. -- Grant Edwards grante Yow! I want to read my new at poem about pork brains and visi.com outer space... From tim.one at home.com Sun Dec 16 00:55:17 2001 From: tim.one at home.com (Tim Peters) Date: Sun, 16 Dec 2001 00:55:17 -0500 Subject: "XXX undetected error" in python_d.exe In-Reply-To: Message-ID: [Courageous] > ... > In retrospect, this appears to be a case of me not knowing exactly > when to use the PyErr_Clear() call. This simply _must_ fall into > the domain of extension authoring esoterica. :-) The 2.2 docs should be clearer about this, but the bottom-line rules are simple: 1. Every C API function call capable of an error return must be checked for an error return. 2. When a C API function call does indicate an error occurred, you must either pass that error on to your caller, or, if you intend to ignore the error, you must call PyErr_Clear() before making another C API function call. It's best not to think too hard about what those rules imply when a destructor gets called by magic ... From peter.milliken at gtech.com Mon Dec 3 16:45:57 2001 From: peter.milliken at gtech.com (Peter Milliken) Date: Tue, 4 Dec 2001 08:45:57 +1100 Subject: Python evangelists unite! References: <3C07884E.75E18DF7@engcorp.com> <9ue2o2$b344@news1.gtech.com> <3C0B08F3.C9CDE885@engcorp.com> Message-ID: <9ugrrt$b345@news1.gtech.com> Yeah, I guess you missed the point. But then you're very busy making money aren't you? :-) So perhaps we shouldn't be too critical :-) The major point was that Python is good for some simple, single person jobs - which you and your mate obviously do, but it is *not* good for larger projects that involve more than one individual (IMO :-)) - this statement has implications on the size of the job in a very direct way. As for Python meeting *all* of the software engineering principles you ever *learned* - well, only you can be the judge of what you did or didn't learn :-). It certainly fails in a number of important areas that I *learned* about software engineering :-). So lets leave it at the fact that we have different educational backgrounds :-). Evangelical support of a language is nice to see, just don't let it blind you to what is available in the way of tools. Python is a tool. Just as a carpenter wouldn't attempt to build a house using only a hammer, I wouldn't attempt to write all of my software using Python. I like Python, I use Python. But I realise that Python has some severe limitations. I wouldn't use Python to "build a house". All you have to do is look at the Pep requests and tools such as PyChecker to realise the deficiencies of the language. Sure it will grow as a result of some of these tools and requests but it has some fundamental design basis that can never change - but it keeps Guido gainfully employed and good luck to him:-). Programmers should be aware of the limitation of any tool in their toolbox and act accordingly (and please, don't throw C/C++ into the argument! I consider C and by extension C++, nothing more than high level assembler! :-)). There are a great deal of very mature languages out there that provide greater support for programming in the large. You could stick with Python as it matures and continually shoe-horn your design into its features and as long as you're a one man band that doesn't have to provide long term support for something that you wrote (I mean *long* term - a 10 - 15yr life for many products isn't uncommon - how long will your last job survive in production?). Obviously you haven't worked at the architectural level of any *large* projects (10's or even 100's of programmers) otherwise you would never make the statements you do. Ignorance is bliss I guess :-) In the meantime, Python seems to suit you, so enjoy! :-) Peter "Peter Hansen" wrote in message news:3C0B08F3.C9CDE885 at engcorp.com... > [Top-quoting corrected.] > > Peter Milliken wrote: > > "Peter Hansen" wrote: > > > brueckd at tbye.com wrote: > > > > Peter Milliken wrote: > > > > > I use Python as a good, quick and dirty hacking language. For real (read > > > > > production) stuff that I expect a customer to run or will require more than > > > > > a single person working for a couple of hours, I look elsewhere :-). Sure > > > > > there are examples of Python being used for "large" jobs - and very > > > > > successful they have been too - but these people are masochists (IMO) :-). > > > > > They could have been more productive with other languages that provide > > > > > better support for generic software engineering principles/standards. > > > > > > > > I am *so* glad that there are people in the world that share your opinion > > > > because you hand me a competitive advantage on a silver platter. I don't > > > > even have to work for it! Keep up the good work; many, many thanks! > > > > > > Dave! :-( Sshhhhh! > > > > > > (Most of the people here are probably not in business themselves. > > > You're not supposed to leak the secret out to our competitors!) > > > > You both prove *my* point - thanks! :-) > > You're point being what again? That we could have been more productive > using some language other than Python, and that we are masochists > because we chose to use Python instead? > > If that's your claim, you're welcome to it, and Dave and I will > continue being *much* more productive than we have ever been > with other languages, for reasons clearly and directly > attributable to the design of Python and the community. > Do you really believe Python has poor support for "generic" > engineering principles? Maybe you're just using it wrong. > I find it supports *all* the useful engineering principles > I've ever learned, and then some. > > Or did you have some other point I missed? > > -- > ---------------------- > Peter Hansen, P.Eng. > peter at engcorp.com From km-news1 at onlinehome.de Sun Dec 9 07:27:57 2001 From: km-news1 at onlinehome.de (Klaus Meyer) Date: Sun, 9 Dec 2001 13:27:57 +0100 Subject: It's hard to find documentation References: <200112081328040980.0156CC2B@mail.rdc1.sdca.home.com> <20011208213833.GA1268@lilith.hqd-internal> Message-ID: <9uvlis$5jr$1@news.online.de> Hello, i found this very helpfully: http://www.orgmf.com.ar/condor/pytstuff.html quotation from there: The Python Shelf. All the docs you use to like in one package! Includes: Python 2.1 Documentation, the output of Ping's pydoc (python 2.1 version), Python Frequently Asked Questions (up to March 08 2001), IDLE explained, an Introduction to Tkinter (by Fredrik Lundh), and the HOWTOs. You can use them together with full search text or on individual basis. For Windows OS. -- MfG K.-G. Meyer From guido at python.org Fri Dec 21 16:33:15 2001 From: guido at python.org (Guido van Rossum) Date: Fri, 21 Dec 2001 16:33:15 -0500 Subject: [Python-Dev] RELEASED - Python 2.2 final In-Reply-To: Your message of "21 Dec 2001 21:27:43 GMT." <2m8zbwjmb4.fsf@starship.python.net> References: <200112211954.OAA16972@cj20424-a.reston1.va.home.com> <2m8zbwjmb4.fsf@starship.python.net> Message-ID: <200112212133.QAA18024@cj20424-a.reston1.va.home.com> > > http://sf.net/project/shownotes.php?release_id=?????? Oops, sorry. The correct URL is: http://sourceforge.net/project/shownotes.php?release_id=66610 --Guido van Rossum (home page: http://www.python.org/~guido/) From aahz at panix.com Mon Dec 24 10:27:22 2001 From: aahz at panix.com (Aahz Maruch) Date: 24 Dec 2001 07:27:22 -0800 Subject: f(n=4) works; bug or feature? References: <3C26B3DA.4000102@erols.com> <3C27404E.8030601@erols.com> Message-ID: In article <3C27404E.8030601 at erols.com>, Edward C. Jones wrote: >Aahz Maruch wrote: >> In article <3C26B3DA.4000102 at erols.com>, >> Edward C. Jones wrote: >>> >>>In Python 2.2, the following code prints a "4". >>> >>>def fun(n): >>> print n >>> >>>fun(n=4) >>> >>>Bug or feature? >>> >> >> Feature. You're using the ability of Python to define keyword arguments >> to functions. > >Embarrassment. In this minimal context, it looked like an assignment. It is an assignment, but the assignment occurs in the function's context. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 7 days and counting From chrishbarker at attbi.com Mon Dec 10 14:08:30 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Mon, 10 Dec 2001 11:08:30 -0800 Subject: "import" analysis References: Message-ID: <3C15082E.4FC3D726@attbi.com> Sylvain Thenault wrote: > does anyone know a tool which parse a project's files and tell you which > modules are imported but not present in the parsed project nor in the > standard python library ? no, but check out Py2exe and McMillian's Installer. Either one will do part of the job for you... -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From jjl at pobox.com Mon Dec 17 13:18:38 2001 From: jjl at pobox.com (John J. Lee) Date: Mon, 17 Dec 2001 18:18:38 +0000 Subject: WYSIWYG text Editor in python? In-Reply-To: <3C1DDCAC.C477A0A6@cicei.ulpgc.es> References: <3C1DDCAC.C477A0A6@cicei.ulpgc.es> Message-ID: On 17 Dec 2001, Enrique wrote: > I am a biochemist using computer programming mainly for > data analysis, and a Python fan. Now I have faced a > different task, automating text reports. For this task I [...] Just another thought: not entirely sure what you want to do exactly, but you might also consider something like Reportlab (pdf generation). John From max at malva.com.ua Fri Dec 21 02:52:22 2001 From: max at malva.com.ua (Max Ischenko) Date: Fri, 21 Dec 2001 09:52:22 +0200 Subject: Is there a tool for python under Linux? References: Message-ID: ?????? wrote: > I want to know if there is a tool which can compile python's > source code into a standalone EXE file under Red Hat Linux7.0 ,for > example,compile my.py into my.exe under Linux. Easily. Invoke the following script as: pycompile yourfile.py #!/bin/sh # Compiles python script into .exe fname=$1 bname=${1%py} echo -n Compiling\ ... mv $fname ${bname}exe echo " done" -- $ \(- bash: (-: command not found From johnroth at ameritech.net Wed Dec 19 14:49:32 2001 From: johnroth at ameritech.net (John Roth) Date: Wed, 19 Dec 2001 11:49:32 -0800 Subject: Dictionaries as records References: <7_XT7.28652$t07.4042756@twister.midsouth.rr.com> Message-ID: "Bill Wilkinson" wrote in message news:F82U7.28866$t07.4111647 at twister.midsouth.rr.com... > > "John Roth" > > In this case, you have one copy of each of your input > > strings, not 15000 copies! The memory usage should be > > pretty close to pure dictionary overhead. > > I don't see how that can be. If they were all copies of the same reference, > wouldn't a change in one record be reflected in all? Below I make a change > to one record and the others remain the same: No. Assignment changes the object to which the variable refers, it does not change the object that is being refered to. In your example, the second pass created a new string object by slicing and concatination, and then assigned it to the key in the dictionary. It did this 15000 times. The first pass assigned the same string (which was a literal in the function). John Roth From LLoeffler at home.com Wed Dec 26 02:38:09 2001 From: LLoeffler at home.com (Luke) Date: Wed, 26 Dec 2001 01:38:09 -0600 Subject: strange Tkinter problem References: Message-ID: <3C297E61.70701@home.com> This is behavior common to pretty much all GUI's. Your callback function triggered by a button click should run in a new thread, or spawn a new thread in which the networking code runs. Check out the threading and thread modules. From r.b.rigilink at chello.nl Sat Dec 29 07:25:02 2001 From: r.b.rigilink at chello.nl (Roeland Rengelink) Date: Sat, 29 Dec 2001 13:25:02 +0100 Subject: Python Popularity, python at sourceforge Message-ID: <3C2DB61E.D9D76142@chello.nl> Hi, As was remarked earlier in this thread, a measure of Python's popularity, if not quality, can be obtained by looking at the number of sourceforge projects using Python. Below you'll find a number of tables comparing sourceforge projects using Python to those using Perl, PHP, Java, C and C++. These numbers were obtained by screen-scraping the sourceforge trove pages. I started this analysis expecting to find clear evidence for Python's - exploding popularity - cross-platform usability - ease of development Alas, the numbers are far more ambigious than I'd hoped. To summarize: 1. Python is the smallest of the 6 languages discussed here. 2. Python is currently growing slower than PHP and Java, but faster than C and Perl. - Python has only been gaining on Perl for the last 6 months - the difference in growth w.r.t PHP and Java may be getting smaller 3. Java is more cross-platform than Python. Perl, C, C++ are less. 4. There is no clear evidence for Python's ease of development. The most interesting result (I think) is Python's changing role from a glue/scripting language to a stand-alone development language. Cross-language development statistics are investigated at the end of this post. 1. All projects The following two tables list the cumulative number and quarterly growth rates of sourceforge projects using Python, Perl, PHP, Java or C++ as one of their programming languages. Note that projects using more than one of these languages contribute to the numbers of each of those languages. The following conclusions can be drawn - Python is only half as big as any of the other languages. - The growth rate of Perl, as compared to Python, has been steadily declining since ther third quarter of 2000. It has become smaller than Python's growth rate in the third quarter of 2001. - The growth rates of PHP and Java have been much larger than Python's. However, up to the third quarter of 2001 their growth rates declined relative to Python. - Since the third quarter of 2000, C has been the slowest growing language. - The growth rate of Python is most similar to that of C++ To summarize: Early 2000 Python was the slowest growing language. Currently only PHP and Java are growing faster, and the gap is closing Table 1a. Cumulative number of projects Python=1 Python Perl PHP Java C C++ Perl PHP Java C C++ 00-03-01 98 172 84 139 529 361 1.8 0.9 1.4 5.4 3.7 00-06-01 221 417 251 371 1220 882 1.9 1.1 1.7 5.5 4.0 00-09-01 374 785 555 756 2030 1518 2.1 1.5 2.0 5.4 4.1 00-12-01 528 1178 883 1257 2827 2220 2.2 1.7 2.4 5.4 4.2 01-03-01 701 1575 1328 1841 3706 2949 2.2 1.9 2.6 5.3 4.2 01-06-01 898 2020 1867 2539 4652 3806 2.2 2.1 2.8 5.2 4.2 01-09-01 1097 2406 2326 3164 5513 4589 2.2 2.1 2.9 5.0 4.2 01-12-01 1266 2690 2745 3774 6189 5285 2.1 2.2 3.0 4.9 4.2 Table 1b. Quarterly growth rates Percentage growth Python=1 Pyth Prl PHP Jav C C++ Perl PHP Java C C++ 00-06-01 125 142 198 166 130 144 1.1 1.6 1.3 1.0 1.1 00-09-01 69 88 121 103 66 72 1.3 1.7 1.5 1.0 1.0 00-12-01 41 50 59 66 39 46 1.2 1.4 1.6 1.0 1.1 01-03-01 32 33 50 46 31 32 1.0 1.5 1.4 0.9 1.0 01-06-01 28 28 40 37 25 29 1.0 1.4 1.3 0.9 1.0 01-09-01 22 19 24 24 18 20 0.9 1.1 1.1 0.8 0.9 01-12-01 15 11 18 19 12 15 0.8 1.2 1.3 0.8 1.0 2. Cross platform projects Python advertises itself as a cross-platform development language. Here, I assume that cross-platform means either OS-independent, or for 2 or more of the the different OS families [Unix, Win, Mac] The conclusion here is pretty much expected: - Python is more 'cross-platform' than Perl, C and C++, but less so than Java, and comparable to PHP Table 2a Cumulative number of cross-platform projects Python=1 Python Perl PHP Java C C++ Perl PHP Java C C++ 00-06-01 157 273 172 311 590 484 1.7 1.1 2.0 3.8 3.1 00-12-01 365 722 598 1047 1317 1159 2.0 1.6 2.9 3.6 3.2 01-06-01 626 1243 1298 2135 2122 1939 2.0 2.1 3.4 3.4 3.1 01-12-01 900 1658 1959 3198 2836 2701 1.8 2.2 3.6 3.2 3.0 Table 2b Cross-platform projects as fraction of all new projects Python=1 Pyth Prl PHP Jav C C++ Perl PHP Java C C++ 00-06-01 71 65 68 83 48 54 0.9 1.0 1.2 0.7 0.8 00-12-01 67 59 67 83 45 50 0.9 1.0 1.2 0.7 0.7 01-06-01 70 61 71 84 44 49 0.9 1.0 1.2 0.6 0.7 01-12-01 74 61 75 86 46 51 0.8 1.0 1.2 0.6 0.7 3. Active projects Python also advertises itself for its ease of development. One could expect that easy projects are more active than difficult projects. The following tables list statistics for projects that have an activiy_ranking of more than 80 %. Since I don't know how this activity is measured I can't really interpret these numbers. Activity ranking is a relative measure of a projects activity, which is computed over all sourceforge projects. An activity ranking of 80% means 80% as active as the most active sourceforge project. Activity seemt to comprise both developer activity (checkins, bug fixes) and user activity (downloads, bug reports). The most notable result from these tables is probably that the numbers are so similiar. Hence, my tentative conclusion: - Project activity is largely independent from the choice of programming language and therefore also independent of the 'accessability' of the language Table 3a Cumulative number of active projects Python=1 Python Perl PHP Java C C++ Perl PHP Java C C++ 00-06-01 24 36 21 33 156 94 1.5 0.9 1.4 6.5 3.9 00-12-01 43 59 49 74 268 174 1.4 1.1 1.7 6.2 4.0 01-06-01 59 95 81 127 368 263 1.6 1.4 2.2 6.2 4.5 01-12-01 74 120 128 182 441 347 1.6 1.7 2.5 6.0 4.7 Table 3b Percentage active as fraction of all projects Python=1 Pyth Prl PHP Jav C C++ Perl PHP Java C C++ 00-06-01 10 8 8 8 12 10 0.8 0.8 0.8 1.2 1.0 00-12-01 6 3 4 4 6 5 0.5 0.7 0.7 1.1 1.0 01-06-01 4 4 3 4 5 5 1.0 0.8 1.0 1.3 1.3 01-12-01 4 3 5 4 4 5 0.9 1.3 1.1 1.2 1.4 4 Mature projects Ease of development may also be reflected in what percentage of projects reaches a mature development status. The following tables give numbers for projects that reached a mature or production/stable development status. The data suggest that Perl and C project reach a mature development status more often than Python, PHP, Java and C++ projects. Note that development status is assessed by the project developers themselves Table 4a Cumulative number of mature projects Python=1 Python Perl PHP Java C C++ Perl PHP Java C C++ 00-06-01 43 118 41 59 294 168 2.7 1.0 1.4 6.8 3.9 00-12-01 87 233 109 161 599 342 2.7 1.3 1.9 6.9 3.9 01-06-01 122 367 194 286 887 503 3.0 1.6 2.3 7.3 4.1 01-12-01 160 455 280 399 1110 644 2.8 1.8 2.5 6.9 4.0 Table 4b Percentage mature as fraction of all projects started. Python=1 Pyth Prl PHP Jav C C++ Perl PHP Java C C++ 00-06-01 19 28 16 15 24 19 1.5 0.8 0.8 1.2 1.0 00-12-01 14 15 10 11 18 13 1.1 0.8 0.8 1.3 0.9 01-06-01 9 15 8 9 15 10 1.7 0.9 1.0 1.7 1.1 01-12-01 10 13 9 9 14 9 1.3 0.9 0.9 1.4 0.9 5. Cross language development The most interesting results are obtained when we compare projects that use a single language with those that use multiple languages. The follwing tables compare the fraction of projects that use more than one language, to those that only use a single language. There are many trends here. - Python, Perl, PHP and Java projects are increasingly becoming single-language projects. - The percentage of cross-language projects in cross-platform projects is lower for Python, Perl, PHP and Java, while its substantially higher for C and C++ projects. - Of the currently active Python projects nearly all old projects included other languages, while only a third of the new projects does so. - Perl is the only language for which the fraction of multi-language projects is larger for active projects. - For the mature Python projects there is also a large difference in the fraction of cross-language projects between old and new projects. - For all languages the percentage of mature projects that use more than one language is smaller. One conclusion - Python is increasingly used a stand-alone development language, especially in active and mature projects. Table 5a Percentage of all new projects Pyth Prl PHP Jav C C++ Perl PHP Java C C++ 00-06-01 55 51 41 35 47 46 0.9 0.8 0.6 0.9 0.8 00-12-01 52 42 37 33 47 46 0.8 0.7 0.6 0.9 0.9 01-06-01 51 48 39 30 46 46 0.9 0.8 0.6 0.9 0.9 01-12-01 45 42 31 26 47 43 0.9 0.7 0.6 1.0 1.0 Table 5b Percentage of new cross platform projects Pyth Prl PHP Jav C C++ Perl PHP Java C C++ 00-06-01 52 47 44 32 56 51 0.9 0.8 0.6 1.1 1.0 00-12-01 50 40 33 30 54 50 0.8 0.7 0.6 1.1 1.0 01-06-01 51 43 36 27 54 52 0.8 0.7 0.5 1.1 1.0 01-12-01 44 39 28 24 56 48 0.9 0.7 0.6 1.3 1.1 Table 5c Percentage of active projects Pyth Prl PHP Jav C C++ Perl PHP Java C C++ 00-06-01 87 58 19 12 51 44 0.7 0.2 0.1 0.6 0.5 00-12-01 68 60 17 46 44 51 0.9 0.3 0.7 0.7 0.7 01-06-01 50 55 40 32 47 37 1.1 0.8 0.6 0.9 0.7 01-12-01 33 64 25 19 52 47 1.9 0.8 0.6 1.6 1.4 Table 5c Percentage of mature projects Pyth Prl PHP Jav C C++ Perl PHP Java C C++ 00-06-01 58 36 34 27 37 37 0.6 0.6 0.5 0.6 0.6 00-12-01 47 26 20 32 37 44 0.5 0.4 0.7 0.8 0.9 01-06-01 45 37 32 24 34 36 0.8 0.7 0.5 0.8 0.8 01-12-01 34 31 25 22 36 40 0.9 0.7 0.6 1.1 1.2 Undoubtedly there's more to be gained from these numbers. But this is starting to look like work, so... Roeland -- r.b.rigilink at chello.nl "Half of what I say is nonsense. Unfortunately I don't know which half" From dyoo at hkn.eecs.berkeley.edu Sun Dec 30 19:54:30 2001 From: dyoo at hkn.eecs.berkeley.edu (Daniel Yoo) Date: Mon, 31 Dec 2001 00:54:30 +0000 (UTC) Subject: Is learning Python "extraordinary"? References: Message-ID: Tim Peters wrote: : [Jesse F. W] :> I am a high school senior, and like many others, I am applying :> to college. I am applying to MIT (as well as many other schools). :> MIT describes what they are looking for as students who do or have :> done "extraordinary things". My question is this, Is teaching myself :> Python (with the aid of the Python tutorials and some help from the :> various lists) an "extraordinary thing"? > It shows intellectual curiosity and self-motivation, two things any > admissions board smiles on. However, for MIT, you should make clear > that your studies have convinced you Python is merely a bad > implementation of Scheme . Or that one can use Python to implement a Scheme... *grin* http://hkn.eecs.berkeley.edu/~dyoo/python/pyscheme/pyscheme-0.01.tar.gz From aleax at aleax.it Fri Dec 28 09:35:26 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 15:35:26 +0100 Subject: REPOST: Re: Wine applicability (was: Python Popularity: Questions and Comments) References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9901.998345FB@earthlink.net> <200112281405.IAA20884@starbase.neosoft.com> Message-ID: <0$--$$_----_---$_$@news.noc.cabal.int> "Cameron Laird" wrote in message news:200112281405.IAA20884 at starbase.neosoft.com... ... > >I don't do much gaming, but I still have to use Windows (mostly in win4lin > >under Linux) for a few needs (e.g., SOME durned webpages that I need won't > >show correcty under any browser except Internet Explorer). Not to mention > >that think3 is a mostly-Windows shop, too. > > > >Linux is my preferred platform for most tasks, except that my firewall/etc > >machine runs OpenBSD (sometimes security is more important than richness > >of features, support for strange hardware, and so on). > . > I'm a tiny surprised; I sincerely thought you > were most comfortable with Windows for COM and > ADO riches. I do love COM and COM-based technologies, and for the last few years I've had to immerse myself almost exclusively in Windows to develop some of the expertise for which I was (and am) gainfully employed. But, out of all the operating systems and environments I've tried (including also Vax/VMS, IBM mainframe OS's such as VM/SP and MVS, Apollo Domain, and quite a few others) Unix-like ones have always been my personal preference for most tasks. I used Linux at home in '92-'95, before the switch to Windows for "total immersion/gain expertise" purposes, and this year I've been able to switch back to Linux at home (and OpenBSD for the firewall/etc -- now THAT is stability, solidity, and security; upon reviewing most all available environments, OpenBSD struck me as heads and shoulders above the crowd -- but, behind the firewall, I find Linux preferable, given typical "consumer" needs such as Windows emulation, viewing Realmedia files, and so on). > Alex, do you have any sense of how well "SOME > durned webpages ..." look when viewed with IE > under Wine on Linux? Are you saying that they > *are* acceptable through win4lin-plus-IE? I was unable to make Microsoft Word run perfectly under Wine, and that's my primary need -- Word with O'Reilly customized macros &c, as that's what I'm required to use for one of the books. So, I did not try Wine extensively on other tasks. I did try VMWare (a beta) and found it somewhat clunky, ponderous, and slow, although maybe that was its beta nature; anyway, I wasn't motivated to plunk down several hundred dollars for the final version to find out. Then I discovered, carefully hidden on a CD of my favorite Linux Distribution (Mandrake 8.1 powerpack), a demo/trial version of NeTraverse's Win4Lin. Half an hour after starting to try it out I had purchased the full unlimited license online (after trying to do so, without success, directly at Mandrake Store, I just got to NeTraverse's site, and, there, it was a snap) -- 1/4 the price of VMWare and more usable for my purposes. Lots of limitations that may be important to some: you only get to run Windows98 on top of Linux, and your Windows "machine" doesn't get to see any strange hardware you may have (in my case, a durned Winmodem by Conexant, really win-only; fortunately I was later able to have it exchanged with a Lucent-chipset one, which does run fine under Linux, it appears). But those limitations were not important for my own specific purposes. All webpages show up just fine under IE 5.5 (haven't bothered downloading 6, I'm told it plays havoc with CSS handling), Word runs, and so does Visual Studio when I need to compile/try out something in Windows version. I have occasionally used Excel, Powerpoint, the OKbridge Windows clent, and a few minor things -- for each of those I'd have good Linux side alternatives too, but, since I had win4lin already, why bother. I believe the only failure was when trying to examine some files with the Windows Media Player. I do get occasional "crashes" (of the simulated Win98 environments), but roughly as often as a real Win98 crashes under similar usage, so I don't think that's win4lin's fault. Alex ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Alex Martelli" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:50:23 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775360 27193 211.57.49.2 (31 Dec 2001 05:09:20 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:09:20 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From gat at jpl.nasa.gov Sat Dec 1 12:53:07 2001 From: gat at jpl.nasa.gov (Erann Gat) Date: Sat, 01 Dec 2001 09:53:07 -0800 Subject: A modest indentation proposal References: <3C0773C2.A12D0BAC@pacific.net.hk> Message-ID: In article , "Terry Reedy" wrote: > Why is ';\n' better for that than '\n'? Because it isn't really '\n', it's '\n'. You can type that as '\n' in a good editor, but you can also easily "delete the backspace" for example by hitting the tab key. What I'm looking for is information in the character stream that is redundant with the indentation to provide an indication when this has happened. That redundant information is already there for the beginnings of blocks (trailing colons), I just want it at the end as well. E. From jknapka at earthlink.net Mon Dec 31 00:16:13 2001 From: jknapka at earthlink.net (Joseph A Knapka) Date: Mon, 31 Dec 2001 05:16:13 GMT Subject: REPOST: Re: Who needs exceptions (was Re: Two languages, too similar, competing References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> <87ellcrfs3.fsf@kursk.kassube.de> Message-ID: <5$--$$-$$$$_$-$__$@news.noc.cabal.int> Cliff Wells wrote: > > On 30 Dec 2001 14:36:28 +0100 > Nils Kassube wrote: > > > I never claimed that an OS should be written in Python. There are > > several good all purpose languages who are better for this task, > > e.g. Lisp and Ada. > > Sorry, I was being somewhat facetious. Unfortunately I am not familiar > with either Lisp or Ada so I can't comment on their appropriateness for > low-level work. Since you aren't the first person I've heard advocate Ada > for this type of work, I have to wonder why it hasn't been done (or has > it?). Lack of such an OS doesn't prove anything, but it does beg the > question. Many embedded systems run Ada "on the metal" -- that is, no "real" OS, just Ada (compiled down to native code, natch) for everything from application logic to interrupt handlers. So arguably there are many tiny OS's implemented in Ada. (I have no personal experience with Ada either, just picked this tidbit up by lurking on embedded lists. Someone will no doubt correct me soundly if I'm leading you astray :-) Lisp, OTOH, strikes me as an unlikely vehicle for an OS implementation; I think of Lisp as being at about the same level of abstraction as Python (but with much less appealing syntax, and a much greater functional emphasis). But I've only written enough Lisp to get the hang of it, not enough to be an expert. Cheers, -- Joe "I should like to close this book by sticking out any part of my neck which is not yet exposed, and making a few predictions about how the problem of quantum gravity will in the end be solved." --- Physicist Lee Smolin, "Three Roads to Quantum Gravity" ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Joseph A Knapka Newsgroups: comp.lang.python Subject: cmsg cancel <3C2F9D70.CE43AAA5 at earthlink.net> Control: cancel <3C2F9D70.CE43AAA5 at earthlink.net> Date: Mon, 31 Dec 2001 03:19:28 GMT Organization: Korea Telecom Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news1.kornet.net 1009779087 8801 211.57.49.2 (31 Dec 2001 06:11:27 GMT) X-Complaints-To: usenet at feeder.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 06:11:27 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From syver-en+usenet at online.no Tue Dec 18 23:42:15 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 19 Dec 2001 05:42:15 +0100 Subject: ANN: ciphon 0.3.4 References: Message-ID: Sean Reifschneider writes: > Oops. Some browsers don't deal very with with a certain format of > response in the "ls" data. I have made a patch to the FTP server so > that it writes the data in the "old" format which some browsers, in > particular Netscape, can handle better. And internet explorer 6 and emacs 21.1 too would benefit from this change. -- Vennlig hilsen Syver Enstad From nobody at nowhere Thu Dec 13 14:45:46 2001 From: nobody at nowhere (nobody at nowhere) Date: Thu, 13 Dec 2001 19:45:46 GMT Subject: Games Made w/ Python Message-ID: <9vb0lq$mp3$1@nntp9.atl.mindspring.net> X-No-Archive: yes Hey, Thanks for all of the great replies. I downloaded Python & SDL . Will Pygame still work with Python 2.2? And which files do I download? There's so many of 'em! TIA. From jkraska at san.rr.com Thu Dec 27 02:30:05 2001 From: jkraska at san.rr.com (Courageous) Date: Thu, 27 Dec 2001 07:30:05 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <9$--$$-$$$$%_$$$%$@news.noc.cabal.int> >How is Python doing popularity wise? After such a meteoric growth >thought the nineties, and a spectacular climax in 2000 and early 2001, >is Python leveling out,... Compare the newsgroup traffic to other contemporary languages. While an imperfect metric, I believe you will find that Python is quite healthily alive. C// ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Courageous Newsgroups: comp.lang.python Subject: cmsg cancel <96jl2u83ge9jfqfc4eedmeprp96c8sisno at 4ax.com> Control: cancel <96jl2u83ge9jfqfc4eedmeprp96c8sisno at 4ax.com> Date: Mon, 31 Dec 2001 03:36:04 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009776075 27193 211.57.49.2 (31 Dec 2001 05:21:15 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:21:15 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From michael at stroeder.com Sun Dec 30 09:58:33 2001 From: michael at stroeder.com (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Sun, 30 Dec 2001 15:58:33 +0100 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <4VlX7.6657$l93.1694996@newsb.telia.net> <6o6s2u4pa4kvqben6ftatrfttu9s78ee1k@4ax.com> Message-ID: <3C2F2B99.DE8AD110@stroeder.com> Ulf Magnusson wrote: > > C is: > Easy to learn > [..] > Python is: > Hard to learn (well relativly to C) ??? Ciao, Michael. From cjensen at bioeng.ucsd.edu Thu Dec 27 20:02:17 2001 From: cjensen at bioeng.ucsd.edu (Curtis Jensen) Date: 27 Dec 2001 17:02:17 -0800 Subject: affects on extended modules References: <3C051775.A8D4FD66@bioeng.ucsd.edu> <83pu5zrvbl.fsf@panacea.canonical.org> Message-ID: <1be8d8b.0112271702.69a599a@posting.google.com> Kragen Sitaker wrote in message news:<83pu5zrvbl.fsf at panacea.canonical.org>... > Curtis Jensen writes: > > We have created a python interface to some core libraries of our own > > making. We also have a C interface to these same libraries. However, > > the the python interface seems to affect the speed of the extended > > libraries. ie. some library routines have their own benchmark code, > > and the time of exection from the start of the library routine to the > > end of the library routine (not including any python code execution), > > takes longer than it's C counterpart. > > In the Python version, the code is in a Python extension module, > right? A .so or .dll file? Is it also in the C counterpart? (If > that's not it, can you provide more details on how you compiled and > linked the two?) > > In general, referring to dynamically loaded things through symbols --- > even from within the same file --- tends to be slower than referring > to things that aren't dynamically loaded. > > What architecture are you on? If you're on the x86, maybe Numeric is > being stupid and allocating things that aren't maximally aligned. But > you'd probably notice a pretty drastic difference in that case. > > ... or maybe Numeric is being stupid and allocating things in a way > that causes cache-line contention. > > Hope this helps. I have been unable to find any references to dynamically loaded objects being slower than statically linked objects. I understand that there is an initial cost when the library is loaded that wouldn't be there in the static case, though, I don't know why it would be slower after that. Can you please provide some references for this, or explain why this would be? Thanks. -- Curtis Jensen From pinard at iro.umontreal.ca Mon Dec 17 09:25:00 2001 From: pinard at iro.umontreal.ca (=?iso-8859-1?q?Fran=E7ois?= Pinard) Date: 17 Dec 2001 09:25:00 -0500 Subject: Tar for python? Better compressed file archives 'r us? In-Reply-To: <200112170639.fBH6dpk26965@bigboy.bizarsoftware.com.au> References: <200112170639.fBH6dpk26965@bigboy.bizarsoftware.com.au> Message-ID: [Richard Jones] > I gather that zip compresses the stored files individually, whereas > gzip'ing tar files will take advantage of the large amount of similarity > between the files in the archive. This has an effect on the quality of compression, indeed. The drawback of compressing the result of putting many files together (the `.tgz' method), instead of putting together many compressed files (the `.zip' method), is that if your archive is damaged somewhere in the middle, you loose all files at and after the damage. Otherwise, you loose only one file. That drawback is a serious one when `.tgz' is used to store on archive media as a security against disasters. For a good while, I put aside the `-y' and `-Y' options in the `tar' program for per-file and per-block compression, but this has probably be abandoned in current development (I do not know). -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From store_li at sina.com Wed Dec 19 21:46:37 2001 From: store_li at sina.com (Kick) Date: Thu, 20 Dec 2001 10:46:37 +0800 Subject: It's Tk's fault References: <9vp5bv$gvfps$1@ID-12869.news.dfncis.de> Message-ID: <9vrji0$hbcov$1@ID-12869.news.dfncis.de> My string is a ordinary 'string' type according to the result of Print type(variable) "Kirill Simonov" wrote in message news:mailman.1008782602.15314.python-list at python.org... > On Wed, Dec 19, 2001 at 12:31:20PM +0800, Kick wrote: > > I have done some experiment: > > > > Using the same code to retrieve data from database: > > > > 1. Display data using console by print clause > > 2. Display data using HTML using gb2312 encoding. > > 3. Display data using wxPython > > 4. Display data using Tk > > Is your data a unicode string or a regular string? > In other words, what does "print type(data)" show? > > > Only tk display a wrong char. I know Tk is easy to use and modify. So is > > there any one who can help me to display Chinese code correctly in Tk > > widget? > > > Kirill > > From jeff at ccvcorp.com Tue Dec 11 13:57:40 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Tue, 11 Dec 2001 10:57:40 -0800 Subject: constructors for lists and tuples References: <1f5252d4.0112110519.2617d639@posting.google.com> <3fd89c2981ebd022646e2b1b0ab3b14d.45609@mygate.mailgate.org> Message-ID: <3C165724.C68A77D4@ccvcorp.com> Rene Jensen wrote: > If you would want a list of initialized objects, do this: > > MyList = [None] * size > MyList = map(lambda x:MyClass() , MyList) For Python 2.x, you can use a list comprehension: MyList = [MyClass() for x in range(size)] I find myself liking list comps more and more all the time. :) Jeff Shannon Technician/Programmer Credit International From ol1 at v10a.com Thu Dec 20 10:53:08 2001 From: ol1 at v10a.com (o polite) Date: Thu, 20 Dec 2001 16:53:08 +0100 Subject: pymacs and rlcompleter In-Reply-To: References: <200112181235.fBICZd706819@relay.wineasy.se> Message-ID: <200112201607.fBKG7Dm05073@smtp.wineasy.se> But since you're planning to rewrite python-mode over Christmas you might as well tuck these features in. Also sprach Fran?ois Pinard: > Pymacs is an interface allowing to use Python in Emacs instead of Emacs > LISP, while Python mode is written in pure Emacs LISP. I would guess the > authors are not likely to give up on that purity, if it can be maintained. > :-) -- o polite From brian at sweetapp.com Mon Dec 17 17:25:03 2001 From: brian at sweetapp.com (Brian Quinlan) Date: Mon, 17 Dec 2001 14:25:03 -0800 Subject: pyexpat and unicode In-Reply-To: <9vlh7i$f4$1@peabody.colorado.edu> Message-ID: <002f01c18749$aca03f30$445d4540@Dell2> Dado wrote: > data_uni = u"\202" > data = "there" > > data_uni.encode('utf8') > > parser.Parse(data) > parser.Parse(data_uni) What effect did you expect the line: data_uni.encode('utf8') to have? Unicode objects, like strings, are immutable. What you probably meant is: data_uni = data_uni.encode('utf8') Cheers, Brian From soppers3 at cti.ecp.fr Thu Dec 27 20:06:12 2001 From: soppers3 at cti.ecp.fr (Stephane SOPPERA) Date: Fri, 28 Dec 2001 02:06:12 +0100 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <3C2BC584.53199AD5@cti.ecp.fr> Ron Stephens wrote: > > What do you guys think???? > > Ron Stephens > http://www.awaretek.com/plf.html Python City I'm just raising a question to the ones who know both ruby and python. I'm new to python since this morning (learned it in only 8hours, that's a good point for python; I've been looking to the ruby book, which seems to be a tutorial, that will take me more time to read...). I don't know ruby. I've learned python because it can be used as a script language for other application. Actually it is used as a script language for Blender3D (http://www.blender3d.com), and I need to script this soft. My question is: can ruby be also used as a scripting language for another app (not written in ruby)? If the answer is yes: is it used in any application? Thanks, -- Stephane SOPPERA http://stephane.soppera.free.fr From chrishbarker at attbi.com Fri Dec 28 14:08:58 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Fri, 28 Dec 2001 11:08:58 -0800 Subject: REPOST: Re: set decimal place References: <3c291037.4684696@news.tm.net.my> <3C292938.ED322C60@bellatlantic.net> <184fbd02.0112260109.4392423@posting.google.com> <3C2A29A5.8E9FB5BE@engcorp.com> <3C2B794A.800A94E5@attbi.com> <3C2BED49.E54CB73E@engcorp.com> Message-ID: <4$--$$_----_-%$$%$@news.noc.cabal.int> Peter Hansen wrote: > > not completely. you might want to check if two values are the same to 4 > > decimal places, in which case round should work just fine: > > > > >>> 10.0/3 == 10.00001/3 > > 0 > > >>> round(10.0/3,4) == round(10.00001/3,4) > > 1 > > I don't know if this is guaranteed to work in all cases. That depends on how robust the round() code is, and I have no idea about that. Someone who knows better than me suggested using float("%.4g"%x) to get significant figures, because most C libraries have robust and correct code for the %g format specifier. Also, there is the problem of how you choose to define "correct" rounding. There is no one definition. > Comparing floating point values directly is generally > not a good idea, although I don't know whether this applies > to rounded values, and if so how far you have to round them > before it makes it safe. Exactly, it is one easy way to check if two floating point values are "close enough", by a criteria most of us understand. > If it is safe, you have a valid point, but not likely what > the OP wanted. The OP wasn't all that clear about what they wanted, but you're probably right! -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Chris Barker Newsgroups: comp.lang.python Subject: cmsg cancel <3C2CC34A.ED177E8D at attbi.com> Control: cancel <3C2CC34A.ED177E8D at attbi.com> Date: Mon, 31 Dec 2001 01:51:28 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775131 27193 211.57.49.2 (31 Dec 2001 05:05:31 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:05:31 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From al_dass at yahoo.com Wed Dec 26 20:41:47 2001 From: al_dass at yahoo.com (Al Dass) Date: 26 Dec 2001 17:41:47 -0800 Subject: REPOST: Re: [ANN] _socket.pyd with SSL support for Python 2.2 References: Message-ID: <1$--$$-$$$$%__$$_$@news.noc.cabal.int> For those interested... here is link to _socket.pyd & _socket_d.pyd for Python 2.1.1 on Win32. http://home.attbi.com/~al.dass/dev/python/2.1.1/win32_socket_ssl/python_2_1_1_ssl_socket.zip Cheers, Al Dass ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: al_dass at yahoo.com (Al Dass) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:36:08 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775990 27193 211.57.49.2 (31 Dec 2001 05:19:50 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:19:50 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From mcfletch at rogers.com Wed Dec 12 14:03:26 2001 From: mcfletch at rogers.com (Mike C. Fletcher) Date: Wed, 12 Dec 2001 14:03:26 -0500 Subject: WGL in python, ChoosePixelFormat error References: <24bfc89266728f0b6632b23acd7028aa.45609@mygate.mailgate.org> Message-ID: <3C17A9FE.8090502@rogers.com> You might find that more PyOpenGL programmers are on the PyOpenGL-users list at SourceForge. First question: Why WGL and win32api? It's (IMO) the least supportive of the GUI libraries for Python (for new users not coming from a VC++ background). I'd suggest using wxPython, Tkinter or PyGame for the GUI. All of those have well-supported and easy-to-use PyOpenGL contexts. Second question: Have you looked at Mark Hammond's OpenGL demo that comes with PythonWin? It's the only PyOpenGL demo with win32api I've ever seen, so if that's what you're fixed on, that's likely the only demo code you'll find (though I've heard someone somewhere actually created a system with it, I've no idea who). If you're just starting out, my recommendation would be to use wxPython. It's a fully-featured GUI system targetted at "traditional" GUIs, and the PyOpenGL widget is easy to use. If you're seeing your project having more of a "Game GUI" (a control HUD over a 3D world), then maybe go with PyGame. As a note, there is a lot of sample code for PyGame and wxPython PyOpenGL work in the OpenGLContext package (yeah, I know, shameless plug :o) ). Links: http://sourceforge.net/mail/?group_id=5988 http://www.wxPython.org http://www.pygame.org http://pyopengl.sourceforge.net/documentation/openglcontext/ HTH, Mike Rene Jensen wrote: > Hi all. > > Does anyone know where to find an example of how to set up an opengl context > via wgl? Is this being posted in the wrong forum? > > I get a strange error when trying to call ChoosePixelFormat > This is how I try to setup my gl-context using win32all and wgl: > > # Register window-class .. > # Create window.. > # GetDC.. > > Desc = PIXELFORMATDESCRIPTOR() > Desc.xxx = yyy > .. > PDesc = PIXELFORMATDESCRIPTORPtr (Desc) > format = ChoosePixelFormat (windowDC, PDesc) > > ..Which results in: > > TypeError: Type Error. Expected _p_q_const__PIXELFORMATDESCRIPTOR > > But what does that mean? > > Thanks in advance all! I've just started using python, and loved it instantly. > I'm trying to make a radiosity-renderer for creating shadowmaps in 3d games. I > really hope python is good enough for it, because I simply love the simplicity > of the code. > > chilopoda at hotmail.com > > > -- _______________________________________ Mike C. Fletcher http://members.rogers.com/mcfletch/ From dhcassette at excite.com Sat Dec 1 08:11:08 2001 From: dhcassette at excite.com (Special Offer) Date: 1 Dec 2001 08:11:08 -0500 Subject: "Your Retirement Business" [lccrj] Message-ID: My name is BJ Bishop.. Your Time is valuable, so's mine.. Imagine yourself earning as much money as any Professional, beginning RIGHT NOW! You must be Motivated, Positively oriented (nice person too) and SERIOUSLY want to change your financial picture... Get back to me.. SHOW ME you ARE Positively Oriented, motivated and ready to change your financial picture. We will move forward and I will personally mentor and train you one on one.. If you have a good Work Ethic in THIS Business, you can "IDLE" through 2002 with CASH in YOUR Bank account.. No Selling.. 24 Hours: 800-558-4158 I Look Forward to Hearing from You. BJ Bishop ************************************** Your Email Address Removal/Deletion Instructions: We comply with proposed federal legislation regarding unsolicited commercial email by providing you with a method for your email address to be permanently removed from our database and any future mailings from our company. To remove your address, please send an email message with the word REMOVE in the subject line to: mailto:llllllllllproc at excite.com?Subject=Remove If you do not type the word REMOVE in the subject line, your request to be removed will not be processed. From greg at cosc.canterbury.ac.nz Wed Dec 5 18:25:10 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Thu, 06 Dec 2001 12:25:10 +1300 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BD39F.D43D4FF7@mega-nerd.com> <3c0be454$1@207.229.64.20> <3C0BE5D5.4386B359@mega-nerd.com> Message-ID: <3C0EACD6.B2191A44@cosc.canterbury.ac.nz> Huaiyu Zhu wrote: > > So I'd suggest the tab advocates to consider the other side's view. And vice versa as well. To give one concrete example, BBEdit on the Mac is very definitely what Huaiyu calls a "tab-character" editor, both in what happens when you press the tab key, and in the way its block-shifting commands work. If Python were ever to mandate space-only indenting, I would be very disappointed, since it would effectively make it impossible to use BBEdit to write Python code. I also recognise that mandating tab-only indentation would cause equal distress to those with editors of the other kind. So, as far as I can see, both styles need to be allowed. I understand that problems occur if you take a file produced using one kind of editor and directly edit it with an editor of the other kind. But this seems to be unavoidable giving the existence of these two mutually incompatible editing regimes, or communities, or whatever you want to call them. Mandating one style of indentation doesn't solve this problem, it only shuts out half of the community. And I don't think that would be a nice thing to do. In summary, my positions on the various issues are: * Space-only block indentation should be allowed. * Tab-only block indentation should be allowed. * Mixed indentation should probably be rejected always, or at least by default, although I can live with having to say -tt. * Python shouldn't care about spacing used for purposes other than block indentation, although pragmatically it's best done with spaces only. * People in both camps should get used to the idea of using conversion tools to deal with each other's code and stop hating each other, or George Bush may target you next after Afghanistan. :-) -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From aahz at panix.com Sat Dec 29 11:12:42 2001 From: aahz at panix.com (Aahz Maruch) Date: 29 Dec 2001 08:12:42 -0800 Subject: whrandom (was Re: Python 1.5.x vs Python 2.x.x) References: <3C180FF7.DEAEA6C6@radical.ca> <7xheqkr05q.fsf@ruckus.brouhaha.com> Message-ID: In article , James T. Dennis wrote: > > While that topic has come up: I find whrandom to be an unsightly > name for accessing a set of functions which is so commonly accessed > by novice students. What was wrong with must calling it rand or > random? Is it pure pedantry? You're not supposed to use whrandom, although unfortunately the docs have been less clear about this historically than they should have been. The specific functionality of random is located in whrandom, to provide an abstraction layer in case some better pseudo-random algorithm comes along. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 2 days and counting From michael at stroeder.com Sun Dec 30 09:48:00 2001 From: michael at stroeder.com (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Sun, 30 Dec 2001 15:48:00 +0100 Subject: REPOST: Re: Who needs exceptions (was Re: Two languages, too similar, competing References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> <3C2E498B.6DC757E0@stroeder.com> <3C2E6A51.589E7F1D@earthlink.net> Message-ID: <3$--$$_----__$_$-$@news.noc.cabal.int> Ron Stephens wrote: > > Several folks seem to agree that > +++C and programmers who like C should die a slow and painful death for > > holding back the computer industry for two decades.+++ > > I am hoping that the above does not apply to fellow I've heard of named Guido > van Rossum, who, it is commonly rumored, has written some useful progrms in > "C" from time to time ;-)))) Well, he could have used Modula instead... ;-) Seriously, I'm sick of all the security announcements regarding buffer overflows and such. Not to speak of memory leaks. That's stone age. Furthermore exceptions are a very nice possibility to make proper error handling feasible in complex projects hopefully resulting in more secure code. Ciao, Michael. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Michael =?iso-8859-1?Q?Str=F6der?= Newsgroups: comp.lang.python Subject: cmsg cancel <3C2F2920.89841C81 at stroeder.com> Control: cancel <3C2F2920.89841C81 at stroeder.com> Date: Mon, 31 Dec 2001 01:33:17 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774216 27193 211.57.49.2 (31 Dec 2001 04:50:16 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:50:16 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jkraska at san.rr.com Sun Dec 30 13:29:44 2001 From: jkraska at san.rr.com (Courageous) Date: Sun, 30 Dec 2001 18:29:44 GMT Subject: Is learning Python "extraordinary"? References: <3C2DC53F.31010.D9D6B0A@localhost> of "Sat, 29 Dec 2001 13:29:35 PST." <3C2DC53F.31010.D9D6B0A@localhost> Message-ID: >Whatever you do, after you have written your letter, pack your ego >down to size so you can go back to being a humble learner. The world >is full of traps for young people who have more ego than is good for >them, and it would be a shame to trigger a bunch of them because you >wanted to write the perfect letter to impress MIT. Ego is always healthy, it's narcissism which will strike you down. C// From Tom.Karas at htp-tel.de Thu Dec 27 17:14:27 2001 From: Tom.Karas at htp-tel.de (Tom Karas) Date: Thu, 27 Dec 2001 23:14:27 +0100 Subject: REPOST: Re: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B941D.B1E45AA5@htp-tel.de> Message-ID: <2$--$$_----_-$-_%$@news.noc.cabal.int> Hello all! Thank you Aahz Maruch. > >What means nntp ? > > It's a protocol for transferring netnews articles, the way HTTP is a > protocol for transferring HTML documents. For more information, poke > around Google. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.cwix.com!torn!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Tom Karas Newsgroups: comp.lang.python Subject: cmsg cancel <3C2B9D43.E3B6407E at htp-tel.de> Control: cancel <3C2B9D43.E3B6407E at htp-tel.de> Date: Mon, 31 Dec 2001 01:58:46 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775555 27193 211.57.49.2 (31 Dec 2001 05:12:35 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:12:35 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From sholden at holdenweb.com Wed Dec 19 07:58:47 2001 From: sholden at holdenweb.com (Steve Holden) Date: Wed, 19 Dec 2001 07:58:47 -0500 Subject: Dictionaries as records References: <7_XT7.28652$t07.4042756@twister.midsouth.rr.com> Message-ID: "Bill Wilkinson" wrote in message news:7_XT7.28652$t07.4042756 at twister.midsouth.rr.com... > > "John Roth" > > Your records seem to average around 250 bytes, so that's about 16 > > characters per field. Object overhead for each object is roughly the > > same as this (it might be larger, I haven't looked at the headers > > recently.) > > Yes sir, about 250 bytes. Here is some code that shows what I am confused > about. (Hoping my spaces don't get stripped out while being posted) > There is a big difference between the memory usage of the two sections of > code below. I can work around this, but I am a bit curious now. It would be > nice to know why the second part below takes up so much ram (I think about > 1.2k per rec?). > > #A sample record that looks like the ones I use. Data obfuscated. > d = {"f":"kdfkjdkfjdkj", > "g":"ldjfljdfkjdf", > "u":"dkfkjdfkjdfj", > "t":"kdjfkjdfkjdkjfkjdf", > "u1":"kdjfkjdjdkjfkjdfjkdjf", > "ii2":"kjdfkjdfjkdjfkjdfjdfj", > "g3":"ldjfljdfkjdf", > "u4":"dkfkjdfkjdfj", > "g5":"ldjfljdfkjdf", > "u6":"dkfkjdfkjdfj", > "g7":"ldjfljdfkjdf", > "u8":"dkfkjdfkjdfj", > "g9":"ldjfljdfkjdf", > "u10":"dkfkjdfkjdfj", > "g11":"ldjfljdfkjdf", > "u12":"dkfkjdfkjdfj",} > > #Method 1 > #Just make a bunch of copies of the same record again and again. > tbl = [] > for x in range(15000): > tbl.append(d.copy()) > > raw_input("Check your Ram usage then press enter") > > #Method 2 > #Ok, now change each record just a little bit. > #Hack off the last two chars from each field and > #add one new character. Then append the new record > #to the table. > tbl = [] > for x in range(15000): > t = d.copy() > for k in t.keys(): > t[k] = t[k][:-2] + str(x)[-1] > tbl.append(t.copy()) > print "Now check your memory usage again." > Bill: Try using copy.deepcopy() in place of d.copy() in your first section to see whether it changes the memory requirements significantly. A copy of a dictionary does not need to copy the values of the keys or the items, since they are held as references. Using deep copying might duplicate more data (though I have not read the interpreter source to verify this...). Basically, though, I'm afraid you might have to accept that you have passed some limit of usefulness for the programming technique you originally chose. Unfortunately there is never any guarantee that a particular method will scale well to larger data sets, particularly when you rely on the intrinsic properties of some language artefact like the Python dictionary. You might ultimately have to consider one of the techniques other posters have mentioned (or possibly a relational database). regards Steve -- http://www.holdenweb.com/ From aleax at aleax.it Tue Dec 11 12:11:25 2001 From: aleax at aleax.it (Alex Martelli) Date: Tue, 11 Dec 2001 18:11:25 +0100 Subject: lost interest? References: <20011208001123.A5989@casa.parque> <3C14FEBD.AD52B516@attbi.com> Message-ID: <9v5enr079j@enews4.newsguy.com> "Skip Montanaro" wrote in message news:mailman.1008084977.20129.python-list at python.org... ... > * Perl's third-party modules tend to rely heavily on other third-party > modules for their proper functioning, so CPAN's ability to register > and handle inter-module dependencies is important. ... > CPAN is marvelous. The way the Perl and Python communities operate, it > fills a niche perfectly in the Perl world, but I think would be a bit of a > solution looking for a problem in the Python world. If it encourages more reuse of code in module A by the author of module B, I think it would be a VERY good influence "in the Python world". Why *shouldn't* the useful 3rd-party modules we use be free to rely on other useful 3rd-party modules yet?! Since switching my Linuxing to Mandrake I've grown SO fond of urpmi's automatic resolution of dependencies (Debian's apt-get works at least as well, I hear) that I can't believe we'd WANT to be without it for Python...! Alex From arthur.siegel at rsmi.com Mon Dec 3 12:37:32 2001 From: arthur.siegel at rsmi.com (arthur.siegel at rsmi.com) Date: Mon, 3 Dec 2001 12:37:32 -0500 Subject: More assignment/copy novice confusion Message-ID: Hans writes - >> Arthur Siegel wrote: >>[binding and references to lists] >> All of this is far from obvious, but of course does >> in the end make perfect sense. >While it is a continuous source of confusion for newbies, >it is only far from obvious if you're used to the implicit >copying of other languages. I am testifying that it is far from obvious even if you have no other reference point as to how other languages work. Like most things, once you understand it, it kind of *seems* obvious. But the specific issues I raised here, with the simplest of class structures, was an issue as *to me* because in fact and in practice I was continually being bitten. It did get to the point where I had an emprirical understanding - I knew how to get the behavior (usually) that I was looking for, but without much concept of why things were happening quite as they were. To make another of a series of unprovable statements - it seems to me that in learning something new at an advanced age, I am at some disadvantage in terms of how quickly I might pick things up - I do walk around with more preconceptions of how things *should* work. On the other hand, there is more introspection - more of an ability to watch myself learn, as I learn. I am simply reporting that these are the kinds of issues about which I hit my first and most substantial brick wall. I guess it is up to others to assess how much can be generalized from that about "usability" and documentation issues. >But in fact, many other languages don't implicitly copy >either for more complex objects... if you hack up a linked list in C, it doesn't >copy itself magically... neither do arrays or what C calls >"strings". So I think Python's concept isn't all that >far-fetched... in fact, it might be more intuitive than >most. This is another place where I as a novice whose experience is limited to Python (I actually do some Java, based on what I learned from Python, the transition I can testify was relatively painless - Python *does* serve as a good foundation- at least as to Java - has been my general experience). But the point, going back to the list.remove() behavior on iteration, is that I am less likely to say - of course, that is the nature of the beast for this kind of language. It still seems kind of broken that the language should give me back results it could *know* is not what I was expecting. One let's down one's guard, because there is a general expectation that the compiler only let's one go so far in the direction of stupidity. Still seems like, yes I crossed the stupidity line, but the compiler let me get away with it. But I am quite adament in not wanting to see Python move in the direction of design decisions whose primary purpose is coddling novices. So in talking about what has given me difficulty I should re-iterate how much has not, how intuitive much of it seems - *given* substantial focus directed toward the effort to understand. Last point, is that I can only plead that in our usability assessments we separate out results for those coming to the table with and without that willingness to extend effort and meet the learning process half way. Results and conclusions will surely be different for the two groups. The programming language for people who don't care about programming, should be something other than Python, IMO. Art From fperez528 at yahoo.com Sat Dec 1 15:57:11 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Sun, 02 Dec 2001 20:25:11 +2328 Subject: Whatever happened to String Interpolation? References: <9u6dbn$nsj$1@peabody.colorado.edu> <9ue35a$sbi$1@peabody.colorado.edu> Message-ID: <9uerd1$hbk$1@peabody.colorado.edu> phil hunt wrote: > This involves changing the python language. IMO a better proposal > would be to implement it in Python, perhaps using the syntax: > > i("x is `x`, f(x) is `f(x)`") > > That already exists: type 'python Itpl' in google. f. From jgardn at alumni.washington.edu Sun Dec 2 09:21:34 2001 From: jgardn at alumni.washington.edu (Jonathan Gardner) Date: Sun, 2 Dec 2001 23:21:34 +0900 Subject: Python, PyQT and QSpinBox In-Reply-To: <9ubnie$34b$1@snipp.uninett.no> References: <9ubnie$34b$1@snipp.uninett.no> Message-ID: <200112021443.fB2EhHJ02115@my.knctv.co.kr> On Sunday 02 December 2001 08:02 am, Yngve F. Johansen wrote: > Hello > > I'm rather new to Python, and to GUI programming as well. I've been fooling > around with the QT toolkit, and find it extremely easy and intuitive to > work with, short of one thing I can't figure out: > > I use a QSpinBox in my dialog, and it works, kind of. The problem is when I > enter text rather than use the Up/Down buttons. The text isn't > updated/converted > to an integer-value automatically, but if I move the mouse-pointer over the > widget buttons it gets converted. Humm... looks like a post for the PyQt mailing list. I am sure they would be glad to help you out. > > Is there a way to change this behavior? I've tried to subclass the QSpinBox > and > write my own functions, but it didn't help a whole lot. > Rewriting something just because it isn't behaving the way you expected... kind of beats the purpose of using a standard set of widgets, huh? Looks like the widget should be rewritten not from your program, but from the source level. jonathan From vincent_a_primavera at netzero.net Fri Dec 14 04:23:58 2001 From: vincent_a_primavera at netzero.net (Vincent A. Primavera) Date: 14 Dec 2001 09:23:58 +0000 Subject: Grail... Message-ID: <1008321839.13477.11.camel@del-vap-bos.ralphpill.com> Hello, Are there any Grail users out there? If so... I finally got v0.6 to "work" with Python v2.1.1 despite the deprecation warnings etc. But, when I try to load pages I get another error. For instance, if I try to go to www.python.org a window pops up saying: An exception occured in a callback function : exceptions.AttributeError : MyHTTP instance has no attribute 'sock' Anybody else run in to this? Thank you, Vincent A. Primavera P.S. I would be interested to know if anyone is using this on a daily basis and where you have found success/failure w/browsing, applets, etc. From curtin at ubsw.com Sat Dec 15 17:08:54 2001 From: curtin at ubsw.com (craig curtin) Date: 15 Dec 2001 14:08:54 -0800 Subject: quick eval question References: <4c7395cb.0112150728.2275ad75@posting.google.com> Message-ID: <4c7395cb.0112151408.34bd9@posting.google.com> this is a better example of what i'm trying to do. any suggestions/alternates appreciated. elements = {} elements['OUTLOOK'] = {} elements['OUTLOOK']['CATEGORY'] = 'DEVL_TEST' elements['OUTLOOK']['AUTHOR'] = {} elements['OUTLOOK']['AUTHOR']['ADDRESS'] = 'John Smith/Devl' elements['OUTLOOK']['AUTHOR']['NAME'] = 'Engineering Division' elements['OUTLOOK']['AUTHOR']['TYPE'] = 'SMTP' elements['OUTLOOK']['CREATEDATE'] = '12/10/01 17:21:23' # now i want a 'path component' ePath ="['OUTLOOK']['CREATEDATE']" # i can't seem to put the dict and path together print elements+ePath #print elements eval(ePath) #print eval(elements eval(ePath)) hope this makes sense, craig curtin at ubsw.com (craig curtin) wrote in message > i'm looking to do something like this but my brain is failing... > > i = [1,2,3,4,5] > j = '[2]' > > k = eval( i j ) > > ie. i want to get k = 3 ... From saurabh at nortelnetworks.com Fri Dec 14 17:52:27 2001 From: saurabh at nortelnetworks.com (Saurabh Chadha) Date: Fri, 14 Dec 2001 16:52:27 -0600 Subject: How can i know what type of arguments go into a function!!! Message-ID: <3C1A82AA.4915CA1A@nortelnetworks.com> Hi all, I am just a newbie and was looking at a simple client server program. Derived from the TCPServer class in (SocketServer module). I am on version 1.5.2. My question is that in order to construct a TCPServer module i have to pass it in a class derived from BaseRequestHandler class. I have to override the handle method. The code follows below. >>> class mine(BaseRequestHandler): ... def handle(self): ... print self.request, self.client_address, ... data = self.request.recv(300) ... while data: ... print data, len(data) ... data = self.request.recv(300) ... print "Done" ... >>> server_address = ('', 22222) >>> kk = TCPServer(server_address, mine) >>> kk.serve_forever() The code works fine. But it took me a while to figure out how to print the data. I had to look at other code just to know that self.request is a socket type and do a type(socket) on it to get to the functions that are available to me. What strategy are you people using to determine the type of the object. It does affect my readability since the i had to plug in dir(self.request) in the code to make sure the type is a socket. Regards, Saurabh From eldiener at earthlink.net Mon Dec 31 00:29:26 2001 From: eldiener at earthlink.net (Edward Diener) Date: Mon, 31 Dec 2001 05:29:26 GMT Subject: Python and Ruby: a comparison References: <3C2B9A61.EE1618DB@earthlink.net> <2WpX7.1145$0s5.714029@news20> <3C2E6876.4CBF45D4@geneva-link.ch> <465v2u4lv3illoviq19nhdf1r2vcknbakn@4ax.com> Message-ID: <3C2FF718.1020306@earthlink.net> CLR is a lowest common denominator for language ideas which MS supports. What happens when a language has good ideas which are more advanced than what CLR supports. It is left out of CLR, or included into it with those ideas stripped from the language to accomodate CLR. Sometimes the Holy Grail of language interoperability has serious flaws to it. Similarly Esperanto may be a nice idea but most countries love their own languages. The same goes for languages which programmers use. Tim Roberts wrote: > Boris Borcic wrote: > > >>Conrad Schneiker wrote: >> >> >>>So my question is: at such a presently entirely hypothetical future >>>juncture, is there any practical and desirable middle ground for a common >>>single successor language to the current generations of Python and Ruby? >>> >>What would be fun is to have library interoperability completed >>with interlingual source-to-source conversion from adequately >>constrained style... premitting more or less, to use one's language >>superficial idioms to mean corresponding idioms in the other >>language. >> > > Oddly enough, I believe that is almost exactly what Bill Gates believes he > has created with .NET and the common language runtime. From michael at stroeder.com Sat Dec 29 17:54:03 2001 From: michael at stroeder.com (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Sat, 29 Dec 2001 23:54:03 +0100 Subject: REPOST: Re: Who needs exceptions (was Re: Two languages, too similar, competing References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> Message-ID: <2$--$$_----__$%_-$@news.noc.cabal.int> Nils Kassube wrote: > > gerson.kurz at t-online.de (Gerson Kurz) writes: > > [Error checking without exceptions] > > > So ? After all, C doesn't need it, and I think few C programmers would > > call this feature the "most missing", or? > > C and programmers who like C should die a slow and painful death for > holding back the computer industry for two decades. Fully agree with that. Ciao, Michael. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Michael =?iso-8859-1?Q?Str=F6der?= Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E498B.6DC757E0 at stroeder.com> Control: cancel <3C2E498B.6DC757E0 at stroeder.com> Date: Mon, 31 Dec 2001 02:28:15 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774508 27193 211.57.49.2 (31 Dec 2001 04:55:08 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:55:08 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From imvenki at hotmail.com Thu Dec 20 09:55:59 2001 From: imvenki at hotmail.com (venkatakrishnan.k) Date: 20 Dec 2001 06:55:59 -0800 Subject: Bus Error in HP-UX 11.00 References: <950ee0f0.0112172230.1d7eba3f@posting.google.com> Message-ID: <950ee0f0.0112200655.4a0325be@posting.google.com> Hai, I was using Python2.1 which was build from source using gcc-3.0.1 compiler. I did the conventional configure, make & make install dance for my source. Whether i was right or wrong,i concluded that the problem was with my build. So i opted for a readymade binary for python for HP. I got a HP-ported python binary from http://hpux.connect.org.uk/hppd/hpux/Languages/python-2.1 and i am no longer getting that "Bus Error". So i assumed that my conclusion was right. But i have one more problem. I am actually porting my python code developed for Windows to HP. I use ActivePython-2.1 from www.activestate.com for Windows. It comes with builtin support for packages like distutils & zlib. But i was shocked to see that these packages are missing in my HP-UX binary. Now i am searching for a binaries for all such additional packages. Does anybody have the binary or i have to do the same 'configure ;make ; make install' activity???? thanks, venkatakrishnan.k Jody Winston wrote in message news:... > imvenki at hotmail.com (venkatakrishnan.k) writes: > > > Hai all, > > I have a program which runs good in linux systems.When i tried to port it to > > HP i got this strange error called "bus error" and my program core-dumped. > > Since i am new to HP i dont know how to solve it and i am not even sure > > whether the problem lies with my code. > > I would be very pleased to get a solution for this as this is very urgent. > > > > bye, > > venkatakrishnan.k > > You didn't give us much to go on. > > o What's the python version > o What modules are being used > o Did you compile the dynamic modules correctly using something > like (aCC -Wl,-E -Wl,+s -Wl,+b$(HOME)/Tools/$(FULLNAME)/lib/python2.2/lib-dynload) > > Try running with python -v to see what's going on. Run python under a > debugger. From wurmy at earthlink.net Sat Dec 8 19:50:19 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Sun, 09 Dec 2001 00:50:19 GMT Subject: It's hard to find documentation References: <200112081328040980.0156CC2B@mail.rdc1.sdca.home.com> <20011208213833.GA1268@lilith.hqd-internal> Message-ID: <3C12B34B.591E013E@earthlink.net> Bruce Eckel wrote: > > Sure, but why can't I use the search mechanism to do this? If it > won't discover a document when I give it the exact title, it seems > pretty difficult to find lesser things. For that matter, I can't > think of when the search mechanism on the site has given me what I > was looking for. It seems to vary between thousands of documents > and "nothing found" I don't use that search option very often, so I cannot comment on that, but Google usually does the right thing: python extending embedding yields http://www.python.org/doc/current/ext/ext.html as the first hit. --Hans From Lutz.Schroeer at kybernetik-manufaktur.de Thu Dec 6 14:59:15 2001 From: Lutz.Schroeer at kybernetik-manufaktur.de (Lutz Schroeer) Date: 6 Dec 2001 19:59:15 GMT Subject: gadfly and autonumber/auto_increment/guid? Message-ID: Hi, i've searched through the Net for hours now and couldn't find any hint: How do I create an autonumber/auto_increment/guid or the like in a table using the gadfly DB? Please help, I really don't want to switch to M$ Access and VB :-)) Latz From skip at pobox.com Sun Dec 30 20:21:33 2001 From: skip at pobox.com (Skip Montanaro) Date: Sun, 30 Dec 2001 19:21:33 -0600 Subject: Suggested tweak to base64.py In-Reply-To: References: Message-ID: <15407.48541.98973.185604@12-248-41-177.client.attbi.com> Tim> I'd like to suggest the following four lines be inserted just Tim> before the end of base64.test(): ... (I'm not picking on Tim here, really I'm not... ;-) Anytime you have a bug report, feature request, or patch you think should be applied to the Python core, it's best to go to http://sourceforge.net/projects/python/ and file a bug report or submit a patch. That way it will get tracked, assigned to someone appropriate (typically the person best able to digest your submission), and if any discussion about the request is required, provides a permanent record of the discussion. -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From rdsteph at earthlink.net Sat Dec 29 20:27:08 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sun, 30 Dec 2001 01:27:08 GMT Subject: REPOST: Re: Zope Documentation (was RE: Python Popularity: Questions and References: <3C2E55A6.D873E301@engcorp.com> Message-ID: <3$--$$_----__$%--$@news.noc.cabal.int> Bill Tate wrote: > > I understand the "zen" thing, To which Peter Hansen replied >>If you say that, then you don't really understand it. ;-) I would just like to add, if you meet the Buddha on the road, Kill him... But anyway, I subscribe to the church of Tim Peters and the Zen of Python, introspectively yours, Ron Stephens ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E6E87.6F8E7FE1 at earthlink.net> Control: cancel <3C2E6E87.6F8E7FE1 at earthlink.net> Date: Mon, 31 Dec 2001 04:55:35 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774638 27193 211.57.49.2 (31 Dec 2001 04:57:18 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:57:18 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From pcc at ecet.vtc.edu Sun Dec 30 15:10:31 2001 From: pcc at ecet.vtc.edu (Peter) Date: Sun, 30 Dec 2001 15:10:31 -0500 Subject: Manipulating Win32 attributes; newbie question. Message-ID: Hello! I'm new to Python although I have a fair amount of experience with other languages (C++, Java, some Perl). I'm working on the Windows platform with Python 2.0. I have Pythonwin installed. My problem is that I need to manipulate some Win32 specific file attributes. In particular, I need to temporarly turn off the read-only attribute on a directory. In C I could use the Win32 API functions GetFileAttributes() and SetFileAttributes() to do this. I'm not sure how to get the job done with Python. I looked around in both the generic and Pythonwin documentation but I didn't see anything that addressed this issue. TIA Peter From s.schwarzer at ndh.net Sun Dec 30 21:02:09 2001 From: s.schwarzer at ndh.net (Stefan Schwarzer) Date: Mon, 31 Dec 2001 03:02:09 +0100 Subject: (Almost) command line simulation with execfile References: <3C2CADA8.8D6BE4C@ndh.net> <3c2f4182_2@news.newsgroups.com> Message-ID: <3C2FC721.145D2EBC@ndh.net> Hello Brad Brad Clements wrote: > Please post internet.py Here it is: ''' Some internet-related modules ''' import socket import urllib import smtplib import time def url_content_part(url, count=None): '''Return a number of bytes from an URL.''' fetched = urllib.urlopen(url) if count is None: text = fetched.read() else: text = fetched.read(count) fetched.close() return text def send_example_email(server, from_addr, to_addr): '''Send an email (with fixed text).''' date = time.strftime( '%a, %d %b %Y %H:%M:%S', time.localtime() ) text = '''\ From: %(from_addr)s To: %(to_addr)s Date: %(date)s Subject: A little Python example for sending mails Hello user This is a mail from %(from_addr)s to %(to_addr)s via server %(server)s Best regards Your Python interpreter ;-)\n''' % vars() host = smtplib.SMTP(server) host.sendmail(from_addr, [to_addr], text) host.quit() raw_input( 'Please ensure you are connected to the internet and press [Return]: ') print try: url = 'http://www.python.org/' count = 150 print 'The first %s characters from %s:' % (count, url) print url_content_part(url, count) print print 'Sending an email:' server = raw_input('Enter a valid mailserver (full name) for your domain: ') from_addr = raw_input('Enter FROM email address: ') to_addr = raw_input('Enter TO email address: ') send_example_email(server, from_addr, to_addr) print 'Mail has been sent.' except (IOError, socket.error): print print 'There seems to be a problem with your internet connection.' print 'Are you really online? Is all set up?' except smtplib.SMTPException: print print 'Sending your mail failed. Please check your parameters and' print 're-execute the program with the correct ones.' From skip at pobox.com Tue Dec 11 10:56:07 2001 From: skip at pobox.com (Skip Montanaro) Date: Tue, 11 Dec 2001 09:56:07 -0600 Subject: Finding out if a python binary has been compiled with or without pymalloc In-Reply-To: References: Message-ID: <15382.11415.117670.619171@12-248-41-177.client.attbi.com> R?mi> I'd like to know if there is a way to find out if a python binary R?mi> distribution has been compiled with or without pymalloc. My R?mi> website hosting machine has python2.1 installed on it, but I don't R?mi> know where this distribution comes from. I only have access to the R?mi> python2.1 binary, and I'd like to check if it uses pymalloc or R?mi> not. The strings command is a crude, but often effective way to search for symbols in an executable. My normal Python executable is compiled with threads and without pymalloc: % strings -a /usr/local/bin/python | egrep -i malloc | sort -u malloc malloc@@GLIBC_2.0 PyMem_Malloc _PyObject_GC_Malloc PyObject_Malloc I also have a without-threads with-pymalloc version, however: % strings -a python | egrep -i malloc | sort -u malloc malloc@@GLIBC_2.0 malloc_hook _PyCore_ObjectMalloc _PyCore_ObjectMalloc_FetchHooks _PyCore_ObjectMalloc_SetHooks PyMem_Malloc _PyObject_GC_Malloc PyObject_Malloc Note the extra *ObjectMalloc* symbols. This is on a recent Linux system using gcc and neither executable was stripped. YMMV. -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From joshyotty at hotmail.com Wed Dec 26 23:27:22 2001 From: joshyotty at hotmail.com (Josh Yotty) Date: 26 Dec 2001 20:27:22 -0800 Subject: The Python community needs a lighter heart to it. References: <40dbad98.0112261431.3e928cf2@posting.google.com> Message-ID: <23302360.0112262027.4ff23468@posting.google.com> pythonnet at hotmail.com (Andrew Nguyen) wrote in message news:<40dbad98.0112261431.3e928cf2 at posting.google.com>... > The python community is a bunch of people who can't take a joke. (Or > at least make one:)) You have got to be a) kidding b) lying or c) dense. Or maybe the humor doesn't make sense to you because you've never seen Monty Python before (Nudge, nudge). ...wake up and smell the dead parrot. > Also, usenet SUXXOR (sucks) because itttt issss > soooo cunfuseeeng... Ack! Moronic l337 5P34K! Do not poison my eyes! Shoo! Go play with QBasic! ...it's not that hard to use Usenet. > I bet you, that if we put a link on the python homepage with a link to > an EZBoard, python would be Much more popular. How does a $100 dollar bet sound? Seriously, though, Python is 'popular' right now. Imagine if the uninspired non-hacker programmers came and poisoned Python forever. ...the thought makes me want to vomit. > The most exciting topic > I have seen to date is 'Fun with Classess in Python 2.2'. Well, the newsgroup appears to have been more fun a couple years back. http://python.org/doc/Humor.html --Josh Yotty From stuffedfriedred at yahoo.com Tue Dec 4 20:02:10 2001 From: stuffedfriedred at yahoo.com (Stuffed Fried Red Pepper) Date: Tue, 4 Dec 2001 20:02:10 -0500 Subject: extracting html table rows into a list References: <9aadf0f.0111220750.719466de@posting.google.com> Message-ID: I just wanted to add that your code is shorter than using the HTMLParser class to do this task. "Walter D?rwald" wrote in message news:mailman.1006449030.30723.python-list at python.org... damien Wetzel wrote: > hi , > does any body has a script which parse a big table from an html file > and create a list of rows ? You could give XIST a try (http://www.livinglogic.de/Python/xist/) Code might look like this: from xist import parsers from xist.ns import html doc = parsers.parseTidyURL("http://www.freshmeat.net/", defaultEncoding="latin-1") firsttable = doc.find(type=html.table, searchchildren=1)[0] rows = firsttable.find(type=html.tr) for row in rows: print row.asPlainString() HTH, Walter D?rwald From grey at despair.dmiyu.org Tue Dec 4 10:34:32 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Tue, 04 Dec 2001 15:34:32 -0000 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <3C0BE492.5DACEA18@mega-nerd.com> <3C0C8872.2A3715A4@mega-nerd.com> Message-ID: On Tue, 04 Dec 2001 08:25:23 GMT, Erik de Castro Lopo wrote: > Easy. Tabs everywhere: > some_dict = { > 'Jane':{'Age':'21', 'Dept':'0001', 'Ext':'1234'}, > 'John':{'Age':'22', 'Dept':'0010', 'Ext':'5678'}, > 'Jeff':{'Age':'23', 'Dept':'0100', 'Ext':'9009'}, > 'Jody':{'Age':'24', 'Dept':'1000', 'Ext':'8765'}, > 'Jeny':{'Age':'25', 'Dept':'0110', 'Ext':'4321'} > } > Beautiful!!!! Uh, no, rather nasty in fact. Face it, that's the one case where tabs fail and is so common as to prevent tabs from being ever used in code. -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From aahz at panix.com Sat Dec 29 13:15:14 2001 From: aahz at panix.com (Aahz Maruch) Date: 29 Dec 2001 10:15:14 -0800 Subject: REPOST: OT: Gender-based security? (was Re: Fate of win32all?) References: <7876a8ea.0112212116.2ebabc23@posting.google.com> <3C2BABD5.1070907@skippinet.com.au> Message-ID: <9$--$$_----___%$%$@news.noc.cabal.int> [BTW, Bruce, could you please make sure to attribute quotes? Makes threads a lot easier to follow.] In article , Bruce Eckel wrote: >Mark Hammond: >> >>Thanks to everyone who replied to this thread - I really appreciate the >>supportive words. I am very sure I will land on my feet, so there is no >>need to worry (now if someone would just tell that to my girlfriend :) > >Women are wired different -- they look to security first. Nope. Perhaps you need to be introduced to some of the women I know. Of course, they *do* tend to prefer Perl.... -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 2 days and counting ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!zeus.visi.com!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: aahz at panix.com (Aahz Maruch) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:38:42 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774635 27193 211.57.49.2 (31 Dec 2001 04:57:15 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:57:15 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From mjais at web.de Tue Dec 4 09:22:18 2001 From: mjais at web.de (Markus Jais) Date: Tue, 04 Dec 2001 15:22:18 +0100 Subject: Any magazines about Python? References: <3c0cd177.5568479@news> Message-ID: On Tue, 04 Dec 2001 14:39:22 +0100, Phredd Phlintstone wrote: > I like to read away from my computer, and am wondering if any of the > popular computer magazines have regular articles/columns about Python? I > am very newbie, and starting to understand just the most basic > programming principles from the Gauld book, "Learn to Program Using > Python." I know about online resources but am wondering if my local > magazine rack has any promise. Thanks Please post any responses to this > to this newsgroup. hello sometimes the linuxjournal http://www.linuxjournal.com has some articels about python, but not very much a year ago or so, they had more. then the linuxjournal had normaly about 180 pages.nowadays it only has about half the size. seems that the python articels suffered from this. also sometimes, doctor dobb's has articels about python http://www.ddj.com markus From rdsteph at earthlink.net Fri Dec 28 20:09:13 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sat, 29 Dec 2001 01:09:13 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: <2$--$$_----_-%$%%$@news.noc.cabal.int> Hmm, it is absolutely amazing how fast PHP got so popular, isn't it? PHP has quite a few more SourceForge projects than Python, as many as Perl in fact (about 2700 I believe, compared to Python's 1300). Also, there are more PHP books in most book stores than Python books. Does anyone know how old PHP is? I'd really like to know. I have not been aware of PHP for much more than two years, but then I wasn't paying any attention before that. When was PHP "launched"? How did it grow so fast? Can the Python community learn anything from this phenomenon? Can we even incorporate some of the good points from PHP for web programming into Python, or Python add-on "products"? Ron Stephens http://www.awaretek.com/plf.html ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2D1833.1D481943 at earthlink.net> Control: cancel <3C2D1833.1D481943 at earthlink.net> Date: Mon, 31 Dec 2001 01:35:21 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774934 27193 211.57.49.2 (31 Dec 2001 05:02:14 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:02:14 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From kragen at pobox.com Wed Dec 5 04:57:05 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 05 Dec 2001 04:57:05 -0500 Subject: Help! string from buffer to socket References: <8b70ef6a.0112041630.53976082@posting.google.com> Message-ID: <831yiaq9am.fsf@panacea.canonical.org> cat_stack at erraticimpact.zzn.com (cat3) writes: > I'm trying to write a class that allows arbitrary strings to be added > to the data to be sent on a socket. A certain amount of data will be > collected from the buffer when the socket is ready for sending. I > don't have lots of network or OOP experience, but am trying to get a > simple class together that can do this. Before I read and debug your code, why aren't you using asyncore.dispatcher_with_send from the standard library? From akuchlin at mems-exchange.org Wed Dec 12 10:10:37 2001 From: akuchlin at mems-exchange.org (Andrew Kuchling) Date: 12 Dec 2001 10:10:37 -0500 Subject: XXX References: <20011212111644.A5144@jupiter.senux.com> Message-ID: <3dpu5kpj82.fsf@ute.mems-exchange.org> Tim Hammerquist writes: > "XXX" has also been used to identify an email, particularly in an AOL > mailbox. ;) On the DB-SIG, people often replace the username and password with 'xxx' when giving sample code. At least one subscriber's domain unfailingly sends a note to the list admin address informing me that the message has been held due to possibly obscene content, and it'll be sent onward after being inspected. Whoever's inspecting those messages must be getting rather annoyed at this point. --amk (www.amk.ca) I sit here for hours. It's like sitting amongst lighthouses, each lighthouse giving you a bearing on lost spaces of time... -- Peter Greenaway, _A Zed and Two Noughts_ From aahz at panix.com Fri Dec 21 15:50:02 2001 From: aahz at panix.com (Aahz Maruch) Date: 21 Dec 2001 12:50:02 -0800 Subject: age of new pythonistas References: Message-ID: In article , Fredrik Lundh wrote: >Tim Peters wrote: >> >> I suspect Fredrik Lundh also knows Mark's age, but you've seen >> how hard it is to get a straight answer from a bot. > >iirc, Barry's a few years older than Mark (or was it the other >way around?), and I'm a few years older than my sister. Am I old enough to date your sister? -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 10 days and counting From zope at thewebsons.com Sat Dec 15 19:16:28 2001 From: zope at thewebsons.com (Ben Ocean) Date: Sat, 15 Dec 2001 16:16:28 -0800 Subject: Compiling Python with Tkinter Message-ID: <5.1.0.14.0.20011215161055.00a46cf0@thewebsons.com> Hi; I'm attempting to compile python2.1.1 with support for tkinter. The problem I'm running into is the fact that, apparently, my tkinter and tcl live in different directories. Therefore, following the instructions in Modules/Setup is a little confusing. Here's what I've done but it doesn't work: # *** Always uncomment this (leave the leading underscore in!): _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \ # *** Uncomment and edit to reflect where your Tcl/Tk libraries are: -L/usr/lib \ ### ***THIS NEXT LINE WAS MY IDEA*** -L/opt/tcltk/lib \ # *** Uncomment and edit to reflect where your Tcl/Tk headers are: -I/usr/include \ ### ***THIS NEXT LINE WAS MY IDEA*** -I/opt/tcltk/include \ # *** Uncomment and edit to reflect where your X11 header files are: -I/usr/X11R6/include \ # *** Or uncomment this for Solaris: # -I/usr/openwin/include \ # *** Uncomment and edit for Tix extension only: # -DWITH_TIX -ltix8.1.8.2 \ # *** Uncomment and edit for BLT extension only: # -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \ # *** Uncomment and edit for PIL (TkImaging) extension only: # (See http://www.pythonware.com/products/pil/ for more info) -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \ # *** Uncomment and edit for TOGL extension only: # -DWITH_TOGL togl.c \ # *** Uncomment and edit to reflect your Tcl/Tk versions: -ltk8.3 -ltcl8.3 \ # *** Uncomment and edit to reflect where your X11 libraries are: -L/usr/X11R6/lib \ # *** Or uncomment this for Solaris: # -L/usr/openwin/lib \ # *** Uncomment these for TOGL extension only: # -lGL -lGLU -lXext -lXmu \ # *** Uncomment for AIX: # -lld \ # *** Always uncomment this; X11 libraries to link with: -lX11 Please tell me how to do this properly! TIA, BenO From ssthapa at classes.cs.uchicago.edu Thu Dec 27 17:17:25 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Thu, 27 Dec 2001 22:17:25 GMT Subject: REPOST: ANNOUNCE: ciphon 0.3.5 Message-ID: <1$--$$_-----$%$__$@news.noc.cabal.int> I've completed ciphon 0.3.5. Ciphon is an utility to provide features similar to the perl CPAN shell. It lets you automatically download and install python modules. Changes: Readline is now optional Several bugs have been fixed (installation of rpms, errors with missing the installed.xml file) The configuration is now saved after the first start up if the ~/.ciphonrc file is not present A few other bugs in installing and determining whether a package is current have been fixed Ciphon is available from ftp.community.tummy.com in /pub/python-packages, or from sourceforge (https://sourceforge.net/projects/pythonsiphon/), or from within ciphon itself. There are still some problems with rpm installations due to modules not listing all their files. However, standard installation should work and I have received reports of successful installations using standard installations. There is also a mailing list for ciphon available at sourcefoge. The signup page is at http://lists.sourceforge.net/lists/listinfo/pythonsiphon-devel -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newsengine.sol.net!news-feed.riddles.org.uk!sn-xit-03!supernews.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:43:19 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775549 27193 211.57.49.2 (31 Dec 2001 05:12:29 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:12:29 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From tchur at optushome.com.au Sun Dec 9 14:58:10 2001 From: tchur at optushome.com.au (Tim Churches) Date: Mon, 10 Dec 2001 06:58:10 +1100 Subject: Eclipse and Python/Jython? References: <9uu5rr$8ed$1@news.worldonline.be> <3C13B960.13F8959F@optushome.com.au> Message-ID: <3C13C252.B55B07DC@optushome.com.au> I know it is early days yet but are cunning plans being hatched to integrate Jython and/or CPython into Eclipse? At first glance Eclipse looks like an IDE for build Java Web applications, but apparently it goes much further than that. It seems that IBM is trying to position it as the main alternative to MS Visual .NET, and they are doing so via an open source strategy. For more information and links on Eclipse, see http://www-106.ibm.com/developerworks/library/l-erick.html Tim C From aahz at panix.com Fri Dec 21 10:50:52 2001 From: aahz at panix.com (Aahz Maruch) Date: 21 Dec 2001 07:50:52 -0800 Subject: Huge Dicts and perfomance References: Message-ID: <9vvlos$lb7$1@panix3.panix.com> In article , Lucio Torre wrote: > >the main problem of course is that doing it this way, performance >sucks. I took me nothing to code it, but it takes to much to run (more >than coding). So, any ideas on how to achieve my goal in a better >(faster) way? If I had to guess, the problem more likely comes from your choice of algorithms rather than dict performance per se (unless you have hundreds of thousands of nodes). You may want to consult a textbook on data structures and algorithms. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 10 days and counting From donod at home.com Thu Dec 13 02:13:32 2001 From: donod at home.com (Don O'Donnell) Date: Thu, 13 Dec 2001 07:13:32 GMT Subject: Designing for Inheritance References: Message-ID: <3C18551E.8ED9E883@home.com> "nspies.geo" wrote: > > The problem is thus: how do I design the base class so that it will > create an extracted object of the correct type, even if it's been > inherited? It may well be that the inherited class needs to wrap the > base class function, but I do not wish to re-write the function in > every base class. > > Here it is in code. > > -- > > class BaseAlignment: > def extractx(self, x): > extraction = BaseAlignment() > extraction = self.data[0:x] > > return extraction > > class InheritedAlignment(BaseAlignment): > def extractx(self, x): > BaseAlignment.extractx(self, x) > > #do something more here... > > return extraction > > -- > > The problem is that the return value of extractx from > InheritedAlignment is a BaseAlignment.... > Any hints? Sure. Instead of using a fixed identifier for the base class name, use the variable self.__class__ instead: class BaseAlignment: def extractx(self, x): extraction = self.__class__() ... Now if self is actually an instance of subclass InheritedAlignment, extraction will also be an instance of subclass InheritedAlignment. > > Thanks, No problem. Hope this is what you are looking for. Cheers, Don From jessw at loop.com Fri Dec 21 18:45:53 2001 From: jessw at loop.com (Jesse W) Date: Fri, 21 Dec 2001 15:45:53 -0800 Subject: Deleting variables referenced in nested scope Message-ID: <3C235931.16267.9C16A41@localhost> As I was playing arround with the new nested scopeing rules in Python 2.2a2, I got a SyntaxError I did not understand. Here is the code: def foo(): x=5 add=lambda a:x+a del x When I ran this, I got this error: SyntaxError: can not delete variable 'x' referenced in nested scope What is this error? Why is it here? What does it mean? Thank you for your time, Jesse Weinstein From fperez528 at yahoo.com Thu Dec 20 07:27:28 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Fri, 21 Dec 2001 11:55:28 +2328 Subject: Another distutils question References: <9vumpp$hn2$1@peabody.colorado.edu> Message-ID: Martin von Loewis wrote: > Fernando =?ISO-8859-1?Q?P=E9rez?= writes: > >> For the distutils gurus out there: how can I specify a hierarchy of nested >> directories to be copied somewhere? > > For PyXML, we use an enhanced install_data command, that supports > manifest-style file lists. You can find it in the PyXML CVS, under > xml/setupext. > > HTH, > Martin Thanks Martin. I actually have PyXML and did see the setupext/ stuff, I just didn't want to add yet another extraneous module to my package. I'm trying to stick to the standard tools when possible, and my case was simple enough that an ugly kludge allowed me to make it work (but *really* ugly). I did like a lot the enhanced install though. It seems like the kind of functionality that's badly needed in distutils. Any chance of that making it into the standard for new releases? cheers, f From claird at starbase.neosoft.com Mon Dec 31 11:17:16 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 31 Dec 2001 10:17:16 -0600 Subject: Is Stackless Python DEAD? References: <184fbd02.0110262039.74799675@posting.google.com> Message-ID: <110A0579A87BA846.8CEE70EF24F483BD.740CFC77F4D54FA3@lp.airnews.net> In article , Christian Tismer wrote: >Well, it is a little late to answer this, but... > >Michael Hudson wrote: > > > Martin von Loewis writes: >... > >... > > >>- It adds a field nesting_level to the thread state, without > >> ever checking its value (it just counts the nesting level) > >> > > > > I imagine this was just for bragging with :) > > >Yes. I needed a way to track when and why there are still >recursions. At sme pahse I also had the idea to drive >decisions on this when I'm allowed to switch things, but >later I learned that this is the wrong way. Along with bragging rights, one of the not-obvious-but- easy-to-explain reasons to introspect on recursion depth is as a defense against denial-of-service (or more un- intentional) security hazards. If you're executing something dynamic enough to give a user a wedge into the execution stack, it's prudent, however crude it might seem, to impose resource limits. One engineering discovery is that recursion depth can be a useful resource to limit. . . . >I'm at a redesign for Stackless 2.2. I hope to make it simpler, >split apart Stackless and optimization, and continuations are >no longer my primary target, but built-in microthreads. Cool! . . . -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From ed_play at yahoo.co.uk Thu Dec 20 15:44:34 2001 From: ed_play at yahoo.co.uk (Ben Ainsworth) Date: 20 Dec 2001 12:44:34 -0800 Subject: Raw sockets References: Message-ID: <2c55c8be.0112201244.2e4e1027@posting.google.com> > [1] If you're going to use tcp, then why do you need raw sockets? I've got the impression that you need the tighter control over TCP that raw sockets allows, as you only send a SYN packet (and an RST) and don't complete the three way handshake. > [2] Since traceroute relies on the icmp messages returned when the > TTL goes to zero, I'm not sure how you could write a traceroute > without icmp. Well apparently it's been done: http://michael.toren.net/code/tcptraceroute/ , but not for python / windows. Obviously the replies are in icmp (except the last), but from what little I know of network security, tcp is the least blocked protocol, particularly via port 80. > [3] Raw sockets using Python are pretty much the same as raw sockets > using C or any other language -- you need to manually wrap your > data up in the headers that the tcp/ip layers normally wrap for > you (including checksums). I think there's a 'ping' in python > floating around that uses raw sockets to make icmp packets. > You might search the archives. Thanks, I've found a C tutorial on raw sockets, and a python version of ping. Does anyone have a copy of Jeremy Hylton's code? The link at http://www.python.org/~jeremy/python.html is dead. Ben Ainsworth From djrassoc01 at mindspring.com Sat Dec 29 11:57:39 2001 From: djrassoc01 at mindspring.com (Dr. David J. Ritchie, Sr.) Date: Sat, 29 Dec 2001 10:57:39 -0600 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2CBACB.FBF3C3C9@mindspring.com> <3C2D47F0.6DF7C8BE@mindspring.com> Message-ID: <6$--$$_----__$%$_$@news.noc.cabal.int> "Dr. David J. Ritchie, Sr." wrote: > ...I am probably on shaky > ground here due to ignorance... At least on topic in regard to the above anyway ;-} and somewhat on the topic of what doex language X have that makes it more attractive (or less attractive) than Python, I'd like to say that it almost seems like Python is not that far away from allowing as a language feature: from module.python.org import * or from module.python.org import graphics where "module.python.org" is some internet node. It would seem that such a feature would embrace and include as part of Python the Java capability of incorporating classes over the net and up the ante on the .net initiative (remember what I said about ignorance here). Wouldn't this go some way towards solving the problem of encouraging more module sharing a la Perl's CPAN but in a Python-esque way...? -- Dr. David J. Ritchie, Sr. djrassoc01 at mindspring.com http://home.mindspring.com/~djrassoc01/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.tele.dk!small.news.tele.dk!134.75.7.11!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Dr. David J. Ritchie, Sr." Newsgroups: comp.lang.python Subject: cmsg cancel <3C2DF5FF.E332F4EE at mindspring.com> Control: cancel <3C2DF5FF.E332F4EE at mindspring.com> Date: Mon, 31 Dec 2001 04:57:36 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774689 27193 211.57.49.2 (31 Dec 2001 04:58:09 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:58:09 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From calves at coelce.com.br Sat Dec 1 14:44:40 2001 From: calves at coelce.com.br (Alves, Carlos Alberto - Coelce) Date: Sat, 1 Dec 2001 16:44:40 -0300 Subject: Converting an integer to base 2 Message-ID: <29A97D00F387D411AC7900902770E14802CCA15C@lcoeexc01.coelce.net> Yeah, it works. But not for n=0, when we get the wrong result '' intead '0'. See below: ====================================================================== Python 2.1 (#15, Apr 16 2001, 18:25:49) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. IDLE 0.8 -- press F1 for help >>> def ito2(n): if n < 1: return '' else: return itoa2(n / 2) + str(n & 1) >>> ito2(0) '' >>> ======================================================================== I can modified the code do fix it, but it is appending the '0' string at the begining of result. Maybe someone could resolvt it: See the modified code below do the same, also to n=0, but adding '0' at head of string. def ito2(n): if n==0: return '0' elif n < 1 and n!=0: return '' else: return ito2(n / 2) + str(n & 1) >>> ito2(4) '0100' > -----Original Message----- > From: William Park [mailto:opengeometry at yahoo.ca] > Sent: Friday, November 30, 2001 5:37 PM > To: python-list at python.org > Subject: Re: Converting an integer to base 2 > > > On Fri, Nov 30, 2001 at 10:16:16PM +0200, Erno Kuusela wrote: > > def itoa2(n): > > if n < 1: > > return '' > > else: > > return itoa2(n / 2) + str(n & 1) > > Brillant! > > -- > William Park, Open Geometry Consulting, . > 8 CPU cluster, NAS, (Slackware) Linux, Python, LaTeX, Vim, Mutt, Tin > > -- > http://mail.python.org/mailman/listinfo/python-list > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gmcm at hypernet.com Sun Dec 9 11:32:14 2001 From: gmcm at hypernet.com (Gordon McMillan) Date: 09 Dec 2001 16:32:14 GMT Subject: Creating a "package" using C extensions? References: <4bo41u8de4r4njcchh4g3mcuvdhqohhu39@4ax.com> Message-ID: Courageous wrote: > > So. I've written Python C extensions before. And I've > written Python packages before, with subdirectories and > __init__.py files and so forth before. What I'm unclear > on is the proper way to combine these. > > I can see that if I just used a normal __init__.py and > then pointed it to C extension dlls, this would probably > work. > > Is this the approved way of doing this? Yes. > Is there a way to govern the entire thing entirely from > C? IOW, is there a __init__.py equivalent for C modules? You could probably hack something up by butchering the module object in some way, but the import code assumes that extension modules are just plain modules, not packages. -- Gordon http://www.mcmillan-inc.com/ From altis at semi-retired.com Sat Dec 29 03:05:15 2001 From: altis at semi-retired.com (Kevin Altis) Date: Sat, 29 Dec 2001 00:05:15 -0800 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <458b194a.0112282052.1123341@posting.google.com> Message-ID: <6$--$$_----_--$%_$@news.noc.cabal.int> I couldn't agree more. Thus you won't be surprised that in many ways that is the sweet spot that PythonCard is aiming at. You'll need wxPython 2.3.2 or higher and Python 2.x to give it a try, but you can at least look at screen shots if nothing else. http://pythoncard.sourceforge.net/ We are moving towards a component model, which will give you many of the capabilities you are familiar with from using COM. There is a layout editor (the resourceEditor sample) and automatic event binding and event handlers that should look a lot like what you have used with VB. You can already build standalone Windows executables using py2exe. Input and criticism are welcome. ka "Resty Cena" wrote in message news:458b194a.0112282052.1123341 at posting.google.com... > The real source of growth for both Python and Ruby are the 3M VB > developers worldwide. Whichever can provide what it is that VB > developers like about VB on top of what Python and Ruby natively offer > will hit the jackpot. To me these are: (a) Visual drag-and-drop > application builder with data aware controls, and (b) good support for > the big databases (Oracle, Sybase, Informix). I'm going through the > gui chapters of Mark Lutz' PP2E, and while I can see that handcrafting > gui this way gives me a lot of control, I'm thinking I don't want to > do this -- I'm a database application developer. I want to write a > dynamic work order system and I have no ambition to become a system > tool maker. And so do the 3M VB developers. > > VB used to be a toy language. Not too long ago no respectable company > would use VB for their corporate systems. It did not start to become > an enterprise solution until VB3. What happened there? > > VB 6 will be retired in favor of VB.NET. Personally I think that the > direction VB has taken, towards a verbose C#, is misguided. VB should > have evolved into something like Python or Ruby. With VB.NET, VB > programmers will ask, "What's the point?" Might as well dive into C#. > Or look around for something else. > > Hopefully by that time -- 18 months from now? -- Python and/or Ruby > will have what it is VB programmers cannot live without. > > Folks, come up with (a) and (b) above, then start posting at c.l.vb. > > > Paul Prescod wrote in message news:... > > Dave Thomas wrote: > > > > > > ... Instead, Ruby will attract folks from outside the > > > Python world. Ruby and Python differ in philosophy and _feel_. Some > > > folks like one, some the other. I don't see it as competition. I see > > > it as choice. > > > > Is there really a difference? Pepsi and Coke are choices. They are also > > in competition. They have a somewhat different taste but are more > > similar than different. In the long run, there will come a day when > > they've taken as much of the market share of other drinks away as they > > will, and the primary competition will be between the two of them. > > > > Paul Prescod ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Kevin Altis" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:44:44 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774808 27193 211.57.49.2 (31 Dec 2001 05:00:08 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:00:08 +0000 (UTC) X-Report: Report abuse to abuse at uswest.net X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jlh at home.com Mon Dec 3 22:10:38 2001 From: jlh at home.com (Jeff Hinrichs) Date: Mon, 3 Dec 2001 21:10:38 -0600 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> Message-ID: <11cf01c17c71$401214c0$6702a8c0@gato> I like the width of 4 spaces also, BUT I use tabs and configured my editor to "DISPLAY" tabs as 4 characters in width. It does not replace tabs with spaces it displays the white space equivalent to 4 spaces. Spaces are great for separating words/glyph combinations but are not proper for formatting. Hammers work for nails but not screws. Same for spaces v. tabs. > But this is all academic, because the defacto and near dejure standard > for Python is 4 spaces per indentation level. Tabs are deprecated. > > Insert tabs if you like. I predict you will annoy lots of other Python > programmers, when you begin to work with them. > > C// > > -- > http://mail.python.org/mailman/listinfo/python-list > From aahz at panix.com Fri Dec 28 12:41:30 2001 From: aahz at panix.com (Aahz Maruch) Date: 28 Dec 2001 09:41:30 -0800 Subject: REPOST: O'Reilly book production (was Re: Wine applicability) References: <3C2A9D33.67FEC261@earthlink.net> <200112281405.IAA20884@starbase.neosoft.com> <200112281642.KAA24897@starbase.neosoft.com> Message-ID: <9$--$$_----_---%%$@news.noc.cabal.int> In article , Alex Martelli wrote: >"Cameron Laird" wrote in message >news:200112281642.KAA24897 at starbase.neosoft.com... >>Alex: >>> >>>that's my primary need -- Word with O'Reilly customized macros &c, >>>as that's what I'm required to use for one of the books. So, I >> >> O'REILLY MAKES YOU USE WORD MACROS?!??!!? >> I've got to talk with those boys. That strikes me as an atrocity. > >"makes" is probably an overbid. The Cookbook I'm doing in XML with a >custom DTD, and that's just fine - I get to use VIM:-). But for the >Nutshell, that wasn't an option. Really? May you explain why? (I'm still hoping to do a book with O'Reilly and I *really* don't want to use Word.) -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 3 days and counting ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: aahz at panix.com (Aahz Maruch) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:07:09 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775190 27193 211.57.49.2 (31 Dec 2001 05:06:30 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:06:30 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From mhammond at skippinet.com.au Sun Dec 16 08:19:27 2001 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun, 16 Dec 2001 13:19:27 GMT Subject: cannot run makepy or COM browser References: Message-ID: <3C1CA004.5030609@skippinet.com.au> Robert C. Kircher, Jr. wrote: > When I try to run makepy or the com browser I get the following errors. > Any ideas? It looks like your installation is corrupt. > >>> Failed to execute command: > from win32com.client import makepy;makepy.main() > Traceback (most recent call last): > File "D:\Python21\Pythonwin\pywin\framework\toolmenu.py", line 103, in > HandleToolCommand > exec "%s\n" % pyCmd > File "", line 1, in ? > ImportError: cannot import name makepy This is looking for win32com\client\makepy.py. From Pythonwin, check out what win32com.client.__path__ is, and make sure it is where you expect (ie, the directory where makepy lives!) > >>> Failed to execute command: > from win32com.client import combrowse;combrowse.main() > Traceback (most recent call last): > File "D:\Python21\Pythonwin\pywin\framework\toolmenu.py", line 103, in > HandleToolCommand > exec "%s\n" % pyCmd > File "", line 1, in ? > ImportError: cannot import name combrowse Ditto for win32com\client\combrowse.py Mark. From tatebll at aol.com Fri Dec 28 13:37:11 2001 From: tatebll at aol.com (Bill Tate) Date: 28 Dec 2001 10:37:11 -0800 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: Roy Smith wrote in message news:... > tatebll at aol.com (Bill Tate) wrote: > > This past spring, I spent a full month pouring over Zope in detail. I > > pulled every example product I could find that I thought would be > > relative to the purpose of setting up a commercial-based application. > > I downloaded the tutorial and the draft zope book. I pulled down > > every bit of documentation I could find for developers. In so many > > cases, I found whatever documentation was available that key aspects > > of the implementation took the "assumed facts-already-in-evidence" > > approach; omitting key details that would were critical to improving > > my understanding of using Zope. > > Unfortunately, I have to agree. I've looked at Zope a few times, because > the hype sounded really cool (as all good hype should). But, every time I > ever tried to understand it to the level of, "OK, so how do I actually > write an application using this", I was stumped. I dunno maybe, I'm missing something here? Here's the latest usage figures for PHP - which has been around for how long now???? PHP: 7,095,691 Domains, 1,046,426 IP Addresses Source: Netcraft What's wrong with this picture???? From ssthapa at classes.cs.uchicago.edu Tue Dec 18 01:53:24 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Tue, 18 Dec 2001 06:53:24 GMT Subject: Python CPAN beta test References: Message-ID: Walter Moreira wrote: >> Do you have expat installed? > >I looked into Modules/Setup and I found that expat is commented. Thanks. >Perhaps this kind of dependence should be more clearly stated, in order to >convince more people to try ciphon. > I'll put the comment in but I thought that expat was a required since the sax parsers in the python standard library depend on it. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From emile at fenx.com Sat Dec 29 10:04:35 2001 From: emile at fenx.com (Emile van Sebille) Date: Sat, 29 Dec 2001 07:04:35 -0800 Subject: need help with class of arrays which have attibutes References: <3C2D3C2C.C9EF5AFE@pythonemproject.com> Message-ID: "Rob" wrote in message news:3C2D3C2C.C9EF5AFE at pythonemproject.com... > > Hi Emile, I've been reading the books and experimenting with different > kinds of classes, but it just doesn't seem possible to use an array as a > basis for a number of class attributes. For example, > wire=conductor (i.e. class) wire[1].x1=30 wire[2].x2=40 etc. Rob. import Numeric class Test: def __init__(self): self.attrs = Numeric.zeros(10) def __repr__(self): return repr(self.attrs) t1 = Test() t1.attrs[2] = 1 t2 = Test() t2.attrs[2] = 2 print t1 print t2 HTH, -- Emile van Sebille emile at fenx.com --------- From kunal at kunalk.co.uk Sat Dec 1 16:42:21 2001 From: kunal at kunalk.co.uk (Kunal Kothari) Date: Sat, 1 Dec 2001 21:42:21 -0000 Subject: Just started, need help! References: Message-ID: <9ubis6$92f$1@plutonium.btinternet.com> Save the entire program as a .py script and then type "python abc.py" where abc is the name. this will run your program. "Kyle Thompson" wrote in message news:u0gnomis1sgl95 at corp.supernews.com... > Hi, > When I do an input command, I hit enter so I may then do the if and else > command but when I hit enter it try's to run the input command. How do I > make it not run when its being made and just run when I'm done with a part > and want to run it? > -Thanks > > From phd at phd.pp.ru Sat Dec 1 05:42:41 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Sat, 1 Dec 2001 13:42:41 +0300 Subject: Python 2.2: socket.ssl documentation? In-Reply-To: <200112011035.fB1AZon01743@lap1.mtg.at>; from andreas@mtg.co.at on Sat, Dec 01, 2001 at 11:35:43AM +0100 References: <200111291746.fATHkeY24178@lap1.mtg.at> <20011130191622.GA483@lilith.hqd-internal> <200112011035.fB1AZon01743@lap1.mtg.at> Message-ID: <20011201134241.C7648@phd.pp.ru> On Sat, Dec 01, 2001 at 11:35:43AM +0100, Andreas Kostyrka wrote: > > htt?://www.cs.fhm.e?u/?ifw00065/??ssl/ > What was that URL? www.cs.fhm.eu doesn't seem to exist. :( ^^ edu, I think Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From jeff at ccvcorp.com Thu Dec 20 14:09:04 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Thu, 20 Dec 2001 11:09:04 -0800 Subject: Newbie Programming References: <84fd22ef.0112192032.14c75f8a@posting.google.com> Message-ID: <3C223750.A4ECFEAD@ccvcorp.com> Evan Roman wrote: > I have just begun programming in Python a couple months ago. While i > feel like i am doing OK, i don't think im getting any better. The > problem is i can't think of anything to program... I think I have most > of the fundamentals down, but i can't think of any ways to use them. > I was just wondering if there was some website that gives ideas of > little projects to do so that one could sharpen his programming > skills. Thanx in advance for all the help. > -Evan You might want to check out Useless Python at www.lowerstandard.com/python It's aimed at relative beginners, and has lots of code samples, suggested projects, and challenges. Jeff Shannon Technician/Programmer Credit International From mhammond at skippinet.com.au Thu Dec 20 17:58:53 2001 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 20 Dec 2001 22:58:53 GMT Subject: Win32Service and Service Manager References: <52842usq62dho41m9i4lg15l8pgfc0h8m3@4ax.com> Message-ID: <3C226D30.5080902@skippinet.com.au> Dale Strickland-Clark wrote: > I've written a basic service and it stops and starts with the Net > command but I can't find it or anything relating to Python in the > Service Manager. > > So the questions are: > > 1. Where is it hiding? > 2. How do I change the user it runs under? > 3. How do I change the startup mode? > > OS is Win2K I am not too sure what you are asking. There are no generic Python features in the Service Control Manager - each service using Python is completely stand alone. win32serviceutil.py has code that interacts with the Service Control Manager, including installing services using arbitary user names and start modes. See win32serviceutil.HandleCommandLine(). Mark. From quinn at chunder.ugcs.caltech.edu Mon Dec 3 21:04:15 2001 From: quinn at chunder.ugcs.caltech.edu (Quinn Dunkan) Date: 4 Dec 2001 02:04:15 GMT Subject: python editor poll References: <3bfd7f87@news.airtel.net> <3C03CFAC.6A29863@earthlink.net> Message-ID: On Thu, 29 Nov 2001 23:19:44 +0100, J?rgen A. Erhard wrote: >And in my case... Emacs, since I happened to run across uEmacs in my >Amiga days (first editor that felt *good*). (As if anyone wanted to >know that ;-) vim was originally an amiga editor, I think. Or at least had ports early on. The first time I ran across vim was version 1.something on a Fred Fish CD, and I had been using uEmacs at the time :) From cliechti at gmx.net Sat Dec 29 19:41:29 2001 From: cliechti at gmx.net (Chris Liechti) Date: 30 Dec 2001 01:41:29 +0100 Subject: values of sys.platform? for a serial port lib References: <3C2E543D.4BFB07D@engcorp.com> Message-ID: Peter Hansen wrote in news:3C2E543D.4BFB07D at engcorp.com: > Between links on Unix, third-party serial port devices under > Windows which might not use the COMx convention, and other such > variations, I'd strongly recommend you *not* try to use an > index origin of 0 but instead pass the open() routine (or > whatever you have) a *string* naming the serial port. i want it to run mainly on win32 and linux. the user of the lib should not need to care about device names. i use a function to create the device string so the real numbering with numbers and/or letters is no problem. i also have an optional argument to specify the port string, but when this is used it isn't portable anymore. > By the way, does your win32 implementation work well with > threads, if one thread is trying to read from the port while > the other is trying to write to it? i haven't tested it that way. i use it in a multi-threaded environment, but the class that accesses the serial port (and generates binary communication frames) uses means from the module threading. the lib just calls the underlying functions from the os, so no thread safety from there. chris -- Chris From kwg at renre-europe.com Fri Dec 7 11:18:51 2001 From: kwg at renre-europe.com (Ken Guest) Date: 07 Dec 2001 16:18:51 +0000 Subject: COM with Python. Message-ID: <1007741936.1170.17.camel@lewis> I'm new to coding com objects in Python and am trying to figure out why I keep getting a Run Time error 429 (ActiveX component can't create Object) raised by VB's CreateObject function. Everything seems to register ok (as far as registering as a COM server anyways). But I keep getting either that error, or python import related errors. I've tried using SimpleCOMServer.py from chapter 5 of the "Programming on Win32" book and attempting to create a PythonUtilities object and that worked fine. could somebody please help me on this one? thanks. k. ===vb code=== Dim svr As Object Set svr = VBA.CreateObject("renre.GPS_layerstats.Objects.COMRunObject") ===python code below==== ---Objects.py----- class RunObject: def __init__(self): self._results = None def test(self): return "test" class COMRunObject(RunObject): """COM version of the RunObject.""" _reg_clsid_ = '{358FD80E-1190-40A7-9796-D5DBDB52f580}' _reg_desc_ = "renre.GPS_layerstats.Objects" _reg_progid_ = "renre.GPS_layerstats.Objects" _reg_class_spec_= "renre.GPS_layerstats.Objects.COMRunObject" _public_methods_ = ["test" ] def __init__(self): self._robj = RunObject() self.userNameSpace = {'RunObject':self._robj} ----app.py---- import Objects if __name__ == __main__: if os_name == "nt": import win32com.server.register win32com.server.register.UseCommandLine(Objects.COMRunObject) -- The duck quacks. From LLewin at oreilly.com Fri Dec 28 14:27:38 2001 From: LLewin at oreilly.com (Laura Lewin) Date: 28 Dec 2001 11:27:38 -0800 Subject: REPOST: Re: Wine applicability (was: Python Popularity: Questions and Comments) References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9901.998345FB@earthlink.net> <200112281405.IAA20884@starbase.neosoft.com> Message-ID: <2$--$$_----_--_-_$@news.noc.cabal.int> Hi, Just a quick note to say that O'Reilly doesn't make anyone use Word. You can use Word, Frame, or XML. Alex started the Nutshell in Word so we're sticking with it. If it's too much of a problem, though, Alex, we can change. Let's talk off the list. Laura LLewin at oreilly.com "Alex Martelli" wrote in message news:... > "Cameron Laird" wrote in message > news:200112281405.IAA20884 at starbase.neosoft.com... > ... > > >I don't do much gaming, but I still have to use Windows (mostly in > win4lin > > >under Linux) for a few needs (e.g., SOME durned webpages that I need > won't > > >show correcty under any browser except Internet Explorer). Not to > mention > > >that think3 is a mostly-Windows shop, too. > > > > > >Linux is my preferred platform for most tasks, except that my > firewall/etc > > >machine runs OpenBSD (sometimes security is more important than richness > > >of features, support for strange hardware, and so on). > > . > > I'm a tiny surprised; I sincerely thought you > > were most comfortable with Windows for COM and > > ADO riches. > > I do love COM and COM-based technologies, and for the last few years > I've had to immerse myself almost exclusively in Windows to develop > some of the expertise for which I was (and am) gainfully employed. But, > out of all the operating systems and environments I've tried (including > also Vax/VMS, IBM mainframe OS's such as VM/SP and MVS, Apollo Domain, > and quite a few others) Unix-like ones have always been my personal > preference for most tasks. I used Linux at home in '92-'95, before > the switch to Windows for "total immersion/gain expertise" purposes, > and this year I've been able to switch back to Linux at home (and > OpenBSD for the firewall/etc -- now THAT is stability, solidity, and > security; upon reviewing most all available environments, OpenBSD > struck me as heads and shoulders above the crowd -- but, behind the > firewall, I find Linux preferable, given typical "consumer" needs such > as Windows emulation, viewing Realmedia files, and so on). > > > > Alex, do you have any sense of how well "SOME > > durned webpages ..." look when viewed with IE > > under Wine on Linux? Are you saying that they > > *are* acceptable through win4lin-plus-IE? > > I was unable to make Microsoft Word run perfectly under Wine, and > that's my primary need -- Word with O'Reilly customized macros &c, > as that's what I'm required to use for one of the books. So, I > did not try Wine extensively on other tasks. I did try VMWare (a > beta) and found it somewhat clunky, ponderous, and slow, although > maybe that was its beta nature; anyway, I wasn't motivated to plunk > down several hundred dollars for the final version to find out. > > Then I discovered, carefully hidden on a CD of my favorite Linux > Distribution (Mandrake 8.1 powerpack), a demo/trial version of > NeTraverse's Win4Lin. Half an hour after starting to try it out > I had purchased the full unlimited license online (after trying > to do so, without success, directly at Mandrake Store, I just got > to NeTraverse's site, and, there, it was a snap) -- 1/4 the price > of VMWare and more usable for my purposes. Lots of limitations > that may be important to some: you only get to run Windows98 on > top of Linux, and your Windows "machine" doesn't get to see any > strange hardware you may have (in my case, a durned Winmodem by > Conexant, really win-only; fortunately I was later able to have > it exchanged with a Lucent-chipset one, which does run fine under > Linux, it appears). But those limitations were not important for > my own specific purposes. All webpages show up just fine under > IE 5.5 (haven't bothered downloading 6, I'm told it plays havoc > with CSS handling), Word runs, and so does Visual Studio when I > need to compile/try out something in Windows version. I have > occasionally used Excel, Powerpoint, the OKbridge Windows clent, > and a few minor things -- for each of those I'd have good Linux > side alternatives too, but, since I had win4lin already, why > bother. I believe the only failure was when trying to examine > some files with the Windows Media Player. I do get occasional > "crashes" (of the simulated Win98 environments), but roughly as > often as a real Win98 crashes under similar usage, so I don't > think that's win4lin's fault. > > > Alex ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!nnxp1.twtelecom.net!newsfeed.cs.wisc.edu!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: LLewin at oreilly.com (Laura Lewin) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:59:02 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775115 27193 211.57.49.2 (31 Dec 2001 05:05:15 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:05:15 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From chrishbarker at attbi.com Fri Dec 28 14:08:58 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Fri, 28 Dec 2001 11:08:58 -0800 Subject: set decimal place References: <3c291037.4684696@news.tm.net.my> <3C292938.ED322C60@bellatlantic.net> <184fbd02.0112260109.4392423@posting.google.com> <3C2A29A5.8E9FB5BE@engcorp.com> <3C2B794A.800A94E5@attbi.com> <3C2BED49.E54CB73E@engcorp.com> Message-ID: <3C2CC34A.ED177E8D@attbi.com> Peter Hansen wrote: > > not completely. you might want to check if two values are the same to 4 > > decimal places, in which case round should work just fine: > > > > >>> 10.0/3 == 10.00001/3 > > 0 > > >>> round(10.0/3,4) == round(10.00001/3,4) > > 1 > > I don't know if this is guaranteed to work in all cases. That depends on how robust the round() code is, and I have no idea about that. Someone who knows better than me suggested using float("%.4g"%x) to get significant figures, because most C libraries have robust and correct code for the %g format specifier. Also, there is the problem of how you choose to define "correct" rounding. There is no one definition. > Comparing floating point values directly is generally > not a good idea, although I don't know whether this applies > to rounded values, and if so how far you have to round them > before it makes it safe. Exactly, it is one easy way to check if two floating point values are "close enough", by a criteria most of us understand. > If it is safe, you have a valid point, but not likely what > the OP wanted. The OP wasn't all that clear about what they wanted, but you're probably right! -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From opengeometry at yahoo.ca Wed Dec 5 21:57:47 2001 From: opengeometry at yahoo.ca (William Park) Date: Wed, 5 Dec 2001 21:57:47 -0500 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) In-Reply-To: ; from tim.one@home.com on Wed, Dec 05, 2001 at 09:00:57PM -0500 References: <20011205192505.B1704@node0.opengeometry.ca> Message-ID: <20011205215747.A2268@node0.opengeometry.ca> On Wed, Dec 05, 2001 at 09:00:57PM -0500, Tim Peters wrote: > [William Park] > > One solution that has been proposed long ago (and many time since) is > > end-block keywords like shell. Hmm, it's kind of funny... I often type faster than I think. > > Let's see. > > for i in range(10): > if i % 2 == 0: > print i, i**2 > shell > shell > > Yup, that works. I'll add > > from __future__ import shell > > to 2.2 if it will stop this discussion . -- William Park, Open Geometry Consulting, . 8 CPU cluster, NAS, (Slackware) Linux, Python, LaTeX, Vim, Mutt, Tin From dvh at kph.uni-mainz.de Fri Dec 14 05:33:16 2001 From: dvh at kph.uni-mainz.de (Dietrich von Harrach) Date: Fri, 14 Dec 2001 11:33:16 +0100 Subject: open second xterm under X11 Message-ID: <3C19D56C.B45C867F@kph.uni-mainz.de> How can I open and use a second xterm or text window from within a python program. Tcl/Tk seems to be overkill and curses too primitive. D. Harrach From jeff at ccvcorp.com Thu Dec 27 14:11:09 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Thu, 27 Dec 2001 11:11:09 -0800 Subject: REPOST: Re: A new message board is up References: <40dbad98.0112262232.1868734e@posting.google.com> Message-ID: <4$--$$_----_%__$%$@news.noc.cabal.int> Andrew Dalke wrote: > Andrew Nguyen wrote: > >A new message board (that doesn't have the Usenet delay) is up! > > >Also, usenet SUXXOR (sucks) because itttt issss soooo > >cunfuseeeng... Why not switch to an EZBoard? Why have maling > >lists that are too confusing? I for one say that we create a > > NEW forum! > > But it does require a login, registration, including address, > income(!), and marital status(!!) information, and a 300 line > license agreement. Since it's a web based system there's also > a lack of good search system, no way to add your own filters, > no support for off-line reading, killing a thread, archive > messages, or all those other features Usenet readers have > accumulated over time. I don't think it can scale up to > several hundred messages a day, like c.l.py has. I agree, Andrew. As a frequent contributor to another EZBoard group (focused on a local community), I can say that for certain things, the features that EZBoard has are great. For our local community group, I wouldn't want to use Usenet. But, by the same token, there are things for which Usenet is better. (And how on earth is Usenet confusing? Maybe it's just a matter of using a crappy newsreader--Outlook Express, perhaps?) I wouldn't want to read this Python group on EZBoard. One should match the tool to the situation, and however pretty and shiny a tool EZBoard might be, its features do not make it the most suited for an open programming-language forum. EZBoard *can* handle several hundred messages daily, but it can get to be a bit slow at times, especially since it tends to include a moderate amount of graphics. Also, EZboard is commercial--it's supported by popup ads. A community can buy freedom from ads, at a rate that's determined by the traffic on that board--I'd estimate several thousand dollars per year, at the traffic rate of c.l.py. I don't want to see ads while reading c.l.py, nor do I think it's reasonable to expect members to donate money. To be honest, I don't think it's reasonable to require "membership" (however easily gained) to post in a programming forum. For these reasons and others (like sheer disgust at the thought of anyone using "l33t sp34k" in anything other than total parody), I won't be participating in this Python EZBoard. Jeff Shannon Technician/Programmer Credit International ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!nycmny1-snh1.gtei.net!news.gtei.net!newsfeed.mathworks.com!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Jeff Shannon Newsgroups: comp.lang.python Subject: cmsg cancel <3C2B724D.E4D31E24 at ccvcorp.com> Control: cancel <3C2B724D.E4D31E24 at ccvcorp.com> Date: Mon, 31 Dec 2001 03:35:19 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775646 27193 211.57.49.2 (31 Dec 2001 05:14:06 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:14:06 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From andreas at mtg.co.at Mon Dec 31 05:39:06 2001 From: andreas at mtg.co.at (Andreas Kostyrka) Date: Mon, 31 Dec 2001 11:39:06 +0100 Subject: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) In-Reply-To: References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> <3C2E498B.6DC757E0@stroeder.com> <3C2E6A51.589E7F1D@earthlink.net> <3C2F2920.89841C81@stroeder.com> Message-ID: <20011231113906.C5961@vaio2.mtg.co.at> On Sun, Dec 30, 2001 at 11:14:36AM -0500, Roy Smith wrote: > It's also possible to write memory leaks in python. Consider something > like: > > packetLog = [] > while 1: > request = getPacketFromSocket() > packetLog.append (request) > doStuffWithPacket (request) > > It's pretty dumb to write something like that, but it certainly is a memory > leak. Nope, it's not. It's just an algorithm that needs unbounded memory. A memory leak happens if you somewhere forget about "memory". Basically something like this: const char *someFunc(const char *instr) { char *interBuf=malloc(strlen(instr)+1); return instr; } Now nobody ever will able to find this block of memory, as it's pointer has been lost. The difference to the above python code is, that python will free the memory when the code block is left. (In your example this could happen because of exception when the socket is shut down.) There are basically only 2 ways to make Python memory leak: 1.) Leaky C modules. Some are badly written, others access an API that makes wrapping it impossible without some leaks. 2.) [Older versions only] Circular references. class Circular: def __init__(self): self.circular=self IMHO, there is a huge difference between buffer overflows and exec/eval: -) exec/Eval just behave like documented, and like some "functions" might pose security risks if passed untrusted data. -) buffer overflows (basically fooling around with pointers) OTOH makes the code do completly unexpected things. Basically it breaks the "virtual" virtual machine. This is almost impossible in Python. (There are always C language modules ;) ) C and Python both expose potentially unsecure interfaces. And this is well, because it is needed to do real work. C OTOH exposes many additional unsafe interfaces that wouldn't have to be unsafe by their semantic needs. They are just unsafe because nobody did think when defining the API. (Example: strcat versus strncat) This is documented by a number standard library functions that are shadowed by a second set of functions that do the same thing, but are "safe". For some interesting thoughts about runtime safety, one should consider Modula3, which does have the safe/unsafe concept explicitly in the language. (It's also an example for a safe enviroment that is compareable to C in performance, as it checks only a small number of constructs at runtime.) Regards, Andreas From peoter_veliki at hotmail.com Thu Dec 13 15:42:38 2001 From: peoter_veliki at hotmail.com (Peoter Veliki) Date: Thu, 13 Dec 2001 12:42:38 -0800 Subject: which book? References: <9vb2vt$efv63$1@ID-75083.news.dfncis.de> Message-ID: > I can also recommend "core python" which has very clear and in depth > explanantions of the core concepts of python I think it is pretty good too, but expect the back to break on the book within a month like all other Core books. From jason at jorendorff.com Thu Dec 13 18:11:43 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Thu, 13 Dec 2001 17:11:43 -0600 Subject: threading module oddness In-Reply-To: Message-ID: Tim, Thanks for the great response! > threading != thread; Conditions are documented as requiring a > threading.Lock or threading.RLock, not a thread.lock, and the former > define only .acquire() and .release(). Hmm. I had not realized this. Good point. [Strangely enough, what I wrote would work anyway, due to some other strangeness in the implementation. Two wrongs make a right!] > > 2. Wow, I had no idea what was going on under the hood here. > > Especially Condition.wait(). Wouldn't it be better if all this > > stuff were implemented using the native primitives? > > Better according to what criteria? Certainly not better for > maintainability or clarity. Excellent question. Here's what I had in mind: 1. Performance factors: wall clock time and CPU usage. Here's one guy's measure of how Condition.wait() performs: http://www.bagley.org/~doug/shootout/bench/prodcons/ 2. Principle of least surprise. I think a guy who's done some thread programming on Linux before, would likely expect Condition to behave as though it had a pthread cond object inside -- on Linux anyway. ("Surely they're not duplicating kernel-level features in Python...") I'm no guru, but I'm guessing this assumption could lead to the occasional subtle bug. 3. Clarity. I think the threading code for any given platform will be simpler and shorter than the existing threading.py code. Just for giggles, I'm currently writing a "winthreading.py" module that uses win32event. We'll see how it goes. -- Jason Orendorff From henrik at moskau.hmotakef.homeip.net Sat Dec 29 16:19:55 2001 From: henrik at moskau.hmotakef.homeip.net (Henrik Motakef) Date: 29 Dec 2001 21:19:55 +0000 Subject: REPOST: Re: values of sys.platform? for a serial port lib References: Message-ID: <8$--$$_----__%$__$@news.noc.cabal.int> Chris Liechti writes: > i'm interested in values for "sys.platform" and, if possible, the name of > the serial port (an how the ports are numbered ttyS0, ttyS1 etc.) > e.g "linux2" and "/dev/ttyS%d" % port, numbering starting at zero. I don't really know where sys.platform is defined (I ended up with a "grep -r "PLATFORM" * in the source tree, resulting in a line "Makefile.pre.in: $(CC) -c $(CFLAGS) -DPLATFORM='"$(MACHDEP)"'...", so I think it's defined by autoconf/automake; maybe that helps...), but FYI: # python -c "import sys; print sys.platform" openbsd3 # ls /dev/tty* /dev/tty /dev/ttyC5 /dev/ttyc2 /dev/ttyp4 /dev/ttype /dev/ttyq8 /dev/tty00 /dev/ttyC6 /dev/ttyc3 /dev/ttyp5 /dev/ttypf /dev/ttyq9 /dev/tty01 /dev/ttyC7 /dev/ttyc4 /dev/ttyp6 /dev/ttyq0 /dev/ttyqa /dev/tty02 /dev/ttyC8 /dev/ttyc5 /dev/ttyp7 /dev/ttyq1 /dev/ttyqb /dev/tty03 /dev/ttyC9 /dev/ttyc6 /dev/ttyp8 /dev/ttyq2 /dev/ttyqc /dev/ttyC0 /dev/ttyCa /dev/ttyc7 /dev/ttyp9 /dev/ttyq3 /dev/ttyqd /dev/ttyC1 /dev/ttyCb /dev/ttyp0 /dev/ttypa /dev/ttyq4 /dev/ttyqe /dev/ttyC2 /dev/ttyCcfg /dev/ttyp1 /dev/ttypb /dev/ttyq5 /dev/ttyqf /dev/ttyC3 /dev/ttyc0 /dev/ttyp2 /dev/ttypc /dev/ttyq6 /dev/ttyC4 /dev/ttyc1 /dev/ttyp3 /dev/ttypd /dev/ttyq7 # w 9:18PM up 16:54, 5 users, load averages: 1.17, 1.24, 1.23 USER TTY FROM LOGIN@ IDLE WHAT henrik C0 - 4:24AM 0 xemacs http.ml henrik p2 :0.0 8:04PM 1:06 gimp devel/yeah/docs/request_process hth Henrik ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Henrik Motakef Newsgroups: comp.lang.python Subject: cmsg cancel <873d1tiv0k.fsf at moskau.hmotakef.homeip.net> Control: cancel <873d1tiv0k.fsf at moskau.hmotakef.homeip.net> Date: Mon, 31 Dec 2001 04:38:21 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774500 27193 211.57.49.2 (31 Dec 2001 04:55:00 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:55:00 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From dhhnews0 at hotmail.com Thu Dec 6 20:34:20 2001 From: dhhnews0 at hotmail.com (Dan Howard) Date: Fri, 07 Dec 2001 01:34:20 GMT Subject: Python - string to hexbytes conversion - HELP! References: Message-ID: Thanks to all that responded to my plea for help! Much appreciated. I now have several ways of approaching the problem Regards Dan "me" wrote in message news:HKvP7.17239$2Fd.11985 at news1.bloor.is... > I'm a newbie to Python and I am trying > to convert a string of decimal numbers - read from raw_input > to a series of hexbytes > eg > if I do a read and get a='1234567' > I need an equivalent string to be > b=Chr(0x01)+chr(0x23)+chr(x045)+chr(0x67) > > all this is to control a device from the serial port > but I cannot seem to recall how to conver the input to my required output > An hints or suggestion most appreciated! I've spend hours trying various > built in's > which I would prefer to use > > HELP! > > From pedro_rodriguez at club-internet.fr Fri Dec 28 05:19:56 2001 From: pedro_rodriguez at club-internet.fr (Pedro) Date: Fri, 28 Dec 2001 11:19:56 +0100 Subject: affects on extended modules References: <3C051775.A8D4FD66@bioeng.ucsd.edu> <83pu5zrvbl.fsf@panacea.canonical.org> <3C0E7138.FD485D1D@bioeng.ucsd.edu> <1be8d8b.0112271705.50940295@posting.google.com> Message-ID: "Curtis Jensen" wrote: > Pedro wrote in message > news:... >> "Curtis Jensen" wrote: >> >> > Kragen Sitaker wrote: >> >> >> >> Curtis Jensen writes: >> >> > We have created a python interface to some core libraries of our >> >> > own making. We also have a C interface to these same libraries. >> >> > However, the the python interface seems to affect the speed of the >> >> > extended libraries. ie. some library routines have their own >> >> > benchmark code, and the time of exection from the start of the >> >> > library routine to the end of the library routine (not including >> >> > any python code execution), takes longer than it's C counterpart. >> >> >> >> In the Python version, the code is in a Python extension module, >> >> right? >> >> A .so or .dll file? Is it also in the C counterpart? (If that's >> >> not >> >> it, can you provide more details on how you compiled and linked the >> >> two?) >> >> >> >> In general, referring to dynamically loaded things through symbols >> >> --- even from within the same file --- tends to be slower than >> >> referring to things that aren't dynamically loaded. >> >> >> >> What architecture are you on? If you're on the x86, maybe Numeric >> >> is being stupid and allocating things that aren't maximally aligned. >> >> But you'd probably notice a pretty drastic difference in that case. >> >> >> >> ... or maybe Numeric is being stupid and allocating things in a way >> >> that causes cache-line contention. >> >> >> >> Hope this helps. >> > >> > Thanks for the responce. The C counterpart is directly linked >> > together into one large binary (yes, the python is using a dynamicaly >> > linked object file, a .so). So, That might be the source of the >> > problem. I can try and make a dynamicaly linked version of the C >> > counterpart and see how that affects the speed. We are running on >> > IRIX 6.5 machines (mips). >> > Thanks. >> > >> > >> Don't know if this helps but I had a similar problem on Linux. >> >> The context was : a python script was calling an external program and >> parsing output (with popen) many times. I decided to optimize this by >> turning the external program into a dynamicaly linked library with >> python bindings. I expected to gain the extra system calls to fork and >> start a new process, but it turned out that this solution was slower. >> >> The problem was caused by multithreading stuff. When using the library >> straight from a C program, I didn't link with multithreaded libraries >> and so all system calls weren't protected (they don't need to lock and >> unlock their resources). >> >> Unfortunately, the library was reading files with fgetc (character by >> character :( ). Since the Python version I used was compiled with >> multi-threading enabled, it turned out that the fgetc function used in >> this case lock/unlock features, which cause the extra waste of time. >> >> To find this, I compiled my library with profiling (I think I needed to >> use some system call to activate profiling from the library, since I >> couldn't rebuild Python). >> >> OT : at the end I fixed the library (fgetc replaced by fgets), and >> didn't gain anything by turning the external program into a python >> extension. Since it seemed that Linux disk cache was good, I removed >> the python extension thus keeping a pure Python program, and >> implemented a cache for the results of the external program. This was >> much simpler and more efficient in this case. > > > Is this a problem with i/o only? Our the code sections that we > benchmarked has no i/o in it. > > -- > Curtis Jensen In my case, it was only i/o related. If your problem, as I understand it, is : + I've got a function f() written in C + f() execution is doing some benchmark telling how much time it took to complete + calling f() from a C binary gives a (significant) shorter duration than calling (the same) f() from a Python extension you may have to check what f() is doing, because , what I was stating is, that it may be affected by the python environment : - Are doing extensive calls to an external library ? In my case, some glibc calls need to inforce reentrancy protection when running in a multithreaded context. These protections blew out any gain. - If you're doing calls to external libraries, are you linked against the same versions ? (ldd on binaries and libraries may help) - More basicaly, did you compile with the same options ? Could the differences point to a possible source of your problem ? (may be worth checking optimization, debug, conditional compilation options) Regards, -- Pedro From borcis at geneva-link.ch Thu Dec 27 16:54:34 2001 From: borcis at geneva-link.ch (Boris Borcic) Date: Thu, 27 Dec 2001 22:54:34 +0100 Subject: A new message board is up References: <40dbad98.0112262232.1868734e@posting.google.com> <3C2B724D.E4D31E24@ccvcorp.com> Message-ID: <3C2B989A.1D504787@geneva-link.ch> Jeff Shannon wrote: > > others (like sheer disgust at the thought of anyone using "l33t > sp34k" in anything other than total parody), What's this standard, anyway clearly a 3 should stand for a B, not an e. 1234567 IRBASGT obviously. BB From jkraska at san.rr.com Wed Dec 5 11:56:31 2001 From: jkraska at san.rr.com (Courageous) Date: Wed, 05 Dec 2001 16:56:31 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <3C0C8330.79D0E598@mega-nerd.com> <23891c90.0112050750.2bed3aa8@posting.google.com> Message-ID: >Can you give an example of how spaces must creep in on continuation >lines? ##--snip; not in particular the column-positioning of the "or". If ## tabs are used here, it will be misaligned with other ## tabstop stettings for certain if isinstance(f, future.Step) or \ isinstance(f, future.Status) or \ isinstance(f, future.Announce) or \ isinstance(f, possibility.Observe) or \ isinstance(f, future.Incarnate) or \ isinstance(f, future.Start) or \ isinstance(f, future.Timeout): ##--snip; in this case, the continuation line is lined up on the ## string boundary to create some congruity between the code ## and the message produced log.Fatal("Unexpected RETURN intercepted from user code.\n" "This is almost certainly due to an inappropriate explicit\n" "or implicit use of return in an Task. HINT: Make sure\n" "to use Fail(), End(), or Succeed() to terminate a Task,\n" "The most suspicious task is probably this one:\n\n"+lastFuture.String()) ##--snip; here, like the or, the actions are put into a column. ## simple actions, organized like this are both compact and ## readable. if methodname==self.task.name: methodname="-" else: methodname=methodname[0:20]+"()" if self.task.status: stat=status.strings[self.task.status] else: stat="UNKNOWN" if self.absoluteT == simulator.ticks: when="now" else: when="future" > am aware that there's a lot of hostility to tab >usage in various open source projects, but that's really a consequence >of the tools around on many platforms today. I don't think so. Even word will get fucked up if someone tweaks the positioning of the tabs in the ruler. The reason this problem doesn't make itself more evident is that the document carries its tabstops with it. You can do this in vim at the beginning of the document, by the way. E.g., ##------------------------------------------------------------------------------ ## $Id: resource.py,v 1.1 2001/12/05 00:44:27 jkraska Exp $ ## vim: ts=8 ##------------------------------------------------------------------------------ C// From mattsurf76 at hotmail.com Thu Dec 27 09:06:03 2001 From: mattsurf76 at hotmail.com (Matt Russell) Date: 27 Dec 2001 06:06:03 -0800 Subject: REPOST: cmp Message-ID: <5$--$$_----_%-%$%$@news.noc.cabal.int> Well, I just made myself look silly. I admit it... when I type 1==1 into the interpreter, I thought if it was true, the result is 1 - this is right. But cmp(1,1) actually returns 0 (in accordance to the docs) But why then are we given the mechanism to compare instances of classes via the __cmp__ def ? Collegues of mine have used this to return 1 (truth) if two instances are equal (instanceA==instanceB).... this obviously wasn't the intended purpose. (__cmp__ shuold return 0 if the result of cmp(a,b) is to be trusted?? Perhaps then could someone explain to me how one compares classes useing the == operator, or indeed if this bad programming practice. I hope I didn't waste too much of guido's time when I posted a bug on sourceforge :( ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!wesley.videotron.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: mattsurf76 at hotmail.com (Matt Russell) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:13:32 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775762 27193 211.57.49.2 (31 Dec 2001 05:16:02 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:16:02 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From vvainio at karhu.tp.spt.fi Wed Dec 12 02:25:24 2001 From: vvainio at karhu.tp.spt.fi (Ville Vainio) Date: 12 Dec 2001 09:25:24 +0200 Subject: Whatever happened to String Interpolation? References: <9u6dbn$nsj$1@peabody.colorado.edu> <9ue35a$sbi$1@peabody.colorado.edu> <9uerd1$hbk$1@peabody.colorado.edu> Message-ID: Fernando P?rez writes: > That already exists: type 'python Itpl' in google. So, it appears to be done already. What's the fuss, then? Wouldn't having this in the standard library suffice? Looking at the relatively concise syntax on Itpl, why on earth would one want an equivalent thing encumbering the core language? -- Ville Vainio - http://www.tp.spt.fi/~vvainio - ICQ #115524762 Wild geese have no intention to cast a reflection Water has no mind to assume their form From logiplexsoftware at earthlink.net Thu Dec 20 16:43:50 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Thu, 20 Dec 2001 13:43:50 -0800 Subject: Raw sockets In-Reply-To: References: <2c55c8be.0112201244.2e4e1027@posting.google.com> Message-ID: <20011220134350.1416bcad.logiplexsoftware@earthlink.net> On Thu, 20 Dec 2001 21:29:23 GMT grante at visi.com (Grant Edwards) wrote: > > I've got the impression that you need the tighter control over > > TCP that raw sockets allows, > > Tighter control than raw sockets? Raw sockets is as low-level > as it gets. You even have to put the Ethernet addresses in > yourself. He said "that" not "than". Changes the meaning entirely =) -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From scott_hathaway at riskvision.com Thu Dec 20 12:03:26 2001 From: scott_hathaway at riskvision.com (Scott Hathaway) Date: Thu, 20 Dec 2001 11:03:26 -0600 Subject: question soap and classes Message-ID: I want to create a soap server that will expose many classes and then acces them as follows: client: import SOAP if SOAP.Config.SSLserver: from M2Crypto import SSL SOAP.Config.debug = 1 SOAP.Config.BuildWithNoType = 1 SOAP.Config.BuildWithNoNamespacePrefix = 1 s = SOAP.SOAPProxy("http://localhost:8800") u1 = s.classA.Login('joe','smith') u2 = s.classB.Logout('joe','smith') server: import SOAP if SOAP.Config.SSLserver: from M2Crypto import SSL server = SOAP.SOAPServer(('localhost',9900)) import classA import classB a = classA.classA() server.registerObject(a) b = classB.classB() server.registerObject(b) try: server.serve_forever() except KeyboardInterrupt: pass This does not allow me to access separate classes. Can anyone tell me the best way to do what I want? Thanks, Scott Hathaway From rcena at epcor.ca Sat Dec 29 09:21:51 2001 From: rcena at epcor.ca (Resty Cena) Date: 29 Dec 2001 06:21:51 -0800 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <458b194a.0112282052.1123341@posting.google.com> Message-ID: <4$--$$_----_-%-$%$@news.noc.cabal.int> "Kevin Altis" wrote in message news:... > I couldn't agree more. Thus you won't be surprised that in many ways that is > the sweet spot that PythonCard is aiming at. You'll need wxPython 2.3.2 or > higher and Python 2.x to give it a try, but you can at least look at screen > shots if nothing else. > > http://pythoncard.sourceforge.net/ > > We are moving towards a component model, which will give you many of the > capabilities you are familiar with from using COM. There is a layout editor > (the resourceEditor sample) and automatic event binding and event handlers > that should look a lot like what you have used with VB. You can already > build standalone Windows executables using py2exe. > Yes, I've been following the progress of PythonCard (and Boa Constructor) very intently (I did some educational stuff in HyperCard a long time ago). I must congratulate you and the team for the tremendous progress made in such a short time. Tim Churches made this list in another posting. I'd put (a), (b), and (e) as my top priority. The main things which PythonCard needs are: a) A drag-and-drop form editor (I believe this is being worked on) b) Automated bindings of data-aware controls to underlying databases. c) A drag-and-drop SQL query editor. d) A banded report writer like Access or Crystal reports. e) A really easy installation routine which handles the database installation/adminstration as well. f) Excellent documentation. Best wishes, rmc > "Resty Cena" wrote in message > news:458b194a.0112282052.1123341 at posting.google.com... > > The real source of growth for both Python and Ruby are the 3M VB > > developers worldwide. Whichever can provide what it is that VB > > developers like about VB on top of what Python and Ruby natively offer > > will hit the jackpot. To me these are: (a) Visual drag-and-drop > > application builder with data aware controls, and (b) good support for > > the big databases (Oracle, Sybase, Informix). I'm going through the > > gui chapters of Mark Lutz' PP2E, and while I can see that handcrafting > > gui this way gives me a lot of control, I'm thinking I don't want to > > do this -- I'm a database application developer. I want to write a > > dynamic work order system and I have no ambition to become a system > > tool maker. And so do the 3M VB developers. > > > > VB used to be a toy language. Not too long ago no respectable company > > would use VB for their corporate systems. It did not start to become > > an enterprise solution until VB3. What happened there? > > > > VB 6 will be retired in favor of VB.NET. Personally I think that the > > direction VB has taken, towards a verbose C#, is misguided. VB should > > have evolved into something like Python or Ruby. With VB.NET, VB > > programmers will ask, "What's the point?" Might as well dive into C#. > > Or look around for something else. > > > > Hopefully by that time -- 18 months from now? -- Python and/or Ruby > > will have what it is VB programmers cannot live without. > > > > Folks, come up with (a) and (b) above, then start posting at c.l.vb. > > > > > > Paul Prescod wrote in message > news:... > > > Dave Thomas wrote: > > > > > > > > ... Instead, Ruby will attract folks from outside the > > > > Python world. Ruby and Python differ in philosophy and _feel_. Some > > > > folks like one, some the other. I don't see it as competition. I see > > > > it as choice. > > > > > > Is there really a difference? Pepsi and Coke are choices. They are also > > > in competition. They have a somewhat different taste but are more > > > similar than different. In the long run, there will come a day when > > > they've taken as much of the market share of other drinks away as they > > > will, and the primary competition will be between the two of them. > > > > > > Paul Prescod ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: rcena at epcor.ca (Resty Cena) Newsgroups: comp.lang.python Subject: cmsg cancel <458b194a.0112290621.4134fdaa at posting.google.com> Control: cancel <458b194a.0112290621.4134fdaa at posting.google.com> Date: Mon, 31 Dec 2001 03:35:11 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774756 27193 211.57.49.2 (31 Dec 2001 04:59:16 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:59:16 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From dmallwitz at cox.rr.com Wed Dec 19 18:47:43 2001 From: dmallwitz at cox.rr.com (David Mallwitz) Date: Wed, 19 Dec 2001 18:47:43 -0500 Subject: Tkinter+ backspace characters (and an re.sub problem) References: <3c202041$1_6@goliath.newsgroups.com> Message-ID: <3c2125a1_2@goliath.newsgroups.com> "Steve Holden" wrote in message news:CC1U7.38101$PA.32115 at atlpnn01.usenetserver.com... > "David Mallwitz" wrote in message > news:3c202041$1_6 at goliath.newsgroups.com... > > Hello group, > > The Tkinter Text widget doesn't understand '\b' or '\x08' as the > > backspace character when sent a string containing either of them. Nor does > > it understand '^H' as a substitute for '\b'. > > I've done some googling, but haven't found a solution other than doing > a > > regexp sub on the string before sending it to the text widget. That seemed > > like a good idea, but I'm not able to construct the regexp in a way that > > will handle stacked backspace characters. > > Any ideas on how to tell the widget to process a backspace? Or on how > to > > construct an RE that will match multiple '\b's? > > > > For example: > > >>>string = 'all work and no play makes Jack\x08\x08\x08\x08Dave a dull > boy' > > >>> print string ###this works as you would expect it to > > all work and no play makes Dave a dull boy > > >>>root = Tk() > > >>>text = Text(root) > > >>>text.pack() > > >>>text.insert(END, string) > > ### prints 'all work and no play makes Jack||||Dave a dull boy' on the > > widget > > >>>a = re.compile('.\x08') > > >>> a.sub('', string) ###fails - would have thought there should be 3 > > '\x08's left, or none at all > > 'all work and no play makes Jac\x08Dave a dull boy' > > >>> > > David: > > If I understand you correctly, you are expecting the Text widget to respond > to data values in the same way as it would respond to keyboard events. This > isn't likely to happen, so you are left with having to do the preocessing > yourself. > > If, on the other hand, you are saying that the backspace KEY isn't being > actioned then there would seem to be a fundamental problem with your Tkinter > installation (I know it works for me). > > If the former case is what applies, where are these characters coming from? > Given that Tkinter is a GUI, why are you processing keystrokes from > elsewhere? > > regards > Steve > -- > http://www.holdenweb.com/ > > > > > Whoops. Guess I could have been a little clearer in my original post... I'm processing input from a Cisco router that is directly connected to my serial port. The router has a command line interface that will send a '--More--' prompt when the text output is longer than the configured terminal display length. When the user hits the router will send a series of 8 backspace characters to delete the '--More--' prompt and then send the next page of text. Works great on a console, which is all it was designed for. I had hoped that the Text widget would be able to interpret the backspace character ('\b', or its' hex value '\x08') properly or that I could configure it to do so. From the responses I have received it appears that this is wishful thinking on my part. I'll put some more effort into processing the router output through a regexp before I send it to the widget. Thanks to all, Dave pretty good networking guy not so hot programmer -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- From ibarona at tid.es Fri Dec 21 09:40:33 2001 From: ibarona at tid.es (Isaac Barona) Date: Fri, 21 Dec 2001 14:40:33 GMT Subject: Comunicating through COM ports References: <3c228dff$1_1@goliath.newsgroups.com> Message-ID: <3c234933.199142031@tid> You can try the uspp (Universal Serial Port Python Library). You can download it from: http://balder.prohosting.com/ibarona/en/python/uspp/uspp_en.html Isaac. On Thu, 20 Dec 2001 20:25:46 -0500, "David Mallwitz" wrote: >Comunicating through COM portsChapter 19 of Mark Hammond and Andy Robinson's >'Python Programmingon on Win32' covers this quit well, and with the >Activestate Python distro there is a multithreaded demo called >'win32comport_demo.py'. But here's what I do - example is from a console >connection to an old Cisco router. > >>>> from Serial import Serial >>>> ### open the COM1 port >>>> serialconfig = Serial.PortDict() >>>> serialconfig['port'] = Serial.COM1 >>>> serialconfig['rxBufSize'] = 4096 >>>> port = Serial.Port(serialconfig) >>>> port.open() >>>> port.write('show conf \r') >>>> x = port.read() >>>> x >'show conf \r\nUsing 768 out of 32762 bytes\r\n!\r\nversion 11.1\r\nno >service u >dp-small-servers\r\nno service tcp-small-servers\r\n!\r\nhostname >Router\r\n!\r\ >n!\r\nip subnet-zero\r\nno ip domain-lookup\r\n!\r\nhub ether 0 1\r\n >link-test\ >r\n auto-polarity\r\n!\r\nhub ether 0 2\r\n link-test\r\n >auto-polarity\r\n!\r\n >hub ether 0 3\r\n link-test\r\n auto-polarity\r\n --More-- ' > >Best, >Dave > > >"Alves, Carlos Alberto - Coelce" wrote in message >news:mailman.1008852145.28654.python-list at python.org... >Anybody could give me an example code of how connect/comunicate through COM >ports (i.e. COM1, COM2). I'm under windows 98. >Thanks!!! >Carlos Alberto >COELCE/DPRON-Departamento de Projetos e Obras Norte >Fone: 677- 2228 >e-mail: calves at coelce.com.br >\|||/ >(o o) >--ooo0-(_)-0ooo-- > > > > >-----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- >http://www.newsfeeds.com - The #1 Newsgroup Service in the World! > Check out our new Unlimited Server. No Download or Time Limits! >-----== Over 80,000 Newsgroups - 19 Different Servers! ==----- From gh_pythonlist at gmx.de Tue Dec 4 18:11:09 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Wed, 5 Dec 2001 00:11:09 +0100 Subject: german documentation In-Reply-To: <9ujjvp$918ch$1@ID-19768.news.dfncis.de> References: <9ujjvp$918ch$1@ID-19768.news.dfncis.de> Message-ID: <20011204231108.GC2857@lilith.hqd-internal> On Tue, Dec 04, 2001 at 11:49:21PM +0100, Frank Lohfelt wrote: > Hello, i search the Python documentation translated to german to > download and read offline or other Books and guids in german for free > download. Check out http://www.python.org/doc/NonEnglish.html#german For Python books, all the German ones listed there are quite good. Heh, I only know of one German Python book by "Markt und Technik Verlag" that really sucks, and it's not listed there. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From G.Kruschina at gmx.de Mon Dec 3 15:27:02 2001 From: G.Kruschina at gmx.de (Guenter Kruschina) Date: Mon, 3 Dec 2001 21:27:02 +0100 Subject: How to compare text? In-Reply-To: <3C0B5C9C.10969.755101@localhost> Message-ID: <3C0BEE26.5908.1B94372@localhost> From: "A" To: tutor at python.org, activepython at listserv.ActiveState.com, python-list at python.org Subject: How to compare text? Send reply to: printers at sendme.cz Priority: normal Date sent: Mon, 3 Dec 2001 11:06:04 +0100 > > Hello, > How can I compare of one parragraph of text with another > paragraph?Each paragraph can have about 100 words. > For example I have the first paragraph > > I want to be very good at Python programming. Better than in Perl. > > THe second paragraph might look loke this: > > She works all day long to master Perl. > > All that I need is to find out if any of word from the second is in the > first paragraph. For the example above I should find out word > > Perl > > > What is the best and quickest way? > Thank you for help. > Ladislav > > > _______________________________________________ > ActivePython mailing list > ActivePython at listserv.ActiveState.com > http://listserv.ActiveState.com/mailman/listinfo/activepython > Hallo Ladislav, I have written a small progam, which will work as you expect. I hope so. I think this is a fast way to compare two paragraphs. wbg G?nter -------------- next part -------------- def CreateDict(par): #Remove some chars for char in ('.',';',','): par = par.replace(char,"") words = par.split(' ') dPar = {} for word in words: dPar[word] = 1 return dPar def Diff(par1,par2): dPar1 = CreateDict(par1) dPar2 = CreateDict(par2) lCommon = [] for word in dPar2.keys(): if dPar1.has_key(word): lCommon.append(word) return lCommon def main(): lCommonWords = Diff("I want to be very good at Python programming. Better than in Perl.", "She works all day long to master Perl.") print "Common Words: ", lCommonWords main() From greg at cosc.canterbury.ac.nz Thu Dec 6 19:54:53 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Fri, 07 Dec 2001 13:54:53 +1300 Subject: Calling a generator multiple times References: <200112061113290670.0100F457@mail.rdc1.sdca.home.com> Message-ID: <3C10135D.C101176A@cosc.canterbury.ac.nz> Courageous wrote: > > The first call to some generator g() should behave like: > > f=g() > f.next() > > Subsequent calls to g() should behave like > > f.next() Er... where is this "f" going to be stored? Before you answer that, make sure you've considered for i in g(): for j in g(): print i, j > ... As long as the generator is defined with a signature > which makes it appear as an ordinary function, that's exactly > how it should behave. When generators first appeared, quite a number of people, including me, argued fervently and passionately that generators *shouldn't* look like ordinary functions, for this very reason. Alas, our pleas fell on deaf ears. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From syring at email.com Wed Dec 26 22:03:42 2001 From: syring at email.com (Karl M. Syring) Date: Thu, 27 Dec 2001 04:03:42 +0100 Subject: Pascal's triangle (beginner) References: Message-ID: "A. Keyton Weissinger" schrieb > Good stuff in here, Karl. What are these examples from? Well, Kirby Urner is a math teacher (http://www.inetarena.com/~pdx4d/ocn), it seems, and the question of the original poster looked like some kind home work problem. Karl M. Syring From ssthapa at classes.cs.uchicago.edu Tue Dec 18 19:40:43 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Wed, 19 Dec 2001 00:40:43 GMT Subject: ANN: ciphon 0.3.4 References: Message-ID: Andy Todd wrote: > >For those who wan't to access this via SourceForge the URL is; > >http://sourceforge.net/projects/pythonsiphon/ > >Although that is showing 0.3.1 as the current release; > >http://sourceforge.net/project/showfiles.php?group_id=20509&release_id=6610 >0 > >Which appears to supercede 0.3.4. I'm not what the deal with sourceforge is. If you click on the view all project buttons, 0.3.4 appears. I think it may have been a sourceforge bug. I've hidden the 0.3.1 release so that the 0.3.4 release appears. >Suchandra, should we be going to tummy.com or SourceForge? Either one of them will have the latest release. I'll update both at the same time. Also starting from 0.3.4, you can download and install the latest release of ciphon from within ciphon. > >Oh, and the 'Home Page' link at SF doesn't work either, it redirects to >http://ciphon.sourceforge.net/ which gives me a big 'Not Found'. I haven't had time to create and upload a home page for ciphon yet. I've been too busy trying to make sure the code works and adding features/ writing docs =(. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From paul at prescod.net Fri Dec 28 18:17:51 2001 From: paul at prescod.net (Paul Prescod) Date: Fri, 28 Dec 2001 18:17:51 -0500 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <3C2CFD9F.7BAE8129@prescod.net> Dave Thomas wrote: > > ... Instead, Ruby will attract folks from outside the > Python world. Ruby and Python differ in philosophy and _feel_. Some > folks like one, some the other. I don't see it as competition. I see > it as choice. Is there really a difference? Pepsi and Coke are choices. They are also in competition. They have a somewhat different taste but are more similar than different. In the long run, there will come a day when they've taken as much of the market share of other drinks away as they will, and the primary competition will be between the two of them. Paul Prescod From mwh at python.net Wed Dec 12 08:00:09 2001 From: mwh at python.net (Michael Hudson) Date: Wed, 12 Dec 2001 13:00:09 GMT Subject: Signal handling and threads problem References: Message-ID: "Jason Orendorff" writes: > If the main thread is currently busy (for example, if it's > blocked on input), then it does *not* get automatically > interrupted. It waits until it's done before executing the > signal handler. (Not sure how this works on Solaris.) > > Admittedly this is weird. > > In addition to the above, I believe Python handles SIGINT > by default. But you should be able to override it. > > Anyway, your post seems to suggest that you know all this > and the program seems to be ignoring SIGINT completely. (?) Also worht noting is that if you're running Python from the interactive prompt, readline buggers about with signals more than is sensible and can really confuse. Cheers, M. -- Good? Bad? Strap him into the IETF-approved witch-dunking apparatus immediately! -- NTK now, 21/07/2000 From uwe at rocksport.de Thu Dec 6 11:21:59 2001 From: uwe at rocksport.de (Uwe Schmitt) Date: 6 Dec 2001 16:21:59 GMT Subject: pickle question References: <9unov6$c4on9$1@hades.rz.uni-sb.de> Message-ID: <9uo5v7$c2a5i$1@hades.rz.uni-sb.de> Oleg Broytmann wrote: | On Thu, Dec 06, 2001 at 12:40:06PM +0000, Uwe Schmitt wrote: |> I pickled some data on my local unix machine. When I try |> to read this data on a windows machine, nothing is pickled |> at all. | Did you open the pickled file in binary mode? No. should I ? Yours, Uwe -- Dr. rer. nat. Uwe Schmitt Uwe.Schmitt at num.uni-sb.de Universitaet des Saarlandes Angewandte Mathematik Building 36.1 Room 4.17 PO-Box 151150 D-66041 Saarbruecken Mobile:0177/6806587 Fax:+49(0)681/302-4435 Office:+49(0)681/302-2468 From mwh at python.net Tue Dec 18 15:24:02 2001 From: mwh at python.net (Michael Hudson) Date: Tue, 18 Dec 2001 20:24:02 GMT Subject: /usr/bin/env: python: No such file or directory References: <9vivft$593$1@peabody.colorado.edu> <171220010818339518%jwbaxter@spamcop.net> <9vnvue$m5d$1@peabody.colorado.edu> Message-ID: Fernando P?rez writes: > It is NOT practical to expect users to write their scripts using > #!/usr/bin/env python2, simply because that's a weird, redhat only > default that breaks everywhere else. And what of code they download? > Now they have to manually inspect every script they get from the web > to replace python->python2? That's plain moronic. No, those scripts should use distutils, which will get it right when it installs them. $ python2 setup.py install --prefix=$HOME Everyone should use distutils. All the time. Cheers, M. -- > Why are we talking about bricks and concrete in a lisp newsgroup? After long experiment it was found preferable to talking about why Lisp is slower than C++... -- Duane Rettig & Tim Bradshaw, comp.lang.lisp From chrishbarker at attbi.com Tue Dec 4 14:10:33 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Tue, 04 Dec 2001 11:10:33 -0800 Subject: Making a string raw References: <59333ea6.0112041014.7908e9ab@posting.google.com> Message-ID: <3C0D1FA9.A3C10C67@attbi.com> Rune Nesheim wrote: > > Could any of you lot tell me how to convert a string stored in > avariable to a raw string? There is no such thing, the concept of "raw" strings, only applies to literals. ie: s = r'\this' and s = '\\this' create exactly the same object. Give a little more detail about what problem you are trying to solve, and we may be able to help you. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From chrishbarker at attbi.com Thu Dec 20 13:42:14 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Thu, 20 Dec 2001 10:42:14 -0800 Subject: Improve performance for writing files with format modification References: Message-ID: <3C223106.E751A204@attbi.com> "christine.bartels at teleatlas.com" wrote: > I want to use python but at the moment the write-function takes so > much time that I prefer gawk for this conversion (3 times faster!). You must have one huge number of huge files for this to take more time to run than it takes you to fiddle with your script! Or a very slow machine. Anyway, you are probably never going to get Python to be as fast as gawk. It is a general purpose tool, not nearly as specialized as gawk, and as such is not quite as efficient for simple text crunching. Andrew Dalke wrote: > In other words, that the inner loop is written > > for i in fblock: > nfile.write("%20s%10s\n" % tuple(string.split(i, ';'))) or: for i in fblock: nfile.write("%20s%10s\n" % tuple(i.split(';'))) > Try this > > def convert(file, nfile): > write = nfile.write # cache the attribute lookup to a local variable > tupl = tuple # cache the __builtin__ lookup to a local variable > splt = split # cache the module lookup to a local variable shouldn't this be: splt = string.split > while 1: > fblock = file.readlines(0x2000) you seem to be reading in only about 8k of data here at a time (probably more because readlines() rounds up to an internal buffer size). That is a minuscule amount on today's machines! It would probably run faster if you added a few zeros there. > if not fblock: > break > for i in fblock: > write("%20s%10\n" % tupl(splt(i, ';'))) > > file = open(filein,"r") > nfile = open(fileout,"w") > convert(file, nfile) > file.close() > nfile.close() I'd be interested to hear how much of a difference this makes... -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From pythonnet at hotmail.com Thu Dec 27 13:06:45 2001 From: pythonnet at hotmail.com (Andrew Nguyen) Date: 27 Dec 2001 10:06:45 -0800 Subject: A new message board is up References: <40dbad98.0112262232.1868734e@posting.google.com> Message-ID: <40dbad98.0112271006.b98e822@posting.google.com> Oh my, I geuss I have to explain to you this: I CAN PUT IT ON SO THAT YOU DON'T HAVE TO REGISTER THE MODS ARE ME AND I PROMISE I WILL ONLY DELETE WHEN NESCASARY(SP?) OK and yes, python does need a lighter heart. From mwh at python.net Wed Dec 5 06:04:21 2001 From: mwh at python.net (Michael Hudson) Date: Wed, 5 Dec 2001 11:04:21 GMT Subject: 'ioctl ' call in python (serial port reading) References: <3C0C8FF3.7060500@beth.uniforum.org.za> <3C0CAE73.6060304@beth.uniforum.org.za> <20011205111542.5369dd87.use-net@schabi.de> Message-ID: Markus Schaber writes: > Hi, > > On Tue, 04 Dec 2001 13:07:31 +0200 > mixo wrote: > > > P.S I had to change > > "i &=~ termios.TIOCM_RTS" to "i = (i) & ~TIOCM_RTS" > > It seems that you're using python 1.5.2. Maybe 2.1 is worth an upgrade. :-) 2.1.1, please... > > For one reason or another I don't "TIOxxxx" defined > > in "termios" module,so I also had to define them > > > > #from /usr/include/asm/termios.h > > TIOCMGET =0x5415 > > TIOCMSET =0x5418 > > TIOCM_RTS =0x004 > > Maybe you should contact the termios author about this, so this > might be corrected in future versions? (or a new module with the > termios.h constants added?) If he was using 1.5.2 or 2.0, then the constants should be in TERMIOS instead. There was a release which had a crippled set of constants in termios, but I can't remember which one it was/find it. At any rate, all the constants mentioned are in termios on the systems I have access to in CVS at present. Cheers, M. -- ... but I guess there are some things that are so gross you just have to forget, or it'll destroy something within you. perl is the first such thing I have known. -- Erik Naggum, comp.lang.lisp From peter.milliken at gtech.com Tue Dec 4 00:30:50 2001 From: peter.milliken at gtech.com (Peter Milliken) Date: Tue, 4 Dec 2001 16:30:50 +1100 Subject: Python evangelists unite! References: <3C07884E.75E18DF7@engcorp.com> <9ue2o2$b344@news1.gtech.com> <3C0B08F3.C9CDE885@engcorp.com> <9ugrrt$b345@news1.gtech.com> <3C0C526A.C7CB4FD0@engcorp.com> Message-ID: <9uhn3i$b348@news1.gtech.com> "Peter Hansen" wrote in message news:3C0C526A.C7CB4FD0 at engcorp.com... > > 1. For the record, I've never met Dave (presumably the "your mate" in your > statement above) and we do not work together. We just seem to have similar > views on some of these issues. (I realize my comments might have been > misleading in this regard.) > Actually, "your mate" was meant in the sense of you having placed yourself (apparently) in the same view. I assumed no other contact :-). I am Australian, so "your mate" can be an expression that covers many situations :-). It doesn't necessarily imply a close relationship or otherwise. > 2. Here's a simple point for you to consider in relation to your claims. > I'm the directory of software engineering for a wireless telecom > company with 100+ people. There are fourteen developers here who are > using Python (almost exclusively) for some rather large applications, > ranging from factory automation through Intranet to embedded Linux > stuff for industrial control. In case this isn't obvious: these > are NOT one-person jobs. Several have involved eight or nine > people simultaneously at their peaks. I'm happy to report from > *actual experience* that your statement has *no* implications on the > size of the jobs we have undertaken, direct or otherwise. And > as for suitability in other ways: we have had an order of magnitude > fewer reported bugs, and have productivity at least two, probably > three times, higher than on any project I've worked on in the past. > These numbers are largely attributable to Python, and that makes > using it good business sense no matter how you look at it. > Good to hear your experiences. You look after 14 people - well done, that's a big team, do you manage to do any development yourself with that number of people to supervise? I never could with teams that size, it drove me to distraction...... What is the basis for your comparisons though? You state that you have achieved fewer bugs and increased productivity using Python. (just for my information :-)) it would be nice to know over what other language you claim these improvements. Have you considered that there might be other languages available that provide similar order of magnitude improvements over Python? What was the basis for your choice of Python as the development language of choice? i.e did you perform any studies into available languages, or did someone recommend it? If it was recommended, what was the basis of the recommendation? Have you considered mixing languages i.e. Python for the bits that suit python and some other language for the rest? As I have stated in other posts here, all is not "black and white" (as someone else said :-)) and I apologise if I gave that impression in my original post. Having done some industrial control software when I was a "pup" what features of Python do you find useful here that you can't find in some other language? Does the interpreted nature of Python cause any speed difficulties? What is the required responsiveness of yoir problem domain? > > As for Python meeting *all* of the software engineering principles you ever > > *learned* - well, only you can be the judge of what you did or didn't learn > > :-). It certainly fails in a number of important areas that I *learned* > > about software engineering :-). > > While I cannot speak for the grounding your school may have provided, > the University of Waterloo gave me its usual solid grounding in engineering > principles. Perhaps your school emphasized some areas I would consider > unimportant. Or perhaps the advice that a "poor workman should not > blame his tools" should apply even to those calling themselves software > engineers. (If I were you, I would probably have put a smiley here.) > I'll put in as many as you want - I intend no offence in any of my comments, I am pursuing this thread in the hopes of (self) improvement :-). Lets see, information hiding, type checking, run-time checking, design by 'contract' (ties in with information hiding), spring to mind as immediate features that I would like to see in a language and that I was taught are "good features" to have. Seems you don't find them important, I guess we will have to disagree as to what is important or not :-) Personally I love information hiding and coding by 'contract' - it seems there is always someone in the team who is just plain lazy and wants to access and modify the behaviour of another object directly rather than using the agreed interface or requesting that the agreed interface be changed. Strong typing is wonderful too. My Ada programs have 95%+ of *all* bugs out of them by the time I get it to compile cleanly - wished I could say the same of my Python programs! :-) Finding bugs by testing is just so *expensive*! > > All you have to do is look at the Pep requests and tools such as PyChecker > > to realise the deficiencies of the language. > > Actually, I am quite happy ignoring the PEPs, and so far have not > found it necessary to integrate PyChecker into our development environment. > We have done quite well without it so far (although I figure PyChecker > would be of some small help and we'll probably use it eventually). > Perhaps our testing processes (part of good software engineering) > are adequate for the purpose. > Do you gather metrics on the problems that PyChecker is meant to cure? i.e. does anyone record the fact that they lost 1/2 hr to the fact that they mispelt a variable name? :-) Metrics is the best way to improve your shop - unfortunately the typical programmer doesn't like to record them :-). > So your suggestion doesn't seem likely to reveal any significant > deficiencies to me: if I haven't seen any myself, it must be because > *for my purposes* there are none! > Hmmm.... at the risk of offending, have you considered that you might not have sufficiently broad experience to be able to determine that? (lots of smileys here - :-), :-), :-), :-) - there, is that enough? :-) (one more for good measure)). > > You could stick with Python as it matures ... > > How much more than 10 years old does a language have to be for you > to call it mature? (No, that's merely a rhetorical question.) > Rhetoric is OK :-) Difficult sometimes to keep it out of these threads :-). 10 years is a long time, I guess from what I have observed in some posts on the list, people are attempting to state that they would like to see things like some facility in the language to make it easy for them to type-check their arguments (one example that springs to mind). I really don't spend too much time looking for these items though or I might be able to pull up many more examples :-) Unfortunately, I "skim" these because I know there are very good languages that already offer these features (and they didn't take 10 years to get there! - which is *not* a slame at Guido - he has done an excellent job! :-)). > > ... and as long as you're a one man band that doesn't have to provide > > long term support for something that you wrote (I mean *long* term - a 10 - > > 15yr life for many products isn't uncommon - how long will your last job > > survive in production?). Obviously you haven't worked at the architectural > > level of any *large* projects (10's or even 100's of programmers) otherwise > > you would never make the statements you do. Ignorance is bliss I guess :-) > > Erm, yes.... well. Our product design is intended to scale to > hundreds of systems and have a lifetime of roughly ten years. > I see no evidence after working on this project for two and > a half years that we will not fulfill our objectives. In spite of > my background in Systems Design Engineering and my professional > engineering license, I suppose you may be right that I don't have > what it takes to work on large projects. Luckily for me, your > opinion on that matter is unlikely to raise any doubts in my mind, > although I suppose you're quite welcome to express it. > Sorry, no offence intended there. Rhetoric got the better of me :-). I'm quite sure you could scale up to larger projects - after all it is the same software engineering principles! :-) All either of us can do is talk from personal experience. I have a reasonable amount in that regards but it is limited in the sense of 29 years work experience in certain fields and situations - first 8 in industrial control, next 20 in defence (biggest project was 100+ programmers) and the last year in a "commercial" environment. So I am trying to gather as much as I can from other people (we can't learn it all! :-)). Thankyou for your input. Hopefully I can learn some more from your experiences in the answers to the questions I pose above. If you feel they are too "personal" to do through this news group then please feel free to reply directly to me. Thanks Peter P.S. I have a Degree in Elect. Engineering. Formal software training consisted of a single semester in Fortran and Basic back sometime around 1977 (I think) - I read a lot though, software is my hobby. I have been *everything* except project manager (not that stupid! :-)) i.e. test engineer, QA engineer, Configuration Manager, sub-contract manager, software engineer, system architect, team leader of everyone of those disciplines etc etc ad nauseum..... :-) From pcc at ecet.vtc.edu Sun Dec 30 22:45:30 2001 From: pcc at ecet.vtc.edu (Peter) Date: Sun, 30 Dec 2001 22:45:30 -0500 Subject: REPOST: RE: Manipulating Win32 attributes; newbie question. References: Message-ID: <7$--$$_----__%-$$$@news.noc.cabal.int> In article , pieter.claerhout at pandora.be says... > These functions are declared in the win32api module... Thanks... I think I got what I need now. I was looking at the wrong help (for my purposes). Peter ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Peter Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:12:20 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009773935 27193 211.57.49.2 (31 Dec 2001 04:45:35 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:45:35 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From loewis at informatik.hu-berlin.de Fri Dec 28 12:59:59 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 28 Dec 2001 18:59:59 +0100 Subject: pth files - can they prepend to sys.path? References: Message-ID: "Skip Montanaro" writes: > Is it possible to force a directory mentioned in a .pth file to be > inserted at the beginning of sys.path instead of appended to the > end? By means of a dirty trick, perhaps. Put a line import prepend_foo into a .pth file, then add a module prepend_foo.py into the same directory, which reads import sys sys.path.insert(0,"foo") Works from Python 2.1 on. HTH, Martin From stephen at theboulets.net Sat Dec 15 13:42:25 2001 From: stephen at theboulets.net (Stephen Boulet) Date: Sat, 15 Dec 2001 12:42:25 -0600 Subject: Printing complex numbers Message-ID: I know that for floats you can do: print '.3f' % x or print '.3e' % x But how do you do the same for complex numbers? -- Stephen From aahz at panix.com Sat Dec 29 13:55:55 2001 From: aahz at panix.com (Aahz Maruch) Date: 29 Dec 2001 10:55:55 -0800 Subject: Correct use of Classes? References: Message-ID: In article , G. Willoughby wrote: > > Can someone please point me to any docs on the net that deal with >correct useage of classes in python. I have been coding with python now for >nearly a year but i haven't really touched on using classes, I know how to >code them but i need a little guidance for when to use them in the real >world. Try http://www.mindview.net/Books/TIPython -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 2 days and counting From djrassoc01 at mindspring.com Fri Dec 28 13:32:49 2001 From: djrassoc01 at mindspring.com (Dr. David J. Ritchie, Sr.) Date: Fri, 28 Dec 2001 12:32:49 -0600 Subject: Python Popularity: Questions and Comments References: Message-ID: <3C2CBACB.FBF3C3C9@mindspring.com> In regards to Jonathan's comments.... Jonathan Feinberg wrote: > "A. Keyton Weissinger" writes: > > > If it is as "X" as we all say/know/feel-in-our-hearts that it is, why is > > there so very little real commercial appeal? > > [snip] > > > OK. At this point, I will get probably 3-10 messages public or private > > saying that Python does not attempt to answer the same niche. > > It has nothing whatsoever to do with the merits. It's entirely about > marketing. It's about pointy-headed Chief Technical Officers who have > heard that Java is a good "enterprise" language, etc. > In support of Python, I would say "Absolutely!" Compare the advertising dollars spent on Java vs. that spent on Python. Along with CD ROM's, we should be distributing a page of peel-off stick on, "Python Inside" labels as an insert with every Python book. I also think it is related to the less and less actual technical experience of senior decision makers in corporations. It means that decision methodology is based more on what "large number of people believe to be true" and this makes it particularly susceptible to the marketing of myths. On the other hand, just to stir the pot a little and because I believe you should be able to argue both sides of an issue, I would say when it comes to semi-critical and critical applications, there are features of Java (like strong typing) that at least mandate a certain level of consistency between all execution paths. I can argue to myself to dismiss that one by saying that of course interpretative languages should not be expected to hold to that level of validation. So, maybe it's reasonable to choose Java for the toaster I am manufacturing. But then the dynamics are that you have the foot in the door with a group of developers inside the firewall who already know java well, it is a simple (-minded?) leap to employing it in enterprise-wide constructs. --D. -- Dr. David J. Ritchie, Sr. djrassoc01 at mindspring.com http://home.mindspring.com/~djrassoc01/ From dsavitsk at e-coli.net Tue Dec 11 17:48:37 2001 From: dsavitsk at e-coli.net (dsavitsk) Date: Tue, 11 Dec 2001 22:48:37 GMT Subject: win32service win32pipe question Message-ID: <93wR7.6168$Rw2.4468272@newssrv26.news.prodigy.com> i followed the example of making a win32service in Mark Hammond's book. when i run the client i get the following error. does anyone know what this might be from? X:\epsp2\server\bin>PipeServiceClient.py hello there service Traceback (most recent call last): File "X:\epsp2\server\bin\PipeServiceClient.py", line 8, in ? data = win32pipe.CallNamedPipe(pipeName, message, 512, 0) pywintypes.api_error: (2, 'CallNamedPipe', 'The system cannot find the file spec ified.') the client code is below, the service code is more or less word for word from page 352. -------------------------------------------------- import win32pipe import sys import string if __name__ == '__main__': message = string.join(sys.argv[1:]) pipeName = '\\\\.\\pipe\\ecpSpoolPipe' data = win32pipe.CallNamedPipe(pipeName, message, 512, 0) print "the service sent back:" print data From sholden at holdenweb.com Mon Dec 17 09:43:43 2001 From: sholden at holdenweb.com (Steve Holden) Date: Mon, 17 Dec 2001 09:43:43 -0500 Subject: /usr/bin/env: python: No such file or directory References: <9vivft$593$1@peabody.colorado.edu> Message-ID: "Fernando P?rez" wrote ... > ddidierd78 wrote: > > > Hi, > > > > I am running redhat 7.2 and installed the following: > > > > python2.2-2.2b1-2.i386.rpm > > python2.2-devel-2.2b1-2.i386.rpm > > python2.2-tools-2.2b1-2.i386.rpm > > > > When trying to run a script, I get the following message: > > > > /usr/bin/env: python: No such file or directory > > > > additionally the only thing relating to python in /usr/bin is the file > > python2.2 > > > > > > Thanks for any help, > > Dan > > the problem is Rhat installs python1.5 as python and python2.x as python2. So > you need to symlink python2.x to python in /usr/bin. > It would be safer to modify your scripts to make the shebang line read #!/usr/bin/env python2 to avoid possible breakage in the Red Hat anaconda adminstration suite. You will need to create a symbolic link (/usr/bin/python2 --> python2.2) before the shebang line will work correctly. Or you could just use #!/usr/bin/env python2.2 but that might be a bit version-specific... regards Steve -- http://www.holdenweb.com/ From sdm7g at Virginia.EDU Tue Dec 11 12:01:08 2001 From: sdm7g at Virginia.EDU (Steven Majewski) Date: Tue, 11 Dec 2001 12:01:08 -0500 (EST) Subject: Recursing into directories In-Reply-To: <20011210180027.GB973@lilith.hqd-internal> Message-ID: On Mon, 10 Dec 2001, Gerhard [iso-8859-1] H?ring wrote: > Le 10/12/01 17:22, Ron crivit: > > Hi, > > > > Is there a built-in class (in dircache, os.path????) that > > recurses thru a directory tree? > > > > I've written one using dircache.listdir, but if there is some- > > thing pre-written, I'd rather use that... > > Only a function: os.path.walk > > And because I usually want a class, too, I didn't find it especially > useful. > A function like os.path.walk is awkward becuase it's inverted -- you need to do all of the work inside with a callback. Generators are much neater -- you can invert it back again so that your processing is on the outside where it belongs, and the directory walking is hidden inside the generator which just produces the next pathname on each call. Something like: # recursive file iterator as a generator: from __future__ import generators from os import listdir, path, curdir def Files( *paths ): if not paths: paths = ( curdir, ) for start in paths: for file in listdir( start ): file = path.join( start, file ) if path.isfile( file ): yield file elif path.isdir(file): for more in Files( file ): yield more Then you can do: 'for file in Files( ... )' , Or better yet, wrap the generator in a class. The example below (which I've posted before) allows you to do something like: for x in Files() & isGif & fileOwner('sdm7g') & fileLargerThan(512) |range(20): to loop over the first 20 Gif files larger than 512 bytes owned by 'sdm7g'. (or if you don't like the overloading of "&" and "|", use a test in a list comprehension -- both are clearer than the functional notation. ) -- Steve Majewski ------ from __future__ import generators,nested_scopes ## You need: ## a generator: (you can also start with a list) def Ints(): n = 0 while 1: yield n n += 1 def Always( arg ): while 1: yield arg ## one or more filters: def Test( gen, test ): for x in gen: if test(x): yield x ## and a terminator: ## by condition: def Quit( gen, test ): for x in gen: if test(x): raise StopIteration else: yield x # or by count: def Count( gen, n ): for x in gen: yield x n -= 1 if n == 0 : break ## shorthand names so the lines don't get too long... odd = lambda x: Test( x, lambda y: y % 2 ) enough = lambda x: Quit( x, lambda y: y > 100 ) notdiv3 = lambda x: Test( x, lambda y: y % 3 ) print "\n odd ints that are not divisible by 3 under 100:" for i in notdiv3( enough( odd( Ints() ))): print i print "\n first 20 odd ints not divisible by 3:" for i in Count( notdiv3(odd(Ints())), 20 ): print i # recursive file iterator as a generator: from os import listdir, path, curdir def Files( *paths ): if not paths: paths = ( curdir, ) for start in paths: for file in listdir( start ): file = path.join( start, file ) if path.isfile( file ): yield file elif path.isdir(file): for more in Files( file ): yield more import os, stat def fileLargerThan( n ): return lambda s,size=n: os.stat(s)[stat.ST_SIZE] > n def fileExt(ext): return lambda s: os.path.splitext( s )[-1].lower() == ext.lower() isGif = fileExt( '.gif' ) ## This is MUCH nicer than using os.path.walk() with a callback! ## find the first 20 gifs in your cwd... for f in Count(Test( Files(), isGif ), 20 ): print f def fileSize( test ): return lambda name: test( os.stat(name)[stat.ST_SIZE] ) import pwd def fileOwner( uname ): uid = pwd.getpwnam( uname )[2] return lambda fname: os.stat( fname )[stat.ST_UID] == uid _test = Test _count = Count class Gen: def __init__( self, generator ): self.generator = generator def __iter__( self ): return self.generator class Genpipe(Gen): def Test( self, pred ): self.generator = Test( self.generator, pred ) return self def Count( self, n ): self.generator = Count( self.generator, n ) return self def __or__( self, other ): if callable(other): self.generator = Test( self.generator, other ) return self print 'Genpipe test...' for file in Genpipe( Files('.') ).Test( isGif ).Count(10): print file def Append( *generators ): for g in generators: for x in g: yield x def Alternate( *generators ): gs = list(generators) for i in range(len(gs)): if not hasattr( gs[i], 'next' ): gs[i] = iter(gs[i]) while 1: for g in gs: yield g.next() def Combine( *generators ): gs = list(generators) for i in range(len(gs)): if not hasattr( gs[i], 'next' ): gs[i] = iter(gs[i]) while 1: lis = [] for g in gs: lis.append( g.next() ) yield tuple(lis) class Genops(Genpipe): def __and__( self, other ): if callable(other): self.generator = Test( self.generator, other ) return self def __or__( self, other ): self.generator = Alternate( self.generator, other ) return self def __add__( self, other ): self.generator = Append( self.generator, other ) return self _files = Files class Files(Genops): def __init__( self, *args ): self.generator = apply( _files, args ) print 'Last test...' for x in Files() & isGif & fileOwner('sdm7g') & fileLargerThan(512) |range(20): print x From tbryan at python.net Sun Dec 2 20:27:01 2001 From: tbryan at python.net (Tom Bryan) Date: Mon, 03 Dec 2001 01:27:01 GMT Subject: Distutils bdist_rpm missing licence option? Message-ID: I'm using Distutils-1.0.2 with Python-1.5.2. I'm trying to build an RPM for PyUnit. Here's my .cfg file # pyunit Distutils configuration file [bdist_rpm] licence = Python License long_description = This package contains PyUnit, a unit testing framework \ for Python. PyUnit is a standard library in Python 2.1, but it needs \ to be installed separately for Python 1.5.2. release = 1 vendor = Ecoaccess.org packager = Tom Bryan The licence option is listed in the Distutils documentation, but I'm getting the following error. Search for licence on http://www.python.org/doc/current/dist/creating-wininst.html $ python1.5 setup.py bdist_rpm --spec-only running bdist_rpm error: error in setup.cfg: command 'bdist_rpm' has no such option 'licence' Indeed, bdist_rpm.py's user_options list seems to be missing licence. I could get Distutils to stop complaining by editing bdist_rpm.py, but I couldn't get it to initialize the variable: it still outputs a .spec file with a "Copyright: UNKOWN" line. Am I doing something wrong, or should I submit a bug to the Python project at SourceForge? I already searched the bugs, and this one isn't reported. I can't believe that I'm the first one to use Distutils to build an RPM and notice that the licence (and long_description) options don't work. ---Tom From use-net at schabi.de Tue Dec 4 10:05:25 2001 From: use-net at schabi.de (Markus Schaber) Date: Tue, 4 Dec 2001 16:05:25 +0100 Subject: Printing from Windows References: <9ui1ki$lfv$1@news.netpower.no> <20011204111022.682cc9dc.use-net@schabi.de> Message-ID: <20011204160525.13e9b50f.use-net@schabi.de> Hi, On Tue, 04 Dec 2001 11:21:05 GMT "Neil Hodgson" wrote: > > Maybe the gtk+ printing works with windows and unix in the same way. > > > > This has the disadvantage that gtk+ is not part of standard python, > > but there are some extreme powerful widgets there (including > > embedding the mozilla engine). > > AFAICT there is no printing support in GTK+. If there is I'd like to > hear about it so I can support printing in Scintilla and SciTE. There is > a gnome-print module but that is part of GNOME and GNOME is generally > only available on X/Unix. That's possible, I only read that gdk (one of the base libraries for gtk and gnome) drawing operations are suitable for printing as well. Maybe that gnome has the only implementation using this facility. markus -- "GPL software is not free - the cost is cooperation" From fgranger at alussinan.org Fri Dec 21 02:25:26 2001 From: fgranger at alussinan.org (=?ISO-8859-1?Q?Fran=E7ois_Granger?=) Date: Fri, 21 Dec 2001 08:25:26 +0100 Subject: Unsung Python modules References: <3dsnad226b.fsf@ute.mems-exchange.org> Message-ID: <1f4qlgm.1iuu0th19yclb3N%fgranger@alussinan.org> Scherer, Bill wrote: > On 14 Dec 2001, Andrew Kuchling wrote: > > > What's your favorite unsung module? > > I think anygui will become one. While not the interface (yet) > for gui's of exacting detail, for the more mundane gui it's quite > sufficient. My first gui with it ran without change under Python > on Linux and windows, and under Jython too. That's so cool. A really cool one. And run on MacOS like a charm. -- La majorit? ? toujours tort car elle est compos?e d'imb?ciles. La minorit? aussi, mais moins nombreux... - L?o Campion - cit? pas No?lle Adam From mac at dgp.toronto.edu Tue Dec 4 11:19:30 2001 From: mac at dgp.toronto.edu (Maciej Kalisiak) Date: Tue, 04 Dec 2001 16:19:30 GMT Subject: "print 0.1==0.1" -> TypeError; what did I do? References: <87pu5vqxvv.fsf@dgp.toronto.edu> Message-ID: <87bshf7yb1.fsf@dgp.toronto.edu> "Fredrik Lundh" writes: > does the problem go away if you add this line just > after the call to your extension: > > hasattr(None, "spam") Yes! After following your suggestions about PyErr_Occurred() I quickly found the problem, thanks! I'm curious though, how exactly did the above statement get rid of the exception?? -- Maciej Kalisiak|mac@] "Be master of your petty annoyances and conserve your dgp.toronto.edu|www.] energies for the big, worthwhile things. It isn't the dgp.toronto.edu/~mac] mountain ahead that wears you out - it's the grain of ] sand in your shoe." -- Robert Service From chris.gonnerman at newcenturycomputers.net Tue Dec 11 08:42:44 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Tue, 11 Dec 2001 07:42:44 -0600 Subject: O_APPEND & O_WRONLY References: <9v4o5l$1h75$1@colo.mobo-it.nl> Message-ID: <004701c18249$bb2a0040$0101010a@local> ----- Original Message ----- From: "waalp" > I'm trying to open a file in append mode (using python under ms windows) > if i use the O_APPEND parameter i get a errormessage from the interpreter > like this: > OSError: [Errno 9] Bad file descriptor > > But if i use the O_WRONLY parameter everything goes write. > > But i want to append the file, not overwrite it? > > am i doing something wrong here? Yup, I'm afraid so... see my notes below: > my code: > #!/usr/bin/python > from os import * This is a real bad idea. Just 'import os' and add os. to the beginning of everything... you are overriding builtins with incompatible interfaces. > def writeLog(logMSG): > logfd = open('event.log',O_APPEND) You need to bitwise-OR the O_APPEND and O_WRONLY flags (AFAIK). > write(logfd, logMSG) > close(logfd) > > writeLog('hello world') Why aren't you using the normal Python builtin file functions? I'd write your function like this: ################################## def writeLog(logMSG): log = open("event.log", "a") log.write(logMSG) log.close() writeLog('hello world') ################################## Or even better: ################################## log = None def writeLog(logMSG): global log if log is None: log = open("event.log", "a") log.write(logMSG) log.flush() writeLog('hello world') ################################## From rob at pythonemproject.com Sat Dec 29 13:11:24 2001 From: rob at pythonemproject.com (Rob) Date: Sat, 29 Dec 2001 18:11:24 GMT Subject: need help with class of arrays which have attibutes References: <3C2D3C2C.C9EF5AFE@pythonemproject.com> Message-ID: <3C2E06C9.E2AE1F40@pythonemproject.com> Thanks Emile! Paul Dubois helped me out with this originally and I thought that his code was broken, since a test case didn't work right. Now I'm perplexed since I can no longer get his code to break :) But there is one part of my program that definitely is hosed which uses this class, and today I'll try to get it to work. Here is what Paul send me: -------------------------------- from Numeric import * class Cond: x1=0 y1=0 lz1=0 x2=0 y2=0 lz2=0 DelX=0.0 DelY=0.0 DelZ=0.0 wire=map(lambda dummy: Cond(), zeros((20))) -------------------------------------------------- In case you are wondering why I'm doing such insanity, I'm porting a C program with chained structures. If I don't set up some Python classes that work the same, I'll have to change 100's of lines of code. I will print out your code, study it, and keep it for further reference. Thanks a lot! Rob. Emile van Sebille wrote: > > "Rob" wrote in message > news:3C2D3C2C.C9EF5AFE at pythonemproject.com... > > > > Hi Emile, I've been reading the books and experimenting with different > > kinds of classes, but it just doesn't seem possible to use an array as a > > basis for a number of class attributes. For example, > > wire=conductor (i.e. class) wire[1].x1=30 wire[2].x2=40 etc. Rob. > > import Numeric > > class Test: > def __init__(self): > self.attrs = Numeric.zeros(10) > > def __repr__(self): > return repr(self.attrs) > > t1 = Test() > t1.attrs[2] = 1 > > t2 = Test() > t2.attrs[2] = 2 > > print t1 > print t2 > > HTH, > > -- > > Emile van Sebille > emile at fenx.com > > --------- -- The Numeric Python EM Project www.pythonemproject.com From mwh at python.net Mon Dec 3 06:17:38 2001 From: mwh at python.net (Michael Hudson) Date: Mon, 3 Dec 2001 11:17:38 GMT Subject: 2.1 loop with try & continue -> bug? References: <9u93uh$4m$1@peabody.colorado.edu> <9u9447$4m$2@peabody.colorado.edu> Message-ID: Fernando P?rez writes: > Fernando P?rez wrote: > > > > Am I missing something? > > > > Yes, I missed the bug report :) > > Well, time for 2.2 I guess. Or 2.1.2. Cheers, M. -- If I had wanted your website to make noise I would have licked my finger and rubbed it across the monitor. -- signature of "istartedi" on slashdot.org From jkraska at san.rr.com Mon Dec 10 11:45:54 2001 From: jkraska at san.rr.com (Courageous) Date: Mon, 10 Dec 2001 16:45:54 GMT Subject: Fatal Error in the interpreter? Message-ID: I'm currently using the Debug build from Python as checked out of the current CVS branch (Python22). I have an extension that I've written and compiled successfully, but when I import it, the interpreter crashes: Fatal Error: Interpreter not initialized (version mismatch?) Upon introspection, it appears that the program is crashing from within Py_InitModule(). I clearly see the version mismatch suggestion on the error line, but after fishing about, I'm fairly confident that I don't have a different Python in my runtime than the Python I compiled with. What else causes this error? C// From gh_pythonlist at gmx.de Sat Dec 8 16:38:33 2001 From: gh_pythonlist at gmx.de (Gerhard =?unknown-8bit?Q?H=E4ring?=) Date: Sat, 8 Dec 2001 22:38:33 +0100 Subject: It's hard to find documentation In-Reply-To: <200112081328040980.0156CC2B@mail.rdc1.sdca.home.com> References: <200112081328040980.0156CC2B@mail.rdc1.sdca.home.com> Message-ID: <20011208213833.GA1268@lilith.hqd-internal> Le 08/12/01 ? 13:28, Bruce Eckel ?crivit: > Here's an example. In the Python FAQ, there's a reference (no URL) > to a document: > 5.1. Can I create my own functions in C? > Yes, you can create built-in modules containing functions, > variables, exceptions and even new types in C. This is explained in > the document "Extending and Embedding the Python Interpreter" (the > LaTeX file Doc/ext.tex). Also read the chapter on dynamic loading. > > So let's try to find "Extending and Embedding the Python > Interpreter". Using 'search,' using 'advanced search,' nothing > comes up with that title. Maybe it doesn't exist. Who knows. I have > this struggle a lot when hunting for python information. The docs you're refering to are in the standard Python documentation, for example here: http://www.python.org/doc/current/ext/ext.html I agree that documentation can always be improved. Especially with respect to extension programming. On the other hand, especially the docs on the C API have improved lately. But I still need to go hunting for examples in existing C modules most of the time. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From thisis at bogus.com Wed Dec 5 13:29:42 2001 From: thisis at bogus.com (Duke) Date: Wed, 5 Dec 2001 13:29:42 -0500 Subject: Learning resources needed References: <9ukp40$90u84$1@ID-106629.news.dfncis.de> Message-ID: <9uloua$9bb3v$1@ID-106629.news.dfncis.de> "Laura Creighton" wrote in message news:mailman.1007560868.5116.python-list at python.org... > You need to give a better mailing address than thisis at bogus.com if you want > to get mail. I do not. ng posts are just fine ;) > Stay away from Tcl if you can help it. Hmm this is surprising, I thought Tcl would be worthwhile to know. But you're the second person to disagree so I'm just going to get aquainted with it (already done actually) and leave it at that. Still, it's standard on many UNiX systems, and on virtually all Linux distro (less my own ;) > Take a look at > http://www.pythonware.com/library/tkinter/introduction/index.htm > If you find this hard going, then learning Tkinter will be hard for you. Thx, Luca pointed it out first and it's perfect. > Lots of people like wxPython. Lots of people don't. So, what else is new? ;) > Some of the reasons > that some people hate it are exactly the same reasons that some people > love it. You will have to try it and see. Makes sense, however it will have to wait since I've made the decision to go with Tkinter for now. Actually, PyQt is what I'll most likely try next since I've programmed Qt. From grey at despair.dmiyu.org Thu Dec 27 20:08:02 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Fri, 28 Dec 2001 01:08:02 -0000 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <3$--$$_-----$%$__$@news.noc.cabal.int> On Thu, 27 Dec 2001 17:48:13 +0000, phil hunt wrote: > Python runs quickly on my 300 MHz box, which is 3 times slower > than the slowest PC you can buy today. It can only get more popular. Well, if you take the measure of just pure Mhz.... 4 times slower. ;) -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Steve Lamb Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:36:14 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775454 27193 211.57.49.2 (31 Dec 2001 05:10:54 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:10:54 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From kevin at cazabon.com Sun Dec 16 16:33:45 2001 From: kevin at cazabon.com (Kevin Cazabon) Date: 16 Dec 2001 13:33:45 -0800 Subject: cgi : limiting size of POST? Message-ID: <5a4226f0.0112161333.e3120a0@posting.google.com> Is there a way to automatically limit the size of a user POST through CGI, or is this the responsibility of the webserver itself? From the description of the cgi module, it looks like the POST info (including attached files) is stored in memory as a string... sounds dangerous if someone decides to upload 1GB of data...? Through Perl CGI, I can set CGI::POST_MAX... and uploaded files are stored on disk, not in memory. Any thoughts of how to control this with Python cgi and Apache on Linux? Thanks! Kevin Cazabon. From wurmy at earthlink.net Sun Dec 2 01:21:24 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Sun, 02 Dec 2001 06:21:24 GMT Subject: Help with classes References: <9uc9v5$g69$1@news.xmission.com> Message-ID: <3C09C85E.94379059@earthlink.net> Kaden wrote: > I am playing with classes and trying to get the hang of them. I pretty > much understand how inheritance and sub/superclassing goes I think. I > just am having trouble figuring out how to get different classes to > communicate with each other. The best way I can think to explain this is > to post an example, so here's a nearly verbatum snippet from a tutorial I > recently read: > > class Basket: > > def __init__(self,contents=None): > self.contents = contents or [] > > def add(self,element): > self.contents.append(element) > print "You put the", element, "in your basket." > > def remove(self,element): > self.contents.remove(element) > print "You remove the", element, "from your basket." > > def print_me(self): > result = "" > for element in self.contents: > result = result + " " + `element` > print "You look in your basket and see:" + result > > class NiceBasket(Basket): > > def open(self): > print "You open your basket." > state = "open" > > def close(self): > print "You close your basket." > state = "closed" > > Now then, the above class works. However, I want to be able to add some > checks, such as checking to see if NiceBasket is closed when you try to > add soemthing to it. I can't figure out how to do this. By overloading methods. For example, add a new 'add' method to NiceBasket, that checks, and if the check is successful, it calls its parents' add method: def add(self, element): if self.state == "open": Basket.add(self, element) else: print "The basket is not open." I see that in your open and close methods, you use 'state' as a local variable. This won't work; to make it visible throughout the instance of NiceBasket, you should add "self." to it: def close(self): print "You close your basket." self.state = "closed" Initializing this state variable is probably a good idea too. To do so, override the __init__ constructor in NiceBasket: def __init__(self, contents=None): Basket.__init__(self, contents) self.state = "closed" # or open, depending on what you want > The only way I could see this working is if the checks were done in the > Basket class, but that would be the wrong place since NiceBasket is the > class gives the baskets the ability to be opened. So any checks would > have to be in NiceBasket, right? Indeed, and the code samples above show you how. :-) Note that, when you call a method in the same class, you do it like this: self.method(args) but calling a parent's method is done like this: .method(self, args) e.g. Basket.add(self, element). HTH, --Hans From chris.gonnerman at newcenturycomputers.net Sat Dec 1 14:41:19 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Sat, 1 Dec 2001 13:41:19 -0600 Subject: PHP vs. Python/comp.lang.php? References: <9tia10$43o$1@dahlia.singnet.com.sg> <3bfcce0b$0$89809$edfadb0f@dspool01.news.tele.dk> <20011129.151831.971899228.1845@hp.com> <83vgfru4la.fsf@panacea.canonical.org> Message-ID: <005801c17aa0$3d393580$0101010a@local> ----- Original Message ----- From: "Suchandra Thapa" > By templating features, I was refering to a way to separate the html > and code into separate files, one for the html with tags indicating where > to substitute values and one for the code. This is primarily so that > the web designers/graphic artists can fiddle around with the look and feel > without having to know php or python. Likewise, the developers can write > the code without having to worry about the appearance. I've got one of those... my makesite.py at http://newcenturycomputers.net/projects/webpub.html It started out as a way to standardize the look and feel of a basically static website, but grew into a general HTML templating system. (There are very many more such modules, I've recently learned...) From skip at pobox.com Sun Dec 23 09:37:56 2001 From: skip at pobox.com (Skip Montanaro) Date: Sun, 23 Dec 2001 08:37:56 -0600 Subject: MySQLdb "Illegal instruction" error. In-Reply-To: <97ae44ee.0112230102.791201d2@posting.google.com> References: <97ae44ee.0112222313.1d1c71d6@posting.google.com> <97ae44ee.0112230102.791201d2@posting.google.com> Message-ID: <15397.60484.395352.859525@12-248-41-177.client.attbi.com> >> >>> import MySQLdb >> >>> d = MySQLdb.connect("", "test", "", "") >> Illegal instruction >> >> I can confirm that the MySQL database 'test' can be accessed by >> anybody on localhost (as well as any other host) using the mysql >> client. So, I think it must be MySQLdb on my system. shriek> Sorry, the above snippet was wrong - should've been >>>> d = MySQLdb.connect("", "", "", "test") shriek> but the problem still persists (ie. "Illegal Instruction" error shriek> and Python exits). Works for me (2.2, --with-threads, MySQLdb 0.9.1): >>> import MySQLdb >>> d = MySQLdb.connect("", "", "", "test") >>> c = d.cursor() >>> c.execute("describe tables") >>> c.execute("show tables") 1L >>> c.fetchall() (('testac',),) >>> c.execute ("describe testac") 2L >>> c.fetchall() (('object_id', 'int(11)', 'YES', '', None, ''), ('object_title', 'varchar(64)', 'YES', '', None, '')) -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From bac at OCF.Berkeley.EDU Tue Dec 4 17:06:21 2001 From: bac at OCF.Berkeley.EDU (Brett Cannon) Date: Tue, 4 Dec 2001 14:06:21 -0800 Subject: Making a string raw In-Reply-To: References: <59333ea6.0112041014.7908e9ab@posting.google.com> Message-ID: Go to the Python Cookbook at activestate.com . I posted a function there that does exactly what Gary suggests you do. It is under the tet section. You could also just search for 'raw string' to find it. -Brett Cannon On Tue, 4 Dec 2001, Gary Herron wrote: > There is no such thing as a raw string! A string is a string is a > string (except for unicode strings) and it might, or might not, > contain back-slashes or non-ascii characters. > > The 'raw' part has to do with string literals, which is how create > strings in a python program. Other ways of creating strings, such as > a Tkinter textbox, may or may not have an easy way to create string > values with various special characters. (If memory serves, a '\n' in > a tkinter textbox produces a two character string -- backslash > followed by "n".) > > Example: > spam = r'hello' > eggs = 'hello' > produce exactly the same string value. Neither is raw or un-raw, and > both are Python strings with five characters. > > The same hold true for the following two ways of creating strings: > spam = r'C:\abc' > eggs = 'C:\\abc' > Again the two strings have the same value, neither is raw or not raw, > and both have a backslash > > If what you want is to take a string which has various backslash > sequences such as "\n" and convert such sequences into newlines, then > try: > str.replace("\\n", "\n") > or > str.replace(r"\n", "\n") > both of which specify replacing the two character string backslash-"n" > with a one character newline. > > Hope that's all clear, > Gary Herron > > > On Tuesday 04 December 2001 10:14 am, Rune Nesheim wrote: > > Could any of you lot tell me how to convert a string stored in > > avariable to a raw string? > > > > I know I create a raw string this way: > > > > spam = R'hello' > > > > But if I don't know what the string is going to contain, for example > > if I fetch from a Tkinter text-box to the variable 'eggs' and want to > > convert 'eggs' into a raw string. > > From usenet at NOSPAM-irmen.cjb.net Sat Dec 22 08:15:56 2001 From: usenet at NOSPAM-irmen.cjb.net (Irmen de Jong) Date: Sat, 22 Dec 2001 14:15:56 +0100 Subject: How to generate XML References: <3c21e330@news.opennet.it> Message-ID: "Martin von Loewis" wrote in message news:j44rmko5s6.fsf at informatik.hu-berlin.de... > I'm amazed that people always start proposing difficult-to-use > libraries when this question comes up. I'd prefer to use > > print "" I've created various applications that parse XML using a parser, and generate XML using plain print statements. The generated XML depended on the data set, i.e. it wasn't a static document. Also the size varied from about one printed page to more than 5 printed pages, nothing too spectacular. But every single time there were various problems: 1. syntax errors (like not escaping <, or forgetting a /) 2. structural errors (opening tags were not closed, wrong nesting) 3. inconsistencies (one ducument had US-ASCII encoding, the other no specified encoding, the next had \n\r line separators, another didn't have any line separators) 4. difficulties when changing specs. Restructuring the XML usually meant: erase and type it all in once again. 5. Creating recursive or repeated structures is somewhat awkward, and the resulting XML is almost never looking "good" for the human eye; usually it's not indented at all. If I need to create a XML doc that is larger than, say, 10 elements, I will *not* do that using prints. I will use DOM, or some other API, to create it in a structured, consistent way. I believe that all five problems above are solved by doing it this way. What would be wrong with (hypothetical code):- doc=Doc("UTF-8") root=Element("root",{"type","sometype"}) root.add(Element("subelt", "the contents")) root.add(Element("empty")) root.add(...some other document root element...) # great for recursive/repeating structures doc.add(root) print doc.XML() and then getting The contents .... here is some other document included.... Just my ?0.02. Regards Irmen de Jong From andy47 at halfcooked.com Sun Dec 2 23:00:32 2001 From: andy47 at halfcooked.com (Andy Todd) Date: 3 Dec 2001 04:00:32 GMT Subject: Very new to this References: <#k0oOh4eBHA.1192@cpimsnntpa03> <#EQGkj4eBHA.1188@cpimsnntpa03> <3C0AB92D.2010407@home.com> <#3jVur4eBHA.1404@cpimsnntpa03> <3C0AEF74.3080005@home.com> <3C0AF54B.8070301@home.com> Message-ID: "amberdelton" wrote in : >Are there any good books or web sites that you could suggest for a >beginner? I have never programmed before, this is my first try at it. >Thanks for all the help. > > Try the newbies page at Python.org - http://www.python.org/doc/Newbies.html Also don't forget the first rule of the internet "Google is your friend" - its amazing how many specific questions can be answered by entering http://www.google.com/ in the location field of your favourite browser and then typing words into the search field. Regards, Andy -- Content free posts a speciality From use-net at schabi.de Tue Dec 4 09:58:12 2001 From: use-net at schabi.de (Markus Schaber) Date: Tue, 4 Dec 2001 15:58:12 +0100 Subject: Fullscreen window in pythongtk Message-ID: <20011204155812.0c760e00.use-net@schabi.de> Hi, I'm currently using python-gtk version 0.6.8-12 (debian woody). Now I've got the problem that I want to open a fullscreen window (not maximized, but really full screen, means: window in front of all others, no decoration visible). I tried several variations, my last try was the following code: =================== #!/usr/bin/env python from gtk import * import GDK #define hooks def destroy(*args): window.hide() mainquit() #create the window window = GtkWindow(WINDOW_TOPLEVEL) window.connect("destroy", destroy) window.set_border_width(1) window.set_title("Test") #Try to make the window full screen window.set_policy(0,0,1) window.set_position(WIN_POS_CENTER) window.set_uposition(0,0) window.set_usize(screen_width(),screen_height()) #add an exit button Button = GtkButton("exit") window.add(Button) Button.connect("clicked", destroy) #Show the whole thing window.show_all() mainloop() =================== Now the window has the correct size, but the window manager shifts the window left and down so the left and top decoration (title bar etc.) are visible. (I'm using sawfish/gnome. Opera and XAWTV do fullscreen fine.) During search in some mailing list archives, I found the following C snipplet: =================== gdk_window_raise (window->window); gdk_window_move_resize (window->window, 0, 0, gdk_screen_width(), gdk_screen_height()); =================== However, the pygtk window doesn't have a window attribute, and the gdk functions window_raise and window_move_resize seem to be left out in the python wrapper. Does anybody know the trick I missed? markus -- "GPL software is not free - the cost is cooperation" From zhangsc at neusoft.com Tue Dec 4 00:24:16 2001 From: zhangsc at neusoft.com (=?gb2312?B?1cXJ2bPb?=) Date: Tue, 04 Dec 2001 13:24:16 +0800 Subject: dictionary quetion Message-ID: <001801c17c83$eb0cd010$4301010a@sky> Hello! I have a question about python's dictionary,I have a dictionary type variable, such as dbs={'xk.dhs.org': '166.111.177.77', 'www.symantec.com':'202.112.237.39', 'ftp.happynet.org':'166.111.160.7'} When I input dbs['www.symantec.com']='202.112.237.15',I want to get the result like that: dbs={'xk.dhs.org': '166.111.177.77', 'www.symantec.com':['202.112.237.39','202.112.237.15'],'ftp.happynet.org':'166.111.160.7'} How to realize this function? When I input dbs['www.symantec.com']='202.112.237.39',how to determine if this item has exists in dbs,if item has existed, the result is still like this: dbs={'xk.dhs.org': '166.111.177.77', 'www.symantec.com':['202.112.237.39','202.112.237.15'],'ftp.happynet.org':'166.111.160.7'} if item doesn't exist,then insert new value into dbs,How to realize this function? When I print dbs,I like the result as follows: 'xk.dhs.org': '166.111.177.77' 'www.symantec.com':'202.112.237.39' 'www.symantec.com':'202.112.237.15' 'ftp.happynet.org':'166.111.160.7' How to realize these function? Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From bill-bell at bill-bell.hamilton.on.ca Thu Dec 27 14:43:36 2001 From: bill-bell at bill-bell.hamilton.on.ca (Bill Bell) Date: Thu, 27 Dec 2001 14:43:36 -0500 Subject: Hi there In-Reply-To: <1009480388.1931.3329.m5@yahoogroups.com> Message-ID: <3C2B3398.19120.CE4879@localhost> Heather19i at aol.com wrote, in part: > [M]y name is Heather and I am a 19 year old female ... attending > San Diego State University ... [I] and my four of my girlfriends > and are all VERY turned on to meet a guy and satisfy ALL of his > pleasures. Obviously Heather just doesn't understand the strength of a man's feelings about his calling as a software developer. Perhaps we would be best just to ignore this invitation--even those of us who live near to San Diego. "It is the time that you have wasted for your rose that makes your rose so important."--St-Exupery From maxm at normik.dk Thu Dec 6 09:37:24 2001 From: maxm at normik.dk (Max M) Date: Thu, 6 Dec 2001 15:37:24 +0100 Subject: Python classes for reading/writing/parsing MIDI files References: <3C0F63F0.20D2B25@alum.mit.edu> Message-ID: <3c0f82a1$0$25377$edfadb0f@dspool01.news.tele.dk> "Will Ware" wrote in message news:3C0F63F0.20D2B25 at alum.mit.edu... > Nearly a year ago I wrote some Python classes for MIDI events and objects. > These made it possible to parse an existing MIDI file to produce a meaningful > Python data structure, and I used that to do some music synthesis in > software. The classes are now also capable of writing a MIDI file. Thusfar > the only test I've done has been to read in one MIDI file, parse it to > Python data structures, and write out another, and make sure they sound > identical; Great ... i'll have a look-see. Algorithmic composition is rad :-) regards Max M From jkraska at san.rr.com Mon Dec 10 17:50:50 2001 From: jkraska at san.rr.com (Courageous) Date: Mon, 10 Dec 2001 22:50:50 GMT Subject: Is c or c ++ my language for this task... Or is it Python? References: <3c14c628$3_1@mk-nntp-1.news.uk.worldonline.com> Message-ID: <5jea1u8ivaaj4o7a4aa98gcm5chgmli3f1@4ax.com> >What language *does* offer what I require? Where is its ng? _Languages_ often don't offer services at all. Rather, people write the service and happen to have it implemented in a particular language. What you're looking for is a service and/or library which happens to be implemented in the language you are interested in. Some newsgroups are more general purpose than others. Because of the sheer numbers of people who know C++, the comp.lang.c++ newsgroups is topical strictly speaking to the language itself and the language only. It's syntax, grammar, and its official standard library are the only things that they discuss. C// From robin at jessikat.fsnet.co.uk Mon Dec 3 04:12:37 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Mon, 3 Dec 2001 09:12:37 +0000 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: In article , Courageous writes > >>well I'm +1 on use of tabs. It's much better when the response time is >>long eg across the Atlantic or a heavily loaded server. > >If you're noticing a difference with small things like text files, >I highly suggest you use a compressing transport protocol. > >C// > unfortunately compression has no effect on the response time. In fact to get compression to work I have to wait for at least some characters to fill a buffer. God knows what it would do to multi-character sequences which are often detected by timing. As often the seriously under experienced are shouting the loudest. -- Robin Becker From peter at engcorp.com Fri Dec 7 19:46:13 2001 From: peter at engcorp.com (Peter Hansen) Date: Fri, 07 Dec 2001 19:46:13 -0500 Subject: list comprehensions to effect visitors References: Message-ID: <3C1162D5.570DCEC6@engcorp.com> "Cromwell, Jeremy" wrote: > > > Peter Hansen wrote: > > > Bruce Eckel wrote: > > > > > > I am in fact feverishly translating "Thinking in Patterns" into > > > "Thinking in Python" to prepare for my tutorial at the Python > > > conference, which is due monday. I was certain it would be an > > > enormous job as it was with C++ and Java to write these examples, > > > but as usual Python changes everything, and I might even hit the > > > deadline. > > > > Why not post some of the samples here as a translation exercise? > > Peter, > I thought we weren't supposed to help people with their homework? I believe Bruce is no longer in school. > I know, you just want The thought did not occur to me until you mentioned it. > to encourage an author Uh, yes... > whose written some good books on other languages Yes. > to complete his Python book for the benefit > of all of us. And yes. I'm not sure whether there is sarcasm in your posting, or not, without a smiley, so I have to assume there was some objection. Other than the idea of helping somebody who might help the Python community back, to which part of my suggestion do you object? (I don't see you posting very often here, so perhaps you are new and didn't realize that some of us like to post messages in attempts to help newcomers to Python. It lets us exercise our Python coding skills, lets us exercise our writing and explanatory skills, and it gives us personal satisfaction to help others. Now maybe you'll understand the suggestion.) Regards, ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From stephen at stephencox.org Tue Dec 4 18:45:37 2001 From: stephen at stephencox.org (stephen cox) Date: Tue, 04 Dec 2001 23:45:37 GMT Subject: zope newsgroup? References: <9ug7rq$86oo8$1@ID-84593.news.dfncis.de> Message-ID: check out http://forums.devshed.com/forumdisplay.php?s=&forumid=11 -- Stephen Cox web.net geek for non-profits, political campaigns, and a few socially conscious businesses. stephen at stephencox.org From fredrik at pythonware.com Mon Dec 3 17:57:21 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon, 03 Dec 2001 22:57:21 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BD39F.D43D4FF7@mega-nerd.com> <3c0be454$1@207.229.64.20> <3C0BE5D5.4386B359@mega-nerd.com> Message-ID: Erik de Castro Lopo wrote: > However, the people who like me prefer using tabs (and nothing but tabs) for > indentation need to speak up. no, we don't. the language won't change just because a few people on a usenet newsgroup don't have anything better to do with their time. (how about writing some fun code, folks?) From leipold at acm.org Sun Dec 30 17:00:27 2001 From: leipold at acm.org (Walt Leipold) Date: 30 Dec 2001 14:00:27 -0800 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <458b194a.0112282052.1123341@posting.google.com> Message-ID: <0$--$$_----__%$%-$@news.noc.cabal.int> robin at brainexeculink.com wrote: > Since I'm talking databases, I wish someone with more time and brains > than I would pick up the Gadfly project and bring it up to date. We > need a pure Python SQL database. That too would help "sell" the > language. Right on! Gadfly rocks, but it's showing its age. Any takers? ------------------------------------------------------------------------ "If all you have is a hammer, Walt Leipold everything looks like a nail." leipold at acm.org ------------------------------------------------------------------------ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.berkeley.edu!ucberkeley!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: leipold at acm.org (Walt Leipold) Newsgroups: comp.lang.python Subject: cmsg cancel <71f60588.0112301400.36aed62c at posting.google.com> Control: cancel <71f60588.0112301400.36aed62c at posting.google.com> Date: Mon, 31 Dec 2001 01:38:02 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774052 27193 211.57.49.2 (31 Dec 2001 04:47:32 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:47:32 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From James_Althoff at i2.com Mon Dec 10 13:17:01 2001 From: James_Althoff at i2.com (James_Althoff at i2.com) Date: Mon, 10 Dec 2001 10:17:01 -0800 Subject: Calling a generator multiple times Message-ID: responding to responding to I was describing only Python's current "simple generators" (as that is what I thought the discussion was about). Jim =============================================== >So as to not confuse myself, I think of generators thusly: > >A generator is a function or method that -- by virtue of using the yield >statement -- *creates* and *returns* an iterator object when invoked by a >caller. The caller normally takes that returned iterator object and uses >it by invoking its "next" method until StopIteration is raised. The code >inside the generator function or method *runs* when the "next" method of >said iterator is invoked. Each time a caller invokes the *generator* >function or method, a new iterator object is created and returned. I believe that this is too restrictive a definition. My experience of generators (from C++/STL) is that a generator is simply a callable entity that returns an object every time you call it; this call takes no arguments so it is "generating" objects rather than being a factory -- factory calls take arguments and build the object based on those arguments while generators create new objects based on some internal logic. So a generator could be thought of as a zero-argument factory. I think it might have been better to say that Python now has "improved support for generators" in the form of 'yeild.' I suspect there will be a fair amount of discussion for awhile, every time the term "generator" is used, if the accompanying code does not include 'yeild'. I also think that a generator only returns an iterator if that's what it promises to generate; otherwise it returns a regular object. Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== -- http://mail.python.org/mailman/listinfo/python-list From richardSPAM at geotek.co.uk Mon Dec 3 10:15:43 2001 From: richardSPAM at geotek.co.uk (Richard Chamberlain) Date: Mon, 3 Dec 2001 15:15:43 -0000 Subject: number of values in a list References: <9uebug$81d1i$1@ID-69142.news.dfncis.de> Message-ID: <45agu9.ku7.ln@servant.geotek.co.uk> len(abc) Richard "Andreas Penzel" wrote in message news:9uebug$81d1i$1 at ID-69142.news.dfncis.de... > Hello NG! > > I have a list and want to know the number of values. > Example: abc = [5,10,15,20,25,30] > result should be: 6 > > What to do? > > > Thanks, Andreas > > > From tatebll at aol.com Wed Dec 19 13:59:38 2001 From: tatebll at aol.com (Bill Tate) Date: 19 Dec 2001 10:59:38 -0800 Subject: Dictionaries as records References: Message-ID: "Bill Wilkinson" wrote in message news:... > I have been happily using a list of dictionaries to hold table data for > years. > For the first time, this method is proving less than efficient because of > the amount > of memory overhead the dictionaries produce. I have a file with 200K > records and > 16 fields. This file is parsed and each row is put into a dictionary and > the dictionary is > added to a list. The raw file is only about 50mb. > > I was shocked to see that my memory use jumped to 500MB! When I delete the > list the memory is returned to the system, so I know that the memory is > being used in the dictionaries. > > What strikes me as odd is that I can create a list of 200K dictionaries with > test data (a copy of the same record over and over) and the amount of memory > used is only half. > > Having read many of the articles on this newsgroup about how dictionaries > are sized, I am aware of some of the memory issues involved with using a > great number of dictionaries as I am. > > Can someone who has faced this issue and found a workaround please fill me > in. I know one can use a list of lists or a list of tuples, but had rather > stick to the dictionaries because of some library issues. > > Thanks in advance, > > Bill Have you tried Metakit for Python - its unbelievably fast, extremely compact and easy to use with standard builtins? Its plain fun to use. From mwh at python.net Tue Dec 4 05:04:31 2001 From: mwh at python.net (Michael Hudson) Date: Tue, 4 Dec 2001 10:04:31 GMT Subject: 'ioctl ' call in python (serial port reading) References: <3C0C8FF3.7060500@beth.uniforum.org.za> Message-ID: mixo writes: > I am current trying to drop 'RTS' (Request To Send) > on a serial port. In 'c' I do the following : > > ++++++++++++++++++++++++++++++++++++++++++++++++ > . > . > > int fd, mdlns;//fd is a file discriptor > . > . > > ioctl (fd, TIOCMGET, &mdlns); > mdlns &= ~TIOCM_RTS; > ioctl (fd, TIOCMSET, &mdlns); > . > . > . > +++++++++++++++++++++++++++++++++++++++++++++++ > > What would the equivilent code in 'python' be? > How can I disable 'RTS' on a serial port? > Something a bit like this: import fcntl, struct, termios s = fcntl.ioctl(fd, termios.TIOCMGET, "\000\000\000\000") i = struct.unpack('l', s)[0] i &=~ termios.TIOCM_RTS s = struct.pack('l', i) fcntl.ioctl(fd, termios.TIOCMSET, s) Not tested! Cheers, M. -- Our Constitution never promised us a good or efficient government, just a representative one. And that's what we got. -- http://www.advogato.org/person/mrorganic/diary.html?start=109 From lac at strakt.com Mon Dec 3 11:17:33 2001 From: lac at strakt.com (Laura Creighton) Date: Mon, 03 Dec 2001 17:17:33 +0100 Subject: A modest indentation proposal In-Reply-To: Message from gat@jpl.nasa.gov (Erann Gat) of "Fri, 30 Nov 2001 14:35:41 PST." References: Message-ID: <200112031617.fB3GHXua013875@ratthing-b246.strakt.com> I think that you will have a better chance of getting your management to let you use Python if you start using it yourself for some open source project that interests you and get good enough at it that you are so enthusiastic about the other virtues of Python that you no longer care about indentation, and know deep down that nobody else should either. You might want to take a look at the last 3 weeks of the anygui project. http://anygui.sourceforge.net (But its easier to read the maling list at http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/anygui-devel) 2 weeks ago we had a cool idea. If we used Python weakrefs, we could write a dispatcher, and that would make the problems of garbage collection much smaller. The problem was that few or none of us knew how weakrefs actually worked. We talked about it for 2 days and then, as hackers who don't understand what they are doing like to do, we went and wrote code. In four days 5 people, working independently, produced _7_ working dispatchers. The joke was that I was the only one who hadn't written a dispatcher. And the only reason I didn't write one, was that I have only been programming in Python every day for 6 months. So I am too slow for the company I am keeping; I couldn't write a dispatcher quickly enough. I think I could write one in 10 days. And Joe Knapka and Patrick O'Brien each wrote _two_ dispatchers in four days. These were not toy prototypes; they do useful work. Paolo Invernizzi and I, who each needed a dispatcher for our own purposes for a prototype in our respective workplaces, each took one of these dispatchers and installed it at work in our prototypes. Patrick O'Brien made a recipe out of his dispatcher http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/87056. You can find pointers to most of the rest of them at http://aspn.activestate.com/ASPN/Mail/Message/909131. The reason your management should want Python is because it exposes you to less risk. Instead of spending all your time in wretched planning meetings where people make decisions about what code we all are going to write, based on what somebody has read about what it is supposed to be like somewhere, you can tell the advocates of differing approaches to come back in four days with a prototype. Then you can look at the code and say useful things like 'this design will never scale' and 'this is a really difficult part' and 'oops we never thought of that before' .... while all the rest of the world is busy in a meeting yapping about what the ideal implentation of the ideal design would look like. You generate designs faster, and you can throw the worse ones away. You can read the anygui archives to watch us do a lot of that, as well. Note that a lot of the ideas we threw away would be _adopted_ by other non Python projects. They were good ideas. We just had _even_ _better_ _ones_. (Indeed, after all of this, we considered not using _any_ weakref version _at all_.) The reason everybody wants Python is because it shortens the list of 'cool things that I would like to do, but I will never get done in time before I die'. Your semicolon proposal is, at this point, worse than irrelevant. It is _irritating_ to have to type semi-colons and brackets, when you are used to not having to. Every time I have to write something in C, I am _annoyed_ at this. And this is the case with every person I know of who has had the pleasure of writing all their code in Python for a few months. It spoils you, and makes using certain other languages _irritating_. In March, I set me the goal of reading every comp.lang.python article that has been archived. Years and years of this stuff. I am almost finished, (and if any of you are considering this, my suggestion is _don't_ do this, it is _not_ time effective). But this gives me an interesting perspective. Many, many, many people who start using Python come with the idea that the shortcomings of the language they are most used to, are shortcomings of programming languages in general. They perceive what they think is the same weakness in Python, and immediately propose that this defect be rectified. The existing Python community says something on the order of 'this problem that you are worrying about, really isn't a problem for Python programmers'. The newcomer shakes his head, and thinks that the Python community is nuts. Six months go by. The newcomer has in the meantime been posting much more interesting Python questions to the list that indicate that he or she has been using the language to do something fairly interesting (or at least complicated. ). And a brand new Python novice comes in with fears that Python has this horrible defect that they recognise from their experience with programming language Z. And this time, newcomer, six months more experienced with Python, is among the _first_ to say, 'you know, this really isn't a problem for Python programmers'. So I think that the only real solution to your management's worries about indentation is to let them program, or watch you program in Python for six months or so. (And maybe a copy of pychecker will ease their fears.) You need a different argument to get them to let you use Python in the first place, but fortunately you will have one after you personally start using Python for six months; and that one will be 'look at how incredibly productive I am in Python'. Of course this implies waiting until you have been programming in Python long enough to get the incredible, near miraculous boost in productivity you have always wanted. (At which point, I predict, semicolons, brakets, and other clutter will bother you as well, and you will hate your proposal.) If this pitch does not work, then it will be extremely difficult for you to sell your management on _anything_. If they truly cannot see how being this much more productive can expose them to much less risk, and they are so incredibly risk adverse that your proposal, which amounts to a _coding standard_ is a hot, serious, topic, then it may be hopeless. It will take a high degree of negotiating skill in any case, and one focused on getting your management to dream again. This is very hard work, which I have done too much of. I've successfully made large government agencies who had such a mindset change their policies, but that was only because I recognised that nobody in management there actually gave a damn about minimizing _risk_, and minimizing _failure_ was also not a top priority. Failure was _expected_, but what was important was that when it failed, CBS News and Time Magazine would not understand _why_ it failed, and so couldn't write a nasty article saying that everybody at the Agency were negligent fools who waste taxpayers money. You are at Nasa. This may be your management's position as well. If so, recall, if you use Python, and your project fails in some way interesting to journalists, then they will say that it failed because Python uses whitespace for indentation. This is something that every journalist can understand, and it will feed their egos and make them feel like God to think that those fancy technical experts botched something and _I_ _FOUND_ _THEM_ _OUT_. So they will say this, _even if_ the true reason that your project failed was that in your C++ extension you passed an array of X when you meant to pass an array of Y. Journalists lie, and every idiot journalist on the planet is going to wish to believe that a failure was caused by indentation. You cannot get around this risk. And no amount of redesigning Python can help the problem that the profession of journalist is so full of ego-driven, obnoxious dabblers, inordinately fond of their superficial knowledge and who, seemingly incapable of any creative acts of their own take an obscene and petty joy in preventing creativity in others. I don't have time to write more. Magnus Lie Hetland, Benevolent Dictator for A While of the anygui project has decided, that despite his having an exam on Friday, and his getting out of the hospital from knee surgery, that we are going to have a beta release _this Friday_. I have code to write. But I wish you the very best of luck, since I care about space a lot, and I think that Nasa missions would be a lot safer if they used more Python and less C++. Laura Creighton From shulmang at colorado.edu Thu Dec 27 18:22:31 2001 From: shulmang at colorado.edu (Garett Shulman) Date: Thu, 27 Dec 2001 23:22:31 GMT Subject: REPOST: python irc Message-ID: <0$--$$_-----$$$--$@news.noc.cabal.int> does anyone know of python irc servers/channels? ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Garett Shulman Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:34:41 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775506 27193 211.57.49.2 (31 Dec 2001 05:11:46 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:11:46 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jknapka at earthlink.net Mon Dec 31 00:16:13 2001 From: jknapka at earthlink.net (Joseph A Knapka) Date: Mon, 31 Dec 2001 05:16:13 GMT Subject: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> <87ellcrfs3.fsf@kursk.kassube.de> Message-ID: <3C2F9D70.CE43AAA5@earthlink.net> Cliff Wells wrote: > > On 30 Dec 2001 14:36:28 +0100 > Nils Kassube wrote: > > > I never claimed that an OS should be written in Python. There are > > several good all purpose languages who are better for this task, > > e.g. Lisp and Ada. > > Sorry, I was being somewhat facetious. Unfortunately I am not familiar > with either Lisp or Ada so I can't comment on their appropriateness for > low-level work. Since you aren't the first person I've heard advocate Ada > for this type of work, I have to wonder why it hasn't been done (or has > it?). Lack of such an OS doesn't prove anything, but it does beg the > question. Many embedded systems run Ada "on the metal" -- that is, no "real" OS, just Ada (compiled down to native code, natch) for everything from application logic to interrupt handlers. So arguably there are many tiny OS's implemented in Ada. (I have no personal experience with Ada either, just picked this tidbit up by lurking on embedded lists. Someone will no doubt correct me soundly if I'm leading you astray :-) Lisp, OTOH, strikes me as an unlikely vehicle for an OS implementation; I think of Lisp as being at about the same level of abstraction as Python (but with much less appealing syntax, and a much greater functional emphasis). But I've only written enough Lisp to get the hang of it, not enough to be an expert. Cheers, -- Joe "I should like to close this book by sticking out any part of my neck which is not yet exposed, and making a few predictions about how the problem of quantum gravity will in the end be solved." --- Physicist Lee Smolin, "Three Roads to Quantum Gravity" From wurmy at earthlink.net Wed Dec 26 19:42:26 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Thu, 27 Dec 2001 00:42:26 GMT Subject: REPOST: Re: re.match oddity References: Message-ID: <2$--$$-$$$$%%-$$-$@news.noc.cabal.int> Issac wrote: > > A curious thing is happening in my c2py.py script (below). > The resulting files contain little ^M's (when viewed with the Windows > version of gvim 6.0 but not when viewed with notepad.exe) at the ends > of the lines. When I remove the lines > > line_is_lone_left_curly = re.match(r'^\s*{\s*((//.*)|(/\*.*\*/))?$', line) > if line_is_lone_left_curly: > pylines[-1] = pylines[-1][:-1] + ':\n' > continue > > the ^M's go away. Does anyone know why? I'm using Python 2.1.1 > on Cygwin with Windows 2000. Not sure it has anything to do with re.match. Most likely it's caused by the line that appends ':\n'. This is probably written to file as '\r\n' (CR/LF) (in Windows). I suspect that some other lines only have '\n' (LF) as a line separator, otherwise gvim would not show them; it usually detects the line ending and displays the text accordingly. The solution is to make sure that your lines have either a Windows or a Unix line ending, but not a mix. Use os.linesep when in doubt. --Hans ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Hans Nowak Newsgroups: comp.lang.python Subject: cmsg cancel <3C2A6D23.AD1807D9 at earthlink.net> Control: cancel <3C2A6D23.AD1807D9 at earthlink.net> Date: Mon, 31 Dec 2001 03:56:52 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009776154 27193 211.57.49.2 (31 Dec 2001 05:22:34 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:22:34 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From fperez528 at yahoo.com Wed Dec 5 10:18:08 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Thu, 06 Dec 2001 14:46:08 +2328 Subject: Suggestion for a change to a standard module - where? References: <9um7m0$ie9$1@peabody.colorado.edu> Message-ID: <9uop06$lb2$1@peabody.colorado.edu> Michael Hudson wrote: > Fernando P?rez writes: > >> So, who should I talk to? > > http://www.python.org/patches/ > > Cheers, > M. > Thanks. Patch submitted to sourceforge. Cheers, f From lac at strakt.com Mon Dec 3 18:11:18 2001 From: lac at strakt.com (Laura Creighton) Date: Tue, 04 Dec 2001 00:11:18 +0100 Subject: whats new in 2.2 (was A modest indentation proposal) In-Reply-To: Your message of "03 Dec 2001 22:37:13 GMT." References: Message-ID: <200112032311.fB3NBIua015658@ratthing-b246.strakt.com> Here is my current decorator pattern: class Decorator: """An abstract Decorator class based on one posted to comp.lang.python by Rainer Deyke. """ def __init__(self, decorated): self._decorated = decorated # add some data attributes you want def __getattr__(self, name): return getattr(self._decorated, name) def __call__(self, *args, **kwargs): self._decorated(*args, **kwargs) # Override other operators too This relies on the fact that my __getattr__ will not get called if python already finds the attribute. What am I supposed to do in 2.2 with not classic classes, if this is the exact behaviour I want? Laura Creighton From bsturk at news.rcn.com Fri Dec 7 00:45:02 2001 From: bsturk at news.rcn.com (Brian Sturk) Date: 7 Dec 2001 05:45:02 GMT Subject: strict python? Message-ID: Can python be more strict about declarations? I didn't see a flag to the interpreter, and haven't seen anything yet in my book or on www.python.org. I ask because I got burned by something like this: def func ( self ): print hello def call_func( self ): self.func <--- no parentheses my script that had code like this ran fine, but didn't call the function. I would have thought that this would have been an error since there was no assignment of any kind. It took me a little for me to figure it out in my real script. It'd be nice to have this stuff pointed out while parsing it. Is it possible? thanks -- .-----------------------------------------------------,-------. | Brian M. Sturk - http://www.nh.ultranet.com/~bsturk \ C/C++ | .> )\,^a__ |--------------------------| bsturk at nh.ultranet.com | Java | ( _ _)/ /-." ~ | http://www.telengard.com `---------------------------`------| `( )_ )/ | Telengard Technologies Inc. - NT/*nix UI & device drivers | _<_s_<_s '-------------------------------------------------------------' From davebutlerREMOVE at hotmail.com Mon Dec 17 17:30:49 2001 From: davebutlerREMOVE at hotmail.com (Dave Butler) Date: Mon, 17 Dec 2001 22:30:49 GMT Subject: Python Hosting Questions References: Message-ID: Thanks to all who replied with suggestions. Another question: Is anything special needed if I wanted to run Zope? My feeling is that may be difficult to run if the Hosting company is not oriented to it. Dave "Fredrik Lundh" wrote in message news:Yc7T7.4074$l93.1017789 at newsb.telia.net... > Dave Butler wrote: > > > I am searching for a new hosting company because my existing host does not > > provides many services/technologies (like Python) that I would like to use. > > While I evaluate potential hosts, I am uncertain as to which questions I > > should be asking. Perhaps CLP can help me with my list of questions as it > > relates to Python. Here are my Python questions for the web hosting > > companies: > > > > 1) Which version of Python is installed (it seems it should be at least 2.0 > > or 2.1) > > 2) Is Mod_python supported? > > www.cornerhost.com is worth checking out (we're using them for > portions of pythonware.com). they know Python, and the support > is more than excellent, this far. > > (I think the answers to your questions are 2.0, and yes) > > > > > > From syver-en+usenet at online.no Wed Dec 12 19:11:34 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 13 Dec 2001 01:11:34 +0100 Subject: tabs vs spaces, what do IDEs use? References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <3c17d349$1@207.229.64.20> Message-ID: "Peter Bismuti" writes: > I've noticed that both JBuilder (if I remember correctly) and > VisualStudio.net use tabs as the default for indenting with a width of > 4. > > This is certainly a strong piece of anecdotal evidence that refutes > this idea that "normal" people uses spaces for indenting. Or maybe contrarywise :-) -- Vennlig hilsen Syver Enstad From zhangsc at neusoft.com Thu Dec 13 21:21:33 2001 From: zhangsc at neusoft.com (=?gb2312?B?1cXJ2bPb?=) Date: Fri, 14 Dec 2001 10:21:33 +0800 Subject: socket question Message-ID: <002201c18446$0c82cb40$4301010a@sky> I encountered a question,when I deal with UDP socket connection,my programs existed.I have two programs,one is server.py,another is client.py ,I run them in two computers,server.py is at 10.1.1.27,client is at 10.1.1.67 ,my programs are follows: server.py #It works at IP address of 10.1.1.27 .... #I get udpaddr from IP header of 32bit source ip address, #and I get udpdata[0] from UDP header of 16bit source port number. addr=udpaddr,udpdata[0] print type(addr) print addr #for some program design reason,I can't use data,addr=udpSerSock.recvfrom(BUFSIZ) to get addr udpSerSock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) udpSerSock.sendto(data,addr) udpSerSock.close() client.py #It works at IP address of 10.1.1.67 from socket import * import string HOST='10.1.1.27' PORT=21567 BUFSIZ=1024 ADDR=(HOST,PORT) udpCliSock=socket(AF_INET,SOCK_DGRAM) data=raw_input('>') udpCliSock.sendto(data,ADDR) print udpCliSock.getsockname() data, addr = udpCliSock.recvfrom(BUFSIZ) if data: print data udpCliSock.close() First,I run server.py at 10.1.1.27 $python server.py Then I run client.py at 10.1.1.67 $python client.py >hello The running result of server.py: ('10.1.1.67', 1165) $ The running result of client.py,it raise a error: ('0.0.0.0', 1165) Traceback (most recent call last): File "client.py", line 11, in ? data, addr = udpCliSock.recvfrom(BUFSIZ) socket.error: (104, 'Connection reset by peer') I know that my server.py don't use normal way to return data to client.py ,but I need this way! How to correct my programs? Any ideas will be appreciated! Thanks. Edward -------------- next part -------------- An HTML attachment was scrubbed... URL: From owen at astrono.junkwashington.emu Wed Dec 26 15:34:47 2001 From: owen at astrono.junkwashington.emu (Russell E. Owen) Date: Wed, 26 Dec 2001 12:34:47 -0800 Subject: strange Tkinter problem References: Message-ID: In article , tjiit wrote: >I have an application using a Tkinter GUI which starts a network >connection if you click on a button. The strange thing is that the GUI >freezes and the connection is established. Does this mean that Tkinter >executes the functions bound do an event and then returns when the >function has ended? I thought it would to kinda multi-threading so it >could handle large events and keep interactive while doing it. >Can anyone give me a (some) hints? Check out Tk file events (or use threads, as others have suggested -- I've not tried this). One source of info is my web page: . -- Russell From rnd at onego.ru Sun Dec 2 14:01:04 2001 From: rnd at onego.ru (Roman Suzi) Date: Sun, 2 Dec 2001 22:01:04 +0300 (MSK) Subject: Draft PEP: string interpolation with backquotes In-Reply-To: Message-ID: On Sun, 2 Dec 2001, Roman Suzi wrote: >On Sun, 2 Dec 2001, Oren Tirosh wrote: > >>PEP: XXXX >>Title: String interpolation with backquotes >>Author: oren at hishome.net (Oren Tirosh) >>Created: 2-Dec-2001 >If we are concerned about readability, we do not need interpolation. Those >who want it could easily use special library. >Also i" has an impact on program efficiency, because ` ` will not >be precompileble (or will it?) as the rest of Python code. Ooops! PEP has words about preprocesing and compile-time checks of i""-string. My mistake. * However, I think that Python doesn't need string interpolation! My hope is, that Guido will never allow preprocessing and such features in. Why formatting is not enough??? One can do: print format("lalalal %(s1+s2+s3)s .... dfdfdfdf", namespace) easily. Or, if one prefer, this kind of formats could be added: print format("lalalal %(`s1+s2+s3`)s .... dfdfdfdf", namespace) or just: print format("lalalal %`s1+s2+s3`s .... dfdfdfdf", namespace) In the form it is proposed, it makes difficult to control presentation. Format string is more powerful than repr could be made. And anyway what inline `expr` will add? Well, if this is to be done in Python, I'd prefer another way. General kind of inlines, with possibility to process them as one likes, with whatever processor is choosen. But this is already possible and needs no additions. Sincerely yours, Roman Suzi -- _/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/ _/ Sunday, December 02, 2001 _/ Powered by Linux RedHat 6.2 _/ _/ "Old MacDonald had a computer with an EIE I/O" _/ From fredrik at pythonware.com Mon Dec 17 17:55:47 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon, 17 Dec 2001 22:55:47 GMT Subject: python and SOAP?? References: <9vldte$hn7$1@pea.uk.research.att.com> Message-ID: Duncan Grisby wrote: > Tunnelling everything through a port that's normally used for > "safe" things like web servers is not a proper, secure, solution. on the other hand, anyone who thinks that hackers won't find your service if it's on another port should probably not connect their machines to the internet. if they get through your firewall, and the software they get access to isn't solid enough, they're in. (but I really didn't have to tell you that, did I ;-) From nospam at bigfoot.com Mon Dec 24 10:35:54 2001 From: nospam at bigfoot.com (Gillou) Date: Mon, 24 Dec 2001 16:35:54 +0100 Subject: MimeWriter and smtplib: long list of 'To:' recipients References: <9vvks6$27qr$1@norfair.nerim.net> Message-ID: Steve, Thanks a lot for your reply. Here is some more information... > > > Perhaps a little more information would be helpful. > > Is the MimeWriter library apparently formatting a correct message? If so, > presumably the error occurs in smtplib? If so, can you give us the error > message and traceback, plus some of the code surrounding the point of error? This code does not trigger any exception. In debug mode, the smtp server did not reply anything noticeable pertinent to my problem. > > If everything appears to happen correctly in your Python program but you get > bounce mails because some of the messages cannot be delivered (even though > you are pretty sure the addresses are good) then you have an ISP-related > issue, which you will typically only solve by talking with the ISP's > technical support folk (assuming, that is, that they have any). I sent a mail to a long list of recipients with different mail clients (IE5 and StarOffice mail). The difference I noticed is that these mail clients split the "To" line in multiple lines, the second line (and following) beginning with some spaces like this: To: mymother at herisp.net, mygirlfriend at bed.org, mybrother at home.com, myboss at hell.org When the Mimewriter.addheader('To', samelistofrecipients) writes all in one long line. Is there some limitations in the SMTP protocol (or other related rfc) regarding the length of an header line ? Happy Christams --Gilles > > regards > Steve > -- > http://www.holdenweb.com/ > > > > > From claird at starbase.neosoft.com Thu Dec 27 21:30:42 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 27 Dec 2001 20:30:42 -0600 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: <7$--$$_----_%-$$-$@news.noc.cabal.int> In article , RPM1 wrote: . . . >"full technical support" > >That's what gets thrown in my face whenever I mention Python. >(And I mention it a lot). The company I work for writes point >of sale software in C and VB, because "there's support" and >"customers won't pay for something made with freeware." > >I think if Python wants to get "bigger" or more acceptable, >it needs marketing. The guy with the bag of money needs >to say, "Oh yeah, Python, I've heard of that." Customers >ask us if we have a Java 'solution', they don't ask if we >have a Python 'solution'. That's got to change if Python >'wants' to grow more, (I don't know that it does). > > It seems to me, (with my limited experience), that the >most dedicated audience Python has is the scientific >community. I would start there. Get some big chemical, >pharmaceutical, or biological corporations to use Python, >(by catering to their needs), and then they will in turn >support the language when they see the wonderful end >product. Then people like me can say to my boss, "look >Dow, Johnson & Johnson, and ADM all use Python >heavily, so there's nothing to be afraid of." . . . Companies like Dow, J&J, and ADM *do* use Python. I'm rather grouchy on this subject. My experience is that organizations that start talk about "full technical support" are resistant to any factual content. It doesn't matter how much we demonstrate Python's technical superiority to them, nor how many times Python has proven itself capable/reli- able/efficient/...; it makes them uncomfortable, and no rational discussion affects their comfort. I say, "it's an optimized solution. Yes, it has Java segments." That's usually enough for the people who just want buzzwords. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!newsfeed.mathworks.com!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: claird at starbase.neosoft.com (Cameron Laird) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:21:13 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775710 27193 211.57.49.2 (31 Dec 2001 05:15:10 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:15:10 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From tripp81 at yahoo.com Mon Dec 3 06:14:48 2001 From: tripp81 at yahoo.com (Tripp Scott) Date: Mon, 03 Dec 2001 18:14:48 +0700 Subject: executing .pyc file In-Reply-To: <20011203123441.E2490@phd.pp.ru> References: <5.1.0.14.2.20011203134639.03256bd8@202.95.131.154> <5.1.0.14.2.20011203134639.03256bd8@202.95.131.154> Message-ID: <5.1.0.14.2.20011203181231.02714718@202.95.131.154> On 03/12/2001 16:34, Oleg Broytmann wrote: >On Mon, Dec 03, 2001 at 01:53:41PM +0700, Tripp Scott wrote: > > has someone written a trick so i can directly execute .pyc in > > unix? > > http://www.lyra.org/greg/python/#dev cool. but the .pyc is now not valid for python (can't be imported as usual). i think i'll settle with a script wrapping the original .py, that way i can also get a shorter name. thanks, t From maxm at mxm.dk Thu Dec 13 10:30:33 2001 From: maxm at mxm.dk (maxm) Date: Thu, 13 Dec 2001 16:30:33 +0100 Subject: Just ignore ... Sorry! Re: gibman2worldonline.dk References: Message-ID: Whoops ... I was in the wrong folder when I send that ... Sorry ... Max M From fredrik at pythonware.com Mon Dec 3 18:55:31 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon, 03 Dec 2001 23:55:31 GMT Subject: 2.1.1 and regexp References: Message-ID: Dave Pawson wrote: > Can anyone straighten me out on > the history / future of regexp in python please. > Present (2.1.1) documentation implies that re will be > replaced by sre. > http://www.python.org/doc/current/lib/module-re.html no, it says that the "pre" engine may go away. user code should use "re", unless they have a good reason for not doing so. From michael at stroeder.com Thu Dec 27 14:21:28 2001 From: michael at stroeder.com (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Thu, 27 Dec 2001 20:21:28 +0100 Subject: A new message board is up References: <40dbad98.0112262232.1868734e@posting.google.com> <3C2B724D.E4D31E24@ccvcorp.com> Message-ID: <3C2B74B8.D2FE36F5@stroeder.com> Jeff Shannon wrote: > [..] > I won't be participating in this Python EZBoard. I always wonder why people put "web forums" in place. I can't read them while being off-line (e.g. on the train) and they are damn slow. Newsgroups and mailing lists are the right medium for this kind of communication. Ciao, Michael. From wtchiu at hongkong.com Tue Dec 11 10:51:02 2001 From: wtchiu at hongkong.com (wtchiu) Date: Tue, 11 Dec 2001 23:51:02 +0800 Subject: Hi All Message-ID: <3C162B65.27E6B107@hongkong.com> Hi All, I am a newbie of PYTHON From syver-en+usenet at online.no Fri Dec 21 07:27:52 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 21 Dec 2001 13:27:52 +0100 Subject: threading.py -> winthreading.c : Some results References: Message-ID: "Jason Orendorff" writes: > I've reimplemented the synchronization objects of threading.py > in non-portable, Win32-only C. Cool, can I get the code from anywhere? -- Vennlig hilsen Syver Enstad From sjoshi at ingr.com Mon Dec 10 13:27:56 2001 From: sjoshi at ingr.com (Sunit Joshi) Date: 10 Dec 2001 10:27:56 -0800 Subject: Can't import from mx.ODBC Message-ID: <8f8ffe67.0112101027.24a3dcaf@posting.google.com> Hello I'm trying to imort from mx.ODCB.Windows but I keep getting an error saying "ImportError: No module named mx.ODBC.Windows". I checked the sys.path and I do have the following: 'C:\\Python21\\mx\\ODBC' Could someone please tell me what is wrong here..?? thanks Sunit sjoshi at ingr.com From jgardn at alumni.washington.edu Thu Dec 20 12:12:15 2001 From: jgardn at alumni.washington.edu (Jonathan Gardner) Date: Fri, 21 Dec 2001 02:12:15 +0900 Subject: [BTTC-core] CVS should be working now... In-Reply-To: <000401c1896c$3acb9ba0$35101b41@hugh> References: <000401c1896c$3acb9ba0$35101b41@hugh> Message-ID: <200112201712.fBKHCeJ06252@my.knctv.co.kr> On Friday 21 December 2001 12:37 am, TigerWraith wrote: > Jon is there a way that you can send me the files directly? I don't really > know how to use the CVS and I don't know if I can use it to begin with. > Also I haven't tried yet, but im not using Win9x anymore New computer and > 98SE wasn't very Stable on it. Kept having to re-install ever 3 days. Ill > let you know if I can get all the Python Stuff to run on Win2KPro or not. > Shoot. I keep forgetting about you guys. ;-) I'll make a release sometime tomorrow. It's 3:00 AM here, and I can't see the screen anymore. CVS does work with windows, but you have to take some time to get it working right. I think I was using winCVS, but it had some weird behavior. Try searching on Google for something like "howto windows cvs" or "windows cvs beginner" or whatnot, see what comes up. Make sure you also use the resources at sourceforge, because their documentation is aimed specifically at people like you who are all new to this. The scariest part of CVS for me was the fact that it was creating directories and moving stuff around, and "what's all this authentication/login/password stuff about and how come it don't work?" But after a while, it all makes a lot of sense, and you realize how easy it was all along. Kind of like HTML, I guess. Good Luck, Jonathan From sdm7g at Virginia.EDU Wed Dec 19 18:59:02 2001 From: sdm7g at Virginia.EDU (Steven Majewski) Date: Wed, 19 Dec 2001 18:59:02 -0500 (EST) Subject: Why is Complex number notation the way it is? In-Reply-To: Message-ID: On Wed, 19 Dec 2001, Grant Edwards wrote: > >> I've been coding Python for about a day now, and I can't 'see' why a > >> complex number like 2+3i is represented as 2+3j in Python. > > > > Guido was apparently thinking like an engineer at the > > time. Electronic engineers use j instead of i to avoid > > confusion with current. > > And I'm sure it's almost as obvious why "i" is used for > current. :) I was told it was because "c" was already taken for > capacitance, but I still don't know why "i" was chosen over > some other as-yet-unused letter. But, we use notation where > current flows from "+" to "-" so don't try to confuse us with > facts! I think you can blame Ben Franklin for that! He was the champion of the 'single-fluid' theory of electricity [1] -- opposed to the dual-fluid theory, which held that the two poles represented two different electrical fluids which flowed in opposite directions. Obviously, the positive (+) pole is where there is a surplus of electrical fluid -- and electricity, like water, flows from a higher to a lower (negative) level! Of course, if you've read any book on semiconductor theory, you will know that Franklin was wrong: the two-fluid theory was the correct one -- "electrons" flow in one direction and "holes" flow in the opposite direction! -- Steve [1] I double checked my memory by searching for "Ben Franklin electric current fluid" on google and scored another bullseye: From philh at comuno.freeserve.co.uk Thu Dec 27 15:01:10 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Thu, 27 Dec 2001 20:01:10 +0000 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <35fda446.0112270421.7082ff87@posting.google.com> Message-ID: On 27 Dec 2001 04:21:57 -0800, Dudley Carr wrote: >First and foremost, the rate at which a language is growing, >especially in terms of industry acceptance, is always difficult to >tell since rarely is a survey done to find out how many people are >using a particular language across all industries. > >Personally, I use the following metric to see how a language is >progressing: > >1. Look at the number of Oreilly books (possibly books by other >publishers) that have been or are going to be released in relation to >the language. > >2. Number of articles on programming websites using / explaining the >language. > >2. Look the support for new technologies in the language and its >libraries. > >3. Activity in the newsgroup is also very indicative esp. with the >number of newbie questions flowing-in (mention in an earlier post). 5. look at the number of projects using that language on Sourceforge. -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From andreas at mtg.co.at Mon Dec 3 06:07:20 2001 From: andreas at mtg.co.at (Andreas Kostyrka) Date: Mon, 3 Dec 2001 12:07:20 +0100 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) In-Reply-To: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> Message-ID: Am Montag, 3. Dezember 2001 05:37 schrieb Courageous: > But this is all academic, because the defacto and near dejure standard > for Python is 4 spaces per indentation level. Tabs are deprecated. Were does it say so? I've been programming Python with mixed spaces/tabs since 1.3. Works like a charm. Just never forget to install python-mode.el ;) Andreas -- Andreas Kostyrka; Raiffeisenstr. 16/9; 2320 Zw?lfaxing Tel: +43/676/4091256; Fax: +43/1/7065299 From greg at cosc.canterbury.ac.nz Wed Dec 12 18:17:43 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Thu, 13 Dec 2001 12:17:43 +1300 Subject: PEP 276 Simple Iterator for ints (fwd) References: <3c169178.96189593@wa.news.verio.net> <3c16a0ca.100111272@wa.news.verio.net> Message-ID: <3C17E597.454CEBCD@cosc.canterbury.ac.nz> Bengt Richter wrote: > > Then again, you could just spell it out...: > > for i in slice(0,5,2): > ... You could also define an ints object that would let you say for i in ints[0:5]: ... -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From toflatpy2 at oaktown.org Fri Dec 7 21:00:47 2001 From: toflatpy2 at oaktown.org (toflat) Date: 7 Dec 2001 18:00:47 -0800 Subject: Monitoring the windows clipboard Message-ID: <48dbc3f6.0112071800.7f7fd0b9@posting.google.com> Hey there, newbie guy here again, with you guessed it, another newbie question... I have this shareware app that works with text files and has an "Automatic paste" feature. When this feature is activated it automatically pastes any text that is copied to the windows clipboard to whatever file is active in the program. So it has a way of monitoring the windows clipboard and pasting the contents to a new line in the file whenever something new is added to the clipboard. It seems to be pretty instantaneous (i get a little system 'beep'). Is there a way I can get Python to do the same thing? I want the script/program to monitor the clipboard and paste the contents to a file whenever something new is copied (for my purposes it would always be a URL from a browser). Thanks!! -t From buzzard at urubu.freeserve.co.uk Tue Dec 11 11:49:48 2001 From: buzzard at urubu.freeserve.co.uk (Duncan Smith) Date: Tue, 11 Dec 2001 16:49:48 -0000 Subject: eGenix extensions / GMP Message-ID: <9v5df1$tla$1@newsg4.svr.pol.co.uk> I have recently installed the eGenix experimental extensions. This includes a Windows port of GMP 3.1.1. That works fine. But I would also like to use GMP via PyInline (or C++), but the C compiler doesn't seem to recognise that GMP is present. I have also downloaded the Windows port separately from http://www.lemburg.com/files/python/, but I'm not sure where to go from here. Anyone any idea how to sort this out (step by step)? Python 2.1, Visual Studio 6 on Win 2000. Thanks in advance. Duncan Smith From skip at pobox.com Wed Dec 19 17:40:53 2001 From: skip at pobox.com (Skip Montanaro) Date: Wed, 19 Dec 2001 16:40:53 -0600 Subject: re.compile bug? In-Reply-To: <16d79c8d.0112140658.6bd40400@posting.google.com> References: <16d79c8d.0112140658.6bd40400@posting.google.com> Message-ID: <15393.6005.227554.177512@beluga.mojam.com> John> Compilation fails with VERBOSE flag but works otherwise. ... >>> comment = "([^#]*)(#.*)?$" >>> re.compile(comment, re.VERBOSE) Traceback (most recent call last): File "", line 1, in ? File "d:\PYTHON21\lib\sre.py", line 90, in compile return _compile(pattern, flags) File "d:\PYTHON21\lib\sre.py", line 136, in _compile raise error, v # invalid expression sre_constants.error: unbalanced parenthesis Note that when verbose mode is enabled, the syntax of regular expressions changes slightly to make them more readable (that is "verbose" doesn't mean "verbose output", but "verbose input"): This flag allows you to write regular expressions that look nicer. Whitespace within the pattern is ignored, except when in a character class or preceded by an unescaped backslash, and, when a line contains a "#" neither in a character class or preceded by an unescaped backslash, all characters from the leftmost such "#" through the end of the line are ignored. All you need to do is place your second hash mark in a character class to keep it from being interpreted as an embedded comment: >>> comment = "([^#]*)([#].*)?$" >>> import re >>> re.compile(comment, re.VERBOSE) <_sre.SRE_Pattern object at 0x81db008> -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From rozen at mcn.org Sat Dec 22 21:45:39 2001 From: rozen at mcn.org (Don Rozenberg) Date: Sat, 22 Dec 2001 18:45:39 -0800 Subject: SnoPy 0.1 - SNOBOL pattern matching for Python Message-ID: <200112230522.fBN5Mnsa006849@mail.mcn.org> This is the first release of SnoPy, a Python extension build on GNAT.SPITBOL.PATTERNS which provides many features of SNOBOL pattern matching to the Python developer. It is released under the GPL. The home site for SnoPy is http://snopy.sourceforge.net. There is an extensive users guide including a SNOBOL pattern matching tutorial. SNOBOL was a text processing language without equal that was developed at Bell Labs in the 1960's. It has nearly died out but I am offering this extension as an alternative to regular expressions. In many respects, SNOBOL pattern matching is much more powerful yet easier to learn than regular expressions.

SnoPy 0.1 - SNOBOL pattern matching extension for Python. (22-Dec-01) From ungrzr2 at ubatxbat.pbz Fri Dec 14 01:07:31 2001 From: ungrzr2 at ubatxbat.pbz ({-- Rot13 - Hateme) Date: 14 Dec 2001 06:07:31 GMT Subject: Wrap C function which takes variable lengthed parameters? Message-ID: How to wrap a C function which takes variable lengthed parameter? Any one has such experience? Thanks. From tuttledon at mailandnews.com Sat Dec 22 14:43:08 2001 From: tuttledon at mailandnews.com (Don Tuttle) Date: Sat, 22 Dec 2001 19:43:08 GMT Subject: Fate of win32all? References: <7876a8ea.0112212116.2ebabc23@posting.google.com> <3C242A7F.2060805@skippinet.com.au> Message-ID: Thanks Mark! The simple truth is that you're the reason I use Python today. If you hadn't developed Pythonwin and the Win32 extension I'd still only be using WinBatch and a little Perl. Neither of which would have caused me to think about a possible career in programming the way Python has. So I owe ya. (And maybe on some days blame you ;-) In a way, I'm glade to see you leave ActiveState. Although the timing sucks. (My wife once working for a company that let many people go on Christmas Eve just to avoid shelling out holiday pay.) I've never been completely comfortable with their involment with the open source community. They do, after all, owe their very existence to Microsoft. And I think Dick Hart is much more in tune with Microsoft's dominion theology than say Dave Roth is. So, it now appears ActiveState has decided they can't Profit from Python like they have Perl and are going to take their little ball-y and go play in more capitalistically exploitable fields. Oh well. Shit happens. But then again, maybe now it will be less likely to happen to Python. Here's hoping you get a great paying job that allows you to spend part of your PAID time in Python development!!! Don Tuttle From grey at despair.dmiyu.org Fri Dec 28 15:26:51 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Fri, 28 Dec 2001 20:26:51 -0000 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <32c382ad.0112272324.4c78689b@posting.google.com> <3C2C88A6.9D13A3D6@earthlink.net> Message-ID: On Fri, 28 Dec 2001 15:04:12 GMT, Hans Nowak wrote: > > I'm pretty sure 1.5.2 had strip already... > According to the Beazley book it did. -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From aurumxxl at polbox.com Wed Dec 12 17:12:19 2001 From: aurumxxl at polbox.com (Irmingard Anna Kotelev) Date: Wed, 12 Dec 2001 17:12:19 Subject: New York Remembrance Message-ID: <09cca0113160cc1WEB5276@mailto.t-online-com.de> Dear friends, the madness incarnate of September 11th, 2001 is one which will never be forgotten. How could it be? This shook the entire world, and my heart was broken along with all of yours. I have created a slide show in respectful tribute to all who passed, as well as the heroics of the people. I know that America...the world... will not allow this attack to ruffle it's feathers, and I stand and applaude for the strength and resolve of it's people. God bless America...God bless the world. Do sign my 'Response to this Tribute' if compelled and please pass this on to at least one friend. http://www.aurumxxl.de/ny/ny.htm Irmingard Anna Kotelev Photographer 21th of September 2001 If you have received this email by error, please excuse it, and me for sending it. Thank you. IAK From gh_pythonlist at gmx.de Sun Dec 23 12:48:45 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Sun, 23 Dec 2001 18:48:45 +0100 Subject: vi or emacs for editing Python on Linux? In-Reply-To: <1009127729.9271.0.nnrp-12.c2de51d8@news.demon.co.uk> References: <1009127729.9271.0.nnrp-12.c2de51d8@news.demon.co.uk> Message-ID: <20011223174844.GA1411@lilith.hqd-internal> Le 23/12/01 ? 17:18, Michael Thompson ?crivit: > Hi, > > I don't think the 'learn vi as it is everywhere' argument to be bogus. If > you work in > a large company and support UNIX machines scattered all over the world then > the availability of vi is something you can depend on. [...] It's valid argument only the particular sysadmin problem you describe. For sysadmins who control their environment or for regular developers, it *is* bogus. loving vim, hating vi, Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From shalehperry at attbi.com Sun Dec 16 13:21:03 2001 From: shalehperry at attbi.com (Sean 'Shaleh' Perry) Date: Sun, 16 Dec 2001 10:21:03 -0800 (PST) Subject: Idiomatic portable way to strip line endings? In-Reply-To: <3c1cddd3.6188589@news.muenster.de> Message-ID: > > def removecrlf( line): > """Remove \r\n or \n from end of string.""" > if line[-1:] == '\n': > if line[-2:-1] == '\r': > return line[:-2] > else: > return line[:-1] > else: > return line > so on the worst case you create 3 strings to return one. Ick. From jkraska at san.rr.com Sat Dec 15 17:28:17 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 15 Dec 2001 22:28:17 GMT Subject: "Pythonj Fatal error: UNREF invalid object References: Message-ID: <1pin1uccddtk3d0o7ne50cics9ctj3nhfd@4ax.com> >+ Trying to delete an object twice (although I'd expect a memory fault > then, since deleting it the first time would have set > op->_ob_next = op->_ob_prev = NULL). I'll check into this. I can't see how I would have accidentally decref'd something too many times, but it's possible. I would have expected a different answer to that. >+ Not initializing an extension object correctly -- _Py_NewReference(ob) > has to get called when an object pops into existence, in order to > insert ob into refchain. But PyObject_Init ususally does that for > you. Right. I'll double check, but I think it's initialized correctly. >If it's random memory corruption, perhaps defining SLOW_UNREF_CHECK will >catch it earlier. I'll try that, and thank you for the insight. The following should look familiar. When I'm not getting the above described error, I'm getting one here: static void reset_exc_info(PyThreadState *tstate) { PyFrameObject *frame; PyObject *tmp_type, *tmp_value, *tmp_tb; frame = tstate->frame; if (frame->f_exc_type != NULL) { Blip! frame itself is NULL. That's a bit too regular to be random, although anything is possible. :-) I didn't mention, but I'm doing some nasty ass shit. For one, I'm escaping out of Python on a _cooperative_ multithread shift and reentering later, sometimes returning to a prior shift point. Currently this is always the same execution frame, but it's not guaranteed to be. I wasn't quite sure if this was really possible, but I wanted to give it a try anyway. N.B.: this is not preemptive multithreading, so there is never more than one actual thread of execution inside of the Python engine. C// From markj+0111 at cloaked.freeserve.co.uk Sat Dec 22 20:16:59 2001 From: markj+0111 at cloaked.freeserve.co.uk (MJ Ray) Date: Sun, 23 Dec 2001 01:16:59 GMT Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic References: Message-ID: New Scheme wrote: >> So who the fuck are you, Mr. Hotmail.com? >Your extreme pathologic response clearly demonstrates the problem with >the small, fundamentalist group of scheme "defenders of the faith" >that are being left further and further behind as the world moves >forward. Nice failure to answer the question, Mr Hotmail. In case you haven't noticed while you've been constructing yet another alias, work to update Scheme in many aspects continues apace. As my experience should show, the Scheme community is very welcoming to newcomers and it is possible to use Scheme for modern applications. If you don't want to help it, that's your problem. It is small, clean and, yes, relevant to today's work. You are just a common troll and I'm sorry I replied, but some things couldn't be left unsaid. Goodbye. Follow-ups set. From stephen.boulet at motorola.com Mon Dec 3 19:15:43 2001 From: stephen.boulet at motorola.com (Stephen Boulet) Date: Mon, 03 Dec 2001 18:15:43 -0600 Subject: Handling division by zero Message-ID: <3C0C15AF.E1441FBF@motorola.com> I have some math operations going on where sometimes the divisor will be zero. Is this an acceptable way to handle this: 1. test if the divisor is zero 2. if so, instead of dividing by it, multiply by a large number ? How do I figure out what a large number on my python 2.1 for NT distribution is? Right now, I'm using: MAXPOS = 0x7fffffff MAXNEG = 0x80000000 I've imported scipy (which includes Numeric), and the numbers are complex, if that matters, although: >>> from scipy import * >>> 0 == 0j 1 Thanks. -- Stephen From sysadmin at simonweb.com Thu Dec 20 22:49:51 2001 From: sysadmin at simonweb.com (sysadmin at simonweb.com) Date: Thu, 20 Dec 2001 20:49:51 -0700 Subject: Our Apologies Message-ID: <200112210349.fBL3np515106@picasso.simonweb.com> Dear Internet User, We would like to sincerely apologize for an unsolicited e-mail you may have received from a user on our network. The offending e-mail entitled ?This really worked for me, $$$ try, it's very easy? was sent by one of our users two days ago. At Simonweb.com we do not support nor condone the use of unsolicited e-mail as a means of advertising. Any web hosting client of ours who is found to be taking part in the distribution of unsolicited e-mail is subject to account cancellation without notice. We have removed this user?s account and we will destroy all e-mail lists associated with this user immediately. Rest assured that you will no longer receive this message from our network. Because our rates are so low, we are occasionally targeted by these spammers because in the even that we do cancel their account, they are not out much money. Fighting spam is the responsibility of every internet user and there are many ways to do it. If you are interested in learning how to fight spam, please visit spam page at http://www.simonweb.com/spam.htm . This e-mail has been sent as an apology and you will not receive further messages from us. However, we did want to take the time to write this letter to you to help you find out how you can fight spam yourself. You really are more powerful in this battle against spam than you probably realize. Again, for information on how to fight spam, please visit our spam page at http://www.simonweb.com/spam.htm. Our sincerest apologies, Simonweb.com From boud at rempt.xs4all.nl Mon Dec 17 16:34:51 2001 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 17 Dec 2001 21:34:51 GMT Subject: WYSIWYG text Editor in python? References: <3C1DDCAC.C477A0A6@cicei.ulpgc.es> <9vlgpe$o8v$1@news1.xs4all.nl> Message-ID: <9vlodr$32h$1@news1.xs4all.nl> Nahuel Greco wrote: > On 17 Dec 2001 19:24:30 GMT > boud at rempt.xs4all.nl (Boudewijn Rempt) wrote: >> >> On the other hand, I'm currently working on a text editor written >> almost entirely in Python (all editing and redisplay), with the goal >> of finally having a real interlinear text editor. I think it can >> be done -- but it's nowhere yet. >> >> > You know about scintilla / scite ? http://www.scintilla.org/ Yes - it's written in C++, not Python, but otherwise really excellent. It can't be used for interlinear text, either. -- Boudewijn Rempt | http://www.valdyas.org From jason at jorendorff.com Sun Dec 9 18:37:03 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Sun, 9 Dec 2001 17:37:03 -0600 Subject: join vs instances In-Reply-To: Message-ID: Robin Becker wrote: > I had expected that the join operation would also apply to UserStrings > somehow or that there would be some magic method that would allow join > to be applied to user strings, but I can't find out how. [...] class MyStr(str): def my_method(self): return MyStr("<<" + self + ">>") This works in Python 2.2. Older versions won't let you do that. UserString is not nearly as versatile. >>> x = MyStr("abcdefg") >>> ','.join(['w', x, 'y', 'z']) # hey, it works! 'w,abcdefg,y,z' >>> x.my_method() '<>' If you're really interested in the C source code to join(), start here http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/~checkout~/python/python/dist /src/Objects/stringobject.c?rev=2.146&content-type=text/plain and search for "join". You'll find it around line 1166. -- Jason Orendorff http://www.jorendorff.com/ From robin at jessikat.fsnet.co.uk Mon Dec 17 19:33:54 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Tue, 18 Dec 2001 00:33:54 +0000 Subject: Why no match? References: <8ctT7.13638$o9.556973@news1.tin.it> Message-ID: In article <8ctT7.13638$o9.556973 at news1.tin.it>, Alex Martelli writes .... > >Sure, this matches -- look at the end of the pattern: an equal sign, 0 or >more spaces, one digit, zero or more spaces, no constraints on what comes >after. This part I just described in words matches the '=1' part of the >argument to method match, no? > >>>>> re.compile(r'^self\s*\.\s*test\s*=\s*\d\s*$').match('self.test=11') >>>>> > >But this specifies that the string ends after the match, and it doesn't, as >it has an extra digit '1' at the end. So, the result is None. > >Maybe you want \d+ (one *or more* digits) in the pattern rather than just >\d (*exactly* one digit) as you have now? too late too late -- Robin Becker From h.jehadalwan at student.kun.nl Sun Dec 23 12:42:16 2001 From: h.jehadalwan at student.kun.nl (husam) Date: Sun, 23 Dec 2001 18:42:16 +0100 Subject: Search the difference: Why this function defenition does'nt work? References: <3C260A92.5030907@student.kun.nl> Message-ID: <3C261778.60108@student.kun.nl> Aahz Maruch wrote: > In article <3C260A92.5030907 at student.kun.nl>, > husam wrote: > >>I'm not trying to add string to a list of integeres. What I wanted to do >>is to add each argument of func2('a','b','c') to sum=['e']. Since sum is >>a list of chars, and the arguments are accessable as a sequence, one >>would expect that the addition operation would be correct. On the >>interactive shell, it is a trivial operation. But, only when i use it in >>the function defenition i get problems. Adding 'a' to ['b'] does not >>work, but adding list('a') to ['b'] it does, so, i thought that this >>might help my code, but converting the args to a list did not helpe >>either . I really didn't get yet! >> > > use list.append() > I know that this works, but it does not help my understanding! From fperez528 at yahoo.com Fri Dec 7 08:46:49 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Sat, 08 Dec 2001 13:14:49 +2328 Subject: Need help with regular expression References: <20011208113002.A21206@newcreature.org> Message-ID: <9utsd5$blr$1@peabody.colorado.edu> Ben Logan wrote: > Well at least I'm not the only one... > > I don't have the money to go buy the book, and I checked my > libraries, > but they don't have it. I also searched the web for useful info, > but found none. google(python regular expressions) yet? the first hit pretty much sums up what you need to know. f From peter.milliken at gtech.com Sun Dec 30 16:00:29 2001 From: peter.milliken at gtech.com (Peter Milliken) Date: Mon, 31 Dec 2001 08:00:29 +1100 Subject: REPOST: Re: Book "python programming patterns". anybody read this?? References: Message-ID: <2$--$$_----___%_$$@news.noc.cabal.int> G'Day Cliff, "Cliff Wells" wrote in message news:mailman.1009574494.4804.python-list at python.org... > On Mon, 24 Dec 2001 06:59:21 +1100 > "Peter Milliken" wrote: > > > Generally the standard of maintenance programmer is just > > not as good as developers (otherwise they would be developing, wouldn't > > they? :-)) and so it is a well recognised tenant that I attempt to follow > - > > code for the lowest common denominator. > Sorry to hear of these experiences, I guess we all run into this kind of situation sooner or later :-). Good luck with unravelling the mess. > Anyway, my point is, I think your statement is unfounded. There are > undoubtedly cases where what you said is true, but to assume it's the > common case is wrong - especially when you consider that many people > (myself included) learned to program by developing applications, so the > quality of coding in those apps is poor (I would probably cringe if I were > to review code I wrote 10 years ago - some poor sod is probably cursing me > right now as he tries to decipher some mess I wrote =) > I am an Electrical Engineer with a single semester of Fortran and Basic :-). The rest is self-taught, on the job training that spans (depending how you count it) at least 20 - 25 years. We all "cringe" when we think of our earliest efforts - I still produce awful code when I make the mistake of thinking I can just bash out a program off the top of my head - personally, I have to sit down and think the entire application through and do a design and requirements analysis (not in that order :-)) otherwise I end up with a poorly designed and coded mess :-). Perhaps others can say they produce works of art off the top of their heads without design that they would be proud to have other programmers review - I can't. Most of us, at some stage, spend our early introduction in a maintenance environment (mine was maintaining 24 6" thick volumes of listings of assembler code which another company had been hired to provide comments for, they ended up with approximately one comment per listing page - back in '79, I think it was :-)). I am currently work in a maintenance environment. So sometimes you tend to make statements that are a bit sweeping. But I still stick by the general statement that typically, the majority of programmers in maintenance roles would not be there if they had a choice. I am an exception, I have a choice, but my choice was to get out of defence - and to erase a "stigma" of 20 years in an industry isn't easy! :-) > Besides, applications are often written without a good specification (or > only a very basic one) so the developer is left winging it, adding > features, learning new toolkits, etc, until the original architecture is > obscured beyond comprehension. Take a look at many of the open-source > projects around and you'll often find that one of the first things > "maintainers" do upon acquiring a system is recode large portions of it to > make it more readable/maintainable, etc. > Yes, I have a poor background to comment here and this may sound (almost certainly! :-)) overly harsh, because I spent most of my work experience in the defence industry. But to me, "pressure to market", "no time to analyise", "no time to design", "customer doesn't know what he wants, so we have to wing it" - are at the end of the day just excuses for the fact that *all* the people involved in the project can't be brought around to the concept/idea that you should sit down and plan the project step by step and not proceed to the next until the previous is complete i.e. sit down with the customer, analyise the requires - protype if necessary, but get them nailed down and worked out until the customer is happy that he knows what he wants!. Then the programmer should sit down and use the analsysis to generate a design (documentation! ugh, how many programmers want to spend their life doing documentation! - there is always some excuse not too! :-) "gee, if we did that then the competition would beat us to market and we wouldn't have a job" - true I am sure in some cases but I doubt this is true for the majority of cases/projects!). Then the code can be generated from the design. Overally idealistic I am sure, but that is my opinion :-) People talk about the "software crisis" - the only crisis I have seen (in my experience :-)) is the one that your typical programmer doesn't want to do "paperwork" - all he/she wants to do is generate the next coding masterpiece. A formal analysis means paperwork, a good design means paperwork (and what is worse - others have to be able to read and understand it! :-)). But most programmers want to cut code - nothing else :-). Your point about the open source projects proves the point. Nobody bothered i.e. wanted to, sit down and work out the requirements properly - that would have taken "unnecessary time", "we know what we want - lets start coding!" :-) Hence others come in after the fact and re-write the entire thing - a very expensive exercise! Peter > That said, I don't disagree with your tenant of coding for the LCD. While > not always possible, it's good to keep in mind when one is tempted to write > "clever" code =) > > Regards, > > -- > Cliff Wells > Software Engineer > Logiplex Corporation (www.logiplex.net) > (503) 978-6726 x308 > (800) 735-0555 x308 > ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Peter Milliken" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:21:31 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774059 27193 211.57.49.2 (31 Dec 2001 04:47:39 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:47:39 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From notrub-snodar at shaw.ca Wed Dec 12 21:20:18 2001 From: notrub-snodar at shaw.ca (Burton Radons) Date: Thu, 13 Dec 2001 02:20:18 GMT Subject: a lambda in a function References: <9v8knj$f61$1@news.ucar.edu> Message-ID: <3C1810CD.7050509@shaw.ca> Fred Clare wrote: > Why does interpreting the five lines: > > > def func(): > x = 1 > add_one = lambda i: i+x > j = add_one(100) > func() > > > Give me: > > Traceback (most recent call last): > File "test.py", line 6, in ? > func() > File "test.py", line 4, in func > j = add_one(100) > File "test.py", line 3, in > add_one = lambda i: i+x > NameError: There is no variable named 'x' > > > while interpreting the three lines: > > > x = 1 > add_one = lambda i: i+x > j = add_one(100) > > works just fine? It's a matter of scope vagaries. This is answered in the FAQ, question 4.5 at (http://www.python.org/cgi-bin/faqw.py?req=show&file=faq04.005.htp): 4.5. When I define a function nested inside another function, the nested function seemingly can't access the local variables of the outer function. What is going on? How do I pass local data to a nested function? Python does not have arbitrarily nested scopes. When you need to create a function that needs to access some data which you have available locally, create a new class to hold the data and return a method of an instance of that class, e.g.: class MultiplierClass: def __init__(self, factor): self.factor = factor def multiplier(self, argument): return argument * self.factor def generate_multiplier(factor): return MultiplierClass(factor).multiplier twice = generate_multiplier(2) print twice(10) # Output: 20 An alternative solution uses default arguments, e.g.: def generate_multiplier(factor): def multiplier(arg, fact = factor): return arg*fact return multiplier twice = generate_multiplier(2) print twice(10) # Output: 20 ---- Note that this has been solved in the 2.1 series thanks to PEP 227 (Nested Scopes), as a __future__ feature. In 2.2 nested scopes were added as default. If you can't upgrade or if your code has to work on older versions, you'll have to use default arguments. The second works because you're adding variables to the global dictionary, rather than a local dictionary that is specific to that frame. Hope that helps. From brueckd at tbye.com Sun Dec 30 22:38:15 2001 From: brueckd at tbye.com (brueckd at tbye.com) Date: Sun, 30 Dec 2001 19:38:15 -0800 (PST) Subject: Python Popularity: Questions and Comments In-Reply-To: Message-ID: On Sun, 30 Dec 2001, Ulf Magnusson wrote: > Yes I would be, personally I like to think of Python as the Inverse of C. > C is: > Easy to learn > Genrates fast code > and you have to write many lines of code to accomplish something. > > Python is: > Hard to learn (well relativly to C) For whom would it be harder to learn Python than C? You mentioned later that you had used C and only C for many years, so I'm curious as to how you came to that conclusion. > Generates piss pore performance code (I am sorry to say) Hmmm... this doesn't exactly fit with the other two parts of your inverse-of-C function as 90+% of the time both C and Python performance is "fast enough". Most programs have a minimum performance requirement that is easy to reach, and the ones that are harder are not all CPU bound (e.g. rewriting in C an I/O bound Python server could result in little or no performance gains). -Dave From dsavitsk at e-coli.net Tue Dec 11 14:34:28 2001 From: dsavitsk at e-coli.net (dsavitsk) Date: Tue, 11 Dec 2001 19:34:28 GMT Subject: CGI form repost from browser--how to prevent? References: Message-ID: <8dtR7.6164$Rw2.4462556@newssrv26.news.prodigy.com> how about using JavaScript? make the submit for your form something like Click Here to Submit. add an element like this to the form then add a function like this to the Head something like that should work ... i think? "Chris" wrote in message news:fa7108b0.0112111051.3a9585c5 at posting.google.com... > I'm writing a Python cgi script that does some inserts into a mysql > database based on data in an html form submitted by a user. Is there > any way to prevent the browser from reposting the data from the form > when the user hits refresh in the browser after they have submitted > the form? When this happens, the script receives the same cgi form > data and performs the same inserts on the database. I think maybe > this can be prevented by storing some state info with cookies?? Not > sure (have never used cookies). Any ideas on an easy way to prevent > this? > > Many Thanks. > > -Chris From starx at pacbell.net Mon Dec 3 05:52:17 2001 From: starx at pacbell.net (Philip Swartzleonard) Date: 3 Dec 2001 10:52:17 GMT Subject: more on "Is this considered black magic?" References: <3C0B441C.8000608@vscht.cz> Message-ID: Marcin 'Qrczak' Kowalczyk || Mon 03 Dec 2001 02:04:46a: > Mon, 03 Dec 2001 10:21:32 +0100, Beda Kosata pisze: > >> map( lambda o: o.method( args), objects) >> >> The solution is not very error prone, but when you know what you have >> in your list it works just fine. As a side effect you also get list of >> results. > > If you don't need the results, a 'for' loop is more straightforward: > > for i in objects: o.method(args) > Hm, is there something sane that can be done to make 'method' in this situation a variable? The way i'm designing things, it would be useful to have a 'call ArbitrayFunction of all X in container' function. Pointers to established information appriciated, btw :) -- Philip Sw "Starweaver" [rasx] :: From tim at vegeta.ath.cx Thu Dec 27 14:22:15 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Thu, 27 Dec 2001 19:22:15 GMT Subject: REPOST: Re: A new message board is up References: <40dbad98.0112262232.1868734e@posting.google.com> <40dbad98.0112271006.b98e822@posting.google.com> Message-ID: <8$--$$_-----$%$%-$@news.noc.cabal.int> Andrew Nguyen graced us by uttering: > and yes, python does need a lighter heart. Python _does_ indeed have a lighter heart. It merely disliked being dragged down by doomsayers and promptly floated away. Tim Hammerquist -- For every problem, there is one solution which is simple, neat and wrong. -- H. L. Mencken ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Tim Hammerquist Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:55:39 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775624 27193 211.57.49.2 (31 Dec 2001 05:13:44 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:13:44 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From toni at devsoft.devsoft.com Fri Dec 7 11:43:27 2001 From: toni at devsoft.devsoft.com (Anton Hartl) Date: 7 Dec 2001 16:43:27 GMT Subject: MINGW References: <9uo25q$ilp$1@bob.news.rcn.net> Message-ID: In article <9uo25q$ilp$1 at bob.news.rcn.net>, David Abrahams wrote: >Is anyone out there successfully using MINGW for development of extensions >with recent versions of Python (e.g. 2.1, 2.2b2)? The procedures I've found >on the web for making it work don't inspire confidence. I would appreciate a >pointer to a known working procedure if anyone can come up with it. Check out http://starship.python.net/crew/kernr/mingw32/Notes.html We are building extensions for a quite a while now using a cross compiler hosted on FreeBSD and have not encountered any problems at all. -Toni -- /dev software gmbh | Anton Hartl | www.devsoft.com Gabelsbergerstr. 51 | Phone: +49 (89) 287237-0 | mastering 80333 Muenchen | Fax: +49 (89) 287237-33 | real-time Germany | Email: ah AT devsoft _ com | complexity From keyton at weissinger.org Sun Dec 30 23:24:21 2001 From: keyton at weissinger.org (A. Keyton Weissinger) Date: Sun, 30 Dec 2001 23:24:21 -0500 Subject: Python Popularity, python at sourceforge In-Reply-To: <3c2fdce9.28535902@nntp> Message-ID: > Java is primarily used for user interfaces on websites and gui. Huh? I think you may have Java mistaken for something else. Take a look at java.sun.com. You will find Java is all about server, server, server and did I mention server programming.... K From tatebll at aol.com Fri Dec 28 09:31:06 2001 From: tatebll at aol.com (Bill Tate) Date: 28 Dec 2001 06:31:06 -0800 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: <9$--$$_-----$$$_$$@news.noc.cabal.int> Ron Stephens wrote in message news:<3C2B9E04.9957801F at earthlink.net>... > I recently read an interview with a Digital Creations top manager where he said > that he hopes someone starts a successful business based solely on providing > ISP services using Zope, with full technical support. Is anyone looking into > this? Does anyone think this could be a successful business model? I am > interested in opinions on this. This past spring, I spent a full month pouring over Zope in detail. I pulled every example product I could find that I thought would be relative to the purpose of setting up a commercial-based application. I downloaded the tutorial and the draft zope book. I pulled down every bit of documentation I could find for developers. In so many cases, I found whatever documentation was available that key aspects of the implementation took the "assumed facts-already-in-evidence" approach; omitting key details that would were critical to improving my understanding of using Zope. I consider myself a masochist in the sense that I'm willing to go through various contortions to figure something out, but like many others, I reached a point of saying that I still don't get it. I won't even touch the issue of ZOPE's CMF or Zope Templates - the documentation on that couldn't be more confusing if it tried. My point is, the product may be perfect for my needs, but please do away with tutorial examples referring to using zoo animals to illustrate object navigation or elvis sightings to solidfy understanding of the product. There were simply too many disjointed pieces in the documentation to allow me to pull all the pieces together and believe me when I say I'm a person who will go to great lengths to try to "get something." If I'm having trouble, than I suspect more than a few others are as well. Any commercial enterprise is likely to be supported by either some data model or object-class model that almost invariably has a RDBMS on the back-end for persistent storage (I've also worked with ODBMS so ZODB isn't an issue for me). If you want to gain converts to zope, build a tutorial that follows some resemblance of a what a normal web site has to provide by way of example - perhaps something akin to the Pet Store example in Zope would be useful??? How about building an example auction site from scratch? I would be more than happy to devote time and energy contributing to Zope but I can't until I figure out how Zope works. To some degree, I think my confusion with Zope increased AFTER I went through the documentation. Truthfully, I don't even know whether Zope would be even a reasonable candidate for doing something akin to the Pet Store example or even an auction site for that matter. PHP has virtually exploded on the scene by providing a everything including the kitchen sink - it appears to have taken little convincing to gain converts to PHP and accordingly to the latest web surveys, its implementation is huge. I much rather see tools like Zope achieve that kind of status. But I don't imagine that too many folks are going to be willing to work that hard to achieve Zope Zen when other alternatives exists and that's a damn shame because I suspect Zope is an excellent product. I truly do commend and appreciate DC's contribution's to Python, but I hope somebody can point to something (either examples or documentation) that gives me a reason to try again. Truthfully, I just don't think its me. Bill Tate ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: tatebll at aol.com (Bill Tate) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:18:49 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775385 27193 211.57.49.2 (31 Dec 2001 05:09:45 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:09:45 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From sholden at holdenweb.com Thu Dec 20 15:13:56 2001 From: sholden at holdenweb.com (Steve Holden) Date: Thu, 20 Dec 2001 15:13:56 -0500 Subject: elegent sql building References: <1a241b9d.0112120534.cea1fa4@posting.google.com> <9vtcim$dnp$1@scotsman.ed.ac.uk> Message-ID: "Eddie Corns" wrote in message news:9vtcim$dnp$1 at scotsman.ed.ac.uk... > cmedcoff at home.com (Charles Medcoff) writes: > > >I recently read (parts of) "Dive Into Python" which inspired me to > >write something like the following: > > > >def buildSql(ids, engineTypes, transTypes): > > return "SELECT * FROM vehicle WHERE id in (%s) AND engineType IN > >(%s) AND transType IN (%s)" % \ > > (",".join(["'%s'" % (id) for id in ids]), > > ",".join(["'%s'" % (e ) for e in engineTypes]), > > ",".join(["'%s'" % (t ) for t in transTypes])) > > >print buildSql(['vin1', 'vin2', 'vin3'], ['4cy', '6cy'], ['4sp', > >'5sp'] ) > > >Now you can imagine where the inputs to buildSql might trickle down > >from a user interface. This is nice; perhaps even elegent. There is > >a problem with it though. What if any one of, or all of, the inputs > >are empty? The code needs to figure out whether to include the > >"WHERE" and the "AND"'s and where to put them. A chain of if's would > >be inelegent. Is there a better solution? Suggestions appreciated. > > First attempt: > > def buildSql(ids, engineTypes, transTypes): > return " WHERE ".join(filter(None,["SELECT * FROM vehicle"," AND ".join(filter(None,["%s IN (%s)" % (b,a) * max(0,min(1,len(a))) for a,b in zip([",".join(["'%s'" % i for i in x]) for x in [ids,engineTypes,transTypes]],["id","engineType","transType"])]))])) > > There's a fairly nasty trick in there! > > Second (much better) attempt: > > def buildSql(ids, engineTypes, transTypes): > return " WHERE ".join(filter(None,["SELECT * FROM vehicle"," AND ".join([" IN ".join ([b,"(%s)"%a]) for a,b in zip([",".join(["'%s'" % i for i in x]) for x in [ids,engineTypes,transTypes]],["id","engineType","transType"]) if a])])) > > > >>> print buildSql(['vin1', 'vin2', 'vin3'], ['4cy', '6cy'], ['4sp','5sp'] ) > SELECT * FROM vehicle WHERE id IN ('vin1','vin2','vin3') AND engineType IN ('4cy','6cy') AND transType IN ('4sp','5sp') > > >>> print buildSql(['vin1', 'vin2', 'vin3'], ['4cy', '6cy'], [] ) > SELECT * FROM vehicle WHERE id IN ('vin1','vin2','vin3') AND engineType IN ('4cy','6cy') > > >>> print buildSql(['vin1', 'vin2', 'vin3'], [], [] ) > SELECT * FROM vehicle WHERE id IN ('vin1','vin2','vin3') > > >>> print buildSql([], [], [] ) > SELECT * FROM vehicle > > >>> print buildSql([], ['4cy', '6cy'], [] ) > SELECT * FROM vehicle WHERE engineType IN ('4cy','6cy') > > > > Homework exercise: fill in the blank to generalise it better :) > > def buildSql(table, values, names): > return ... > > > buildSql ("engines", [[1,2],[],[],[11,22]], ["id","type","size","weight"]) > --> SELECT * FROM engines WHERE id IN ('1','2') AND weight IN ('11','22') > > > At the end of the day I think using 'if' would be more sane!! > The whole question of generating SQL from query input has a long and fascinating history. It's obvious you want to ensure that you don't include a cluse for those items the user has provided no specifications for. If you chose to generalise a little more you might get to the idea of a "specifier", consisting of a field name, a type (to say whether quotes are required around the values) and a value list. You could then do something like [UNTESTED CODE WARNING]: class Spec(): def __init__(self, name, str, vlist): self.name = name self.str = str self.vlist = vlist def vals(self) if self.str: tstr = "'%s'" else tstr = "%s" return ", ".join([tstr % x for x in vlist]) def cclause(self): return "%s IN (%s)" % (self.name, self.vals()) def buildSQL(tbl, *specifiers): conds = " AND ".join([s.cclause() for s in specifiers]) It would be simpler not to provide the specifiers for those fields the user had omitted, but it would also be fairly easy to add a predicate to determine whether the cclause() method should process it or not, as in: def buildSQL(tbl, *specifiers): conds = " AND ".join([s.cclause() for s in specifiers if s.vlist]) Such class-based manipulations might not be worthwhile if this were simply to handle user inputs and then be forgotten, but similar code could be used procedurally rather than in object-oriented fashion. regards Steve -- http://www.holdenweb.com/ From ryan.phillips at csus.edu Thu Dec 27 19:57:59 2001 From: ryan.phillips at csus.edu (Ryan Phillips) Date: 28 Dec 2001 00:57:59 GMT Subject: REPOST: Re: python irc References: Message-ID: <9$--$$_----_--_-_$@news.noc.cabal.int> irc.openprojects.net #python #pygame are the ones i know about -ryan "Garett Shulman" wrote in message news:e5bn2us3h5hi86lvkadn58glg9i7n6u0ov at 4ax.com... > does anyone know of python irc servers/channels? ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Ryan Phillips" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:51:28 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775467 27193 211.57.49.2 (31 Dec 2001 05:11:07 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:11:07 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From careye at spamcop.net Sun Dec 30 21:28:32 2001 From: careye at spamcop.net (Carey Evans) Date: 31 Dec 2001 15:28:32 +1300 Subject: values of sys.platform? for a serial port lib References: Message-ID: <87g05sktrj.fsf@psyche.dnsalias.org> Chris Liechti writes: > i'm interested in values for "sys.platform" and, if possible, the name of > the serial port (an how the ports are numbered ttyS0, ttyS1 etc.) > e.g "linux2" and "/dev/ttyS%d" % port, numbering starting at zero. Actually, my "linux2" platform has the serial ports at /dev/tts/{0,1}. Granted, some of this may be just me delighting in finding out how many programs break when I disable compatibility symlinks in devfs, but it's worth remembering that even standard serial ports may be somewhere strange. -- Carey Evans http://home.clear.net.nz/pages/c.evans/ From chris.gonnerman at newcenturycomputers.net Sat Dec 22 23:28:03 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Sat, 22 Dec 2001 22:28:03 -0600 Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic References: <3218013921984060@naggum.net> Message-ID: <007201c18b6a$3c924e20$0101010a@local> Who are these people, and what are they doing in this list? I bear no malice toward any language (unless you count disgust with Visual Basic or confusion with Perl) and would not engage in such heated battle with anyone over any language. This is the only list I still subscribe to because 1) I love Python and 2) the people, from GvR on down, are reasonable and generally quite polite. From harryo at zipworld.com.au Thu Dec 27 18:22:56 2001 From: harryo at zipworld.com.au (HarryO) Date: Thu, 27 Dec 2001 23:22:56 GMT Subject: Two languages, too similar, competing in the same space. References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> Message-ID: On Fri, 28 Dec 2001 09:56:29 +1100, Ron Stephens wrote: > ... But > now that Ruby is out there, it absorbs enormous mind share, and > development time to recreate libraries etc., which are already available > in Python, thus hurting Python. I have only tried it in a very minimal way, just to see that it did basically what was advertised, but you might be interested in this. There's a Ruby library that allows you to do things like: require 'python' require 'python/httplib' h = Py::Httplib::HTTP.new(host) h.putrequest('GET', path) h.putheader('Accept', 'text/html') h.putheader('Accept', 'text/plain') h.endheaders() Ie, the "require 'python'" makes pulling in Python libraries as simple as ... require 'python/SOME_PYTHON_LIB' which is almost as easy as doing it in Python. Similarly, referencing elements of such a library simply requires prefixing them with "Py::". Once you have a handle to a Python object, you call it the same way you would in Python. I don't think one could make it much simpler. So, to some extent, it's possible to avoid reinventing the wheel. How well this works, I can't say, just that the examples I played with worked as advertised. Obviously, there's some overhead, in that it's running a copy of the Python interpreter to execute the Python code, but so long as the work the library is doing for one is larger than the actual overhead of the call to it, that shouldn't be a problem. From Shourya.Sarcar at med.ge.com Tue Dec 18 11:50:09 2001 From: Shourya.Sarcar at med.ge.com (Sarcar, Shourya C (MED)) Date: Tue, 18 Dec 2001 10:50:09 -0600 Subject: seeing documentation Message-ID: <75968FA028EAD311B3530090279CF80C0B189FCA@uswaumsx07medge.med.ge.com> i am trying to figure out the interfaces for GNU parted from python I am not able to get hold on any documentation. is it possible to get documentation out when i am able to do "import parted" i think i have a lib for parted in /usr/lib/python but not the source code. thanks in advance From lokie.spods at ntlworld.com Sun Dec 23 17:46:21 2001 From: lokie.spods at ntlworld.com (lokie.spods) Date: Sun, 23 Dec 2001 22:46:21 -0000 Subject: I used os.waitpid,but I still can't Zombie process? References: <1008825134.967004@yabetcha.sttl.drizzle.com> Message-ID: "Donn Cave" wrote in message news:1008825134.967004 at yabetcha.sttl.drizzle.com... > Quoth "lokie.spods" : > ... > | However you can save a lot of overhead from the loop, by creating a handler > | for SIGCHLD and calling waitpid(-1, os.WNOHANG) from within the handler. See > | Pythons signal module for more details of that option. > > Hm, I think we're going in circles here - if I remember right, he was > having problems with EINTR because of SIGCHLDs. Between that and the > extra problems Python has with signal handling, I personally think SIGCHLD > is a total loser for Python programs. > > Once when we were wrestling with this one someone, maybe me, suggested > a pipe as a signalling device, just leave one end in the child process > and it will become readable on exit because of the end of file. Could > be tricky to get it to work reliably, and of course not great for massive > numbers of processes, but I don't know if anyone has really checked it out. > > Donn Cave, donn at drizzle.com OP's code snippet imply's that the original intent of the code is to continously loop and fork processes, performing cleanup when possible. Now my first suggestion of calling waitpid in that loop and looping until waitpid reports no more child processes ready to exit is a good strategy, however it does add overhead to the main loop. As all child processes will raise SIGCHLD upon exit it seems stupid to ignore the oppertunity to take advantage of the signal and perform cleanup as its required, working smarter not harder. Now your point mentions EINTR, regardless of whether you write code to handle that signal, or leave it unhandled some routines are going to exit anyway with EINTR. Re-reading the OP's code snippet, it looks like any IO that could exit with EINTR is in the child and out of scope of that signal anyway. I read your idea of signalling process completion back to the calling process via a pipe with interest. It fits in with an idea I'm playing with for a threaded DNS server, the idea being that a thread signals the main process to awake and deal with the results, so the main process can blissfully sleep in a select call until needed. As said server is in C not Python, it'll probably be very offtopic to report on success or failure of that approach, but intuitively I expect it to work as advertised. -- Anthony McDonald Spammer's please note that spamming this email address with your unsolicited crap will result in me spamming your network administrators with complaints! From gh_pythonlist at gmx.de Fri Dec 14 04:43:00 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Fri, 14 Dec 2001 10:43:00 +0100 Subject: Wrap C function which takes variable lengthed parameters? In-Reply-To: <3C19AC0B.7ABD04DF@xs4all.nl> References: <6p5j1u0oag2ofkam8o7fig5dvkfc2392hk@4ax.com> <3C19990E.BE0F3FA@alcyone.com> <3C19AC0B.7ABD04DF@xs4all.nl> Message-ID: <20011214094300.GB1476@lilith.hqd-internal> Le 13/12/01 ? 23:57, Just van Rossum ?crivit: > Erik Max Francis wrote: > > > > Courageous wrote: > > > > > Ouch! There's a way to do this, if I recall. Something to do > > > with generating the varargs and prepping it correctly. Whether > > > or not you can do this _portably_ is not something that I recall. > > > > Yes. Varargs can be used to make a va_list and pass that into another > > function. Use of varargs and va_list are ANSI compliant. > > But you can't contstruct a va_list and pass it to a _vararg_ function; > or at least it's not standard, portable, etc. See eg. > > http://www.eskimo.com/~scs/C-faq/varargs/invvarargs.19920714.html > > Unless I missed something, I think this is what the OP wanted. *g* I messed with that problem in my pyAda project (for writing Python extensions in Ada 95). I finally read that section of the C FAQ, too, but wanted to try nevertheless. Finally I could come up with a very dirty stack maniupulation hack using C macros and it worked on gcc/Linux/x86. I was pretty sure it wouldn't work on other platforms, and I was correct: as soon as I used doubles, it went wrong on gcc/Solaris/SPARC. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From jeff at ccvcorp.com Tue Dec 11 14:14:54 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Tue, 11 Dec 2001 11:14:54 -0800 Subject: intresting buried treasure in the on line reference manual References: Message-ID: <3C165B2E.AAF5CA16@ccvcorp.com> Kirk Bailey wrote: > Sending a message in python to the mail MTA > > I also found this in the refernece, very helpful, eccept for 2 things- a > line of gibberish, and there is a bug on line 14. > 12 msg = ("From: %s\r\nTo: %s\r\n\r\n" > 13 % (fromaddr, string.join(toaddrs, ", "))) # <-- I suspect > this is a linewrap error, it does not bomb This is not an error. The use of "extra" parentheses forces the parser to read this entire bit as a single line. You could also use the line-continuation character to achieve the same effect: msg = "From: %s\r\nTo: %s\r\n\r\n" \ % (fromaddr, string.join(toaddrs, ',')) > > 14 while 1: > 15 try: > 16 line = raw_input() > 17 except EOFError: > 18 break > 19 if not line: > 20 break > 21 msg = msg + line # <-- this line screws everything up! # if I place it all on one line. # the test is APPARENTLY to create an endless loop with 2 # hard coded exit conditions manually built in. But my python hates it. (Comments moved to increase legibility) You don't say anything about what *does* happen here, so it's hard to say what the problem is. What makes you say that Python hates it? :) This does do exactly what you say it apparently does--it reads successively from raw_input(), until a blank line or an EOF is entered, appending the input to an already existing string (msg). What do you expect it to do, that it's not doing? Note that, if I were coding this, I'd do it a bit differently, probably like... body = [] while 1: try: line = raw_input() except EOFError: break if not line: break body.append(line) msg = msg + string.join(body, '\n') As it exists in your code, there's no newline separating the "lines" read in from raw_input(), those should be added manually (either with string concatenation, as the original does, or by using string.join() as I do). Jeff Shannon Technician/Programmer Credit International From sdm7g at Virginia.EDU Mon Dec 3 20:44:29 2001 From: sdm7g at Virginia.EDU (Steven Majewski) Date: Mon, 3 Dec 2001 20:44:29 -0500 (EST) Subject: Draft PEP: string interpolation with backquotes In-Reply-To: <9uh67a$eoe$1@peabody.colorado.edu> Message-ID: On Mon, 3 Dec 2001, Fernando [ISO-8859-1] P?rez wrote: > What's wrong in this group every time someone suggests something that > even remotely resembles perl there's a fanatic response to it? Cool > down. I've used perl a lot, and am sick of it. I don't want python to > become perl, but I simply keep an open mind to situations where in > real, everyday work, I find it lacking. I don't think it's specifically "Perlphobia" . I think most pythoneers have learned to be conservative about syntax changes, which means you not only have to make a good argument for your feature, but you have to make a good argument that the feature NEEDS to be implemented by a change in syntax, and not implemented by a function (python or built-in) or a new class or builtin-object. > And I think the beauty of an open language is precisely that these > discussions can be had. But obviously if everytime someone suggests > something different (even if they are wrong) your response is to tell > them 'if you don't like it get out of here', progress isn't exactly > going to be very fast... You've made a pretty convincing argument about why it's a handy feature, but I haven't heard an argument for why it requires a new syntax (or new sematics for an old syntax). I would say that Python is not very 'syntactically open' -- certainly not in the way that Lisp or Forth is. -- Steve Majewski From gry at ll.mit.edu Thu Dec 13 17:28:33 2001 From: gry at ll.mit.edu (george young) Date: Thu, 13 Dec 2001 17:28:33 -0500 Subject: Model View Presenter GUI pattern? Message-ID: <20011213172833.0bfac3c7.gry@ll.mit.edu> Is anyone using the Model View Presenter GUI framework/pattern in python? I've been reading bits about it, and it sounds quite attractive. I've started trying to write a simple MVP module as a basis for an application. The hardest part is dealing with the overall structure: my app deals with a big structured data object and it's hard to picture how the parallel trees of models, views, and presenters all get instantiated and linked. Below I include my baby mvp.py file (using pygtk) for comment/discussion. Any comments of design/implementation/style etc. are very welcome. A few mvp references for the curious: http://www.object-arts.com/Lib/EducationCentre4/htm/modelviewpresenter.htm http://www.object-arts.com/EducationCentre/Overviews/ModelViewPresenter.htm http://www-106.ibm.com/developerworks/library/mvp.html import gtk class Topw(gtk.GtkWindow): def __init__(self): gtk.GtkWindow.__init__(self, gtk.WINDOW_TOPLEVEL) self.connect("destroy", gtk.mainquit) self.connect("delete_event", gtk.mainquit) class Observable: def __init__(self): self.observers = [] def register(self, o): self.observers.append(o) def un_register(self, o): self.observers.remove(o) def notify(self): for o in self.observers: o.update(self) class Observer: '''Just for clarity, not really needed.''' def update(self): pass class Model(Observable): def __init__(self, value=None): Observable.__init__(self) self.set(value) def get(self): return self._value def set(self, v): self._value = v def str(self): return `self.get()` class IntegerModel(Model): def __init__(self, i): Model.__init__(self, i) def set(self, i): self._value = int(i) class IntegerView(gtk.GtkEntry, Observer): def __init__(self): gtk.GtkEntry.__init__(self) def set(self, x): self.set_text(`x`) def clear(self): self.delete_text(0, -1) def update(self, mod): self.set(mod.get()) class IntegerPresenter: def __init__(self, i=None): self.view = IntegerView() self.model = IntegerModel(i) self.model.register(self.view) self.view.connect('changed', self.changed) def changed(self, v): try: self.model.set(int(v.get_text())) except ValueError: gtk.gdk_beep() if __name__ == '__main__': pres = IntegerPresenter(33) topw = Topw() topw.add(pres.view) topw.show_all() gtk.mainloop() -- I cannot think why the whole bed of the ocean is not one solid mass of oysters, so prolific they seem. Ah, I am wandering! Strange how the brain controls the brain! -- Sherlock Holmes in "The Dying Detective" From nikolai at micon.no Tue Dec 4 19:19:25 2001 From: nikolai at micon.no (Nikolai Kirsebom) Date: Wed, 5 Dec 2001 01:19:25 +0100 Subject: Database Access Framework Message-ID: I've made a small framework which may be used to write small programs accessing a database (ODBC). The system is written exclusively in Python, using wxPython for GUI and mxODBC for database access. The code is based on Robin Dunn's example demo for wxPython. If you are interested in having a look, two version may be found at http://www.micon.no/PythonPage.asp. Hopefully some may find it useful. I'm currently using it on a SQL server 2000 where the plug-in modules typically access dictionary definitions. I will be very happy for comments (+ve/-ve) and if anyone makes changes / additions to it, please let me know, and I'll update the code (and have it placed on my server). Good luck. Nikolai Kirsebom From syver-en+usenet at online.no Sun Dec 2 16:23:25 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 02 Dec 2001 22:23:25 +0100 Subject: Let's make Python really strict about indentation References: <3C087F11.4030706@post.harvard.edu> <3c0a697c$1@207.229.64.20> Message-ID: Andrew Koenig writes: > I am concerned about the possibility of the compiler rejecting > programs because of default editor behavior of which beginning > programmers cannot reasonably be expected to be aware. I got very confused a couple of times when starting programming python because of this. I changed my editor since then, so now it's okay, but it's a bit disturbing that code can look as if code is scoped one way in an editor when it's really scoped differently. It is like having C++ code that looked like this in one editor: if (something) { doStuff(); doStuff2(); } and like this in another if (something) doStuff(); doStuff2(); Compile errors if there are tabs in a file would be fine by me, but I suspect some people would be upset. -- Vennlig hilsen Syver Enstad From dyoo at hkn.eecs.berkeley.edu Wed Dec 26 00:32:57 2001 From: dyoo at hkn.eecs.berkeley.edu (Daniel Yoo) Date: Wed, 26 Dec 2001 05:32:57 +0000 (UTC) Subject: [BEGINNER] meta-functions References: Message-ID: Igor Mozetic wrote: : A simple question from a newbie, sorry. : I have functions defined normally, def fname(arg1,arg2): : and also represented as tuples (fname, arg1, arg2), : to use them by apply(fname, (arg1,arg2)) - no problem. : How do I make a comparison: fname == 'string' ? It sounds like you're doing some data-directed programming. Out of curiosity, would it be ok to store the function's name within your tuple as well? For example: ### def square(x): return x*x def sqrt(x): return x**(.5) def getFunction(name): functions = [("square", square), ## A dictionary may be a ("sqrt", sqrt)] ## better data structure ## for this. for n, f in functions: if n == name: return f return None while 1: f_name = raw_input("Enter function name:") f = getFunction(f_name) if not f: break print f(42) ### This approach doesn't take too much advantage of many Python-specific features. Hope this helps! From ahimsa at inext.co.za Sun Dec 30 06:51:34 2001 From: ahimsa at inext.co.za (Ahimsa Consulting) Date: Sun, 30 Dec 2001 13:51:34 +0200 Subject: Is learning Python "extraordinary"? References: Message-ID: <011b01c1912b$ce478760$0100000a@aeon2k> Well I can tell you that as a 37 year old with no computer/programming experience beyond the occasional tweak of a Win98 machine, teaching myself both the Linux os and Python is a significant challenge, and I would feel extraordinary if I were able to call myself proficient in programming. It might take me a while, but I intend to get there ... certainly way beyond the "Hello, World!". I agree with earlier comments though - esp with Sheila: the context of your accomplishment is the important thing. Without context, there is no foreground, so I would suggest emphasise the context out of which your own personal accomplishments have grown. Good luck with your applications. From sdm7g at Virginia.EDU Mon Dec 3 21:03:29 2001 From: sdm7g at Virginia.EDU (Steven Majewski) Date: Mon, 3 Dec 2001 21:03:29 -0500 (EST) Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) In-Reply-To: Message-ID: On Mon, 3 Dec 2001, Steve Lamb wrote: > On 3 Dec 2001 23:17:22 GMT, Quinn Dunkan > wrote: > > Not for me it doesn't, when I use proportional fonts. > > Anyone who uses proportional fonts for programming gets what they deserve Less eye strain ? Fewer headaches ? > because neither spaces nor tabs work. -- sdm From client.services at esbisc.easymax.com Sun Dec 9 04:44:15 2001 From: client.services at esbisc.easymax.com (client.services at esbisc.easymax.com) Date: Sun, 09 Dec 2001 09:44:15 GMT Subject: < < < FREE Online Seminar Unleash the Power of the Internet > > > Message-ID: <698DDAE0.760319C5.44eca61908c789143ae2823e7f2b0cc0@esbisc.easymax.com> Attention all serious Internet professionals... Here's your chance to learn how to improve your Small Business website with Easymax Small Business Internet Software Consulting! Keith Gallaher, expert programmer and Internet guru who's worked with CompuServe, AOL, and Sears, other smaller Internet merchants is presenting a twenty-minute intensive FREE Online Seminar. If you are an online merchant with six months or six years proven Internet experience, click on the link below! Our firm specializes in helping you get to the next level of Internet success. Click the link below for more information and to REGISTER. This Online Seminar is LIMITED to the First 25 Registrants, so don't delay! Click here http://esbisc.easymax.com/seminar.cgi?2,1,2 to learn more! Just copy and paste http://esbisc.easymax.com/seminar.cgi?2,1,2 in to your browser. Best wishes, P.S. This message is ONLY being sent to folks who have requested information. This is not Multi-level, Direct Sales, or any sales program. We offer proven success Internet technology that will help you get to the top of Internet success! Small Business Internet Software Consulting From hrvoje.tercek at caatoosee.hr Thu Dec 13 09:18:56 2001 From: hrvoje.tercek at caatoosee.hr (=?iso-8859-2?Q?Hrvoje_Ter=E8ek?=) Date: Thu, 13 Dec 2001 15:18:56 +0100 Subject: Read and Print ASCII >128 as is in cp437 on DOT-MATRIX printer or file regardless local setting Message-ID: <002f01c183e1$1a006bc0$6f00000a@activmedia.hr> Pleas could You help me about my problem? Summary: Read and Print ASCII >128 as is in cp437 regardless local setting ! System: Win2000, Linux ; locals-cp1250 Status: URGENT Content: I have to wrote report generator. For this purpose must be able to read and print ASCII characters > 128. Not to mention that I need characters from US ASCII found in Pithon21/Lib/encodings/cp437.py. I'd tried all encode, decode, codecs trick I have found on Internet but always the same. ' ASCII is bigger then 128 !!!'. Also I have print template file written with Notepad (witch can exactly reproduce characters such ALT+218) witch I read, manipulate end print from python. I couldn't trick python to not encode read characters such ALT+218 in same utf-8 three characters for any ASCII > 128. Yes it must be something with locale settings or else but isn't it some easy-normal way. Thanks, at front Yours Python fan, Hrvoje Tercek -------------- next part -------------- An HTML attachment was scrubbed... URL: From horatio at qpsf.edu.au Thu Dec 13 23:23:33 2001 From: horatio at qpsf.edu.au (Horatio Davis) Date: Fri, 14 Dec 2001 14:23:33 +1000 (EST) Subject: Scientific Libraries in Python In-Reply-To: <375ad208.0112062048.1e9930c@posting.google.com> Message-ID: On 6 Dec 2001, Prabhu Ramachandran wrote: > Umm, I'm not sure I understand. Did you really mean that MayaVi would > be able to eat the Mathematica and IDL graphics for breakfast? I > haven't used them much to actually comment on that but if they do > choose to use MayaVi for their visualization then it isn't really > possible to eat them for breakfast is it? Hmm. Almost. What makes MayaVi interesting to me is the combination of VTK and Python to add value to the VTK. Mathematica and IDL may be able to use VTK, but they won't be switching to Python to build on it. The best they could hypothetically hope for is doing MayaVi-type stuff implemented in their own languages, with VTK as the visualization library. Which license MayaVi has is irrelevant to whether this can happen. Now posit some weird parallel universe where Mathematica tries to incorporate Python and the VTK into itself (no, I can't think of a reason for them to, either). In this _particular_ niche, MayaVi is far ahead of any proprietary software, and will handily out-compete any such hypothetical monstrosity. That's what I mean by "eaten for breakfast." As for the question of whether MayaVi's versatility and graphical quality would _in_general_ beat Mathematica or IDL, I haven't played with either. much. Matlab, now, that I could give you a comparison with. Ask me again after I finally get libVtkPython*.so to link correctly on Linux. > Anyway thanks for the compliments. I read this obscure paper somewhere on the Net once that reckoned ego satisfaction was the major incentive for open-source hacking. (: It's probably about time this thread moved off the general Python list to some place more specialized. As soon as the scipy.org people unstick their list server and let me successfully subscribe (hint, hint) I'll try there. Cheers, Horatio From ws-news at gmx.at Tue Dec 18 06:36:42 2001 From: ws-news at gmx.at (Werner Schiendl) Date: Tue, 18 Dec 2001 12:36:42 +0100 Subject: How to print e.g. 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE regardless locale settings ??? References: Message-ID: <3c1f2b16$1@brateggebdc5.br-automation.co.at> Hi, you must know the locale settings of your printer to print non-ASCII (i. e. ord > 127) characters on your printer (unless you have a unicode capable printer, which I do now know of one...). Use the unicode object's encode() method with the proper encoding for the printer to get the right, encoded string. When you send this to your printer, you'll get the desired result. hth Werner "Hrvoje Ter?ek" wrote in message news:mailman.1008669442.10799.python-list at python.org... There is the problem: You have two attachments. Box.gif, box.txt. As you suppose the image is capture screen how file should appear and how it should look like on my dot-matrix printer, send from python !!! Box.txt is written in Notepad because there is only editor which accept my ALT+ commands exactly as I need. So task would be: If box.txt appeared exactly as box.gif look like, try load box.txt and push to printer all from python. Doesn't work at my place :((( Rephrase the problem ... in Python21\lib\encode there is the file cp437.py. Obviously used at installation and locale settings. Q: How to print (standard output or dot matrix printer) e.g. 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE regardless locale settings??? I have Win2000, Python 2.1 and locale setting set to cp1250... Thanks at front Hrvoje Tercek -------------- next part -------------- An HTML attachment was scrubbed... URL: From MarkH at ActiveState.com Sun Dec 2 19:31:24 2001 From: MarkH at ActiveState.com (Mark Hammond) Date: Mon, 03 Dec 2001 00:31:24 GMT Subject: Using COM and .pyc References: Message-ID: <3C0AC861.7050105@ActiveState.com> Bear B wrote: > I have problems doing some changes in a .py - file that contains source to > two com-classes under python-win. Do I have to register this com-classes > after every time I have saved my changes, or is it just necessary to > register it once? Is it not true, that my old .pyc - file should be replaced > whith a new .pyc - file after my changes have been made? > > I have tried SO MANY ways to make things work, but all a get is exceptions > and errors. Can someone please give me some advises how to make this work?! I am guessing that the consumer of the program is still running and uding the old object. After changing the Python code, you must ensure that any programs using this Python code are also restarted. Mark. From usenet at thinkspot.net Sat Dec 29 20:24:19 2001 From: usenet at thinkspot.net (Sheila King) Date: Sat, 29 Dec 2001 17:24:19 -0800 Subject: Is learning Python "extraordinary"? References: <3C2E5706.5880983E@engcorp.com> Message-ID: On Sat, 29 Dec 2001 18:51:34 -0500, Peter Hansen wrote in comp.lang.python in article <3C2E5706.5880983E at engcorp.com>: > I'm afraid not. All the developers I've hired in the last > two years took about a week to become productive with Python > after being exposed to it for the first time. Of course, > maybe they're *all* extraordinary! And these developers you hired were high school students applying for admission to college? I think that you're answering with the wrong comparison group as your background sample. Certainly I'd expect any professional developer to be able to pick up Python in a week. But, among the set of all students applying for university admission, how many of them have taught themselves Python? I think this is an important distinction. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org/ From aleax at aleax.it Sat Dec 8 17:51:49 2001 From: aleax at aleax.it (Alex Martelli) Date: Sat, 08 Dec 2001 22:51:49 GMT Subject: Class equivalence? References: Message-ID: <9QwQ7.4649$NB6.127259@news2.tin.it> Bruce Eckel wrote: >>>> class Flower: pass >>>> class Daisy(Flower): pass >>>> Daisy is Flower > 0 > > What am I missing here? That Daisy isn't Flower? They differ e.g. in their __name__ attribute. So how could they be the same thing? Alex From dalke at dalkescientific.com Sun Dec 9 00:21:33 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Sat, 8 Dec 2001 22:21:33 -0700 Subject: Does 'super' exist? References: Message-ID: <9uusq7$3t4$1@slb2.atl.mindspring.net> Bruce Eckel: >It's a little hard to tell, does 'super' exist in 2.2? If so, where >might I find the syntax? Thanks. Python has multiple base classes so there isn't a 'super'. Inside an insteance method, to get the parents of a given class, as a tuple, in the order of occurance used in the class definition, use self.__class__.__bases__ Andrew dalke at dalkescientific.com From jkraska at san.rr.com Sat Dec 15 12:28:08 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 15 Dec 2001 17:28:08 GMT Subject: "Pythonj Fatal error: UNREF invalid object References: <38ol1uoj0nufo0tu50kvhq112p4llc6hqv@4ax.com> Message-ID: >> Regarding the subject line, what semantics causes the above fatal >> error to occur, generally? > >Looks like[1] it happens when internal gc structures get messed up. >Are you implementing a container that participates in gc? Have you >got everything right? > >It also might be caused by random memory scribbling, I guess. >[1] As in I did > $ cd /path/to/python/src > $ grep UNREF -r . > and looked at what I found. Was this beyond you? As a matter of fact, not only was it not beyond me, I did so and read the code prior to posting the message. While "random memory scrambling" and "gc messing up" are obvious candidates, I wouldn't have thought I would have to type out that I already considered these things and was wondering if any variety of standard situations arise up with extension writers and screwing up particular data structures. This might help me get closer to the problem, because as of right now, Python is crashing in a spot unrelated to my code and I don't have Purify. The error traces back to the eval loop, so this isn't an easy problem to diagnose. Is anyone using any free/open source memory diagnosers for Windows 2000 with Python? C// From news at davidglasser.net Fri Dec 28 12:49:03 2001 From: news at davidglasser.net (David Glasser) Date: Fri, 28 Dec 2001 12:49:03 -0500 Subject: REPOST: Re: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <1008303437.718558@cswreg.cos.agilent.com> <9vbvi5$cm0$1@peabody.colorado.edu> <7xhequjsgl.fsf@ruckus.brouhaha.com> <9vc581$g0h$1@peabody.colorado.edu> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> <7xlmfxvbx7.fsf@ruckus.brouhaha.com> <3dbsgt7f0e.fsf@ute.mems-exchange.org> <7xheqkr05q.fsf@ruckus.brouhaha.com> <7xy9jwozuo.fsf@ruckus.brouhaha.com> Message-ID: <1$--$$_----__--%$$@news.noc.cabal.int> Paul Rubin wrote: > I haven't used it in my own code. Some of the Red Hat configuration > scripts use it. I found that out when I installed Python 2.1 on my > Red Hat system, replacing Python 1.5, and the installation scripts > broke because they could no longer import "rand". Grr, growl, gnash. I'm just sort of curious -- why do *configuration scripts* need to get random numbers? Does Red Hat only have a 50% chance of installing certain packages? -- David Glasser news at davidglasser.net http://www.davidglasser.net/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: news at davidglasser.net (David Glasser) Newsgroups: comp.lang.python Subject: cmsg cancel <1f54m7x.dx3fy7122k534N%news at davidglasser.net> Control: cancel <1f54m7x.dx3fy7122k534N%news at davidglasser.net> Date: Mon, 31 Dec 2001 02:17:56 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775187 27193 211.57.49.2 (31 Dec 2001 05:06:27 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:06:27 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From peter at engcorp.com Wed Dec 26 14:48:53 2001 From: peter at engcorp.com (Peter Hansen) Date: Wed, 26 Dec 2001 14:48:53 -0500 Subject: REPOST: Re: set decimal place References: <3c291037.4684696@news.tm.net.my> <3C292938.ED322C60@bellatlantic.net> <184fbd02.0112260109.4392423@posting.google.com> Message-ID: <1$--$$-$$$$%%-$$-$@news.noc.cabal.int> Goh S H wrote: > David Lees wrote in > message news:<3C292938.ED322C60 at bellatlantic.net>... > > kwsiew at tm.net.my wrote: > > > > > > is there a way(or any function) to set decimal place in python(to any > > > decimal place I want) > > > example : > > > 2)10.0/3 = 3.3333333333333335 (I want 3.3333 - 4 decimal place) > > > >>> print '%8.1f' % (17.0/4) > > 4.3 > > >>> print '%8.4f' % (10.0/4) > > 2.5000 > > OR use built-in function round if you're expecting float instead of string >>> 10.0/3 3.3333333333333335 >>> round(10.0/3, 4) 3.3332999999999999 ^^^^^^^ This doesn't really solve the OP's problem. >>> print round(10.0/3, 4) 3.3333 >>> print "%.4f" % (10.0/3) 3.3333 The concept of "having 4 decimal places" is meaningless with floating point representations until you actually display the value as a formatted string. -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Peter Hansen Newsgroups: comp.lang.python Subject: cmsg cancel <3C2A29A5.8E9FB5BE at engcorp.com> Control: cancel <3C2A29A5.8E9FB5BE at engcorp.com> Date: Mon, 31 Dec 2001 02:55:50 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009776115 27193 211.57.49.2 (31 Dec 2001 05:21:55 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:21:55 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From peter at engcorp.com Sun Dec 30 00:59:41 2001 From: peter at engcorp.com (Peter Hansen) Date: Sun, 30 Dec 2001 00:59:41 -0500 Subject: REPOST: Re: Is learning Python "extraordinary"? References: <3C2E5706.5880983E@engcorp.com> Message-ID: <1$--$$_----__$_$-$@news.noc.cabal.int> Sheila King wrote: > > On Sat, 29 Dec 2001 18:51:34 -0500, Peter Hansen wrote > in comp.lang.python in article <3C2E5706.5880983E at engcorp.com>: > > > I'm afraid not. All the developers I've hired in the last > > two years took about a week to become productive with Python > > after being exposed to it for the first time. Of course, > > maybe they're *all* extraordinary! > > And these developers you hired were high school students applying for > admission to college? Uh, no actually. :-) I think my perspective is somewhat tainted from being one of the freaks (back then) who was rather self-taught. By the end of high school I knew BASIC, C, APL, 6502 assembly, and others. By *no* means exceptional compared to many of the real wizards of the industry, but I think it means it didn't occur to me that high school students of today might not already know several programming languages. At least those applying for MIT. :) It is still my opinion that a bright person who has learned several computer languages can learn Python enough to start working on non-trivial tasks with not much more than a week of learning, but that opinion is based solely on observation of a dozen perhaps quite bright people doing just that. -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Peter Hansen Newsgroups: comp.lang.python Subject: cmsg cancel <3C2EAD4D.77564075 at engcorp.com> Control: cancel <3C2EAD4D.77564075 at engcorp.com> Date: Mon, 31 Dec 2001 03:43:09 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774368 27193 211.57.49.2 (31 Dec 2001 04:52:48 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:52:48 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From paul at boddie.net Thu Dec 20 06:00:47 2001 From: paul at boddie.net (Paul Boddie) Date: 20 Dec 2001 03:00:47 -0800 Subject: /usr/bin/env: python: No such file or directory References: <9vivft$593$1@peabody.colorado.edu> <171220010818339518%jwbaxter@spamcop.net> <9vnvue$m5d$1@peabody.colorado.edu> Message-ID: <23891c90.0112200300.6c2a13cb@posting.google.com> quinn at groat.ugcs.caltech.edu (Quinn Dunkan) wrote in message news:... > > I don't know how much time I've wasted fighting with too-clever install > scripts, broken Makefile-mazes that want to rebuild the world every time, GNU > configure picking broken settings, setup.py deciding to start using > 'gcc -shared' to make shared objects on SunOS when only 'gcc -G' works and > what do you edit to change that, and programs which generate perl scripts > which generate imakefiles which generate makefiles which generate shell > scripts which sed out a bunch of magic tokens in configuration files, which > then breaks, etc. etc. when all I really needed was 'cc -c *.c -o program; > cp program /usr/local/bin'. This kind of reminds me of all those projects which use automake instead of autoconf, or at least I assume they use automake, because instead of pertinent questions being asked in the configure script, you get hundreds of checks being run for no obviously good reason: Checking for maiden name of aunt... Jenkins >From what I've seen of distutils, it does seem to do a reasonably good job, and it certainly seems a lot more workable than the old Makefile.pre.in/Setup thing (which, in turn, at least managed to do the right thing most of the time, unlike certain parts of the KOffice build process), but I haven't actually attempted to employ it in anything I've written. Indeed, that's probably because I mostly stay clear of writing C-level extensions. Perhaps the issue here is how to get distutils to scale down so that it's trivial to use - even for pure Python projects. Having written the above, I now anticipate an example of distutils' triviality... ;-) Paul From erik at naggum.net Sat Dec 22 09:07:35 2001 From: erik at naggum.net (Erik Naggum) Date: Sat, 22 Dec 2001 14:07:35 GMT Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic References: <3218013921984060@naggum.net> Message-ID: <3218018853244911@naggum.net> * Erik Naggum > Look, Tengwar is more widely used than Scheme these days. * IsraelRT | And an infamous Common Lisp user gives popularity as a reason to | choose a language? No. That would be a rather spectacularly invalid conclusion. Since you obviously have no idea what Tengwar is, suffice to say that a relatively small group of people have adopted this artificial writing system from J.R.R.Tolkien in order to enjoy communication within the secluded world of ardent fans. Some therefore consider it a symptom of a cult. It was the likeness of ardent fans in small number who keep the rest of the world out through a measure of intended obscurity that prompted the comparison, not the mere quantity of weirdos. Please confirm that you have been enlightened by responding with another hostile grunt. | Wonders will never cease.... That easily happens when you abandon rationality. Enjoy your wonders. /// -- The past is not more important than the future, despite what your culture has taught you. Your future observations, conclusions, and beliefs are more important to you than those in your past ever will be. The world is changing so fast the balance between the past and the future has shifted. From sholden at holdenweb.com Mon Dec 31 13:00:22 2001 From: sholden at holdenweb.com (Steve Holden) Date: Mon, 31 Dec 2001 13:00:22 -0500 Subject: How to solve a problem? References: Message-ID: "A" wrote in message news:mailman.1009388558.27442.python-list at python.org... > Hi, > My program downloads regularly some files and it takes some > time so I need to shorten this downloading time. As most of these > files are the same, many times when the program downloads these > files, I would like to download only those that are not the same or > are newer. What is the best solution? > Many thanks for help. > Ladislav > Try taking a look at the ftpmirror.py program, normally to be found in the tools subdirectory of your Python distribution. This will show you how to mirror things by selective download. regards Steve -- http://www.holdenweb.com/ From aahz at panix.com Thu Dec 20 15:06:25 2001 From: aahz at panix.com (Aahz Maruch) Date: 20 Dec 2001 12:06:25 -0800 Subject: lost interest? References: <20011208001123.A5989@casa.parque> <4bLT7.32$aS.11733@news010.worldonline.dk> Message-ID: <9vtgc1$de5$1@panix3.panix.com> [I haven't been on c.l.py for several weeks, so what I say may be addressed elsewhere.] In article , Suchandra Thapa wrote: >maxm wrote: >> >>Oh but that wasn't what I meant. It was more about the fact that the core >>developers who can put some weight behind a package system are not involved >>in it. They are happier doing core language features like object type >>unifications. (Which I also look forward to ;-) ) > > Yes, I suppose that's true although I thought that there some of the >core developers working on distutils that might have been interested >in something like this. >From some threads on python-dev, even distutils is having trouble finding developer support these days. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 11 days and counting From TomH at optiscan.com Thu Dec 20 18:06:12 2001 From: TomH at optiscan.com (Tom Harris) Date: Fri, 21 Dec 2001 10:06:12 +1100 Subject: what is the equivalent of LAST_INSERT_ID() in mx.ODBC ? Message-ID: I have seen this done by having an extra column in the table that is defaulted to the current time, then querying the table (after inserting a new row) for the row with the latest time. Obviously this will fail for multiple users, and probably in other cases, but it will work in certain situations. Alternatively if you can guarantee that your ID increases with each insertion, you can just return the row with the highest ID, eg SELECT TOP 1 * FROM tbl ORDER BY id DESC Tom Harris, Software Engineer Optiscan Imaging, 15-17 Normanby Rd, Notting Hill, Melbourne, Vic 3168, Australia email tomh at optiscan.com ph +61 3 9538 3333 fax +61 3 9562 7742 This email may contain confidential information. If you have received this email in error, please delete it immediately,and inform us of the mistake by return email. Any form of reproduction, or further dissemination of this email is strictly prohibited. Also, please note that opinions expressed in this email are those of the author, and are not necessarily those of Optiscan Pty Ltd. -----Original Message----- From: Max M [mailto:maxm at normik.dk] Sent: Friday, 21 December 2001 2:44 To: python-list at python.org Subject: what is the equivalent of LAST_INSERT_ID() in mx.ODBC ? I am trying out mx.ODBC in windows (connecting to an Acces DB), and I am doing an insert where the key is auto-generated by access. Now how do I get the key back? I have tried "c.execute('SELECT LAST_INSERT_ID()')" but gets a: ProgrammingError: ('37000', -3102, "[Microsoft][ODBC Microsoft Access Driver] Undefined function 'last_insert_id' in expression.", 4523) So I guess that is not the right way. Has anybody got an idea? Is it an odbc, mx.ODBC or simply an access problem to find the right documentation?? I have searched the web, the db.api, newgroups etc. but nothing is showing up. regards Max M From jcromwell at ciena.com Tue Dec 4 14:57:08 2001 From: jcromwell at ciena.com (Cromwell, Jeremy) Date: Tue, 4 Dec 2001 11:57:08 -0800 Subject: more fun with PEP 276 Message-ID: James, You left out the best part! By adding a little snippet to all the div routines, you can solve the original problem (having an index that spans a list.) try: other = len(other) except: pass Now you can write: for i in span/table.rowcount: for j in span/table.colcount: print table.value(i,j) Thanks to your hard work, we can play with this implementation and come up with some new ideas (maybe we'll even come up with a good one!) For example by adding different operators: __lshift__, __rrshift__ = __div__, __rdiv__ __rshift__, __rlshift__ = __floordiv__, __rfloordiv__ and setting: __ = span # in the spirit of ... then >>> list(3>>__>>9) [4, 5, 6, 7, 8, 9] >>> list(3>>__<<9) [4, 5, 6, 7, 8] >>> list(3<<__<<9) [3, 4, 5, 6, 7, 8] >>> list(3<<__>>9) [3, 4, 5, 6, 7, 8, 9] which allows for i in __<< table.rowcount: for j in __<< table.colcount: print table.value(i,j) Jeremy Cromwell ############################################# "Heaven goes by favor, If it went by merit, you would stay out and your dog would go in." --Mark Twain -----Original Message----- From: James_Althoff at i2.com [mailto:James_Althoff at i2.com] Sent: Monday, December 03, 2001 4:04 PM To: python-list at python.org Subject: more fun with PEP 276 It is readily apparent from the PEP 276 thread that while the author has tried his best to do the tedious, dirty work of showing the modest benefits of the modest proposal actually contained in PEP 276 many of those contributing to the thread, OTOH, have been having quite a jolly good time offering suggestions for wholesale changes in the area of for-loops, integer sequences, lists, iterators, etc. Is there any compelling reason why everyone else should be having all the fun? I think not. And so, without further adieu, here comes "yet another proposal for changing the heck out of for-loops". The thinking goes as follows. Let's start with Greg Ewing's recent suggestion of writing for-loops as: for -5 <= i <= 5: print i The nice thing about the above is the apparent clarity of intent. And the fact that all combinations of open and closed intervals are handled nicely. On the down side we observe that this construct requires new syntax, that it doesn't work outside of the context of a for-loop (in fact, it is a relational expression outside the context of a for-loop), and that there is no apparent mechanism for having a step size other than 1 (or -1). Now I, for one, happen to like the "for i in iterator:" construct (with emphasis on the *in*). Also, others have seemed to show fondness for the Haskell-like style of: [0,1 ... 10] (using the suggested existing Python ellipsis notation, i.e., "..."). So what if we turn things around a little and say: for i in -5 <= ... <= 5: print i One little hitch is that Python only supports the ellipsis literal, "...", in slice notation. So this would require syntax changes. We really prefer *not* to ask for such, right? So for now, what if we just used a builtin object, let's call it "span" (spam's more-respected cousin ;-). span represents something that knows how to create an iterator for a "span of numbers" between a given one and another. So we would now write: for i in -5 <= span <= 5: print i We can make span an instance of a class and then note that "<=", ">=", etc. are operators that we can implement using the magic methods __le__, __ge__, etc. Unfortunately, this won't work very well because of a couple of things. The comparison magic methods don't have left and right versions the way arithmetic operators do. So we can't really distinguish increasing sequences from decreasing sequences like we would want. Worse is that -5 <= span <= 5 turns into "(-5 <= span) and (span <= 5)" instead of "(-5 <= span) <= 5)". And we have no control over this. Finally, "-5 <= span <= 5" when used in an "if" statement should do something boolean and not something iterator-ish to be consistent with relational expressions in general. So creating a class that redefines the relational operators doesn't work out quite as well as one would hope in this situation. But, if we were willing to be somewhat flexible and non-perfectionistic, we could try a slight variation on all of this. Given that some have suggested using [xxx], [xxx), (xxx] as ways of indicating various combinations of open and closed intervals (to the dismay of others), the following might not be such a traumatic stretch. Suppose we use "/" to indicate an open interval and "//" to indicate a closed interval as in, for example: -3 // ... // 3 # closed-closed: -3, -2, -1, 0, 1, 2, 3 -3 // ... / 3 # closed-open: -3, -2, -1, 0, 1, 2 -3 / ... // 3 # open-closed: -2, -1, 0, 1, 2, 3 -3 / ... / 3 # open-open: -2, -1, 0, 1, 2 etc. Let's continue using "span", though, instead of "..." so that we don't require syntax changes. Note that "//" and "/" are operators with corresponding magic methods (in Python 2.2). Further note that they each have left and right versions. We now create a class, IteratorBounds that holds the start value, stop value, step value, and "open/closed" status for the left and right sides of an enumeration of numbers. We make a default instance of IteratorBounds named "span" with the following default values: stop == 0 start == 0 step == 1 left == 'closed' right == 'closed' Using the example implementation included at the end of this message, we can write things like: Python 2.2b1 (#25, Oct 19 2001, 11:44:52) [MSC 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> >>> for i in -5 // span // 5: # closed-closed ... print i, ... -5 -4 -3 -2 -1 0 1 2 3 4 5 >>> >>> for i in -5 / span / 5: # open-open ... print i, ... -4 -3 -2 -1 0 1 2 3 4 >>> >>> for i in -5 // span / 5: # closed-open ... print i, ... -5 -4 -3 -2 -1 0 1 2 3 4 >>> >>> for i in -5 / span // 5: # open-closed ... print i, ... -4 -3 -2 -1 0 1 2 3 4 5 >>> We can handle descending intervals as well as ascending (specified by reversing the order) as in: >>> for i in 5 // span // -5: # descending closed-closed ... print i, ... 5 4 3 2 1 0 -1 -2 -3 -4 -5 >>> We can do shortcuts as in: >>> for i in span // 5: ... print i, ... 0 1 2 3 4 5 >>> >>> for i in -5 // span: ... print i, ... -5 -4 -3 -2 -1 0 >>> We can also change the step size (using several techniques) as in: >>> for i in 0 // span(step=2) // 20: ... print i, ... 0 2 4 6 8 10 12 14 16 18 20 >>> >>> for i in 0 // span.by(2) // 20: ... print i, ... 0 2 4 6 8 10 12 14 16 18 20 >>> Returning to the motivating example of PEP 276, we can easily index structures as in: >>> mylist = [0,1,2,3,4,5,6,7,8,9] >>> >>> for i in span / len(mylist): ... print mylist[i], ... 0 1 2 3 4 5 6 7 8 9 >>> or for those that like to be more explicit: >>> for i in 0 // span / len(mylist): ... print mylist[i], ... 0 1 2 3 4 5 6 7 8 9 >>> Other indexing examples: >>> for i in len(mylist) / span // 0: # access in reverse order ... print mylist[i], ... 9 8 7 6 5 4 3 2 1 0 >>> >>> for i in len(mylist) / span: # reverse order short form ... print mylist[i], ... 9 8 7 6 5 4 3 2 1 0 >>> >>> for i in span(step=2) / len(mylist): # access every other item ... print mylist[i], ... 0 2 4 6 8 >>> >>> for i in span(step=3) / len(mylist): # every third item ... print mylist[i], ... 0 3 6 9 >>> But wait, there's more ... This mechanism works outside of for-loops equally well. >>> >>> list(0 // span // 9) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> >>> list(span // 9) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> >>> list(-5 // span // 5) [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5] >>> >>> list(-5 / span / 5) [-4, -3, -2, -1, 0, 1, 2, 3, 4] >>> >>> list(5 // span // -5) [5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5] >>> >>> list(5 / span / -5) [4, 3, 2, 1, 0, -1, -2, -3, -4] >>> >>> list(0 // span(step=2) // 20) [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20] >>> >>> list(20 / span(step=3) / 0) [17, 14, 11, 8, 5, 2] >>> >>> i = 3 >>> i in 0 // span // 5 1 >>> i in -5 // span // 0 0 >>> And, if you order now, we'll throw in: >>> >>> [1,2,3] + 10 // span // 15 + [21,22,23] [1, 2, 3, 10, 11, 12, 13, 14, 15, 21, 22, 23] >>> But wait, there's even *more*. >>> >>> list('a' // span // 'j') ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] >>> >>> list('a' // span(step=2) // 'z') ['a', 'c', 'e', 'g', 'i', 'k', 'm', 'o', 'q', 's', 'u', 'w', 'y'] >>> >>> list('z' // span // 'a') ['z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm', 'l', 'k', 'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a'] >>> The (claimed) advantages with this scheme include: - no syntax changes required (!!!) - handles all combinations of closed/open intervals - handles descending as well as ascending intervals - allows step size to be specified - reuses the "i in iterator" paradigm of existing for-loops - supports shortcuts for the common case of indexing from 0 to len-1 - works outside of for-loops ("in" statement, list & tuple functions) - no confusion with or overloading of list or tuple syntax - no list versus iterator confusion - is reasonably transparent (once you get used to it ;-) - is straightforward to implement On the down side: - not as immediately transparent as "-5 <= i <= 5" Anyway, another nice advantage is that you can take the example implementation below and play with it before finalizing your opinion (which I hope you will do :-). Note, the iterator in the example implementation uses a 2.2 generator, so you need 2.2. (Or you could implement a separate iterator class and try it in 2.1). Now, that *was* fun, wasn't it. Jim ==================================== from __future__ import generators import operator class IteratorBounds: stopOpDict = { (1,0):operator.__lt__, # step positive, rightside open (1,1):operator.__le__, # step positive, rightside closed (0,0):operator.__gt__, # step negative, leftside open (0,1):operator.__ge__ # step negative, leftside closed } def __init__(self,stop=0,start=0,step=1,left='closed',right='closed'): self.stop = stop self.start = start self.step = step self.left = left # 'closed' or 'open' self.right = right # 'closed' or 'open' def __call__(self,stop=0,start=0,step=1,left='closed',right='closed'): return IteratorBounds( stop=stop, start=start, step=step, left=left, right=right) def __iter__(self): start,stop = self.calcStartStop() if start is None: raise StopIteration return step = self.step if ((stop > start and step < 0) or (stop < start and step > 0)): step = -step i = start if self.left == 'open': i = self.calcNext(i,step) if i is None: raise StopIteration return stopOp = self.stopOpDict[(step >= 0),(self.right == 'closed')] while 1: if not stopOp(i,stop): break yield i i = self.calcNext(i,step) if i is None: break raise StopIteration def calcStartStop(self): start = self.start stop = self.stop if isinstance(start,str) and not isinstance(stop,str): try: stop = chr(stop) except: return None,None elif isinstance(stop,str) and not isinstance(start,str): try: start = chr(start) except: return None,None return start,stop def calcNext(self,obj,step): if isinstance(obj,str): try: return chr(ord(obj)+step) except: return return obj + step def __div__(self,other): '''Return an IteratorBounds that is open on the RHS at other''' result = IteratorBounds( stop=other, start=self.start, step=self.step, left=self.left, right='open') return result def __floordiv__(self,other): '''Return an IteratorBounds that is closed on the RHS at other''' result = IteratorBounds( stop=other, start=self.start, step=self.step, left=self.left, right='closed') return result def __rdiv__(self,other): '''Return an IteratorBounds that is open on the LHS at other''' result = IteratorBounds( stop=self.stop, start=other, step=self.step, left='open', right=self.right) return result def __rfloordiv__(self,other): '''Return an IteratorBounds that is closed on the LHS at other''' result = IteratorBounds( stop=self.stop, start=other, step=self.step, left='closed', right=self.right) return result def __pow__(self,other): '''Return an IteratorBounds with step set to other''' if not isinstance(other,int): raise TypeError result = IteratorBounds( stop=self.stop, start=self.start, step=other, left=self.left, right=self.right) return result def by(self,step): '''Return an IteratorBounds with step set to step''' if not isinstance(step,int): raise TypeError result = IteratorBounds( stop=self.stop, start=self.start, step = step, left = self.left, right = self.right) return result def __add__(self,other): '''Create a list on self and add to other''' if isinstance(other,list): return list(self) + other raise TypeError def __radd__(self,other): '''Create a list on self and add to other''' if isinstance(other,list): return other + list(self) raise TypeError span = IteratorBounds() # Default instance #$ Testing def test(testItem): result = list(eval(testItem[0])) == testItem[1] print testItem[0], ' passed:', result def runtests(): testList = [ ('-5 // span // 5', [-5,-4,-3,-2,-1,0,1,2,3,4,5]), ('-5 / span / 5', [-4,-3,-2,-1,0,1,2,3,4]), ('-5 // span / 5', [-5,-4,-3,-2,-1,0,1,2,3,4]), ('-5 / span // 5', [-4,-3,-2,-1,0,1,2,3,4,5]), ('5 // span // -5', [5,4,3,2,1,0,-1,-2,-3,-4,-5]), ('5 / span / -5', [4,3,2,1,0,-1,-2,-3,-4]), ('5 // span / -5', [5,4,3,2,1,0,-1,-2,-3,-4]), ('5 / span // -5', [4,3,2,1,0,-1,-2,-3,-4,-5]), ('-5 // span.by(2) // 5', [-5,-3,-1,1,3,5]), ('-5 // span(step=2) // 5', [-5,-3,-1,1,3,5]), ('-5 // span **2 // 5', [-5,-3,-1,1,3,5]), ('5 // span.by(-2) // -5', [5,3,1,-1,-3,-5]), ('5 // span(step=-2) // -5', [5,3,1,-1,-3,-5]), ('5 // span **-2 // -5', [5,3,1,-1,-3,-5]), ('span // 5', [0,1,2,3,4,5]), ('span / 5', [0,1,2,3,4]), ('-5 // span', [-5,-4,-3,-2,-1,0]), ('-5 / span', [-4,-3,-2,-1,0]), ("'a' // span // 'd'", ['a','b','c','d']), ("'a' / span / 'd'", ['b','c']), ("'z' // span // 'w'", ['z','y','x','w']), ("'z' / span / 'w'", ['y','x']), ("'a' // span.by(2) // 'j'", ['a','c','e','g','i']), ("'z' / span.by(2) / 'p'", ['x','v','t','r']) ] for testItem in testList: test(testItem) -- http://mail.python.org/mailman/listinfo/python-list From jkraska at san.rr.com Sat Dec 22 12:19:58 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 22 Dec 2001 17:19:58 GMT Subject: Book "python programming patterns". anybody read this?? References: Message-ID: >I havn't seen the book, but I have to wonder about the above. Over the 25 >or so years I've been programming, I've gradually shifted my priorities >from elegance, cleverness, and efficiency, to simplicity and ease of >understanding. "As a younger programmer, I prided myself in the number of lines of code I wrote. As an older programmer, I pride myself in the number of lines of code that I reduce." There is a certain intersection of the two geometries of your life, where elegance and cleverness overlap simplicity and comprehensibility. Or so I believe, and strive for. C// From maxm at normik.dk Thu Dec 20 10:43:58 2001 From: maxm at normik.dk (Max M) Date: Thu, 20 Dec 2001 16:43:58 +0100 Subject: what is the equivalent of LAST_INSERT_ID() in mx.ODBC ? Message-ID: <3c22072d$0$35602$edfadb0f@dspool01.news.tele.dk> I am trying out mx.ODBC in windows (connecting to an Acces DB), and I am doing an insert where the key is auto-generated by access. Now how do I get the key back? I have tried "c.execute('SELECT LAST_INSERT_ID()')" but gets a: ProgrammingError: ('37000', -3102, "[Microsoft][ODBC Microsoft Access Driver] Undefined function 'last_insert_id' in expression.", 4523) So I guess that is not the right way. Has anybody got an idea? Is it an odbc, mx.ODBC or simply an access problem to find the right documentation?? I have searched the web, the db.api, newgroups etc. but nothing is showing up. regards Max M From ykingma at accessforall.nl Fri Dec 7 15:45:08 2001 From: ykingma at accessforall.nl (Ype Kingma) Date: Fri, 07 Dec 2001 21:45:08 +0100 Subject: Jython with embedded Java References: <3C108B32.436B1999@geneva-link.ch> Message-ID: <3C112A41.85357E11@accessforall.nl> Boris, you wrote: > > Say I wanted to use Jython to program animations > in an SVG plugin through the Java API. > Is this possible ? How should I go about it ? > > BB You have better chances when asking this the jython-users list. I have no experience with SVG, but in general to use a Java API in jython: - put the .zip or .jar on the class path when invoking jython and then - import the API classes in your jython code. Eg. since classes.zip is already on the class path you can do: import java.lang.System as jsys jsys.out.println(""" Welcome to the wonderful world of Jython. """) print dir(jsys.out) print dir(jsys.out.__class__) Have fun, Ype From claird at starbase.neosoft.com Fri Dec 28 09:05:22 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 28 Dec 2001 08:05:22 -0600 Subject: REPOST: OT: Wine applicability (was: Python Popularity: Questions and Comments) References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9901.998345FB@earthlink.net> Message-ID: <7$--$$_----_-$%_$$@news.noc.cabal.int> In article , Alex Martelli wrote: . . . >I don't do much gaming, but I still have to use Windows (mostly in win4lin >under Linux) for a few needs (e.g., SOME durned webpages that I need won't >show correcty under any browser except Internet Explorer). Not to mention >that think3 is a mostly-Windows shop, too. > >Linux is my preferred platform for most tasks, except that my firewall/etc >machine runs OpenBSD (sometimes security is more important than richness >of features, support for strange hardware, and so on). . . . I'm a tiny surprised; I sincerely thought you were most comfortable with Windows for COM and ADO riches. Alex, do you have any sense of how well "SOME durned webpages ..." look when viewed with IE under Wine on Linux? Are you saying that they *are* acceptable through win4lin-plus-IE? -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: claird at starbase.neosoft.com (Cameron Laird) Newsgroups: comp.lang.python Subject: cmsg cancel <29D69352B05A5CDB.572DD1F16BBDAB9A.554D3155ECE12A85 at lp.airnews.net> Control: cancel <29D69352B05A5CDB.572DD1F16BBDAB9A.554D3155ECE12A85 at lp.airnews.net> Date: Mon, 31 Dec 2001 05:11:32 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775412 27193 211.57.49.2 (31 Dec 2001 05:10:12 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:10:12 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From com-nospam at ccraig.org Mon Dec 10 08:27:44 2001 From: com-nospam at ccraig.org (Christopher A. Craig) Date: 10 Dec 2001 08:27:44 -0500 Subject: strict python? In-Reply-To: References: Message-ID: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) writes: > I would really object to that. I use expressions > like self.func to refer to functions and to create function > lookups all the time. E.g. returning self.func so that > the it can be used later as a callback or some other function. I think you missed the point. The original point was not that Python should raise a warning when a function is referenced, but not called. It was, rather, that a warning should be raised when a function is referenced, but the reference is then ignored. i.e. "def foo(self): self.func" would raise a warning, but "def foo(self): return self.func" would not. -- Christopher A. Craig From grey at despair.dmiyu.org Tue Dec 4 10:33:27 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Tue, 04 Dec 2001 15:33:27 -0000 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <3C0BE492.5DACEA18@mega-nerd.com> <3C0C55A8.EAD03FD5@cosc.canterbury.ac.nz> <87ZO7.1377$eq3.87747655@news.incc.net> Message-ID: On Mon, 3 Dec 2001 21:28:53 -0800, Peoter Veliki wrote: > Anything you want to line up must be at the same indent level. In the > example below, however many tabs the first line has in front of it, each of > the other lines below must also have the same number of tabs and the use > spaces to finishing lining everything up. If you do this it will line up on > any editor. Uhhhh, no. I have my tabs set to 4, you have yours set to 8. There are three tabs and two spaces before each line. In my editor that is 15 spaces. Yours it will be 24. I would love to see your proof that 15=24, even for large values of 15. -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From sheershion at mailexpire.com Fri Dec 21 09:09:29 2001 From: sheershion at mailexpire.com (Robert Amesz) Date: Fri, 21 Dec 2001 14:09:29 -0000 Subject: Tar-like module? References: Message-ID: Scott Fenton wrote: > This may be an idiotic question, but is there a module > to read tar files in python? I googled around and > couldn't find anything, and the Python Std Library docs > didn't have anything. Any help would be nice. Wel, I've written such a module for my own use a few months ago, in pure Python. It can both read and write TAR-files, or streams, rather. I've used it to re-archive about a GB of data[1] without any hiccoughs[2], so any bugs will most likely be minor ones. (Of course, standard disclaimers ALWAYS apply.) If you want it you'd be welcome to it, but as I never expected to be used by anyone but myself there are a few caveats: 1 - There's no documentation, not even docstrings , so I really should whip up some very basic documentation first. Fortunately, there is a module, which I wrote for initial testing which at least has an example how to write .tgz files and read straight .tar files. 2 - It has been tested under Win98 _only_. There really isn't any platform dependent code in it as far as I know, but, well, untested is untrusted. 3 - Although I've used the module to read an write a lot of files my prime concern has been the integrity of the data, things like file modes and file ownership were not important to me and and therefore should not be trusted in that respect. 4 - The module has been conceived so data flows into it and out of it as streams, using only read() / write(). (This is to make it easier use (de)compression efficiently.) This does imply, however, that you can't get a list of files from the archive without reading the entire archive, and if you need just a single file you must read all files preceding it. For compressed TAR files this is not an issue, as the (de)compressor can't start in the middle of a stream anyway, but for other applications this might be very inefficient. Also, when writing, the size of each file must be known in advance. Robert Amesz -- [1] Making .zip archives into .tbz2 (tar.bz2) archives can free up a lot of space on your HD. [2] Every TAR file which was written by the write routines was verified by using the read routines and comparing SHA checksums with the original files. Also, I've used some standard archivers to do some spot checks, and those were happy with the re-archived files, too. From cmedcoff at home.com Thu Dec 13 17:30:15 2001 From: cmedcoff at home.com (Charles Medcoff) Date: 13 Dec 2001 14:30:15 -0800 Subject: elegent sql building References: <1a241b9d.0112120534.cea1fa4@posting.google.com> <1a241b9d.0112121450.7aa92a12@posting.google.com> Message-ID: <1a241b9d.0112131430.157f306f@posting.google.com> On second thought there are a couple of minor drawback to this. 1. Function parameter names must match the table column names - maybe good, maybe bad. 2. One is stuck with columns of all the same type - in this case strings - of course I did not indicate that I needed that flexiblity in my original problem statement. I still like the SQL trick though. With that in mind I had another crack at it that addresses my comments above. (Not quite as elegent syntactically as your solution :( ) This version uses your SQL trick and the "and or trick" to address my original problem. Thanks again. # original solution def buildSql(ids, engineTypes, transTypes): return "SELECT * FROM vehicle WHERE id in (%s) AND engineType IN (%s) AND transType IN (%s)" % \ (",".join(["'%s'" % (id) for id in ids]), ",".join(["'%s'" % (e ) for e in engineTypes]), ",".join(["'%s'" % (t ) for t in transTypes])) # solution 2 def buildSql2(vehicleIds, engineTypes, transTypes): return "SELECT * FROM vehicle WHERE 1=1 %s %s %s" % \ ( vehicleIds and "AND svehicleid IN (%s)" % ",".join(["'%s'" % (id) for id in vehicleIds]) or "", \ engineTypes and "AND ienginetype_id IN (%s)" % ",".join(["%s" % (e ) for e in engineTypes]) or "", \ transTypes and "AND itranstype_id IN (%s)" % ",".join(["%s" % (t ) for t in transTypes]) or "") def test(): print buildSql2(['vin1', 'vin2', 'vin3'], ['4cy', '6cy'], ['4sp', '5sp'] ) print buildSql2(['vin1', 'vin2', 'vin3'], [], ['4sp', '5sp'] ) print buildSql2(['vin1', 'vin2', 'vin3'], ['4cy', '6cy'], [] ) print buildSql2(['vin1', 'vin2', 'vin3'], [], [] ) if __name__ == "__main__": test() From fredrik at pythonware.com Sun Dec 30 12:36:04 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sun, 30 Dec 2001 17:36:04 GMT Subject: REPOST: Re: Zope Documentation (was RE: Python Popularity: Questions and Comments) References: <3C2E55A6.D873E301@engcorp.com> Message-ID: <9$--$$_----__%$-_$@news.noc.cabal.int> Bill Tate wrote: > "Xxxxxx is the world's first company dedicated to using the science > of experience strategy, design, and technology to create extraordinary > results for our clients." interestingly enough, a google search for the above phrase gave two very similar hits: Xxxxxx is the world's first company dedicated to using the science of experience strategy, design, and technology to create extraordinary results for our clients. Yyyyyy is the world's first company dedicated to using the science of experience strategy, management, and technologies to create extraordinary results for our clients. design or management, that's the question... ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Fredrik Lundh" Newsgroups: comp.lang.python Subject: cmsg cancel <8gIX7.7072$l93.1790214 at newsb.telia.net> Control: cancel <8gIX7.7072$l93.1790214 at newsb.telia.net> Date: Mon, 31 Dec 2001 02:49:52 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774161 27193 211.57.49.2 (31 Dec 2001 04:49:21 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:49:21 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jpt.d at rogers.com Sun Dec 30 22:12:14 2001 From: jpt.d at rogers.com (Jeffrey Drake) Date: Mon, 31 Dec 2001 03:12:14 GMT Subject: Tkinter gui for the winnt subst command References: <11f1fe5.0112300800.680cb872@posting.google.com> Message-ID: <3c2fd756.27109611@nntp> os.popen("subst z: c:\python22") that works very quickly, i don't know what your problem might be. On 30 Dec 2001 08:00:54 -0800, yuvale at radware.com (yuval) wrote: >I need to map and remap (cmd.exe subst ...) certain >directories on my computer very often. Therefore I wrote a >Tkinter gui which upon button press performs essentially >cmd.exe /c subst ... with various arguments. >I tried several approaches (os.popen, os.system,spawnv) for >running the command. Unfortunately with all these approaches >it takes the command a very, very long time (~30 seconds) to complete. >I am running Python 2.1. Does anybody know where the >problem lies and how to solve it? From stefan at snobis.de Sun Dec 30 06:14:02 2001 From: stefan at snobis.de (Stefan Nobis) Date: 30 Dec 2001 12:14:02 +0100 Subject: REPOST: Re: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> Message-ID: <6$--$$_----__%$-_$@news.noc.cabal.int> gerson.kurz at t-online.de (Gerson Kurz) writes: > So ? After all, C doesn't need it, and I think few C programmers would > call this feature the "most missing", or? Take a closer look at the standard C libraries. They are *very* bad. I would call it very error-prone, if a function returns a value, that could be a correct value as good as an error code. This sort of in-band error-handling is the dead of every big library. So exception handling is very bad needed for good libraries. And that's are only the simpler issues. There are other issues like objects on the stack and the time, when they are destroyed and the like. That said i call every language broken, which does not have exception handling (or something similiar). -- Until the next mail..., Stefan. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Stefan Nobis Newsgroups: comp.lang.python Subject: cmsg cancel <87sn9tdkp1.fsf at 520075220525-0001.dialin.t-online.de> Control: cancel <87sn9tdkp1.fsf at 520075220525-0001.dialin.t-online.de> Date: Mon, 31 Dec 2001 03:15:29 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774266 27193 211.57.49.2 (31 Dec 2001 04:51:06 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:51:06 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From dale at riverhall.NOTHANKS.co.uk Thu Dec 20 12:34:41 2001 From: dale at riverhall.NOTHANKS.co.uk (Dale Strickland-Clark) Date: Thu, 20 Dec 2001 17:34:41 +0000 Subject: Win32Service and Service Manager Message-ID: <52842usq62dho41m9i4lg15l8pgfc0h8m3@4ax.com> I've written a basic service and it stops and starts with the Net command but I can't find it or anything relating to Python in the Service Manager. So the questions are: 1. Where is it hiding? 2. How do I change the user it runs under? 3. How do I change the startup mode? OS is Win2K Thanks -- Dale Strickland-Clark Riverhall Systems Ltd From mcfletch at rogers.com Tue Dec 25 13:23:14 2001 From: mcfletch at rogers.com (Mike C. Fletcher) Date: Tue, 25 Dec 2001 13:23:14 -0500 Subject: Properties fun with 2.2 References: Message-ID: <3C28C412.3070904@rogers.com> Hmm, don't really understand what the contract of the result is supposed to be: A sequence object, where a "controller sequence" declares property objects. These property objects control the data type, allow for bounds checking, and do the actual work of storing/retreiving data. or A sequence object, where the sequence object has "numerically indexed attributes". That is, a "sparse sequence of attributes" where each attribute is controlled by a particular Property object (that is, data type, bounds checking, storage/retrieval are all handled by the delegated object). or Something else? class ControlledSequence: # there's no 2.2-specific content here... def __getitem__( self, index ): return self.__properties[index].__get__( self, index ) # same for set and del, put in some slice logic with iteration class ControlledSequenceProperty: def __get__( self, client, index ): #this isn't the same API as standard property type #see the property example for what you'd do here, #basically just get/set/del the value from the client Where, depending on the contract, __properties is a list or a dictionary. [2.2 content here] One thing I really don't get in the property design is why the property __get__ __set__ __del__ methods don't normally have an API like that above (i.e. pointer to property object, pointer to client object, and pointer to the key/index/attributename used to call the property). With that, you could re-use the same property object if the property attributes were identical. Enjoy, Mike Robin Becker wrote: ... > very nice. I wondered if this stuff would be easy and it seems it can > be. One of the things I need is a collection of properties ie a property > > P > > with its own attributes (probably properties themselves) which can be > accessed as > > P[0] > > ie a thing similar to P, but allowed individual values where these > differ from the aggregate. I wonder whether this is more easily done in > 2.2. It's quite hard in 2.1. ... From jafo at tummy.com Thu Dec 20 23:28:56 2001 From: jafo at tummy.com (Sean Reifschneider) Date: Thu, 20 Dec 2001 21:28:56 -0700 Subject: Tar-like module? In-Reply-To: <20011221022407.GA22502@home.com>; from scott@fenton.baltimore.md.us on Thu, Dec 20, 2001 at 09:24:07PM -0500 References: <20011221022407.GA22502@home.com> Message-ID: <20011220212856.A5080@tummy.com> On Thu, Dec 20, 2001 at 09:24:07PM -0500, Scott Fenton wrote: >This may be an idiotic question, but is there a module >to read tar files in python? I googled around and >couldn't find anything, and the Python Std Library docs >didn't have anything. Any help would be nice. Actually, I think there are a few of them. I can't remember what packages they're a part of though... Distutils, maybe? Anyway, pyntar at ftp.tummy.com:/pub/tummy/pyntar/ has the ability to read tar data including processing the headers. It's not really a complete setup though. Sean -- "Yes on one, no on two." "Is number one nuke Russia, or number two?" -- _Buckaroo_Banzai_ Sean Reifschneider, Inimitably Superfluous tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python From aahz at panix.com Fri Dec 28 09:36:55 2001 From: aahz at panix.com (Aahz Maruch) Date: 28 Dec 2001 06:36:55 -0800 Subject: REPOST: Re: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B941D.B1E45AA5@htp-tel.de> Message-ID: <1$--$$_----_---$_$@news.noc.cabal.int> In article , DeepBleu wrote: > >NNTP is an internet protocol like SMTP, POP3 and HTTP for >communication. Also, it is the oldest one and it used to be the most >instructive before AOL hit the scene along with the 'gold rush' :) Really? NNTP is older than SMTP? Mind telling me where you found that little gem? -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 3 days and counting ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: aahz at panix.com (Aahz Maruch) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:25:34 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775381 27193 211.57.49.2 (31 Dec 2001 05:09:41 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:09:41 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From phd at phd.pp.ru Wed Dec 5 10:27:43 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Wed, 5 Dec 2001 18:27:43 +0300 Subject: The Best Smart Card Story You've Never Heard In-Reply-To: <3C0E39FD.F74E4014@med.uni-tuebingen.de>; from rupert.kolb@med.uni-tuebingen.de on Wed, Dec 05, 2001 at 04:15:09PM +0100 References: <3C0E39FD.F74E4014@med.uni-tuebingen.de> Message-ID: <20011205182743.E24826@phd.pp.ru> On Wed, Dec 05, 2001 at 04:15:09PM +0100, Rupert Kolb wrote: > That means, that spamers are NOT afraid of sending spam to the list or > the > private email addresses of the people which are active at the list. Spammer are arae afraid of something. > I think, the maintainers should do something against the spam. > Maybe other people at the list disagree. I agree. But *how* is another question. Most other spam-free mailing lists I know are !closed! lists - only registered subscribers may write, and only from registered addresses. Python mailing list cannot be closed - it is gatewayed to (and from) newsgroup comp.lang.python. Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From fredrik at pythonware.com Fri Dec 21 11:28:23 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 21 Dec 2001 16:28:23 GMT Subject: lost interest? References: <20011208001123.A5989@casa.parque> <4bLT7.32$aS.11733@news010.worldonline.dk> <9vtgc1$de5$1@panix3.panix.com> Message-ID: Suchandra Thapa wrote: > Yes, I noticed Andrew's message to distutils-sig about not being able > to maintain distutils anymore. However, I think that distutils is mature > enough that it could get by with the occasional patch. a "dummies guide to the distutils internals" wouldn't hurt, either. every time I've tried to write a setup script for PIL, I've had to give up after an hour or so. how do you tell the damn thing to find your Python LIB files, if they're not where it expects them to be (wherever that is)? how do you tell it to leave the output files in the current directory, so your test framework still works? how to you tell it to use the right compiler? etc. From nbecker at fred.net Sun Dec 30 15:48:33 2001 From: nbecker at fred.net (nbecker at fred.net) Date: 30 Dec 2001 15:48:33 -0500 Subject: REPOST: Re: /usr/bin/env: python: No such file or directory References: <9vivft$593$1@peabody.colorado.edu> <171220010818339518%jwbaxter@spamcop.net> <9vnvue$m5d$1@peabody.colorado.edu> <9vo6ng$mhs$1@nntp6.u.washington.edu> Message-ID: <9$--$$_----___-_$$@news.noc.cabal.int> >>>>> "Aloysius" == Aloysius Toh writes: Aloysius> Redhat 7.2 has both 1.5 and 2.1 Yes. Since RedHat scripts require 1.5, they should say so explicitly. This would enable you to install 2.1 or 2.2 or whatever you like without conflicts. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: nbecker at fred.net Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:46:18 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774087 27193 211.57.49.2 (31 Dec 2001 04:48:07 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:48:07 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From al_dass at yahoo.com Wed Dec 26 20:46:20 2001 From: al_dass at yahoo.com (Al Dass) Date: 26 Dec 2001 17:46:20 -0800 Subject: SSL Sockets in Windows References: Message-ID: Check it out... unzip and put in your \DLLs folder... but be sure to save the orginals. http://home.attbi.com/~al.dass/dev/python/2.1.1/win32_socket_ssl/python_2_1_1_ssl_socket.zip Cheers, Al Dass From reynolds at panix.com Wed Dec 5 13:38:08 2001 From: reynolds at panix.com (Brian Reynolds) Date: 5 Dec 2001 13:38:08 -0500 Subject: A Python GUI Book. References: <3beedf26@nntp.server.uni-frankfurt.de> <3c0390eb@nntp.server.uni-frankfurt.de> Message-ID: <9ulpig$qb6$1@panix3.panix.com> In article <3c0390eb at nntp.server.uni-frankfurt.de>, Michael 'Mickey' Lauer wrote: >Laura Creighton wrote: >> One defect that most GUI books I am aware of suffer from is that they >> are written almost exclusively from the point of view of providing >> ways for users to provide _input_ to your program, database, or whatever. >[...] >> And then, on your first job, you have to write code that handles >> real-time updates of a package tracking system. Many people need >> to write applications where the user _is_ a passive receiver of >> data. This is hard to do well, and worth a chapter all to itself, >> in my opinion. > >This is a very good suggestion - thank you. But can you imagine >a scenario where this can be combined into one example application which >both reacts to user input and change of internal data ? An online stock trading application that both displays real time updates of stock prices and executes the user's buy/sell orders. Any sort of process control application (or simulation of same) which displays system status and accepts user input to the system (think flight/driving simulator for a popular example). -- Brian Reynolds | "Dee Dee! Don't touch that button!" reynolds at panix.com | "Oooh!" http://www.panix.com/~reynolds | -- Dexter and Dee Dee NAR# 54438 | "Dexter's Laboratory" From jason at jorendorff.com Wed Dec 12 20:00:28 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Wed, 12 Dec 2001 19:00:28 -0600 Subject: Sorting things into bins In-Reply-To: <20011213002503994.AAA248@mail.climatedata.com@SUEW2000> Message-ID: > Is there a quick and simple way to sort a set of values (strings in this > case) into a set of bins, based on a subset of the characters in the > string? mylist = ['0101', '0102', '0103', '0201', '0202', '0203'] mybins = {} for s in mylist: bin = s[-2:] mybins.setdefault(bin, []).append(s) print mybins -- Jason Orendorff http://www.jorendorff.com/ From tim at zope.com Thu Dec 6 17:41:57 2001 From: tim at zope.com (Tim Peters) Date: Thu, 6 Dec 2001 17:41:57 -0500 Subject: Lists of attributes In-Reply-To: <200112061156340080.01286540@mail.rdc1.sdca.home.com> Message-ID: [Bruce Eckel] > Sent: Thursday, December 06, 2001 2:57 PM > If I have: > > class Flower: > def accept(self, visitor): > visitor.visit(self) > def __repr__(self): > return self.__class__.__name__ > > class Gladiolus(Flower): pass > Flower.gladiolus = Gladiolus() > > class Runuculus(Flower): pass > Flower.runuculus = Runuculus() > > class Chrysanthemum(Flower): pass > Flower.chrysanthemum = Chrysanthemum() > > Is there a clever way to get a list containing > [Flower.gladiolus, Flower.runuculus, Flower.chrysanthemum] > > I've got: > [j for i,j in Flower.__dict__.items() if Flower in > j.__class__.__bases__] > But I was hoping for something less awkward... I thought your original [Flower.gladiolus, Flower.runuculus, Flower.chrysanthemum] was quite elegant . Note that new-style classes in Python 2.2 keep track of their (immediate) subclasses, in order to speed propagating dynamic changes down the inheritance graph (an invisible chore performed by the runtime on your behalf). So, in 2.2, change class Flower: to class Flower(object): (that makes Flower a new-style class), and later Flower.__subclasses__() can be used to obtain the list [Gladiolus, Runuculus, Chrysanthemum]. mightily-impressed-by-correctly-spelled-flower-names-ly y'rs - tim From kfarmer at thuban.org Tue Dec 4 07:58:41 2001 From: kfarmer at thuban.org (Keith Farmer) Date: Tue, 04 Dec 2001 12:58:41 GMT Subject: PythonWin / wxPython interaction -- errors? Message-ID: <5M3P7.2428$JT2.1002469535@newssvr14.news.prodigy.com> Imagine the following situation: create wxFrame use hWnd of wxFrame to create a PyCWnd object set message hooks in both wxPython and PythonWin -- each set of hooks intercepts a different set of messages. the intention is that PythonWin catches messages that wxPython cannot. would this be the cause of receiving doubled message calls? ie, if PythonWin receives a particular message, would the presence of the wxFrame with the same hWnd cause the OS to transmit the message in duplicate? ---------- Keith J. Farmer kfarmer at thuban.org http://www.thuban.org From jkraska at san.rr.com Sat Dec 29 14:46:02 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 29 Dec 2001 19:46:02 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <4VlX7.6657$l93.1694996@newsb.telia.net> Message-ID: <6o6s2u4pa4kvqben6ftatrfttu9s78ee1k@4ax.com> >and to defeat the speed problem: an OPTIMIZING NATIVE CODE COMPILER You're not the first person to think of this. One of the problems is that designing an optimizing native code compiler for a fully dynamic language like Python is quite a difficult task. >1. Since the language is currently evolving very rapidly it is probably > a bad time to start such a project, Not really. The basic parts of Python which the compiler needs to support properly have been present for years. It has to do with first class language access to the dictionary which exists in every namespace, and how this first class access intertangles semantically with Python itself. Or at least that is one major element of the picture. IIRC, the generation of execution frames plays another role, and these likewise offer first class accessibility in Python. Again, they are intertwined. C// From sill at sill.silmarill.org Sun Dec 16 15:27:52 2001 From: sill at sill.silmarill.org (Andrei Kulakov) Date: Sun, 16 Dec 2001 20:27:52 GMT Subject: persistant options Message-ID: Hello, I'm looking for solutions or advice on persistant options / config file. Here's an example file: ~/.programrc # this option does [...] opt1 = 3 When the program is run and this option's changed from inside program, it should be written back to the config file. I know how to do this but I thought maybe there's a module that does this sort of thing already. I searched VoP but there's nothing of this sort there.. It seems like a lot of programs would benefit from this capability.. right? - Andrei -- Cymbaline: intelligent learning mp3 player - python, linux, console. get it at: cy.silmarill.org From andy47 at halfcooked.com Sun Dec 2 22:38:03 2001 From: andy47 at halfcooked.com (Andy Todd) Date: 3 Dec 2001 03:38:03 GMT Subject: Difference between 'import' and 'from ... import' Message-ID: I'm having a problem with imports and would appreciate any hints, tips or pointers to documentation or faqs. I've got a package installed in a directory on my PYTHONPATH and I cannot seem to import a module from that package directly. The directory is c:\python21\Gadfly and the module is gadfly.py. If I try; >>> from Gadfly import gadfly everything works and I can specify a connection and access my database. But, if I try; >>> import gadfly I get an error message; Traceback (most recent call last): File "", line 1, in ? SystemError: NULL result without error in call_object I've tried googling for this error message but it seems to be a generic error which is masking my real problem. This has got me a little stumped because the other modules in this package will import (e.g. sqlgen, sqlwhere) so I presume there is something in gadfly.py that the interpreter doesn't like. The gadfly documentation only talks about 'from gadfly import gadfly' and I'm just wondering if there is something specific in the module which prohibits a direct import. I'm running Python 2.1.1 on Windows98 with the latest version of gadfly from http://www.chordate.com/gadfly.html Thanks in advance, Andy -- Content free posts a speciality From brian at sweetapp.com Sat Dec 22 17:10:38 2001 From: brian at sweetapp.com (Brian Quinlan) Date: Sat, 22 Dec 2001 14:10:38 -0800 Subject: RELEASED - Python 2.2 final In-Reply-To: <20011222033347.C26726@tummy.com> Message-ID: <000601c18b35$7d4b77f0$445d4540@Dell2> Anyone know what ActiveState is doing with respect to ActivePython? Is ActivePython 2.2 final going to be out soon? The last release was ActivePython 2.2a1. Cheers, Brian From maxm at mxm.dk Fri Dec 21 17:25:32 2001 From: maxm at mxm.dk (maxm) Date: Fri, 21 Dec 2001 23:25:32 +0100 Subject: vi or emacs for editing Python on Linux? Message-ID: I am a long-time Windows developer who is trying to migrate to Linux for several reasons. But this doesn't come naturally to me :-) And some of the things about Linux I really like, others are a pain. Likewise with windows. But all in all I want to gradually switch. One of my biggest problems in switching is my editor. On windows I use Ultraedit as a general editor, and i type really fast in it. Knowing the shortcuts and all. Every time I boot up one of my Linux machines I have a hard time editing files under the arcane unix editors. I have tried both emacs and vim and I disklike both! I guess it's because I have strong habbits by now, and not because the editors are bad. But my point is that I figure that I have to use either editor if I want to switch platform. So before I commit myself to spending the days learning one of them thorougly (and swallow the loss in income ;-) ) I would like to know the strong/weak point in using either for Python. I know this is close to religion. But are there any rational reasons to use one instead of the other for Python? My understanding is that for emacs I have to use a lisp dialect to automate/extend it, and in vim I can use Python as an extension language of sort. Do I understand that correctly? I would especially like to use my next editor on my notebook with as little use of the mouse as possible. Regards Max M From skip at pobox.com Sun Dec 23 14:47:31 2001 From: skip at pobox.com (Skip Montanaro) Date: Sun, 23 Dec 2001 13:47:31 -0600 Subject: [OT] Teamwork in Python Development In-Reply-To: <20011223.095646.1061730690.31051@dougfort.net> References: <20011223.095646.1061730690.31051@dougfort.net> Message-ID: <15398.13523.278237.361426@12-248-41-177.client.attbi.com> >> From the January Scientific American: the picture is better in the >> printed version Doug> http://www.sciam.com/2002/0102issue/010250100.html Neat picture. Interesting technique. I actually found the blurb about antibiotics next to it both more interesting and more disturbing however: Antibiotics are shown to speed the growth of chicks and turkeys, and U.S. raisers are now feeding them to poultry on a large scale. Mortimer P. Starr and Donald M. Reynolds, bacteriologists at the University of California, examined intestines of turkeys grown on a diet supplemented with streptomycin and found that it took only three days for a bacteria population completely resistant to the drug to appear. If the feeding of antibiotics produces resistant varieties of parasites such as Salmonella, the organism may not only poison human consumers but be immune to treatment with drugs. -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From tatebll at aol.com Sun Dec 30 12:15:08 2001 From: tatebll at aol.com (Bill Tate) Date: 30 Dec 2001 09:15:08 -0800 Subject: REPOST: Re: Zope Documentation (was RE: Python Popularity: Questions and Comments) References: <3c2f03f4$0$2592$afc38c87@news.optusnet.com.au> Message-ID: <4$--$$_----____$-$@news.noc.cabal.int> djmitchell wrote in message news:<3c2f03f4$0$2592$afc38c87 at news.optusnet.com.au>... > Bill Tate wrote: > > > I understand the "zen" thing, but it's not something that business > > people are going to care about when they making a decision about > > whether to use it or not. > > Yep, exactly. > > My last boss was a "who cares what it is? If it's open source and you > techos recommend it, we'll give it a try" kind of guy. If we could present > a justification in terms of risk/benefit that looked good, he gave us his > blessing. I switched him from thinking development=C++/Java to Perl and > Python, we replaced Solaris and AIX boxes with Linux, and we saved our > employers enormous quantities of money. When I tried to talk him into > looking at Zope, I found there was no frame of reference I could use - no > comparisons with J2EE or n-tier COM, which are probably about the closest > alternatives in terms of development approach If he was to let me take on > some work using Zope, his problems were: > - trying to convince his superiors that this unheard-of Zope thing was > better in some vaguely-defined way than J2EE and large COM solutions > - how to estimate the design/dev times using Zope. At least with J2EE and > COM there's some body of evidence out there as to how long projects take > from conception to production. We'd proven that Python compared to C++ > gave something around 10:1 reduction in dev times, but Zope isn't Python > - how was Zope going to perform on hardware from vendor X. We already had > reasonable expectations as to how J2EE performed on specific hardware, and > could budget our hardware purchases with some degree of confidence. The > Zope web site suggests "it runs fast", but there's no data at all that I > could find to back it up > > I knew I was on a loser even as I was saying something like "it's a better > Java than Java" as I was describing Zope's platform independence. When I > had to resort to crap platitudes like this, even though I believe it, I > knew nobody holding development purse strings was going to let me finish > the spiel. > > Zope seems to have an "it's better than the rest; just take our word for > it" mentality attached to it, and solid comparisons with other tools or > performance data just doesn't appear to be out there. Sun took this tack > with Java in the early days, and MS did with COM/MTS a few years ago, and > large corporates had a belief that Sun and MS wouldn't let their customers > down (else they'd lose market share and shareholders would get upset). > With Zope not having a major corporation behind it, and the NASDAQ collapse > in 2000, there's that much less blind faith available for Zope. Even a > small pilot or proof-of-concept implementation costs serious dollars, and > that type of money just isn't around any more. > > I'd LOVE to use Zope for something grander than my personal site holding my > resume and pictures of my kids, but if I couldn't convince one of the most > receptive managers I've ever had, it seems like an impossible task. It's > sort of like the conceptual leap that was required to embrace OO > development several years ago; there was a large body of evidence as to how > non-OO development worked in "best practice" scenarios, lots of project > managers skilled in non-OO development and a general feeling of comfort > that the old ways worked. Why change to OO, and take on all the unknown > development risks? > > Based on the available documentation, Zope seems to need this sort of > "death or glory" approach, and hardly anyone seems willing to take these > risks at present. Although I'd love to see the next Yahoo! or Amazon > startup use Zope, there's just no way the men holding the chequebooks would > allow it. > > If anyone's got any suggestions as to how Zope can be made into less of a > perceived business risk, I'd love to help make it happen, but it seems > beyond me at present. I couldn't of said it better if I tried - its this aspect of zope that I would like to help the community address. Can't get by on - try it you'll like it. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: tatebll at aol.com (Bill Tate) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:05:59 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774164 27193 211.57.49.2 (31 Dec 2001 04:49:24 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:49:24 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From andreas.ulbrich at gmx.net Tue Dec 4 05:21:47 2001 From: andreas.ulbrich at gmx.net (Andreas Ulbrich) Date: Tue, 04 Dec 2001 11:21:47 +0100 Subject: Printing from Windows References: <9ui1ki$lfv$1@news.netpower.no> <20011204111022.682cc9dc.use-net@schabi.de> Message-ID: <3C0CA3BB.9090508@gmx.net> Markus Schaber wrote: > Hi, > > On Tue, 4 Dec 2001 09:35:44 +0100 > "David Brown" wrote: > > >>It doesn't look like there is much hope for using Tkinter for printing, >>so I'm generalising my original question. >> >>Are there any good ways to make a printout from a Python program? I'll >>be running mostly on Windows, but I'd much prefer a cross-platform >>solution for later migration to Linux. Sure, I could use the Win32 api >>directly - but that is the sort of thing I am trying to avoid with >>Python + Tkinter. There must surely be thousands of developers out >>there with the same problem. >> >>Any hints or ideas would be much appreciated. >> > > Maybe the gtk+ printing works with windows and unix in the same way. > > This has the disadvantage that gtk+ is not part of standard python, but there are some extreme powerful widgets there (including embedding the mozilla engine). > > markus > I personally prefer PyQt for this purpose. Of course, just like gtk+ its not part of the standard Python distribution. Using Qt seems somewhat more sane to me. But well that's pretty much a matter of taste :-) From erik at naggum.net Sat Dec 22 12:18:50 2001 From: erik at naggum.net (Erik Naggum) Date: Sat, 22 Dec 2001 17:18:50 GMT Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic References: <3218013921984060@naggum.net> <3218018853244911@naggum.net> <92592u85pq0t8hvhklgq5jjojiuldtv7dr@4ax.com> Message-ID: <3218030326803537@naggum.net> * IsraelRT | And an infamous Common Lisp user gives popularity as a reason to | choose a language? * Erik Naggum > No. That would be a rather spectacularly invalid conclusion. Since you > obviously have no idea what Tengwar is * IsraelRT | You are either delusional or sadly lacking in rationality if you believe | that the second statement follows as a consequence of the first. As a _consequence_? No. Logic and rational thought is not quite your thing, is it? But since your emotive invective is conditional upon your false premise, I guess I am in the clear. Whew! That was _so_ close. | Go take your medication. I assume you have extensive experience with medication helping your own behavioral problems since you think this silliness is an insult, but it just goes to show that once again, the aggressiveness of Israel gets blamed on those attacked. History is indeed repeating itself. /// -- The past is not more important than the future, despite what your culture has taught you. Your future observations, conclusions, and beliefs are more important to you than those in your past ever will be. The world is changing so fast the balance between the past and the future has shifted. From nikander at mindspring.com Wed Dec 19 12:05:32 2001 From: nikander at mindspring.com (Robert Nikander) Date: Wed, 19 Dec 2001 12:05:32 -0500 Subject: how to free PyArg_Parse'd args? Message-ID: <20011219.120523.74603.8495@localhost.localdomain> Hello all, If I create a C extension class with a member char * name, and I get the name initially from a PyArg_ParseTuple(args, 's'...), Who should I call to free it when the objects tp_dealloc slot is called? I am trying PyMem_Del/Free( obj->name ) but am getting a seg fault. Thanks for any help, Rob From fperez528 at yahoo.com Sun Dec 23 14:13:56 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Mon, 24 Dec 2001 18:41:56 +2328 Subject: [OT] Quantum Python (Re: Properties fun with 2.2) References: <3C27CFC0.5AB401F7@geneva-link.ch> Message-ID: Boris Borcic wrote: > In any case, an example toy-modelling Heisenberg's uncertainty > principle looks like a must. Rules over the consistency > of value mimicking the behavior of complementary > QM observables before enchanted student eyes... > Neat idea. I think though that you don't need py2.2 for that. You could play nice games with __getattr__ already and a random number generator: attributes whose values only exist when measured. Granted, the syntactic sugar of 2.2 (for this it's sugar, I know for other things its deep and true) makes it easier, but it can be done in 2.1, I think. I might play around with a QuantumCat class tomorrow, sounds like fun :) On a more serious note, it might be instructive for intro quantum courses for things like simple two-level systems or spin polarization problems. I keep thinking of a neat computational physics course in python, this would be a cool toy problem to include. Merry Xmas, f. From fdrake at acm.org Sat Dec 8 01:30:53 2001 From: fdrake at acm.org (Fred L. Drake) Date: Sat, 8 Dec 2001 01:30:53 -0500 (EST) Subject: [development doc updates] Message-ID: <20011208063053.2367D286BC@beowolf.digicool.com> The development version of the documentation has been updated: http://python.sourceforge.net/devel-docs/ Another day of updates; various fixes and clarifications. From Bruce at EckelObjects.com Sat Dec 8 10:47:38 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Sat, 08 Dec 2001 07:47:38 -0800 Subject: Calling a generator multiple times In-Reply-To: References: Message-ID: <200112080747380630.001F119F@mail.rdc1.sdca.home.com> >So as to not confuse myself, I think of generators thusly: > >A generator is a function or method that -- by virtue of using the yield >statement -- *creates* and *returns* an iterator object when invoked by a >caller. The caller normally takes that returned iterator object and uses >it by invoking its "next" method until StopIteration is raised. The code >inside the generator function or method *runs* when the "next" method of >said iterator is invoked. Each time a caller invokes the *generator* >function or method, a new iterator object is created and returned. I believe that this is too restrictive a definition. My experience of generators (from C++/STL) is that a generator is simply a callable entity that returns an object every time you call it; this call takes no arguments so it is "generating" objects rather than being a factory -- factory calls take arguments and build the object based on those arguments while generators create new objects based on some internal logic. So a generator could be thought of as a zero-argument factory. I think it might have been better to say that Python now has "improved support for generators" in the form of 'yeild.' I suspect there will be a fair amount of discussion for awhile, every time the term "generator" is used, if the accompanying code does not include 'yeild'. I also think that a generator only returns an iterator if that's what it promises to generate; otherwise it returns a regular object. Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From ecastro at cicei.ulpgc.es Tue Dec 18 11:27:20 2001 From: ecastro at cicei.ulpgc.es (Enrique) Date: 18 Dec 2001 16:27:20 GMT Subject: How to know that a second application has finished? Message-ID: <3C1F6F21.C03A3ABC@cicei.ulpgc.es> Hi, Let me put my question again, in a different and more general form. I have a Python program that launches a GUI application in a separate window via COM. I am using Python 2.1.1 with win32 extensions in MS-Windows (win95/98/NT) Is it possible to suspend the main Python program until the COM application has finished? (has been closed). I want to resume from that point onwards. How the main program gets information of the state of other applications launched from it? Thanks in advance Enrique Castro From dhhnews0 at hotmail.com Fri Dec 7 21:23:59 2001 From: dhhnews0 at hotmail.com (Dan Howard) Date: Sat, 08 Dec 2001 02:23:59 GMT Subject: Tinker vs wxPython ?- Opinions/Views Message-ID: <3ReQ7.21098$2Fd.14596@news1.bloor.is> I'm a newbie at Python and about to create my first set of GUI appliactions. I would like to run them on Windows and Linux ( and possibly MAC). I'm trying now to decide whether to use Tinker or wxPthyon. Would appleciate views, opinions and experiences... Thanks - Dan From jason at jorendorff.com Wed Dec 19 18:31:34 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Wed, 19 Dec 2001 17:31:34 -0600 Subject: compile() question In-Reply-To: <2bbda179.0112141529.49f816ce@posting.google.com> Message-ID: > I am parsing a stream of colon-delimited fields (field:value) where > the field is an attribute for an object. Since there are a few dozen > fields and I don't want to handle each field separately, I used exec > to make it easy (after splitting): > > exec ( 'volume.' + field + ' = "' + value + '"' ) This is a slow approach (plus it fails if there are " characters in the value). Try this instead: setattr(volume, field, value) ## Jason Orendorff http://www.jorendorff.com/ From ylee12 at uiuc.edu Fri Dec 28 14:21:40 2001 From: ylee12 at uiuc.edu (Young-Jin Lee) Date: Fri, 28 Dec 2001 13:21:40 -0600 Subject: REPOST: [Q] how to use IDLE in linux Message-ID: <5$--$$_-----$%_%_$@news.noc.cabal.int> Hi, I have problem using IDLE in Linux. I installed Python 2.2 and tried to launch IDLE, but it didn't work. I read the on-line document for IDLE and it says that I needed to just type "idle", but it didn't work for me. What am I supposed to do to use IDLE in Linux? TIA. YJ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Young-Jin Lee" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:03:01 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775122 27193 211.57.49.2 (31 Dec 2001 05:05:22 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:05:22 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From qrczak at knm.org.pl Sat Dec 22 12:36:22 2001 From: qrczak at knm.org.pl (Marcin 'Qrczak' Kowalczyk) Date: Sat, 22 Dec 2001 17:36:22 +0000 (UTC) Subject: Search the difference: Why this function defenition does'nt work? References: <3C24A967.3070604@student.kun.nl> <3C24B3AE.8060103@student.kun.nl> Message-ID: Sat, 22 Dec 2001 17:24:14 +0100, husam pisze: > Why is it bad to say: > sum=[] Becase []+'b' doesn't mean anything. -- __("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ QRCZAK From jpt.d at rogers.com Sun Dec 30 22:12:14 2001 From: jpt.d at rogers.com (Jeffrey Drake) Date: Mon, 31 Dec 2001 03:12:14 GMT Subject: REPOST: Re: Tkinter gui for the winnt subst command References: <11f1fe5.0112300800.680cb872@posting.google.com> Message-ID: <5$--$$_----__$-__$@news.noc.cabal.int> os.popen("subst z: c:\python22") that works very quickly, i don't know what your problem might be. On 30 Dec 2001 08:00:54 -0800, yuvale at radware.com (yuval) wrote: >I need to map and remap (cmd.exe subst ...) certain >directories on my computer very often. Therefore I wrote a >Tkinter gui which upon button press performs essentially >cmd.exe /c subst ... with various arguments. >I tried several approaches (os.popen, os.system,spawnv) for >running the command. Unfortunately with all these approaches >it takes the command a very, very long time (~30 seconds) to complete. >I am running Python 2.1. Does anybody know where the >problem lies and how to solve it? ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newshub.northeast.verio.net!verio!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: jpt.d at rogers.com (Jeffrey Drake) Newsgroups: comp.lang.python Subject: cmsg cancel <3c2fd756.27109611 at nntp> Control: cancel <3c2fd756.27109611 at nntp> Date: Mon, 31 Dec 2001 03:41:27 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009773946 27193 211.57.49.2 (31 Dec 2001 04:45:46 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:45:46 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From mikecrowe at bigfoot.com Sat Dec 29 19:19:02 2001 From: mikecrowe at bigfoot.com (MikeCrowe) Date: Sun, 30 Dec 2001 00:19:02 -0000 Subject: Reg-Ex and lambda optimization Message-ID: Hi folks, New to Python, and had this question. I couldn't figure out how to read a directory and filter the results by what I wanted. I basically wanted to read: dir\db*.* and get all names of files matching that spec. Here's the line I finally came up with: dbDirs = filter(lambda s: re.match('^db.*$',s), os.listdir(self.start)) I couldn't figure out how to us the FileList class, and this works. Here's my question: Is the re.match('^db.*$',s) compiled each iteration of the loop lookup? I don't notice this being slow, but was curious if this was bad coding. Mike From ykingma at accessforall.nl Sun Dec 9 05:43:29 2001 From: ykingma at accessforall.nl (Ype Kingma) Date: Sun, 09 Dec 2001 11:43:29 +0100 Subject: __subclasses__() (was OK, now *this* is cool) References: <3C112086.5F7072A9@accessforall.nl> Message-ID: <3C13404D.F7A60179@accessforall.nl> Martin, you wrote: > > Ype Kingma writes: > > > P.S. Did they really make __subclasses__() a method? > > Yes. Each type holds a list of weak references to its subtypes, to > avoid creating cycles. If you want a list of all subclasses, you need > to go through the weak references and find those which are still > live. The list you get will be different from what is in the type > object; the function call will remind you that some computation is > going on. > Thanks for your explanation. It took some time to digest. Do I understand correctly that subclass references are weak links because a subclass may disappear (become not live) and a normal subclass reference could then keep the subclass accessible only because the of the existence of the normal subclass reference in the super class? To avoid this problem (superfluous reference to subclass) weak links are used so that the garbage collector can free the subclass when expected. When a real reference is needed as a result if the __subclasses__() method this method then checks all weak references and (atomically) creates normal references from the ones that are still valid. Superclass references should be normal references because they are needed to find attributes by inheritance. I suppose the cycles you mention are not direclty related to the former python problem that the garbage collector could not get rid of objects in cycles? Thanks in advance, Ype P.S. I'll also take a look at python-dev. From robin at jessikat.fsnet.co.uk Fri Dec 7 03:53:26 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Fri, 7 Dec 2001 08:53:26 +0000 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C0FBAA8.F1A44304@attbi.com> <3C100EFF.6EEA6C7A@cosc.canterbury.ac.nz> Message-ID: . ..... >> >I think there may be a need for a long term dating system, but that >isn't the same as counting femtoseconds. The IAU routinely adjust >sidereal time with leap seconds etc as the Earth's rotation changes. > >A true dating system would need to take such events into account as >otherwise transactions could take place in non-time. Of course the >difficulty is not that of counting the femtoseconds but of mapping them >back into our familiar days and months. as evidence I offer http://tycho.usno.navy.mil/leapsec.html from which As of 1 January 1999, TAI is ahead of UTC by 32 seconds. TAI is ahead of GPS by 19 seconds. GPS is ahead of UTC by 13 seconds. there's clearly more to dating than a simple counter :( -- Robin Becker From yfjohans at NOSPAMTHANKYOUMAM-siving.hia.no Sun Dec 2 08:44:45 2001 From: yfjohans at NOSPAMTHANKYOUMAM-siving.hia.no (Yngve F. Johansen) Date: Sun, 02 Dec 2001 14:44:45 +0100 Subject: Python, PyQT and QSpinBox References: <9ubnie$34b$1@snipp.uninett.no> <9uco14$3cb$1@news1.xs4all.nl> Message-ID: <9udb9l$g9h$1@snipp.uninett.no> Boudewijn Rempt wrote: > Which version of Qt are you using? The Qt 3 QSpinbox has a function > interpretText() that should be called whenever the user manually edits > the contents of the spinbox. I think that this function should do the > right thing by default (i.e. call mapTextToValue(), but you could > always subclass QSpinbox and reimplement interpretText to do what you > want. I've got QT v2.3.1 installed, and if I'm not mistaken the interpretText() function is available in QT 2.3 as well, it's at least listed in the documentation. When I subclassed QSpinBox I overwrote mapTextToValue, and simply tried to convert a string to an integer which I returned. I also reimplemented textChanged() and simply called updateDisplay(). The problem seems to be that there isn't any signaling going on until I move my mousepointer over the widget, as none of my overwritten functions are called unless I do so. > If you could post a small sample script showing the behaviour, I'm sure > I cold help you find a solution. I don't really know if there is any point in pasting any code, as I don't have much code related to the QSpinBox. I originally used the raw QSpinBox widget and it worked, short of it not updating the value unless I move my mouse over it. I'm not using any weird values either, just integers from 0 to 99. I'm not to familiar with the signal-slot mechanism, and it could be that I have to do something with this? I don't have a single connect() statement defined relating to the QSpinBox widget. Hope you have some tips, thanks for your help thus far! Sincerly, Yngve F. Johansen From borcis at geneva-link.ch Mon Dec 24 21:07:02 2001 From: borcis at geneva-link.ch (Boris Borcic) Date: Tue, 25 Dec 2001 03:07:02 +0100 Subject: [OT] Quantum Python (Re: Properties fun with 2.2) References: <3C27CFC0.5AB401F7@geneva-link.ch> Message-ID: <3C27DF46.A44B70F3@geneva-link.ch> Fernando P?rez wrote: > > > mimicking the behavior of complementary > > QM observables before enchanted student eyes... > > > > two-level systems or spin polarization problems. Exactly what I have in mind, when thinking of complementary QM observables, since they were first exposed in my school, as illustrated by Stern and Gerlach apparatus/experiments. There-is-spin-in-"the wheel(s/2) turn(s/2)"-ly yours, BB From benji_york at cal-na.com Fri Dec 21 10:12:36 2001 From: benji_york at cal-na.com (Benji York) Date: 21 Dec 2001 07:12:36 -0800 Subject: Python on the desktop References: <94e3fce8.0112210053.2568529d@posting.google.com> Message-ID: <59667b81.0112210712.7528c69@posting.google.com> sarat_venugopal at yahoo.com (Sarat Venugopal) wrote in message news:<94e3fce8.0112210053.2568529d at posting.google.com>... > Hi all, > 1. If python is to permeate the realm of commercial desktop (in > whatever scope), we need the ability to convert it into a native > executable... I read somewhere, it may never be > possible in Python. Can anyone throw light on this? Due to Python's highly dynamic nature, a "compiled" version would do pretty much what the VM does now, but the executables would be very large. If you're wanting speed, check out the nascent Psyco project (http://homepages.ulb.ac.be/~arigo/psyco/). If you just want to obscure the code, then I wouldn't worry too much. In my estimation, byte-compiled python is only marginally easier to decompile (not dis-assemble) than C, C++, or Java. (Note that there are some sophisticated C, C++, and Java decompilers.) > 2. Absence of a standard GUI, which really fits the major platforms. I'd go with wxWindows all the way here: native look and feel, cross-platform, multiple laguage support, lots of functionality. I've worked with TK and looked deeply into some of the other GUI libraries, and wx is the all-around best (see http://www.wxwindows.org/ and http://www.wxpython.org/). For a good GUI builder check out (the commercial, but inexpensive) wxDesigner (http://www.roebling.de/) which produces code in C++, Perl, and Python. > 3. Does the community see Python as a full-fledged programming > language? I do. I've been doing web apps, utility scripts, command line apps, batch processes, and GUI apps (daily) in Python for over two years now. It is definatly the language that I develop the most quickly in, and produce the most maintainable code. (The two most important factors of PL choice IMHO.) -- Benji York york6 at mindspring.com From djrassoc01 at mindspring.com Fri Dec 28 13:32:49 2001 From: djrassoc01 at mindspring.com (Dr. David J. Ritchie, Sr.) Date: Fri, 28 Dec 2001 12:32:49 -0600 Subject: REPOST: Re: Python Popularity: Questions and Comments References: Message-ID: <2$--$$_----_-%$$%$@news.noc.cabal.int> In regards to Jonathan's comments.... Jonathan Feinberg wrote: > "A. Keyton Weissinger" writes: > > > If it is as "X" as we all say/know/feel-in-our-hearts that it is, why is > > there so very little real commercial appeal? > > [snip] > > > OK. At this point, I will get probably 3-10 messages public or private > > saying that Python does not attempt to answer the same niche. > > It has nothing whatsoever to do with the merits. It's entirely about > marketing. It's about pointy-headed Chief Technical Officers who have > heard that Java is a good "enterprise" language, etc. > In support of Python, I would say "Absolutely!" Compare the advertising dollars spent on Java vs. that spent on Python. Along with CD ROM's, we should be distributing a page of peel-off stick on, "Python Inside" labels as an insert with every Python book. I also think it is related to the less and less actual technical experience of senior decision makers in corporations. It means that decision methodology is based more on what "large number of people believe to be true" and this makes it particularly susceptible to the marketing of myths. On the other hand, just to stir the pot a little and because I believe you should be able to argue both sides of an issue, I would say when it comes to semi-critical and critical applications, there are features of Java (like strong typing) that at least mandate a certain level of consistency between all execution paths. I can argue to myself to dismiss that one by saying that of course interpretative languages should not be expected to hold to that level of validation. So, maybe it's reasonable to choose Java for the toaster I am manufacturing. But then the dynamics are that you have the foot in the door with a group of developers inside the firewall who already know java well, it is a simple (-minded?) leap to employing it in enterprise-wide constructs. --D. -- Dr. David J. Ritchie, Sr. djrassoc01 at mindspring.com http://home.mindspring.com/~djrassoc01/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.berkeley.edu!ucberkeley!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Dr. David J. Ritchie, Sr." Newsgroups: comp.lang.python Subject: cmsg cancel <3C2CBACB.FBF3C3C9 at mindspring.com> Control: cancel <3C2CBACB.FBF3C3C9 at mindspring.com> Date: Mon, 31 Dec 2001 04:58:10 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775148 27193 211.57.49.2 (31 Dec 2001 05:05:48 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:05:48 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From slzatz at hotmail.com Sun Dec 30 11:46:48 2001 From: slzatz at hotmail.com (Steve Zatz) Date: Sun, 30 Dec 2001 16:46:48 GMT Subject: REPOST: Re: Help - command line arguments References: Message-ID: <8$--$$_----__%--%$@news.noc.cabal.int> Thanks to both Hans and Emile. Setting sys.argv to the command line arguments did the trick. Thanks. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.cwix.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Steve Zatz" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:34:29 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774177 27193 211.57.49.2 (31 Dec 2001 04:49:37 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:49:37 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From s.keim at laposte.net Fri Dec 7 05:06:56 2001 From: s.keim at laposte.net (sebastien) Date: 7 Dec 2001 02:06:56 -0800 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C100BB2.6446E896@cosc.canterbury.ac.nz> Message-ID: <7da8d8f8.0112070206.49e1bef4@posting.google.com> Thanks for your responses Here my feeling about theim. I'll try to include your comment's in a second draft of the PEP, but there is no chance that this will be done before Monday. RB> = Robin Becker KS> = Kragen Sitaker CB> = Chris Barker OB> = Oleg Broytmann PH> = Phil Hunt GE> = Greg Erwin ------------ CB>I use mxDateTime frequently, and it is a fabulous package. (...) CB>It makes a whole lot more sense to me to put in a trimmed-down CB>version that to re-invent this particular wheel. OB>Just a day ago the question was raised (by me) in zope list. The answer OB>was: both Guido and Marc-Andre said "no". It is a matter of support. Who OB>will support the module in the std python lib? I love mxDateTime too. My first idea was to write a post with "WE MUST HAVE mxDateTime IN THE STANDARD LIBRARY" But, when I restarted my brain, it happened to me that mxDateTime exist since a quite long time, and then if it is not now in the standard library, it's probably for good reasons. I didn't saw other reasons than support costs, cool I was true! KS>Note that this means you can't use your date module to calculate time KS>intervals easily. My feeling was that this elapsed day format should only be used for calendar class interoperability. The end user should use the arithmetic methods provided by calendar classes and he shouldn't have to bother with this format. For sample he should be able to write something like: elapsed_time = FrenchRevolutionCalendar(3,VENDEMIAIRE,15) - date(1789,7,14) RB>It seems odd to define dates as a duration in days from a fixed time and RB>then define durations in a different scale ie seconds. My intuitive feeling was that seconds are more natural for expressing duration, both in Python and in current life (second is the SI unit). And if we hide the elapsed day format to calendar classes users, the two scales doesn't seem so odd for me. KS>I sort of agree, but I tend to think that the tuple would be OK if it KS>was an object with named attributes instead of just being a tuple. Not a real objection, but I feel a little better to write x.day instead of x[2]. KS>The POSIX format (in floating point) has the additional problem that KS>it loses precision as we get far from 1970. In fact the format I suggested for calendars interoperability has the same problem :( KS>that means we can express nanoseconds KS>for about a month or two on either side of the epoch, microseconds for KS>about 90 years on either side of the epoch, milliseconds for about KS>90,000 years on either side of the epoch, and seconds for about 90 KS>million years on either side of the epoch. I'm not sure what not KS>being able to calculate Jurassic times in milliseconds costs us, but I KS>thought I should mention it. Thank's for your precisions, I'll add this to the PEP >>In this format, the integer part correspond to the number of elapsed >>days since the start of the day 1858-11-17 CE. PH>Any reason why that day particularly? It's something like 2400000 days after the conjonction of 3 specific astronomical events (see the link [4] of the PEP). Given the previous results, it would be better to choose an epoch nearer current dates (maybe the 2000/1/1 or Guido soon birthday ;-)) RB>wouldn't it be wise to establish the representation limits in years and RB>fractions of a second and make these a required part of implementations RB>of AbstractDate derived classes. Do you mean to add methods like: - max_year() - min_year() - precision() That seems a good idea to me, I'll add this, with an exception that should be raised when a date is outside the calendar class range. CB>I would argue that applications that deal with nanoseconds are of a CB>different breed than those that deal with day, month, year type calculations. CB>There is no need for a single package to handle both well. I agree with that, maybe I should add this to the PEP. My feeling is that the 80% case won't bother with times shorter than what a computer clock can return. PH>Perhpas it'd be better to have se seconds as a separate integer, for PH>accuracy of arithmetic. KS>Given that Python has arbitrary-precision integers, it might be best KS>to just use them. I think that 1 millisecond for 90.000 years is a quite good result. In fact, the better argument against real number is arithmetic problems, I hope we can solve theim by saying that all numbers between x and x+precision are equals. If we can't, then your solution is probably the best, but: - this will make calculs a little more complex - we must choose the scale for the time number (seconds seems a little restrictive to me) KS>It might be useful to express the time in TAI rather than GMT, KS>although that distinction ceases to be meaningful outside of modern KS>times. Could you give me more explanations? I suppose that what is called GMT in computer litteracy is in fact TAI. KS>Perhaps you could include code samples demonstrating how your proposed KS>module would make user code simpler? I'll try to do that for next draft of the PEP ;-) >> What exist today for Python >>powerful mxDateTime tools already exist >> NormalDate define also a light date class[2]. KS>Can you outline what these packages provide? Yes this chapter of the PEP need a bit of explainations. I'll do that. >> I feel this solution better than the POSIX convention to count the >> elapsed time in seconds because not all the days have the same length. GE>What?!? This sounds more like an argument for NOT using days as GE>the basic unit. Otherwise you can't meaningfully take the difference GE>between two dates and express it in the same units. GE>Because of what you said above about leap seconds (...) I must admit there is something dificult here. This need more thought, but in the two case you will have problems to use both a class which ignore leap seconds and a class able to use theim. With the day unit you have problems for duration arithmetic, with the second unit you have problems for convertion betwwen calendards classes. My feeling is that the second case is most common than the first. By the way, of course the standard class shouldn't bother with leap seconds. From wryder at taz.cs.wcupa.edu Wed Dec 12 17:20:24 2001 From: wryder at taz.cs.wcupa.edu (wryder at taz.cs.wcupa.edu) Date: 12 Dec 2001 22:20:24 GMT Subject: trouble with import odbc References: <9v3aj4$9ke$1@news.netmar.com> Message-ID: <9v8l78$4hf$1@news.netmar.com> Thanks for the reply. As I posted later, I got it working. Would just like to mention that because an error message is accurate doesn't mean its helpful. For example, say you want to buy a house. Is knowing that a house is for sale enough to help you out? Or do you need to know more? Even if my mistake was an ametuerish one, none-the-less a simple indication of the path and object that the script was attempting to load would have saved me a couple hours. -Bill >First you have to go into the ODBC settings (Start Menu | Settings | Control >Panel, double click on ODBC) and create a System DSN pointing to the >database you want to use. This will require you to have a PostgreSQL ODBC >driver loaded, whcih I assume you've done. > >Then you should call > > conn = odbc.odbc("DSNName") > >to make the connection to your database. The error message is an exact >description of what you are doing wrong. You would get the same thing if you >wrote > > import sys > sys("Hello") > >regards > Steve >-- >http://www.holdenweb.com/ > > > > > ----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web ----- http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups NewsOne.Net prohibits users from posting spam. If this or other posts made through NewsOne.Net violate posting guidelines, email abuse at newsone.net From tim at vegeta.ath.cx Fri Dec 21 17:53:11 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Fri, 21 Dec 2001 22:53:11 GMT Subject: vi or emacs for editing Python on Linux? References: Message-ID: maxm graced us by uttering: > I am a long-time Windows developer who is trying to migrate to Linux for > several reasons. But this doesn't come naturally to me :-) And some of the > things about Linux I really like, others are a pain. Likewise with windows. > But all in all I want to gradually switch. Excellent. Best of luck! > One of my biggest problems in switching is my editor. On windows I use > Ultraedit as a general editor, and i type really fast in it. Knowing the > shortcuts and all. Every time I boot up one of my Linux machines I have a > hard time editing files under the arcane unix editors. I have tried both > emacs and vim and I disklike both! > > I guess it's because I have strong habbits by now, and not because the > editors are bad. Historically, I believe Emacs has been closer to the Win32 mindset as far as user interface, but Vim (the best vi clone, IMHO) has recently included an "evim" command, loading vim with a point-and-type interface, but with all of vim's power underneath. Vim's GUI version, gvim, also has the classic pulldown menus available. Both Emacs and vi have rather long learning curves, but they are both among the most widespread, powerful, extensible, just plain groovy editors around. They both also have numerous ports on Win32 platforms. > But my point is that I figure that I have to use either editor if I want to > switch platform. So before I commit myself to spending the days learning one > of them thorougly (and swallow the loss in income ;-) ) I would like to know > the strong/weak point in using either for Python. I don't understand how you would lose income in learning to use free software with ample documentation. Time, yes, but not money. In any case, you don't _have_ to use either one. There are dozens of powerful text/code editors available for unix/linux (and I've had good results running Win32's UltraEdit-32 under WINE, a Windows emulator, in case you're interested). > I know this is close to religion. But are there any rational reasons to use > one instead of the other for Python? Emacs seems at times to be better supported in the Python community, but there is a strong Vim undercurrent as well; neither of these are noticeably dominant. It definitely seems to me, however, that a vast majority of linux pythonistas use _either_ vi or Emacs, or at least don't talk about it much. =) > My understanding is that for emacs I have to use a lisp dialect to > automate/extend it, and in vim I can use Python as an extension language of > sort. Do I understand that correctly? Emacs' innate language is Emacs-lisp (elisp), yes. But there are new extensions available, IIRC, that allow you to extend it in other ways/languages. Pymacs is one. Vim is very much extensible using Python, and I've just finished rebuilding Vim with the latest Python 2.2 embedded. In fact, Vim's designed to compile with support for several languages, including Python, Perl, Ruby, and others. > I would especially like to use my next editor on my notebook with as little > use of the mouse as possible. Either Emacs or Vim are ideal for this, as they were designed to be powerful before mice were standard computer equipment. Go to http://www.python.org/editors/ and look at the tables there. They list editors, IDEs, and other tools for multiple platforms that support Python. The list includes at least 10 linux editors that are neither Emacs- nor vi-related; 4 of these are available for both Win32 _and_ linux. Before you go downloading all these, however, see if IDLE doesn't meet your needs. It's part of the standard Python distro and is most likely already on your harddrive. HTH Tim Hammerquist -- Trust the computer industry to shorten the term "Year 2000" to Y2K. It was this kind of thinking that got us in trouble in the first place. -- Adrian Tyvand From aahz at panix.com Mon Dec 24 00:03:51 2001 From: aahz at panix.com (Aahz Maruch) Date: 23 Dec 2001 21:03:51 -0800 Subject: f(n=4) works; bug or feature? References: <3C26B3DA.4000102@erols.com> Message-ID: In article <3C26B3DA.4000102 at erols.com>, Edward C. Jones wrote: >In Python 2.2, the following code prints a "4". > >def fun(n): > print n > >fun(n=4) > >Bug or feature? Feature. You're using the ability of Python to define keyword arguments to functions. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 8 days and counting From aleax at aleax.it Tue Dec 11 10:10:21 2001 From: aleax at aleax.it (Alex Martelli) Date: Tue, 11 Dec 2001 16:10:21 +0100 Subject: Creating a "package" using C extensions? References: <4bo41u8de4r4njcchh4g3mcuvdhqohhu39@4ax.com> <3C14FFDE.97DA740A@attbi.com> Message-ID: <9v57kr02q3i@enews4.newsguy.com> "Chris Barker" wrote in message news:3C14FFDE.97DA740A at attbi.com... ... > IF you figure out how to do this, I'd love to see an example. It owuld > be prettyhandy for me as well. Maybe even a cookbook entry? You mean, something like the following pa.py...: #include static PyMethodDef nomethods[] = { {NULL, NULL} }; void initmod1() { PyObject* m = Py_InitModule("pa.mod1", nomethods); /* add module attributes, if any */ PyModule_AddStringConstant(m, "foo", "bar1"); } void initmod2() { PyObject* m = Py_InitModule("pa.mod2", nomethods); /* add module attributes, if any */ PyModule_AddStringConstant(m, "foo", "bar2"); } void initpa() { PyObject* module; PyObject* package = Py_InitModule("pa", nomethods); if(!package) return; /* add package attributes, if any */ PyModule_AddStringConstant(package, "foo", "bar"); module = PyImport_AddModule("pa.mod1"); if(!module) return; if(PyModule_AddObject(package, "mod1", module)) return; Py_INCREF(module); initmod1(); module = PyImport_AddModule("pa.mod2"); if(!module) return; if(PyModule_AddObject(package, "mod2", module)) return; Py_INCREF(module); initmod2(); } Of course, in real life you'd no doubt use something more substantial as the package's contents, and modules' contents, rather than these feeble "nomethods" and string constants, but, is this the gist of what you mean? I could surely post it as a cookbook recipe, of course. BTW, the setup.py to build this on any platform, just for completeness (but it IS rather obvious of course): from distutils.core import setup, Extension setup (name = "pa", version = "1.0", maintainer = "Alex Martelli", maintainer_email = "aleax at aleax.it", description = "Sample Python multimodule package", ext_modules = [Extension('pa',sources=['pa.c'])] ) Waiting for some feedback (I may have misunderstood, or made some silly mistake, as I just put this together:-) before making a recipe of it... Alex From cmbchris at mac.com Wed Dec 26 23:10:02 2001 From: cmbchris at mac.com (Chris Dutton) Date: Wed, 26 Dec 2001 23:10:02 -0500 Subject: REPOST: Re: Range of characters? References: <3C2A074D.8214E5E0@earthlink.net> Message-ID: <7$--$$-$$$$%_$___$@news.noc.cabal.int> in article 3C2A074D.8214E5E0 at earthlink.net, Mari Mcdade at wurmy at earthlink.net wrote on 12/26/01 12:27 PM: > You don't need the string module, really, but using the literal > string "ABCDEFGHIJKLMNOPQRSTUVWXYZ" seemed a bit ugly. ;-) Well, this is even less ugly then. from string import uppercase as u for c in u: print "%sython" % c or, in my new love, Ruby... for c in "A".."Z" puts "%sython" % c end ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Chris Dutton Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:28:31 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775933 27193 211.57.49.2 (31 Dec 2001 05:18:53 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:18:53 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From kragen at pobox.com Sat Dec 1 07:14:38 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 01 Dec 2001 07:14:38 -0500 Subject: affects on extended modules References: <3C051775.A8D4FD66@bioeng.ucsd.edu> Message-ID: <83pu5zrvbl.fsf@panacea.canonical.org> Curtis Jensen writes: > We have created a python interface to some core libraries of our own > making. We also have a C interface to these same libraries. However, > the the python interface seems to affect the speed of the extended > libraries. ie. some library routines have their own benchmark code, > and the time of exection from the start of the library routine to the > end of the library routine (not including any python code execution), > takes longer than it's C counterpart. In the Python version, the code is in a Python extension module, right? A .so or .dll file? Is it also in the C counterpart? (If that's not it, can you provide more details on how you compiled and linked the two?) In general, referring to dynamically loaded things through symbols --- even from within the same file --- tends to be slower than referring to things that aren't dynamically loaded. What architecture are you on? If you're on the x86, maybe Numeric is being stupid and allocating things that aren't maximally aligned. But you'd probably notice a pretty drastic difference in that case. ... or maybe Numeric is being stupid and allocating things in a way that causes cache-line contention. Hope this helps. From peoter_veliki at hotmail.com Sun Dec 2 22:57:44 2001 From: peoter_veliki at hotmail.com (Peoter Veliki) Date: Sun, 2 Dec 2001 19:57:44 -0800 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: Perhaps this is besides the point of the original posting, but...... With tabs, each person can set the indenting width to whatever value he/she likes best. As one person pointed out, a tab is a variable. This flexibility is tantamount to a "separation of style and content". This is an argument *for* using tabs. > >let's see, I like 4 spaces, he like 8 and she likes 6 and so on. That > > I'm sure glad you like 4, because if you were working on my team, > that's exactly the way one indents python. And well, if you don't > like the coding standard, I suppose you can always find another > project, eh? :) From sdm7g at Virginia.EDU Wed Dec 19 20:22:42 2001 From: sdm7g at Virginia.EDU (Steven Majewski) Date: Wed, 19 Dec 2001 20:22:42 -0500 (EST) Subject: was: Take 2: PEP draft for expression embedding In-Reply-To: Message-ID: Ok: how about something like this (using 2.2 -- the same thing is possible with earlier versions, but defined slighly differently): >>> class D(dict): ... def __init__( self, d ): ... self.d = d ... def __getitem__(self, key ): ... try: ... return self.d[key] ... except KeyError: ... return eval(key, self.d) ... I'm just pasting this from a python session: the class needs a descriptive name: class EvaluatingDict ? >>> e = D(locals()) >>> e['sin'] >>> e['x'] 0.5 >>> e['sin(x)'] 0.47942553860420301 Got the idea ? Now use that evaluating dict with a format string: >>> "X=%(x)s, sin(x)=%(sin(x))s" % e 'X=0.5, sin(x)=0.479425538604' -- Steve From issac at myfirstlink.net Sun Dec 30 21:05:14 2001 From: issac at myfirstlink.net (Issac) Date: Sun, 30 Dec 2001 20:05:14 -0600 Subject: listtree.py crash Message-ID: <015a01c1919f$967df7f0$6401a8c0@mojave> ActiveState Python 2.1.1 and 2.2 both reject the listtree.py tkinter demo (from the Python 2.2 source distro) : $ python listtree.py listtree.py Traceback (most recent call last): File "listtree.py", line 37, in ? main() File "listtree.py", line 33, in main list = listtree(f, app) File "listtree.py", line 11, in listtree listnodes(list, app, '.', 0) File "listtree.py", line 15, in listnodes klass = list.send(app, 'winfo', 'class', widget) File "c:\Python21\lib\lib-tk\Tkinter.py", line 582, in send return self.tk.call(('send', interp, cmd) + args) TclError: invalid command name "send" Does anyone know how to fix this? Issac --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.310 / Virus Database: 171 - Release Date: 12/19/2001 From usenet at thinkspot.net Sat Dec 29 14:53:46 2001 From: usenet at thinkspot.net (Sheila King) Date: Sat, 29 Dec 2001 11:53:46 -0800 Subject: OT: Gender-based security? (was Re: Fate of win32all?) References: <7876a8ea.0112212116.2ebabc23@posting.google.com> <3C2BABD5.1070907@skippinet.com.au> Message-ID: On 29 Dec 2001 10:15:14 -0800, aahz at panix.com (Aahz Maruch) wrote in comp.lang.python in article : > [BTW, Bruce, could you please make sure to attribute quotes? Makes > threads a lot easier to follow.] > > In article , > Bruce Eckel wrote: > >Mark Hammond: > >> > >>Thanks to everyone who replied to this thread - I really appreciate the > >>supportive words. I am very sure I will land on my feet, so there is no > >>need to worry (now if someone would just tell that to my girlfriend :) > > > >Women are wired different -- they look to security first. > > Nope. Perhaps you need to be introduced to some of the women I know. > Of course, they *do* tend to prefer Perl.... I did want to say something about that. Well, it doesn't apply to me too strongly. I'm the kind of person who changed my major as an undergrad, based on enjoying what I was studying rather than having a career to go to when I finished. (I figured...*something* would turn up.) Just this past year, I quit my job of 18 years, to go to something where my income is not guaranteed in order to enjoy my life more. Heck, maybe I'm a man in a woman's body???? Well, my husband does have the better paying job of the two of us, so maybe that gives me some freedom. And he is very supportive of me. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org/ From jslowery at hotmail.com Mon Dec 17 03:23:29 2001 From: jslowery at hotmail.com (Jeremy Lowery) Date: Mon, 17 Dec 2001 02:23:29 -0600 Subject: local variables in exec Message-ID: a snipplet would be describe this. >>> x = 100 >>> def f(): ... print x ... >>> f() 100 >>> lns = {x: '4500'} >>> fc = 'def f(): print x' >>> bc = compile(fc, '', 'exec') >>> exec bc in lns >>> lns['f']() Traceback (most recent call last): File "", line 1, in ? File "", line 1, in f NameError: global name 'x' is not defined >>> why doesn't this work? From pythonnet at hotmail.com Tue Dec 25 02:48:17 2001 From: pythonnet at hotmail.com (Andrew Nguyen) Date: 24 Dec 2001 23:48:17 -0800 Subject: How do I access DoS thru Python? Message-ID: <40dbad98.0112242348.46af380f@posting.google.com> Well, the subject answers it... From 102030405 at gmx.net Sat Dec 1 16:00:40 2001 From: 102030405 at gmx.net (Ralf Claus) Date: Sat, 1 Dec 2001 22:00:40 +0100 Subject: a function like net send Message-ID: <9ubge7$vbg$01$1@news.t-online.com> Hello, how can i produce a function like 'net send' (win32) I don't want to import the os module. Thanks in advance -- Gru? Ralf From mwh at python.net Mon Dec 3 06:21:12 2001 From: mwh at python.net (Michael Hudson) Date: Mon, 3 Dec 2001 11:21:12 GMT Subject: Access input line on NameError? References: Message-ID: gb at cs.unc.edu writes: > Can I get access to the offending text line of the input when I take a > NameError exception? I see that it is available on a SyntaxError but I > can't seem to find it on a NameError. I think you can use the traceback module to do this. Or if you like getting your hands dirty, use sys.exc_info() and grub around with frame and code objects yourself. Cheers, M. -- One of the great skills in using any language is knowing what not to use, what not to say. ... There's that simplicity thing again. -- Ron Jeffries From robin at jessikat.fsnet.co.uk Mon Dec 17 19:34:17 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Tue, 18 Dec 2001 00:34:17 +0000 Subject: Why no match? References: Message-ID: In article , Skip Montanaro writes > > Robin> my own stupidity the patter should be > Robin> re.compile(r'^self\s*\.\s*test\s*=\s*\d+\s*$').match('self.test=11') > >Also, if you're using the match method there's no need to include "^" at the >start. (Are there siutations where it makes a difference?) > perhaps perhaps -- Robin Becker From pzw1 at hotmail.com Thu Dec 13 16:44:10 2001 From: pzw1 at hotmail.com (Peter Wang) Date: 13 Dec 2001 13:44:10 -0800 Subject: Calling member functions? References: Message-ID: "David Dawkins" wrote: > class Handler: > def Callback(self): > print "Callback called" > class Notifier: > def __init__(self, object, method): > self.m_object = object > self.m_method = method > def notify(self): > ## Now what?? > self.m_method(self.m_object) ## naive attempt > h = Handler() > n = Notifier( h, h.Callback ) > h.notify() # I want this to do h.Callback() in effect (i'll assume you mean n.notify in the last line.) when you instantiate n with "h.Callback", you're assigning a *bound* function reference to n.m_method. you can see this by just printing out the value of n.m_method. you'll get something like: thus, when you call m_method(), you don't have to provide an instance for the "self" variable because the function is already bound to an instance (specifically, to h). if you change your code a little bit to the following: class Notifier: def __init__(self, object, method): self.m_object = object self.m_method = method def notify(self): self.m_method(self.m_object) ## naive attempt h = Handler() n = Notifier(h, Handler.Callback) n.notify() this will also work. notice that here, n is instantiated with an *unbound* function, named Handler.Callback (which is different from h.Callback). in this case, if you want to call n.m_method(), you have to provide an instance for the "self" parameter, so you have to pass in self.m_object. incidentally, if you print out the value of n.m_method in this modified code, you get: HTH, peter From gh_pythonlist at gmx.de Wed Dec 5 01:22:33 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Wed, 5 Dec 2001 07:22:33 +0100 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) In-Reply-To: <01120417475903.01465@logiplex1.logiplex.net> References: <01120417475903.01465@logiplex1.logiplex.net> Message-ID: <20011205062232.GA1595@lilith.hqd-internal> Le 04/12/01 ? 17:47, Cliff Wells ?crivit: > On Tuesday 04 December 2001 16:58, Tim Peters wrote: > > > I've lost track, but I'm pretty sure it was either because the example > > used tabs, or because it used spaces. > > After reading this entire thread, I think there are valid arguments on > both sides, so I'll be avoiding both tabs and spaces in all my code. Better? Seperatation of representation and semantics? The obvious disadvantage of an XML representation of sourc code would be that we would need *really good* editors to make it not painful. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From BPettersen at NAREX.com Thu Dec 20 16:00:53 2001 From: BPettersen at NAREX.com (Bjorn Pettersen) Date: Thu, 20 Dec 2001 14:00:53 -0700 Subject: Bug in % string formatting? Message-ID: <60FB8BB7F0EFC7409B75EEEC13E20192158CAC@admin56.narex.com> > From: Fernando P?rez [mailto:fperez528 at yahoo.com] > > If this is not a bug in % string formatting, I'd love to > understand what is > going on. > > The example code is: > > names = {'John' : ('John Doe','jodoe at nowhere'), > 'Jane' : ('Jane Doe','jadoe at nowhere'), > } > > format_string = '%s <%s>\n%s <%s>' > > format_list = names['John'][:] + names['Jane'][:] > > # This works ok > print 'With prebuilt list:' > print format_string % format_list > > # but this fails. The format string is copied verbatim from > above print 'Explicit list construction:' print format_string > % names['John'][:] + names['Jane'][:] The % operator binds tighter than +, so what you really wrote above (minus useless [:]) was: print (format_string % names['John']) + names['Jane'] To get what you expected you need to use explicit parentheses: print format_string % (names['John'] + names['Jane']) Hth, -- bjorn From rdsteph at earthlink.net Wed Dec 5 07:37:53 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Wed, 05 Dec 2001 12:37:53 GMT Subject: Learning resources needed References: <9ukp40$90u84$1@ID-106629.news.dfncis.de> Message-ID: <3C0E1662.172C318B@earthlink.net> You might want to look at my book reviews at http://www.awaretek.com/plf.html Also some gui stuff Duke wrote: > I am looking to learn Python/Tkinter. I'm a competent C/C++/Java > programmer, however I don't have any experience with Tcl/Tk. I think I can > easily pick up Python from the stuff I found linked on python.org, however I > would be interested in any or all resources specifically addressing > Tkinter - if there are any which cater to a beginning Python user, all the > better. > The other alternative is to buy a book. There only seems to be one specific > to this (Python and Tkinter Programming, John E. Grayson) and it's gotten > mixed reviews as far as I can tell. Should I give Tcl a shot as well? > Seems to me that Python is, in a way, competing with Tcl as the scripting > engine behind the Tk toolkit. If I learn Tcl/Tk first would it be > relatively simple to move over to Python/Tkinter? > And oh yeah, I've always hated GOOEY programming and this is the first > compromise I am willing to make to get something going on the > non-command-line front ;) > > Thx. > > P.S. Anyone recommending vxPython instead? My main gripe would be that it > wouldn't run in KDE while Tkinter should run in both it & GNOME. Easy[er] > Windblows client libs install is a plus. From russb at jump.net Mon Dec 3 16:31:03 2001 From: russb at jump.net (Russell Briggs) Date: 3 Dec 2001 13:31:03 -0800 Subject: Displaying multiple results in a list Message-ID: <741f261e.0112031331.75c2e1c6@posting.google.com> Wanted to know if there was a way to specify ranges in a list such as: newlist = ["1", "2", "3", "4", "5", "6"] print newlist[1..3] #ie: print newlist[1], newlist[2], newlist[3] Can something like this be done? /russ From loewis at informatik.hu-berlin.de Fri Dec 28 18:20:05 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 29 Dec 2001 00:20:05 +0100 Subject: ETA for Win32all under Python 2.2? References: Message-ID: David Brady writes: > P.S. There's a longstanding rule in my family: you're > not allowed to complain about anything you could fix > yourself. I'd offer to help, but "a beating" was the > funnier of the two threats. :-) Did you even try to build the package from source??? The source code that was used for 2.1 should work without modification for 2.2, too (if it doesn't, please submit a bug report). Regards, Martin From krissepu at vip.fi Thu Dec 6 14:21:55 2001 From: krissepu at vip.fi (Pekka Niiranen) Date: Thu, 06 Dec 2001 21:21:55 +0200 Subject: license key validation - encryption/decryption References: <9ujgam$a1e$1@news1.xs4all.nl> Message-ID: <3C0FC553.62760259@vip.fi> Hi, maybe you could tie the license to the MAC -address of their network card. Make python to check it thru some system call (ipconfig /all => parse the result in program (it is stored into *pyd -file) => compare to license periodically at runtime) -pekka- From debl2nononospammywhammy at bellatlantic.net Tue Dec 25 20:34:10 2001 From: debl2nononospammywhammy at bellatlantic.net (David Lees) Date: Wed, 26 Dec 2001 01:34:10 GMT Subject: set decimal place References: <3c291037.4684696@news.tm.net.my> Message-ID: <3C292938.ED322C60@bellatlantic.net> >>> print '%8.1f' % (17.0/4) 4.3 >>> print '%8.4f' % (10.0/4) 2.5000 >>> print '%8.2f' % (20.0/7) 2.86 >>> print '%8.5f' % (20.0/7) 2.85714 David Lees kwsiew at tm.net.my wrote: > > is there a way(or any function) to set decimal place in python(to any > decimal place I want) > example : > 1)17.0/4 = 4.25 (but I want it to be 4.3) > 2)10.0/3 = 3.3333333333333335 (I want 3.3333 - 4 decimal place) > 3) 20.0/7 = 2.8571428571428572( I want 2.86 or 2.85714) > > thank you > rgds, > SKW From kragen at pobox.com Sat Dec 1 04:16:27 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 01 Dec 2001 04:16:27 -0500 Subject: Python evangelists unite! References: Message-ID: <83snavti50.fsf@panacea.canonical.org> writes: > In truth, all less dynamic languages *wish* they had this > feature. Since they don't developers instead have two additional pieces of > work when creating a new class: (1) they have to figure out up front the > total collection of possible attributes/properties instances can have, and > (2) they have to set them to some null-like value if those attrs/props > are not present. So instead of an instance simply not having a property, > all other instances have to have a property with a value that means they > don't have that property. Wow. I do this all the time in Python, simply because it's easier to write (and read): if self.property is None: self.property = self.computeproperty() than try: self.property except AttributeError: self.property = self.computeproperty() or if not hasattr(self, 'property'): # especially when it's __property self.property = self.computeproperty() From hamish_lawson at yahoo.co.uk Tue Dec 11 13:52:26 2001 From: hamish_lawson at yahoo.co.uk (Hamish Lawson) Date: 11 Dec 2001 10:52:26 -0800 Subject: lost interest? References: <20011208001123.A5989@casa.parque> Message-ID: <915a998f.0112111052.85e9570@posting.google.com> Justin Sheehy wrote: > I'd ask a different question from yours. Why is it a problem that > Python doesn't have an equivalent to CPAN? "Perl has it" isn't > enough. The Vaults of Parnassus is a great resource for cataloguing Python modules, but the fact that it doesn't actually host the modules means that a link may not always work, whether temporarily or more permanently. I'd welcome having a number of replicated repositories that provided a permanent home for modules. Hamish Lawson From danielk at aracnet.com Thu Dec 6 09:33:42 2001 From: danielk at aracnet.com (Daniel Klein) Date: Thu, 06 Dec 2001 06:33:42 -0800 Subject: getting the name of a variable References: <4iuu0ukgrhokpphmg31t1lj6qks67irr23@4ax.com> Message-ID: Forgot to mention, if var cannot be found in the globals() dicitonary, it will throw a KeyError exception. A slight modification to the function will handle this >>> def varname(var): var = str(var) try: print var + " : " + str(globals()[var]) except KeyError: print var + " : " >>> varname('zz') zz : Dan On Thu, 06 Dec 2001 06:03:11 -0800, Daniel Klein wrote: >Assuming the variable is user-defined (not in __builtins__) and is not >local to the function/method... > >>>> x = 42 >>>> y = ['a','b','c'] >>>> def varname(var): > print str(var) + " : " + str(globals()[var]) > >>>> varname('x') >x : 42 >>>> varname('y') >y : ['a', 'b', 'c'] >>>> > >Daniel Klein > > >On 6 Dec 2001 04:47:37 -0800, sandskyfly at hotmail.com (Sandy Norton) >wrote: > >>When I'm debugging I'm always sticking stuff like "print 'x:', x" in my code. >>So is there a handy function that will print a variable name and value such that: >> >>>>> def print_var_name_and_value(var): >> "prints variable name : value" >> >> >>>>> variable = 'me var' >>>>> print_var_name_and_value(variable) >>variable : me var >> >> >>Any responses, pointers, hints would be much appreciated. >> >>thanx. >> >>Sandy > From aroach at electriceyeball.com Tue Dec 4 21:13:28 2001 From: aroach at electriceyeball.com (Anthony Roach) Date: Tue, 4 Dec 2001 21:13:28 -0500 Subject: os.spawnve and threads References: Message-ID: Anthony Roach wrote: > I went ahead and submitted a patch that fixes it like you suggested. I even > fixed the the doc strings! To top it all off I ran the scons option-j.py > test, and it now passes. Wow, thanks! I guess this Free software stuff really works! I've never dealt with a proprietary software company that has support this good. I'm impressed! > I'm not a registered Python developer, so it's anyone's guess whether or not > this fix will make it into Python 2.2. Cross your fingers... Fingers crossed... -Anthony From wurmy at earthlink.net Sat Dec 29 18:12:39 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Sat, 29 Dec 2001 23:12:39 GMT Subject: REPOST: Re: Was that to inpolite? Re: Call for a small program References: <3C2BAEF3.CC34B8DD@htp-tel.de> <3C2E0D55.9EC9B67F@htp-tel.de> <3C2E2D00.A8E511EB@earthlink.net> <3C2E34E9.E748DB4F@htp-tel.de> Message-ID: <3$--$$_----__$%_-$@news.noc.cabal.int> Tom Karas wrote: > > Hello Hans, > > > I don't see the message you're referring to. When did you post it? > > the name of the subject / thread is: Call for a small programm X-posting > followup-to comp.lang.python from Friday It doesn't show up in my newsreader. Since others apparently didn't see the message either, I guess something went wrong with posting it, or it got lost in the Usenet vacuum. Now that you have our attention, it's probably a good idea to post the original message again. :-) --Hans ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Hans Nowak Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E4CA4.1A230381 at earthlink.net> Control: cancel <3C2E4CA4.1A230381 at earthlink.net> Date: Mon, 31 Dec 2001 02:25:30 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774504 27193 211.57.49.2 (31 Dec 2001 04:55:04 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:55:04 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From chris.gonnerman at newcenturycomputers.net Thu Dec 13 19:38:21 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Thu, 13 Dec 2001 18:38:21 -0600 Subject: Ordered dictionaries? References: <20011213214515.61016.qmail@web21106.mail.yahoo.com> Message-ID: <004d01c18437$a4d25500$0101010a@local> My Red-Black Tree module at http://newcenturycomputers.net/projects/rbtree.html implements an ordered dictionary, RBDict. ----- Original Message ----- From: "David Brady" To: "Python" Sent: Thursday, December 13, 2001 3:45 PM Subject: Ordered dictionaries? > Hello, > > One last Perl module that I need to replace to > complete my Python toolkit is a custom module that let > me create a dictionary whose keys were settable and > retrievable in a particular order. Essentially, this > let us have a list whose ordered elements were also > accessible by name. > > Has anyone done this? If not, what class operators > would I need to override to create my own class that > does this? > > Example of how it would work, assuming OrderedDict was > a working class of what I wanted: > > >>> od = OrderedDict() > >>> od['Alice'] = 'Anderson' > >>> od['Bob'] = 'Bradley' > >>> od.append('Christiansen') > >>> od.['Dave'] = 'Dobson' > >>> od.keys() > ['Alice', 'Bob', 2, 'Dave'] > >>> od.values() > ['Anderson', 'Bradley', 'Christiansen', 'Dobson'] > >>> od[3] > 'Dobson' > >>> od[7] = 'Johnson' > # Notice assignment does not trigger IndexError > >>> od.values() > ['Anderson', 'Bradley', 'Christiansen', 'Dobson'] > >>> len(od) > 8 > >>> for i in range(len(od)): print od[i] > Anderson > Bradley > Christiansen > Dobson > None > None > None > Johnson > > ...etc. Notice that this is making the python list > act more like a Perl list, which may not be desirable. > Also, I don't know if the None object "exists" in > terms of taking up space in the list, my thinking is > that it shouldn't; that trying to access an undefined > element should create the None object and return it > rather than padding the list with statically-created > None objects. > > Anyway, if anyone has already done this, I'd love to > see it; if not, some tips about where to start would > be wonderful. Is there a canonical list of all the > __functions__ a Python object can have, when they are > called and why, and what they must do if implemented > by a user? > > Thank you, > > -dB > > ===== > David Brady > daves_spam_dodging_account at yahoo.com > I'm feeling very surreal today... or *AM* I? > > __________________________________________________ > Do You Yahoo!? > Check out Yahoo! Shopping and Yahoo! Auctions for all of > your unique holiday gifts! Buy at http://shopping.yahoo.com > or bid at http://auctions.yahoo.com > > -- > http://mail.python.org/mailman/listinfo/python-list > > From s.thuriez at quantaflow.com Fri Dec 7 06:41:55 2001 From: s.thuriez at quantaflow.com (sebastien) Date: 7 Dec 2001 03:41:55 -0800 Subject: reading character in word References: <69e00d8d.0112040959.1e3f7541@posting.google.com> Message-ID: <69e00d8d.0112070341.57640207@posting.google.com> "Steve Holden" wrote in message news:... > "sebastien" wrote ... > > Hi, > > > > Maybe have you encountered my problem : I do not manage to read > > accentuated characters such as ??? ... from a microsoft word > > application using win32com.client. > > > > Here is the programm that I used : > > > > from win32com.client import constants, Dispatch > > > > word= Dispatch('Word.Application') > > mondoc=word.Documents.Open(r"c:\test.doc") > > nombre_caracteres=mondoc.Characters.Count > > for numero_caractere in range (1,int(nombre_caracteres)+1): > > caractere=mondoc.Characters.Item(numero_caractere) > > try: > > print caractere > > except: > > print("cannot read character") > > pass > > > The problem here is a lack of information: you are catching all errors, then > not printing out enough information to see what the exact error is! I > suspect it will be complaining about characters with ordinal values greater > than 127 -- the print statement notoriously fails to handle these. > > > > Everything is fine as soon as I do not use characters with coma accent > > such as ? ? ? in the document... > > > > > > I also tried on my PC to do : > > > > test_input=raw_input("entrer phrase avec accents : ") > > print str(test_input) > > for char in test_input: > > print char,ord(char) > > > > after enterring word using the ???..there is no problem printing the > > correct letters (for exemple ?t?). > > > > There maybe some option in Word that I should set ?? > > > > I hope that someone will have some leads ... > > You need to do a search on Google for something like "Python print Unicode > string" to get advice on conversion to an appropriate encoding before you > print. If this isn't the problem, then remove the try/except and post the > exact message you see. > > regards > Steve There is indeed a unicode problem. If I exceute the following code: ____________________________________________________________ from win32com.client import constants, Dispatch word= Dispatch('Word.Application') mondoc=word.Documents.Open(r"c:\testseb7.doc") nombre_caracteres=mondoc.Characters.Count caractere="" for numero_caractere in range (1,int(nombre_caracteres)+1): caractere=mondoc.Characters.Item(numero_caractere) print caractere #print caractere.encode('latin-1') ______________________________________________________ the error is : File “win32com\gen_py\00020905-0000-0000-c000-000000000046x0x8x1.py, line 9331, in___str__ return str(apply( self.__call__,args)) UnicodeError: ASCII encoding error : ordinal not in range(128) then I tried to convert it to printable caracters or sequence number using : ____________________________________________________ from win32com.client import constants, Dispatch word= Dispatch('Word.Application') mondoc=word.Documents.Open(r"c:\testseb7.doc") nombre_caracteres=mondoc.Characters.Count caractere="" for numero_caractere in range (1,int(nombre_caracteres)+1): caractere=mondoc.Characters.Item(numero_caractere) #print caractere print caractere.encode('utf-8') _______________________________________________________ The error message is : File "E:\Python21\win32com\client\_init__.py". line 348, in __getattr__ AttributeError: encode If I try to use the code : __________________________________________________________ from win32com.client import constants, Dispatch word= Dispatch('Word.Application') mondoc=word.Documents.Open(r"c:\testseb9.doc") nombre_caracteres=mondoc.Characters.Count caractere="" for numero_caractere in range (1,int(nombre_caracteres)+1): caractere=mondoc.Characters.Item(numero_caractere) print unicode(caractere) __________________________________________________________ I get the following error : .... UnicodeError: Ascii encoding error: ordinal not in range(128) I am sure there is a problem with the unicode settings but I do not see how to modify it. Sebastien. From sholden at holdenweb.com Wed Dec 5 12:01:07 2001 From: sholden at holdenweb.com (Steve Holden) Date: Wed, 5 Dec 2001 12:01:07 -0500 Subject: Arrgh (re: ANN: Simple Newsgroup Searchterm Monitor) References: <3c20bba2.19642734@127.0.0.1> Message-ID: "(Five Fresh) Fish" wrote ... > Bugger me, I've never attached a file before, and have no idea why Agent > sent umpteen copies (other than that, obviously, I was doing something > completely wrong.) > > Apo's if there's a half-dozen of my messages. I sent out cancel messages, > so hopefully they won't get to propagate very far. Grrr. > > The script scans a list of newsgroups, searching the subject and header for > search terms. Very simple search, no regex support as yet, but nonetheless > handy for monitoring an industry-specific newsgroup for mention of, say, > your company name. > > Anyone who wants it, follow-up this message and I'll *email* it to you. > I'm giving up on using Agent to post a zipfile. :-) > Couldn't you post it on a web server somewhere? regards Steve -- http://www.holdenweb.com/ From trytop at 21cn.com Sun Dec 9 20:21:55 2001 From: trytop at 21cn.com (luckey) Date: Mon, 10 Dec 2001 09:21:55 +0800 Subject: A common GUI define like rebol VID? Message-ID: <9v12k6$ak9$1@mail.cn99.com> I don't understand why not python define a common GUI like REBOL VID ? From azz at gnu.org Sat Dec 29 13:52:00 2001 From: azz at gnu.org (Adam Sampson) Date: 29 Dec 2001 18:52:00 +0000 Subject: Can't exit python with ^D under certain circumstances References: <1c1X7.79465$7l5.52086@atlpnn01.usenetserver.com> Message-ID: <87itap271r.fsf@cartman.azz.us-lot.org> "Steve Holden" writes: > The real question is why the end of file you send to your local ssh > client doesn't make it through to the Python interpreter as an EOF, > but instead (apparently) gets transmitted as a character. Perhaps Ctrl-D isn't the default EOF character on his system? "stty -a" should show what eof is set to; to change it to Ctrl-D, do "stty eof '^D'". I've run into this before with intr being set to ^? instead of ^C on an old HP machine... -- Adam Sampson From mwh at python.net Sat Dec 29 14:16:59 2001 From: mwh at python.net (Michael Hudson) Date: Sat, 29 Dec 2001 19:16:59 GMT Subject: pty.spawn() and friends References: Message-ID: "James T. Dennis" writes: > So naturally I tried to implement the simplext expect script > (autopasswd) as a Python script using the pty.spawn() function. Dunno what that does, but I've been able to do things using os.forkpty directly, and not going near the pty module. This makes your code less portable, but at least I could get it to work. Cheers, M. From paul at boddie.net Mon Dec 10 16:14:44 2001 From: paul at boddie.net (Paul Boddie) Date: 10 Dec 2001 15:14:44 -0600 Subject: Dr. Dobb's Python-URL! - weekly Python news and links (Dec 10) Message-ID: comp.lang.python: where else are programmers so ready to compute femtosecond intervals? Since Python Enhancement Proposals (PEPs) became part of the process of improving Python, quite a few have been floated, flamed and even accepted and appreciated. James Althoff isn't merely content to wait for others to polish PEP 276, however, which wants to let you write your integer ranges in a nicer way. http://groups.google.com/groups?selm=mailman.1007424313.28420.python-list%40python.org Bizarre "bug or feature" of the week goes to request #210830 - available at... http://sourceforge.net/tracker/?group_id=5470&atid=105470&func=detail&aid=210830 http://groups.google.com/groups?threadm=6ac595a2.0112041944.75dab62b% 40posting.google.com&rnum=1 On the subject of "debugging for dummies", some interesting tricks with Michael Hudson's pyrepl are showcased. If you've been happy with trace statements and just aren't motivated to set up that debugger, then this might be for you! http://groups.google.com/groups?selm=3b091a1c.0112060650.1f185978%40posting.google.com The Refereed Paper Track of IPC10--titles, authors, Best Paper Award nominations, ...--is complete. http://www.python10.org/p10-paperTrack1.html Providing COM servers on Windows platforms isn't hard when Duncan Booth posts an example of how it can be done. http://groups.google.com/groups?selm=Xns916E9F71480C7duncanrcpcouk%40127.0.0.1 Duncan's code must be formatted with spaces in order to survive the ravages of the Internet, which brings us to a point of contention... tabs or spaces - which form of indentation should be banned?! Fredrik Lundh attempts to draw the discussion to a close, inadvertently revealing his own indentation preference. http://groups.google.com/groups?selm=lrTO7.728%24l93.293881%40newsb.telia.net In the heat of the discussion light emerges from Tony J Ibbs' corner of the debating chamber, where he refers us to the work of Logilab; happen if people started to plug all these XML tools together... http://groups.google.com/groups?selm=mailman.1007633352.28265.python-list%40python.org http://www.logilab.org/pypasax/ ActiveState releases Visual Python 1.0, the Python plugin to Visual Studio .NET. Features include: syntax-aware editor, auto-indenting, code folding, Python-specific debugger, ... http://www.ActiveState.com/VisualPython Guido and friends are not the only people inspired by the "original" Python. Some of the results are more directly derived from the works of the comedy team in question, though. (Sadly, you'll need access to "proprietary" video players to get the benefit of this final URL for the week.) http://www.lego.com/eng/studios/studioinfo/montypython.as ======================================================================== Everything you want is probably one or two clicks away in these pages: Python.org's Python Language Website is the traditional center of Pythonia http://www.python.org Notice especially the master FAQ http://www.python.org/doc/FAQ.html PythonWare complements the digest you're reading with the daily python url http://www.pythonware.com/daily comp.lang.python.announce announces new Python software. Be sure to scan this newly-revitalized newsgroup at least weekly. http://groups.google.com/groups?oi=djq&as_ugroup=comp.lang.python.announce Michael Hudson continued Andrew Kuchling's marvelous tradition of summarizing action on the python-dev mailing list once every other week, into July 2001. Any volunteers to re-start this valuable series? http://starship.python.net/crew/mwh/summaries/ http://www.amk.ca/python/dev The Vaults of Parnassus ambitiously collect Python resources http://www.vex.net/~x/parnassus/ Much of Python's real work takes place on Special-Interest Group mailing lists http://www.python.org/sigs/ The Python Software Foundation has replaced the Python Consortium as an independent nexus of activity http://www.python.org/psf/ Cetus does much of the same http://www.cetus-links.de/oo_python.html Python FAQTS http://python.faqts.com/ The old Python "To-Do List" now lives principally in a SourceForge reincarnation. http://sourceforge.net/tracker/?atid=355470&group_id=5470&func=browse http://python.sourceforge.net/peps/pep-0042.html Python Journal is at work on its second issue http://www.pythonjournal.com Links2Go is a new semi-automated link collection; it's impressive what AI can generate http://www.links2go.com/search?search=python Tenth International Python Conference http://www.python10.org Archive probing tricks of the trade: http://groups.google.com/groups?oi=djq&as_ugroup=comp.lang.python&num=100 http://groups.google.com/groups?meta=site%3Dgroups%26group%3Dcomp.lang.python.* Previous - (U)se the (R)esource, (L)uke! - messages are listed here: http://www.ddj.com/topics/pythonurl/ http://purl.org/thecliff/python/url.html (dormant) or http://groups.google.com/groups?oi=djq&as_q=+Python-URL!&as_ugroup=comp.lang.python Suggestions/corrections for next week's posting are always welcome. [http://www.egroups.com/list/python-url-leads/ is hibernating. Just e-mail us ideas directly.] To receive a new issue of this posting in e-mail each Monday morning, ask to subscribe. Mention "Python-URL!". -- The Python-URL! Team-- Dr. Dobb's Journal (http://www.ddj.com) is pleased to participate in and sponsor the "Python-URL!" project. >From paul at boddie.net Thu Dec 6 05:27:59 2001 Received: from mx13.nameplanet.com (mail at mx13.nameplanet.com [62.70.3.43]) by starbase.neosoft.com (8.9.3/8.9.3) with SMTP id FAA68477 for ; Thu, 6 Dec 2001 05:27:58 -0600 (CST) (envelope-from paul at boddie.net) From: paul at boddie.net Received: 6 Dec 2001 11:18:24 -0000 Received: from unknown (HELO www3.nameplanet.com) (192.168.2.43) by mx13 with SMTP; 6 Dec 2001 11:18:24 -0000 Received: (qmail 3544 invoked by uid 400); 6 Dec 2001 11:18:24 -0000 Date: 6 Dec 2001 11:18:24 -0000 Message-ID: <20011206111824.3543.qmail at www3.nameplanet.com> To: claird at starbase.neosoft.com MIME-Version: 1.0 Subject: Re: How would you like Content-Type: text/plain Content-Transfer-Encoding: 7bit Status: R Hello, Well, it looks fairly straightforward, in that it's an extension of my usual activities of surfing and gathering. From the Python-URL! messages of the past, I can see that there's a top section specific to the week's activities, and there's a bottom section which contains generic references which appear more or less unchanged each time. >From the Tcl-URL! digest guidelines document you referred to in your message, I assume that I'll be preparing the top section of Python-URL! and sending it off to you for the "boilerplates" to be added, and that this would need to be done before the 5am CST deadline each Monday - that would be 11am GMT wouldn't it? I think I can handle the pressure, so if I understand the job's responsibilities correctly, then I will gladly take you up on your offer. It might even widen my perspectives somewhat in the process. :-) When do I start?! Regards, Paul -- Get your firstname at lastname email at http://Nameplanet.com/?su -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From mwh at python.net Sun Dec 30 05:26:02 2001 From: mwh at python.net (Michael Hudson) Date: Sun, 30 Dec 2001 10:26:02 GMT Subject: How to do "ANN:"? References: Message-ID: Harry George writes: > A couple of times I've tried to annouce package upgrades using "ANN:" > entries to c.l.p and c.l.p.a, but nothing shows up. Is there a magic > decoder ring? Well, for clpa you have to wait for the moderators' christmas hangovers to fade. > Most recently, updates for mkpythonproj, pdx, and pyperlish. I've just approved those. Hopefully they'll show up soon. (20 messages in the queue: 4 approvals, 16 discards, sigh). Cheers, M. From slzatz at hotmail.com Sun Dec 30 00:15:36 2001 From: slzatz at hotmail.com (Steve Zatz) Date: Sun, 30 Dec 2001 05:15:36 GMT Subject: Help - command line arguments Message-ID: I am new to Python and although I am sure that the following is obvious I can't figure the following out or find an answer in any of the texts that I have access to. My question is: Can you run a script that takes command line arguments from within the Python shell or from the Python command line? For example, something like: test.py -a -b runs fine from the *Windows XP* command prompt. >From the Python command line, I can do the following: import test test.main() which doesn't produce an exception but I can't figure out how to input the command line arguments. And from the Python Shell, just running test.main() produces a getopt exception which does not occur when it runs from the Python command line. (But in either case, I can't figure out how to use command line arguments.) Again, any help would be appreciated. Thanks. From waalp at pissed.co.uk Tue Dec 18 04:56:44 2001 From: waalp at pissed.co.uk (waalp) Date: Tue, 18 Dec 2001 10:56:44 +0100 Subject: implementing a timer? Message-ID: <9vn0gv$ll6$1@colo.mobo-it.nl> I'm trying to make a script that will check if i have mail every let's say 10 minutes.So i tought let's use something like a timer. But i can't find any documentation on how to implement something like this. I'm a beginner so it could be that i haven't looked in the right places. Could somebody please help? Thanks, Peter From wtr at hannover.sgh-net.de Tue Dec 11 15:45:36 2001 From: wtr at hannover.sgh-net.de (Wolfgang Teschner) Date: Tue, 11 Dec 2001 21:45:36 +0100 Subject: jpeg files displayed in a loop References: <9v53nf02hm6@enews4.newsguy.com> Message-ID: On Tue, 11 Dec 2001 15:03:28 +0100, "Alex Martelli" wrote: > >"Wolfgang Teschner" wrote in message >news:rp8a1u82me3g8v8ievtfjve9llbodq6rau at 4ax.com... >> Hi, >> I want to automatically display all jpeg files of a dir in a long >> loop, with a wait time between the different displays. Just that. >> No user input. >> With PIL, it seems to be impossible because of TKinters mainloop. > >Why impossible? Doesn't Tkinter's "after()" method provides just >what you need -- sheduling some action (in your case, moving to >the next image) for X seconds from now? > Hello, Alex, thank you for your idea! I have never used TKinter before (I was exposed to Python just 6 months ago and "worked with it for not more than 3 weeks in that time), so I didn't know of the existence of something like "after()". I didn't find it in the examples, either (viewer.py, plyer.py all do different things). So I was lost... I just thought I had a small problem which I could have solved by browsing through the examples and then start to build-up from them. Ok, now I can give it another try! Thanks, again, wolfgang > >Alex > > From grey at despair.dmiyu.org Mon Dec 3 18:51:27 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Mon, 03 Dec 2001 23:51:27 -0000 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <3C0BE492.5DACEA18@mega-nerd.com> Message-ID: On Mon, 03 Dec 2001 20:46:10 GMT, Erik de Castro Lopo wrote: > You really ought to try using nothing but tabs for indentation and setting > the tab width in your editor to whatever you prefer. > This is so easy and works **SO** well. Until you answer it here is the only reply you will get because I am tired of reiterating that it is NOT "style" and "preference". some_dict = {'Jane':{'Age':'21', 'Dept':'0001', 'Ext':'1234'}, 'John':{'Age':'22', 'Dept':'0010', 'Ext':'5678'}, 'Jeff':{'Age':'23', 'Dept':'0100', 'Ext':'9009'}, 'Jody':{'Age':'24', 'Dept':'1000', 'Ext':'8765'}, 'Jeny':{'Age':'25', 'Dept':'0110', 'Ext':'4321'} } What if I use 4 and you use 8? some_dict = {'Jane':{'Age':'21', 'Dept':'0001', 'Ext':'1234'}, 'John':{'Age':'22', 'Dept':'0010', 'Ext':'5678'}, 'Jeff':{'Age':'23', 'Dept':'0100', 'Ext':'9009'}, 'Jody':{'Age':'24', 'Dept':'1000', 'Ext':'8765'}, 'Jeny':{'Age':'25', 'Dept':'0110', 'Ext':'4321'} } The other way around? some_dict = {'Jane':{'Age':'21', 'Dept':'0001', 'Ext':'1234'}, 'John':{'Age':'22', 'Dept':'0010', 'Ext':'5678'}, 'Jeff':{'Age':'23', 'Dept':'0100', 'Ext':'9009'}, 'Jody':{'Age':'24', 'Dept':'1000', 'Ext':'8765'}, 'Jeny':{'Age':'25', 'Dept':'0110', 'Ext':'4321'} } You get it yet? You finally understand that preference SCREWS UP THE INTENT AND READABILITY OF THE ABOVE EXAMPLE WHICH IS NOT ALL THAT UNCOMMON? Yeesh. 3 days now and you still haven't address that real and valid concern! -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From altis at semi-retired.com Wed Dec 19 14:22:13 2001 From: altis at semi-retired.com (Kevin Altis) Date: Wed, 19 Dec 2001 11:22:13 -0800 Subject: WYSIWYG text Editor in python? References: <3C1DDCAC.C477A0A6@cicei.ulpgc.es> Message-ID: I believe that wxTextCtrl uses RichEdit under win32 when the wxTE_RICH style flag is used in wxPython or wxTE_RICH | wxTE_MULTILINE. Of course, all of RichEdit is "hidden" behind the wxTextCtrl API. demo.py included with wxPython 2.3.1 or higher (the latest is 2.3.2) includes a demo of using wxTE_RICH to set styled text in the control. ka "Neil Hodgson" wrote in message news:N1tT7.20847$_z.56740 at news-server.bigpond.net.au... > Enrique > > ... need a MS-Word-like text editor > > RichEdit is built into windows and is fairly capable - WordPad is a very > simple use of RichEdit. [This URL will need unwrapping] > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/riche > dit_94xg.asp > > > able to render on screen text in bold, [OK] > > italics, [OK] > > underline, [OK] > > greek symbols [OK] and > > super/subscripts. [Available in recent versions as CFM_SUBSCRIPT / > CFM_SUPERSCRIPT but not exposed in WordPad]. > > I work with MS-Windows. > > RichEdit was previously used as the editor for Python source code within > PythonWin until Mark and I replaced it with Scintilla. Scintilla is better > than RichEdit for source code but worse for documents. > > In a quick search I couldn't find a Python demonstration of RichEdit. > > Neil > > > From ungrzr2 at ubatxbat.pbz Fri Dec 14 20:09:04 2001 From: ungrzr2 at ubatxbat.pbz ({-- Rot13 - Hateme) Date: 15 Dec 2001 01:09:04 GMT Subject: Wrap C function which takes variable lengthed parameters? References: <6p5j1u0oag2ofkam8o7fig5dvkfc2392hk@4ax.com> <3C19990E.BE0F3FA@alcyone.com> <3C19AC0B.7ABD04DF@xs4all.nl> <1gbj1u8pm1t63ao6bjq98jlh66glf78fnu@4ax.com> Message-ID: Michael Hudson wrote in news:uzo4mgk9e.fsf at python.net: > "{-- Rot13 - Hateme" writes: > >> But still I have no idea how to construct a list of arguements >> passed in from python. There are no standard function calls to >> create a va_list by handle. > > I'm not quite sure what you are asking (probably my fault), but you > might want to look at the implementation of, say, Py_BuildValue and > Py_VaBuildValue in the Python source (they're in Python/modsupport.c, > I think ... yup). > What I want is to somehow construct a va_list from a python list. And then pass the va_list to a C funciton which ask for a va_list. Say a list of the form ['arg1', 'arg2', 'arg3'] to a va_list contains va_list va; // ("arg1", &arg1, "arg2", &arg2, "arg3", &arg3) Then pass the va_list to a function like: int GetAttribute(ID id, va_list va); The Py_BuildValue/Py_VaBuildValue parse a va_list and return a python tuple object. I was looking for an opposite process: tuple->va_list. I try to find a standard way to build a va_list at runtime. Or maybe there some way for python C API which can pass me a va_list from python code(not really feasible, I think.) Thanks. From sholden at holdenweb.com Fri Dec 28 11:33:43 2001 From: sholden at holdenweb.com (Steve Holden) Date: Fri, 28 Dec 2001 11:33:43 -0500 Subject: REPOST: Re: Can't exit python with ^D under certain circumstances References: Message-ID: <4$--$$_----__--$%$@news.noc.cabal.int> "wealthychef" wrote in message news:mailman.1009322789.23019.python-list at python.org... > Hi, this is weird to me, don't know how to fix. > On my local python installation on machine A in a normal shell, ^ > D works to exit Python as expected. On machine B on the > console, ^D also works fine, but if I ssh to machine B from > machine A and try to exit Python with ^D, Python does not exit, > instead I get the following strange error message: > > >>> ^D > File "", line 1 > c > ^ > SyntaxError: invalid syntax > > What is printing here as a little 'c' is showing up in the terminal > as maybe > > E > F > > crammed into one character, or > > F > F > > I can't quite read it. > Can anyone help me? I'm no xmodmap dude, but i suspect > some sort of keyboard confusion. The two systems are different. > Machine A is running one flavor of Unix, and machine B is > running another, each with radically different hardware. > Is there another way to exit Python? Workaround? Fix? Thanks. > The "E and F rammed into a single character" sounds like a representation of "EOF" as a graphic. The real question is why the end of file you send to your local ssh client doesn't make it through to the Python interpreter as an EOF, but instead (apparently) gets transmitted as a character. In the meantime, you can terminate the interpreter with something like: import sys sys.exit("No more Python!") regards Steve -- http://www.holdenweb.com/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.berkeley.edu!ucberkeley!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Steve Holden" Newsgroups: comp.lang.python Subject: cmsg cancel <1c1X7.79465$7l5.52086 at atlpnn01.usenetserver.com> Control: cancel <1c1X7.79465$7l5.52086 at atlpnn01.usenetserver.com> Date: Mon, 31 Dec 2001 03:03:56 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775253 27193 211.57.49.2 (31 Dec 2001 05:07:33 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:07:33 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From pinard at iro.umontreal.ca Wed Dec 19 18:00:16 2001 From: pinard at iro.umontreal.ca (=?iso-8859-1?q?Fran=E7ois?= Pinard) Date: 19 Dec 2001 18:00:16 -0500 Subject: moderator: please unsubscribe me! In-Reply-To: References: Message-ID: [John Roth] > This is not a mailing list. It is a mailing list for many of us. I think it gets gatewayed into a newsgroup. -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From tjreedy at home.com Sat Dec 1 03:29:04 2001 From: tjreedy at home.com (Terry Reedy) Date: Sat, 01 Dec 2001 08:29:04 GMT Subject: A modest indentation proposal References: <3C0773C2.A12D0BAC@pacific.net.hk> Message-ID: "Erann Gat" wrote in message news:gat-3011012340480001 at 192.168.1.50... > Ah, I think I understand the problem. What I meant was that a semicolon > would designate the end of the block to the *editor*, which would use that > information together with colons to provide an auto-indent facility. Why is ';\n' better for that than '\n'? Terry J. Reedy From daves_spam_dodging_account at yahoo.com Thu Dec 27 13:15:27 2001 From: daves_spam_dodging_account at yahoo.com (David Brady) Date: Thu, 27 Dec 2001 10:15:27 -0800 (PST) Subject: Replacing ActivePython? Message-ID: <20011227181527.34925.qmail@web21105.mail.yahoo.com> Hello, With Mark's parting comment about ActiveState slowing development on ActivePython, I'm turning my eyes back to the python.org version of Python, and I'm wondering what I would need to do to get the same, or at least a similar, level of integration with the Win32 API, shell, etc. I wouldn't worry about it but I'm ready to step up to Python 2.2 and ActiveState's version is stalled in alpha. I know I'll need to grab win32all and install it... what else should I do? For example, how do I make WSH execute .pys files? They don't appear to be recognized under the python.org sources. I'm assuming that it's some sort of registry tweak that's handled in the ActiveState installer. Any other things that'll need to be set up? Thank you, -dB ===== David Brady daves_spam_dodging_account at yahoo.com I'm feeling very surreal today... or *AM* I? __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com From donod at home.com Tue Dec 25 12:36:46 2001 From: donod at home.com (Don O'Donnell) Date: Tue, 25 Dec 2001 17:36:46 GMT Subject: string compare question.Please Help!!! References: <001f01c18ceb$fdb53900$4301010a@sky> Message-ID: <3C28B951.E021A1B5@home.com> Evgeny Jonson wrote: > > #For IP addres something like this: > > import string > import sys > > def ip_cmp(ip1, ip2): > """Compare IP addreses as strings > """ > l_ip1 = ip1.split('.') > l_ip2 = ip2.split('.') > if len(l_ip1) == 4 and len(l_ip2) == 4: > s_ip1 = string.zfill(l_ip1[0], 3) + '.' + \ > string.zfill(l_ip1[1], 3) + '.' + \ > string.zfill(l_ip1[2], 3) + '.' + \ > string.zfill(l_ip1[3], 3) > > s_ip2 = string.zfill(l_ip2[0], 3) + '.' + \ > string.zfill(l_ip2[1], 3) + '.' + \ > string.zfill(l_ip2[2], 3) + '.' + \ > string.zfill(l_ip2[3], 3) > resault = cmp(s_ip1, s_ip2) > else: > print 'Wrong IP addres format!' > sys.exit(0) > > return resault > > # my test > > print ip_cmp('10.66.73.78','10.0.0.0') # return 1 > print ip_cmp('10.66.73.78','10.255.255.255') # return -1 The concept is right but the implementation is tiresome. There is no need to convert the list back to a string, just compare the two lists. Here is a quicker way: >>> def ipnumlist(ipstr): """Convert an ip address to a list of integers""" return [int(s) for s in ipstr.split('.')] >>> cmp(ipnumlist('10.66.73.78'), ipnumlist('10.255.255.255')) -1 And, if you want to package the compare into a function: >>> def ipcmp(ip1, ip2): return cmp(ipnumlist(ip1), ipnumlist(ip2)) >>> ipcmp('10.66.73.78', '10.255.255.255') -1 >>> ipcmp('10.66.73.78', '10.55.255.255') 1 Cheers, Don From pythonnet at hotmail.com Thu Dec 27 01:32:40 2001 From: pythonnet at hotmail.com (Andrew Nguyen) Date: 26 Dec 2001 22:32:40 -0800 Subject: A new message board is up Message-ID: <40dbad98.0112262232.1868734e@posting.google.com> A new message board (that doesn't have the Usenet delay) is up! Xutilla is the admin. it is at http://pub19.ezboard.com/fthepythonmessageboard95602frm1 Hope to see you! From Bruce at EckelObjects.com Thu Dec 6 14:13:29 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Thu, 06 Dec 2001 11:13:29 -0800 Subject: Calling a generator multiple times Message-ID: <200112061113290670.0100F457@mail.rdc1.sdca.home.com> I'm trying to create a clever way to call a generator multiple times, but the only thing I've been able to come up with is: import random rgen = random.Random() def itemGenerator(dummy): return rgen.choice(['one', 'two', 'three', 'four']) print map(itemGenerator, [None]* 25) This works, but it requires the 'dummy' argument which seems inelegant. I'll bet someone has a better idea... Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From rasmussn at lanl.gov Mon Dec 3 18:29:13 2001 From: rasmussn at lanl.gov (Craig E Rasmussen) Date: Mon, 3 Dec 2001 16:29:13 -0700 Subject: Problems with dynamic loading on Debian Message-ID: <8F774EEC-E845-11D5-87F6-0030657EBC3E@lanl.gov> I've run into problem loading modules on Debian (libc-2.2.2). I first load module A.so (using the command "from A import *"). Note that library A.so contains the symbol _XXX. But when I subsequently load module B.so (using the command "from B import *") I get an ImportError: ./B.so undefined symbol: _XXX. To make things perfectly clear, the dynamic loader has already seen _XXX as it was loaded from A.so. So I don't see why the ImportError occurs. I've not seen this problem before. The usage outlined above works fine on Mac OS X and on RedHat versions older than 7.2 (I won't have access to 7.2 for a week or so). A colleague thinks that I might indeed have the same problem on RedHat 7.2 as he says the dynamic loader is broken in new linux versions. Has anyone seen this problem? Can anyone suggest a solution? I've tried building python from scratch so that I know that I'm using the same compiler versions for everything but this didn't help. Thanks, Craig From logiplexsoftware at earthlink.net Sun Dec 30 17:58:19 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Sun, 30 Dec 2001 14:58:19 -0800 Subject: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) In-Reply-To: <87ellcrfs3.fsf@kursk.kassube.de> References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> <87ellcrfs3.fsf@kursk.kassube.de> Message-ID: <20011230145819.59aa99a2.logiplexsoftware@earthlink.net> On 30 Dec 2001 14:36:28 +0100 Nils Kassube wrote: > I never claimed that an OS should be written in Python. There are > several good all purpose languages who are better for this task, > e.g. Lisp and Ada. Sorry, I was being somewhat facetious. Unfortunately I am not familiar with either Lisp or Ada so I can't comment on their appropriateness for low-level work. Since you aren't the first person I've heard advocate Ada for this type of work, I have to wonder why it hasn't been done (or has it?). Lack of such an OS doesn't prove anything, but it does beg the question. > > develop run-of-the-mill applications in C. Like any other language, C has > > places where it shines and places where it isn't really appropriate. > > Yes, it really shines for security and stability problems. Heck, even > bit-fiddling is better done using Ada. As I mentioned earlier, I don't know Ada, but I suspect insecure, unstable software can be written in any language. Familiarity with a language and good design is the best way to avoid these problems. This may be why C retained its popularity for so long: small language that's reasonably easy to learn (both feature-wise and wart-wise). As far as design, I will grant that it can be difficult to maintain a good design in C for anything very complex. This is why I believe C to be a "better assembler". Use it for performance-critical code and then call it from a higher-level language (like Python). > BTW: > > int add_two_numbers(int a, int b){ > return a+b; > } > > What's the meaning (semantics) of add_two_numbers(23575,23575)? Hrm. Don't like flaunting my ignorance on the list, but I don't see what you're getting at. On my 32-bit PC, it means 47150. I would say add_two_numbers() accepts two arguments of machine-word-size, adds them and returns the machine-word-size result on the stack. If the result is greater than the machine-word-size, the result will be negative (on a two's complement machine). I'd probably return a long if that were going to be an issue, or perhaps use an arbitrary-precision library. I think perhaps you are trying to point out something that I am too obtuse to see. Please feel free to enlighten me. Regards, -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From boud at rempt.xs4all.nl Mon Dec 17 14:24:30 2001 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 17 Dec 2001 19:24:30 GMT Subject: WYSIWYG text Editor in python? References: <3C1DDCAC.C477A0A6@cicei.ulpgc.es> Message-ID: <9vlgpe$o8v$1@news1.xs4all.nl> John J. Lee wrote: > Perhaps this is an annoying answer, but PyQt has a trivial-to-use text > editor widget. I don't recall if Qt 2 can do bold / italic, etc, but I'm > almost certain Qt 3 does (with html or xml internally, IIRC). The > interface for selecting text attributes such as bold or subscript would be > up to you, of course. PyQt is stupidly easy to use :) Qt 2 can only show rich text - not edit it. Qt 3 isn't yet available in a non-commercial edition for Windows, but it includes a very capable rich text engine. I don't think it can show complex formulae, though. On KDE I'd script KFormula using DCop for that, I think. On the other hand, I'm currently working on a text editor written almost entirely in Python (all editing and redisplay), with the goal of finally having a real interlinear text editor. I think it can be done -- but it's nowhere yet. -- Boudewijn Rempt | http://www.valdyas.org From timcera at earthlink.net Sun Dec 30 09:34:52 2001 From: timcera at earthlink.net (Tim Cera) Date: 30 Dec 2001 06:34:52 -0800 Subject: REPOST: Re: Paramaterized local variable name References: <9c3f2e9c.0112292115.6a4e22af@posting.google.com> <3C2EA509.63ACDDC9@earthlink.net> Message-ID: <8$--$$_----__%%$$$@news.noc.cabal.int> Hans Nowak wrote > You probably want > > start = getattr(data[key][i], local_name) > > Now you can set local_name to a string "name" or "rev" > or whatever attribute of data[key][i] you want to > access. Works great! THANKS! Thanks also to Sean for the 'exec' based solution. take care Tim Cera ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: timcera at earthlink.net (Tim Cera) Newsgroups: comp.lang.python Subject: cmsg cancel <9c3f2e9c.0112300634.6e2c1ef6 at posting.google.com> Control: cancel <9c3f2e9c.0112300634.6e2c1ef6 at posting.google.com> Date: Mon, 31 Dec 2001 03:05:55 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774221 27193 211.57.49.2 (31 Dec 2001 04:50:21 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:50:21 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From dkuhlman at rexx.com Fri Dec 28 14:42:02 2001 From: dkuhlman at rexx.com (Dave Kuhlman) Date: 28 Dec 2001 13:42:02 -0600 Subject: REPOST: Re: scripting on top of structural References: <3C2C7B6C.DB7EDC32@doc.ic.ac.uk> Message-ID: <2$--$$_----__-_-%$@news.noc.cabal.int> In comp.lang.python Benjamin Tai wrote: > > Hi, > > Please note that this message is posted on Python and Tcl newsgroup, and > VTK mailing list. > > When an application written in a structural language is extended with a > scripting language, there are many improved functionalities. > > 1) Packages for GUI (in C/C++ case) > 2) Wider range of libraries, easier interprocess communication. > 3) Expose the application to a wider range of community. > 4) Simplified syntax, speed up prototyping. > 5) Ready to be embedded into foreign application as scripting language > functioned as a glue. Also, 6. Speed of development from the scripting language _and_ speed of execution from the underlying C/C++ code. You might also want to look at Chapter 2, "Scripting Languages" in the SWIG manual, available at: http://www.swig.org/Doc1.1/HTML/Scripting.html - Dave -- Dave Kuhlman dkuhlman at rexx.com -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Dave Kuhlman Newsgroups: comp.lang.python Subject: cmsg cancel <1009569279.849331 at rexx.com> Control: cancel <1009569279.849331 at rexx.com> Date: Mon, 31 Dec 2001 02:50:05 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775105 27193 211.57.49.2 (31 Dec 2001 05:05:05 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:05:05 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jkraska at san.rr.com Sun Dec 30 01:07:22 2001 From: jkraska at san.rr.com (Courageous) Date: Sun, 30 Dec 2001 06:07:22 GMT Subject: REPOST: Re: Is learning Python "extraordinary"? References: <3C2E5706.5880983E@engcorp.com> <3C2EAD4D.77564075@engcorp.com> Message-ID: <4$--$$_----__-%$$$@news.noc.cabal.int> >I think my perspective is somewhat tainted from being one of the >freaks (back then) who was rather self-taught. By the end of >high school I knew BASIC, C, APL, 6502 assembly, and others. >By *no* means exceptional compared to many of the real wizards >of the industry, but... But, by all means exceptional, likely with an IQ over 130, perhaps edging to 145, placing you smack into the range of individuals which are at a minimum smarter than ~97.5% of all the rest of humanity. So pat yourself on the back and engage in some well- deserved emotional masturbation. You're likely better than you give yourself credit for. Moreover, in this case, a little acceptance of your own lofty capabilities may do you some good, because when you learn to aknowledge yourself, you may begin to see the signficance of similar accomplishment in others. OM, HARI SHIVA, and all that. :-P C// ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Courageous Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:08:31 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774341 27193 211.57.49.2 (31 Dec 2001 04:52:21 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:52:21 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From fredrik at pythonware.com Tue Dec 4 02:29:16 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 04 Dec 2001 07:29:16 GMT Subject: Python evangelists unite! References: Message-ID: James Althoff wrote: > But since all things are not simply "black or white" you might want to keep > in the back of your mind the fact that our company has written a successful > commercial product that comprises several hundreds of thousands of lines of > Jython code written by several dozen programmers working in multiple > locations throughout the world and has been in production use for over a > year are you sure it still works, now that someone on comp.lang.python has told you that it was a bad idea to do that? ;-) From aleax at aleax.it Thu Dec 6 09:28:20 2001 From: aleax at aleax.it (Alex Martelli) Date: Thu, 6 Dec 2001 15:28:20 +0100 Subject: Packaging Python into COM object? References: Message-ID: <9unva1$nvi$1@serv1.iunet.it> "Rachmat Hartono" wrote in message news:V4aP7.61268$RG1.33657094 at news1.rdc1.sfba.home.com... > Hi, I'm just starting to use Python for our project and I have questions.. > > Is it possible to package all python code into one COM DLL (Windows)? If No. You need non-COM interactions too; just COM doesn't suffice. > this is possible, that means I don't have to put Python distribution (2.1.1 > or 2.2) in my installation package once I'm ready to ship the product > right? What modules needs to be distributed though? Can anyone give me a > pointer of how I can do this? Two possibilities, for example: http://starship.python.net/crew/theller/py2exe/ http://www.mcmillan-inc.com/install5_ann.html Alex From -$Paul$- at verence.demon.co.uk Mon Dec 17 05:20:13 2001 From: -$Paul$- at verence.demon.co.uk (Paul Wright) Date: 17 Dec 2001 10:20:13 -0000 Subject: Livewires and pygame References: <3c1cd19e$0$10212$ba620e4c@news.skynet.be> Message-ID: <9vkgst$ejf$1@verence.demon.co.uk> In article <3c1cd19e$0$10212$ba620e4c at news.skynet.be>, Lorint Hendschel wrote: ># python >Python 2.0 (#1, Apr 11 2001, 19:18:08) >[GCC 2.96 20000731 (Linux-Mandrake 8.0 2.96-0.48mdk)] on linux-i386 >Type "copyright", "credits" or "license" for more information. >>>> from livewires import beginners >>>> from livewires import colour >>>> from livewires import games > >At this stage, my interpreter just sits there and does no longer >respond to anything, I'm obliged to kill the terminal. > >I imported successively all "importable thingies" (sorry, I'm a newbie) >from the pygame directory (all files in *.pyc and *.so, e.g. from pygame >import mouse), and it worked. Suggestion: are you able to run the pygame examples? That'll tell you whether the problem is with the pygame install or the livewires one. Also, you could try doing each of the following imports one after the other at the Python command prompt: pygame, pygame.image, pygame.mixer, pygame.font, pygame.transform pygame.draw They're all needed by the livewires.games module, so if one of them hangs your python interpreter, that's where the problem lies. The only other thing the games module then does on import is call pygame.init (), so you could try that after you've done all the imports. If all that works but you still can't import the livewires stuff, email me at python at livewires.org.uk and I'll try to help further. >Note that when I do: > >from livewire import * > >... it works, but then when I do a "dir(beginners)", I have a long list of >usable things, while "dir(games)" produces an error: That's because "from livewires import *" imports the beginners module only. It's a feature which exists for hysterical raisins. It's probably quite useful to you because it means you can use the beginners' sheets without attempting to invoke pygame, so you can learn from those before moving on to the games. -- ----- Paul Wright ------| Set phasers to EVISCERATE. -paul.wright at pobox.com--| http://pobox.com/~pw201 | From maxm at mxm.dk Sat Dec 15 12:07:07 2001 From: maxm at mxm.dk (maxm) Date: Sat, 15 Dec 2001 18:07:07 +0100 Subject: Recursive update of arbitrarily nested dicts Message-ID: I am writing a module where I am updating nested dicts, and it has this method: def addDayToTrack(self, trackId, year, theDay, day): if not self.tracks.has_key(trackId): self.tracks.update({trackId:{year:{theDay:day}}}) elif not self.tracks[trackId].has_key(year): self.tracks[trackId].update({year:{theDay:day}}) elif not self.tracks[trackId][year].has_key(theDay): self.tracks[trackId][year][theDay] = day oh and self.tracks={} But clearly this could be solved more generally by a recursive function. Something like: def addDayToTrack(self, trackId, year, theDay, day): # recursive update self.rUpdate(self.tracks, {trackId:{year:{theDay:day}}}) Now my only problem is that recursive method "rUpdate(targetDict, itemDict)". Knowing this group, many other has written a method like this before me. Does anybody have one at hand? The idea is that it should traverse the targetDict, updating keys and values as apropriate. Anyhoo ... I will try it myself, but recursion is not my pot of tea though. regards Max M From tomaz.ficko at agroruse.si Fri Dec 14 05:00:03 2001 From: tomaz.ficko at agroruse.si (Tomaz Ficko) Date: Fri, 14 Dec 2001 11:00:03 +0100 Subject: Strange QTable behavior Message-ID: Hello I'm writing a dictionary like application with PyQt. I'm using QTable widget to display the data in a table with two columns. But there is a problem, when I set number of rows to more than 1638 and fill all cells with QTableItems the contents of the table become blank no grid, no nothing. If I double click a cell then the text becomes visible. So the QTableItems are there they are just not visible. I have tried to use update, repaint method, and updateCell method but nothing helps. Is this bug or feature? Has somebody else noticed similar behavior? I want to be able to display 50000 rows in table, which widget should I use? I'm using: Suse 7.3 Python 2.1.1 PyQt-3.0-Qt-2.3.1 Qt 2.3.1 Thanks for any help in advance. Sincerely, Tomaz From oren-py-l at hishome.net Sat Dec 8 05:44:19 2001 From: oren-py-l at hishome.net (Oren Tirosh) Date: Sat, 8 Dec 2001 05:44:19 -0500 Subject: Calling a generator multiple times In-Reply-To: <0gn21usqeasqa1bp4sveh0vjagtmbmfpof@4ax.com>; from jkraska@san.rr.com on Sat, Dec 08, 2001 at 12:30:25AM +0000 References: <0gn21usqeasqa1bp4sveh0vjagtmbmfpof@4ax.com> Message-ID: <20011208054419.A77659@hishome.net> On Sat, Dec 08, 2001 at 12:30:25AM +0000, Courageous wrote: > > >A generator is a function or method that -- by virtue of using the yield > >statement -- > > I understand how it works, intuitively. My objection is not that > I don't understand it, but rather that a lone keyword appearing > in the content of the method definition actually changes what is > being defined. That's just plain wrong. I agree. It should be immediately apparent that a generator function is not a regular instance of the 'function' type. I believe that the most natural way to indicate this is to use the function object's type. A generator function should be an instance of a 'generator' type, a subclass of the 'function' type. It should return a 'generator_iterator' object when called. Here's what the syntax might look like: def foo(args)(generator): ... Why this syntax? Simply following the same rules as class definitions. A class definition has an optional base class or classes in parens; when omitted, a default metaclass is used ('class' today, perhaps 'object' in the future). This syntax is the logical result of extending this rule to functions and defining 'function' as the default metaclass for new function definitions. This default may be overridden, with the only alternative being 'generator', at least for now. There are no new keywords required, 'generator' is just a built-in type. The __future__ mechanism gives a clean way to deprecate the current syntax where a generator function is defined by the mere presence of a 'yield' statement somewhere within the function's body. Oren From fperez528 at yahoo.com Thu Dec 20 07:24:05 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Fri, 21 Dec 2001 11:52:05 +2328 Subject: Distutils question References: <9vu28t$4g9$1@peabody.colorado.edu> Message-ID: Michael Hudson wrote: > Well, one option would be to *in your script* ask distutils where they > will have gone: > >>>> from distutils.core import Distribution >>>> from distutils.command import install >>>> i = install.install(Distribution()) >>>> i.finalize_options() >>>> i.install_data > '/home/crew/mwh' > Thanks a lot for this tip. distutils is nice, but I'd have to say it needs some work in the documentation dept. Most of the functions don't even have docstrings, and the problem is that setup() is very much a one-way black box. It takes a few options but there's no (documented) way of knowing what it did, where it put things. > But that's risky; it can be affected by the user options to setup.py. That's what I'm afraid of. If the user gives a --home=~/local for example, is there any way to know about that? > > I'd hope it would be possible to get distutils to install a file in > your package saying where things ended up, but I have no idea if/how > this is possible. > >> I'm sure that people who have used distutils for big projects have >> run into this, > > And they probably hang out on the distutils-sig; I suggest asking > there might have better luck. mmmh. Didn't know about such a thing. Thanks, google did its usual good deed, I'll try to bugger those folks a bit. Again, thanks for your help, Fernando From justin at iago.org Fri Dec 28 08:38:02 2001 From: justin at iago.org (Justin Sheehy) Date: Fri, 28 Dec 2001 08:38:02 -0500 Subject: is this a bug or what? In-Reply-To: ("I.J."'s message of "Thu, 27 Dec 2001 02:56:50 +0100") References: Message-ID: "I.J." writes: >>>> M=[[0]*3]*3 >>>> M > [[0, 0, 0], [0, 0, 0], [0, 0, 0]] >>>> M[1][1]=1 >>>> M > [[0, 1, 0], [0, 1, 0], [0, 1, 0]] > > Is this new age math? No, and it isn't a bug either. You made a list with three references to the same list in it. Then you modified the list that you had three references to. See also the FAQ: http://www.python.org/doc/FAQ.html#4.50 -Justin From rayvd at pacbell.net Tue Dec 4 00:43:51 2001 From: rayvd at pacbell.net (Ray Van Dolson) Date: Tue, 04 Dec 2001 05:43:51 GMT Subject: Baffled by httplib and SSL! References: Message-ID: >Since I am not yet using this library I will limit my observation to >the fact that the scheme (https:) and the host (//www.dotster.com) are >normally implied by a) the connection port (443 by default) and b) the >connected host. I would therefore have expected the first line to be > >send: 'POST /account/login/login.asp HTTP/1.1\r\n' > >but I don't know if this is what's causing your problem. > >regards > Steve Thanks for the suggestion--I'm not sure why I was doing it this way to start out with. However, changing to just the /account/etc part didn't have any effect. It still hangs at the __ssl.read() portion of getresponse() Anyone out there written any code with HTTPSConnection? Thanks. From python_only at yahoo.com Fri Dec 28 04:27:14 2001 From: python_only at yahoo.com (Goh S H) Date: 28 Dec 2001 01:27:14 -0800 Subject: REPOST: Python Enterprise ??? Message-ID: <7$--$$_--%--_$%%$$@news.noc.cabal.int> Check it out ! http://www.gnuenterprise.org/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail Message-ID: Control: cancel <184fbd02.0112280127.159247b5 at posting.google.com> Subject: cmsg cancel <184fbd02.0112280127.159247b5 at posting.google.com> From: python_only at yahoo.com (Goh S H) Newsgroups: comp.lang.python X-No-Archive: yes Lines: 2 NNTP-Posting-Host: wonenara.ozemail.com.au X-Trace: ozemail.com.au 1009643077 203.108.164.177 (Sun, 30 Dec 2001 03:24:37 EST) NNTP-Posting-Date: Sun, 30 Dec 2001 03:24:37 EST Organization: OzEmail Ltd, Australia Distribution: world Date: Sat, 29 Dec 2001 13:00:15 GMT This message was cancelled from within Mozilla. From bob at passcal.nmt.edu Thu Dec 20 14:27:52 2001 From: bob at passcal.nmt.edu (Bob Greschke) Date: Thu, 20 Dec 2001 12:27:52 -0700 Subject: Pmw.ScrolledText: selecting a line? Message-ID: <9vte32$7rs$1@newshost.nmt.edu> My program reads an equipment-generated (ASCII) log file and extracts certain lines of interest. A graph is constructed which plots the values (voltages, temps, etc.) from some of the lines, then a child window is brought up with a ScrolledText widget and the log file gets .importfile'ed into the ScrolledText field. I can click on a point on the graph and get the ScrolledText field to jump to the corresponding line in the file with .yview(line number), but how (if possible) can I get the line to then also be 'selected' or 'highlighted' somehow so the user knows which line the point is associated with? Thanks! Bob From paul at prescod.net Sat Dec 29 08:19:19 2001 From: paul at prescod.net (Paul Prescod) Date: Sat, 29 Dec 2001 08:19:19 -0500 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <458b194a.0112282052.1123341@posting.google.com> Message-ID: <3C2DC2D7.C0C715D4@prescod.net> Resty Cena wrote: > > The real source of growth for both Python and Ruby are the 3M VB > developers worldwide. Whichever can provide what it is that VB > developers like about VB on top of what Python and Ruby natively offer > will hit the jackpot. Initially, VB was innovative. Now it is primarily popular because it is an "industry standard" and has Microsoft's name on it. Unfortunately, neither Ruby nor Python have either advantage. There is no doubt that Ruby and Python could pick up SOME of the VB.NET diaspora but I have a sense that in the long run, Microsoft will reassert control of those developers using its marketing muscle. Nevertheless, I agree that that market is huge and largely untapped. Paul Prescod From tim at vegeta.ath.cx Thu Dec 27 05:17:20 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Thu, 27 Dec 2001 10:17:20 GMT Subject: install Python2.2 question References: Message-ID: graced us by uttering: > My computer operation system is Red Hat Linux7.0, > I install python2.2,it raise a error,How to correct? > it follows: > > [root at storm /root]# rpm -i python2-2.2-2.i386.rpm > error: failed dependencies: > libcrypto.so.2 is needed by python2-2.2-2 > libdb-3.2.so is needed by python2-2.2-2 > libexpat.so.0 is needed by python2-2.2-2 > libreadline.so.4 is needed by python2-2.2-2 > libssl.so.2 is needed by python2-2.2-2 v2.2 is the most recent release of Python and was probably built using libraries that didn't come on your distribution CDs. The rpm you're trying to install requires the listed rpms in order to function. You can try to search for them at one of the http://rpmfind.net/ mirrors. If you have a sufficient devel environment and you are up to the challenge, you can try to build Python yourself, but it may be more trouble than it's worth if you're new to linux. HTH Tim Hammerquist -- Little one, I would like to see anyone -- prophet, king or god -- persuade a thousand cats to do anything at the same time. -- Orange Cat, The Sandman From joel.quinet at be.unisys.com Mon Dec 10 08:44:42 2001 From: joel.quinet at be.unisys.com (Joel Quinet) Date: Mon, 10 Dec 2001 14:44:42 +0100 Subject: How to change IP Address by Python program on Win Platform Message-ID: <9v2aqb$mbt$1@ih292.ea.unisys.com> Hi all, I have to change my IP address on my laptop frequently for testing. I am borring to do it by setting... I would like to do it by Python script. How can I do that ? Joel From logiplexsoftware at earthlink.net Sun Dec 30 18:04:18 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Sun, 30 Dec 2001 15:04:18 -0800 Subject: wxBitmapFromImage function in wxPython? In-Reply-To: <3C2F7BB3.577D3712@cti.ecp.fr> References: <3C2F7BB3.577D3712@cti.ecp.fr> Message-ID: <20011230150418.690734ff.logiplexsoftware@earthlink.net> On Sun, 30 Dec 2001 21:40:19 +0100 Stephane SOPPERA wrote: > I read in the documentation of wxPython that this function exists: > > wxBitmapFromImage(image, depth=-1) > Convert a wxImage > to a wxBitmap. > > But the Python does not know it. > When I use it, it return an Nameerror exception. (I use the from > wxPython.wx import * command) > It's not in dir(wxPython.wx). > I'm using python 2.1. > Is that function really exists? > What could be another solution to do the same thing? > > Thanks in advance, Python 2.1.1 (#1, Aug 28 2001, 19:51:39) [GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-85)] on linux2 Type "copyright", "credits" or "license" for more information. >>> from wxPython.wx import * >>> wxBitmapFromImage >>> Perhaps there is something amiss with your wxPython installation? -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From maxm at mxm.dk Fri Dec 14 07:58:09 2001 From: maxm at mxm.dk (maxm) Date: Fri, 14 Dec 2001 13:58:09 +0100 Subject: what is self._base? References: <3C19EC50.153B76A1@doc.ic.ac.uk> Message-ID: "Benjamin Tai" wrote in message news:3C19EC50.153B76A1 at doc.ic.ac.uk... > However I can't find any documents/explanation for the following: > > 1) What is "_base" "_base" is an attribute on the object that can contain any Python objects. It could alse be called base, Base, __base etc. The leading underscore indicates that it is a private attribute, that should only be used by the class itself. This is just a convention, and is not enforced by the language. So even though you shouldn't you could call it via: stack = Stack() print stack._base >>> some_kind_of_stack_object > 2) What is "start=None" It is a default parameter passed to the __init__ method. It means that it has not been assigned a more meaningfull value. If you create the object with a parameter, you could do it like: stack = Stack('Spam egg') print stack._base >>> Spam egg or like this which is in effect the same. stack = Stack(start='Spam egg') print stack._base >>> Spam egg > 3) Why can't I just write "self = stacktype.Stack()" Oh but you can ... it would just not do what you excpect ;-) What if you have more than one attribute. How would you call them then. ie.:: self = 'Max M' self = 'Rasmussen' self = 'Denmark' self.firstName = 'Max M' self.lastname = 'Rasmussen' self.country = 'Denmark' Without the attribute name you could not adress the values again. And by setting self to a string or any other object you are in effect changing the object to something else. I would recommend that you get a hold of the excellent "Learning Python" book, that does a great job at explaining the fundemantals of Python. It will save you a lot of time in the long run. regards Max M From pierre.hanser at sxb.bsf.alcatel.fr Fri Dec 7 02:54:44 2001 From: pierre.hanser at sxb.bsf.alcatel.fr (Pierre HANSER) Date: Fri, 7 Dec 2001 07:54:44 +0000 (UTC) Subject: pygtk 0.6.8 crashes on everything References: <3c0f909e.0@mercury.planet.net.au> Message-ID: <9upsk3$q1p$1@mephisto.sxb.bsf.alcatel.fr> hello from experiences with Sketch, it seems that pygtk does not work if Python is compiled with py_malloc enabled. -- Pierre Hanser From peter at engcorp.com Thu Dec 6 20:44:33 2001 From: peter at engcorp.com (Peter Hansen) Date: Thu, 06 Dec 2001 20:44:33 -0500 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: <3C101F01.1C48582A@engcorp.com> Ben Wolfson wrote: > > On Thu, 06 Dec 2001 11:46:40 -0600, Bjorn Pettersen wrote: > > Ps: Isn't it time for someone to call someone a space-nazi/tab-nazi so > > this thread can die? > > Tabs damage code like the Blitzkrieg in Poland, man. You must be a nazi > to support them. That's just the kind of statement that Hitler would make! God, win will people stop talking like that? Besides, you probably really support the tab-nazi's side of things, but you invoked the Law just to let them claim they've won the argument. (Newbies please see http://www.killfile.org/~tskirvin/faqs/godwin.faq . Please also note Quirk's Exception, which effectively invalidates Ben's pathetically obvious attempt to bring the discussion to a close whilst still letting the tab people claim they won. ;-) ) -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From wurmy at earthlink.net Sun Dec 9 19:03:41 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Mon, 10 Dec 2001 00:03:41 GMT Subject: join vs instances References: Message-ID: <3C13F9D7.5091357@earthlink.net> Robin Becker wrote: > > In article , Brad > Bollenbach writes > ..... > >Of course it's expected that you can't get away with simply referring to > >the instance directly and expecting a string to pop out, but can you > >give an example of a gotcha with a UserString vs. builtin (that is to say, > >a scenario where you the difference between the two will make it > >impossible for you to write code that won't break)? > > > > > >Brad > well since UserStrings can be added to strings > > eg > >>> from UserString import UserString > >>> u = UserString('U') > >>> u+'a' > 'Ua' > >>> 'a'+u > 'aU' > >>> > > I had expected that the join operation would also apply to UserStrings > somehow or that there would be some magic method that would allow join > to be applied to user strings, but I can't find out how. What is the > primitive implementation of join? I haven't looked at the C code, but I expect that it wants the types of the list items to be , not "something that behaves like a string". The latter can often be done in Python code, but I guess this wasn't an option for built-in (C) functions. There are other examples of this in Python, for example exec, that takes a dictionary but not a UserDict: >>> from UserDict import UserDict >>> d = UserDict() >>> exec 'print "Hello"' in d Traceback (most recent call last): File "", line 1, in ? exec 'print "Hello"' in d TypeError: exec: arg 2 must be a dictionary or None There are several workarounds possible, e.g. doing a map(str, lst) where lst is your list that contains UserString instances, then joining it. --Hans From jwbaxter at spamcop.net Sun Dec 23 22:15:02 2001 From: jwbaxter at spamcop.net (John W. Baxter) Date: Sun, 23 Dec 2001 19:15:02 -0800 Subject: vi or emacs for editing Python on Linux? References: Message-ID: <231220011915029251%jwbaxter@spamcop.net> In article , Roy Smith wrote: > About all the vi I really know is :q! I don't even know that much...I have to grab a book and look it up every time I get stuck in vi in a file I don't want to damage. (Yes, I could tape a not-sticky-enough note to the monitor.) On the other hand, I've used Emacs since about 1994, essentially full time, and still know only about two dozen commands. They do what I need. I could probably have learned that much vi. --John From krissepu at vip.fi Mon Dec 31 12:20:36 2001 From: krissepu at vip.fi (Pekka Niiranen) Date: Mon, 31 Dec 2001 19:20:36 +0200 Subject: Optimization help needed: Search and Replace using dictionary of parameters Message-ID: <3C309E64.6A7E37DD@vip.fi> How can I do this most efficiently: I have filenames and parameters in a sparse matrix that is a dictionary: {'file1, parameter1': xxx, 'file1, parameter2' : yyy, 'file2, parameter1' : zzz, 'file2, parameter2': hhh, 'file2, parameter3': ggg, 'file3, parameter1': ccc, 'file4, parameter1:' ddd, 'file4, parameter2:', eee} I would like to run search and replace to files for each parameters; For example: parameter1 in file1 should be replaced with xxx etc. Before I start writing code, any ideas what is the fastest way of doing it ?: regex- or string -functions ? Map or readlines() ? Any ideas are appreciated.. -pekka- From jason at jorendorff.com Sun Dec 16 14:17:20 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Sun, 16 Dec 2001 13:17:20 -0600 Subject: socket question Message-ID: > The server should call udpSerSock.bind( ('10.1.1.27', 21567) ) > before it issues the recvfrom() call - otherwise, how is the > server's UDP layer to know which interface and address to > listen on? This is a red herring. udpSerSock is not intended to listen for packets, only to send one. -- Jason Orendorff http://www.jorendorff.com/ From dlharris at mail.usyd.edu.au Sat Dec 29 03:33:48 2001 From: dlharris at mail.usyd.edu.au (Dave Harrison) Date: Sat, 29 Dec 2001 19:33:48 +1100 Subject: posting the code - further to odd problem Message-ID: <20011229083348.GA1244@dave@isetroc.com> Further to my last post I had checked the id of each object and they were unique objects so Im still stuck :-) However the packet class code is as follows : import string pdic = {} class Packet: def __init__(self, info): self.buildDic(info) def buildDic(self, info): for item in info: split = string.split(item,"=") if (len(split) > 1): pdic[split[0]] = split[1] def getVal(self, key): if pdic.has_key(key): result = pdic[key] else: result = '' return result def getDic(self): return pdic def printDic(self): for item in pdic: print item + ':' + pdic[item] From fredrik at pythonware.com Wed Dec 12 21:24:35 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 13 Dec 2001 02:24:35 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> Message-ID: Ville Vainio wrote: > Why don't issue a DeprecationWarning whenever tabs are found in the > source file? That wouldn't "break" things, but it would surely > motivate tab-using people to learn the right way of doing things. why not issue a WhitespaceTrollWarning whenever your name is found in Python source code? Sure wouldn't break any of my code. From dlharris at mail.usyd.edu.au Sat Dec 29 02:16:00 2001 From: dlharris at mail.usyd.edu.au (Dave Harrison) Date: Sat, 29 Dec 2001 18:16:00 +1100 Subject: odd problem, most likely stupid one too :-) Message-ID: <20011229071600.GA774@dave@isetroc.com> Ive written a class named packet, and I have a list on values that I am using to create my packets by passing the values in as I instantiate the classes I am creating. I do the creation in a for loop, for item in itemlist: PACKET = Packet(item) paclist.append(PACKET) except that when I try to go back through and see the packets in my paclist they are all exactly the same as the final one that I store in the list. As in I do, for pac in paclist: print pac.getVal() and I get exactly the same value, despite the fact that I know for sure they are different. If I getVal as I create the packets I get the correct and unique values, but once stored I get the oddity. Any ideas ? Thanks Dave From david.brydon at att.net Fri Dec 14 12:16:40 2001 From: david.brydon at att.net (David Brydon) Date: 14 Dec 2001 09:16:40 -0800 Subject: os.system commands in CGI on IIS? Message-ID: <46d8afc4.0112140916.838be25@posting.google.com> This question seems to come up repeatedly over the last several years of posts, but I haven't been able to find it answered: Serving web pages from Microsoft IIS on NT, in a python CGI script, if I execute os.system("copy c:\a.txt c:\b.txt") It does not happen when the cgi page is called from a browser. However if the script is run from the command line, it works fine. Is there any way to get IIS to execute these os.system calls? Thanks much, David From jeff at ccvcorp.com Thu Dec 6 14:56:34 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Thu, 06 Dec 2001 11:56:34 -0800 Subject: Is it possible to kill a thread ? References: <9unnfb$6fp$1@wanadoo.fr> Message-ID: <3C0FCD72.A5FA167C@ccvcorp.com> guignot wrote: > I have a prog which launches a server, using thread.start_new call. > When I destroy the gui, it keeps stuck, probably because the server thread > is still running... > Can the main prog cleanly die, or is there a way to kill the thread ? Create a threading.Event object, and pass it to the thread at startup. When you want to close the application, set the event, and then join() the thread. In the thread, you periodically check the event. When the event becomes set, then the thread terminates itself. At that point, your main thread returns from join() and you can finish shutting down. Jeff Shannon Technician/Programmer Credit International From tuttledon at mailandnews.com Fri Dec 28 17:18:28 2001 From: tuttledon at mailandnews.com (Don Tuttle) Date: Fri, 28 Dec 2001 22:18:28 GMT Subject: ETA for Win32all under Python 2.2? References: Message-ID: FYI, Mark is in transition as he is no longer with ActiveStake. (Seems more accurate then "ActiveState") Read the recent thread "Fate of Win32all" http://groups.google.com/groups?hl=en&threadm=7876a8ea.0112212116.2ebabc23%4 0posting.google.com&rnum=1&prev=/groups%3Fq%3Dfate%2Bof%2Bwin32all%26hl%3Den %26group%3Dcomp.lang.python.*%26rnum%3D1%26selm%3D7876a8ea.0112212116.2ebabc 23%2540posting.google.com Don "David Brady" wrote in message news:mailman.1009566632.18455.python-list at python.org... > GAAAAAH! It doesn't exist yet! > > I want to say something bitter, like "Python is dead > to me," but saying "Python 2.2 is as yet unborn to me" > just comes off wobbly and obtuse. > > Mark, I recall a poster I had in the mid-80's that had > definitions of various computer terms on it. It had > the following definition: > > CHAINING: Method of attaching programmers to their > desks to increase output. > > Is Win32all for 2.2 done yet? If you write back to > say no, I'll be forced to beat you for fiddling with > e-mail when you should be writing code... :-) > > Ah, but seriously. Great package. So great that I > really can't afford to move to Python 2.2 until > Win32all supports it... so, if threats don't work, > I'll resort to bribes and then to begging. Tell me > where you want the cookies sent. :-) > > Any idea of an ETA? > > So-anxiously-awaiting-Win32all-that-I'm-copying-Mark's-sig-style > ly, > > -dB > P.S. There's a longstanding rule in my family: you're > not allowed to complain about anything you could fix > yourself. I'd offer to help, but "a beating" was the > funnier of the two threats. :-) > > ===== > David Brady > daves_spam_dodging_account at yahoo.com > I'm feeling very surreal today... or *AM* I? > > __________________________________________________ > Do You Yahoo!? > Send your FREE holiday greetings online! > http://greetings.yahoo.com > From pzw1 at hotmail.com Mon Dec 17 11:22:06 2001 From: pzw1 at hotmail.com (Peter Wang) Date: 17 Dec 2001 08:22:06 -0800 Subject: Update Oreilly books? References: Message-ID: pythongeek at tradersdata.com wrote in message news: > I am about to slowly transfer out of my newbie status, and I am going > to purchase a Programming Python Book (an upgrade from learning python) > and I wanted to know if anyone knows whether Oreilly will update the > book with the upcoming 2.2 release or if the 2nd edition will last till > 3.0 Python relase. > > Thank You > Dan Dan, If you are familiar enough with the language, I would highly recommend moving to a reference book of some sort, as I have found my reference books much more useful. Since a great deal of Python's power comes from its "batteries included" standard module library, it behooves you to familiarize yourself with said batteries. The New Riders "Python Essential Reference" book is a great book for learning about what modules are out there, and also has lots of good info on core Python (like syntax, builtins, exception heirarchy). Mine gets heavy use. HTH, peter From emile at fenx.com Sun Dec 30 21:00:49 2001 From: emile at fenx.com (Emile van Sebille) Date: Sun, 30 Dec 2001 18:00:49 -0800 Subject: REPOST: Re: Origin of ly y'rs signature style References: Message-ID: <7$--$$_----___%_$$@news.noc.cabal.int> "Michael Hudson" wrote in message news:lkg05s8jo2.fsf at elios.maths.bris.ac.uk... > "Emile van Sebille" writes: > > > I know I've read a good article or post on the origin and adoption > > of the "xx-xx-xx ly y'rs" signoffs brought to the python group by > > Tim Peters. After some searching this morning I couldn't relocate > > that article/post. Does anyone have a link to it? > > There's something about it in AMK's python quotes collection: > > http://www.amk.ca/quotations/python-quotes/index.html > > and there may be something in the Tim Peters shrine: > > http://www.python.org/tim_one/ > Thanks. That got me to this thread, which may have been what I was thinking of. http://groups.google.com/groups?threadm=3dvh4jz0m9.fsf%40amarok.cnri.reston. va.us -- Emile van Sebille emile at fenx.com --------- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Emile van Sebille" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:39:23 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009773956 27193 211.57.49.2 (31 Dec 2001 04:45:56 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:45:56 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From lac at strakt.com Wed Dec 5 09:11:39 2001 From: lac at strakt.com (Laura Creighton) Date: Wed, 05 Dec 2001 15:11:39 +0100 Subject: cursor option in Tkinter In-Reply-To: Message from Lukasz Pawelczyk of "Wed, 05 Dec 2001 11:49:13 +0100." <3C0DFBA9.2F640288@lucent.com> References: <3C0DFBA9.2F640288@lucent.com> Message-ID: <200112051411.fB5EBdua019087@ratthing-b246.strakt.com> > Hello, > > I have found good documentation for Tkinter: > "An introduction to Tkinter", > but there are no available words for cursor option for widgets. > I know only one dafault for Text widget: "xterm". > There are the pictures of available cursors, but there are no any > names for them. > > Could anyone tell me where can I find it? > > Thanks in advance, > Lukasz Go to: http://www.nmt.edu/tcc/help/lang/python/tkinter.html and download the PDF file Tkinter reference: A GUI for Python. What you want is on page 9. Laura Creighton From martin at v.loewis.de Sun Dec 30 09:24:51 2001 From: martin at v.loewis.de (Martin v. Loewis) Date: 30 Dec 2001 15:24:51 +0100 Subject: How can I display unicode in Tk widget References: <9vkqm7$fqo83$1@ID-12869.news.dfncis.de> <9vnou6$gpvgr$1@ID-12869.news.dfncis.de> <9vunds$hiile$1@ID-12869.news.dfncis.de> Message-ID: "Kick" writes: > Could someone help me? With the code you have given, it is still difficult to understand your problem: You fetch the string from the database, but we do not know what the string is. Could you please modify your program to print the type and value of f, then modify it to use the value literally, i.e. without any use of SQLite. Or, to try this vice versa, please execute the program import Tkinter l = Tkinter.Label(text=u"\u5321") l.pack() l.tk.mainloop() on your system. On my system (Python 2.2 on Windows XP), it displays a window with a single Chinese character (which I picked arbitrarily, since I don't speak Chinese). What does that very program do on your system? If it fails, which Python version and Windows version are you using? Regards, Martin From phd at phd.pp.ru Tue Dec 11 04:00:12 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Tue, 11 Dec 2001 12:00:12 +0300 Subject: reading from a serial port (boot) In-Reply-To: <3C15A6EE.9050408@beth.uniforum.org.za>; from mixo@beth.uniforum.org.za on Tue, Dec 11, 2001 at 08:25:50AM +0200 References: <3C15A6EE.9050408@beth.uniforum.org.za> Message-ID: <20011211120012.G18425@phd.pp.ru> The permissions of the script and mydaemin.py are mostly irrelevant here. The permissions of the ttyS0 is releveant. You have to start you programs as user root or as a user with the group uucp. On Tue, Dec 11, 2001 at 08:25:50AM +0200, mixo wrote: > My serial port permission look like this: > > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > crw-rw---- 1 root uucp 4, 64 Dec 11 07:54 ttyS0 > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > Now I have a script that starts up as the machine boots and > read from the serial port. My problem is, it does not get > anything from the port, unless I manualy start it as 'root'. > What do I need do /change to get it to start reading at > boot time? > > P.S > The script to start the daemon has the following permissions > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > -rwxr-xr-x 1 root root 1463 Dec 10 17:29 myscript.sh > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > The daemon itself, > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > -rwxr-xr-x 1 root root 3678 Dec 10 16:04 mydaemon.py > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From jkraska at san.rr.com Fri Dec 14 16:43:29 2001 From: jkraska at san.rr.com (Courageous) Date: Fri, 14 Dec 2001 21:43:29 GMT Subject: "XXX undetected error" in python_d.exe References: <3C19DC19.6060107@skippinet.com.au> Message-ID: On Fri, 14 Dec 2001 10:59:10 GMT, Mark Hammond wrote: >Courageous wrote: > >> How am I supposed to interpret this error when it is printed >> by the Python interpreter? > > >It generally means that someone has previously set an exception and not >cleared or propagated it. Okay. Explain this: if (!TaskInstance_Check(arg3)) { sprintf(msg, "Third argument to task constructor must be a valid task,\n" "found a \"%s\" instead.", arg3->ob_type->tp_name ); PyErr_SetString(PyExc_ValueError, msg); return NULL; } This error occurs and properly returns NULL. An exception gets delivered to the executable, but the "XXX undeteced error" message still comes up. Everything else seems normal. I was under the impression that it was acceptible to set up a Python error in this particular fashion. No? C// From syt at gemini.logilab.fr Tue Dec 18 04:23:36 2001 From: syt at gemini.logilab.fr (Sylvain Thenault) Date: Tue, 18 Dec 2001 09:23:36 +0000 (UTC) Subject: pyexpat and unicode References: Message-ID: On Mon, 17 Dec 2001 23:49:57 GMT, Alex Martelli wrote: >import sys >import xml.parsers.expat >parser = xml.parsers.expat.ParserCreate(encoding='utf8') > >data_uni = u"\202" >data = "there" > >denc = data_uni.encode('utf8') > >for thedata in data_uni, data, denc: > parser = xml.parsers.expat.ParserCreate(encoding='utf8') > print 'parsing', repr(thedata) > try: parser.Parse(thedata, 1) > except: > print 'oops', sys.exc_info()[0] > print 'done' > >[alex at arthur alex]$ python a.py >parsing u"\x82" >oops exceptions.UnicodeError >done >parsing "there" >done >parsing "\xc2\x82" >oops xml.parsers.expat.ExpatError >done >[alex at arthur alex]$ > >The first one corresponds to what you're seeing (passing unicode data tries >to encode it with your default encoding, and the default's default is >ansi), the second one is a string that first within the 'ansi' subset of >utf-8... and I don't know what to make of the third one, which I thought >would work. > replacing parser = xml.parsers.expat.ParserCreate(encoding='utf8') with parser = xml.parsers.expat.ParserCreate() and I obtain the following results: parsing u"\x82" oops exceptions.UnicodeError done parsing "there" 1 done parsing "\xc2\x82" 1 done another try: replacing parser = xml.parsers.expat.ParserCreate() with parser = xml.parsers.expat.ParserCreate(encoding='UTF-8') give the same results. I came to the simple conclusion that pyexpat doesn't recognize the 'utf8' string as a valid encoding while unicode methods does. -- Sylvain Thenault LOGILAB http://www.logilab.org From pobrien at orbtech.com Fri Dec 14 00:39:25 2001 From: pobrien at orbtech.com (Patrick K. O'Brien) Date: Fri, 14 Dec 2001 05:39:25 GMT Subject: Model View Presenter GUI pattern? References: <20011213172833.0bfac3c7.gry@ll.mit.edu> Message-ID: You may want to take a look at this dispatcher code: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/87056 -- Patrick K. O'Brien Orbtech.com - Your Source For Python Development Services "george young" wrote in message news:20011213172833.0bfac3c7.gry at ll.mit.edu... > Is anyone using the Model View Presenter GUI framework/pattern in python? > I've been reading bits about it, and it sounds quite attractive. > > I've started trying to write a simple MVP module as a basis for an application. > The hardest part is dealing with the overall structure: my app deals with a > big structured data object and it's hard to picture how the parallel trees of > models, views, and presenters all get instantiated and linked. > [snip] From skip at pobox.com Wed Dec 19 17:46:49 2001 From: skip at pobox.com (Skip Montanaro) Date: Wed, 19 Dec 2001 16:46:49 -0600 Subject: index()-like behavior that returns all occurences... In-Reply-To: <3C2110BE.8060300@my-deja.com> References: <3C2110BE.8060300@my-deja.com> Message-ID: <15393.6361.697604.404273@beluga.mojam.com> Lorin> x = [ [1], [1,2], [], [1,2,3], [], [2], [12] ] [i for i in range(len(x)) if len(x[i]) == 0] Lorin> I want to find the index of all of the empty lists. List comprehensions are a pretty straightforward way to deal with this problem: >>> x = [ [1], [1,2], [], [1,2,3], [], [2], [12] ] >>> [i for i in range(len(x)) if len(x[i]) == 0] [2, 4] -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From aahz at panix.com Fri Dec 21 10:44:20 2001 From: aahz at panix.com (Aahz Maruch) Date: 21 Dec 2001 07:44:20 -0800 Subject: python threads References: <96c7f32.0112210450.174f6914@posting.google.com> Message-ID: <9vvlck$hjf$1@panix3.panix.com> In article <96c7f32.0112210450.174f6914 at posting.google.com>, curt finch wrote: > >My understanding is that python's current threads implementation >does not really allow for this in the sense that only one thread >can be running at a time, regardless of the number of chips on >the machine, and additionally that the threads cannot really >interrupt each other and still maintain correct state. > >Is that all correct? Oleg and Michael are wrong: the answer is "sort of yes and sort of no". It is true that threads running pure Python code can only run one at a time. However, as soon as a thread makes a function call into an extension, the extension can release the Global Interpreter Lock (GIL). All of the standard I/O functions (including sockets), for example, are coded this way, so that running a threaded app with a lot of I/O typically gets a heavy speed boost. If you want to do computational threading, there's no reason why you can't write an extension that also releases the GIL. The reason so little of that has been done is that computational threading only makes sense under SMP; the GIL provides superior performance with a single CPU. It *is* true that Python threads running Python code cannot interrupt each other preemptively. For more info, see http://starship.python.net/crew/aahz/ -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 10 days and counting From phr-n2001d at nightsong.com Mon Dec 31 10:28:40 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 31 Dec 2001 07:28:40 -0800 Subject: stackless python References: <9vpjds$due$1@usc.edu> <1008824522.772261@yabetcha.sttl.drizzle.com> Message-ID: <7x3d1r1k9j.fsf@ruckus.brouhaha.com> Christian Tismer writes: > I'm pretty sure Scheme can. It has raw continuations, so you can > implement everything with them, why not microthreads? > Continuations can do even more, they are able to create new > control structures for your language. And exactly that it the point > which makes them insuitable for Python: They are too powerful. > Python has its own control structures, and we don't need a construct > with the power to build some. This is oversized, and very oversized > construct turns out to be a drawback at some future. > What Python needs is a secure mechanism to switch frame changes > at certain times. This is not continuations, but microthreads with > explicit or implicit switching. The thing I don't fully understand is that several Scheme implementations are both smaller and faster than Python. I've been wondering for a while whether it's time to graft a Python parser onto a Scheme compiler/evaluator. The limitations of "simple generators" also seem kind of artificial--maybe Stackless for 2.2 can support calling a generator from multiple places. From fbartlet at optonline.net Fri Dec 28 20:44:16 2001 From: fbartlet at optonline.net (Frederick H. Bartlett) Date: Sat, 29 Dec 2001 01:44:16 GMT Subject: REPOST: printing from Word using win32com Message-ID: <5$--$$_----_-%$%%$@news.noc.cabal.int> How do I get rid of the UnicodeError in something = myWord.ActiveDocument.Paragraphs for item in something: try: print str(item).encode('latin-1') except UnicodeError: print "XXX There was a Unicode Error." Thanks! ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Frederick H. Bartlett" Newsgroups: comp.lang.python Subject: cmsg cancel <3C2D2007.AD251D51 at optonline.net> Control: cancel <3C2D2007.AD251D51 at optonline.net> Date: Mon, 31 Dec 2001 04:42:55 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774914 27193 211.57.49.2 (31 Dec 2001 05:01:54 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:01:54 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From peter.milliken at gtech.com Sun Dec 30 16:00:29 2001 From: peter.milliken at gtech.com (Peter Milliken) Date: Mon, 31 Dec 2001 08:00:29 +1100 Subject: Book "python programming patterns". anybody read this?? References: Message-ID: G'Day Cliff, "Cliff Wells" wrote in message news:mailman.1009574494.4804.python-list at python.org... > On Mon, 24 Dec 2001 06:59:21 +1100 > "Peter Milliken" wrote: > > > Generally the standard of maintenance programmer is just > > not as good as developers (otherwise they would be developing, wouldn't > > they? :-)) and so it is a well recognised tenant that I attempt to follow > - > > code for the lowest common denominator. > Sorry to hear of these experiences, I guess we all run into this kind of situation sooner or later :-). Good luck with unravelling the mess. > Anyway, my point is, I think your statement is unfounded. There are > undoubtedly cases where what you said is true, but to assume it's the > common case is wrong - especially when you consider that many people > (myself included) learned to program by developing applications, so the > quality of coding in those apps is poor (I would probably cringe if I were > to review code I wrote 10 years ago - some poor sod is probably cursing me > right now as he tries to decipher some mess I wrote =) > I am an Electrical Engineer with a single semester of Fortran and Basic :-). The rest is self-taught, on the job training that spans (depending how you count it) at least 20 - 25 years. We all "cringe" when we think of our earliest efforts - I still produce awful code when I make the mistake of thinking I can just bash out a program off the top of my head - personally, I have to sit down and think the entire application through and do a design and requirements analysis (not in that order :-)) otherwise I end up with a poorly designed and coded mess :-). Perhaps others can say they produce works of art off the top of their heads without design that they would be proud to have other programmers review - I can't. Most of us, at some stage, spend our early introduction in a maintenance environment (mine was maintaining 24 6" thick volumes of listings of assembler code which another company had been hired to provide comments for, they ended up with approximately one comment per listing page - back in '79, I think it was :-)). I am currently work in a maintenance environment. So sometimes you tend to make statements that are a bit sweeping. But I still stick by the general statement that typically, the majority of programmers in maintenance roles would not be there if they had a choice. I am an exception, I have a choice, but my choice was to get out of defence - and to erase a "stigma" of 20 years in an industry isn't easy! :-) > Besides, applications are often written without a good specification (or > only a very basic one) so the developer is left winging it, adding > features, learning new toolkits, etc, until the original architecture is > obscured beyond comprehension. Take a look at many of the open-source > projects around and you'll often find that one of the first things > "maintainers" do upon acquiring a system is recode large portions of it to > make it more readable/maintainable, etc. > Yes, I have a poor background to comment here and this may sound (almost certainly! :-)) overly harsh, because I spent most of my work experience in the defence industry. But to me, "pressure to market", "no time to analyise", "no time to design", "customer doesn't know what he wants, so we have to wing it" - are at the end of the day just excuses for the fact that *all* the people involved in the project can't be brought around to the concept/idea that you should sit down and plan the project step by step and not proceed to the next until the previous is complete i.e. sit down with the customer, analyise the requires - protype if necessary, but get them nailed down and worked out until the customer is happy that he knows what he wants!. Then the programmer should sit down and use the analsysis to generate a design (documentation! ugh, how many programmers want to spend their life doing documentation! - there is always some excuse not too! :-) "gee, if we did that then the competition would beat us to market and we wouldn't have a job" - true I am sure in some cases but I doubt this is true for the majority of cases/projects!). Then the code can be generated from the design. Overally idealistic I am sure, but that is my opinion :-) People talk about the "software crisis" - the only crisis I have seen (in my experience :-)) is the one that your typical programmer doesn't want to do "paperwork" - all he/she wants to do is generate the next coding masterpiece. A formal analysis means paperwork, a good design means paperwork (and what is worse - others have to be able to read and understand it! :-)). But most programmers want to cut code - nothing else :-). Your point about the open source projects proves the point. Nobody bothered i.e. wanted to, sit down and work out the requirements properly - that would have taken "unnecessary time", "we know what we want - lets start coding!" :-) Hence others come in after the fact and re-write the entire thing - a very expensive exercise! Peter > That said, I don't disagree with your tenant of coding for the LCD. While > not always possible, it's good to keep in mind when one is tempted to write > "clever" code =) > > Regards, > > -- > Cliff Wells > Software Engineer > Logiplex Corporation (www.logiplex.net) > (503) 978-6726 x308 > (800) 735-0555 x308 > From tismer at tismer.com Mon Dec 31 09:58:27 2001 From: tismer at tismer.com (Christian Tismer) Date: Mon, 31 Dec 2001 15:58:27 +0100 Subject: stackless python References: None <9vpjds$due$1@usc.edu> <1008824522.772261@yabetcha.sttl.drizzle.com> Message-ID: <3C307D13.1030208@tismer.com> Donn Cave wrote: > Quoth "John DeWeese" : > | Hello, I'm a python newbie interested in using stackless python to support > | hundreds of simulation objects for a game. I've checked out various articles > | and it sounds great, and I've visited stackless.com. Seems that branch is > | becoming a bit dated. I also see that some features such as generators (not > | relevant to me) have made it into python 2.2. So, what's up, can anyone > | share their experiences regarding stackless python, micro-threads, etc.? > > Stackless can really do miracles for an application design that has to > deal with asynchronous event handling of some kind. I don't think you > ever get miracles like that free, though. To work with Stackless, you > really need to keep your head screwed on - in my opinion it isn't for > casual use in every conceivable application. Raw continuations, anyway - > I don't know microthreads, that sword is probably not so double-edged. > Anyway, it's like a whole new language, and one with not much competition - > I don't know, can Scheme do that stuff? I'm pretty sure Scheme can. It has raw continuations, so you can implement everything with them, why not microthreads? Continuations can do even more, they are able to create new control structures for your language. And exactly that it the point which makes them insuitable for Python: They are too powerful. Python has its own control structures, and we don't need a construct with the power to build some. This is oversized, and very oversized construct turns out to be a drawback at some future. What Python needs is a secure mechanism to switch frame changes at certain times. This is not continuations, but microthreads with explicit or implicit switching. I will implement this for Python 2.2, probably with some help of volunteers. ciao - chris -- Christian Tismer :^) Mission Impossible 5oftware : Have a break! Take a ride on Python's Kaunstr. 26 : *Starship* http://starship.python.net/ 14163 Berlin : PGP key -> http://wwwkeys.pgp.net/ PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF where do you want to jump today? http://www.stackless.com/ From Administrator Sun Dec 2 07:47:53 2001 From: Administrator (Administrator) Date: Sun, 2 Dec 2001 05:47:53 -0700 Subject: ScanMail Message: To Recipient virus found and action taken. Message-ID: <04f201c17b2f$8ecdb5d0$0e0fbb82@corp.es.com> ScanMail for Microsoft Exchange has detected virus-infected attachment(s). Sender = Lara Kalliri Recipient(s) = python-list at python.org Subject = Re: Scanning Time = 12/02/2001 05:47:53 Engine/Pattern = 5.600-1011/173 Action on virus found: The attachment info.DOC.scr contains WORM_BADTRANS.B virus. ScanMail has Deleted it. Warning to administrator. ScanMail has detected a virus. 12/02/2001 05:47 AM TORINO info.DOC.scr/Deleted python-list at python.org Lara Kalliri Re: From luc.saffre at mail.ee Sat Dec 8 09:27:11 2001 From: luc.saffre at mail.ee (Luc Saffre) Date: Sat, 08 Dec 2001 14:27:11 GMT Subject: Article about using wxGrid (wxPython) Message-ID: <3c122258.37041542@news.cis.dfn.de> Hello, i'd like to say that i started to write an article about using the wxGrid of wxPython. I published this article on my private homepage: http://www.saffre.f2s.com/wxgrid.htm I would be glad to get some feedback since this article is a work in progress. Luc From simon at brunningonline.net Wed Dec 12 04:39:03 2001 From: simon at brunningonline.net (Simon Brunning) Date: 12 Dec 2001 01:39:03 -0800 Subject: Problems using tkSimpleDialog References: <314b29e9.0112110704.1b42edd4@posting.google.com> <9v5boc$2auh$1@norfair.nerim.net> Message-ID: <314b29e9.0112120139.5d613628@posting.google.com> "Eric Brunel" wrote in message news:<9v5boc$2auh$1 at norfair.nerim.net>... > > The problem is simple: Tk needs to be initialized before the > "tkSimpleDialog" module can work. Just do: > import Tkinter > root = Tkinter.Tk() > before calling tkSimpleDialog.askstring, and it will magically solve the > problem. > > What happens is that if you don't explicitely set the "parent" option for > your dialog, a default one is chosen which is "the" instance of the Tk class > for your application, corresponding to its main window. Apparently, if this > instance was not created "manually", the "tkSimpleDialog" module does not > create one automatically. > > Hope this helps. > - eric - Thanks Eric. That does help. Problem is, the Tkinter.Tk() thing brings up an empty parent window, which I don't want. Ah well, back to the drawing board! Cheers, Simon B. From jwbaxter at spamcop.net Mon Dec 24 01:22:36 2001 From: jwbaxter at spamcop.net (John W. Baxter) Date: Sun, 23 Dec 2001 22:22:36 -0800 Subject: f(n=4) works; bug or feature? References: Message-ID: <231220012222364805%jwbaxter@spamcop.net> In article , Sean 'Shaleh' Perry wrote: > On 24-Dec-2001 Edward C. Jones wrote: > > In Python 2.2, the following code prints a "4". > > > > def fun(n): > > print n > > > > fun(n=4) > > > > Bug or feature? > > > > feature. It is called a keyword argument. > > def func(a, b, c): > print a > print b > print c > > func(b = 1, a = 8, c = 'hello') > > The idea here is you can call the function with the arguments in any order as > long as you know their names. Hnady for long function calls like gui toolkits > or network code. And handy for functions with lots of optional arguments where you're happy with the defaults except for one or two somewhere near the "right end" of the argument list. --John From paul at prescod.net Fri Dec 28 18:00:42 2001 From: paul at prescod.net (Paul Prescod) Date: Fri, 28 Dec 2001 18:00:42 -0500 Subject: Two languages, too similar, competing in the same space. References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> Message-ID: <3C2CF99A.87FA5C71@prescod.net> Neil Hodgson wrote: > >... > > Most people are not switching to Ruby from Python but from languages like > Perl and C++, and Ruby is more than 10% better than those languages. When people get tired of Perl, for whatever reason, there was a time when Python was the next logical language. Now there is a choice and it could go either way: Python could be a better choice because it is more established, Ruby could be a better choice because it is syntactically more like Perl. > ... I'll be > quite happy if Ruby does achieve 'world-domination' and am forced to use as > it is a much better language than most. I claim that each of the languages hurts the other's bid for "world domination" or even mainstream acceptance. When programmers ask to write code in a scripting language, managers will say: "You want us to write in one of those flavour-of-the-month languages?" It seems the curse of the scripting language world to forever fork off new languages just as older ones gain a little bit of acceptance. Paul Prescod From tim at vegeta.ath.cx Sun Dec 2 02:44:16 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Sun, 02 Dec 2001 07:44:16 GMT Subject: Whatever happened to String Interpolation? References: <9u6dbn$nsj$1@peabody.colorado.edu> <837ks6se4c.fsf@panacea.canonical.org> <9uc26v$akh$1@peabody.colorado.edu> <9uckd9$o43$1@peabody.colorado.edu> Message-ID: Fernando P?rez graced us by uttering: > Tim Hammerquist wrote: [ snip ] >> This slippery slope is one of many reasons many Pythonistas don't >> want creeping featurism to infect their language. > > I honestly don't see it as a slippery slope. Ping's implementation > seems to 'do the right thing' in all cases, produces no surprises and > doesn't at all require the kind of grossness you quoted. It doesn't require said "grossness", but it didn't do what it looked like...at least not to these eyes. Again, that's just me. =) > I don't see interpolated strings as being a 'slippery slope', the > concept of special strings is *already* in the language. Fair enough. Perhaps I spoke too soon. > I certainly *don't* want to see Python go the perl route (and I've > written a lot of perl, so I know exactly what it's like). But that > doesn't mean that there aren't things where python's current syntax > can actually end up leading to unnecessary ugliness. This seems to be a quite prominent fear in this NG. ;) > In fact, things like 'blah %(var)s' to me look a lot less readable > (and line noise like, perl-like, whatever) than 'blah $var'. Or is it > that in Python there's such a rabid fear of $ as to not even admit a > case where something like it may be useful? It's possible. It's always important, though, to remember where we came from: cout << "Enter a number: " << crlf; cin >> i_num; cout << "You entered " << i_num << crlf; ;) Tim Hammerquist -- Sometimes we can choose the path we follow. Sometimes our choices are made for us. And sometimes we have no choice at all. -- Morpheus, The Sandman From cdewin at dingoblue.net.au Tue Dec 11 16:26:04 2001 From: cdewin at dingoblue.net.au (Another rookie) Date: 11 Dec 2001 21:26:04 GMT Subject: Thankyou very much References: <9v5ea4$d1ek8$1@ID-119882.news.dfncis.de> Message-ID: <9v5tlb$d81ug$2@ID-119882.news.dfncis.de> Thankyou very much for your help Gerard, Gary and Alex. From phr-n2001d at nightsong.com Sun Dec 23 06:38:07 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 23 Dec 2001 03:38:07 -0800 Subject: SnoPy 0.1 - SNOBOL pattern matching for Python References: Message-ID: <7x4rmi88v4.fsf@ruckus.brouhaha.com> Don Rozenberg writes: > SNOBOL was a text processing language without equal that was > developed at Bell Labs in the 1960's. It has nearly died out but I > am offering this extension as an alternative to regular expressions. > In many respects, SNOBOL pattern matching is much more powerful yet > easier to learn than regular expressions. Wow, cool. A lot of SNOBOL patterns can be transformed into regular expressions. However, a lot of them can't be. Regular expressions have caught on as a pattern language because they can be interpreted very efficiently. Completely general SNOBOL patterns can be extremely slow to interpret. When SNOBOL was invented, these things weren't understood as well as they are now. The successor to SNOBOL is called ICON: http://www.cs.arizona.edu/icon Python draws some ideas from Icon and looking at Icon will probably be interesting to Python fans, even if they don't take up programming in it. From debl2nonospammy at bellatlantic.net Sat Dec 29 19:51:24 2001 From: debl2nonospammy at bellatlantic.net (David Lees) Date: Sun, 30 Dec 2001 00:51:24 GMT Subject: REPOST: Re: win32all-141 for Python 2.2 References: <3C2D4676.5060700@skippinet.com.au> Message-ID: <0$--$$_----__$%--$@news.noc.cabal.int> Thanks for posting this. I am having an installation problem, probably due to other versions of Python on my Win98 box. I have both ActiveState 2.1.1 and the 2.2 version from the python.org site. An error occurs during win32all-141 installation saying that an AXScripting Engine can not be registered. Also something a problem with the python21.dll. When I start up PythonWin the interactive window says '2.2', but the 'About' menu item says this is Activestate 2.1.212. It looked like the installation was going into the python.org 2.2 directory (the installer did not have an option to change installation directory). david lees Mark Hammond wrote: > > I have made a new win32all release for Python 2.2. > > Hrmm - it seems I can't login to starship :( So I have temporarily > placed it at: > > http://users.bigpond.net.au/mhammond/win32all-141.exe > > The only new known issue is that "Active Debugging" will probably not > work - using the Microsoft Debuggers when using Python in an ASP or IE > page will fail. > > I will move this to starship, including details of exactly what has > changed, ASAP. > > Mark. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: David Lees Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E6515.6A957604 at bellatlantic.net> Control: cancel <3C2E6515.6A957604 at bellatlantic.net> Date: Mon, 31 Dec 2001 02:49:21 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774445 27193 211.57.49.2 (31 Dec 2001 04:54:05 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:54:05 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From stephen at theboulets.net Sun Dec 9 23:04:42 2001 From: stephen at theboulets.net (Stephen Boulet) Date: Sun, 09 Dec 2001 22:04:42 -0600 Subject: questions about of writing python scripts References: Message-ID: You could use the 'type' command to find out the type of a variable. -- Stephen ed wrote: > Hi I have a question regarding writing python scripts.. > for large program written i python,, One thing i notice is it needs to > run to the specifc piece of code i order to detect error. let's say > the valaue is assigned to a wrong variables, I cannot know in advance, > > say I have > b = 1 (defined way earlier) > if x == 1: > a = b > else: > a = c > which a to be used as interger later on. > > x being passed in eariler. > since b is deinfed I can assign to it, > > but c is floating and has not value and a got assgined to it. ... in > other compiation lang, this type of error will be caught in > compilaiton time, but I can't using python.. is ther any utility or > way to catch this type of error way ahead? > thankx From pzw1 at hotmail.com Tue Dec 11 09:44:47 2001 From: pzw1 at hotmail.com (Peter Wang) Date: 11 Dec 2001 06:44:47 -0800 Subject: __init__ concerns References: <9v4ov301ukq@enews4.newsguy.com> Message-ID: "Alex Martelli" wrote in message news:<9v4ov301ukq at enews4.newsguy.com>... > have to stick with it if you're stuck on Python 1.5.2. In modern > Python, > > def __init__(self, *args, **kwds): > BASECLASS.__init__(self, *args, **kwds) > # whatever else you need here > > is a very typical idiom, and I don't see any "kind of a kludge" are > about it (and, of course, variations were args and/or kwds are tweaked > somehow before delegating to a base class's __init__). ah, i was not aware that python 2.0 had this particular construct. i'll have to go back and read the ChangeLogs. :) you're right, the new notation is not a kludge at all, and i was actually a bit disappointed that this was not the behavior in 1.5.2. (the old style of using apply() seemed a bit... uncouth.) thanks to everyone who replied! -peter From BPettersen at NAREX.com Wed Dec 5 12:20:57 2001 From: BPettersen at NAREX.com (Bjorn Pettersen) Date: Wed, 5 Dec 2001 10:20:57 -0700 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) Message-ID: <60FB8BB7F0EFC7409B75EEEC13E20192215120@admin56.narex.com> > From: Courageous [mailto:jkraska at san.rr.com] > > >Can you give an example of how spaces must creep in on continuation > >lines? > > ##--snip; not in particular the column-positioning of the "or". If > ## tabs are used here, it will be misaligned with other > ## tabstop stettings for certain > > if isinstance(f, future.Step) or \ > isinstance(f, future.Status) or \ > isinstance(f, future.Announce) or \ > isinstance(f, possibility.Observe) or \ > isinstance(f, future.Incarnate) or \ > isinstance(f, future.Start) or \ > isinstance(f, future.Timeout): Ack, so much typing :-) klasses = [future.Step, future.Status, ...] if filter(lambda x: isinstance(f,x), klasses): > ##--snip; in this case, the continuation line is lined up on the > ## string boundary to create some congruity between the code > ## and the message produced > > log.Fatal("Unexpected RETURN intercepted from user code.\n" > "This is almost certainly due to an > inappropriate explicit\n" > "or implicit use of return in an Task. HINT: > Make sure\n" > "to use Fail(), End(), or Succeed() to > terminate a Task,\n" > "The most suspicious task is probably this > one:\n\n"+lastFuture.String()) Ugly... txt = """ Unexpected RETURN intercepted from user code. This is almost certainly due to an inappropriate explicit... """ log.Fatal(txt) > ##--snip; here, like the or, the actions are put into a column. > ## simple actions, organized like this are both compact and > ## readable. > > if methodname==self.task.name: methodname="-" > else: > methodname=methodname[0:20]+"()" > > if self.task.status: > stat=status.strings[self.task.status] > else: stat="UNKNOWN" > > if self.absoluteT == simulator.ticks: when="now" > else: when="future" If anyone writes code like that on any of our projects they'll be shot . When one of the if tests change it usually causes a cascading re-indent of the second column. We use tabs exlusively for all our projects, and in practice there is never a problem getting things to line up (I guess as with the "whitespace-for-indentation" issue you'll have to try it before you believe it). -- bjorn From aahz at panix.com Sat Dec 29 17:06:33 2001 From: aahz at panix.com (Aahz Maruch) Date: 29 Dec 2001 14:06:33 -0800 Subject: Is learning Python "extraordinary"? References: Message-ID: In article , Jesse F. W wrote: > > I am a high school senior, and like many others, I am applying >to college. I am applying to MIT (as well as many other schools). >MIT describes what they are looking for as students who do or have >done "extraordinary things". My question is this, Is teaching myself >Python (with the aid of the Python tutorials and some help from the >various lists) an "extraordinary thing"? How many python-list'ers are >high school students? No, it's not an extraordinary thing. We used to have an 11-year old posting here. However, I *would* say that learning Python is extraordinarily smart. If you have a taste for masochism, learning Perl well enough to be a guru would be extraordinary. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 2 days and counting From phd at phd.pp.ru Thu Dec 13 07:35:09 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Thu, 13 Dec 2001 15:35:09 +0300 Subject: Calling member functions? In-Reply-To: ; from david_j_dawkins@spamless.hotmail.com on Thu, Dec 13, 2001 at 12:22:17PM -0000 References: Message-ID: <20011213153509.J9671@phd.pp.ru> On Thu, Dec 13, 2001 at 12:22:17PM -0000, David Dawkins wrote: > > > self.m_method(self.m_object) ## naive attempt > > > > ^^^^^^^^ You call a method with one argument, but the > > Callback method does not accept any arguments. > > but then how does Handler.Callback receive its own "self" value? In this m_method is not a method - it is *bound* method! It is h.Callback - an object, that stores both h and Callback! So when you call it, Python gets the self for Callback from the bound method; the self will by just h! Understand? vvvvvvvvvv - you initialized m_method with the bound method > > > n = Notifier( h, h.Callback ) Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From keyton at weissinger.org Fri Dec 14 21:56:40 2001 From: keyton at weissinger.org (A. Keyton Weissinger) Date: Fri, 14 Dec 2001 21:56:40 -0500 Subject: Package Question - please help. In-Reply-To: <59E456FD3AD1FE80.FF0578E51CFDE7B5.7FEBAE7CEB1F44D9@lp.airnews.net> Message-ID: I'm having a (possibly newbie) package import problem. I have (on a Win2K box) the following dir setup: c:\package1 \__init__.py \subpackage1 \__init__.py \myCode.py \subpackage2 \__init__.py \testMyCode.py testMyCode.py is a unit test for myCode.py. It attempts to load a class from within myCode.py with something like the following: from package1.subpackage1.myCode import MyClass I've added c:\package1 to the path (by adding it in the registy -- is there an easier way?). If I attempt to run testMyCode.py from within subpackage2, it dies and gives me: Traceback (most recent call last): File "testMyCode.py", line 3, in ? from package1.subpackage1.myCode import MyClass ImportError: No module named package1.subpackage1.myCode BUT, if I move that file to the root (c:\) and run it from there, it runs like a champ. >From the docs, I think I am doing it right (there is a __init__.py file where it needs to be, I'm using the right syntax, etc). So why is this not working???!?!?! Thank you in advance. Keyton From kragen at pobox.com Thu Dec 6 12:37:16 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 06 Dec 2001 12:37:16 -0500 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> Message-ID: <83wv00mer7.fsf@panacea.canonical.org> s.keim at laposte.net (sebastien) writes: > In standard python, dates are defined with two formats: > * os module use the POSIX format (elapsed time in seconds since the > 1970-01-01) > * a tupple is defined in the time module > They are low level format, not really user-friendly. I sort of agree, but I tend to think that the tuple would be OK if it was an object with named attributes instead of just being a tuple. The POSIX format (in floating point) has the additional problem that it loses precision as we get far from 1970. Perhaps you could include code samples demonstrating how your proposed module would make user code simpler? > What exist today for Python > > A powerful mxDateTime tools already exist but this package is probably > to complex to go on the standard distribution[3]. > > NormalDate define also a light date class[2]. Can you outline what these packages provide? > This intermediate format could be defined as a floating point > representing the modified juian day numbers[5]. > This will be called MJD (Modified Julian Day) in the next part of the > document. > > In this format, the integer part correspond to the number of elapsed > days since the start of the day 1858-11-17 CE. Negatives numbers are > allowed for date before 1858-11-17. The decimal component is the > fraction of the day corresponding to hour minutes and seconds, > expressed in GMT. It might be useful to express the time in TAI rather than GMT, although that distinction ceases to be meaningful outside of modern times. I don't know if this is a substantive objection or not, but this will lose precision as we move further from 1858. IEEE-754's 64-bit format has 52 bits of mantissa, or about 15 or 16 decimal digits; by my possibly-flawed calculations, that means we can express nanoseconds for about a month or two on either side of the epoch, microseconds for about 90 years on either side of the epoch, milliseconds for about 90,000 years on either side of the epoch, and seconds for about 90 million years on either side of the epoch. I'm not sure what not being able to calculate Jurassic times in milliseconds costs us, but I thought I should mention it. Given that Python has arbitrary-precision integers, it might be best to just use them. > I feel this solution better than the POSIX convention to count the > elapsed time in seconds because not all the days have the same length. > About once every year or two there is an extra second, called a "leap > second" added as the last second of the December 31 or June 30. For > example, the last minute of the year 1995 was 61 seconds long, thanks > to an added leap second. In MJD format, this seconds won't accumulate > for years to years. This is why using TAI is a good idea. Note that this means you can't use your date module to calculate time intervals easily; in the POSIX format, you can say, "What time is one hour later than 1995-12-31 23:30:00 UTC?" by adding 3600 to the number of seconds and get the correct answer, which is 1996-01-01 00:29:59. > Properties are new in python 2.2, they allow us to assign assessors > methods to an attribute. They can be emulated in older Python versions with __getattr__ and __setattr__. > That mean that: > - x.day = value will call something like x.set_day(value) > - value = x.day will call value = x.get_day() This is a wonderful idea. From loewis at informatik.hu-berlin.de Fri Dec 28 18:15:59 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 29 Dec 2001 00:15:59 +0100 Subject: pth files - can they prepend to sys.path? References: Message-ID: "Skip Montanaro" writes: > You are one sly dog, Martin... ;-) I added the import facility to .pth files, so I should know how to use it :-) Turns out I didn't ... Due to what I would consider a bug in that facility, adding a line import sys;sys.path.insert(0,"/tmp") also has the desired affect, without requiring a helper module (originally, the plan was that import lines only contain a single import statement; that constraint is not enforced). Regards, Martin From java at dejazzd.com Tue Dec 4 12:57:55 2001 From: java at dejazzd.com (Glenn S.) Date: 4 Dec 2001 09:57:55 -0800 Subject: upload file via form References: Message-ID: <31495c21.0112040957.61bbf3a5@posting.google.com> See my notation in your cgi code below, marked --> That'll stuff the file into the response back to the browser. If you want to do things like properly handle images, etc., you need to do a bit more. Iddo Friedberg wrote in message news:... > Hi, > > This seems like a FAQ, but looking at the newsgroups, manuals etc. I could > not find a reference to this. > > I am trying to load a file to the server via a form. > > #!/usr/local/bin/python > import cgi > > form = cgi.FieldStorage() > if form['userfile'].file: > contents = form['userfile'].file.value -->contents = form['userfile'].value > else: > contents = "Nothing here!" > > print "Content-type: text/html" > print > print "

"
> print contents
> print "
" From objectway at divalsim.it Fri Dec 21 07:38:29 2001 From: objectway at divalsim.it (Nicola Musatti) Date: Fri, 21 Dec 2001 13:38:29 +0100 Subject: An hour's talk on python...Suggestions required (from a newbie) References: Message-ID: <3C232D45.224DE9CC@divalsim.it> Karthik Gurumurthy wrote: > > hi all, > > Our company does'nt use python. many have'nt even heard of it. > hi all, > > Ours is mainly a java shop. > > We have lots of internal training sessions @ our place. > Anyone with a decent knowledge of a particular subject can take such > sessions. > I was planning to take an introductory session on python. > > I feel irrespective of how good the language is, not many > w'd want to try it out unless and otherwise they can see lots of > supporting tools and libraries. > > It has to be a 1 hour talk. > Can someone give me pointers as to how this session c'd be organized? Just a few ideas off the top of my head: 1) Python is easy. Show how simple and consistent the syntax is. It should be easy to come out with simple examples that do useful things. 2) Python solves your problems. Show how possibly the standard library, or publicly available tools and libraries can be put to profit in solving your company's problems. Consider showing Jython, given yours is a Java shop. > 1. functional programming in python This seems an advanced topic for people who probably never heard about the language. Are you targeting someone's specific interests? > 2. about new features that have been included in 2.2? Again, do you think that people that never heard about tuples will be concerned with the latest, niftiest features? > 3. threading as for as tools/libraries are concerned, > 4. GUI : Tkinter Or AWT/Swing via Jython (show that you can interactively program Java!) > 5. xml?? : the one which ships with standard module or something else? > 6. cgi: Even the standard module lets you show how you can set up cgi scripts in seconds. > am kind of a newbie. So am I :-) > But i want to develop some interest here @ my place. Good. > Any suggestion w'd be of great help to me. Hope I've helped you. Cheers, Nicola Musatti From chris.gonnerman at newcenturycomputers.net Fri Dec 14 08:06:21 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Fri, 14 Dec 2001 07:06:21 -0600 Subject: what is self._base? References: <3C19EC50.153B76A1@doc.ic.ac.uk> Message-ID: <003501c184a0$27072ce0$0101010a@local> ----- Original Message ----- From: "Benjamin Tai" > Hi, > > I have come across the following statement in a constructor (Programming > Python by Mark Lutz). After extending a type in C (stacktype), it is > wrapped by a Python class (Stack). > > import stacktype > class Stack: > def __init__(self, start=None): > self._base = start or stacktype.Stack() > > However I can't find any documents/explanation for the following: > > 1) What is "_base" Without the rest of the class it's hard to say for sure, but it appears to be a container for the stacktype.Stack() object that this Stack class is wrapping. > 2) What is "start=None" An argument definition for an arg named "start" which by default will be None if the programmer doesn't provide it. > 3) Why can't I just write "self = stacktype.Stack()" Because self is the Python class instance for Stack; changing it as you suggest in local scope won't change anything, and if it did it would be the wrong thing to do. > > Any help for this newbie would be appreciated. When you "wrap" a C extension class you are usually doing so to make a non-object oriented C 'thing' (I am loathe to say 'object' here) behave as an object-oriented Python 'thing'. So, you generally have some instance attribute (such as _here in this case) to contain the C 'thing' which you are wrapping; then you define methods to act on this 'thing' and voila, you have an object. From drollo at cns.net.au Tue Dec 4 21:19:09 2001 From: drollo at cns.net.au (David Rollo) Date: Wed, 05 Dec 2001 02:19:09 GMT Subject: Is Python suitable for some binary file editing? Message-ID: <1FD639F0.1DA46084@cns.net.au> Hi I am considering as a beginning Python project an iterative task involving conversion of a set of image files to an alternative format. The file conversion is simply making the same change to a handful of characters at a particular offset, and saving under a new filename. It would be repeated several thousand times, looping through a hierarchical directory structure in Windows, editing and renaming as it went. Does this sound like the sort of task that Python is suited to? I had planned to do it in Java, but wondered if this might be the time to cut teeth in Python. Any pointers to existing code base or similar resources would be welcome. Thanks David Rollo From 013-139047 at telia.com Tue Dec 18 17:55:24 2001 From: 013-139047 at telia.com (Christer Frovik) Date: Tue, 18 Dec 2001 22:55:24 GMT Subject: Python equivalent to @lines = 'command'; References: Message-ID: Tim Hammerquist wrote: > Not familiar with PERL, but I'm quite familiar with Perl. > > You seem to be looking to pipe a command's output to a variable > (which is all Perl's backticks really do). Look at the os.popen family > of functions, in this case, os.popen() > > import os > lines = os.popen('ls -1').readlines() > for line in lines: > process(line) Thanks, you've made my day. I wish those pyTHON (giggle) tutorials would include more of these 'neat recepies'. /CF From support at internetdiscovery.com Sat Dec 8 19:46:01 2001 From: support at internetdiscovery.com (Mike Clarkson) Date: Sun, 09 Dec 2001 00:46:01 GMT Subject: New windows case sensitivity in Python 2.1? References: Message-ID: <3b420331.6014969@24.0.228.33> On Sun, 24 Jun 2001 00:31:15 -0400, "Tim Peters" wrote: >Case-destroying archivers and installers are also a vanishing breed, but I >didn't think that also needed to be said . The installer was Microsoft Windows Installer, and the archiver was Unix tar from RedHat Linux, onto a VFAT mounted partition. I don't think either are about to vanish any time soon . oh-joy-another-environment-variable-required-by-the-interpreter-ly, Mike. From debl2nonospammywhammy at bellatlantic.net Thu Dec 27 12:47:08 2001 From: debl2nonospammywhammy at bellatlantic.net (David Lees) Date: Thu, 27 Dec 2001 17:47:08 GMT Subject: REPOST: Re: A new forum is up! References: <40dbad98.0112262238.73fc14f9@posting.google.com> Message-ID: <3$--$$_----_%-$$-$@news.noc.cabal.int> It is a bit hard to tell what the 'feel' is, with only 1 message(containing 4 words) posted in the whole forum. Reading the privacy statement, cookies are used by this site, if anyone cares. david lees Andrew Nguyen wrote: > > A new forum for Python is up. It has a better feel to it than this > forum (in my opinion) > it is at ezboard at: > http://pub19.ezboard.com/bthepythonmessageboard95602! ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: David Lees Newsgroups: comp.lang.python Subject: cmsg cancel <3C2B5E9F.FF1C2CC at bellatlantic.net> Control: cancel <3C2B5E9F.FF1C2CC at bellatlantic.net> Date: Mon, 31 Dec 2001 04:45:51 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775706 27193 211.57.49.2 (31 Dec 2001 05:15:06 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:15:06 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From ben at wblogan.net Sat Dec 8 16:29:32 2001 From: ben at wblogan.net (Ben Logan) Date: Sat, 8 Dec 2001 16:29:32 -0500 Subject: Need help with regular expression In-Reply-To: <9utsd5$blr$1@peabody.colorado.edu>; from fperez528@yahoo.com on Sat, Dec 08, 2001 at 01:14:49PM +2328 References: <20011208113002.A21206@newcreature.org> <9utsd5$blr$1@peabody.colorado.edu> Message-ID: <20011208162932.C27993@newcreature.org> I did a Google search on re's, but not that exact one. Thanks, I'll try it, too. Regards, Ben On Sat, Dec 08, 2001 at 01:14:49PM +2328, Fernando P?rez wrote: > google(python regular expressions) yet? > > the first hit pretty much sums up what you need to know. -- Ben Logan: ben at wblogan dot net OpenPGP Key KeyID: A1ADD1F0 From fredrik at pythonware.com Sat Dec 1 15:59:05 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sat, 01 Dec 2001 20:59:05 GMT Subject: Python-2.2b2 bug? Misc/Makefile.pre.in References: Message-ID: Marcin 'Qrczak' Kowalczyk wrote: > What happened to Misc/Makefile.pre.in? http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/python/dist/src/Misc/Attic/Makefile.pre.in says: Fri Oct 26 14:54:16 2001 UTC (5 weeks, 1 day ago) by akuchling FILE REMOVED Delete Makefile.pre.in (BDFL pronouncement) From bkc at Murkworks.com Mon Dec 31 10:04:33 2001 From: bkc at Murkworks.com (Brad Clements) Date: Mon, 31 Dec 2001 10:04:33 -0500 Subject: Cancel messages References: Message-ID: <3c307f1c$1_6@news.newsgroups.com> But I see one of my posts "Reposted", but I didn't do it. Something is "automatically" reposting cancelled messages. -- Brad Clements, DevNet Sysop 5 Developer Network Sysop Team "Aahz Maruch" wrote in message news:a0psh4$nbs$1 at panix3.panix.com... > [posted to c.l.py with cc to python-list-admin] > > In article , > Gerhard =?iso-8859-1?Q?H=E4ring?= wrote: > > > >What's going on here? A mailman bug from the mail <-> news gateway, or > >somebody coverage-testing their Mozilla?! > > Let's just say that the mental health profession is falling down on the > job. Unfortunately, one of the side effects of these cancel floods is > that we get counter-flooded by people resurrecting the original article. > If you have any say over your netnews server, you should probably set it > up to reject both cancels and resurrections. > > I don't think that cancels affect python-list, but the admins should > probably set up a filter to ignore the REPOST: articles based on the > X-Reposted-By: header. > > > -- > --- Aahz <*> (Copyright 2001 by aahz at pobox.com) > > Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ > Androgynous poly kinky vanilla queer het Pythonista > > Tenth Virtual Anniversary: TODAY! -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- From MarkH at ActiveState.com Mon Dec 3 17:39:29 2001 From: MarkH at ActiveState.com (Mark Hammond) Date: Mon, 03 Dec 2001 22:39:29 GMT Subject: COM "out" Variant Array params and such References: <3C0AC811.4000406@ActiveState.com> Message-ID: <3C0BFFA9.8030707@ActiveState.com> Michael Kelly wrote: >>The correct way to call this should be: >> >>VariantArrayOfStrings = MyIniFile.ReadSections("Section name") >> > > I implemented it that way initially but had all kinds of problems with > clients in other languages, so I changed it to an out param that was > not a retval and that cleared things up for at least VB6, D5 and > Vc++6. It should work the same way from Python whether retval or out. If you have *both* a retval and an out param, then you specify both: rc, VariantArrayOfStrings = MyIniFile.ReadSections("Section name") > I noticed something that sounded similar on the bug list. Is > ActivePython using an older build of win32-all?? There seems > to be a download for a newer build on the ActivePython site > but it stipulates it's for use with the other dist. I downloaded > it but I'm wondering if unpacking on top of ActivePython will > hose my installation? The latest ActivePython and win32all are identical. The next version of either/both should have this fix. Mark. From Tom.Karas at htp-tel.de Sun Dec 16 17:30:13 2001 From: Tom.Karas at htp-tel.de (Tom Karas) Date: Sun, 16 Dec 2001 23:30:13 +0100 Subject: How 2 invoke python 2 read from text file under W2k References: <3C1BBECF.E460DBEC@htp-tel.de> <3C1BCA57.C5E59D9B@bellatlantic.net> <3C1CBFE3.B106A192@htp-tel.de> <20011216133108.098$Dn@news.newsreader.com> Message-ID: <3C1D2075.903F3A61@htp-tel.de> "Hernan M. Foffani" wrote: > > Define a function and call it later. like: > > def cooked_or_raw(): > temperature = input("What is the temperature of the spam?") > if temperature > 50: > print "The salad is properly cooked." > else: > print "Cook the salad some more." > > cooked_or_raw() I did so in the shell and recived the error message: "File "", line XX cooked_and_raw() ^ SyntaxError: invalid syntax" What do i have to do do end my code inserting and to lance a normal call command like cooked_or_raw() ? I started to play arround with the code from the installed "sliderdemo.py" and i can generate a window and can add a button. But the code is to complex to understand fully. May be there is a more educational version of the sliderdemo.py - so that one can start with a full working example and learn the elements step by step. Thanks for your help. cu best regards tom karas From fredegar at haftmann-online.de Mon Dec 17 13:10:28 2001 From: fredegar at haftmann-online.de (Fredegar) Date: Mon, 17 Dec 2001 18:10:28 +0000 Subject: PyGTK on Windoze References: <3C1A2250.6060108@haftmann-online.de> Message-ID: <3C1E3514.4030203@haftmann-online.de> > The binaries provided on this site are for python-1.5.2 and > python-2.0. Looks like you are using python-2.1, did you compile the > extensions yourself? The downloaded binaries won't work. Yes, I have python 2.1 Thanks, Fredegar From Bruce at EckelObjects.com Sun Dec 9 13:35:59 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Sun, 09 Dec 2001 10:35:59 -0800 Subject: Does 'super' exist? In-Reply-To: References: Message-ID: <200112091035590810.00D64FBA@mail.rdc1.sdca.home.com> You refer to this: def super(self): return self.__class__.__bases__[0] class D(C): def hello(self): super(self).dothis(self) which flips a little experience switch in my head: If I do something like this which is ONLY a renaming of some existing thing (especially such a fundamental, important thing as a base-class call), and which doesn't actually add value, then people spend valuable brain cycles translating it in their head, and I end up having to explain it so many times so that it becomes embarrassing. This happened to some degree with Java's awful 'System.out.println()' which I tried shortening to prt() or something, but finally realized that everytime someone saw that they'd have to think "oh, that's actually System.out.println()," wasting one of the 7+-2 things they can hold in their head at any one time. *********** REPLY SEPARATOR *********** On 12/9/01 at 12:09 PM Tim Peters wrote: >[Bruce Eckel] >> Thanks. Looks like the syntax for calling the base-class B's >> constructor would then be: >> super(B, self).__init__() >> I see the value of super() for MI but I was thinking I might get a >> free ride in the form of less typing for SI base-class calls. Oh >> well. > >You may someday, but not in 2.2. The new 2.2 class features, from super() >to staticmethod(), are spelled in a very Lispish way. Guido is keen to add >nicer syntax for some (perhaps all) of them, but in later releases. For >SI, >you can get less typing today by doing, e.g., > > B.__init__(self) > >Another idea is in > > http://aspn.activestate.com/ASPN/Mail/Message/248323 > > >-- >http://mail.python.org/mailman/listinfo/python-list Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From jason at jorendorff.com Wed Dec 19 18:10:24 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Wed, 19 Dec 2001 17:10:24 -0600 Subject: Strange behavior of weak references (weakref module) In-Reply-To: <6c92a8bc.0112180601.2ac4a6f0@posting.google.com> Message-ID: > I found this behavior (bug?) when I want to create weak reference to a > instance method. It's hard to describe (using my poor English writing > ability), so I just attach the way to reproduce the situation. And > notice that the id() of a instance method reference changes after each > function call! This is correct behavior. Each time you do a.test, Python creates a new "bound instance method" object. >>> class A: ... def foo(self, word): ... print "foo:", word ... >>> a = A() >>> m = a.foo >>> m.im_self <__main__.A instance at 0x00948648> >>> m.im_func >>> You can create a "weak method reference" type that makes weak references to both the object and the function. import weakref class WeakMethod: def __init__(self, method): self.self_ref = weakref.ref(method.im_self) self.func_ref = weakref.ref(method.im_func) def __call__(self, *args, **kwds): im_self = self.self_ref() im_func = self.func_ref() if im_self is None or im_func is None: # One or both of the references died. Do nothing. return else: args = (im_self,) + args return im_func(*args, **kwds) For example... >>> a = A() >>> z = WeakMethod(a.foo) >>> z("spam") foo: spam >>> del a # Get rid of a >>> z("eggs") # Does nothing, because the instance a is gone. >>> ## Jason Orendorff http://www.jorendorff.com/ From john at ablogic.ru Tue Dec 25 00:05:21 2001 From: john at ablogic.ru (Evgeny Jonson) Date: Tue, 25 Dec 2001 15:05:21 +1000 Subject: string compare question.Please Help!!! References: <001f01c18ceb$fdb53900$4301010a@sky> Message-ID: <020301c18d01$c2b04460$0effa8c0@dbaseserver> #For IP addres something like this: import string import sys def ip_cmp(ip1, ip2): """Compare IP addreses as strings """ l_ip1 = ip1.split('.') l_ip2 = ip2.split('.') if len(l_ip1) == 4 and len(l_ip2) == 4: s_ip1 = string.zfill(l_ip1[0], 3) + '.' + \ string.zfill(l_ip1[1], 3) + '.' + \ string.zfill(l_ip1[2], 3) + '.' + \ string.zfill(l_ip1[3], 3) s_ip2 = string.zfill(l_ip2[0], 3) + '.' + \ string.zfill(l_ip2[1], 3) + '.' + \ string.zfill(l_ip2[2], 3) + '.' + \ string.zfill(l_ip2[3], 3) resault = cmp(s_ip1, s_ip2) else: print 'Wrong IP addres format!' sys.exit(0) return resault # my test print ip_cmp('10.66.73.78','10.0.0.0') # return 1 print ip_cmp('10.66.73.78','10.255.255.255') # return -1 From woodsplitter at rocketmail.com Thu Dec 6 20:46:43 2001 From: woodsplitter at rocketmail.com (stalin) Date: 6 Dec 2001 17:46:43 -0800 Subject: Newbie - Exporting Excel Spreadsheet References: <673dc1dc.0112051334.370c75f2@posting.google.com> Message-ID: <7876a8ea.0112061746.145c1e76@posting.google.com> [James Fugard wants to automate Excel with Python] I've never used ODBC to access data stored in an Excel spreadsheet, but once you have a cursor you might do something along these lines: while 1: record = cursor.fetchone() if record is None: break print record # whatever calculations When it comes to writing any changes back to the spreadsheet, I imagine you'd need an ID column and an update statement such as: update "Client Data Log$" set ResultCol = theResultOfMyCalculations where IDCol = id As I said, I've never accessed an Excel spreadsheet with ODBC, so I don't have much advice. I have automated Excel with COM, however; here's some sample code and random comments that I sloppily threw together, targeted at newbie level. If posting mangles the code, I can e-mail it to you as a zipped .py: ------------------------------------------------------------ # Disorganized, rambling Python->Excel 97 automation sample # Requires the ActiveState Win32 extensions: # http://aspn.activestate.com/ASPN/Downloads/ActivePython/Extensions/Win32all # Take a look at this page for a chart of the Excel object model: # http://msdn.microsoft.com/library/default.asp?url=/library/en-us/modcore/html/deovrmicrosoftexcel2000.asp # and this one for documentation: # http://msdn.microsoft.com/library/default.asp?url=/library/en-us/modcore/html/deovrworkingwithmicrosoftexcelobjects.asp # This is, of course, sloppy code. You should definitely # take careful error-handling precautions in a "real" # program, lest you create objects and never destroy them # because an exception gets thrown midway through your # program (try... finally is your friend). # Of course, you'd also want to input the filenames from # some external source such as sys.argv or a through a # client module's function parameters. WORKBOOK_IN_FILENAME = r'c:\temp\test.xls' WORKBOOK_OUT_FILENAME = r'c:\temp\test-out.xls' import os from win32com.client import Dispatch # Get a reference to a running Excel instance or create a # new instance if there is not a running instance available. xlApp = Dispatch('Excel.Application') # You definitely want the application visible for the # development phase in case an unhandled exception ends # your program prematurely, leaving the application # object open. xlApp.Visible = 1 # Load the workbook (i.e., .xls file). xlApp.Workbooks.Add(WORKBOOK_IN_FILENAME) # Get first worksheet in first workbook (1-based). # You could use the book/sheet names instead of their indices. dataWorkbook = xlApp.ActiveWorkbook dataSheet = dataWorkbook.Worksheets(1) # xlApp.Workbooks is an example of a Collection. "Calling" # the collection (e.g., xlApp.Workbooks(x)) looks up workbook # x, much as applying the lookup operator (square bracket) to # a sequence or mapping in Python looks up the value at the # specified index or key. Collection elements can usually # can be referenced either by index or key, as demonstrated # on the following line: # xlApp.Workbooks(1).Worksheets('Sheet1').Name # In my opinion Collections are an unholy union of sequences # and mappings; the dual access options are confusing, but # I suppose it seems natural to some. Not very Pythonic, # certainly (not that anyone claimed Collections were # Pythonic). Oh, and their 1-based nature drives me nuts. # When one "calls" a collection, one is actually invoking # its default method, Item. Thus, # xlApp.Workbooks(1) # is equivalent to # xlApp.Workbooks.Item(1) # The most important collections are: # - the Workbooks collection of the Application object # - the Worksheets collection of Workbook objects # - the Charts collection of Workbook objects # - the Cells collection of Worksheet and Range objects # Collections have the following methods: # - Item(index) (the default method discussed above) # - Add(item[, key]) # - Remove(index) # Collections have one read-only property: # - Count # There are also some handy shortcut variables defined: # - ActiveWorkbook # - ActiveSheet # - ActiveCell print 'Manipulating worksheet named "%s"' % dataSheet.Name # Note that COM returns Unicode strings rather than ASCII strings. # Print the value of cell G12. g12 = dataSheet.Range('G12') print 'The value of cell G12 is', g12.Value # Set the value of cell G12 to 'hello'. g12.Value = 'hello' print 'The value of cell G12 is now', g12.Value # Print the value of each cell in A1:B10. subRange = dataSheet.Range('A1', 'B10') rowCount, colCount = subRange.Rows.Count, subRange.Columns.Count print ('About to loop through a range of %d rows by %d columns.' % (rowCount, colCount)) for row in range(1, rowCount + 1): # Remember that Collections are 1-based (gag)! for col in range(1, colCount + 1): print dataSheet.Cells(row, col).Value, print # If you don't want Excel to whine about unsaved files and the like, # set the Application object's DisplayAlerts property to false, as in # xlApp.DisplayAlerts = 0 # In this case I'm programmatically saving the changes, so user prompts # won't be a problem. # Save the changes to another file and exit. if os.path.exists(WORKBOOK_OUT_FILENAME): os.remove(WORKBOOK_OUT_FILENAME) print 'Saving changes to', WORKBOOK_OUT_FILENAME dataWorkbook.SaveAs(WORKBOOK_OUT_FILENAME) dataWorkbook.Close() xlApp.Quit() ------------------------------------------------------------ From mail at andreas-penzel.de Sat Dec 1 07:22:52 2001 From: mail at andreas-penzel.de (Andreas Penzel) Date: Sat, 1 Dec 2001 13:22:52 +0100 Subject: password question on startup Message-ID: <9uai36$796f8$1@ID-69142.news.dfncis.de> Hello NG! I want that on the programm-start the user has to give user-id and password. The password should not be seen on the screen, only e.g. stars. What to do? Thanks, Andreas From eeskoe at yahoo.com Mon Dec 17 16:27:19 2001 From: eeskoe at yahoo.com (Erika Skoe) Date: Mon, 17 Dec 2001 15:27:19 -0600 Subject: deleting from bsddb Message-ID: <9vlnmp$12ck$1@news.doit.wisc.edu> i don't see the syntax anywhere for deleting an element from a bsddb. any hints? -e From sholden at holdenweb.com Wed Dec 12 18:57:53 2001 From: sholden at holdenweb.com (Steve Holden) Date: Wed, 12 Dec 2001 18:57:53 -0500 Subject: mod_python vs mod_snake References: Message-ID: <17SR7.17998$8N6.525682@atlpnn01.usenetserver.com> "Xavier Defrang" wrote ... > > Hi, > > I've got a Python CGI performing XSLT transforms and I experience really > poor performance because it has to import plenty of modules. > > I was then thinking using an interpreter embedded within Apache 1.3. I > want to rely at least on a minimal application framework so I don't feel > like using pcgi. > > Now the question is should I use mod_python or mod_snake? Both have pros > and cons... mod_python looks more mature, more documented and has a > much simpler architecture than mod_snake. > > What I need here is a simple persistent Python environment to run a few > rather simple scripts, I was likely to use mod_python with its standard > publish handler but I noticed that I had to rebuild the interpreter > without thread support... > > And what about the security of these modules? I already googled to look > out for vulnerabilities involving mod_(python|snake) and I havn't found > anything... I'd be glad to hear any good/bad experience in this field > too... > Unless you are wed to Apache for other reasons, you might also consider Xitami and Python long-running web processes. Setup is much simpler, and the whole deal is more lightweight. regards Steve -- http://www.holdenweb.com/ From tdelaney at avaya.com Mon Dec 3 03:27:46 2001 From: tdelaney at avaya.com (Delaney, Timothy) Date: Mon, 3 Dec 2001 19:27:46 +1100 Subject: PEP 276 Simple Iterator for ints (fwd) Message-ID: > If the body inside the loop rebinds the iteration variable > (not a great > idea but we must give it some meaning), it's IMHO reasonable to let > it continue iteration from the new value. I.e. it's translated to > 'while' rather than to 'for i in range'. Definitely not. The name receiving the value from the iterator will *always* be rebound to the object returned from the iterator's next() method. In the case of the proposed syntax, it would *always* be the next integer in the specified series. In fact, it would be impossible to do what you are suggesting unless you were going to have some way to inform the iterator that the name which received its value had been rebound. In which case you would require that for every iterator. Tim Delaney From wex at flarg.com Mon Dec 24 03:10:46 2001 From: wex at flarg.com (Daniel Wexler) Date: Mon, 24 Dec 2001 08:10:46 GMT Subject: distutils problem with interdependent modules References: Message-ID: Thanks so much for the feedback. > I'm surprised it does. Python loads the extensions with > RTLD_LOCAL. Are you sure you are not getting two copies of your module > loaded? It is possible, and I'll check to see for sure, however, my libraries have no global data, only code, so it really doesn't matter if they are loaded twice, does it? I really don't care about the extra overhead or memory, since the library is fairly small. But actually, I think that Linux will only load the code segment once no matter what, it is only the BSS that is duplicated. I don't get it. How should I be segmenting my code? I have two Python C extensions, FOO and BAR. BAR is dependent on FOO. How should these be compiled, linked and used together? By the way, I have now massaged distutils to work under Linux, but I have to make a symlink to the .so files in the build directory to the top level package dir. I've almost got the whole thing working with distutils under Windows, except that I need the .lib files in the top level directory and I can't figure out how to move them there from the build directory after each extension compiles. Right now I have to do that manually each time an extension finishes and the build fails. Thanks again for the help, Dan From barry at zope.com Thu Dec 27 22:27:24 2001 From: barry at zope.com (Barry A. Warsaw) Date: 27 Dec 2001 22:27:24 -0500 Subject: REPOST: Re: age of new pythonistas References: Message-ID: <0$--$$_-----$$$_$$@news.noc.cabal.int> >>>>> "FL" == Fredrik Lundh writes: FL> iirc, Barry's a few years older than Mark (or was it the other FL> way around?), and I'm a few years older than my sister. I'm definitely the middle child of the Pythonlabs crew, which is weird because I'm the oldest of my siblings. In an interesting twist of fate or karma, Guido and Tim like to make me drink strange concoctions they claim is really weak beer, but which I'm beginning to suspect is not. -Barry ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: barry at zope.com (Barry A. Warsaw) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:19:12 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775440 27193 211.57.49.2 (31 Dec 2001 05:10:40 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:10:40 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From aleax at aleax.it Fri Dec 28 09:49:46 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 15:49:46 +0100 Subject: REPOST: Re: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B941D.B1E45AA5@htp-tel.de> Message-ID: <2$--$$_----_---$_$@news.noc.cabal.int> "Aahz Maruch" wrote in message news:a0i027$dl2$1 at panix3.panix.com... > In article , > DeepBleu wrote: > > > >NNTP is an internet protocol like SMTP, POP3 and HTTP for > >communication. Also, it is the oldest one and it used to be the most > >instructive before AOL hit the scene along with the 'gold rush' :) > > Really? NNTP is older than SMTP? Mind telling me where you found that > little gem? SMTP must be older, by a few years (say '82 vs '86?). FTP must be older still -- before SMTP, mail was distributed with an FTP tweak. Of course, netnews used other transport-level protocols (mostly based on UUCP, as I recall) well before the Internet was officially inaugurated (1983, wasn't it?). Alex ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!nycmny1-snh1.gtei.net!news.gtei.net!newsfeed.mathworks.com!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Alex Martelli" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:13:43 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775346 27193 211.57.49.2 (31 Dec 2001 05:09:06 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:09:06 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From robin at jessikat.fsnet.co.uk Sat Dec 15 09:50:45 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Sat, 15 Dec 2001 14:50:45 +0000 Subject: RELEASED Python 2.2 release candidate 1 is out! References: Message-ID: In article , Barry A. Warsaw writes > >Today we release Python 2.2c1, the first and hopefully only release >candidate for Python 2.2, for your extravagation, eyestrain, and >elucidation. > .... just looking at http://www.python.org/2.2/ I see only references to Python 2.2b2! Is this the same as 2.2c1 or is the page lagging behind? -- Robin Becker From dalke at dalkescientific.com Mon Dec 3 12:53:25 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Mon, 3 Dec 2001 10:53:25 -0700 Subject: How to compare text? References: Message-ID: <9ugeaf$rjs$1@slb7.atl.mindspring.net> A wrote: ===== For example I have the first paragraph I want to be very good at Python programming. Better than in Perl. THe second paragraph might look loke this: She works all day long to master Perl. All that I need is to find out if any of word from the second is in the first paragraph. For the example above I should find out word Perl. ===== You should also find that 'to' is in common. Here's a good hint at solving your question. text1 = "I want to be very good at Python programming. " + \ "Better than in Perl." text2 = "She works all day long to master Perl." d = {} for word in text1.split(): d[word] = 1 for word in text2.split(): if d.has_key(word): print "The word", word, "is in both" Things to worry about: - is capitalization important? "May" is a month or someone's name, but unless it's at the beginning of the sentence it does not mean the same as "may". At the very least you should lowercase everything. - you'll need to remove punctuation, unless you don't want "Perl." to match "Perl" - but you will need to keep apostrophes, like "don't" Andrew dalke at dalkescientific.com From pearu at cens.ioc.ee Tue Dec 25 05:32:47 2001 From: pearu at cens.ioc.ee (Pearu Peterson) Date: Tue, 25 Dec 2001 12:32:47 +0200 Subject: distutils lib path In-Reply-To: <1FBV7.3347$bE5.1290856513@twister1.starband.net> References: <1FBV7.3347$bE5.1290856513@twister1.starband.net> Message-ID: On Mon, 24 Dec 2001, Daniel Wexler wrote: > Is there a way to get the name of the platform-specific > subdirectory name of the build/lib*** directory in my > setup.py file? > > For example, when I compile under Linux using Python 2.1, > the directory name I want is: > > build/lib.linux-i686-2.1 > > While, under Windows, the directory name I want is: > > build/lib.win32-2.1 I have used the following in my programs: import sys,os from distutils import util p = os.path.join('build','lib.%s-%s'%(util.get_platform(),sys.version[0:3])) ... > Also, is there a way to have distutils perform some arbitrary > commands after building each extension module? Or perhaps > to callback to a python function that I can define (which then > can do arbitrary things)? In my case I want to move or create > links to the resulting .lib or .so files that are built by distutils. On Windows, can you really create symbolic or hard links? May be you are looking for --build-platlib option of the distutils build command? See setup.py build --help Regards, Pearu From lac at strakt.com Wed Dec 5 09:19:42 2001 From: lac at strakt.com (Laura Creighton) Date: Wed, 05 Dec 2001 15:19:42 +0100 Subject: Tk callback at certain time point? In-Reply-To: Message from "Xiao-Qin Xia" of "Wed, 05 Dec 2001 11:17:29 GMT." <9ukvjn$kk2$1@pegasus.csx.cam.ac.uk> References: <9ukvjn$kk2$1@pegasus.csx.cam.ac.uk> Message-ID: <200112051419.fB5EJgua019114@ratthing-b246.strakt.com> > Hello, > > I am using Tkinter to make an interface. Is there any way to make Tk > automatically call a function after some time or at a certain time point? > > Regards, > Xiao-Qin Xia > use after http://www.pythonware.com/library/tkinter/introduction/x9129-alarm-handlers-and-other.htm Laura Creighton From jkraska at san.rr.com Sat Dec 29 14:46:02 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 29 Dec 2001 19:46:02 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <4VlX7.6657$l93.1694996@newsb.telia.net> Message-ID: <9$--$$_----__%$%$$@news.noc.cabal.int> >and to defeat the speed problem: an OPTIMIZING NATIVE CODE COMPILER You're not the first person to think of this. One of the problems is that designing an optimizing native code compiler for a fully dynamic language like Python is quite a difficult task. >1. Since the language is currently evolving very rapidly it is probably > a bad time to start such a project, Not really. The basic parts of Python which the compiler needs to support properly have been present for years. It has to do with first class language access to the dictionary which exists in every namespace, and how this first class access intertangles semantically with Python itself. Or at least that is one major element of the picture. IIRC, the generation of execution frames plays another role, and these likewise offer first class accessibility in Python. Again, they are intertwined. C// ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.cwix.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Courageous Newsgroups: comp.lang.python Subject: cmsg cancel <6o6s2u4pa4kvqben6ftatrfttu9s78ee1k at 4ax.com> Control: cancel <6o6s2u4pa4kvqben6ftatrfttu9s78ee1k at 4ax.com> Date: Mon, 31 Dec 2001 01:38:50 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774612 27193 211.57.49.2 (31 Dec 2001 04:56:52 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:56:52 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From aahz at panix.com Sat Dec 22 03:05:46 2001 From: aahz at panix.com (Aahz Maruch) Date: 22 Dec 2001 00:05:46 -0800 Subject: Python on the desktop References: <3C23CF6E.CD4BF4D3@engcorp.com> Message-ID: In article , David Bolen wrote: >Peter Hansen writes: >> >> That would make the "standard GUI for the vast majority of platforms" >> an LED and a power switch.... > >And often we have to fight hard for that LED... You had LEDs? Luxury! -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 10 days and counting From loewis at informatik.hu-berlin.de Wed Dec 19 06:16:54 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 19 Dec 2001 12:16:54 +0100 Subject: It's Tk's fault References: <9vp5bv$gvfps$1@ID-12869.news.dfncis.de> Message-ID: "Kick" writes: > Only tk display a wrong char. I know Tk is easy to use and modify. So is > there any one who can help me to display Chinese code correctly in Tk > widget? Since it is easy to use and modify, why don't you just investigate the problem yourself? If you find an answer, don't hesitate to post it to this list. Regards, Martin From dalke at dalkescientific.com Wed Dec 12 05:54:03 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Wed, 12 Dec 2001 03:54:03 -0700 Subject: XML parsing besides SAX and DOM Message-ID: <9v7d9h$s00$1@slb2.atl.mindspring.net> Hello, I've been doing XML processing of a record-oriented data set where in a record: - the data isn't deep (pretty much flat) - all the text is used from between the start and end tags - the text is short (easily fits into memory) I developed another XML API to simplify this case, and I'm curious about other similar systems (eg, I may want to scrap my work). I know about SAX and DOM and about RAX. What others are there? For full details about what I'm doing, see http://www.biopython.org/~dalke/SimpleFields.py Short version is I wrote an adapter from the SAX ContentHandler to my callback-based API, then an implementation which stores the callback events in a dictionary for random access. Andrew dalke at dalkescientific.com From tim at vegeta.ath.cx Sat Dec 29 04:22:25 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Sat, 29 Dec 2001 09:22:25 GMT Subject: REPOST: Re: install Python2.2 question References: Message-ID: <9$--$$_-----$%$__$@news.noc.cabal.int> Alex Martelli graced us by uttering: > "Tim Hammerquist" wrote: > ... >> If you have a sufficient devel environment and you are up to the >> challenge, you can try to build Python yourself, but it may be more >> trouble than it's worth if you're new to linux. > > How so? tar xzf, cd, ./configure, make, sudo make install -- how > much trouble can that be? I can rephrase: if you're new to any operating system that comes standard with development utilities like tar, make, cc. Note that sudo is not available in all distributions (or even different releases of the same distribution) of linux. Or those new to a command line. True, it is quite simple to type the characters you mention, but try to explain to some previous Windows-user what he's doing and why he can't just "download one of them RPM thingies and be done with it." At times I have a hard enough time trying to convince people to login as a non-root user and occasionally su, rather than run as root all the time. It's a different mindset from Windows and new users can get overwhelmed. Look at the options of a configure script, seeing error messages because his linux distro is broken/missing headers, can easily cause him to throw his hands up needlessly. PN: Even clpm suggests using a prepackaged binary "until the user feels up to compiling his own." Tim Hammerquist -- LISP programmers know the value of everything and the cost of nothing. -- Alan Perlis' corruption of an Oscar Wilde quote ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Tim Hammerquist Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:40:59 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774797 27193 211.57.49.2 (31 Dec 2001 04:59:57 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:59:57 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From sholden at holdenweb.com Mon Dec 24 18:33:54 2001 From: sholden at holdenweb.com (Steve Holden) Date: Mon, 24 Dec 2001 18:33:54 -0500 Subject: State of the SysAd art (was: vi or emacs for editing Python on Linux?) References: <1009127729.9271.0.nnrp-12.c2de51d8@news.demon.co.uk> <2E48C714A6E1FBA1.19DE5ADEBF7F088A.DF90F2C1E6CC9E7C@lp.airnews.net> Message-ID: "Cameron Laird" wrote in message news:2E48C714A6E1FBA1.19DE5ADEBF7F088A.DF90F2C1E6CC9E7C at lp.airnews.net... > In article , > Steve Lamb wrote: > . > . > . > > *sigh* Fine,you had to bring it up. Michael, I *do* work on unix > >systems scattered across the nation and my personal workspace is not on every > >single one. You know what is, though? ssh. That means scp is there so when > >I need to get something to/from that machine I can always scp to another > >machine, edit, scp back. > > > > Furthermore, when it comes to programming, I would hope that a company > >that has machines all over the world would have learned the joys of a CVS > >server which would also fill in on the above. Edit on one machine, commit, > >ssh to the machine that needs it, cvs update. > . > . > . > Does this match others' experience? I continue to > run into plenty of production hosts which have barely > been maintained for up to four years, let alone > outfitted with such new-fangled decorations as a > properly-installed ssh. > > Do I hang around industrial environments too much? Well, you probably do, but your experience and mine agree fairly closely -- several clients would rather retain a system configured and working as it is than cope with the pain of re-establishing normal operations after an upgrade. Of course, now that more systems are on the Internet, Microsoft can also use their crappy security as an excuse for getting customers to upgrade, rather than selling them on features, sometimes of dubious value... regards Steve -- http://www.holdenweb.com/ From jkraska at san.rr.com Tue Dec 4 11:41:06 2001 From: jkraska at san.rr.com (Courageous) Date: Tue, 04 Dec 2001 16:41:06 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <3C0C8330.79D0E598@mega-nerd.com> Message-ID: >If spaces should creep in Python won't compile the code. Spaces almost *have* to creep in, for example, on continuation lines. Furthermore, what you're saying isn't true. For example, if the person who writes it himself uses a tabstop of 8 and then allows spaces to creep in, things will tend to work out. All of this, however, is academic. The defacto indentation standard for Python is 4 spaces. If you run into Python projects managed professionally, you're likely to find that their dejure standards are 4 spaces as well, and with these, you'll find that in order to not get their tech leads really pissed at you, you'll be learning what a soft tab stop is, and setting it to 4. C// From jason at jorendorff.com Thu Dec 20 19:21:20 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Thu, 20 Dec 2001 18:21:20 -0600 Subject: Where is time module? In-Reply-To: <3C225C55.1DD68DB6@juno.com> Message-ID: Jeff Sandys wrote: > I can't import the time module or find it anywhere in the > Python-2.1.1.tgz distribution. It's written in C; source code is in "src/Modules/timemodule.c". Try this: >>> import sys >>> print sys.builtin_module_names What does it say? ## Jason Orendorff http://www.jorendorff.com/ From pedro_rodriguez at club-internet.fr Fri Dec 28 05:19:56 2001 From: pedro_rodriguez at club-internet.fr (Pedro) Date: Fri, 28 Dec 2001 11:19:56 +0100 Subject: REPOST: Re: affects on extended modules References: <3C051775.A8D4FD66@bioeng.ucsd.edu> <83pu5zrvbl.fsf@panacea.canonical.org> <3C0E7138.FD485D1D@bioeng.ucsd.edu> <1be8d8b.0112271705.50940295@posting.google.com> Message-ID: <1$--$$_--_-_-%%__$@news.noc.cabal.int> "Curtis Jensen" wrote: > Pedro wrote in message > news:... >> "Curtis Jensen" wrote: >> >> > Kragen Sitaker wrote: >> >> >> >> Curtis Jensen writes: >> >> > We have created a python interface to some core libraries of our >> >> > own making. We also have a C interface to these same libraries. >> >> > However, the the python interface seems to affect the speed of the >> >> > extended libraries. ie. some library routines have their own >> >> > benchmark code, and the time of exection from the start of the >> >> > library routine to the end of the library routine (not including >> >> > any python code execution), takes longer than it's C counterpart. >> >> >> >> In the Python version, the code is in a Python extension module, >> >> right? >> >> A .so or .dll file? Is it also in the C counterpart? (If that's >> >> not >> >> it, can you provide more details on how you compiled and linked the >> >> two?) >> >> >> >> In general, referring to dynamically loaded things through symbols >> >> --- even from within the same file --- tends to be slower than >> >> referring to things that aren't dynamically loaded. >> >> >> >> What architecture are you on? If you're on the x86, maybe Numeric >> >> is being stupid and allocating things that aren't maximally aligned. >> >> But you'd probably notice a pretty drastic difference in that case. >> >> >> >> ... or maybe Numeric is being stupid and allocating things in a way >> >> that causes cache-line contention. >> >> >> >> Hope this helps. >> > >> > Thanks for the responce. The C counterpart is directly linked >> > together into one large binary (yes, the python is using a dynamicaly >> > linked object file, a .so). So, That might be the source of the >> > problem. I can try and make a dynamicaly linked version of the C >> > counterpart and see how that affects the speed. We are running on >> > IRIX 6.5 machines (mips). >> > Thanks. >> > >> > >> Don't know if this helps but I had a similar problem on Linux. >> >> The context was : a python script was calling an external program and >> parsing output (with popen) many times. I decided to optimize this by >> turning the external program into a dynamicaly linked library with >> python bindings. I expected to gain the extra system calls to fork and >> start a new process, but it turned out that this solution was slower. >> >> The problem was caused by multithreading stuff. When using the library >> straight from a C program, I didn't link with multithreaded libraries >> and so all system calls weren't protected (they don't need to lock and >> unlock their resources). >> >> Unfortunately, the library was reading files with fgetc (character by >> character :( ). Since the Python version I used was compiled with >> multi-threading enabled, it turned out that the fgetc function used in >> this case lock/unlock features, which cause the extra waste of time. >> >> To find this, I compiled my library with profiling (I think I needed to >> use some system call to activate profiling from the library, since I >> couldn't rebuild Python). >> >> OT : at the end I fixed the library (fgetc replaced by fgets), and >> didn't gain anything by turning the external program into a python >> extension. Since it seemed that Linux disk cache was good, I removed >> the python extension thus keeping a pure Python program, and >> implemented a cache for the results of the external program. This was >> much simpler and more efficient in this case. > > > Is this a problem with i/o only? Our the code sections that we > benchmarked has no i/o in it. > > -- > Curtis Jensen In my case, it was only i/o related. If your problem, as I understand it, is : + I've got a function f() written in C + f() execution is doing some benchmark telling how much time it took to complete + calling f() from a C binary gives a (significant) shorter duration than calling (the same) f() from a Python extension you may have to check what f() is doing, because , what I was stating is, that it may be affected by the python environment : - Are doing extensive calls to an external library ? In my case, some glibc calls need to inforce reentrancy protection when running in a multithreaded context. These protections blew out any gain. - If you're doing calls to external libraries, are you linked against the same versions ? (ldd on binaries and libraries may help) - More basicaly, did you compile with the same options ? Could the differences point to a possible source of your problem ? (may be worth checking optimization, debug, conditional compilation options) Regards, -- Pedro ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!nycmny1-snh1.gtei.net!cpk-news-hub1.bbnplanet.com!news.gtei.net!newsfeed1.cidera.com!Cidera!netnews.com!newspeer.cwnet.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail Message-ID: Control: cancel Subject: cmsg cancel From: Pedro Newsgroups: comp.lang.python X-No-Archive: yes Lines: 2 NNTP-Posting-Host: wonenara.ozemail.com.au X-Trace: ozemail.com.au 1009643068 203.108.164.177 (Sun, 30 Dec 2001 03:24:28 EST) NNTP-Posting-Date: Sun, 30 Dec 2001 03:24:28 EST Organization: OzEmail Ltd, Australia Distribution: world Date: Sat, 29 Dec 2001 13:38:09 GMT This message was cancelled from within Mozilla. From guignot at wanadoo.fr Thu Dec 6 13:10:11 2001 From: guignot at wanadoo.fr (guignot) Date: Thu, 6 Dec 2001 13:10:11 -0500 Subject: Is it possible to kill a thread ? Message-ID: <9unnfb$6fp$1@wanadoo.fr> I have a prog which launches a server, using thread.start_new call. When I destroy the gui, it keeps stuck, probably because the server thread is still running... Can the main prog cleanly die, or is there a way to kill the thread ? From jamescalthoff at yahoo.com Wed Dec 12 22:34:23 2001 From: jamescalthoff at yahoo.com (James Althoff) Date: Wed, 12 Dec 2001 19:34:23 -0800 (PST) Subject: More fun with PEP 276 Message-ID: <20011213033423.58930.qmail@web20002.mail.yahoo.com> Tim Delaney wrote: >And we come full circle ... again ... Understandable sentiment. But in going around the circle (again), I think there have been some interesting discussions. And this time around we have working, demo implementations for two of the suggestions, namely: for i in -5 < ints() < 5: and for i in -5/span/5: Both of the above handle all variations of open and closed intervals with explicit operators, have mechanisms for steps different than 1, handle both increasing and decreasing intervals, support shortcuts (the latter more so than the former, though), work both inside and outside a for-loop, use an iterator-based approach without actualizing a list unnecessarily, do not make literal syntax for lists any more complex, and -- in the forms listed above -- require no syntax changes and no new keywords and are backwards compatible with existing Python. Are they better than xrange? At least for the case of a decreasing, open-on-the-left, closed-on-the-right interval with variable bounds they seem more natural (I would claim): for i in xrange(a-1,b-1,-1): versus: for i in a > ints() >= b: or: for i in a/span//b: Jim p.s. And Note that PEP 276 itself (merely) suggests adding an iterator to class int which could exist independently from any or none of the above. (I know, we've been around that circle before, too. ). __________________________________________________ Do You Yahoo!? Check out Yahoo! Shopping and Yahoo! Auctions for all of your unique holiday gifts! Buy at http://shopping.yahoo.com or bid at http://auctions.yahoo.com From carty at mazunetworks.com Mon Dec 10 17:04:43 2001 From: carty at mazunetworks.com (Carty Castaldi) Date: Mon, 10 Dec 2001 17:04:43 -0500 Subject: run Tkinter app with no console window? Message-ID: <9v3bhv$m4e$1@news.harvard.net> Hi. I am just learning python and like it quite a bit. I have written some small/useful apps with Tkinter UIs and would like to be able to run them on Windows with no console window or the console window completely hidden. Any help appreciated. -Carty From bkc at murkworks.com Sun Dec 30 17:32:13 2001 From: bkc at murkworks.com (Brad Clements) Date: Sun, 30 Dec 2001 17:32:13 -0500 Subject: Pocket PC Port regrtest results Message-ID: <3C2F4D6E.26004.14EF07E2@localhost> FYI, this is where things stand at the moment. These things need to be fixed (most likely before submitting diffs): 97 tests OK. 36 tests failed: test_StringIO test_builtin test_complex test_copy_reg test_cpickle test_difflib test_dircache test_doctest test_dospath test_email test_glob test_long test_long_future test_mailbox test_mhlib test_mimetypes test_operator test_os test_pickle test_pkg test_pkgimport test_pyclbr test_re test_repr test_sha test_socket test_strftime test_strop test_structseq test_sundry test_time test_unary test_unicode test_urllib test_urllib2 test_wave 53 tests skipped: test___all__ test_al test_asynchat test_bsddb test_calendar test_capi test_cd test_cgi test_cl test_commands test_crypt test_curses test_dbm test_dl test_exceptions test_fcntl test_fork1 test_gdbm test_gettext test_gl test_grp test_gzip test_hotshot test_imgfile test_largefile test_linuxaudiodev test_locale test_minidom test_mmap test_nis test_ntpath test_openpty test_parser test_poll test_popen2 test_pty test_pwd test_pyexpat test_sax test_select test_signal test_socket_ssl test_socketserver test_sunaudiodev test_symtable test_timing test_ucn test_unicode_file test_unicodedata test_winreg test_winsound test_zipfile test_zlib Brad Clements, bkc at murkworks.com (315)268-1000 http://www.murkworks.com (315)268-9812 Fax netmeeting: ils://ils.murkworks.com AOL-IM: BKClements From jkraska at san.rr.com Mon Dec 3 20:43:47 2001 From: jkraska at san.rr.com (Courageous) Date: Tue, 04 Dec 2001 01:43:47 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BD39F.D43D4FF7@mega-nerd.com> Message-ID: <5bao0uct7k0ao0rak0psoobnvteoeh624h@4ax.com> >How hard is it to find an editor that treats tabs correctly and allows >the tab width to be set to something other than 8? To Python, a tab *IS* 8 spaces. YOU get a grip. C// From maxm at normik.dk Fri Dec 21 03:07:46 2001 From: maxm at normik.dk (Max M) Date: Fri, 21 Dec 2001 09:07:46 +0100 Subject: what is the equivalent of LAST_INSERT_ID() in mx.ODBC ? References: Message-ID: <3c22edbf$0$35603$edfadb0f@dspool01.news.tele.dk> "Tom Harris" > SELECT TOP 1 * FROM tbl > ORDER BY id DESC Yes I am aware of that, but it can give me conflicting writes. But ok it's a low write-volume database, and will stay that way, so it will probably work ok. regards Max M From jason at jorendorff.com Tue Dec 18 00:10:39 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Mon, 17 Dec 2001 23:10:39 -0600 Subject: deleting from bsddb In-Reply-To: <9vlnmp$12ck$1@news.doit.wisc.edu> Message-ID: Erika Skoe wrote: > i don't see the syntax anywhere for deleting an element from a bsddb. any > hints? db = bsddb.hashopen("myfile.db", 'w') del db['username'] -- Jason Orendorff http://www.jorendorff.com/ From timo at alum.mit.edu Wed Dec 5 01:13:22 2001 From: timo at alum.mit.edu (Timothy O'Malley) Date: Wed, 05 Dec 2001 01:13:22 -0500 Subject: [ANNOUNCE] timeoutsocket.py version 1.21 Message-ID: hola. I've updated timeoutsocket.py to version 1.21. Fixes include - Better Windows support. Error code 10056 now recognized as an indication of a valid connection. - Better socket emulation. Added connect_ex() method - Better data protection. The read() and readline() methods of a makefile() object no longer lose data when a timeout occurs. The readlines() method still does. - Less intrusive when inserting the shim. It no longer modifies they sys.modules array and no longer modifies every module that has imported 'socket'. I would recommend upgrading. I would especially recommend upgrading on Windows. Where: http://www.timo-tasi.org/python/timeoutsocket.py What is timeoutsocket.py? This module enables a timeout mechanism on all TCP connections. It does this by inserting a shim into the socket module. After this module has been imported, all socket creation goes through this shim. As a result, every TCP connection will support a timeout. The beauty of this method is that it immediately and transparently enables the entire python library to support timeouts on TCP sockets. As an example, if you wanted to SMTP connections to have a 20 second timeout: import timeoutsocket import smtplib timeoutsocket.setDefaultSocketTimeout(20) Good Luck! TimO From laz at strakt.com Wed Dec 12 06:20:38 2001 From: laz at strakt.com (Fredrik Juhlin) Date: Wed, 12 Dec 2001 12:20:38 +0100 Subject: Problems with Tkinter and menus Message-ID: <20011212112038.GA786@strakt.com> "Greg Krohn" wrote: > Works fine for me: Win2K/Python 2.1.1/Tcl 8.3. > It prints 'hello!' for 'Command1', 'Foo', and > 'Bar'. Have you tried restarting Python? Maybe > something got reassigned somehow. The problem persists for me, unfortunately. I'm using Linux 2.4.5/XFree86 4.1.0/Python 2.1/Tcl 8.3. I've tried KDE 2.1.1 and Fvwm 2.2.5 with the same result. //FJ From ferdinando at ametrano.net Mon Dec 3 13:28:52 2001 From: ferdinando at ametrano.net (Ferdinando Ametrano) Date: Mon, 03 Dec 2001 19:28:52 +0100 Subject: [ANN] QuantLib-Python 0.2.1 Message-ID: <5.1.0.14.2.20011203192847.00a9ca10@mail.ametrano.net> QuantLib-Python 0.2.1 --------------------- http://quantlib.org QuantLib-Python is a SWIG wrap of QuantLib. QuantLib is a quantitative finance C++ library for modeling, pricing, trading, and risk management in real-life. A tool for derivatives and financial engineering. Version 0.2.1 of the C++ library and the Python extension have been released. What's new ------------ - in sync with QuantLib 0.2.1 - Upgraded to SWIG 1.3.9 - changed iterator behavior in Python module - added __version__ and __hexversion__ export of C++ QL_VERSION and QL_HEX_VERSION - added 'testing QuantLib x.x.x' message to tests - updated and expanded test suite - updated Swig files' dependencies for MS VC++ project URL: http://quantlib.org License: XFree86 style Categories: Miscellany Ferdinando Ametrano (ferdinando at ametrano.net) http://www.ametrano.net --

QuantLib-Python 0.1.9 - A module for quantititative finance. (18-Sep-01)

-- From sholden at holdenweb.com Fri Dec 21 12:15:09 2001 From: sholden at holdenweb.com (Steve Holden) Date: Fri, 21 Dec 2001 12:15:09 -0500 Subject: if __name__ == "__main__" References: Message-ID: "Martin von Loewis" wrote in message news:j4ofkso7e1.fsf at informatik.hu-berlin.de... > crennert at pbmplus.com (Chris Rennert) writes: > > > Could someone please fill me in on how the if __name__ == "__main__ > > thing works. I am reading through some tutorials and I never really > > get a clear definitive answer on that. > > Is this like main() in C? > > No. __name__, on module level, is the name of the module. So if you > would modify urllib.py to contain > > print __name__ > > then "import urllib" would print > > urllib > > Now, the file that you pass on the command line of the interpreter > does not have a module name (because it really isn't a module), so > __name__ is set to the string "__main__" inside that code. That allows > you to write a file that is used both as a module and as a program. > Everything Martin wrote is correct, but the first word might be considered somewhat harsh! In C, you identify the program's entry point by defining a main() function, which is called when program execution starts. In Python, when program execution starts the interpreter identifies the main program by setting its module name to "__main__". regards Steve -- http://www.holdenweb.com/ From nigel at pc714.maths.usyd.edu.au Mon Dec 10 09:28:52 2001 From: nigel at pc714.maths.usyd.edu.au (nigel at pc714.maths.usyd.edu.au) Date: 11 Dec 2001 01:28:52 +1100 Subject: Python classes for reading/writing/parsing MIDI files References: <3C0F63F0.20D2B25@alum.mit.edu> <7876a8ea.0112061455.6685b313@posting.google.com> <3C111F3C.1B41508C@sage.att.com> <3C1173C8.39FD4761@alum.mit.edu> Message-ID: <877krv5eu3.fsf@pc714.maths.usyd.edu.au> Will Ware writes: > Garry Hodgson wrote: > > i'm interested in being able to display/print sheet music from a given > > midi file. does anyone know: > > > > a) if any of the above packages provide for this? > > b) if this is a particularly hard problem? > > Something to look into is a text-based music notation language called > ABC. There is a collection of utilities called abc2midi which can > produce both MIDI and printable sheet music in Postscript format. If > you're running on Linux, you can use ps2pdf to convert to a PDF > document. Also have a look at * http://www.lilypond.org --- lilypond is the GNU music typesetter, based on TeX, and advertises the midi2ly midi -> lilypond converter. >From the docs for midi2ly.... It is possible to record a MIDI file using a digital keyboard, and then convert it to .ly. However, human players are not rhythmically exact enough to make a MIDI to LY conversion trivial. midi2ly tries to compensate for these timing errors, but is not very good at this. It is therefore not recommended to use midi2ly for human-generated midi files. Correcting the quantization mistakes of the human player takes a lot of time. Hackers who know about signal processing are invited to write a more robust midi2ly. midi2ly is written in *Python*, using a module written in C to parse the MIDI files. So there you go. See also * http://abc.sourceforge.net/abcMIDI/ --- ABC to midi and back, ABC to postscript. Same thing as referred to above. * http://www.gmd.de/Misc/Music/ --- lots of TeX related links, including a link to midi2tex which (1) seems not have been updated since 1994 and (2) is based on MusicTeX, which has been superceded by the confusingly-similarly-named MusiXTeX. Otherwise you can apparently go midi -> ABC -> MusiXTeX. * Chapter 7 of the "LaTeX Graphics Companion" (Goossens, Rahtz & Mittelbach, pub. Addison-Wesley) covers typesetting music in TeX, as well as some of the available input filters and ABC. Nigel From sdm7g at Virginia.EDU Tue Dec 25 17:04:31 2001 From: sdm7g at Virginia.EDU (Steven Majewski) Date: Tue, 25 Dec 2001 17:04:31 -0500 (EST) Subject: Three misc questions In-Reply-To: <3C282187.1090002@hotmail.com> Message-ID: On Tue, 25 Dec 2001, Stefan Werner wrote: > 1. Is there a possibility to read PICT files with Python 1.5.2 on MacOS > 9? PIL unfortunately cannot open them. On the Mac, you can use the QuickDraw procedures Qd.GetPicture and Qd.DrawPicture. Take a look at PICTbrowse in the MacPython Demo directory. > 2. Is there a way for IPC between two Python environments? E.g. Blender > and Poser have both a Python scripting engine, and I'd like to > experiment and link them both together. Is there a way I can send > messages or other data packages between both environments besides using > shared files? There are a bunch of varieties of IPC available. If it's on the Mac, using AppleEvents may be the best choice. I have sometimes had problems using IP socket communication on Mac OS9 and earlier when both processes are on the same machine. ( OSX with it's unix kernel doesn't show the same problems, although I think they can be reproduced if both programs are running in the "classic" box.) > 3. Does anyone know of a library that implements 3D vector math > algorithms like constructing/deconstructing transformation matrices, > conversion of quaternions/matrices/euler angles, coordinate space > conversion, etc? Would be great if it worked with Python 1.5.2, so I > could use it without modificaion with Poser. OpenGL would probably do it, but although the libraries are included on the Mac, I don't believe the GL module has been ported to Mac, and there may be some X dependencies in the SGI/unix GL module. -- Steve Majewski From grante at visi.com Thu Dec 20 17:17:41 2001 From: grante at visi.com (Grant Edwards) Date: Thu, 20 Dec 2001 22:17:41 GMT Subject: Raw sockets References: <2c55c8be.0112201244.2e4e1027@posting.google.com> Message-ID: In article , Cliff Wells wrote: > On Thu, 20 Dec 2001 21:29:23 GMT > grante at visi.com (Grant Edwards) wrote: > >> > I've got the impression that you need the tighter control over >> > TCP that raw sockets allows, >> >> Tighter control than raw sockets? Raw sockets is as low-level >> as it gets. You even have to put the Ethernet addresses in >> yourself. > > He said "that" not "than". Changes the meaning entirely =) Duh. I read it several times and it was different on _my_ screen. Honest. -- Grant Edwards grante Yow! Hello. I know at the divorce rate among visi.com unmarried Catholic Alaskan females!! From paul at JUNKCATCHER.ciphergoth.org Sun Dec 2 21:26:10 2001 From: paul at JUNKCATCHER.ciphergoth.org (Paul Crowley) Date: Mon, 03 Dec 2001 02:26:10 GMT Subject: CryptKit 0.9: cryptsock References: <7xpu5y2szk.fsf@ruckus.brouhaha.com> <7x667pw8ap.fsf@ruckus.brouhaha.com> Message-ID: <874rn9ysw9.fsf@saltationism.subnet.hedonism.cluefactory.org.uk> Paul Rubin writes: > Bryan writes: > > Thanks for the link, it lead me to research other password-based > > key-agreement schemes. I found Authentication and Key Agreement via > > Memorable Password ( > > http://citeseer.nj.nec.com/kwon00authentication.html ) which claims > > to be the most efficient of all of them ( EKE, PAK, SRP, GXY, AuthA > > ). I believe I will implement AMP. Your input would be > > appreciated. > > I'm not familiar with AMP. The SRP paper has references to some other > protocols of this type though. Main problem I see is patent issues > around many of them. I believe SRP was developed in order to avoid > the EKE patent. > > I'm cross-posting to sci.crypt to solicit some wisdom from that > newsgroup. AMP carries a "proof of security", but I can't follow it, and I spoke to an expert in this field who says he's not convinced by it either. Furthermore, AMP has a similar problem to SRP, that a sufficiently devious fake server can check two passwords with every query. That the proof doesn't rule this out indicates some problems with it. It's straightforward to propose a variant on AMP that doesn't have this problem, and that variant may be secure, but I'd like to have a better way to construct the proof of security for that. As far as I can tell from the ResearchIndex URL, that paper hasn't been published yet as such. I think the protocol has great merit and I hope it does get published, though I don't see the advantages of the "amplification scheme" over simply encrypting the password file with a symmetric cipher. If I was going to implement something now, I'd certainly use SRP. -- __ Paul Crowley \/ o\ sig at paul.ciphergoth.org /\__/ Employ me! http://www.ciphergoth.org/cv Cryptography, Linux, Unix, Perl, C/C++, Java, TCP/IP, and more. From mwh at python.net Fri Dec 7 05:27:40 2001 From: mwh at python.net (Michael Hudson) Date: Fri, 7 Dec 2001 10:27:40 GMT Subject: cmd module documentation lying? References: Message-ID: "pwang99c" writes: > so... is this a known problem, or am i misunderstanding something? > should i be emailing David Beazley about his book? or is there some > place for more up-to-date documentation on the cmd module? (besides > the source itself. :-) Looks like Beazley was wrong, from scanning the source. Agree there should be better (any!) documentation on this. Feel like writing some? Cheers, M. -- Not only does the English Language borrow words from other languages, it sometimes chases them down dark alleys, hits them over the head, and goes through their pockets. -- Eddy Peters From ssthapa at classes.cs.uchicago.edu Sat Dec 1 12:10:33 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Sat, 01 Dec 2001 17:10:33 GMT Subject: PHP vs. Python/comp.lang.php? References: <9tia10$43o$1@dahlia.singnet.com.sg> <3bfcce0b$0$89809$edfadb0f@dspool01.news.tele.dk> <20011129.151831.971899228.1845@hp.com> <83vgfru4la.fsf@panacea.canonical.org> Message-ID: Kragen Sitaker wrote: >ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) writes: >> I was commenting on the standard python distribution in reference to >> the original comment about php forcing you to mix html and code. In >> both php and python the standard distribution doesn't have >> templating features, however it is fairly easy to get a module that >> implements it or to create one yourself. > >"%s" % foo in Python is a templating feature. In PHP the whole >language is a templating feature. What am I missing? > By templating features, I was refering to a way to separate the html and code into separate files, one for the html with tags indicating where to substitute values and one for the code. This is primarily so that the web designers/graphic artists can fiddle around with the look and feel without having to know php or python. Likewise, the developers can write the code without having to worry about the appearance. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From buzzard at urubu.freeserve.co.uk Tue Dec 11 14:44:58 2001 From: buzzard at urubu.freeserve.co.uk (Duncan Smith) Date: Tue, 11 Dec 2001 19:44:58 -0000 Subject: eGenix extensions / GMP References: <9v5df1$tla$1@newsg4.svr.pol.co.uk> <9v5gfs0a6h@enews4.newsguy.com> Message-ID: <9v5npg$2jk$1@newsg1.svr.pol.co.uk> Thanks for responding, but I'm still a bit stuck. Details below. "Alex Martelli" wrote in message news:9v5gfs0a6h at enews4.newsguy.com... > "Duncan Smith" wrote in message > news:9v5df1$tla$1 at newsg4.svr.pol.co.uk... > > I have recently installed the eGenix experimental extensions. This > includes > > a Windows port of GMP 3.1.1. That works fine. But I would also like to > use > > GMP via PyInline (or C++), but the C compiler doesn't seem to recognise > that > > GMP is present. I have also downloaded the Windows port separately from > > http://www.lemburg.com/files/python/, but I'm not sure where to go from > > here. Anyone any idea how to sort this out (step by step)? Python 2.1, > > Visual Studio 6 on Win 2000. Thanks in advance. > > I've regularly used the Windows GMP port that comes with gmpy (see > gmpy.sourceforge.net) on its own (not via PyInline -- never tried > that). For that, you basically just need to have Visual C++ find > the .h file (for compilation) and .lib (for linking), either by > placing those files in existing VC++ recognized directories or by > adding to your environment suitable variables. > I've tried copying gmp.h and gmp31.lib to the relevant directories. I can #include without the compiler throwing a wobbler, but if I try something like mpz_mul (x, x, x); in my code I get the message, 'BuildError: error: command '"C:\Program Files\Microsoft Visual Studio\VC98\BIN\link.exe"' failed with exit status 1120'. I'm sure the files I have in gmp-3.1.1-win32-1.zip are all I need if I only knew what to do with them. The files are: gmp31.dll gmp31.lib gmp31.exp gmp.h gmp-3.1.1-win32.patch Readme Copying.lib Of these files, only the DLL is evident in my mx extensions installation. The relevant part of the Readme text is: "This archive contains the GNU MP lib compiled as DLL using MS VC6 on a i386 machine. To link against the DLL, simply add the gmpXX.lib file to your link options and redistribute the gmpXX.dll and this archive together with your application." I have checked out gmpy. Now I have several ways I can use 'integers of arbitrary length' in Python. But what I really want is the way that requires a proper installation of GMP (in the sense that the C compiler doesn't knock it back). > Take care, though: if you compile this way, each DLL you build > will be using its own copy of GMP. Oh. Not the best then. I don't know if Lemburg's port > exposes a C-API (to let other Python-extension DLL's/PYD's share > just one GMP); gmpy's does, and there's an example distributed > with it of another C-coded Python extension using that API. I > don't know about PyInline, though. > Didn't find any examples, just a couple of pyds. Cheers. > > Alex > > > From loewis at informatik.hu-berlin.de Wed Dec 26 18:54:44 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 27 Dec 2001 00:54:44 +0100 Subject: O'Reilly's Python and XML References: Message-ID: "A. Keyton Weissinger" writes: > Anyone have any word on PyXML for Python 2.2? When will it be released, etc? PyXML 0.7 builds fine with Python 2.2 if you have a compiler. If you don't have a compiler, what platform do you want binaries for? In any case, many of the libraries presented in the book will work with the stock Python xml libraries, no PyXML needed. Only when it comes to validation or enhanced DOM features, you need PyXML, and only for XSLT, you need 4Suite (for the plain 4XPath application, PyXML 0.7 should be good enough). Regards, Martin From fredrik at pythonware.com Tue Dec 4 02:52:58 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 04 Dec 2001 07:52:58 GMT Subject: "print 0.1==0.1" -> TypeError; what did I do? References: <87pu5vqxvv.fsf@dgp.toronto.edu> Message-ID: Maciej Kalisiak wrote: > I don't know much of the internals of Python, so this isn't giving me > any hints as to what the problem is. Can anyone offer any hints of > what to look at, as far as debugging goes? What could cause this type > of behaviour? does the problem go away if you add this line just after the call to your extension: hasattr(None, "spam") if that's the case, you've probably forgotten to check the return status from some internal Py-function. a quick and somewhat dirty fix could be to add this to the end of your C function: if (PyErr_Occurred()) return NULL; return result; a better solution is to make sure you check the return value from every Py-function that can generate an exception. for more info, see: http://python.sourceforge.net/devel-docs/ext/errors.html http://python.sourceforge.net/devel-docs/api/exceptions.html hope this helps! From justin at iago.org Tue Dec 4 10:36:15 2001 From: justin at iago.org (Justin Sheehy) Date: Tue, 04 Dec 2001 10:36:15 -0500 Subject: Linux Kernel Design and Why Python is Rad In-Reply-To: <200112040103.fB413jJ00379@my.knctv.co.kr> (Jonathan Gardner's message of "Tue, 4 Dec 2001 09:56:31 +0900") References: <9ugc0h$n9t$1@slb1.atl.mindspring.net> <200112040103.fB413jJ00379@my.knctv.co.kr> Message-ID: Jonathan Gardner writes: > Sun is dying Eh? Where did this piece of FUD come from? Given that you use this as a premise, I don't think I'll bother with the rest of the message. -Justin From vm_usenet at yahoo.com Mon Dec 3 10:18:26 2001 From: vm_usenet at yahoo.com (vm_usenet) Date: 3 Dec 2001 07:18:26 -0800 Subject: Question about PyRun_SimpleString Message-ID: Hi everyone, Is there any way to feed more than one line of code to PyRun_SimpleString? I tried to enter tabs and newlines to the string given as input, but it is still not executed. The only thing I could achieve is to seperate two statements with a semicolon, join them and then run the resulting string. How could I do such a thing? thanks in advance, vm From ulf.magnusson at ubm-computing.com Sun Dec 30 03:21:29 2001 From: ulf.magnusson at ubm-computing.com (Ulf Magnusson) Date: Sun, 30 Dec 2001 08:21:29 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <4VlX7.6657$l93.1694996@newsb.telia.net> <3C2E6D60.81031B00@earthlink.net> Message-ID: "Ron Stephens" wrote > You are probably aware of the Stackless Python project, I don't know off hand > where its web site is, and it's not a compiler I don't think, but a different > implementation of a Python interpreter that is a little faster in program > execution (a lot faster ??). I checked it out, they are located at http://www.stackless.com/ but the project seems a little out of date, according to their homepage the last update occured 2001-05-14 and the last supported version is Python 2.0 Regarding the speed, they clain on their homepage: "8-10% faster executable on Win32" > I know it's not what you are after exactly, but I guess if you want speed of > execution, it could be of interest. Thanks, all information is appreciated! But I guess I am looking for a "real" compiler. > I bet someday someone or some group creates an "optimized" compiler for Python, > but I hear it would be an enormously difficult and complex job. My guess is > that, if Python becomes popular *enough*, then someone will find the difficulty > worth tackling. Yes, I certainly hope so. > On another related tangent, I hope someday someone makes a .Net implementation > of Python. Mark Hammond, who was I think involved in ActiveState's prototype > effort to do just that, has stated how difficult a job it is. But again, if > Python becomes popular enough then someone may do it. > > One last aside, I keep seeing news about Mono, there was a nice > interview/article in, I think Linux Journal recently by Miguel de Icaza (sp?) > and it sounds like they are making real progress. I wonder, would a Python.Mono > be just as difficult as a Python.net (I guess it would). Would a Python.mono and > a Python.net be do-able as a joint project? > > Wouldn't a Python.Mono be nice ;-)))) I guess you are referring to: http://www.go-mono.com/rationale.html otherwise, do educate me... A .NET python will truly be an interesting product, apparently you can download a Visual Python beta (I think) for the VS .NET BETA 2 environment at ActiveState. /U. Magnusson From dave2206 at aol.com Mon Dec 10 09:19:06 2001 From: dave2206 at aol.com (davewesterman) Date: 10 Dec 2001 14:19:06 GMT Subject: A pretty dumb newbie question References: <20011203212412.12737.00000727@mb-cs.aol.com> Message-ID: <20011210091906.16346.00001379@mb-ma.aol.com> sqrt(x) Return the square root of x. >How would you calculate square root? I've tried >x**1/2 >Which doesn't work >Anbody? *)(*()*)(*()*)(*()*)(*()*)(*()*)(*()*)(*()*)(*()*)(*()*)(*()*)(*()*)(*()*) (*()*)(*()*)(*()*)(*()*)(*()*)(*()*) From phd at phd.pp.ru Tue Dec 11 13:35:27 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Tue, 11 Dec 2001 21:35:27 +0300 Subject: A common GUI define like rebol VID? In-Reply-To: <01e701c18271$a47b3da0$156ff181@idi.ntnu.no>; from mlh@idi.ntnu.no on Tue, Dec 11, 2001 at 07:28:34PM +0100 References: <9v12k6$ak9$1@mail.cn99.com> <9v5hdb$bsv$1@tyfon.itea.ntnu.no> <20011211211130.C24106@phd.pp.ru> <01e701c18271$a47b3da0$156ff181@idi.ntnu.no> Message-ID: <20011211213527.D24106@phd.pp.ru> On Tue, Dec 11, 2001 at 07:28:34PM +0100, Magnus Lie Hetland wrote: > > > Anygui will hopefully work on all these platforms. (Yes, *including* > > > DOS... We already have beginning implementations of textgui and > cursesgui > > > in CVS :) > > > > Do you mean to reimplement curses for DOS? Or use some DOS > > implementation of curses? > > We are not reimplementing curses for DOS, no... If there is a version of > curses for DOS, Anygui will work with that. (I don't know anything about > curses in DOS, actually ;) pdcurses (at least for w32), may be? http://www.mikroplan.com.pl/~mak/python/ > And if there is no curses, you can use textgui, which only needs the > print statement. Slightly corny, but mighty cool, IMO. (And at least it > works ;) Aha, curses implemented with "print" :) Nice! > Here is an actual screenshot (I never thought I'd say that about contents > of a plain-text usenet posting ;) ): LOL! :))) Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From wurmy at earthlink.net Fri Dec 28 13:36:09 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Fri, 28 Dec 2001 18:36:09 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2C8A86.50C74E60@earthlink.net> Message-ID: <3C2CBA56.17FE536C@earthlink.net> Steve Lamb wrote: > > On Fri, 28 Dec 2001 15:12:20 GMT, Hans Nowak wrote: > > Hey, you guys, stop dissing my box like that! >=) > > (900 MHz, bought last month...) > > Hey, I'm allowed. > > Winbox for games: 667mhz, 512Mb RAM. > Linux server/workstation: 450Mhz, 384Mb RAM (although I can drop another 450 > in) > Linux Laptop: 667Mhz, 128Mb RAM. > > You trump me on all three. Fair enough, but did you buy those recently? The original remark was about the slowest computers one could get today... Ah well, that's what I get for buying mine at K-mart... ;-) --Hans From bckfnn at worldonline.dk Fri Dec 21 17:36:30 2001 From: bckfnn at worldonline.dk (Finn Bock) Date: Fri, 21 Dec 2001 22:36:30 GMT Subject: ANN: Second beta release of Jython-2.1 Message-ID: <3c23b200.44206856@mail.wanadoo.dk> I am happy to announce the second beta release of Jython 2.1. Jython is a Java implementation of the Python programming language. It allows users to compile Python source code to Java byte codes, and run the resulting bytecodes on any Java Virtual Machine. It is a very seamless and smooth integration with Java: from Python you have complete access to all Java libraries, can build applets, can integrate with Java beans, and can subclass Java classes in Python and vice versa. Like Python, and unlike Java, Jython can also be used interactively: just type some Jython code at the prompt and see the results immediately. A java installer is available for download at the Jython website: http://www.jython.org/ Installation of version 2.1b2 is similar to version 2.0. Further information and tips on installation is available at: http://www.jython.org/install.html Jython 2.1 aims to be feature compatible with Python 2.1.1 and among the new feature are: - support for callproc() in zxJDBC is now available for most simple stored procedure calls. The list of bugs fixed since the previous release includes: - [ #451552 ] case insensitivity on import causes prob - [ #456926 ] PackageManager doesn't work correctly - [ #484949 ] __import__(_) does unwanted rel search - [ #488632 ] -c sys.argv diff - [ #489168 ] Parse error, java traceback - [ #489836 ] Private names is not mangled - [ #490157 ] string.splitlines() - incorrectly splits - [ #490230 ] NotImplemented not implemented - [ #490961 ] PyFile.java requires JDK 1.2 - [ #490962 ] Typo in PyFile.java - [ #490963 ] Please update ReadlineConsole.java - [ #494514 ] Python object not gc()'d - [ #495458 ] multi level import from .zip file. - [ #495870 ] zxJDBC now only prepares statements with params. A complete list of changes and differences are available here: http://www.jython.org/NEWS.html Bugs can be reported to the bug manager on SourceForge: http://sourceforge.net/bugs/?group_id=12867 Cheers, the jython-developers From Cashad at naturallife.ca Mon Dec 17 13:14:37 2001 From: Cashad at naturallife.ca (Cashad at naturallife.ca) Date: Mon, 17 Dec 2001 11:14:37 -0700 Subject: Can you Make 2500++ from $25??? SEE HOW Message-ID: <3101219-2200112117181437907@naturallife.ca> AS SEEN ON ABC's 20/20: The amazing story of a 15 yr. old boy who made over $70,000 on the internet in a matter of weeks. He designed the EASIEST HOME BUSINESS EVER. It's honest, it's not multi-level and best of all, IT'S SIMPLE. You won't be bugging your friends and family. A little time spent each day and only $25 invested and the program begins to work for itself. I figured if a 15 year old boy can do it so can I (a 34 year old IT Manager). For more information email me at cashad at naturallife.ca I had gotten a few of emails about this program, but just deleted them. My curiosity was killing me. So, I finally decided not to delete it. I figured, "hey, it can't hurt to check it out". That decision has changed my life. Here you have the very same opportunity in front of you. If you take just five minutes to read through a program that could make a huge difference in your financial status. This is the type of opportunity we all pray will come along. Since this program aired on National TV, thousands are joining every Hour. You'll earn cash in a matter of a couple of weeks! I did. More information by emailing me at cashad at naturallife.ca THIS IS NOT A SCAM ABC 20/20 PROVED THAT AND ITS JUST TOO....SIMPLE!!!! WE DO NOT SPAM. You are receiving this information via opt-in only. And you may opt-out at any time. If you are not interested and want confirmation of removal, and in compliance with proposed federal legislation (H.R. 3113 and S. 2542) and ll enacted state legislation, reply to this email with 'remove' in the Subject line. From db3l at fitlinxx.com Fri Dec 21 01:41:12 2001 From: db3l at fitlinxx.com (David Bolen) Date: 21 Dec 2001 01:41:12 -0500 Subject: Win32Service and Service Manager References: <52842usq62dho41m9i4lg15l8pgfc0h8m3@4ax.com> <3C226D30.5080902@skippinet.com.au> <30152u49q8p4nj467ijnho4v7jg15vj351@4ax.com> Message-ID: Dale Strickland-Clark writes: > I'm mystified how you can even create a service that doesn't show up > here and yet still responds to NET STOP and START commands. As far as I know you can't. Dumb question though - the snap-in should be sorting and displaying the full display name, so could you be looking for the short name instead? Or perhaps you could also use the 'sc' utility from the resource kit or something like psservice from sysinternals to lookup information based on the same name you are using with the "net" command and see if anything is strange in the display name. (You can also just do the same queries from Python code calling the service functions). Or, any service should be defined in a key (by short name) in the registry under HKLM\System\CurrentControlSet\Services, so you might poke around there to locate your entry and see if anything looks amiss with its display name. Maybe there's some strange character or something in there that is affecting its display in the MMC. -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l at fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/ From bryan at eevolved.com Mon Dec 3 09:40:52 2001 From: bryan at eevolved.com (Bryan) Date: Mon, 3 Dec 2001 09:40:52 -0500 Subject: CryptKit 0.9: cryptsock In-Reply-To: <874rn9ysw9.fsf@saltationism.subnet.hedonism.cluefactory.org.uk> References: <7x667pw8ap.fsf@ruckus.brouhaha.com> <874rn9ysw9.fsf@saltationism.subnet.hedonism.cluefactory.org.uk> Message-ID: On Sunday 02 December 2001 09:26 pm, Paul Crowley wrote: > AMP carries a "proof of security", but I can't follow it, and I spoke > to an expert in this field who says he's not convinced by it either. > Furthermore, AMP has a similar problem to SRP, that a sufficiently > devious fake server can check two passwords with every query. That > the proof doesn't rule this out indicates some problems with it. > > It's straightforward to propose a variant on AMP that doesn't have > this problem, and that variant may be secure, but I'd like to have a > better way to construct the proof of security for that. > > As far as I can tell from the ResearchIndex URL, that paper hasn't > been published yet as such. I think the protocol has great merit and > I hope it does get published, though I don't see the advantages of the > "amplification scheme" over simply encrypting the password file with a > symmetric cipher. > > If I was going to implement something now, I'd certainly use SRP. Thanks for the input. What are your thoughts about EC-PAK? http://citeseer.nj.nec.com/mackenzie01more.html -- <==================================> Bryan Mongeau eEvolved Real-Time Technologies Inc. Website: http://www.eevolved.com Public key: http://pgp.mit.edu <==================================> "Eventually software systems will be able to create bold new designs without human help. Will most people call such systems intelligent? It doesn't really matter." -- K. Eric Drexler From mhammond at skippinet.com.au Wed Dec 19 06:38:57 2001 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 19 Dec 2001 11:38:57 GMT Subject: sys.path ordering question References: Message-ID: <3C207C52.8080700@skippinet.com.au> Kerim Borchaev wrote: > Could someone explain the paths ordering logic used to create sys.path > listed below? > Why win32 extensions are before standard python paths but Numeric and other > after? > (I know this ordering makes sense - it's how modules are searched. Paths before the standard paths come from either the registry or PYTHONPATH. Then .pth files are used, and their paths *appended*, yielding the results you see. > And in fact I'm asking this to get guidelines how should I arrange > my own packages.) Use a .pth file like these packages do. This is really what the Win32 extensions should do too. Mark. From justin at iago.org Fri Dec 14 14:13:15 2001 From: justin at iago.org (Justin Sheehy) Date: Fri, 14 Dec 2001 14:13:15 -0500 Subject: Unsung Python modules In-Reply-To: <15386.18916.707282.784261@beluga.mojam.com> (Skip Montanaro's message of "Fri, 14 Dec 2001 12:50:12 -0600") References: <3dsnad226b.fsf@ute.mems-exchange.org> <15386.18916.707282.784261@beluga.mojam.com> Message-ID: Skip Montanaro writes: > I agree on the readline module (don't have a lot of need to text file > processing that sys.stdin.readlines() won't handle). It seems like I've > travelled back to the dark ages whenever I have to use Python without > readline or a "real" Bourne shell. Being able to recall a line or two from > an interactive session from a few minutes before (or a few days before) > makes day-to-day interaction with these tools so much easier. One reason that a lot of people might not think of this is that it's not needed if you're using Python's interactive mode in an emacs inferior shell buffer alongside Python-mode. Emacs takes care of the history for you, regardless of readline. (Being able to send arbitrary sections of code from the editor into the interactive interpreter is also very important to me.) I like this behavior so much that I will often use Emacs and python-mode even when all I wanted was some interactive experimentation. "Scherer, Bill" writes: > Queue is so handy for many tasks when multithreaded. Seconded. I use Queue very heavily in many different systems. -Justin From fperez528 at yahoo.com Tue Dec 4 11:49:17 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Wed, 05 Dec 2001 16:17:17 +2328 Subject: Suggestion for a change to a standard module - where? References: <9um7m0$ie9$1@peabody.colorado.edu> Message-ID: <9um9tb$jp3$1@peabody.colorado.edu> Fernando P?rez wrote: I guess I should clarify: > that arise in the standard module code. ^^^^ -> 'code.py' > Code which uses the module in its standard form needs no changes ^^^^ -> normal use of the word 'code'. The confusion is b/c there's a standard module actually called 'code'. Real descriptive, eh? Especially when you look into it and realize what it implements is the interactive interpreter itself (which you can use to build your own interpreters). Oh well, somebody was having a low name-creativity day when they put that out. Cheers, f. From tim at vegeta.ath.cx Tue Dec 4 20:18:52 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Wed, 05 Dec 2001 01:18:52 GMT Subject: The Editor Poll results are in! References: <3bfd7f87@news.airtel.net> <9u4cbu$2ts$1@news.xmission.com> Message-ID: Grant Edwards graced us by uttering: > Tim Hammerquist wrote: [ snip ] > > what's "organic coffee"? > > If I recall my chemistry correctly, "organic" refers to > chemical compounds involving carbon, espcially things with > carbon-carbon bonds forming chains/rings. > > Stuff like gasoline, plastics, nerve gas, that sort of thing. LOL! Tim Hammerquist -- If you had two people with a motive, and one of them was alive, who would you arrest? -- Inspector Boot, "Theater of Blood" From store_li at sina.com Tue Dec 18 05:03:17 2001 From: store_li at sina.com (Kick) Date: Tue, 18 Dec 2001 18:03:17 +0800 Subject: How can display chinese char in Python/Tkinter? Message-ID: <9vn4ck$gie1b$1@ID-12869.news.dfncis.de> I have retrieved data from excel and MSSql server,then display it using Tkinter label and text widget. All the char I retrieved from excel were treated as Unicode and display well, while the data I retrieved from MSSql aren't so lucky. they can only be displayed as half char. I use gb2312 as my mssql's code page and I got correct display in console. How can I display data from MSsql correct? Please help me!! From peter at engcorp.com Sun Dec 9 00:46:38 2001 From: peter at engcorp.com (Peter Hansen) Date: Sun, 09 Dec 2001 00:46:38 -0500 Subject: Does 'super' exist? References: Message-ID: <3C12FABE.A56B633F@engcorp.com> Bruce Eckel wrote: > > It's a little hard to tell, does 'super' exist in 2.2? If so, where > might I find the syntax? Thanks. There are potentially multiple 'supers', so you have to be explicit. >>> class A: pass >>> class B: pass >>> class C(A, B): pass >>> C.__bases__ (, ) You can do things like this: >>> class A: ... def __init__(self): ... print 'init A' ... >>> class B: ... def __init__(self): ... print 'init B' ... >>> class C(A, B): ... def __init__(self): ... for base in self.__class__.__bases__: ... base.__init__(self) ... >>> c = C() init A init B ... or if you want the order of initialization to be different than the order in which the superclasses were listed: >>> class C(A, B): ... def __init__(self): ... B.__init__(self) ... A.__init__(self) ... >>> c = C() init B init A -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From peter at engcorp.com Sun Dec 30 00:59:41 2001 From: peter at engcorp.com (Peter Hansen) Date: Sun, 30 Dec 2001 00:59:41 -0500 Subject: Is learning Python "extraordinary"? References: <3C2E5706.5880983E@engcorp.com> Message-ID: <3C2EAD4D.77564075@engcorp.com> Sheila King wrote: > > On Sat, 29 Dec 2001 18:51:34 -0500, Peter Hansen wrote > in comp.lang.python in article <3C2E5706.5880983E at engcorp.com>: > > > I'm afraid not. All the developers I've hired in the last > > two years took about a week to become productive with Python > > after being exposed to it for the first time. Of course, > > maybe they're *all* extraordinary! > > And these developers you hired were high school students applying for > admission to college? Uh, no actually. :-) I think my perspective is somewhat tainted from being one of the freaks (back then) who was rather self-taught. By the end of high school I knew BASIC, C, APL, 6502 assembly, and others. By *no* means exceptional compared to many of the real wizards of the industry, but I think it means it didn't occur to me that high school students of today might not already know several programming languages. At least those applying for MIT. :) It is still my opinion that a bright person who has learned several computer languages can learn Python enough to start working on non-trivial tasks with not much more than a week of learning, but that opinion is based solely on observation of a dozen perhaps quite bright people doing just that. -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From jkraska at san.rr.com Tue Dec 11 22:36:22 2001 From: jkraska at san.rr.com (Courageous) Date: Wed, 12 Dec 2001 03:36:22 GMT Subject: Subclassing builtins or another alternative References: Message-ID: <66jd1u0a1d3h8ps7fvjvbcud10813vmfc9@4ax.com> >So for the 2.2-and-later world, maybe Objects/stringobject.c >has the solution. (Wild guess: try adding Py_TPFLAGS_BASETYPE >to your type's tp_flags.) Good guess; that was one of the things I had to fix a bit earlier. It's funny, I've written any number of Python extensions, understand references, and so on, but I've never quite had the problems I've had with this one before. >Hope this helps! Good luck! Thanks! As it happens, I got it working, and inferred all on my own that setattr isn't used in this context. It didn't help that I introduced a typo to test code not shown that forced an attribute to be used before it was set, temporarily tricking me into thinking I hadn't solved the problem yet. :) By the way, I _am_ using 2.2 (from CVS as a matter of fact). C// From news at originsofevil.com Thu Dec 13 18:22:39 2001 From: news at originsofevil.com (news at originsofevil.com) Date: Thu, 13 Dec 2001 15:22:39 -0800 Subject: Fallen Angels, Originators of Evil on Planet Earth? Message-ID: FREE INTERNET BROADCAST TALK ON: Tuesday, December 18, 2001, at 7 PM (CST) http://www.originsofevil.com/ Fallen Angels, Originators of Evil on Planet Earth? Here's a spiritual curve ball for you. What if Lucifer and the other fallen angels "fell" into Earth and the realms of time and space -- in other words, into your own personal neighborhood? And what if they have literally been "raising hell" on this planet for thousands of years in their anger and rebellion against God and mankind? Terrible wars. Religious fanaticism. Destruction of the environment. Exploitation of natural resources. Political and economic manipulation on a planetary scale? Is this the work of fallen angels living among us here in the physical world.? Is there anything we can do to counteract the instigators of evil on the spiritual level? Tune into this highly unusual free interactive Internet broadcast talk on, "Fallen Angels & the Origins of Evil" and find out. This talk draws from the ancient Book of Enoch, the popular esoteric best-seller, Fallen Angels and the Origins of Evil and several other sources. That's next Tuesday evening, December 18, 2001, at 7 PM (CST). For more information visit: http://www.originsofevil.com/ Sponsored by The Summit Lighthouse of the Twin Cities, broadcast live from Minneapolis. You're in for a surprise. This is not your typical religious talk. Expand your illumination horizon and don't miss it! {If you would like to be removed from this distribution list, please hit reply and type REMOVE in the subject line.] From loewis at informatik.hu-berlin.de Fri Dec 28 18:29:47 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 29 Dec 2001 00:29:47 +0100 Subject: UML/XMI et al References: Message-ID: Harry George writes: > I'm working with several CASE tools, some of which have XMI > interfaces. I want to drive code in and out of them (and generate SQL > code for several DBMS's) using python. Anyone working in this area? Yes, I've been looking into XMI at one time. People also use XSLT to process XMI. > I have already done a generator for UML/XMI DTD --> python classes, and > MySQL and PostgreSQL SQL code generators. Sounds interesting. Are you going to publish that code? Does that use a custom mapping, or a general one? Regards, Martin From claird at starbase.neosoft.com Mon Dec 10 12:40:51 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 10 Dec 2001 11:40:51 -0600 Subject: Date manipulation in Python References: Message-ID: <8FEF48AFAD3C8B1D.016E1CA63BDF379D.179D5366CCEF21B7@lp.airnews.net> In article , David Brady wrote: >Hello, > >Firstoff, thanks to all the great answers I keep >getting on this list. I hope I'm not annoying >everyone... :-) > >I am writing a tool that prints calendar/planner pages >for me. I know how to get today's date and day of the >week from strftime and localtime... but I'd like to be >able to move around in the date and still be able to >print out the correct calendar. For example, if today >were Saturday, December 1st, I'd like to be able to >show the week from Monday, November 26th through >Sunday, December 30th. > >My initial impulse is to figure out which time format >returns epoch seconds, and then add and subtract >86,400 seconds per day to move around in the date. >But somehow I also think that "Guido has thoughtfully >shot me in the foot years ago." :-) > >Oh, one last thing. A coworker *also* has a similar >need, only he needs to go back to exactly midnight of >a certain day of the week, and get the epoch seconds >to return a hardcoded timestamp. > >Is there a good, Python way to do this? ...of course >there is. It just may not be written yet. If it is, >would someone share? . . . Prepare to fall in love. does this, and much more. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From peter at engcorp.com Fri Dec 28 11:49:09 2001 From: peter at engcorp.com (Peter Hansen) Date: Fri, 28 Dec 2001 11:49:09 -0500 Subject: REPOST: Re: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B941D.B1E45AA5@htp-tel.de> Message-ID: <7$--$$_----_-$--_$@news.noc.cabal.int> Alex Martelli wrote: > "Aahz Maruch" wrote: > > DeepBleu wrote: > > > > > >NNTP is an internet protocol like SMTP, POP3 and HTTP for > > >communication. Also, it is the oldest one and it used to be the most > > >instructive before AOL hit the scene along with the 'gold rush' :) > > > > Really? NNTP is older than SMTP? Mind telling me where you found that > > little gem? > > SMTP must be older, by a few years (say '82 vs '86?). FTP must be > older still -- before SMTP, mail was distributed with an FTP tweak. > > Of course, netnews used other transport-level protocols (mostly > based on UUCP, as I recall) well before the Internet was officially > inaugurated (1983, wasn't it?). I *thought* I remembered reading Usenet back around 1980 or 81 but that seems unlikely since Usenet first started in 79 but was limited to only a few computers until probably well after 82. I see that NNTP (RFC977) came around in 1986 while SMTP dates from around 1981 (RFC788) although a previous MTP (RFC780) which is presumably not quite as simple dates from 1980. And I was reminded again of the humorous coincidence that our network mail standards were written by somebody named "Postel". :) -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!zeus.visi.com!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Peter Hansen Newsgroups: comp.lang.python Subject: cmsg cancel <3C2CA285.BE256C16 at engcorp.com> Control: cancel <3C2CA285.BE256C16 at engcorp.com> Date: Mon, 31 Dec 2001 04:22:47 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775244 27193 211.57.49.2 (31 Dec 2001 05:07:24 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:07:24 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From sholden at holdenweb.com Mon Dec 17 08:51:50 2001 From: sholden at holdenweb.com (Steve Holden) Date: Mon, 17 Dec 2001 08:51:50 -0500 Subject: python and SOAP?? References: Message-ID: "John Thingstad" wrote ... > There is a SOAP implementation for Python. > I feel the need to spesify that SOAP is a protocol created to send Object transcripts over the HTTP protocol. > CORBA however existes for objects to communicate over the lLAN. > CORBA (or for that matter DCOM) must be fast as it is created to allow a cluster of objects distributed over multiple machines to exchange date. I am not a CORBA expert, but I don't see anything in the protocols that wouldn't work over the wide area, and I believe it has been used in this way. > SOAP works as a much higher level of abstartion. Say communication with a bank. > Further CORBA will usually be blocked from internet accesss. SOAP using HTTP protocol will not. Indeed, although given that firewalls are normally installed precisely to PREVENT the kind of thing you can do with SOAP one wonders how long this state of affairs is likely to last. I have alsways felt that this aspect of SOAP's justification was pretty bogus. > So... SOAP isn't designed to replace CORBA. > Note that Microsoft is one of the strongest promoters of SOAP and that it dosen't really compete with teir COM+ comittment. > Is BizTalk completely standards-compliant? At one stage it looked as though Microsoft were going to do their usual "slightly incompatible" thing and implement BizTalk as "amost SOAP". regards Steve -- http://www.holdenweb.com/ From h.jehadalwan at student.kun.nl Sat Dec 22 11:23:36 2001 From: h.jehadalwan at student.kun.nl (husam) Date: Sat, 22 Dec 2001 17:23:36 +0100 Subject: Search the difference: Why this function defenition does'nt work? References: <3C24A967.3070604@student.kun.nl> Message-ID: <3C24B388.8020006@student.kun.nl> Aahz Maruch wrote: > In article <3C24A967.3070604 at student.kun.nl>, > husam wrote: > >>hi, I'm a beginner to python and try to understand some basic stuff. >>Hier are two function defenitions , which look the same for me, but the >>second one does not work. Can anybody explain why? >> >>def fun1 (*args): >> sum=args[0] >> for next in args[1:] >> sum=sum+next >> return sum >>print fun1('a','b','c') >> >>>>>abc >>>>> >> >>def fun2 (*args): >> sum=args[:0] >> for next in args[1:] >> sum=sum+next >> return sum >> >>print fun2('a','b','c') >> >> >>>>>TypeError: illegal argument type for built-in operation >>>>> > >>>>l=['a','b','c'] >>>>l[0] >>>> > 'a' > >>>>l[:0] >>>> > [] > > That should be enough to figure out your problem. Next time, try using > the interactive interpreter to test your code. > From jason at jorendorff.com Sat Dec 15 00:35:01 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Fri, 14 Dec 2001 23:35:01 -0600 Subject: IDLE (was: Preserving program structure) In-Reply-To: <1EyS7.6544$ia7.942739@news6-win.server.ntlworld.com> Message-ID: > The impression I get is "avoid IDLE". I use IDLE for pretty much everything. It isn't Emacs, but it works fine and I've had no problems whatever with its indentation handling. When I hit Tab, it apparently inserts the appropriate number of spaces. -- Jason Orendorff From skip at pobox.com Sun Dec 16 15:42:55 2001 From: skip at pobox.com (Skip Montanaro) Date: Sun, 16 Dec 2001 14:42:55 -0600 Subject: persistant options In-Reply-To: References: Message-ID: <15389.1871.536177.214720@12-248-41-177.client.attbi.com> Andrei> I'm looking for solutions or advice on persistant options / Andrei> config file. Check out the ConfigParser module in the Python distribution. -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From mkelly2002NOSPAM at earthlink.net Mon Dec 3 15:32:39 2001 From: mkelly2002NOSPAM at earthlink.net (Michael Kelly) Date: Mon, 03 Dec 2001 20:32:39 GMT Subject: Editing a Path References: Message-ID: On Mon, 03 Dec 2001 11:58:41 -0800, Ben Ocean wrote: >This may be slightly OT, but I need to edit my path /usr/bin/python such >that it renders python2.1 instead of python1.5.2 >I built python2.1 from source on an RH71 box. How do I update the path? >TIA, >BenO > Use the ln command to change the soft link. man ln from the /usr/bin directory do ls -l python if you get something like: python -> python1.5.2 then it's a soft link pointing to that directory. Just use ln to point it to python2.1 Mike -- "I don't want to belong to any club that would have me as a member." -- Groucho Marx From pythonnet at hotmail.com Wed Dec 26 17:31:45 2001 From: pythonnet at hotmail.com (Andrew Nguyen) Date: 26 Dec 2001 14:31:45 -0800 Subject: The Python community needs a lighter heart to it. Message-ID: <40dbad98.0112261431.3e928cf2@posting.google.com> The python community is a bunch of people who can't take a joke. (Or at least make one:)) Also, usenet SUXXOR (sucks) because itttt issss soooo cunfuseeeng... Why not switch to an EZBoard? Why have maling lists that are too confusing? I for one say that we create a NEW forum! I bet you, that if we put a link on the python homepage with a link to an EZBoard, python would be Much more popular. The most exciting topic I have seen to date is 'Fun with Classess in Python 2.2'. Also, the Python Game Dev community DOESN'T EVEN HAVE A FORUM!!! Only IRC wich in my opinion is not that great. With a forum for it, we could trade code and things like that. anyways, it is hard finding about new styles and things like that! From dkuhlman at rexx.com Sat Dec 15 16:57:53 2001 From: dkuhlman at rexx.com (Dave Kuhlman) Date: 15 Dec 2001 15:57:53 -0600 Subject: Preserving program structure References: <3C1A5960.4A27136D@attbi.com> Message-ID: <1008454218.762752@rexx.com> Chris Barker wrote: > > David Dawkins wrote: >> So I'm using IDLE, and Alt-F5 tells me I have a problem with >> indentation. >> >> It seems I had (inadvertently) mixed tab and space characters. >> No amount of "tabbifying" and "untabbifying" resolved the issue, >> so I had to shift *everything* to the left-margin, and re-create >> the indentation with a consistent scheme (8 space hard tabs). > > I'm confused. How is it that "untabbifying" didn't resolve it? While you > may have had a couple of indentations messed up, I would think that > would be a whole lot easier to fix than re-indenting the entire code! A possible explanation -- Suppose that the file you are trying to fix (1) mixes tabs and spaces and (2) suppose the file assumes that tabs are expanded by the Python interpreter to 8 spaces and (3) suppose that when you untabify, you expand them to 4 spaces. Lesson to be learned -- before untabifying, analyse the file to determine how many spaces you should replace each tab with. > > By the way, I don't know about IDLE, but PythonWin (and other editors) > has a mode that allows you to see tabs and spaces, so you can easily go > in a clean out the ones that you don't want. It will also help to set the tab size in your editor, then check the visual appearance of blocks of code so that indented control structures appear correct. Then, that tab setting is likely to be the number of spaces to replace a tab with when you untabify. By the way, when I do my untabifying, I use the UNIX expand and unexpand commands. Are there better tools for this? Is untabify.py any safer? > > > -Chris > -- Dave Kuhlman dkuhlman at rexx.com -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- From paustin at eos.ubc.ca Thu Dec 6 13:08:07 2001 From: paustin at eos.ubc.ca (Phil Austin) Date: 06 Dec 2001 10:08:07 -0800 Subject: MINGW References: <9uo25q$ilp$1@bob.news.rcn.net> Message-ID: "David Abrahams" writes: > Is anyone out there successfully using MINGW for development of extensions > with recent versions of Python (e.g. 2.1, 2.2b2)? The procedures I've found > on the web for making it work don't inspire confidence. I would appreciate a > pointer to a known working procedure if anyone can come up with it. > > TIA, > Dave > The scipy developers seem to have up-to-date experience. See http://www.scipy.org/site_content/tutorials/build_instructions I'm also interested in mingw boost python extensions, but haven't tried a build yet. Regards, Phil From nhv at cape.com Wed Dec 19 21:28:07 2001 From: nhv at cape.com (Norman Vine) Date: Wed, 19 Dec 2001 21:28:07 -0500 Subject: Cygwin fork() rebase solution (was Re: dll_list::load_after_fork() blues ...) In-Reply-To: <20011218211235.GA2476@dothill.com> Message-ID: <001801c188fd$f7ad07a0$a300a8c0@nhv> Jason Tishler writes: > >I believe that I have found a rebase solution to the Cygwin fork() >problem that has been causing Cygwin Python some grief lately. I added >an offset option to the attached rebase tool. If I spread the DLLs out >by an extra 0x10000, then the fork() problem seems to be mitigate. > >After rebasing the necessary Cygwin and Python DLLs: >I can run the full regression test without any failures *even though* >_socket is a shared module. > If my findings are corroborated, then I will work with the Cygwin team > to integrate rebase into setup.exe so that rebasing automatically occurs > every time that setup.exe is run. HI Jason 'Rebase'ing appears to work :-) Following report on a Win98 box with a 'fresh' Cygwin install Let me know if you need more testing done Cheers Norman ========== bash-2.05a$ uname -a CYGWIN_98-4.10 NHV 1.3.6(0.47/3/2) 2001-12-08 17:02 i686 unknown ========== bash-2.05a$ ./rebase.sh cygcrypto.dll: new base = 67f40000, new size = c0000 cygform5.dll: new base = 67f20000, new size = 20000 cygform6.dll: new base = 67f00000, new size = 20000 cyggdbm.dll: new base = 67ee0000, new size = 20000 cyghistory4.dll: new base = 67ec0000, new size = 20000 cyghistory5.dll: new base = 67ea0000, new size = 20000 cygmenu5.dll: new base = 67e80000, new size = 20000 cygmenu6.dll: new base = 67e60000, new size = 20000 cygncurses++5.dll: new base = 67e20000, new size = 40000 cygncurses++6.dll: new base = 67de0000, new size = 40000 cygncurses5.dll: new base = 67d90000, new size = 50000 cygncurses6.dll: new base = 67d40000, new size = 50000 cygpanel5.dll: new base = 67d20000, new size = 20000 cygpanel6.dll: new base = 67d00000, new size = 20000 cygreadline4.dll: new base = 67cd0000, new size = 30000 cygreadline5.dll: new base = 67c90000, new size = 40000 cygregex.dll: new base = 67c60000, new size = 30000 cygz.dll: new base = 67c30000, new size = 30000 cygssl.dll: new base = 67bf0000, new size = 40000 ======== bash-2.05a$ python regrtest.py Python 2.1.1 (#34, Dec 19 2001, 20:24:16) [GCC 2.95.3-5 (cygwin special)] on cygwin ....... 15 tests skipped: test_al test_bsddb test_cd test_cl test_dbm test_dl test_gl test_imgfile test_largefile test_linuxaudiodev test_locale test_nis test_socketserver test_sunaudiodev test_sundry ========= Cygwin DLL version info: DLL version: 1.3.6 DLL epoch: 19 DLL bad signal mask: 19005 DLL old termios: 5 DLL malloc env: 28 API major: 0 API minor: 47 Shared data: 3 DLL identifier: cygwin1 Mount registry: 2 Cygnus registry name: Cygnus Solutions Cygwin registry name: Cygwin Program options name: Program Options Cygwin mount registry name: mounts v2 Cygdrive flags: cygdrive flags Cygdrive prefix: cygdrive prefix Cygdrive default prefix: Build date: Sat Dec 8 17:02:30 EST 2001 CVS tag: cygwin-1-3-6-6 Shared id: cygwin1S3 From ws at mystrobl.de Fri Dec 7 13:19:23 2001 From: ws at mystrobl.de (Wolfgang Strobl) Date: Fri, 07 Dec 2001 19:19:23 +0100 Subject: How to use win32.NetUseGetInfo() References: Message-ID: <91221uocgk515ltnokett9aigtu0nf9c2l@4ax.com> On 7 Dec 2001 00:30:17 -0800, frankimmich at gmx.de (F.Immich) wrote : >I have a question concerning the win32net module. >I want to map the networkpath (UNC) to the corresponding network >resource within Python. >E.g. E: = \\server1\dr1\dir2 >Therefore I think I have to use NetUseGetInfo() ? No, you don't. Use NetUseAdd, like so: >>> win32net.NetUseAdd(None,1,{'remote': u'\\\\wbox\\filme', 'local': u'v:'}) >>> win32net.NetUseGetInfo(None,"v:") {'remote': u'\\\\wbox\\filme', 'local': u'V:'} >>> -- Thank you for observing all safety precautions From miir at iprimus.com.au Sat Dec 1 19:18:41 2001 From: miir at iprimus.com.au (Mike Tsakiris) Date: Sun, 02 Dec 2001 10:48:41 +1030 Subject: Python and FLTK Message-ID: <3C097361.F0297DEA@iprimus.com.au> Is anybody working of porting FLTK to Python; There was one in Sourceforge, but seems to have stopped. From maus at netz.klinik.uni-mainz.de Mon Dec 3 04:45:23 2001 From: maus at netz.klinik.uni-mainz.de (Christian Maus) Date: Mon, 03 Dec 2001 10:45:23 +0100 Subject: spawnv and stdout redirect Message-ID: <9ufhdo$c1r$1@bambi.zdv.Uni-Mainz.DE> I am trying to write a cgi-script in python which should spawn a new process and print a message to the user, stating that the process has been started. Unfortunately, this script has to runon a windows machine and I have the problem that my script doesn't terminate because the process keeps writing to stdout. Is there a way to redirect the stdout of this process to nul ? Simply adding ">nul", "2>nul" to the spawnv arguments does not work. Any help is appreciated. From paul at svensson.org Tue Dec 4 20:20:45 2001 From: paul at svensson.org (Paul Svensson) Date: Wed, 5 Dec 2001 01:20:45 +0000 (UTC) Subject: Draft PEP: string interpolation with backquotes References: <20011202080626.A76724@hishome.net> <20011202170805.A36879@hishome.net> <200112032307.fB3N78327930@bigboy.bizarsoftware.com.au> Message-ID: <9ujspb$777$1@news.island.liu.se> Oren Tirosh writes: >As for the issue of interpolation with backticks being equivalent to str() >rather than repr() - I believe most people won't even notice. When the >system simply does the Right Thing according to the context it feels more >consistent even if technically it isn't. Actually, considering that quotes create strings, having `foo` mean repr(foo) and "`foo`" mean str(foo) seems fairly natural... /Paul From emile at fenx.com Sun Dec 2 09:27:40 2001 From: emile at fenx.com (Emile van Sebille) Date: Sun, 2 Dec 2001 06:27:40 -0800 Subject: cgi question! problem with correct python version References: <9ucugc$7lqqu$1@ID-75083.news.dfncis.de> Message-ID: <9udeq4$7norp$1@ID-11957.news.dfncis.de> "Markus Jais" wrote in message news:9ucugc$7lqqu$1 at ID-75083.news.dfncis.de... > hello > I am using RedHat 7.1 and I have installed the old python 1.5.2 which seems > to be needed by RedHat 7.1 and also the Python 2.1 > > now I have a strange problem. > > 1st script: > ---- > #!/usr/bin/env python Does using #!/usr/bin/env python2.1 work? -- Emile van Sebille emile at fenx.com --------- From ngps at madcap.dyndns.org Tue Dec 4 12:02:04 2001 From: ngps at madcap.dyndns.org (Ng Pheng Siong) Date: 4 Dec 2001 17:02:04 GMT Subject: HOWTO: Programming S/MIME in Python with M2Crypto References: Message-ID: <9uivic$696$1@coco.singnet.com.sg> According to Graeme Longman : > I've been trying to get the examples in the HOWTO to work with Netscape > Messenger and haven't been able to. Have you set Messenger up per the ZSmime HOWTO? -- Ng Pheng Siong * http://www.post1.com/home/ngps From barry at zope.com Fri Dec 14 15:19:56 2001 From: barry at zope.com (Barry A. Warsaw) Date: Fri, 14 Dec 2001 15:19:56 -0500 Subject: [Python-Dev] RELEASED Python 2.2 release candidate 1 is out! References: <15386.23477.137871.205510@anthem.wooz.org> Message-ID: <15386.24300.351531.84724@anthem.wooz.org> Sigh. A cut and paste error omitted the download link from the announcement. As usual, it is http://www.python.org/2.2/ Apologies, and thanks MAL! -Barry From claird at starbase.neosoft.com Thu Dec 27 19:43:32 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 27 Dec 2001 18:43:32 -0600 Subject: tcl??? References: <%FOW7.8662$7p6.139123@rwcrnsc51.ops.asp.att.net> Message-ID: In article <%FOW7.8662$7p6.139123 at rwcrnsc51.ops.asp.att.net>, ~Jason~ wrote: >I am playing around with Python and it is telling me that to activate tcl >type tclch80. I do this and I get an error. I think may be it is because >either I am typing in the wrong version or I do not have it? Am I right and >if so how do I correct it? And if I am wrong, how do I fix it? What it >wants me to do is type [% put "Hello World"] and I do that and I get an >error, why? . . . I don't recognize this description--which likely reflects more on my ignorance than your own pre- cision. What operating system are you using? You're likely to get farther with tclsh rather than tclch80 and puts "Hello World" rather than put "Hello World" It's likely that those in a position to answer you will do so more swiftly and accurately when you supply an exact error message, as opposed to, "I get an error." Tell us which error. You might like to read . -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From sholden at holdenweb.com Thu Dec 20 15:18:04 2001 From: sholden at holdenweb.com (Steve Holden) Date: Thu, 20 Dec 2001 15:18:04 -0500 Subject: Huge Dicts and perfomance References: <1008874192.15275.0.nnrp-02.d4e54907@news.demon.co.uk> Message-ID: "Lucio Torre" wrote ... [ ... ] > > I really dont know :) i have 1.5.2, and 2.0, and 2.1 installed in my > linux box, and cant remember now which one is the default (and i dont > have the machine with me, now). But i can pick anyone i like. I think i > prefer 1.5.2 because ZODB is available as a separate package. Is there a > zodb for 2.x? Any idea of the overhead of adding zodb? Or should i just > use the dbsomehting module? > To answer one specific question I have successfully loaded and run standalone zodb under 2.0, and I don't see why it shouldn't run under 2.1 as well. regards Steve -- http://www.holdenweb.com/ From sag at hydrosphere.com Thu Dec 13 11:50:17 2001 From: sag at hydrosphere.com (Sue Giller) Date: Thu, 13 Dec 2001 09:50:17 -0700 Subject: Sorting things into bins In-Reply-To: References: <20011213002503994.AAA248@mail.climatedata.com@SUEW2000> Message-ID: <20011213164823822.AAA294@mail.climatedata.com@SUEW2000> Jason, While I was hoping to not have to iterate thru the list, this recipe is fine for my needs. I also learned about the .setdefault method - thanks! On 12 Dec 01, at 19:00, Jason Orendorff wrote: > > Is there a quick and simple way to sort a set of values (strings in > > this case) into a set of bins, based on a subset of the characters > > in the string? > > mylist = ['0101', '0102', '0103', '0201', '0202', '0203'] > mybins = {} > for s in mylist: > bin = s[-2:] > mybins.setdefault(bin, []).append(s) > print mybins From daves_spam_dodging_account at yahoo.com Fri Dec 7 16:50:34 2001 From: daves_spam_dodging_account at yahoo.com (David Brady) Date: Fri, 7 Dec 2001 13:50:34 -0800 (PST) Subject: Hiding stuff like passwords in source? Message-ID: <20011207215034.26643.qmail@web21110.mail.yahoo.com> Hello, I have written a bunch of utilities for Python that handle niggly things for me like synching ftp directories and such. Because I'm too lazy to type in my password every time, I've just jammed in the password into the Python source. It's nice being able to just double-click and have a thing run. The problem is, of course, security. If someone else uses my machine, they could easily find my username/passwords from my Python source. Furthermore, I'm absent-minded and will occasionally mail scripts to people, and though I have so far managed to not accidentally send one with my password in it, I'm sure it's only a matter of time. What I'm wondering is if there's a way to encrypt, hide or otherwise modify the way I'm using my user info so that unless I am logged in at my machine, the user info is unusable and unreadable. I got real "clever" a week ago and wrote a module called ftpid and put the variables in there. Then I compiled it and deleted the .py file, leaving only the .pyc. Ah, so clever was I, until I noticed that hiding the source did not prevent me from saying "print ftpid.username, ftpid.password". *SIGH*. I'd really like to preserve the ability to just click a script and have it run as "me", with my info and password. I just don't want to let anyone else get at that information or be able to use it... but I *do* want to be able to easily give them the script so they can type in their own information and have it work for them on their server, etc. Any ideas? Thanks, -dB ===== David Brady daves_spam_dodging_account at yahoo.com I'm feeling very surreal today... or *AM* I? __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com From pzw1 at cornell.edu Fri Dec 7 01:21:57 2001 From: pzw1 at cornell.edu (pwang99c) Date: Fri, 07 Dec 2001 06:21:57 -0000 Subject: cmd module documentation lying? Message-ID: <9upn65+mast@eGroups.com> i'm using the cmd.Cmd interactive interpreter loop for the first time, using documentation out of the latest _Python Essential Reference_. (i looked on the web page http://www.python.org/doc/current/lib/Cmd-objects.html but there wasn't as much detail.) there seems to be a disparity between documentation and actual code behavior with regard to the return values of command functions (do_*). according to the book, only negative return values are construed as errors and cause the cmdloop() function to return; however, in practice, any non-zero value seems to do this. -------------------------------------------- import cmd, string class myInterpreter(cmd.Cmd): def do_blah0(self, argline): return 0 def do_blah1(self, argline): return 1 def do_blahNeg(self, argline): return -1 def do_blahArb(self, argline): return string.atoi(argline) x = myInterpreter() x.cmdloop() -------------------------------------------- when the above code is run, one can type "blah0" all day long and the interpreter continues running; if one tries running any of the other functions (or blahArg with a non-zero value), the interpreter loop exits. so... is this a known problem, or am i misunderstanding something? should i be emailing David Beazley about his book? or is there some place for more up-to-date documentation on the cmd module? (besides the source itself. :-) TIA, peter From d_krause at pixelpark.com Thu Dec 27 16:36:12 2001 From: d_krause at pixelpark.com (Dirk Krause) Date: 27 Dec 2001 13:36:12 -0800 Subject: Poor man's Winzip Message-ID: Hi, I put up some code on http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/104733 This program does the three essential tasks that (at least) I need: 1. Unzip an archive to a folder 2. Zip a folder to an archive 3. Zip a (big) file to an archive For convenient usage, get Gordon McMillan's Installer Package, and freeze this application with > python freeze.py zip2folder.py After that, you will have a self containing EXE that will work even without having python installed. Drop this thing into the 'sendto' folder, and you have a very convenient way to use this program via right mouseclick/sendto zip2folder. (I fiddled with the registry until I found a link giving the extraordinairy simple an undangerous 'sendto' solution). Regards, Dirk From falted at revolta.openlc.org Thu Dec 20 14:59:48 2001 From: falted at revolta.openlc.org (Francesc Alted) Date: 20 Dec 2001 19:59:48 GMT Subject: OpenLC 0.5 released! Message-ID: OpenLC 0.5 is out. Version 0.4 was internal and will never be released. What is? OpenLC is a client/server software designed to facilitate benchmarking and stress testing of a wide variety of information servers (such as web, email, FTP, LDAP, databases, and so on). The package is built around a microkernel that contains basic routines for benchmarking tasks, such as accessing intermediate results in real-time ("spying" on run data), setting up simulated clients, defining scenarios, handling database calls, comparing results of different runs, summarizing data, etc. What's new: - Refactored a lot of code. Now, almost all the code (even the client) should have an Object Oriented shape. - Introduced an internal state machine for OpenLC server. That way your opportunities to mess it sending methods in incorrect order are reduced by orders of magnitude. - New filedata format for raw data: changed from a ZODB database to a BerkeleyDB RECNO fomat. This is because I detected a memory leak in the ZODB database when using the IOBTree format and save into it lots of data. Now, the memory consumption has been reduced a lot!. Also, the speed of data store and retrieve has incremented in a factor of 2. - The statistical module (ReduceData.py) has improved a lot, and it calculates intermediate means, standard deviations, minimum, maximum, skewness, as well as grand totals for the run. Now, Numerical Python and Scientific Python packages are used to speed-up the calculations. - The summary for each run is stored in a NetCDF file, so you can visualize it very easily with any graphical plotter which reads this format, as Grace, ncBrowse or VisAD. - The Internal Servers have been splited out, so each one (normally a descendent class of GenericLoader) is in its own source file. - A new IMAP4 Internal Server has been introduced. It doesn't support all the IMAP4rev1, but it's enough to do some interesting benchmarking. Enjoy! -- Francesc Alted PGP KeyID: 0x61C8C11F OpenLC microkernel benchmarking project: http://www.openlc.org Public PGP key available: http://www.openlc.org/falted_at_openlc.asc Key fingerprint = 1518 38FE 3A3D 8BE8 24A0 3E5B 1328 32CC 61C8 C11F From cliechti at gmx.net Sun Dec 30 07:40:23 2001 From: cliechti at gmx.net (Chris Liechti) Date: 30 Dec 2001 13:40:23 +0100 Subject: values of sys.platform? for a serial port lib References: <7876a8ea.0112292200.593d01e8@posting.google.com> Message-ID: woodsplitter at rocketmail.com (stalin) wrote in news:7876a8ea.0112292200.593d01e8 at posting.google.com: > Chris Liechti wrote in message > news:... >> i've written a portable serial port library. it runs now on linux and >> win32 > > Are you aware of Isaac Barona's Universal Serial Port Python Library? > http://balder.prohosting.com/ibarona/en/python/uspp/uspp_en.html > > How do the design goals of your library differ from USPP? How do you > intend to license it? USPP uses the IMHO restrictive GPL. > > Disclaimer: I've never used USPP. im'aware of that library but it has some drawbacks for me: 1. initialization of binary mode is not correct on posix 2. i must be able to select parity e.g. 9600,8,E,1 3. i need the control lines RTS/DTR, which are not yet implemented 4. licence. it may be used in a proprietary product so i can't use GPL mine is under the python licence. chris -- Chris From gh_pythonlist at gmx.de Tue Dec 11 09:56:33 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Tue, 11 Dec 2001 15:56:33 +0100 Subject: Finding out if a python binary has been compiled with or without pymalloc In-Reply-To: References: Message-ID: <20011211145632.GB1759@lilith.hqd-internal> Le 11/12/01 ? 03:16, R?mi Delon ?crivit: > Hi, > > I'd like to know if there is a way to find out if a python binary > distribution has been compiled with or without pymalloc. > My website hosting machine has python2.1 installed on it, but I > don't know where this distribution comes from. I only have access to > the python2.1 binary, and I'd like to check if it uses pymalloc > or not. My try would be: from distutils import sysconfig def has_pymalloc(): return sysconfig.get_config_var("CONFIG_ARGS").find("pymalloc") >= 0 As you might have guessed, you can find out lots of other useful info with the get_config_vars() and get_config_var() functions. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From loewis at informatik.hu-berlin.de Sat Dec 15 09:44:34 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 15 Dec 2001 15:44:34 +0100 Subject: i18n and german umlauts References: <9vf6fu$82e$05$1@news.t-online.com> Message-ID: "Eike Kock" writes: > I just got started with Python and internationalization using the > gettext module, pygettext.py and msgfmt.py. Everything works fine > except when it comes to special characters like german umlauts. Has > anyone mastered this in a plattform independent way? What problem are you facing? In the original source code, you should only put English messages - that will ease translation, since it will be easier to find a translator speaking English than finding, say, someone who speaks German as a foreign language. In the message catalogs, use whatever encoding you like. Make sure you put a GNU style PO header into each translation, like msgid "" msgstr "" "Project-Id-Version: GNU grep 2.5e\n" "POT-Creation-Date: 2001-03-07 00:02-0500\n" "PO-Revision-Date: 2001-06-09 11:14+02:00\n" "Last-Translator: Martin von L?wis \n" "Language-Team: German \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO-8859-1\n" "Content-Transfer-Encoding: 8-bit\n" That allows to keep track of the catalog's charset, so different catalogs can use different charsets. At run-time, you have two options: - get the translation from the catalog as a byte string, in the encoding of the catalog. This is what gettext.gettext will do. It is the best approach if you print messages to the user's terminal, since that likely uses the same encoding that the translator was using. - get the translation from the catalog as a Unicode string, by means of translation.ugettext (where the translation object is obtained through gettext.translation(domain)). This only works if the encoding of the catalog was declared in the catalog. This approach is best in the following cases: - you output the messages to a GUI toolkit that supports Unicode (like Tkinter). - you output the messages to a file with a well-known encoding (like HTML). In this case, you will need to convert the Unicode string to the encoding of the output file. - you output the messages to a terminal, and you can find out what the encoding of the terminal is (eg. through locale.nl_langinfo(locale.CODESET), of Py 2.2). HTH, Martin P.S. Thanks for confirming that you do use pygettext.py and msgfmt.py. Please notice that, as an option, you could also use GNU gettext for these tasks - they are likely faster than the pure-Python versions. From andrew-pythonlist at puzzling.org Tue Dec 4 22:21:27 2001 From: andrew-pythonlist at puzzling.org (Andrew Bennetts) Date: Wed, 5 Dec 2001 14:21:27 +1100 Subject: COM servers from within a Python service (on Win2k) Message-ID: <20011205142127.A619@frobozz.local> I've searched Google, and haven't found any answers to this... Is it possible for a Python service to also be a COM server? The obvious reason to do this would be to control the service via the COM interface. The only answers that I've found have been along the lines of "Get the service to create seperate COM server when it starts, and use a named pipe to have the COM server communicate with the service", which is rather hacky. I don't see why it shouldn't be possible to just have the COM server in the pythonservice.exe process. Can anyone show me how to make this work? Regards, -Andrew. From tim.one at home.com Thu Dec 6 23:23:42 2001 From: tim.one at home.com (Tim Peters) Date: Thu, 6 Dec 2001 23:23:42 -0500 Subject: Why doesn't this work? In-Reply-To: Message-ID: [Courageous] > Python 2.2b2 (#26, Nov 16 2001, 11:44:11) [MSC 32 bit (Intel)] on > win32 > Type "copyright", "credits" or "license" for more information. > IDLE 0.8 -- press F1 for help > >>> def f(): return [1,2,3] > > >>> f() > [1, 2, 3] > >>> f().append(4) > >>> l=f().append(4) > >>> l > >>> > > Obviously I can fix this, but I'm wondering why it doesn't work > the way I expected it to? You didn't say what you expected, so how should we know ? list.append returns None. In general, most mutate-in-place methods of mutable objects return None (list.append, list.remove, list.sort, list.reverse, dict.update, ...). If they didn't, people would gripe about x = [1, 2, 3] y = x.append(4) instead. "How come got 4 stuffed at the end of x too?" From rumjuggler at cryptarchy.org Mon Dec 17 14:12:46 2001 From: rumjuggler at cryptarchy.org (Ben Wolfson) Date: Mon, 17 Dec 2001 19:12:46 GMT Subject: Looping in Python References: <9vl8os$gcs$1@bob.news.rcn.net> <3C1E36E8.3070707@home.com> Message-ID: On Mon, 17 Dec 2001 12:18:16 -0600, Luke wrote: >If loop were a function, how would you get the code to be executed into >the function? def loop(condition, code): def _loop(state): if not condition(state): _loop(code(state)) else: return state return _loop Or something like that. -- Barnabas T. Rumjuggler You're going to set me up as a kind of slovenly attached pig that Jack Kornfeld can slice down in his violent zen compassion? -- Larry Block From rxg218 at psu.edu Sun Dec 30 18:23:41 2001 From: rxg218 at psu.edu (Rajarshi Guha) Date: Sun, 30 Dec 2001 18:23:41 -0500 Subject: REPOST: introduction to xml in python Message-ID: <3$--$$_----___%_$$@news.noc.cabal.int> Hi, could somebody point me to some code/tutorial describing how to use Python to parse XML - I tried delving into the Python docs, but it seems confusing. Whats the difference between expat and sax? How can I generate a parsers etc. any suggestions appreciated. TIA, -- ------------------------------------------------------------------- Rajarshi Guha | email: rajarshi at presidency.com 417 Davey Laboratory | web : www.rajarshi.outputto.com Department of Chemistry | ICQ : 123242928 Pennsylvania State University | AIM : LoverOfPanda ------------------------------------------------------------------- GPG Fingerprint: DCCB 4D1A 5A8B 2F5A B5F6 1F9E CDC4 5574 9017 AF2A Public Key : http://pgp.mit.edu/ ------------------------------------------------------------------- A meeting is an event at which the minutes are kept and the hours are lost. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Rajarshi Guha Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:13:53 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774019 27193 211.57.49.2 (31 Dec 2001 04:46:59 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:46:59 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From bckfnn at worldonline.dk Mon Dec 3 16:46:20 2001 From: bckfnn at worldonline.dk (Finn Bock) Date: Mon, 03 Dec 2001 21:46:20 GMT Subject: ANN: First beta release of Jython-2.1 Message-ID: <3c0be8cd.37456669@mail.wanadoo.dk> I am happy to announce the first beta release of Jython 2.1. Jython is a Java implementation of the Python programming language. It allows users to compile Python source code to Java byte codes, and run the resulting bytecodes on any Java Virtual Machine. It is a very seamless and smooth integration with Java: from Python you have complete access to all Java libraries, can build applets, can integrate with Java beans, and can subclass Java classes in Python and vice versa. Like Python, and unlike Java, Jython can also be used interactively: just type some Jython code at the prompt and see the results immediately. A java installer is available for download at the Jython website: http://www.jython.org/ Installation of version 2.1b1 is similar to version 2.0. Further information and tips on installation is available at: http://www.jython.org/install.html Jython 2.1 aims to be feature compatible with Python 2.1.1 and among the new feature are: - The weakref module is now available. - The sys.exitfunc hook is called on exit and the sys.excepthook is called when an exception occur. - A CPython compatible xreadlines module. - Support for os.environ and os.system() on common platforms. - Includes zxJDBC for Python DB API 2.0 compatibility. The list of bugs fixed since the previous release includes: - [ #438297 ] SimpleHTTPServer does not work - [ #440660 ] using nested java cls @ level >2 fails - [ #448485 ] Tuple unpacking raises KeyError - [ #448523 ] Support "ASCII" as builtin codec. - [ #449316 ] ArrayList()[0] should raise IndexError - [ #449956 ] jythonc 2.1a3 --package problem - [ #450938 ] time module requires JDK 1.4 - [ #451746 ] jythonc --deep pjy$packages problem - [ #452526 ] traceback lineno is the except line - [ #452947 ] Class of innerclass inst <> innerclas - [ #453301 ] jythonc --compileropts on Windows - [ #457614 ] pls change ©right; to (c) in sources - [ #458945 ] Missing 'lastindex' on match objects - [ #462280 ] builtin method as a class variable - [ #467826 ] SHA digest() method doesn't work - [ #473676 ] cStringIO bug - [ #475445 ] incompatibility with python - [ #475666 ] __nonzero__ exceptions must be ignored - [ #476580 ] 'del obj.non_member' : wrong exception - [ #476772 ] shutdowns in jython / atexit - [ #477608 ] os.path.getmtime() missing - [ #477768 ] ord([123]) 21a3 - [ #477793 ] os.utime() is missing. - [ #480373 ] Can't find _PyInner with classloader. - [ #480390 ] main() does not throw exceptions - [ #484181 ] command line args in dos - [ #485558 ] Synchronization bug in sys.initialize. - [ #485968 ] cStringIO.softspace is not assignable. A complete list of changes and differences are available here: http://www.jython.org/NEWS.html Bugs can be reported to the bug manager on SourceForge: http://sourceforge.net/bugs/?group_id=12867 Cheers, the jython-developers From loewis at informatik.hu-berlin.de Sun Dec 23 18:28:26 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 24 Dec 2001 00:28:26 +0100 Subject: How to generate XML References: <3c21e330@news.opennet.it> Message-ID: "Irmen de Jong" writes: > 3. inconsistencies (one ducument had US-ASCII encoding, > I believe that all five problems above are solved by doing it this way. I don't think you can solve problem 3 with that strategy, at least not in the way you use the DOM. > What would be wrong with (hypothetical code):- > doc=Doc("UTF-8") > root=Element("root",{"type","sometype"}) The element name must be a Unicode string, likewise the attribute name and the attribute value. The DOM is defined in terms of Unicode. It is only that Python does not have strict static typing that you get away with this kind of error. To properly use the DOM, use Unicode strings throughout. Regards, Martin From loredo at astro.cornell.edu Tue Dec 11 18:34:22 2001 From: loredo at astro.cornell.edu (Tom Loredo) Date: Tue, 11 Dec 2001 18:34:22 -0500 Subject: wxPython 2.3.2 References: Message-ID: <3C1697FE.1A0A9888@astro.cornell.edu> Robin- I notice there have been significant developments re: wxWindows for the Mac. Do you know if there is a Mac build of wxPython that uses the wxWindows binaries available for the Mac? Thanks, Tom From fdrake at acm.org Thu Dec 13 23:25:14 2001 From: fdrake at acm.org (Fred L. Drake) Date: Thu, 13 Dec 2001 23:25:14 -0500 (EST) Subject: [development doc updates] Message-ID: <20011214042514.2204B286BC@beowolf.digicool.com> The development version of the documentation has been updated: http://python.sourceforge.net/devel-docs/ Final 2.2c1 documentation. From Eugene.Leitl at lrz.uni-muenchen.de Mon Dec 3 08:38:28 2001 From: Eugene.Leitl at lrz.uni-muenchen.de (Eugene Leitl) Date: Mon, 3 Dec 2001 14:38:28 +0100 (MET) Subject: python-friendly ISPs Message-ID: I've just reread http://www.corrt.com/info/pyisp-list.html Any interesting newcomers/other recommendations for Python-friendly web hosts? I'm looking for something cheap, 100-500 MBytes space. >3 GBytes/month traffic. TIA, -- Eugene From lynn at garlic.com Fri Dec 28 20:28:38 2001 From: lynn at garlic.com (Anne & Lynn Wheeler) Date: Sat, 29 Dec 2001 01:28:38 GMT Subject: REPOST: Re: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> Message-ID: <2$--$$_-----$%_%_$@news.noc.cabal.int> ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) writes: > Actually I believe rfc765 and rfc959 (FTP protocol) is superceded by > rfc1123 which outlines and corrects the specifications for the ftp, telnet, > smtp, and dns protocols. In particular interest to me, rfc1123 indicates that > pasv responses in the ftp protocol don't have to have the format of > 227 (h1,h2,h3,h4,p1,p2). This was something that the python ftplib assumed until > the 2.2 release and which caused problems with anonftpd. reference: http://www.garlic.com/~lynn/rfcietff.htm & click on RFCs that are also "Standards (STD)" and scroll down to STD-9 Note that most fields are "clickable" for instance FTP brings up: FTP - (Stan) - File Transfer Protocol [port:21] 959 (STD-9) - File Transfer Protocol 1415 - FTP-FTAM Gateway Specification clicking on the ".txt" field will retrieve the actual RFC. Clicking on various RFC nos &/or STD references will bring up the appropriate information. Various processes also do cross-checking of released rfc status as well as information released in new STD1s for consistency. The "Obsoleted" section use to appear as "Section 6.10" in earlier STD1s. ============================= STD-9 959 (Stan) - File Transfer Protocol (FTP) 959 is the "standard" 959 S File Transfer Protocol, Postel J., Reynolds J., 1985/10/01 (69pp) (.txt=147316) (STD-9) (Updated by 2228, 2640, 2773) (Obsoletes 765) (Ref'ed By 2389) (FTP) 959 has current updates 2228, 2640, & 2773 ... and is also ref'ed by 2389 2259 PS File Transfer Protocol, Postel J., Reynolds J., 1985/10/01 (69pp) (.txt=147316) (STD-9) (Updated by 2228, 2640, 2773) (Obsoletes 765) (Ref'ed By 2389) (FTP) 2259 is currently in proposed standard state 2640 PS Internationalization of the File Transfer Protocol, Curtin B., 1999/07/28 (27pp) (.txt=57204) (Updates 959) 2640 is currently in proposed standard state 2773 E Encryption using KEA and SKIPJACK, Housley R., Nace W., Yee P., 2000/02/14 (9pp) (.txt=20008) (Updates 959) 2773 is experimental 2389 PS Feature negotiation mechanism for the File Transfer Protocol, Elz R., Hethmon P., 1998/08/21 (9pp) (.txt=18536) (See Also 959) and 2389 is proposed standard state ... but doesn't update 959 but refers to it. ========================= ... also STD-3 STD-3 1122 (Stan) - Requirements for Internet hosts - communication layers 1123 (Stan) - Requirements for Internet hosts - application and support 1123 S Requirements for Internet hosts - application and support, Braden R., 1989/10/01 (98pp) (.txt=239721) (STD-3) (Updated by 2181, 2821) ... 1123 is standard but doesn't directly update FTP or 959 ... but does list requirements for Internet hosts - application and support, which is also updated by 2181 PS Clarifications to the DNS Specification, Bush R., Elz R., 1997/07/31 (15pp) (.txt=36989) (Updated by 2535) (Updates 1034, 1035, 1123) (DNS-CLAR) 2181 is proposed standard status 2821 PS Simple Mail Transfer Protocol, Klensin J., 2001/04/24 (79pp) (.txt=192504) (Obsoletes 821, 974, 1869) (Updates 1123) (SMTP) ==================== from 1123: 4. FILE TRANSFER 4.1 FILE TRANSFER PROTOCOL -- FTP 4.1.1 INTRODUCTION The File Transfer Protocol FTP is the primary Internet standard for file transfer. The current specification is contained in RFC-959 [FTP:1]. FTP uses separate simultaneous TCP connections for control and for data transfer. The FTP protocol includes many features, some of which are not commonly implemented. However, for every feature in FTP, there exists at least one implementation. The minimum implementation defined in RFC-959 was too small, so a somewhat larger minimum implementation is defined here. Internet users have been unnecessarily burdened for years by deficient FTP implementations. Protocol implementors have suffered from the erroneous opinion that implementing FTP ought to be a small and trivial task. This is wrong, because FTP has a user interface, because it has to deal (correctly) with the whole variety of communication and operating system errors that may occur, and because it has to handle the great diversity of real file systems in the world. -- Anne & Lynn Wheeler | lynn at garlic.com - http://www.garlic.com/~lynn/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Anne & Lynn Wheeler Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:29:30 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774921 27193 211.57.49.2 (31 Dec 2001 05:02:01 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:02:01 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From nas at python.ca Mon Dec 10 14:26:04 2001 From: nas at python.ca (Neil Schemenauer) Date: Mon, 10 Dec 2001 11:26:04 -0800 Subject: reference counting for garbage collection In-Reply-To: <1008011593.29363.0.nnrp-10.c1c3e1d9@news.demon.co.uk>; from paul1brian@yahoo.com on Mon, Dec 10, 2001 at 07:13:06PM -0000 References: <1008011593.29363.0.nnrp-10.c1c3e1d9@news.demon.co.uk> Message-ID: <20011210112604.A4442@glacier.arctrix.com> If you want to close to the connection you should call x.close(). Hoping that the GC will close the connection for you in a timely manner is bad style. Neil From mjais at web.de Thu Dec 20 09:16:13 2001 From: mjais at web.de (Markus Jais) Date: Thu, 20 Dec 2001 15:16:13 +0100 Subject: How to generate XML References: <3c21e330@news.opennet.it> Message-ID: On Thu, 20 Dec 2001 14:10:40 +0100, Fabrizio wrote: > Does anybody know if there are modules to generate XML? I know there is > SAX, but it is only for parsing, isn't it? Thank. Fab you can use DOM for generating XML. check out the xml-sig at: http://www.python.org/sigs/xml-sig/ also have a look at 4Suite, an opensource library for xml processing in python. many useful features. http://www.4suite.org/ markus From fredegar at haftmann-online.de Fri Dec 14 11:01:20 2001 From: fredegar at haftmann-online.de (Fredegar) Date: Fri, 14 Dec 2001 16:01:20 +0000 Subject: PyGTK on Windoze Message-ID: <3C1A2250.6060108@haftmann-online.de> Hi! I have found a PyGTK port for Windoze at http://hans.breuer.org/ports/ After installation, the following error occured: >>> import gtk Traceback (most recent call last): File "", line 1, in ? import gtk File "c:\programme\python21\lib\gtk.py", line 21, in ? import _gtk ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden. I have already copied the whole GTK stuff (by Tor Lillquist) to the python dll directory. Has anyone experiences with this situation or can give me a hint? Thanks Fredegar From chrishbarker at attbi.com Thu Dec 27 14:40:58 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Thu, 27 Dec 2001 11:40:58 -0800 Subject: set decimal place References: <3c291037.4684696@news.tm.net.my> <3C292938.ED322C60@bellatlantic.net> <184fbd02.0112260109.4392423@posting.google.com> <3C2A29A5.8E9FB5BE@engcorp.com> Message-ID: <3C2B794A.800A94E5@attbi.com> Peter Hansen wrote: > >>> 10.0/3 > 3.3333333333333335 > >>> round(10.0/3, 4) > 3.3332999999999999 > ^^^^^^^ > This doesn't really solve the OP's problem. > The concept of "having 4 decimal places" is meaningless with > floating point representations until you actually display the > value as a formatted string. not completely. you might want to check if two values are the same to 4 decimal places, in which case round should work just fine: >>> 10.0/3 == 10.00001/3 0 >>> round(10.0/3,4) == round(10.00001/3,4) 1 of course, you would more often want to compare given n significatn figures instaead, in whioch case you can write a function with log, etc that will do it for you. See the archives for a discussion of this, and some posted code. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From maxm at normik.dk Wed Dec 5 07:01:02 2001 From: maxm at normik.dk (Max M) Date: Wed, 5 Dec 2001 13:01:02 +0100 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BD39F.D43D4FF7@mega-nerd.com> <23891c90.0112040239.72e92f5@posting.google.com> Message-ID: <3c0e0c7d$0$89810$edfadb0f@dspool01.news.tele.dk> Personally I find the tab/spaces discussion mindnumbingly boring, but that has never stopped me from speaking out before ... I find that the only thing that really annoys me whit tabs instead of spaces, is the mess I get when I email somebody a piece of code, and the mail software automatically wraps it at 76 characters. Then tabs both makes it harder to correct the code again, and it also makes the linewrapping more "random". regards Max M From junkster at rochester.rr.com Tue Dec 18 06:27:32 2001 From: junkster at rochester.rr.com (Benjamin Schollnick) Date: Tue, 18 Dec 2001 11:27:32 GMT Subject: webmin modules in python? References: Message-ID: In article , Bruce Edge wrote: > I webmin docs really lean towards perl, hs anyone written one in python? > > -bruce. Bruce.... Sorry, but this doesn't seem to make too much sense... Probably because I've never heard of Webmin, nor do I program in perl. Could you elaborate a little bit more, and then maybe we can help... - Benjamin From dalke at dalkescientific.com Mon Dec 3 12:14:07 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Mon, 3 Dec 2001 10:14:07 -0700 Subject: Linux Kernel Design and Why Python is Rad References: Message-ID: <9ugc0h$n9t$1@slb1.atl.mindspring.net> Jonathan Gardner: > Linus Torvalds on design: "Nothing successful has every been > designed. It has evolved." > > Everyone else: "No wait a minute, that's not what this book > says! And that's not what my teacher said!" Now, which books say that? "Rapid Development" is very explicit that all the design models, even the classic waterfall design, have a way to back up from mistakes. It might be slower than other development models, but it's even useful in some cases, like writing the Nth iteration of a salary accounting package where all the requirements and dependencies are well known. Coming from the other side, all designs have been built from knowledge gained in previous work. "Evolved" in its most precise sense means "changed over time." (NOT "improved over time".) So by definition I agree that everything successful has been evolved. Then again, so has everything unsuccessful. Conclusion: this argument is based on a false dichotomy. Design helps minimize the chance of being unsuccessful, and goes hand-in-hand with the evolution of software. Andrew dalke at dalkescientific.com From greg at cosc.canterbury.ac.nz Thu Dec 6 19:36:15 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Fri, 07 Dec 2001 13:36:15 +1300 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C0FBAA8.F1A44304@attbi.com> Message-ID: <3C100EFF.6EEA6C7A@cosc.canterbury.ac.nz> Chris Barker wrote: > > I would > argue that applications that deal with nanoseconds are of a different > breed than those that deal with day, month, year type calculations. I'm not sure that's true. Consider something like generating timestamps for transactions. They need to be unique over a long time, and need quite fine-grained accuracy as well, certainly much less than a second. Even microseconds might be too coarse -- today's processors can do a LOT of computation in a microsecond! I suggest femtoseconds. It's the smallest time unit I've heard anyone talk about. If you need something smaller you're probably a bleeding-edge particle physicist with more things to worry about than finding a time module... -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From zhangsc at neusoft.com Tue Dec 18 20:51:28 2001 From: zhangsc at neusoft.com (=?gb2312?B?1cXJ2bPb?=) Date: Wed, 19 Dec 2001 09:51:28 +0800 Subject: I used os.waitpid,but I still can't Zombie process? Message-ID: <00db01c1882f$adb8e2a0$4301010a@sky> I still want to kill Zombie process which cause by child process,so I use os.waitpid,But I found Zombie is still exist,why? my program is follows: ... while 1: ... ret=os.fork() if ret==0: HOST=udpaddr PORT=21567 ADDR=(HOST,PORT) udpSerSock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) udpSerSock.sendto(data,ADDR) udpSerSock.close() break os.waitpid(ret,os.WNOHANG); Where is my program's error? How to correct my program? Any idea will be appreciated. Edward -------------- next part -------------- An HTML attachment was scrubbed... URL: From webbmaster2001 at directvinternet.com Tue Dec 25 01:20:14 2001 From: webbmaster2001 at directvinternet.com (John Yeager) Date: Tue, 25 Dec 2001 00:20:14 -0600 Subject: Access Problem Message-ID: <3c289e2f$1_2@nopics.sjc> Useing the following code to access a Access Database, I run into a problem getting the Database to Autonumber the primary key Here is my code what am I missing import time import odbc Time = time.ctime(time.time()) connection = odbc.odbc('Everquest') cur = connection.cursor() sql = "Insert into Member VALUES( '(Autonumber goes here )','test', 'test','NULL','p','R300478','Testuser','Test','%s')" % ( Time ) cur.execute( sql ) connection.commit() cur.close() connection.close() So what am I doing wrrong here? From importbinascii Mon Dec 3 23:57:58 2001 From: importbinascii (Eugene) Date: Mon, 3 Dec 2001 20:57:58 -0800 Subject: Newbie: searching an English dictionary for a reg exp References: <3c09f02f.97177874@news.akl.ihug.co.nz> <3c0b1bbe.173865154@news.akl.ihug.co.nz> Message-ID: Oh, sorry about that. "re.search" only requires that the pattern match at the start of the target string; it does not also require that the pattern match all the way to the end. Put "$" at the end of your pattern and that will fix it. (The regular expression "$" means end-of-string.*) And if you just want to print the word that matched, just put "outfile.write( word + ' ' )" in place of what you have in your "if" block. Once you know the word matches, that's good enough for you, right? :) -Eugene * in Python's regular expression and in PERL's. I have no idea what "$" means in other languages' regular expression engines. "^^@++" wrote in message news:3c0b1bbe.173865154 at news.akl.ihug.co.nz... > On Sun, 2 Dec 2001 13:54:24 -0800, "Eugene" binascii.a2b_base64('ZXVnZW5lQGlzb21lZGlhLmNvbQ==')> wrote: > > Oops, looks like I spoke too soon with my last post. > The matches aren't working properly, in that it seems to be finding > too many incorrect matches: > > def searchfor(regpattern): > print "Searching for",regpattern, > matchcount = 0 > reg = re.compile(regpattern, re.I) > m = "" > for word in dictionary: > m = reg.match(word) > if m: > outfile.write(m.group()+' ') > matchcount += 1 > > print "Found",matchcount > return matchcount > > Produces: > Read 1187 words from the dictionary > Read 1 clues from clues.txt > Searching for abac. Found 14 > > Now, in my dictionary there are only 2 words that would match that > criteria - abaca and aback, right? It seems to be returning what is I > guess (abac)*: > dictionary = > ... > Ababua > abac > abaca > abacate > abacay > abacinate > abacination > abaciscus > abacist > aback > abactinal > abactinally > abaction > abactor > abaculus > abacus > Abadite > ... > > I get the feeling I'm barking up the wrong tree by using m.group(). > All I want is the word that matches! IMO the doco for MatchObject > (match-objects.html) is useless (or maybe I am). > > Thanks for any help > > -Matt From tatebll at aol.com Sat Dec 8 13:35:15 2001 From: tatebll at aol.com (Bill Tate) Date: 8 Dec 2001 10:35:15 -0800 Subject: Is Python suitable for some binary file editing? References: <1FD639F0.1DA46084@cns.net.au> <3C114E77.14180DAE@cns.net.au> Message-ID: David Rollo wrote in message news:<3C114E77.14180DAE at cns.net.au>... > Thanks to all for these very helpful comments and advice. > > > David Rollo David, Here's one more you might find interesting and perhaps relevant. I was on a project where we were building a GIS package designed to feed a rather large environmental model. A critical feature of the GIS was the need to be able to import commonly used GIS file formats, in particular, ESRI shapefiles (*.shp). Shape files are in a binary format but, to make things interesting, the file structure intentionally mixes big endian and little endian encodings for certain types of geographic features. Moral of the story - use Python and save yourself a damn lot of headaches. Bill From fredrik at pythonware.com Mon Dec 17 18:55:38 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon, 17 Dec 2001 23:55:38 GMT Subject: CONVERTING TIFF FILES TO JPEG FILES References: Message-ID: <_BvT7.4301$l93.1066754@newsb.telia.net> David A McInnis wrote: > Do you want a module to do this through python? > If so, I don't know. http://www.pythonware.com/products/pil/index.htm From hawkestein at my-deja.com Wed Dec 19 17:12:14 2001 From: hawkestein at my-deja.com (Lorin Hochstein) Date: Wed, 19 Dec 2001 17:12:14 -0500 Subject: index()-like behavior that returns all occurences... Message-ID: <3C2110BE.8060300@my-deja.com> I've got a list of lists, something like this: x = [ [1], [1,2], [], [1,2,3], [], [2], [12] ] I want to find the index of all of the empty lists. In other words, I'd like a function foo that would behave like this: >> foo(x) [2 4] I know there's an index method of list, such that x.index([]) would return "2". But I want all of the indexes, not just the first one. Is there a simple way to do this (besides the obvious for-loop approach)? Lorin (new to Python but thoroughly enjoying it so far) From azz at gnu.org Sat Dec 29 13:52:00 2001 From: azz at gnu.org (Adam Sampson) Date: 29 Dec 2001 18:52:00 +0000 Subject: REPOST: Re: Can't exit python with ^D under certain circumstances References: <1c1X7.79465$7l5.52086@atlpnn01.usenetserver.com> Message-ID: <3$--$$_----__%$-_$@news.noc.cabal.int> "Steve Holden" writes: > The real question is why the end of file you send to your local ssh > client doesn't make it through to the Python interpreter as an EOF, > but instead (apparently) gets transmitted as a character. Perhaps Ctrl-D isn't the default EOF character on his system? "stty -a" should show what eof is set to; to change it to Ctrl-D, do "stty eof '^D'". I've run into this before with intr being set to ^? instead of ^C on an old HP machine... -- Adam Sampson ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Adam Sampson Newsgroups: comp.lang.python Subject: cmsg cancel <87itap271r.fsf at cartman.azz.us-lot.org> Control: cancel <87itap271r.fsf at cartman.azz.us-lot.org> Date: Mon, 31 Dec 2001 02:43:37 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774519 27193 211.57.49.2 (31 Dec 2001 04:55:19 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:55:19 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From fperez528 at yahoo.com Mon Dec 24 12:49:07 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Tue, 25 Dec 2001 17:17:07 +2328 Subject: Can't exit python with ^D under certain circumstances References: Message-ID: wealthychef wrote: > > I can't quite read it. > Can anyone help me? I'm no xmodmap dude, but i suspect > some sort of keyboard confusion. The two systems are different. > Machine A is running one flavor of Unix, and machine B is > running another, each with radically different hardware. > Is there another way to exit Python? Workaround? Fix? Thanks. quick and ugly: >>> import sys >>> def quit():sys.exit() ... >>> quit() As for the origin of the problem, dunno. cheers, f From mhammond at skippinet.com.au Wed Dec 19 07:56:06 2001 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 19 Dec 2001 12:56:06 GMT Subject: os.stat() crashes on Win32 References: Message-ID: <3C208E67.2080401@skippinet.com.au> Jason Orendorff wrote: > I just grabbed the latest out of CVS, built it using VC6, and tried > to run python_d.exe. It bails out (a memory-management assertion fails) > while running site.py. I can repro this :( It is even my bug :( :( I have submitted a bug, with fix at: http://sourceforge.net/tracker/index.php?func=detail&aid=495021&group_id=5470&atid=105470 [I wish source-forge used bugzilla - or at least had user-friendly URLs :-] Hopefully this will make 2.2!! > What's going on here? Why doesn't this cause crashes in the > binary distribution of Python 2.2c1? Am I building it wrong? Luck :) Mark. From mlh at idi.ntnu.no Sat Dec 15 15:06:40 2001 From: mlh at idi.ntnu.no (Magnus Lie Hetland) Date: Sat, 15 Dec 2001 21:06:40 +0100 Subject: New motto/slogan: "Batteries Included, Warts Removed!" References: Message-ID: <9vgagg$akb$1@tyfon.itea.ntnu.no> "Howard B. Golden" wrote in message news:zpAS7.4609$37.445582 at typhoon.socal.rr.com... > With the forthcoming release of 2.2, I'm proposing a new motto/slogan. > ;-) > > Actually, I just want to send my congratulations and thanks to everyone > involved! Perhaps that ought to be "Some Warts Removed"? There are still a few... > --Howard > -- Magnus Lie Hetland The Anygui Project http://hetland.org http://anygui.org From calves at coelce.com.br Fri Dec 21 09:17:47 2001 From: calves at coelce.com.br (Alves, Carlos Alberto - Coelce) Date: Fri, 21 Dec 2001 11:17:47 -0300 Subject: FW: Comunicating through COM ports Message-ID: <29A97D00F387D411AC7900902770E148032DA1FA@LCOEEXC01> Thanks for the example. But, where can I find such module Serial?! -----Original Message----- From: David Mallwitz [mailto:dmallwitz at cox.rr.com] Sent: Thursday, December 20, 2001 10:26 PM To: python-list at python.org Subject: Re: Comunicating through COM ports Comunicating through COM portsChapter 19 of Mark Hammond and Andy Robinson's 'Python Programmingon on Win32' covers this quit well, and with the Activestate Python distro there is a multithreaded demo called 'win32comport_demo.py'. But here's what I do - example is from a console connection to an old Cisco router. >>> from Serial import Serial >>> ### open the COM1 port >>> serialconfig = Serial.PortDict() >>> serialconfig['port'] = Serial.COM1 >>> serialconfig['rxBufSize'] = 4096 >>> port = Serial.Port(serialconfig) >>> port.open() >>> port.write('show conf \r') >>> x = port.read() >>> x 'show conf \r\nUsing 768 out of 32762 bytes\r\n!\r\nversion 11.1\r\nno service u dp-small-servers\r\nno service tcp-small-servers\r\n!\r\nhostname Router\r\n!\r\ n!\r\nip subnet-zero\r\nno ip domain-lookup\r\n!\r\nhub ether 0 1\r\n link-test\ r\n auto-polarity\r\n!\r\nhub ether 0 2\r\n link-test\r\n auto-polarity\r\n!\r\n hub ether 0 3\r\n link-test\r\n auto-polarity\r\n --More-- ' Best, Dave "Alves, Carlos Alberto - Coelce" wrote in message news:mailman.1008852145.28654.python-list at python.org... Anybody could give me an example code of how connect/comunicate through COM ports (i.e. COM1, COM2). I'm under windows 98. Thanks!!! Carlos Alberto COELCE/DPRON-Departamento de Projetos e Obras Norte Fone: 677- 2228 e-mail: calves at coelce.com.br \|||/ (o o) --ooo0-(_)-0ooo-- -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- -- http://mail.python.org/mailman/listinfo/python-list -------------- next part -------------- An HTML attachment was scrubbed... URL: From cjensen at bioeng.ucsd.edu Mon Dec 17 10:37:35 2001 From: cjensen at bioeng.ucsd.edu (Curtis Jensen) Date: Mon, 17 Dec 2001 07:37:35 -0800 Subject: mySQL References: Message-ID: <3C1E113F.E7FA5D8A@bioeng.ucsd.edu> Preben wrote: > > Is there any built-in modules for connecting databases > such as mySQL? > > Or do I have to make them myself? I do not know of a buit-in module, but there is a third party module you can use. It's hard to find but It's at: http://sourceforge.net/projects/mysql-python -- Curtis Jensen cjensen at bioeng.ucsd.edu http://www-bioeng.ucsd.edu/~cjensen/ FAX (425) 740-1451 From ws at mystrobl.de Mon Dec 3 14:46:28 2001 From: ws at mystrobl.de (Wolfgang Strobl) Date: Mon, 03 Dec 2001 20:46:28 +0100 Subject: making a file hidden in win32? References: Message-ID: <0kln0u0k2ivc3ehegq5m9lern9e9uut78r@4ax.com> On Sun, 2 Dec 2001 14:13:46 -0800, "Peoter Veliki" wrote : >Is there anyway I can use python to make a file hidden in windows? import win32api import win32con win32api.SetFileAttributes( "c:/scratch/versteck", win32con.FILE_ATTRIBUTE_HIDDEN ) -- Thank you for observing all safety precautions From peter at engcorp.com Sat Dec 1 02:07:13 2001 From: peter at engcorp.com (Peter Hansen) Date: Sat, 01 Dec 2001 02:07:13 -0500 Subject: Just started, need help! References: Message-ID: <3C0881A1.C2824177@engcorp.com> Kyle Thompson wrote: > > When I do an input command, I hit enter so I may then do the if and else > command but when I hit enter it try's to run the input command. How do I > make it not run when its being made and just run when I'm done with a part > and want to run it? The question is a little unclear, but it sounds like you are expecting to be able to enter a series of commands *without* each one being executed, and then type 'run' or something to start the program. Python doesn't work that way. At the interactive prompt *each* statement you type is executed immediately so you can see the results. If you want to make a program for running later, you need to use a text editor (even Notepad in Windows might do okay for a start, but there are better options) to store the commands, then save the file with a name like coolprog.py, and then go to a command prompt (*not* the Python prompt, but the one your operating system gives you) and type a command like "python coolprog.py" which causes the Python interpreter to compile and run the program. (Use the interactive prompt for experimentation, but use an editor, or IDLE, or PythonWin or something like that for creating programs to save as files and run.) By the way, when you are new, it helps to tell us what operating system you are running and other such details so the advice you get is a little more specific... -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From robert.collins at itdomain.com.au Tue Dec 18 16:33:50 2001 From: robert.collins at itdomain.com.au (Robert Collins) Date: Wed, 19 Dec 2001 08:33:50 +1100 Subject: Cygwin fork() rebase solution (was Re: dll_list::load_after_fork() blues ...) References: <008101c1819b$021aa860$a300a8c0@nhv> <20011212085744.A2400@dothill.com> <20011218211235.GA2476@dothill.com> Message-ID: <018101c1880b$affd10a0$0200a8c0@lifelesswks> Your results are enough for me Jason - I'm happy to include this in setup in some form. Rob From wurmy at earthlink.net Fri Dec 28 15:42:22 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Fri, 28 Dec 2001 20:42:22 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <32c382ad.0112272324.4c78689b@posting.google.com> <3C2C88A6.9D13A3D6@earthlink.net> Message-ID: <5$--$$_----_-%$$%$@news.noc.cabal.int> Steve Lamb wrote: > > On Fri, 28 Dec 2001 15:04:12 GMT, Hans Nowak wrote: > > > > I'm pretty sure 1.5.2 had strip already... > > > > According to the Beazley book it did. Yes, I've been checking out some old binaries, and strip was available as early as 1.4. (Don't know about any older versions.) Ah, those were the days... The One True Python had everything you needed and no bloat. ;-) --Hans ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Hans Nowak Newsgroups: comp.lang.python Subject: cmsg cancel <3C2CD7EB.F90E6C9 at earthlink.net> Control: cancel <3C2CD7EB.F90E6C9 at earthlink.net> Date: Mon, 31 Dec 2001 01:46:47 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775072 27193 211.57.49.2 (31 Dec 2001 05:04:32 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:04:32 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From bokr at accessone.com Fri Dec 28 13:46:38 2001 From: bokr at accessone.com (Bengt Richter) Date: Fri, 28 Dec 2001 18:46:38 GMT Subject: [development doc updates] References: Message-ID: <3c2cbe75.81538125@wa.news.verio.net> On Fri, 28 Dec 2001 00:03:42 -0500 (EST), "Fred L. Drake" wrote: >The development version of the documentation has been updated: > > http://python.sourceforge.net/devel-docs/ > >A variety of updates made since Python 2.2 was released. > > Do these devel-docs exist as downloadable .zip or .tgz of HTML tree? From citykid at nospam.edu Mon Dec 10 02:33:47 2001 From: citykid at nospam.edu (Les Ander) Date: Sun, 9 Dec 2001 23:33:47 -0800 Subject: help with installing pymat on linux RH7.1 Message-ID: Hi, i am new to python and have a question regarding module installation. I downloaded the pymat.cpp (interface to MATLAB) which is to be compiled into pymatmodule.so on my machine (i386, RH7.1) matlab headers are in /usr/local/extern/include matlab libs are in /usr/local/extern/lib/glnx/ numpy is in /usr/lib/python1.5/site-packages/Numeric I did the following: step1: g++ -o pymat.o -c pymat.cpp -I/usr/include/python1.5 -I/usr/include/python1.5/Numeric -I/usr/local/extern/include step2: g++ -shared -o pymatmodule.so pymat.o -L/usr/local/extern/lib/glnx86 -leng -lmx -lmat -lmi -lut (matlab libraries are: libeng.so, libmx.so, libmat.so, libmi.so, libut.so) step3: install -c pymatmodule.so /usr/lib/python1.5/site-packages But in the python interpreter when i try to import pymat i get : ImportError: libeng.so: cannot load shared object file: No such file or directory this is refering to the matlabs libeng.so library I don't know how to fix this, can some one suggest someway to fix this? thanks les From Tom.Karas at htp-tel.de Mon Dec 17 18:23:07 2001 From: Tom.Karas at htp-tel.de (Tom Karas) Date: Tue, 18 Dec 2001 00:23:07 +0100 Subject: How 2 invoke python 2 read from text file under W2k References: <3C1BBECF.E460DBEC@htp-tel.de> <3C1BCA57.C5E59D9B@bellatlantic.net> <3C1CBFE3.B106A192@htp-tel.de> <20011216133108.098$Dn@news.newsreader.com> <3C1D2075.903F3A61@htp-tel.de> Message-ID: <3C1E7E5B.BC0644A@htp-tel.de> Problem is solved. Thanks for all your help. regards tom From jason at jorendorff.com Fri Dec 7 19:20:27 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Fri, 7 Dec 2001 18:20:27 -0600 Subject: Regex help In-Reply-To: Message-ID: > Is there a more efficient way to do this. It seams like this is executing > the search twice. > > patt = re.compile("fax
\s*([0-9]{3,3}-[0-9]{3,3}-[0-9]{4,4})", re.I) > if patt.search(tststring): > faxnum = patt.search(tststring).group(1) > print faxnum Here's what I always do: match = patt.search(tststring) if match: faxnum = match.group(1) print faxnum Also, it is wise to put an r on every regex string: patt = re.compile(r"fax......", re.I) ^ -- Jason Orendorff http://www.jorendorff.com/ From xx758 at cam.ac.uk Wed Dec 5 06:17:29 2001 From: xx758 at cam.ac.uk (Xiao-Qin Xia) Date: Wed, 5 Dec 2001 11:17:29 -0000 Subject: Tk callback at certain time point? Message-ID: <9ukvjn$kk2$1@pegasus.csx.cam.ac.uk> Hello, I am using Tkinter to make an interface. Is there any way to make Tk automatically call a function after some time or at a certain time point? Regards, Xiao-Qin Xia From jlh at home.com Sun Dec 2 21:13:37 2001 From: jlh at home.com (Jeff Hinrichs) Date: Sun, 2 Dec 2001 20:13:37 -0600 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: <100d01c17ba0$1e2f6190$6702a8c0@gato> my 0.02$US: Actually, spaces are the problems not tabs. A tab is a tab, where is indenting by spaces....hmm. let's see, I like 4 spaces, he like 8 and she likes 6 and so on. That causes more grief than tabs. Where as tabs, 1 tab = 1st level block, 2 tabs = 2nd level block and so on. Maybe if people didn't use such brain dead editors that actually replaced tabs with spaces this would be a complete non-issue. You should be able to configure your editor to display tabs in a width that is to your liking WITHOUT mucking with the data. As it is, we are doomed to listen to this argument go on ad nauseum. jeff "and that's all I have to say about that" - Forest Gump > > You'll not find tabs in any code that I touch. Literally. I've got my > > editor configured to save spaces, not tabs. > > Same here. > > I am just wondering that if letting people actually use tabs > is causing trouble, why not get rid of that "feature". From skip at pobox.com Fri Dec 28 09:35:15 2001 From: skip at pobox.com (Skip Montanaro) Date: Fri, 28 Dec 2001 08:35:15 -0600 Subject: pth files - can they prepend to sys.path? Message-ID: <15404.33571.296230.63401@12-248-41-177.client.attbi.com> Is it possible to force a directory mentioned in a .pth file to be inserted at the beginning of sys.path instead of appended to the end? Thx, -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From phr-n2001d at nightsong.com Thu Dec 20 16:56:27 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 20 Dec 2001 13:56:27 -0800 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> <7xlmfxvbx7.fsf@ruckus.brouhaha.com> <3dbsgt7f0e.fsf@ute.mems-exchange.org> Message-ID: <7xbsgttv1w.fsf@ruckus.brouhaha.com> Andrew Kuchling writes: > And if no one reports bugs, they can't get fixed. You could still go > ahead and report them, but unless they're real showstoppers they won't > be fixed in 2.2final, which is being wrapped up even as we speak. I > don't know if it'll be considered worth fixing them in 2.3. I expect these bugs are known already, but earlier in the 2.3 cycle I'd have reported them anyway. > (Or is this talk of incompatibilities simply FUD from people who are > scared of upgrading?) The incompatibilities are real and they do give me a feeling of FUD about upgrades. From srumbalski at prodigy.net Sat Dec 29 10:51:41 2001 From: srumbalski at prodigy.net (Steven Rumbalski) Date: Sat, 29 Dec 2001 15:51:41 GMT Subject: REPOST: Re: age of new pythonistas [was: The Editor Poll results are in!] References: <60c49aa9.0112202148.7218555b@posting.google.com> Message-ID: <2$--$$_----___-$$$@news.noc.cabal.int> Ville Vainio wrote: > Ditto with TCL. When I see 8 backslashes in a row, I look elsewhere Ditto with Python. When I see lines of code terminated by nothing but whitespace, I look elsewhere. asthetic-shock-a-poor-judge-ly yours, Steven Rumbalski ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Steven Rumbalski Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:16:45 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774727 27193 211.57.49.2 (31 Dec 2001 04:58:47 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:58:47 +0000 (UTC) X-Auth-User: 644814285/e4a15933b45bca64 X-Post-Time: Mon, 31 Dec 2001 05:00:46 GMT X-Problems-To: abuse at prodigy.com X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From robin at jessikat.fsnet.co.uk Mon Dec 17 06:53:55 2001 From: robin at jessikat.fsnet.co.uk (Robin Becker) Date: Mon, 17 Dec 2001 11:53:55 +0000 Subject: Why no match? Message-ID: I'm puzzled as to why the second of these pattern matches fails. They only differ in that the second is supposed to match to the end of line. Can any regexpert supply an answer? >>> import re >>> re.compile(r'^self\s*\.\s*test\s*=\s*\d\s*').match('self.test=11') >>> re.compile(r'^self\s*\.\s*test\s*=\s*\d\s*$').match('self.test=11') >>> -- Robin Becker From loewis at informatik.hu-berlin.de Wed Dec 26 19:27:58 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 27 Dec 2001 01:27:58 +0100 Subject: Efficient storage of floats References: <3c272d5e$0$202$626a54ce@news.free.fr> Message-ID: "Francois Petitjean" writes: > Is it possible to have a quantitative assessment of the overhead of the two > methods 1(list) or 2(array)? (overhead in memory footprint or CPU cycles). Getting the overhead in memory consumption is possible, but it is quite time consuming (you'll have to consider malloc overhead as well); see my earlier articles on "size of objects" for examples. It is well possible that the list version consumes five times or more than memory than the array version. On CPU cycles, you get additional indirections with the lists, but this is difficult to estimate - that is best done through bench marking. > And is it interesting to preinitialize the structure? The number of > points is typically 800*2 (for symmetry) that is say up to 8000 > floats. Depends on how often you destroy and recreate them, compared to actually using the data. For a list, pre-allocation is quite pointless, since the list will over-allocate anyway. For an array, it may be reasonable. BTW, pre-allocating [(0.0, 0.0, 0.0)*800] is worse than pre-allocating [None*800]. All 800 references will point to the same object in each case, only that "creating" None is more efficient than creating the tuple. Regards, Martin From jslowery at hotmail.com Sat Dec 1 05:19:42 2001 From: jslowery at hotmail.com (Jeremy Lowery) Date: Sat, 1 Dec 2001 04:19:42 -0600 Subject: load a class dynamically References: <3C08497D.2C92F2B9@earthlink.net> <7PYN7.24373$S93.953955@e3500-atl2.usenetserver.com> <9ua14i$l9t$1@peabody.colorado.edu> Message-ID: Ok, I see how that would help me out. I've been thinking, maybe my approach is entirely wrong. I'm hitting wall after wall after wall. Hypothetically speaking...what would be the best way to write a program that... loaded a python source file that only contained class or function definitions. Put the code in the database(bytecode, sourcecode, whatever) And then loaded and executed that code in a "virtual sandbox." the sandbox so-to-speak would be a restricted execution environment. loaded another python source file that used classes and functions in the first source file. Put that code in the database(bytecode, sourcecode, whatever) And then loaded and executed that code in the current "virtual sandbox." So basically I'd just collectively be loaded class and object definitions into memory (of course, the program could shutdown and be restarted and things would still be the same way because they were stored in the dbase.) And as icing on the cake, the code in the database would need to be able to be changed by the user. I've been pounding on this for about 2 days now, any ideas about this would be greatly appreciated. The package, module stuff is just "extra" Jeremy "Fernando P?rez" wrote in message news:9ua14i$l9t$1 at peabody.colorado.edu... > Jeremy Lowery wrote: > > > Now I'm in search of finding a way to make a dynamic modules, > > packages to add the classes to. I'm writing an app that stores all > > of this stuff in a ZODB and lets users write code on a server over a > > network. And I'm trying to figure out a way to dynamically "pack" > > all of the class definitions into modules and packages so that I can > > plug the base package into the namespace before the code is run. > > > > like one user importing Users.JLowery.ACoolModule > > in the code that is going to be piped over the network, and then the > > module/package structure is dynamically created from the objects in > > the ZODB. (Like the User package gets put in the global namespace) > > (Of course, not dynamically recreate it on every request but you get > > the idea.) > > > > Jeremy > > > > > > > > Never mind the funny variable names, but this does exactly (I think) > that: > > for _t.mod in __IP.rc.import_mod: > try: > exec 'import '+_t.mod in locals() > except : > __IP.InteractiveTB() > import_fail_info(_t.mod) > > __IP.rc.import_mod is a list of strings with names of modules which > get loaded into the user namespace after the program is running. > > Does this help? > > f From phd at phd.pp.ru Fri Dec 21 11:29:30 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Fri, 21 Dec 2001 19:29:30 +0300 Subject: Mild bug: pipermail/python-dev In-Reply-To: ; from tjreedy@home.com on Fri, Dec 21, 2001 at 04:22:52PM +0000 References: Message-ID: <20011221192930.U8259@phd.pp.ru> On Fri, Dec 21, 2001 at 04:22:52PM +0000, Terry Reedy wrote: > This page > http://mail.python.org/pipermail/python-dev/ > has a link to an archive for a message mis-dated (one hopes) February > 2005! Look into Zope archives: http://www.zope.org/Resources/MailingLists :) Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From aleax at aleax.it Mon Dec 31 06:11:14 2001 From: aleax at aleax.it (Alex Martelli) Date: Mon, 31 Dec 2001 11:11:14 GMT Subject: REPOST: introduction to xml in python References: <3$--$$_----___%_$$@news.noc.cabal.int> Message-ID: Rajarshi Guha wrote: > Hi, > could somebody point me to some code/tutorial describing how to use > Python to parse XML - I tried delving into the Python docs, but it seems > confusing. Whats the difference between expat and sax? How can I generate > a parsers etc. Besides the good suggestions you have already received, I urge you to have a look at the XML section of the Python Cookbook, particularly if you learn well from examples rather than from theoretical discussion. http://aspn.activestate.com/ASPN/Cookbook/Python?kwd=XML Paul Prescod's five recipes out of the 12 this will show are particularly instructive, IMHO; Nenadov's shows you how to use expat specifically rather than the normal sax interface (which is a more usual choice); others touch on perhaps more exoteric themes, but still hint at the breadth of applications that Python affords on XML at various levels. Start, in particular, with: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52256 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65127 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65128 in this order, and you already have a first elementary intro to the subject! The "paper" version of the Cookbook will (I hope, or I wouldn't be hard at work editing it:-) provide added-value, with a chapter introduction (by Paul Prescod, again!) framing the whole XML/Python subject, and recipes and discussions selected and edited for completeness and readability. But the "raw materials" of the online version have the substantial plus of being out there right now. The already-mentioned http://www.oreilly.com/catalog/pythonxml/ is also "out there right now", of course, and a huge plus is that the online sample chapter is chapter 1, providing an excellent intro & overview: http://www.oreilly.com/catalog/pythonxml/chapter/ch01.html so, be sure to look into it, of course!!! Alex From xfouoe at westoleyourmoney.com Fri Dec 7 07:19:14 2001 From: xfouoe at westoleyourmoney.com (xfouoe at westoleyourmoney.com) Date: Fri, 07 Dec 2001 12:19:14 GMT Subject: BREAKING NEWS ON PAYPAL SCAM!!!!! 1120 Message-ID: <6t2Q7.11599$ER5.264833@rwcrnsc52> BREAKING NEWS ABOUT PAYPAL SCAM! IF YOU HAVE AN ACCOUNT WITH PAYPAL YOU MAY WANT TO READ THIS BREAKING NEWS FROM.....ZDNET, CNN AND THE NEWYORK TIMES. CLICK ON THE LINK http://www.paypalwarning.com/Default.htm vgsbygupzy From mixo at beth.uniforum.org.za Mon Dec 24 05:01:39 2001 From: mixo at beth.uniforum.org.za (mixo) Date: Mon, 24 Dec 2001 12:01:39 +0200 Subject: os.fork() Message-ID: <3C26FD03.4050301@beth.uniforum.org.za> What does 'os.fork' return? Here is a script I have been playing with : ++++++++++++++++++++++++++++++++++++++++++++ import os l = os.fork() print l ++++++++++++++++++++++++++++++++++++++++++++ This prints out two numbers, I was expecting one. The first number seems to be the 'pid' of the child process and the second number, the exit status 'fork'. The number I was expecting is the exit status. Mixo From jason at jorendorff.com Sun Dec 16 14:53:19 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Sun, 16 Dec 2001 13:53:19 -0600 Subject: Idiomatic portable way to strip line endings? In-Reply-To: Message-ID: > I've been trying to figure out the canonical way to strip > the line endings from a text file. There isn't one. Almost always, either rstrip() is sufficient, *or* you're doing text slinging, in which case you can leave the newline characters on there, do the regex stuff, and file.write() the lines out the same way they came in. That said, the function you want is: def chomp(line): if line.endswith('\r\n'): return line[:-2] elif line.endswith('\r') or line.endswith('\n'): return line[:-1] else: return line If you're getting these strings from a text file, you could: for unstripped_line in file: for line in unstripped_line.splitlines(): ...process line... Why is this necessary? Unfortunately readline() doesn't interpret a bare '\r' as a line ending on Windows or Unix. So if the file contains bare '\r's, then the above code will read the entire file into the unstripped_line variable, then break it into lines with splitlines(). -- Jason Orendorff http://www.jorendorff.com/ From michel at zope.com Sun Dec 2 22:27:43 2001 From: michel at zope.com (Michel Pelletier) Date: Sun, 02 Dec 2001 19:27:43 -0800 Subject: Trouble with ref counts in C extension Message-ID: <3C0AF12F.35EFC7B5@zope.com> I'm having a bit of a problem with a C extension module. I have two C methods, push(o) and pop(): static PyObject * FiclVM_push(FiclVMObject *self, PyObject *args) { PyObject *ob; CELL c; if (!PyArg_ParseTuple(args, "O:push", &ob)) return NULL; Py_INCREF(ob); c.p = ob; vmPush(self->ficl_vm, c); Py_INCREF(Py_None); return Py_None; } /* Pop a Python object off the stack */ static PyObject * FiclVM_pop(FiclVMObject *self, PyObject *args) { CELL c; PyObject *ob; if (!PyArg_ParseTuple(args, ":pop")) return NULL; if (!stackDepth(self->ficl_vm->pStack)) return NULL; // handle better... c = vmPop(self->ficl_vm); ob = (PyObject*)(c.p); Py_DECREF(ob); return ob; } 'c.p' is a "cell pointer" (self->ficl_vm->pStack being a stack of "cells"). push(o) pushes a reference to an object on the stack and pop() pops that reference off and returns it. The stack does nothing to the object other than just look at it, so there is no behind the scenes mutation going on. The problem here is that it doesn't work except for integers. ;) Here's an example: >>> v = system.vm() >>> v.push(1) >>> v.pop() 1 >>> v.push((1,)) >>> v.pop() >>> v.pop() SystemError: Objects/tupleobject.c:123: bad argument to internal function >>> What happened? My only theory thatI can come up with is taht the garbage collector collected the tuple. I don't see why it would do that though because push(o) Py_INCREFs o. It will also work all day long with integer objects and strings no problem. Any ideas? Thanks, -Michel From James_Althoff at i2.com Fri Dec 7 15:24:24 2001 From: James_Althoff at i2.com (James_Althoff at i2.com) Date: Fri, 7 Dec 2001 12:24:24 -0800 Subject: PEP 276 Simple Iterator for ints (fwd) Message-ID: David Eppstein wrote: >It seems like the choices are > >(1) concise for-loop, verbose interval-like object > for x <= i < y > L = [i for x <= i < y] > >(2) verbose for-loop, concise interval-like object > for i in x <= ... < y > L = (x <= ... < y) > >These are not quite the same because of the list/iterator distinction but >the problem that list comprehensions can't be made to return iterators >instead of lists seems to be a more general one than this. Right. (Although the second line of (2) was probably meant to be L = list(x <= ... < y) Here's a simplistic example of how one might make use of intervals as arguments to functions or methods: >>> def printSquares(interval): ... for i in interval: ... print i, i*i ... >>> printSquares(2 <= ... <= 5) # faked it by using // & span 2 4 3 9 4 16 5 25 >>> printSquares(2 <= ...(step=2) <= 10) # faked it by using // & span 2 4 4 16 6 36 8 64 10 100 >>> Jim From gb at cs.unc.edu Sat Dec 1 10:21:22 2001 From: gb at cs.unc.edu (gb at cs.unc.edu) Date: 01 Dec 2001 10:21:22 -0500 Subject: PLplot with Python 2.1? Message-ID: PLplot includes support for Python 1.5. Has anyone ported it to 2.1? It *may* just require changing a few directory names but since it links to NumPy as well I could imagine it requiring some changes to the code. Thanks gb From andy47 at halfcooked.com Tue Dec 18 19:55:36 2001 From: andy47 at halfcooked.com (Andy Todd) Date: 19 Dec 2001 00:55:36 GMT Subject: ANN: ciphon 0.3.4 References: Message-ID: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) wrote in : > > I'm not what the deal with sourceforge is. If you click on the >view all project buttons, 0.3.4 appears. I think it may have been a >sourceforge bug. I've hidden the 0.3.1 release so that the 0.3.4 >release appears. > Looking good now. I think SF just highlights the latest uploaded package. AFAIK you need to be careful when submitting file packages to SF because they batch load them. If you submit two *almost* simultaneously it is a toss up which one is loaded first. This may be what happened, then again those troll gods have been active lately ;-) If I'm uploading stuff I tend to wait for one to show up before sending the next. >>Suchandra, should we be going to tummy.com or SourceForge? > > Either one of them will have the latest release. I'll update both >at the same time. Also starting from 0.3.4, you can download and >install the latest release of ciphon from within ciphon. > I managed to download the tar.gz from ftp.community.tummy.com but I had to use command line ftp. Every time I tried to access this from a web browser it crashed. Just FYI. > >> >>Oh, and the 'Home Page' link at SF doesn't work either, it redirects to >>http://ciphon.sourceforge.net/ which gives me a big 'Not Found'. > > I haven't had time to create and upload a home page for ciphon yet. >I've been too busy trying to make sure the code works and adding >features/ writing docs =(. > Not meant as criticism, honest. Until your massive documentation team comes up a with a page you should probably point the 'home page' link to your automatically created "I'm too busy to create a home page" at http://pythonsiphon.sourceforge.net/ Only a suggestion mind. Regards, Andy -- Content free posts a speciality From GabeN at captura.com Mon Dec 3 17:15:13 2001 From: GabeN at captura.com (Gabe Newcomb) Date: Mon, 3 Dec 2001 14:15:13 -0800 Subject: the purpose of this list??? Message-ID: <168B2A5F6A99D4119E200008C7C9CA8001CCA5E4@gibraltar.captura.com> So I just joined the list an hour ago. I've read 4 of the messages and half of them involve some form of flaming. If we're going to argue about how to do something, that's one thing, but please, people, if you're trying to make points just to preserve your image, give it a rest. It's a waste of all our time. With that said, kudos to everyone else ;) Gabe From roy at panix.com Sat Dec 29 13:40:16 2001 From: roy at panix.com (Roy Smith) Date: Sat, 29 Dec 2001 13:40:16 -0500 Subject: REPOST: Re: Two languages, too similar, competing in the same space. References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> Message-ID: <8$--$$_----__-%$-$@news.noc.cabal.int> gerson.kurz at t-online.de (Gerson Kurz) wrote: > Call me oldfashioned, but I don't like exception handling - I like > if-then-else and error checking style. I am certainly old fashioned. I thought FORTRAN was a great step up from writing in assembler. I've been doing python for about 4 years now, and I'm only just starting to really warm up to the idea of using exceptions on a regular basis, but I've finally gotten the hang of it (by which I mean not just learning the syntax, but getting to the point where it just seems natural). I've been writing lots of parsers lately, for every sort of data file we use. Each new parser is a subclass of a genericFileParser class I wrote (which takes care of low level stuff like reading the file, allowing lines to be pushed back onto the input stream to be reread later, keeping track of line numbers, and formatting error messages). Some of the parsers are pretty complex, employing state machines. Anyway, genericFileParser includes a parseError() method. A specific file parser subclass can just do: If len(blurfl) != 42: self.parseError ('bogus length for blurfl') and you end raising genericFileParser.ParseError with an argument of something like 'parse error in file foo.baz, line 47: bogus length for blurfl'). The really nice thing is it could have been generated deep in a function call chain, and I don't have to worry about propigating the error indication back up the chain. Even nicer, when I'm prototyping a new application, I don't have to worry about error checking at all; I just call my parser and assume everything works as it's supposed to. With return-status type error checking, if I got lazy and didn't check for errors, my program would just continue merrily on its way producing garbage, or mysteriously crashing at some other remote point in the code. With exceptions, if I fail to catch the exception, I blow out of the interpreter with a stack track, so I catch the error right away. Often times, all I'm going to do when I catch the error is exit cleanly with a nicely formatting message, but I can add that code later, at my convenience. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newspeer.monmouth.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Roy Smith Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:23:55 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774625 27193 211.57.49.2 (31 Dec 2001 04:57:05 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:57:05 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From LLoeffler at home.com Mon Dec 3 19:33:27 2001 From: LLoeffler at home.com (Luke) Date: Mon, 03 Dec 2001 18:33:27 -0600 Subject: Regular expression as dictionary key? References: <3C0B2DE9.5040308@home.com> <9ugdnp$8fe$1@slb0.atl.mindspring.net> <3C0BBF31.3000105@home.com> <9uh0ug$2luu$1@agate.berkeley.edu> Message-ID: <3C0C19D7.7000404@home.com> > I wonder if there's a way of precomputing the keys so that doing fuzzy > searching on them won't be so expensive. The difflib module allows > fuzzy searching, but I can imagine that it might be expensive to use. I'd have to think about it some more. Thanks for bringing up difflib--being new to python I didn't know it existed. That looks very cool but as you pointed out potentially expensive with quadratic (avg) performance. I'm basically screwing around with profiling spam by word histograms. In the best case, the word is already in the system and it returns with hash table speed. If not--then this fuzzy matching kicks in (difflib looks great for that) to try to get a match for mispellings or plural forms (more likely). As the db gets bigger and more complete, there should be fewer misses. So actually, speed may not be a great problem. Anyway, it's silly for me to be thinking about speed too much right now with a lot left unfinished. Luke From mamwh at python.net Wed Dec 19 16:56:54 2001 From: mamwh at python.net (Michael Hudson) Date: Wed, 19 Dec 2001 21:56:54 GMT Subject: stackless python References: <9vpjds$due$1@usc.edu> Message-ID: "John DeWeese" writes: > Hello, I'm a python newbie interested in using stackless python to > support hundreds of simulation objects for a game. Cool. > I've checked out various articles and it sounds great, and I've > visited stackless.com. Seems that branch is becoming a bit dated. Well what's there works well enough, I believe. But yes, you're right. > I also see that some features such as generators (not relevant to > me) have made it into python 2.2. So, what's up, can anyone share > their experiences regarding stackless python, micro-threads, etc.? What do you want to know? As you see development on stackless seems largely to be stalled, but I believe there are plenty of people still using it. OTOH, the chances of seeing stackless python or something like it in the core are currently in the vanishing-to-nil range. We went round with this one on the newsgroup a few weeks back -- google is your friend here -- and the conclusion was there was noone willing and able to do the enormous amount of work required. CT has done the first 90% of the work, but there's still the other 90% to go, and even if the work was done, it's far from certain that Guido would accept the changes anyway. Cheers, M. From lac at strakt.com Mon Dec 10 14:47:47 2001 From: lac at strakt.com (Laura Creighton) Date: Mon, 10 Dec 2001 20:47:47 +0100 Subject: two questions - sockets / c functions In-Reply-To: Message from Oleg Broytmann of "Mon, 10 Dec 2001 16:54:17 +0300." <20011210165417.P18573@phd.pp.ru> References: <3c14bc2c$1_2@news7.fast.net> <20011210165417.P18573@phd.pp.ru> Message-ID: <200112101947.fBAJllua032444@ratthing-b246.strakt.com> The only thing Oleg forgot to tell you was that sockets don't work on Windows, so if that was the client-server you wanted, then you need threading instead. You may, of course, have already known this. If you want a client server with threading you may be interested in: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82965 which shows one way to do this. There is nothing Tkinter specific about it, that is just what we use around here; you can use any other gui or no gui at all if you like. This one has the advantage of being _simple_. If you don't want a simple one, this could get you started at least. Laura Creighton From db3l at fitlinxx.com Mon Dec 10 21:48:07 2001 From: db3l at fitlinxx.com (David Bolen) Date: 10 Dec 2001 21:48:07 -0500 Subject: Populating a list References: <5a4226f0.0112092238.7212f87@posting.google.com> <87zo4q7jdy.fsf@toadmail.com> Message-ID: Jeremy Whetzel writes: > Ahhhh... I got it. Thank you. I really thought it closed the file > because of the readlines() on the end of the 'open' function. *scurries > off to fix current project* Yes it is closing the file (except delayed perhaps in the case of an exception as noted elsewhere in this thread), and yes it's related to the use of the readlines() method. At least in the CPython implementation of Python that uses reference counting (the same would not hold true for Jython). While I personally think handling explicit file closes is better, in a statement such as: f = open('filename').readlines() in the CPython implementation of Python which uses reference counting, the open() call returns a file object. A reference to this object only exists within the expression as a temporary reference. That reference is then used to call the readlines() method of the file object. That method executes, the result of which is an object (a list of lines in this case) which you then store a reference to as 'f'. When the statement completes, all that is left is 'f' bound to the object returned by the readlines() call. The temporary reference to the file object disappears as it only existed for the duration of the expression. At that point there are no further references to the file object returned by open(), so in the reference counted implemented, the reference count for the object goes to zero, and the object is destroyed. During the destruction of a file object, the file is also closed. -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l at fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/ From mwh at python.net Fri Dec 21 06:45:08 2001 From: mwh at python.net (Michael Hudson) Date: Fri, 21 Dec 2001 11:45:08 GMT Subject: Distutils question References: <9vu28t$4g9$1@peabody.colorado.edu> Message-ID: Fernando =?ISO-8859-1?Q?P=E9rez?= writes: > I have the following problem with distutils: I want to put a certain > directory with data files in a place where, after installation, my Python > code will be able to find it. > > The problem with the data_files option is that things can end up in places > that depend on python config details (/usr, /usr/local, etc) and later my > running script will have no way of knowing where to find the information. Well, one option would be to *in your script* ask distutils where they will have gone: >>> from distutils.core import Distribution >>> from distutils.command import install >>> i = install.install(Distribution()) >>> i.finalize_options() >>> i.install_data '/home/crew/mwh' But that's risky; it can be affected by the user options to setup.py. I'd hope it would be possible to get distutils to install a file in your package saying where things ended up, but I have no idea if/how this is possible. > I'm sure that people who have used distutils for big projects have > run into this, And they probably hang out on the distutils-sig; I suggest asking there might have better luck. Cheers, M. From kevin at cazabon.com Fri Dec 21 12:50:12 2001 From: kevin at cazabon.com (Kevin Cazabon) Date: 21 Dec 2001 09:50:12 -0800 Subject: FW: Comunicating through COM ports References: Message-ID: <5a4226f0.0112210950.1e383f8f@posting.google.com> If you want simple access to Serial ports, try the "uspp" module written by Isaac Barona: http://balder.prohosting.com/ibarona/en/python/uspp/uspp_es.html I've been playing with it, and it's VERY simple to use... the posted version needs one small modification for W2k/Python 2.1.1, but the author is currently fixing that. FYI, the mod is: comment out / remove the reference to "win32con.FILE_FLAG_OVERLAPPED" in the SerialPort_win.py module. Kevin Cazabon. "Alves, Carlos Alberto - Coelce" wrote in message news:... > Thanks for the example. But, where can I find such module Serial?! > > -----Original Message----- > From: David Mallwitz [mailto:dmallwitz at cox.rr.com] > Sent: Thursday, December 20, 2001 10:26 PM > To: python-list at python.org > Subject: Re: Comunicating through COM ports > > > Comunicating through COM portsChapter 19 of Mark Hammond and Andy Robinson's > 'Python Programmingon on Win32' covers this quit well, and with the > Activestate Python distro there is a multithreaded demo called > 'win32comport demo.py'. But here's what I do - example is from a console > connection to an old Cisco router. > > >>> from Serial import Serial > >>> ### open the COM1 port > >>> serialconfig Serial.PortDict() > >>> serialconfig['port'] Serial.COM1 > >>> serialconfig['rxBufSize'] 4096 > >>> port Serial.Port(serialconfig) > >>> port.open() > >>> port.write('show conf \r') > >>> x port.read() > >>> x > 'show conf \r\nUsing 768 out of 32762 bytes\r\n!\r\nversion 11.1\r\nno > service u > dp-small-servers\r\nno service tcp-small-servers\r\n!\r\nhostname > Router\r\n!\r\ > n!\r\nip subnet-zero\r\nno ip domain-lookup\r\n!\r\nhub ether 0 1\r\n > link-test\ > r\n auto-polarity\r\n!\r\nhub ether 0 2\r\n link-test\r\n > auto-polarity\r\n!\r\n > hub ether 0 3\r\n link-test\r\n auto-polarity\r\n --More-- ' > > Best, > Dave > > > "Alves, Carlos Alberto - Coelce" wrote in message > news:mailman.1008852145.28654.python-list at python.org... > Anybody could give me an example code of how connect/comunicate through COM > ports (i.e. COM1, COM2). I'm under windows 98. > Thanks!!! > Carlos Alberto > COELCE/DPRON-Departamento de Projetos e Obras Norte > Fone: 677- 2228 > e-mail: calves at coelce.com.br > \|||/ > (o o) > --ooo0-( )-0ooo-- > > > > > ----- Posted via Newsfeeds.Com, Uncensored Usenet News ----- > http://www.newsfeeds.com - The #1 Newsgroup Service in the World! > Check out our new Unlimited Server. No Download or Time Limits! > ----- Over 80,000 Newsgroups - 19 Different Servers! ----- From loewis at informatik.hu-berlin.de Fri Dec 28 18:26:47 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 29 Dec 2001 00:26:47 +0100 Subject: Running MySQLdb under solaris and python 2.1 References: <3d504fd.0112281335.45ca330@posting.google.com> Message-ID: beyer at incent.com (hugh) writes: > ImportError: ld.so.1: python: fatal: libmysqlclient.so.10: open > failed: No such file or directory > >>> > > So it's finding the MySQLdb package; it's loading the _mysql.so > module; and then it's failing to link in the libmysqlclient. (right?) > I've found libmysqlclient but I can't get it into the right directory > so the system can link it in--usr/local/bin (where the python program > is), usr/local/lib and usr/local/lib/python2.1 all don't work. > > Is there some magic place for it? The system only looks in /lib and /usr/lib, see ld.so(1). You can hard-code additional directories to search for libraries inside _mysql.so, by passing a -R option to the linker, e.g. cc -G -o _mysql.so -R/myhome/lib -L/myhome/lib -lmysqlclient See ld(1) for a description of the -R option. > Is there some environment variable I can set so it can be found? Yes, LD_LIBRARY_PATH, see ld.so(1). HTH, Martin From chrishbarker at attbi.com Tue Dec 11 13:25:26 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Tue, 11 Dec 2001 10:25:26 -0800 Subject: lost interest? References: <20011208001123.A5989@casa.parque> <3C14FEBD.AD52B516@attbi.com> Message-ID: <3C164F96.1CC4A8C3@attbi.com> Skip Montanaro wrote: > I do a little Perl programming under the guise of using Mason. I find CPAN > indispensible for a few reasons: > > * It appears that more of what the Python distribution calls "core" > modules are distributed separate from Perl proper. > > * I don't know my way around the Perl world very well. > > * Perl's third-party modules tend to rely heavily on other third-party > modules for their proper functioning, so CPAN's ability to register > and handle inter-module dependencies is important. SO:I think this kind of works boith ways: Perl NEEDS CPAN, because you can't get much done without added modules, and those modules tend to be interdependent. Python has gotten as far as it has without a similar archive, because you can get a whol;e lot done iwth just the standard library, and when you do need another module, it most likely works by itself. I think this kind of works both ways: It makes Python easier to use because of its "batteries included" philosphy. But because so much is in the standard library, people expect EVERYTHING to be in it, and when a module is not, they are reluctant to use it. > If I take a peek into the python2.1/site-packages directory of > manatee.mojam.com, a machine that I have been working on heavily the past > week or so, I see these third-party modules: > > csv > mx > TextFile > MySQLdb > timeoutsocket > PIL This is my list: FFT/ PIL/ kinds/ scipy/ MA/ RNG/ mayavi/ vtkPipeline/ Numeric/ PyCrust/ Scientific/ mx/ wxPython/ PythonCardPrototype/ gui_thread/ roundup/ Granted, some of those are there for the purposes of checking them out, and I'm not using them for "real work" Even with Skip's shorter list, It really is a pain in the #$%^ to go find and install all those packages when you need to duplicate your system, or upgrade to a new version. > CPAN is marvelous. The way the Perl and Python communities operate, it > fills a niche perfectly in the Perl world, but I think would be a bit of a > solution looking for a problem in the Python world. I have been following this discussion, and I think Skip is partially right: we don't need a clone of CPAN, it would be overkill. And while I suppose it would be nice to be able to run a script, and have all the modules it needs downloaded and installed for you, I don't need that. However, simply having a SINGLE site that I could go to that would have everything I need would be a big help! more like CTAN (for you TeX/LaTeX users) that CPAN. And no, the vaults of parnasses are not good enough...how many of the packages I (or Skip) have in my list are there? Also, a nice next step would be a comprehensive python distribution. When youo are hard pressed to buy a machine with less thatn 30GB of disk space, why not have an easy way to install ALL the most used packages at once? -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From donn at drizzle.com Tue Dec 25 13:30:05 2001 From: donn at drizzle.com (Donn Cave) Date: Tue, 25 Dec 2001 18:30:05 -0000 Subject: I used os.waitpid,but I still can't Zombie process? References: <1008825134.967004@yabetcha.sttl.drizzle.com> <1009167768.180019@yabetcha.drizzle.com> Message-ID: Quoth "lokie.spods" : | "Donn Cave" wrote in message | news:1009167768.180019 at yabetcha.drizzle.com... |> Quoth "lokie.spods" : |>| "Donn Cave" wrote in message |>| news:1008825134.967004 at yabetcha.sttl.drizzle.com... |> .... |>|> Hm, I think we're going in circles here - if I remember right, he was |>|> having problems with EINTR because of SIGCHLDs. Between that and the |>|> extra problems Python has with signal handling, I personally think SIGCHLD |>|> is a total loser for Python programs. |> |>| As all child processes will raise SIGCHLD upon exit it seems stupid to |>| ignore the oppertunity to take advantage of the signal and perform cleanup |>| as its required, working smarter not harder. Now your point mentions EINTR, |>| regardless of whether you write code to handle that signal, or leave it |>| unhandled some routines are going to exit anyway with EINTR. Re-reading the |>| OP's code snippet, it looks like any IO that could exit with EINTR is in the |>| child and out of scope of that signal anyway. |> |> SIGCHLD will abort your I/O functions with EINTR _only_ if you establish |> a SIGCHLD handler. It's a last resort. | | Which assumes that the calling process left SIGCHLD in its default state. | You can't make that assumption, for example I know of one shell that defines | a handler for SIGCHLD which then gets inherited by any subsequent processes. | Hence after the Christmas cheer has worn off I'll write a few example | programs to see if the Python interpreter overrides the sigaction with an | ignore setting. Well, that's sad, but the solution is SIG_IGN. Donn Cave, donn at drizzle.com From prjoshi at ntc.net.np Sun Dec 30 07:21:53 2001 From: prjoshi at ntc.net.np (Pravin Raj Joshi) Date: Sun, 30 Dec 2001 17:51:53 +0530 Subject: Icons and Tkinter!....From PRJoshi Message-ID: Hi, What I want to do is change the icon of my windows. (I have inserted a photo of what I want to do!) Basically I want to change the TK icon with something else. I read somewhere it was not possible to change that for the root, but it was possible for the toplevel. How to change that? Thanks PRJoshi -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: icon_photo.gif Type: image/gif Size: 3002 bytes Desc: not available URL: From jkraska at san.rr.com Sat Dec 15 12:22:48 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 15 Dec 2001 17:22:48 GMT Subject: Wrap C function which takes variable lengthed parameters? References: <6p5j1u0oag2ofkam8o7fig5dvkfc2392hk@4ax.com> <3C19990E.BE0F3FA@alcyone.com> <3C19AC0B.7ABD04DF@xs4all.nl> <1gbj1u8pm1t63ao6bjq98jlh66glf78fnu@4ax.com> Message-ID: <981n1ukk4ttujgree184i3k29c6g07kgsg@4ax.com> >This is a C problem but this is also a Python problem. >There are no need to wrap a C function for C program. >It is a problem caused by limitation of C language, though. That's what I meant. Python can't do it because C can't do it, and Python is coded in C. A C programmer faced with the same problem, say an array of values and a variadic function, would be unable to continue as well. Faced with a similar problem once, I ended up getting a rendition of the printf libraries done that made public its internal functions so that the varargs array could be prepped explicitly. It worked well, and I still use it today. I wrote a really cool function that works like this: char* str = NULL remprint (&str, , ...); The function detects the allocation length of the format string and allocates the memory for you. No more overflowing string buffers on format expansions. Cool, eh? C// From aahz at panix.com Sat Dec 22 15:16:51 2001 From: aahz at panix.com (Aahz Maruch) Date: 22 Dec 2001 12:16:51 -0800 Subject: python threads References: <96c7f32.0112210450.174f6914@posting.google.com> <3C24E646.1CF22B03@accessforall.nl> Message-ID: In article <3C24E646.1CF22B03 at accessforall.nl>, Ype Kingma wrote: >curt finch wrote: >> >> My understanding is that python's current threads implementation >> does not really allow for this in the sense that only one thread >> can be running at a time, regardless of the number of chips on >> the machine, and additionally that the threads cannot really >> interrupt each other and still maintain correct state. >> >> Is that all correct? > >It is correct for CPython, as others explained. As I explained, it's only partially correct. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 9 days and counting From jgardn at alumni.washington.edu Sun Dec 2 09:25:22 2001 From: jgardn at alumni.washington.edu (Jonathan Gardner) Date: Sun, 2 Dec 2001 23:25:22 +0900 Subject: Python, PyQT and QSpinBox In-Reply-To: <9udb9l$g9h$1@snipp.uninett.no> References: <9ubnie$34b$1@snipp.uninett.no> <9uco14$3cb$1@news1.xs4all.nl> <9udb9l$g9h$1@snipp.uninett.no> Message-ID: <200112021443.fB2EhSJ02119@my.knctv.co.kr> On Sunday 02 December 2001 10:44 pm, Yngve F. Johansen wrote: > I'm not to familiar with the signal-slot mechanism, and it could be that I > have to do something with this? I don't have a single connect() statement > defined relating to the QSpinBox widget. > You should probably take a few moments and run through the Qt tutorial. Take a few more moments and acquaint yourself with PyQt if you learned anything new. The Signal/Slot idea is fundamental to Qt. Jonathan From tim.one at home.com Fri Dec 21 22:42:15 2001 From: tim.one at home.com (Tim Peters) Date: Fri, 21 Dec 2001 22:42:15 -0500 Subject: python threads In-Reply-To: Message-ID: [Michael Hudson] > ... > [1] "free threading" is the name this issue traditionally goes by in > the Python community. Don't really know why. Repeat your google search on "Python free threading" but leave out "Python" next time. The pattern should be clear . It's not a coincidence that Greg Stein wrote the only free-threading variant of CPython (so far). The prospects for another version of that grow dimmer. Everyone (incl. Greg) has noticed that CPython internals, over time, increase their reliance on the thread-safety guarantees of the global interpreter lock. Indeed, I intend to exploit that again in 2.3 by adopting Vladimir Marangozov's pymalloc for Python's internal use, leaving its locking macros blank (avoiding locking overhead in the system malloc isn't the primary reason to adopt pymalloc, but, nevertheless, it was a significant savings on Windows last time I measured it). From bkc at Murkworks.com Sun Dec 30 11:29:28 2001 From: bkc at Murkworks.com (Brad Clements) Date: Sun, 30 Dec 2001 11:29:28 -0500 Subject: (Almost) command line simulation with execfile References: <3C2CADA8.8D6BE4C@ndh.net> Message-ID: <3c2f4182_2@news.newsgroups.com> Please post internet.py -- Brad Clements, DevNet Sysop 5 Developer Network Sysop Team -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- From James_Althoff at i2.com Thu Dec 6 17:12:28 2001 From: James_Althoff at i2.com (James_Althoff at i2.com) Date: Thu, 6 Dec 2001 14:12:28 -0800 Subject: PEP 276 Simple Iterator for ints (fwd) Message-ID: David Eppstein wrote: >But anyway, it would also be acceptable to me to use a syntax like >"for i in lb < ... <= ub". This would also answer the other common >objection that all for-loops must use "for var in iterator" syntax. >I prefer the other syntax, because I think this one is verbose in a way >that doesn't actually improve readability (verbosity that improves >readability is better than conciseness, though). I agree that i in lb < ... <= ub is a bit more verbose without improving readability compared to lb < i <= ub But, I see advantages in having "lb < ... <= ub" available as a general-purpose way of creating an interval object, which could be handy from time to time in some programs. Jim From wurmy at earthlink.net Sat Dec 29 01:41:40 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Sat, 29 Dec 2001 06:41:40 GMT Subject: PythonCard, ease of use, and the GUI problem/opportunity/niche References: <3C2A9D33.67FEC261@earthlink.net> <458b194a.0112282052.1123341@posting.google.com> <3C2D620C.2E67414D@earthlink.net> Message-ID: <3C2D644B.CE2FFED@earthlink.net> Ron Stephens wrote: [an easy-to-use GUI builder] > The only hope that I know of right now is PythonCard, only a six month old project led by Kevin Altis. I > really admire Kevin and his team and I admire this project. I think they are ace coders (especially Kevin ) > who are capable of doing what needs getting done. But I am afraid they will miss the mark, partly for the same > reason as Zope has its detractors, namely, lack of good, easy to use documentation for learning and using the > language. There's also Boa Constructor, which looks very promising, but unfortunately it has the same state as PythonCard... pre-alpha. If this ever really gets off the ground, it will be like having a Delphi using Python rather than Pascal. The current CVS version doesn't like wxPython 2.3.2, though. So I couldn't test the latest code. :-( http://boa-constructor.sourceforge.net/ --Hans From fb at ultranet.com Mon Dec 17 12:02:42 2001 From: fb at ultranet.com (basegmez) Date: Mon, 17 Dec 2001 12:02:42 -0500 Subject: Looping in Python Message-ID: <9vl8os$gcs$1@bob.news.rcn.net> If everything is an object in Python then why not: Syntax: loop(start=0, stop, step=1): (loop.count and loop.value automagically generated by Python, loop count starts from 1 and incremented by 1, loop value starts from start value and incremented by step value, stop value is a long integer) if condition: break elif anothercondition: continue your_statements_and_what_have_you_here Example 1: Input: loop(-4,4,2): print loop.count, loop.value Output: 1 -4 2 -2 3 0 4 2 Example 2: Input: loop(4): print loop.count, loop.value Output: 1 0 2 1 3 2 4 3 If you feel like pushing it, "loop.start", "loop.stop" and "loop.step" may be added. If it could implement floating point step values, it would be even better but I am not sure if this would be feasible. I realized that there have been some lengthy (to put it mildly) discussions of loop structures, if this is already proposed and rejected, just ignore it. If not, someone may be able to come up with better alternatives to "loop.count" and "loop.value" even the "loop" keyword. This was the most Pythonic way I could come up with. Regards, Fahri From SKuzminski at FairIsaac.com Wed Dec 5 14:47:18 2001 From: SKuzminski at FairIsaac.com (Stefan Kuzminski) Date: Wed, 5 Dec 2001 11:47:18 -0800 Subject: IIS & ASP & Python hanging Message-ID: Hi, So I'm happily using python to write my asp pages.. Sadly quite often the python asp pages cause IIS to lock up, the icon spins but the server never returns anything to the browser and then my IIS sessions get used up until I get a 403.9 error which is IIS complaining that it has maxed it's licenses for active connections.. Has anyone seen this? ( gotta convince these people to use apache.. ) Thanks, Stefan From jgardn at alumni.washington.edu Thu Dec 27 06:51:49 2001 From: jgardn at alumni.washington.edu (Jonathan Gardner) Date: Thu, 27 Dec 2001 20:51:49 +0900 Subject: Running a script in windows Message-ID: <200112271149.fBRBnNJ12709@my.knctv.co.kr> I know this comes up a lot, but I can't seem to find the answer in the archives. (If the answer is RTFM, please let me know where.) I don't have a windows box on my desk. A friend of mine does, but I can't get to it. He is trying to run a program I wrote, but the error message is coming up too fast for him to catch it. How can you keep that error message window around longer in Win2K? (BTW, let's pretend he doesn't know how to use the DOS prompt.) Jonathan From QnickQm at alum.mit.edu Thu Dec 6 20:00:16 2001 From: QnickQm at alum.mit.edu (Nick Mathewson) Date: Fri, 07 Dec 2001 01:00:16 GMT Subject: An implementation of a variation on "for 1 <= i <= 10" [was Re: PEP 276 Simple Iterator for ints (fwd)] References: <9uomtp$e1cbj$1@fido.engr.sgi.com> Message-ID: A while ago, Greg (I believe) proposed an alternative to PEP-276 that would allow iteration syntax of the form "for 1 <= i <= 10". In article , David Eppstein wrote: [...] > But anyway, it would also be acceptable to me to use a syntax like > "for i in lb < ... <= ub". This would also answer the other common > objection that all for-loops must use "for var in iterator" syntax. > I prefer the other syntax, because I think this one is verbose in a way > that doesn't actually improve readability (verbosity that improves > readability is better than conciseness, though). Here's some code that implements almost this behavior. Now you can type: for i in 1 <= ints <= 10: print i I don't have "for i in ints <= 10" going yet, but that should be a fairly easy extension. This code requires that you have at least Python 2.2 for the iterator logic to work. Python2.2 is still in beta, but hey -- so is this code. :) ============================================================ #!/usr/bin/python class Integers: def __init__(self, step=None, auto=0): self.lb = None #Lower bound (inclusive) self.ub = None #Upper bound (inclusive) self.up = None #Flag: Are we counting up (ai>c)? self.step = step #Stepping increment self.auto = auto #Automatically return an iterator when we have 2 # bounds? def __gt__(self, n): self.lb = n+1 if self.ub == None: self.up = 1 if self.auto and self.ub != None and self.lb != None: return iter(self) else: return self def __lt__(self, n): self.ub = n-1 if self.lb == None: self.up = 0 if self.auto and self.ub != None and self.lb != None: return iter(self) else: return self def __ge__(self, n): self.lb=n if self.ub == None: self.up = 1 if self.auto and self.ub != None and self.lb != None: return iter(self) else: return self def __le__(self, n): self.ub=n if self.lb == None: self.up = 0 if self.auto and self.ub != None and self.lb != None: return iter(self) else: return self def __nonzero__(self): return 1 def __iter__(self): if self.step == None: self.step = (-1, 1)[self.up] else: assert self.step != 0 and self.up == (self.step > 0) if self.up: return iter(xrange(self.lb, self.ub+1, self.step)) else: return iter(xrange(self.ub, self.lb-1, self.step)) ints = Integers(step=1, auto=1) if __name__=='__main__': assert [i for i in 1 <= Integers() <= 10] == range(1,11) assert [i for i in 10 >= Integers() >= 1] == range(10,0,-1) assert [i for i in 1 < Integers() < 10] == range(2,10) assert [i for i in 10 > Integers() > 1] == range(9,1,-1) assert [i for i in 1 < Integers() <= 10] == range(2,11) assert [i for i in 10 > Integers() >= 1] == range(9,0,-1) assert [i for i in 1 <= Integers() < 10] == range(1,10) assert [i for i in 10 >= Integers() > 1] == range(10,1,-1) assert [i for i in 2 <= Integers(step=2) < 99] == range(2,99,2) n = 0 for i in 1 <= ints <= 10: for j in 1 <= ints <= 10: n += 1 assert n == 100 assert zip(1 <= ints <= 3, 1 <= ints <= 3) == zip((1,2,3), (1,2,3)) ============================================================ What-a-tangled-web-we-weave-when-iterators-interleave'ly yours, -- Nick Mathewson Remove Q's to respond. No spam. From peoter_veliki at hotmail.com Mon Dec 3 13:31:56 2001 From: peoter_veliki at hotmail.com (Peoter Veliki) Date: Mon, 3 Dec 2001 10:31:56 -0800 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) Message-ID: > >With tabs, each person can set the indenting width to whatever value he/she > >likes best. As one person pointed out, a tab is a variable. This > >flexibility is tantamount to a "separation of style and content". This is > >an argument *for* using tabs. > > Until tabs and spaces are mixed, and then we have a living nightmare. I agree. I said earlier that banning a mixture of the two is reasonable, banning tabs altogether is excessively intolerant and user-unfriendly. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik at pythonware.com Tue Dec 4 02:53:01 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 04 Dec 2001 07:53:01 GMT Subject: Python garbage collection question References: <9uhlca$dgf$1@news1.ucsd.edu> Message-ID: Jeff Davis wrote: > I understand that Python uses a reference counting garbage collection > algoritm. However, I noticed that some other langauges use a "mark and > sweep" that does not require the INCREF and DECREF calls. Will the python > development eventually lead up to a different style or is there some > advantage to the current system? I am not trying to prod python in any > direction, but I am curious about the garbage collection system. reading the FAQ might help a bit: http://www.python.org/doc/FAQ.html#6.14 From preben_er_t0ff at hotmail.com Sun Dec 16 05:18:24 2001 From: preben_er_t0ff at hotmail.com (Preben) Date: Sun, 16 Dec 2001 10:18:24 GMT Subject: mySQL Message-ID: Is there any built-in modules for connecting databases such as mySQL? Or do I have to make them myself? From hungjunglu at yahoo.com Mon Dec 31 14:25:43 2001 From: hungjunglu at yahoo.com (Hung Jung Lu) Date: 31 Dec 2001 11:25:43 -0800 Subject: More flexible parameter passing in C++ Message-ID: <8ef9bea6.0112311125.559ff28d@posting.google.com> Hi, This is a question on C++. I guess I am too spoiled with Python features. Now it's hard for me to do things in C++. :) Consider the case of hook methods. You have parent classes that declare hooks. Well, a parent class may not do much with a hook, but the child class may do something with it. That's what hooks are for. Now, the parent class does not know nor does it care what's on the parameter list. Python can handle all this well: the parameter list can be quite dynamic in Python. There are many ways to handle dynamic parameter lists. But I am having hard time with C++, now. One way out is to use hashmaps (equivalent to Python dictionaries), but this is bad for performance. Is there some object-oriented way of making parameter passing more flexible in C++? I mean, the goal is avoid modifying the header declaration of methods... especially in situations where you have subclasses and sub-subclasses. I guess this problem is common enough that many people already have typical solutions (i.e.: patterns). Any thoughts? regards, Hung Jung From mcfletch.geo at yahoo.com Thu Dec 20 02:37:22 2001 From: mcfletch.geo at yahoo.com (Mike C. Fletcher) Date: Thu, 20 Dec 2001 02:37:22 -0500 (EST) Subject: stackless python In-Reply-To: <9vrsnu$e6n$1@usc.edu> Message-ID: <20011220073722.34698.qmail@web13402.mail.yahoo.com> Unfortunately, none of my micro-threading code is my own (all done as part of a research project for a former employer), but I might be able to help out if you're needing pointers or advice. I used it to develop a prototype of a distributed VR + e-commerce + software distribution system. Micro-threads made it considerably simpler than any other methodology I've seen. Good luck, Mike --- John DeWeese wrote: ... > Do you guys know of more example code for > micro-threads? Hungry for info! ... ______________________________________________________ Send your holiday cheer with http://greetings.yahoo.ca From usenet at thinkspot.net Sat Dec 29 20:22:35 2001 From: usenet at thinkspot.net (Sheila King) Date: Sat, 29 Dec 2001 17:22:35 -0800 Subject: REPOST: Re: Is learning Python "extraordinary"? References: Message-ID: <6$--$$_----___%$%$@news.noc.cabal.int> On Sat, 29 Dec 2001 13:29:35 -0800, "Jesse F. W" wrote in comp.lang.python in article : > I am a high school senior, and like many others, I am applying > to college. I am applying to MIT (as well as many other schools). > MIT describes what they are looking for as students who do or have > done "extraordinary things". My question is this, Is teaching myself > Python (with the aid of the Python tutorials and some help from the > various lists) an "extraordinary thing"? How many python-list'ers are > high school students? As a high school teacher of many years, and a former AP Computer Science teacher, I would say that teaching yourself *any* programming language on your own is unusual, although not uncommon. But teaching yourself Python, is rather rare. In writing college admission essays, go ahead and tell about this. More importantly, tell about your motivation for doing it, and any accomplishments that have followed as a result, especially any future plans down the road that your are looking towards as a result of your exposure to Python. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Sheila King Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:27:34 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774665 27193 211.57.49.2 (31 Dec 2001 04:57:45 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:57:45 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From loewis at informatik.hu-berlin.de Fri Dec 21 17:37:45 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 21 Dec 2001 23:37:45 +0100 Subject: Modifying environment variables References: Message-ID: Terry Hancock writes: > However, all this work is wasted, because after > I leave the script, the PATH is unaffected. It > seems that assigning values to os.environ['PATH'] > can affect subshells, but not the one I'm running > the script from. Yes, this is the way Unix works. You can inherit environment variables from the parent process to the child process, but once a process is started (such as the shell), you cannot affect their environment variables from the outside. Everything else would open big security holes. > Is there a way to get around this limitation? Print a shell command on standard output, then, in the shell, do eval `script_name` HTH, Martin From jgardn at alumni.washington.edu Sat Dec 8 05:25:22 2001 From: jgardn at alumni.washington.edu (Jonathan Gardner) Date: Sat, 8 Dec 2001 19:25:22 +0900 Subject: lost interest? In-Reply-To: <20011208001123.A5989@casa.parque> References: <20011208001123.A5989@casa.parque> Message-ID: <200112081030.fB8AUlJ17593@my.knctv.co.kr> On Saturday 08 December 2001 12:11 pm, Walter Moreira wrote: > Hi. > > I've been reading some of the catalog-sig archives and I wonder why the > interest of the community about something like CPAN is so small. When a > message about this thing pops up in c.l.py, it receives only one or two > answers and the thread dies, and in catalog-sig usually happens something > similar. > For me, I really haven't had much installing or finding python packages. It is much easier than it is for perl. > The arguments about not having a working prototype, I think, are not > good. Suchandra Tappa has set up a server with siphon, but nobody has made > comments. > > Why do you think people is not interested? Didn't the community should try > to encourage something like siphon? Maybe because installing new packages for Python is so dead easy? Jonathan From philh at comuno.freeserve.co.uk Sun Dec 2 21:19:22 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Mon, 3 Dec 2001 02:19:22 +0000 Subject: Whatever happened to String Interpolation? References: <9u6dbn$nsj$1@peabody.colorado.edu> <837ks6se4c.fsf@panacea.canonical.org> <9uc26v$akh$1@peabody.colorado.edu> <9ue35a$sbi$1@peabody.colorado.edu> Message-ID: On Sun, 02 Dec 2001 13:31:52 +2328, Fernando P?rez wrote: >Oren Tirosh wrote: >> Will this do? >> >> i"x is `x`, f(x) is `f(x)`" >> >> Take a look at http://www.tothink.com/python/interpp This involves changing the python language. IMO a better proposal would be to implement it in Python, perhaps using the syntax: i("x is `x`, f(x) is `f(x)`") That way, it'll not be part of the language, and anyone who doesn't want the feature will simply not import the relevent module. If you want this sort of thing, you can always use Perl. -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From QnickQm at alum.mit.edu Wed Dec 5 23:59:05 2001 From: QnickQm at alum.mit.edu (Nick Mathewson) Date: Thu, 06 Dec 2001 04:59:05 GMT Subject: Toy interpolation code [was Re: Draft PEP: string interpolation with backquotes] References: <20011202080626.A76724@hishome.net> <20011202170805.A36879@hishome.net> <200112032307.fB3N78327930@bigboy.bizarsoftware.com.au> <9ujspb$777$1@news.island.liu.se> <3C0E715D.855DE84D@ccvcorp.com> Message-ID: One thing I don't understand from the Interpolation Wars is why people feel Python needs any new syntax for this. Here's some example code that shows how to implement four kinds of proposed interpolation. They are: "naive backticks" (i.e., "`a`" == str(a); "``a`+"b"`" is an error) "smart backticks" (i.e., "`a`" == str(a); "``a`+"b"`" == str(repr(a)+"b")) "dollar-quoting" (i.e., "a$b$c" == "a"+str(b)+"c") "perl-style" (i.e., "1+1=$(1+1)" == "1+1=2", "Major $sys.version_info[0]" == "Major 2", x=5; "x=$x" == "x=5".) The interface works in two ways: 1. Immediate i(string, quotestyle='d2') (for quotestyle in('bt1','bt2','d1','d2')) 2. Precompiled pattern = I(string, quotestyle='d2') print str(pattern) print pattern % namespace BUGS: 1. This code is not tested well enough. 2. It is not optimized either. 3. It is not commented well enough. 4. It doesn't fail gracefully when it sees bad syntax. ============================================================ #!/usr/bin/python import sys # Needs version >= 2. assert sys.version_info[0] >= 2 # If we don't have sys._getframe, make one. if hasattr(sys, "_getframe"): _getframe = sys._getframe else: def _getframe(): try: 1/0 except: tb = sys.exc_traceback return tb.tb_frame.f_back def _comp_backtick1(s, ch='`'): """Given a format string, returns a code object that evaluates to the format string, with all values between backquotes evaluated and replaced by their string values. (The argument ch may be used to provide a different backtick value.) """ exp = [] i = 0 while 1: bt = s.find(ch, i) if bt < 0: exp.append(repr(s[i:])) break if bt > i: exp.append(repr(s[i:bt])) bt2 = s.find(ch, bt+1) if bt2 < 0: raise "Bad format" exp.append("str((%s))" % s[bt+1:bt2]) i = bt2+1 if i >= len(s): break if len(exp) == 1: exp = exp[0] else: exp = '"".join( (%s) )' % ", ".join(exp) return compile(exp, '', 'eval') def _get_btexpr_at(s,i,ch='`', min=None): """Returns (expr, end), where expr is the smallest prefix of s[i:] of length>=(min-i) that compiles into a syntactically well-formed python expression, and where end is the index of s immediately following expr.""" if min == None: bt = i+1 else: bt = min while bt < len(s): bt = s.find(ch, bt) if bt < 0: raise "Bad format" try: compile(s[i:bt+1], '', 'eval') return s[i+1:bt], bt+1 except SyntaxError: pass bt = bt + 1 raise "Bad Expression" def _comp_backtick2(s, ch='`', fn=_get_btexpr_at): """Given a format string, returns a code object that evaluates to the format string, with all backquoted chunks evaluated and replaced by their string values. (This differs from _comp_backtick1 in that _comp_backtick1 always looks for the next backtick, whereas _comp_backtick2 understands Python expressions. IOW, _comp_backtick_1(' `"1"+`2`` ') will turn into compile('''"".join((' ',"1"+,'2','',' ')'''), whereas _comp_backtick_1(' `"1"+`2`` ') will turn more sensibly into compile('''"".join((' ',"1"+`2`,' '))'''. ) """ exp = [] i = 0 while 1: bt = s.find(ch, i) if bt < 0: exp.append(repr(s[i:])) break if bt > i: exp.append(repr(s[i:bt])) btexpr, i = fn(s,bt) exp.append(btexpr) if i >= len(s): break if len(exp) == 1: exp = exp[0] else: exp = '"".join( (%s) )' % ", ".join(exp) return compile(exp, '', 'eval') def _comp_dollars1(s): """Given a format string, returns a code object that evaluates to the format string, with all values between dollars evaluated and replaced by their string values. """ return _comp_backtick1(s,'$') _endchars = { '(' : ')', '[' : ']' } def _isidch(ch): return ch.isalnum() or ch in '_.' def _get_dlr_expr_at(s, i): """Given a string s and an index i, returns a tuple (expr, end) such that expr is the longest possible "interpolated expression" beginning at s[i], and end is the index immedatedly after expr. An interpolated expression is either: 1. A parenthesized expression (1+2+4) 2. A dotted name sys.version 3. 1,2, or 3 followed by an index, an attribute, or a call. 4. A string. """ start = i assert s[i] == '$' i += 1 if s[i] == '$': return '"$"', i+1 #BUG: Handle $a.b, $a().b() if s[i].isalnum() or s[i] == "(": while i < len(s) and _isidch(s[i]): i += 1 if i == len(s): return "str(%s)" % s[start+1:], i ch = s[i] endch = _endchars.get(ch) if not endch or endch == ch: return "str(%s)" % s[start+1:i], i e, i2 = _get_btexpr_at(s, start+1, endch) while i2 < len(s) and (s[i2] =='.' or _endchars.get(s[i2])): if s[i2] == '.': while i2 < len(s) and _isidch(s[i2]): i2 += 1 continue try: e, next_i2 = _get_btexpr_at(s, start+1, _endchars[s[i2]], i2+1) i2 = next_i2 except: break return "str(%s)" % s[start+1:i2], i2 elif s[i] in "\"\'`": e, i2 = _get_btexpr_at(s, i, s[i]) return s[i:i2], i2 else: raise "Bad format" def _comp_dollars2(s): return _comp_backtick2(s,'$', _get_dlr_expr_at) _modes = { 'bt1': _comp_backtick1, 'bt2': _comp_backtick2, 'd1': _comp_dollars1, 'd2': _comp_dollars2 } class I: def __init__(self, s, mode='d2'): cfn = _modes[mode] self.compiled = cfn(s) def __mod__(self, vars): return eval(self.compiled, vars, vars) def __str__(self): f = _getframe().f_back return eval(self.compiled, f.f_globals, f.f_locals) def i(s,mode="d2"): loc = _getframe().f_back.f_locals return I(s,mode) % loc if __name__ == '__main__': assert i("1+1=`1+1`", 'bt1') == '1+1=2' assert i("1+1=`'1'+`1``", 'bt2') == '1+1=11' x = 2 assert i("$x$+1=$x+1$", 'd1') == '2+1=3' assert i("$x+1=$(x+1)", 'd2') == '2+1=3' assert i("1+1=$x") == '1+1=2' xyz=9 assert i("3*3=$xyz") == '3*3=9' assert i("3*3+2=$xyz+2") == '3*3+2=9+2' assert i("3*3+2=$(xyz+2)") == '3*3+2=11' assert i("3*3+2=$(11)") == '3*3+2=11' assert i("2**10=$(2**10)") == '2**10=1024' x = 3 assert i("$x**2=$(x**2)") == '3**2=9' x = [1,2,3,[4,5]] assert i("x[1]=$x[1]") == 'x[1]=2' assert i("x[3][0]=$x[3][0]") == 'x[3][0]=4' def power(e): def f(n,e=e): return n**e return f assert i("2**10=$power(10)(2)") == '2**10=1024' class X: pass x = X() x.y = 3 x.z = lambda q:q*q x.z = lambda q:q*q def getsys(): return sys x.getsys = getsys assert i("=> $x.y") == '=> 3' assert i("=> $x.z(10)") == '=> 100' assert i("=> $x.getsys().version_info[0]") == '=> 2' print "OK" ============================================================ -- Nick Mathewson Remove Q's to respond. No spam. From ralph at inputplus.demon.co.uk Sun Dec 23 16:42:08 2001 From: ralph at inputplus.demon.co.uk (Ralph Corderoy) Date: 23 Dec 2001 21:42:08 GMT Subject: SnoPy 0.1 - SNOBOL pattern matching for Python References: Message-ID: Hi Tim, > All the relevant portions of finite automata theory were well-known > then. The fascination with trying to *use* regexps started (AFAICT) > with Unix AIUI Ken Thompson implemented them in ed on their early Unix system, although it might not have been named by then, by generating machine instructions for the PDP/7. All this fuss about JIT... Only the name is new ;-) Ralph. From martin.franklin at westgeo.com Wed Dec 12 05:30:57 2001 From: martin.franklin at westgeo.com (Martin Franklin) Date: Wed, 12 Dec 2001 10:30:57 +0000 Subject: problems subclassing a PMW widget References: <3C169773.772BCB93@swbell.net> Message-ID: <9v7bjv$3218$1@mail1.wg.waii.com> This is what I do to subclass a Pmw widget.....: class MyScrolledText(Pmw.ScrolledText): def __init__(self, parent = None, **kw): # Define the megawidget options. INITOPT = Pmw.INITOPT optiondefs = ( ('borderframe', 0, INITOPT), ('hscrollmode', 'dynamic', self._hscrollMode), ('labelmargin', 0, INITOPT), ('labelpos', None, INITOPT), ('scrollmargin', 2, INITOPT), ('usehullsize', 0, INITOPT), ('vscrollmode', 'dynamic', self._vscrollMode), ) self.defineoptions(kw, optiondefs) Pmw.ScrolledText.__init__(self, parent) self.initialiseoptions(MyScrolledText) def write(self, stuff): self.insert('end',stuff) self.yview_pickplace('end') self.update() So you may need to call defineoptions and initialiseoptions........ HTH Martin From gmcm at hypernet.com Tue Dec 25 07:45:11 2001 From: gmcm at hypernet.com (Gordon McMillan) Date: 25 Dec 2001 12:45:11 GMT Subject: C++ throw causes abort in extension? References: <20011224.123518.378096161.2956@localhost.localdomain> <2ZKV7.13654$PO5.2163087@newsread1.prod.itd.earthlink.net> <20011224.150648.1067106872.1069@localhost.localdomain> Message-ID: Robert Nikander wrote: [throw / catch in extension aborts Python] > Well it is something that was added to gcc between 2.95.3 and 3.0.2. > > I just tried compiling my extension with gcc 2.95.3 rather than > 3.0.2 and exceptions are caught fine. So it must be something added > in gcc 3. Mk4py (the MetaKit wrapper) uses throw / catch. We just recently had to get rid of all cases where the throw and catch were at the top level. If the throw is in a called routine and catch in the caller, it works fine. But top-level throw / catches stopped working recently (at least with gcc). AFAIK, the advise about compiling Python with C++ only applies if your C++ uses static objects. Mk4py doesn't, and we've never heard of anyone having to recompile Python with C++ to get it working. -- Gordon http://www.mcmillan-inc.com/ From fperez528 at yahoo.com Wed Dec 12 17:05:57 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Thu, 13 Dec 2001 21:33:57 +2328 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <1008303437.718558@cswreg.cos.agilent.com> Message-ID: <9vbvi5$cm0$1@peabody.colorado.edu> Greg Weeks wrote: > Angus Mackay (amackay at radical.ca) wrote: > : what are people using? > > I hate to be a stick-in-the-mud, but I'm still with 1.5.2. I couldn't > (with minimal effort) get the new versions to build correctly on HP-UX. > And 1.5.2 is what came with my RedHat 7.2 Linux. For some bizarre reason, redhat 7.2 includes two versions of pyhton with 1.5 being the default. The python2 rpm has python 2.1.1, and the resulting executable (didn't check if it was a symlink) is also called python2. So double check your rh7.2 cds for a 'python2....rpm' file, it should be there (at least it is for x86 archs). cheers, f From aahz at panix.com Fri Dec 28 15:25:03 2001 From: aahz at panix.com (Aahz Maruch) Date: 28 Dec 2001 12:25:03 -0800 Subject: REPOST: Re: O'Reilly book production (was Re: Wine applicability) References: <3C2A9D33.67FEC261@earthlink.net> <3c2cca88.13089772@127.0.0.1> Message-ID: <2$--$$_----_---_$$@news.noc.cabal.int> In article <3c2cca88.13089772 at 127.0.0.1>, (Five Fresh) Fish wrote: > >Silly, really. O'Reilly should use the best software for the task, not the >most popular. Note carefully that O'Reilly *does* normally support XML (and actually prefers it, IIRC). I was just asking Alex what made Word necessary for Nutshell, to make sure that wouldn't be an issue for me. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 3 days and counting ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: aahz at panix.com (Aahz Maruch) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:27:28 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775091 27193 211.57.49.2 (31 Dec 2001 05:04:51 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:04:51 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From martin at v.loewis.de Sun Dec 16 09:41:13 2001 From: martin at v.loewis.de (Martin v. Loewis) Date: 16 Dec 2001 15:41:13 +0100 Subject: python and SOAP?? References: <9valdt$ik6$1@pea.uk.research.att.com> <59E456FD3AD1FE80.FF0578E51CFDE7B5.7FEBAE7CEB1F44D9@lp.airnews.net> Message-ID: claird at starbase.neosoft.com (Cameron Laird) writes: > Unicode's the sticking point. Again, I under- > stand that, in principle, CORBA does a good job > of transporting any kind of data (is this a > good point, by the way, for a gratuitous snipe > at SOAP's performance?). On a practical level, > though, multi-byte codesets have not been a > focus for most CORBA implementations, and I be- > lieve the majority still only support > single-byte for (IDL) "string". True? I'd say "not true". It will be difficult to find a Java ORB that does not support CORBA wstring (even though character set negotiation will be an issue). Likewise, many C++ ORBs that are still maintained support string. OTOH, a cursory inspection of XML RPC things (specifically XML-RPC, but potentially also SOAP implementations) show a surprising ignorance of the Unicode aspects of XML. Again, in Java, the world is probably nice and beautiful, but ... how many C++ SOAP implementations do you know that support Unicode? > The one question I have about this is whether > I'm being unfair to (IDL) "wstring". I'm in- > experienced with CORBA; my impression, though, > is that wstring isn't the solution one wants. Why do you think that? Merely because you consider it unimplemented (which is true for a number of ORBs, indeed)? Or do you have other concerns as well? Regards, Martin From kfarmer at thuban.org Thu Dec 27 09:24:54 2001 From: kfarmer at thuban.org (Keith Farmer) Date: Thu, 27 Dec 2001 14:24:54 GMT Subject: The Python community needs a lighter heart to it. References: <40dbad98.0112261431.3e928cf2@posting.google.com> Message-ID: "Chris Gonnerman" wrote in message news:mailman.1009459470.8426.python-list at python.org... > I just have one question: Who is Andrew Nguyen and why should we > follow him around anyway? Until he leaves us his shoe, you cannot take him seriously... ---------- Keith J. Farmer kfarmer at thuban.org http://www.thuban.org From jwbaxter at spamcop.net Wed Dec 26 20:09:07 2001 From: jwbaxter at spamcop.net (John W. Baxter) Date: Wed, 26 Dec 2001 17:09:07 -0800 Subject: REPOST: Re: Thinking in Python Revision 0.1 Available for Download References: Message-ID: <6$--$$-$$$$%%_%-%$@news.noc.cabal.int> In article , Bruce Eckel wrote: > Just under the wire, I've manage to post the first early alpha > version (0.1) of "Thinking in Python." You can go to the page that > connects you to the download here: > http://www.mindview.net/Books/TIPython Thank you, Bruce. You write so darn well that I'm hooked (and I haven't looked yet). I hope the project works out for you! --John ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!news.kigam.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "John W. Baxter" Newsgroups: comp.lang.python Subject: cmsg cancel <261220011709072938%jwbaxter at spamcop.net> Control: cancel <261220011709072938%jwbaxter at spamcop.net> Date: Mon, 31 Dec 2001 03:11:23 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009776000 27193 211.57.49.2 (31 Dec 2001 05:20:00 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:20:00 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From oren-py-l at hishome.net Sun Dec 23 07:21:14 2001 From: oren-py-l at hishome.net (Oren Tirosh) Date: Sun, 23 Dec 2001 07:21:14 -0500 Subject: Take 3 - multiple arguments to str() Message-ID: <20011223072114.A89844@hishome.net> """ str() with multiple arguments. str([obj1 [, obj2 [...]]]) -> string unistr([obj1 [, obj2 [...]]]) -> unicode This enhancement to the str() function/constructor takes an arbitrary number of arguments. The arguments are converted to strings and concatenated. It is backward compatible with the 0 and 1 argument cases. The multiple argument version of str may be used to defeat the print statement's automatic spacing and for general formatting of strings with embedded expressions. print str("X=",x," Y=",calc_y(x)) The function unistr() behaves similarly but produces unicode strings. It differs from the unicode() constructor not only in taking multiple arguments - like str(), unistr() can convert objects of any type to a unicode string. There is no support for encodings in unistr(). Use .decode() or the unicode() constructor with two arguments for non-default encodings. Credit for ideas: Fredrik Lundh Marcin 'Qrczak' Kowalczyk yours truly """ import __builtin__ def str(*args): """str([obj1 [, obj2 [...]]]) -> string""" return ''.join(map(__builtin__.str, args)) def unistr(*args): """unistr([obj1 [, obj2 [...]]]) -> unicode""" def unistr1(obj): if isinstance(obj, unicode): return obj elif hasattr(obj, '__unistr__'): return obj.__unistr__() else: return unicode(__builtin__.str(obj)) return ''.join(map(unistr1, args)) From lokie.spods at ntlworld.com Fri Dec 14 00:22:18 2001 From: lokie.spods at ntlworld.com (lokie.spods) Date: Fri, 14 Dec 2001 05:22:18 -0000 Subject: Fallen Angels, Originators of Evil on Planet Earth? References: <3c1a3057.19710462@127.0.0.1> Message-ID: "(Five Fresh) Fish" wrote in message news:3c1a3057.19710462 at 127.0.0.1... > On Thu, 13 Dec 2001 15:22:39 -0800, news at originsofevil.com wrote: > > >FREE INTERNET BROADCAST TALK ON: > >Tuesday, December 18, 2001, at 7 PM (CST) > > > >Fallen Angels, Originators of Evil on Planet Earth? > > Sorry, I think you misspelt "Perl." No I think you'll find Perl is spelt EVIL :-)'s From richard at bizarsoftware.com.au Wed Dec 12 20:30:36 2001 From: richard at bizarsoftware.com.au (Richard Jones) Date: Thu, 13 Dec 2001 12:30:36 +1100 Subject: capturing output of os.system() into a list? In-Reply-To: References: Message-ID: <200112130129.fBD1Tsk68476@bigboy.bizarsoftware.com.au> On Thursday 13 December 2001 12:06 pm, Ron wrote: > Is there a built-in method of doing this? I can write a function > to do it, but would rather use the standard method. something like: >>> import os >>> os.popen('ls').readlines() ['addDataManager.dtml\n', 'addExtDataContainer.dtml\n', 'addIdManager.dtml\n', 'CHANGES.txt\n', 'common.py\n', 'common.pyc\n', 'dtml\n', 'help\n', '__init__.py\n', '__init__.pyc\n', 'LowConflictConnection.py\n', 'LowConflictConnection.pyc\n', 'manageDataManager.dtml\n', 'manageExtDataContainer.dtml\n', 'manageIdManager.dtml\n', 'manageImpExpSessionData.dtml\n', 'manageIntDataContainer.dtml\n', 'manageSessionData.dtml\n', 'othertests\n', 'README.txt\n', 'SessionDataContainer.py\n', 'SessionDataContainer.pyc\n', 'SessionDataManager.py\n', 'SessionDataManager.pyc\n', 'SessionData.py\n', 'SessionData.pyc\n', 'SessionIdManager.py\n', 'SessionIdManager.pyc\n', 'SessioningInterfaces.py\n', 'SessioningInterfaces.pyc\n', 'SessioningPermissions.py\n', 'SessioningPermissions.pyc\n', 'SessionStorage.py\n', 'SessionStorage.pyc\n', 'tests\n', 'TODO.txt\n', 'VERSION.txt\n', 'www\n'] >>> Richard From dalke at dalkescientific.com Mon Dec 3 12:16:33 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Mon, 3 Dec 2001 10:16:33 -0700 Subject: Linux Kernel Design and Why Python is Rad References: Message-ID: <9ugc55$ggm$1@slb6.atl.mindspring.net> P.S. Forgot to add Jonathan Gardner: > If you are making something very complicated, it will end up > working if you don't try to kill it with design. Rather, you > should implement small changes, see what works, and take the > best results and work from there. In other words, that's designing your design approach, based on others' experiences, and is part of the evolution of software engineering. Andrew dalke at dalkescientific.com From peter.milliken at gtech.com Sun Dec 2 15:25:06 2001 From: peter.milliken at gtech.com (Peter Milliken) Date: Mon, 3 Dec 2001 07:25:06 +1100 Subject: Python evangelists unite! References: <3C07884E.75E18DF7@engcorp.com> Message-ID: <9ue2o2$b344@news1.gtech.com> You both prove *my* point - thanks! :-) Peter "Peter Hansen" wrote in message news:3C07884E.75E18DF7 at engcorp.com... > brueckd at tbye.com wrote: > > > > On Fri, 30 Nov 2001, Peter Milliken wrote: > > > > > I use Python as a good, quick and dirty hacking language. For real (read > > > production) stuff that I expect a customer to run or will require more than > > > a single person working for a couple of hours, I look elsewhere :-). Sure > > > there are examples of Python being used for "large" jobs - and very > > > successful they have been too - but these people are masochists (IMO) :-). > > > They could have been more productive with other languages that provide > > > better support for generic software engineering principles/standards. > > > > I am *so* glad that there are people in the world that share your opinion > > because you hand me a competitive advantage on a silver platter. I don't > > even have to work for it! Keep up the good work; many, many thanks! > > Dave! :-( Sshhhhh! > > (Most of the people here are probably not in business themselves. > You're not supposed to leak the secret out to our competitors!) > > -- > ---------------------- > Peter Hansen, P.Eng. > peter at engcorp.com From jkraska at san.rr.com Sat Dec 22 02:39:32 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 22 Dec 2001 07:39:32 GMT Subject: Python on the desktop References: <94e3fce8.0112210053.2568529d@posting.google.com> <3C238618.9F54E5CA@attbi.com> Message-ID: On Sat, 22 Dec 2001 07:00:58 GMT, "Dan Compton" wrote: >Read the ISO C++ Standard and tell me where it says anything about that Sure. I quote: Standard C++ shall not^H^H^H include a GUI toolkit nor^H^H^H and shall it^H^H likewise be bound to a specific operating system [insert:, chosen from amongst the following sensible choices: Windows/98, Windows/NT, Windows/ME, Windows/2000, Windows/XP, and Windows/CE]. Standard C++ shall not^H^H^H be limited to a specific hardware platform [insert: , include x86 derivitives and other hardware platforms as designated by the Microsoft Corporation]. Compiler vendors will be held to strict requirements for adhering to the standard [insert: , except for the Microsoft Corporation, who shall be permitted to build a superior compiler, Visual C++, as they so see fit]. >:-/ C// From LLoeffler at home.com Mon Dec 24 23:07:03 2001 From: LLoeffler at home.com (Luke) Date: Mon, 24 Dec 2001 22:07:03 -0600 Subject: Learning how question References: Message-ID: <3C27FB67.8080608@home.com> Google is a programmer's best friend: http://www.google.com/search?num=10&hl=en&safe=active&q=python+making+exe&btnG=Google+Search from that page... http://www.zipcon.net/~showell/cgi-bin/FolderPiki.py/main%3APyToExe From aleax at aleax.it Fri Dec 28 10:02:44 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 16:02:44 +0100 Subject: COM Registration Attributes References: <3C105C56.7080909@ActiveState.com> <5edaf477.0112141237.3f1471b2@posting.google.com> <5edaf477.0112280645.246f7229@posting.google.com> Message-ID: "Bill Bell" wrote in message news:5edaf477.0112280645.246f7229 at posting.google.com... > I have been wondering again about the best way of handling a > collection of Windows registry key additions, deletions or changes as > part of registering a Python COM server. ... > 4. Wrap atl.dll and make it part of the standard Windows distribution. ... > changes the specs for .rgs scripts. (Mind you, isn't this stuff meant > to become less of an issue?) Option 4 looks nicest to me. Maybe not to Microsoft's legal department, though. It would be at least wise to check with them rather than assuming they'd be glad to see some of their "redistributables" redistributed this way (i.e., as a part of a development environment). > What do others think? Wrapping _winreg (or the win32all equivalent thereof) seems the most clever option to me. Such a wrapper might be part of some Python distribution (or more sensibly of win32all). Alex From importbinascii Sun Dec 2 16:59:27 2001 From: importbinascii (Eugene) Date: Sun, 2 Dec 2001 13:59:27 -0800 Subject: Are there any PEPs for typed arguments? References: Message-ID: > Are you claiming that "meth" would not work correctly if I passed a > small long for "a" or that I could not use a instance that supports > __getitem__ (that always returns a length 1 string), __len__ and a few > other string methods for "b"? > > So why restrict the use of compatible types? What checks would you do to determine if a variable could be converted to an int without changing its value? And what checks would you do to safely determine if an object implements all the methods you want it to? If it does implement all those methods, what assurance do you have of what the methods' return-types will be? Supporting compatible types is a good thing, but so is determining at the _start_ of a function that something is going to break because a contract (or an assumption) was not upheld. -Eugene From jwbaxter at spamcop.net Mon Dec 17 11:18:33 2001 From: jwbaxter at spamcop.net (John W. Baxter) Date: Mon, 17 Dec 2001 08:18:33 -0800 Subject: /usr/bin/env: python: No such file or directory References: <9vivft$593$1@peabody.colorado.edu> Message-ID: <171220010818339518%jwbaxter@spamcop.net> In article <9vivft$593$1 at peabody.colorado.edu>, Fernando P?rez wrote: > ddidierd78 wrote: > > > Hi, > > > > I am running redhat 7.2 and installed the following: > > > > python2.2-2.2b1-2.i386.rpm > > python2.2-devel-2.2b1-2.i386.rpm > > python2.2-tools-2.2b1-2.i386.rpm > > > > When trying to run a script, I get the following message: > > > > /usr/bin/env: python: No such file or directory > > > > additionally the only thing relating to python in /usr/bin is the file > > python2.2 > > > > > > Thanks for any help, > > Dan > > the problem is Rhat installs python1.5 as python and python2.x as python2. So > you need to symlink python2.x to python in /usr/bin. > Doing which, a few weeks ago and with a 2.2 alpha and RH 7.1, caused printing to stop working due to an expected module not being in the 2.2 alpha (which one...I don't know). I fixed that by pointing the python link back to 1.5.2. Then I upgraded to RH 7.2 and lost printing again (but not for as long as before...the fix was different and more obvious). --John From timo.SPAM.linna at iki.ME.fi.NOT.invalid Tue Dec 18 14:23:59 2001 From: timo.SPAM.linna at iki.ME.fi.NOT.invalid (Timo Linna) Date: Tue, 18 Dec 2001 19:23:59 GMT Subject: Inheriting Python modules? References: <%LKT7.2764$NB2.64678@news2.nokia.com> <3C1F8EE5.668EF8C6@ccvcorp.com> Message-ID: "Jeff Shannon" wrote in message news:3C1F8EE5.668EF8C6 at ccvcorp.com... > > This is untested, but ISTM that if, inside your defaults.py, you import the > other module(s) using "from othermodule import *", it will have the effect you > want. (I'm pretty sure that wxPython, at least, uses this technique.) Of > course, you'll have to be careful to not cause any namespace conflicts amongst > your modules. This is, however, one of the few legitimate uses of "from module > import *" (IMHO). Ok, this might work, but its exactly the thing I don't want to do (i.e. defining dummy logical modules). I found some examples of using built-in module 'imp' and now I think the internal __import__-function should be overriden. -- timo From bougle at gluce.com Thu Dec 6 00:42:06 2001 From: bougle at gluce.com (bougle gluce) Date: Wed, 5 Dec 2001 21:42:06 -0800 Subject: The Editor Poll results are in! References: <3bfd7f87@news.airtel.net> <9u4cbu$2ts$1@news.xmission.com> Message-ID: "Roy Katz" wrote in message news:Pine.GSO.4.21.0111291730050.10038-100000 at z.glue.umd.edu... > Right on. I'm vegan so I drink soymilk anyway. > > (and I find that Python fits in with my youthful ideals nicely among > others such as Esperanto & being vegan) > > I remember a long thread about Esperanto and Python ideals. I rather > enjoyed that. In fact there are some Esperantists here (Bill Harris > of the Python Tutorial in Esperanto, Erik Max Fancis, Peter > Hansen (?), Konrad Hinsen); I wonder if there any vegens here, > too. > > it'd also be cool to see the relative age of new pythonistas -- I suspect > that they're young, but this is completely unfounded. > > > Roey > > assiduous JED user, but, more generally, Whatever Works (tm). > > > On Thu, 29 Nov 2001, Paul Winkler wrote: > > > On 29 Nov 2001 04:08:30 GMT, Kaden wrote: > > >ALRIGHT! Who's gonna pay for this pepsi ruined keyboard now?! > > > > That's what you get for drinking that crap! I'm currently using > > granola with soymilk. It's much more visually disgusting, which helps > > enhance the comic experience, but it doesn't corrode things nearly as > > badly. It's still a bitch to clean up. > > > > --PW I'm young, a vegetarian, and I like python. there's a connection somewhere but I'm not sure what it is. From DeepBlue at DeepBlue.org Fri Dec 14 12:41:50 2001 From: DeepBlue at DeepBlue.org (DeepBlue) Date: Fri, 14 Dec 2001 11:41:50 -0600 Subject: Fallen Angels, Originators of Evil on Planet Earth? References: Message-ID: You are making lots of unproven assumptions. Latest episode of 'Charmed' throws doubts on your ideas and shows the need for more research in the area. Nowhere had it been shown that the number of demons is not enough to cover the population for a long time to come. DeepBlue "Steven Majewski" wrote in message news:mailman.1008346041.3342.python-list at python.org... > > > If you buy into the initial statement of the problem, but not the > theory of demonic time-sharing, then that would explain why demonic > possession is a relatively rare phenomenon in modern times compared > to ages past. The number of deamons have remained relatively > constant, while the human population has soared, so deamons are > spread thin and percentage of the population who are deamon > possessed has fallen. > But I don't believe that the deamon population is constant: there > are lots being generated on computers every day, and I'll bet that > some of them have escaped! ( Maybe they don't actually die when > you 'kill' them! ) > > -- Steve > > > On 14 Dec 2001, Andrew Kuchling wrote: > > > news at originsofevil.com writes: > > > Fallen Angels, Originators of Evil on Planet Earth? > > > > And they multitask, too! From _Demon Possession Handbook for Human > > Service Workers_, at http://diskbooks.org/part1.html: > > > > 10. Demonic Time-Sharing > > > > Back in the days when Jesus walked the earth and evicted a > > legion [6,000] demons out of one man, the world population was > > a fraction of what it is today. In fact, population experts > > believe the number of people alive today exceeds all the > > people who have died since the dawn of creation. Let's assume > > that the number of demons is fixed and that number is the same > > today as it was when Adam and Eve walked in the Garden of > > Eden. This means that demons today have to cover more > > territory -- in terms of human beings -- than at any time in > > the history of the human race. One way demons can accomplish > > this feat is through what computer experts refer to as > > time-sharing. In the computer world, a large main-frame > > computer can be used by many people at the same time, without > > those users even knowing about the existence of each > > other. When telephone lines are used, people from all over the > > world can access the same computer simultaneously. The > > computer works with each user in turn and does so with such > > speed that each simultaneous user has the illusion of being > > the only person logged on at that time. The Internet uses a > > form of time-sharing. It may not be as fast as you would like, > > but it's time sharing. > > > > Demons may work the same way. Although they are not > > omnipresent in the same sense as God is everywhere at the same > > time, apparently they can move from point to point at very > > high speeds. Assuming that their minimum speed of travel is > > the speed of electricity, 186,000 miles per second, a single > > demon can trouble a large number of people in the course of a > > few minutes. This is like a computer is able to work with a > > large number of customers, through time-sharing. > > > > I can well believe that demons are involved in threaded programming. > > > > --amk > > -- > > http://mail.python.org/mailman/listinfo/python-list > > > > From peter at engcorp.com Sat Dec 29 18:51:34 2001 From: peter at engcorp.com (Peter Hansen) Date: Sat, 29 Dec 2001 18:51:34 -0500 Subject: Is learning Python "extraordinary"? References: Message-ID: <3C2E5706.5880983E@engcorp.com> "Jesse F. W" wrote: > > I am applying to MIT (as well as many other schools). > MIT describes what they are looking for as students who do or have > done "extraordinary things". My question is this, Is teaching myself > Python (with the aid of the Python tutorials and some help from the > various lists) an "extraordinary thing"? I'm afraid not. All the developers I've hired in the last two years took about a week to become productive with Python after being exposed to it for the first time. Of course, maybe they're *all* extraordinary! I agree with Aahz, however, that learning Python is an extraordinarily intelligent thing to do and should help you _be_ extraordinary at whatever college you go to. For more extraordinary things in relation to college applications, always look here for inspiration (enjoy :-) : http://www.geocities.com/jsfhome/Humstuf/college.html -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From jessw at loop.com Sat Dec 29 19:02:59 2001 From: jessw at loop.com (Jesse W) Date: Sat, 29 Dec 2001 16:02:59 -0800 Subject: Is learning Python "extraordinary"? In-Reply-To: <3C2E5706.5880983E@engcorp.com> Message-ID: <3C2DE933.24807.E29E208@localhost> Dear Peter, et. all, Peter Hansen wrote: > For more extraordinary things in relation to college applications, > always look here for inspiration (enjoy :-) : > > http://www.geocities.com/jsfhome/Humstuf/college.html Ah. Thank you! Yep, that describes me perfectly. I like the part about full-contact origami... Thank you; this has brightened up my whole day. Going back to the salt mines of college essay writing, Jesse W From sifu at isohypse.org Mon Dec 24 01:55:12 2001 From: sifu at isohypse.org (Siegmund Fuhringer) Date: Mon, 24 Dec 2001 07:55:12 +0100 Subject: vi or emacs for editing Python on Linux? In-Reply-To: ; from maxm@mxm.dk on Fri, Dec 21, 2001 at 11:25:32PM +0100 References: Message-ID: <20011224075512.E10496@0xx0.net> i used emacs for a long time, but last year my little finger on the left hand began hurting (pressing STRG/META 100 times per minute was to much) than i switched to vim. some hours later my little finger an i loved vim :) so i would recommend vim for the best of health ;) lg sifu... On Fri, Dec 21, 2001 at 11:25:32PM +0100, maxm wrote: > I am a long-time Windows developer who is trying to migrate to Linux for > several reasons. But this doesn't come naturally to me :-) And some of the > things about Linux I really like, others are a pain. Likewise with windows. > But all in all I want to gradually switch. > > One of my biggest problems in switching is my editor. On windows I use > Ultraedit as a general editor, and i type really fast in it. Knowing the > shortcuts and all. Every time I boot up one of my Linux machines I have a > hard time editing files under the arcane unix editors. I have tried both > emacs and vim and I disklike both! > > I guess it's because I have strong habbits by now, and not because the > editors are bad. > > But my point is that I figure that I have to use either editor if I want to > switch platform. So before I commit myself to spending the days learning one > of them thorougly (and swallow the loss in income ;-) ) I would like to know > the strong/weak point in using either for Python. > > I know this is close to religion. But are there any rational reasons to use > one instead of the other for Python? > > My understanding is that for emacs I have to use a lisp dialect to > automate/extend it, and in vim I can use Python as an extension language of > sort. Do I understand that correctly? > > I would especially like to use my next editor on my notebook with as little > use of the mouse as possible. > > Regards Max M > > > -- > http://mail.python.org/mailman/listinfo/python-list > -- _ __ (_)________ / /_ __ ______ ________ ____ _________ _ / / ___/ __ \/ __ \/ / / / __ \/ ___/ _ \ / __ \/ ___/ __ `/ / (__ ) /_/ / / / / /_/ / /_/ (__ ) __// /_/ / / / /_/ / /_/____/\____/_/ /_/\__, / .___/____/\___(_)____/_/ \__, / /____/_/ sifu at isohypse.org /____/ From tim at vegeta.ath.cx Thu Dec 13 22:40:09 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Fri, 14 Dec 2001 03:40:09 GMT Subject: Preserving program structure References: Message-ID: David Dawkins graced us by uttering: > So I'm using IDLE, and Alt-F5 tells me I have a problem with > indentation. > > It seems I had (inadvertently) mixed tab and space characters. > No amount of "tabbifying" and "untabbifying" resolved the issue, > so I had to shift *everything* to the left-margin, and re-create > the indentation with a consistent scheme (8 space hard tabs). > > While doing so, I stuffed up a lot of the program logic, because > it wasn't always obvious which block a particular statement > belonged in. This dismayed me intensely. > > How do experienced Python programmers avoid this problem? I avoid it by not using IDLE. I use Vim for hardcore editing and the Python interpreter for any ad hoc logic testing. With readline support compiled in, the Python interp supports bash-style auto completion as well. In order to change tabs to spaces in-place, you can run it through a filter like expand(1). Tim Hammerquist -- You know, we've got armadillos in our trousers. It's really quite frightening. -- Nigel Tufnel, "This is Spinal Tap" From tim at vegeta.ath.cx Tue Dec 4 21:38:49 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Wed, 05 Dec 2001 02:38:49 GMT Subject: The Editor Poll results are in! References: <3bfd7f87@news.airtel.net> Message-ID: Jonathan Gardner graced us by uttering: > On Wednesday 05 December 2001 02:24 am, Grant Edwards wrote: >> If I recall my chemistry correctly, "organic" refers to >> chemical compounds involving carbon, espcially things with >> carbon-carbon bonds forming chains/rings. >> >> Stuff like gasoline, plastics, nerve gas, that sort of thing. > > Kind of makes you wonder what us non-vegan people eat... Meat? As the great Mark Twain said: "Sacred cows make the best hamburger." ...and Denis Leary: "/Not/ eating meat is a decision. /Eating/ meat is an instict!" ...and Pink Floyd: "How can you have any pudding if you don't eat your meat?!" > Jonathan Tim Hammerquist -- scanf() is evil. From loewis at informatik.hu-berlin.de Tue Dec 4 09:28:42 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 04 Dec 2001 15:28:42 +0100 Subject: Problems with dynamic loading on Debian References: Message-ID: Craig E Rasmussen writes: > Has anyone seen this problem? The problem is that Python loads shared libraries using RTLD_LOCAL, which means that symbols from one extension are not available to another. This is by design; otherwise, extensions that have overlapping symbol spaces by coincidence would not be possible (*). > Can anyone suggest a solution? Do not use extension modules as shared libraries. If you want to exchange information between them, use CObject instances. In Python 2.2, you will be able to set the dlopen flags using sys.setdlopenflags. Regards, Martin (*) in one reported instance of this problem, some extension was using a symbol name "initsocket", which unfortunately came from the socket module. This, essentially, has caused the change in Python. Redhat, in their 1.5.2 installation, reverted the change that already had been made in Python. From gh_pythonlist at gmx.de Sun Dec 23 16:47:20 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Sun, 23 Dec 2001 22:47:20 +0100 Subject: SQLBase - Support? In-Reply-To: References: Message-ID: <20011223214719.GA1420@lilith.hqd-internal> Le 23/12/01 ? 19:22, Nicolas Keller ?crivit: > Hi! > > I'm looking for a possibility to connect to a Gupta SQLBase Server with > Python. As the application will run under Linux (and Zope for the frontend) > I guess that it's not possible to use ODBC? > > Any hints? It should be possible if there is a Gupta ODBC driver for Linux. In case the Gupta SQL server runs on Windows, you could perhaps use an ODBC-ODBC bridge. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From store_li at sina.com Sat Dec 22 22:17:05 2001 From: store_li at sina.com (Kick) Date: Sun, 23 Dec 2001 11:17:05 +0800 Subject: It's Tk's fault References: <9vp5bv$gvfps$1@ID-12869.news.dfncis.de> <9vrji0$hbcov$1@ID-12869.news.dfncis.de> <9vungu$hqp9s$1@ID-12869.news.dfncis.de> Message-ID: While, I found nothing can be download form that URL. Is it still in develop? "Kirill Simonov" wrote in message news:mailman.1008929189.1351.python-list at python.org... > On Fri, Dec 21, 2001 at 03:12:40PM +0800, Kick wrote: > > "Kirill Simonov" wrote in message > > > > > > Try to convert data to unicode before using it: > > > > > > data = unicode(data, 'gb2312') > > > > > > Maybe, you need to download additional codecs from > > > "http://sourceforge.net/projects/python-codecs/". > > > > I have tried but it doesn't work. Python don't know the name of that encode > > method. > > You need to download additional codecs from SourceForge. > > > Kirill > > From mwh at python.net Wed Dec 19 17:01:51 2001 From: mwh at python.net (Michael Hudson) Date: Wed, 19 Dec 2001 22:01:51 GMT Subject: dynamic modules References: <9vo01n$9j8$1@news.tpi.pl> <9vo2s4$noo$1@peabody.colorado.edu> <3C20EC90.3BA07F2F@attbi.com> Message-ID: Chris Barker writes: > Michael Hudson wrote: > > Fernando P?rez writes: > > > import plugin1 as p1 > > > > > > ... > > > > > > del p1 > > > In the next gc pass it should get picked up. > > > > This won't work; consider sys.modules. > > while you can't delete an entire module, can you delete some of it's > members? Example: > > import plugin > > # do stuff > > del plugin.largedatastructure > > If I did this, would the datastructure be deleted? Depends if there are any other references to it. They'll probably be easier to find than all the references to modules though. If this is an extension module, it very much depend on how the code in the extension module accesses the data in "largedatastructure". > If so, it would acomplish most of what the OP wanted. The module would > still be there, but the large data structure wouldn't be. It also looks > like a reload() would bring back the data, although I'm not sure how > well that would work with a compiled module. I think reload() is a no-op for compiled modules. Cheers, M. From anthony.harel at c-s.fr Thu Dec 20 06:24:28 2001 From: anthony.harel at c-s.fr (anthony harel) Date: Thu, 20 Dec 2001 12:24:28 +0100 Subject: launching netscape from python References: <3C21B743.AB4DBAB6@c-s.fr> Message-ID: <3C21CA6C.4A2DB44@c-s.fr> I have to work with python 1.5.2 and the module webbrowser don't seams to exist in this version of python. Oleg Broytmann a ?crit : > On Thu, Dec 20, 2001 at 11:02:43AM +0100, anthony harel wrote: > > I wanted to know the best way to launch netscape (or internet > > explorer) from a python application. > > For the moment I'm using os.system with the command line in > > argument, but I'm sure it's not the best way to do it. > > This have to work under windows and UNIX. > > http://www.python.org/doc/current/lib/module-webbrowser.html > > Oleg. > -- > Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru > Programmers don't die, they just GOSUB without RETURN. -- Anthony HAREL _______________________________ CS Syst?mes d'Information Immeuble Rafale B (a?ropole) 1, Rue Charles Lindbergh 44 346 Bouguenais T?l: (33) 02 40 05 31 11 Fax: (33) 02 40 05 19 26 mailto:anthony.harel at c-s.fr _______________________________ From Tom.Karas at htp-tel.de Tue Dec 18 19:40:05 2001 From: Tom.Karas at htp-tel.de (Tom Karas) Date: Wed, 19 Dec 2001 01:40:05 +0100 Subject: Thanks do all for your help References: <3C1E752E.8864E2E9@htp-tel.de> Message-ID: <3C1FE1E5.878F3CF6@htp-tel.de> I would like to thank all of you for your help. Best regards Tom Karas From aleax at aleax.it Fri Dec 28 09:49:46 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 15:49:46 +0100 Subject: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B941D.B1E45AA5@htp-tel.de> Message-ID: "Aahz Maruch" wrote in message news:a0i027$dl2$1 at panix3.panix.com... > In article , > DeepBleu wrote: > > > >NNTP is an internet protocol like SMTP, POP3 and HTTP for > >communication. Also, it is the oldest one and it used to be the most > >instructive before AOL hit the scene along with the 'gold rush' :) > > Really? NNTP is older than SMTP? Mind telling me where you found that > little gem? SMTP must be older, by a few years (say '82 vs '86?). FTP must be older still -- before SMTP, mail was distributed with an FTP tweak. Of course, netnews used other transport-level protocols (mostly based on UUCP, as I recall) well before the Internet was officially inaugurated (1983, wasn't it?). Alex From jkraska at san.rr.com Sat Dec 29 21:27:04 2001 From: jkraska at san.rr.com (Courageous) Date: Sun, 30 Dec 2001 02:27:04 GMT Subject: REPOST: Re: Is learning Python "extraordinary"? References: <3C2E5706.5880983E@engcorp.com> Message-ID: <1$--$$_----___-$-$@news.noc.cabal.int> >I think that you're answering with the wrong comparison group as your >background sample. Certainly I'd expect any professional developer to be >able to pick up Python in a week. But, among the set of all students >applying for university admission, how many of them have taught themselves >Python? I think this is an important distinction. When I was in highschool, those individuals who self-taught themselves computer programming languages were of the rare breed who were destined to later be technical wizards in their field. Passionately caring about something above and beyond what you're made to do and having the initiative to carry it out is a remarkable thing at any age; in a young mind, it is spectacular. Usenet urban legendry would have it that those who hang out in computer programming language groups are generally taken from the top 1% of their peers. While I can't speak to the degree of this truth, I am certain in the pit of my belly that it is true in spirit. Consider it well, C// ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Courageous Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:53:38 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774430 27193 211.57.49.2 (31 Dec 2001 04:53:50 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:53:50 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From mwh at python.net Thu Dec 6 08:41:00 2001 From: mwh at python.net (Michael Hudson) Date: Thu, 6 Dec 2001 13:41:00 GMT Subject: 'ioctl ' call in python (serial port reading) References: <3C0C8FF3.7060500@beth.uniforum.org.za> <3C0CAE73.6060304@beth.uniforum.org.za> <20011205111542.5369dd87.use-net@schabi.de> <3C0F1EA7.8000205@beth.uniforum.org.za> Message-ID: mixo writes: > Michael Hudson wrote: > > > > If he was using 1.5.2 or 2.0, then the constants should be in TERMIOS > > instead. > > There was a release which had a crippled set of constants in termios, > > but I can't remember which one it was/find it. > > At any rate, all the constants mentioned are in termios on the > > systems > > I have access to in CVS at present. > > Cheers, > > M. > > > > I am actually using 1.5.2, but I have 2.x installed as well. > The constants are not in my TERMIOS. Huh, wierd. What platform are you on? Did you build Python yourself or did it come with the OS? I'm not going to worry about this too much -- the chance of a 1.5.3 is not all that large... Cheers, M. -- Now this is what I don't get. Nobody said absolutely anything bad about anything. Yet it is always possible to just pull random flames out of ones ass. -- http://www.advogato.org/person/vicious/diary.html?start=60 From dcinege at psychosis.com Sat Dec 8 03:09:14 2001 From: dcinege at psychosis.com (Dave Cinege) Date: Sat, 8 Dec 2001 03:09:14 -0500 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) In-Reply-To: <3C101F01.1C48582A@engcorp.com> References: <3C101F01.1C48582A@engcorp.com> Message-ID: On Thursday 06 December 2001 20:44, Peter Hansen wrote: > Ben's pathetically obvious attempt to bring the discussion to a close > whilst still letting the tab people claim they won. ;-) ) GOD has already decided. Your tab blasphamy will only beget you suffering in the here after. -- The time is now 22:54 (Totalitarian) - http://www.ccops.org/ From James_Althoff at i2.com Mon Dec 10 19:04:04 2001 From: James_Althoff at i2.com (James_Althoff at i2.com) Date: Mon, 10 Dec 2001 16:04:04 -0800 Subject: more fun with PEP 276 Message-ID: wtanksley wrote: >> >>> for i in -5 // span // 5: # closed-closed >> ... print i, >> -5 -4 -3 -2 -1 0 1 2 3 4 5 > >Intriguing. Odd. Perverted. Words would fail me, but doggone >it, I find myself liking it. Thanks, Billy. I was starting to wonder if *anyone* was going come around to appreciating its quirky wholesome-ness. >The scary thing is that despite the ENORMOUS gap between the purpose >of the / operator and your abuse of it (help! I'm being repressed!), I >can still read this naturally: "span over length of myList". > >Minor niggle: how would users remember which operator represents which >type of range ending? Do you have a proposed mnemonic? / and // weren't my first choice (< and <= were -- I'm still working on that approach) but since they had the advantage of actually *working* in this scheme, I just went with it. In my mind / seems "thinner" than // so it seems better matched to the "thinner" interior interval whereas // seems better matched to the *thicker* inclusive interval. Also, / seems better matched to < (>) and // seems better matched to <= (>=). >Actually, it was. I dunno if this should go in, but for its purposes >I like it more than any of the other ideas, including my own. Hey, thanks again. Jim From rdsteph at earthlink.net Sat Dec 29 22:24:12 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sun, 30 Dec 2001 03:24:12 GMT Subject: REPOST: Video Programming Message-ID: <6$--$$_----__$%--$@news.noc.cabal.int> In this slow holiday week I am throwing out this "post" (I started to say "idea", but it is definitely too half-baked, moronic, and simple-minded, to be called an idea), FWIW. Please forgive my clueless presumptuousness (is that even a word ???) ... My son got a Microsoft X-box game machine for Christmas. Watching him play games, and once even participating myself (sort-of), I had these thoughts: In the future (far-future?), when computers are more "advanced", and so are programming languages, and so are software "component" models and interfaces, would it be conceivable to have a very high level video programming language? That is, a language that used a video-game like user interface. I could visualize an interface where one used a game-control like device for writing programs. These game control devices are really interesting; I am not able to use one at all well, because they are complex, with many input devices on each control device. You hold them with two hands and use several fingers and thumbs ;-))). You can move 3D objects around the screen, "shoot" guns, "fire" missiles, they have at least 10 or 12 different joystick-trigger-button-thingys for the user to play with. Even though I don't know how to use them, my son and lots of kids are experts; I think Nintendo, Sony, Sega and now X-box all have similar complex control devices, and the upcoming generation will reach adulthood with an intuitive working knowledge of how to use them well. So I visualize a "programmer" "reaching" into a 3D environment on a monitor, to manipulate 3D "components" that have "interfaces" so that they can only be plugged into certain other components in certain ways; but being 3D and visual, one could presumably build up very complex configurations of such visual components, with each component representing a software object or component, with certain well defined interfaces that are represented visually on the monitor. I speculate that this kind of model, or programming metaphor, might offer certain ease-of-use advantages for certain (unknown ;-)) types of programs. One could also use a virtual reality hand glove to manipulate the components, I suppose, or even, in a pinch, one could use a simple present day mouse to do the manipulations. Which brings me to one related thought or memory. A few years ago, when Java was sort of new, I read a couple of Java books (one was Learn in 24 hours I think ;-))) and that got me to the point where I could at least embed applets in a web page and run them, and make simple alterations in the source code to somewhat modify or customize the programs; but it did not get this particular clueless newbie to the point where I could, or where I wanted to anyway, write my own original Java applets or programs. So I found Java Studio, a $99 Sun Microsystems program that allowed one to create simple apps, and/or applets, by manipulating on-monitor 2D graphical components. It was really sort of like creating flow charts that the Java Studio program subsequently turned into Java source code; but it was better than just creating flowcharts, because the components were sort of half-way 3D and you fit them together, on screen, more like a plumber fitting pipes and widgets together, rather than a 2D flow chart. It actually worked, and I was able to create a few original applets that I liked and put on my personal web pages; I loved Java Studio. Then Sun, in their infinite wisdom, discontinued Java Studio. Unfortunately for me, I soon thereafter changed machines or had a disk crash or whatever, to make a long story short, I lost my Java Studio source code (which I had downloaded after paying for it, so I didn't have a master copy) and without the source code of the Java Studio (complier?-interpreter-whatever it was) I could not create new applets. Ah well, I learned a lesson I guess, can anyone say OPEN SOURCE ;-)))) But I always remember that Java Studio as a neat idea. In the future, if there were a much better implementation of such an idea, it could be good. (Of course, Python should be the underlying language ;-))) Now, I know code-genertors have a bad name with many smart folks, but keep in mind, video programing could be more of a reusable component interfacing, high-level architecturing kind of thing; but with perhaps a little code generation going on, around the sides, too , eh ;-))) Anyway, the video game control devices, though I personally dislike using them, do give an awful lot of sophisticated input capabilities, and the coming generations will be intuitively familiar with them, and if you with a kid play 3D first person shooter games (gasp) they do manipulate 3D objects on screen in an amazing fashion. And of course there would always be the need to code the original, sophisticated components in real Python, command line style. Please forgive me for this rambling post, but there it is, food for thought, or for speculation, or for...??? whatever, Ron Stephens P.S. being 3D, you could build really big programs, zooming into the screen's 3D environment really fast to get to different levels of a large program (it wouldn't be necessary to keep all the progam on screen at the same time, streams of components could fade into the background or leap into the foreground gradually as you travel into the "space", just like a real 3D space; and one could choose either high-level sweepingly panaromic views of whole large code sections, or conversely zoom in on narrow code segments. 3D spaces could allow one to create really convoluted patterns with great "depth". I was a Basic language spaghetti coder at heart in college (25-30 years ago!!!) and so I can just imagine the possibilities ;-))) One last aside, as a Math and Physics major in college so long ago, almost all my class mates were head over heels in love with computers, and most of them wound up in the computer science field for careers. Not me. I was sure that computer programming technology would progress so far so fast, that before long whatever I learned about programming in college would be obsolete, since computers would practically program themselves, or at least in such high level languages that most sophisticated users would interface with their computers in natural language ;-)) Boy was I wrong. So, at long last, my hobby now is bringing me back full circle; I still believe that someday, (real-soon-now? maybe not) computer programming languages will advance so far as to massively empower sophisticated users. Maybe I'm still just as wrong as I was 30 years ago, but one can dream, anyway ;-))) And now I find the ideas around building higher level languages more interesting than just about anything else. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E89DD.F3304EA9 at earthlink.net> Control: cancel <3C2E89DD.F3304EA9 at earthlink.net> Date: Mon, 31 Dec 2001 02:56:23 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774409 27193 211.57.49.2 (31 Dec 2001 04:53:29 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:53:29 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jjl at pobox.com Thu Dec 13 14:45:16 2001 From: jjl at pobox.com (John J. Lee) Date: Thu, 13 Dec 2001 19:45:16 +0000 Subject: XML parsing besides SAX and DOM In-Reply-To: <9v7d9h$s00$1@slb2.atl.mindspring.net> References: <9v7d9h$s00$1@slb2.atl.mindspring.net> Message-ID: On Wed, 12 Dec 2001, Andrew Dalke wrote: [...] > I've been doing XML processing of a record-oriented > data set where in a record: > > - the data isn't deep (pretty much flat) > - all the text is used from between the start and end tags > - the text is short (easily fits into memory) > > I developed another XML API to simplify this case, and I'm > curious about other similar systems (eg, I may want to > scrap my work). I know about SAX and DOM and about RAX. > What others are there? XPath? Very simple to use, though possibly too slow for some things. 4Suite has an implementation. John From claird at starbase.neosoft.com Thu Dec 13 10:31:34 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 13 Dec 2001 09:31:34 -0600 Subject: python and SOAP?? References: Message-ID: In article , Markus Jais wrote: >hello > >I saw at soapware.org, that there are at least 2 SOAP implementations >for python supporting both client and server development. > >one is SOAP.py in version 0.97 from Cayce Ullman and Brian Matthews. >and the other is a implementation from pytonware. > >does anybody have experience with these modules??? > >the latest stable version of the pythonware module is 18 months old. >is this project dead???? > >the SOAP.py seems to be under active development. > >can anybody recommend me which one to choose??? >or what the differences are?? . . . Does help? Or ? -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From blessed at mail.com Fri Dec 28 21:57:08 2001 From: blessed at mail.com (Gilbert) Date: 28 Dec 2001 18:57:08 -0800 Subject: REPOST: Is this a bug? Message-ID: <6$--$$_----_-$_$$$@news.noc.cabal.int> Hi! I am wondering if the following results below imply any bug in Python 2.2 or 2.1? When I try to use float numbers, python 2.2 and 2.1.1 shows a little bit different results (I think it is incorrect) from what I enter. But python 1.5.2 seems to be okay? What is wrong? If you know why and how they are different, please let me know. Thanks! ----------------------------------- Python 2.2 (#1, Dec 23 2001, 09:30:32) [GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-98)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> 653.34 653.34000000000003 >>> ----------------------------------- Python 1.5.2 (#1, Oct 13 2001, 09:06:03) [GCC 2.96 20000731 (Red Hat Linux 7.1 2 on linux-i386 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> 653.34 653.34 >>> ----------------------------------- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: blessed at mail.com (Gilbert) Newsgroups: comp.lang.python Subject: cmsg cancel <33e9b770.0112281857.563a36d4 at posting.google.com> Control: cancel <33e9b770.0112281857.563a36d4 at posting.google.com> Date: Mon, 31 Dec 2001 03:42:27 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774904 27193 211.57.49.2 (31 Dec 2001 05:01:44 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:01:44 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From aleax at aleax.it Fri Dec 28 12:41:02 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 18:41:02 +0100 Subject: REPOST: Re: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> <2419401F9FA44C22.520DBCE4218C0223.5487885783B69E22@lp.airnews.net> Message-ID: <8$--$$_----_---%%$@news.noc.cabal.int> "Cameron Laird" wrote in message news:2419401F9FA44C22.520DBCE4218C0223.5487885783B69E22 at lp.airnews.net... > In article , > Cameron Laird I approximated: > > . > > . > > . > >RFC 765 FILE TRANSFER PROTOCOL June 1980 > >RFC 821 SIMPLE MAIL TRANSFER PROTOCOL August 1982 > >RFC 854 TELNET PROTOCOL SPECIFICATION May 1983 > >RFC 850 Standard for Interchange of USENET Messages June 1983 > >RFC 977 Network News Transfer Protocol February 1986 > . > . > . > Oops; substitute the earlier > RFC 788 SIMPLE MAIL TRANSFER PROTOCOL November 1981 That had the same _name_, but I don't think it would interoperate with the one specified in late '82 (and widely implemented in '83), so I don't think they should be considered the same _protocol_. Alex ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Alex Martelli" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:49:24 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775154 27193 211.57.49.2 (31 Dec 2001 05:05:54 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:05:54 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From see.below at no.spam.es Tue Dec 18 05:31:51 2001 From: see.below at no.spam.es (Javier Bezos) Date: Tue, 18 Dec 2001 11:31:51 +0100 Subject: Preserving program structure References: Message-ID: <1f4lzc6.1iyqunc19nz378N%see.below@no.spam.es> David Dawkins wrote: > So I'm using IDLE, and Alt-F5 tells me I have a problem with > indentation. > > It seems I had (inadvertently) mixed tab and space characters. > No amount of "tabbifying" and "untabbifying" resolved the issue, > so I had to shift *everything* to the left-margin, and re-create > the indentation with a consistent scheme (8 space hard tabs). > > While doing so, I stuffed up a lot of the program logic, because > it wasn't always obvious which block a particular statement > belonged in. This dismayed me intensely. > > How do experienced Python programmers avoid this problem? > I don't see much code out there with comments like "# endif", etc. Since I've lost several programs thanks to this "feature" of Python, I've decided to add thinks like that and I've found that just "# end" or even "##" at the end of every block is enough to avoid lots of problems. Yet, I'm not an experienced Python programmer, but I must confess the more I use Python the more I hate that (my point of view, of course). Regards ___________________________________________________________ Javier Bezos | TeX y tipografia jbezos at wanadoo dot es | http://perso.wanadoo.es/jbezos/ From tatebll at aol.com Sun Dec 30 16:50:36 2001 From: tatebll at aol.com (Bill Tate) Date: 30 Dec 2001 13:50:36 -0800 Subject: Zope Documentation (was RE: Python Popularity: Questions and Comments) References: <3C2E55A6.D873E301@engcorp.com> <8gIX7.7072$l93.1790214@newsb.telia.net> Message-ID: "Fredrik Lundh" wrote in message news:<8gIX7.7072$l93.1790214 at newsb.telia.net>... > Bill Tate wrote: > > "Xxxxxx is the world's first company dedicated to using the science > > of experience strategy, design, and technology to create extraordinary > > results for our clients." > > interestingly enough, a google search for the above phrase > gave two very similar hits: > > Xxxxxx is the world's first company dedicated to using > the science of experience strategy, design, and technology > to create extraordinary results for our clients. > > Yyyyyy is the world's first company dedicated to using > the science of experience strategy, management, and > technologies to create extraordinary results for our clients. > > design or management, that's the question... > > Actually they are both from the same company. Its almost too painful to even think about. From grey at despair.dmiyu.org Thu Dec 27 21:13:52 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Fri, 28 Dec 2001 02:13:52 -0000 Subject: REPOST: Re: State of the SysAd art (was: vi or emacs for editing Python on Linux?) References: <2E48C714A6E1FBA1.19DE5ADEBF7F088A.DF90F2C1E6CC9E7C@lp.airnews.net> Message-ID: <0$--$$_----_%-$%-$@news.noc.cabal.int> On 27 Dec 2001 19:53:22 -0600, Cameron Laird wrote: > I entirely agree that in-place editing is not strictly necessary. I was > arguing for ssh, CVS, and IP reacha- bility while some readers were ... > well, younger than they are now. At the same time, I ask for tolerance of > our brethren who cope with more conservative computing regimes. Which is why I wrote my response in the neutral and left out the entire "vi is everywhere" argument that most vi people trot out. The editor, especially vim, stands on its own without resorting to bogus arguments that are no longer applicable in anything remotely approaching the majority of cases. -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Steve Lamb Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:16:00 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775714 27193 211.57.49.2 (31 Dec 2001 05:15:14 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:15:14 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From borcis at geneva-link.ch Mon Dec 24 20:00:48 2001 From: borcis at geneva-link.ch (Boris Borcic) Date: Tue, 25 Dec 2001 02:00:48 +0100 Subject: [OT] Quantum Python (Re: Properties fun with 2.2) References: Message-ID: <3C27CFC0.5AB401F7@geneva-link.ch> Yeah, (takes a palm-reader tone) I see very exotic species of properties germinating in many a pythoneer's mind. I for one would try to sell python to a new niche market, in mathematics... we'd just describe a new "style" of mathematical gadgets, all dying to get classified by life-long experts, and best modelled by arcane python properties ;-) In any case, an example toy-modelling Heisenberg's uncertainty principle looks like a must. Rules over the consistency of value mimicking the behavior of complementary QM observables before enchanted student eyes... Merryxmasly yours, BB -- "Python Rules, and Guido is its BDFL" Mike C. Fletcher wrote: > > For a long time I've wanted a way to define properties for Python From kragen at pobox.com Sun Dec 2 04:48:24 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 02 Dec 2001 04:48:24 -0500 Subject: which is best for a singleton, module or class? References: <9sbd8i$680$1@wanadoo.fr> <3C005692.173907B3@engcorp.com> <3C03275E.2C4D8149@engcorp.com> <3C045C07.BA7B3FE6@engcorp.com> <3C05AE56.E2261313@engcorp.com> <3c05b472$1@207.229.64.20> <3C05C9C3.ADC96FB5@engcorp.com> <8ef9bea6.0111290932.4afa618a@posting.google.com> <83elmftfbt.fsf@panacea.canonical.org> <8ef9bea6.0112011607.464fcd9f@posting.google.com> Message-ID: <83adx2q7fb.fsf@panacea.canonical.org> hungjunglu at yahoo.com (Hung Jung Lu) writes: > Kragen Sitaker wrote in message news:<83elmftfbt.fsf at panacea.canonical.org>... > > Please don't do that, except as a joke. Programs have bugs enough > > without obnoxious people deliberately making them harder to > > understand. > > Joke? :) It's not a joke. Zope Corporation (the same *obnoxious* > people that hired Guido, ha!) uses it. Experienced Python programmers > do use this device, sparingly, but they do use it, in real life. Some of the code in Zope is pretty obnoxious. Have you seen ZPublisher/cgi_hotfix.py? I mean, for crying out loud! I guess I can complain more when I've built a 150,000-line web publishing environment and given it away. By the way, gauss has its hostname set wrong. From keyton at weissinger.org Sun Dec 9 19:56:19 2001 From: keyton at weissinger.org (A. Keyton Weissinger) Date: Sun, 9 Dec 2001 19:56:19 -0500 Subject: Populating a list In-Reply-To: <3C1400BB.7040500@home.com> Message-ID: D'OH! Sorry. Like I said. I'm not all that adept either.... K -----Original Message----- From: python-list-admin at python.org [mailto:python-list-admin at python.org]On Behalf Of Luke Sent: Sunday, December 09, 2001 7:24 PM To: python-list at python.org Subject: Re: Populating a list > states = [] > f=open('/home/mlorfeld/states.txt', 'r+').readlines() > for i in f: > states.append(i.rstrip()) > f.close() > print states f.close() will fail because f is a list, not a file object. > f=open('/home/mlorfeld/states.txt', 'r+').readlines() This line while being fine, probably isn't the best idea in the interest of clairity as f traditionally denotes a file pointer, not a list. I would give it a more meaningful name. -- http://mail.python.org/mailman/listinfo/python-list From joseph at arbitrary.org Mon Dec 3 13:12:56 2001 From: joseph at arbitrary.org (Joseph Santaniello) Date: Mon, 3 Dec 2001 10:12:56 -0800 Subject: pygettext examples? In-Reply-To: References: Message-ID: Sure does help, Martin. Thanks. I'm working on a threaded server-type application that doesn't really have any interactive users who would have enviornmental variables to set, so I'll use your suggestions for how to change things manually. Thanks again, Joseph On 2 Dec 2001 at 15:17, Martin von Loewis wrote: > Joseph Santaniello writes: > > > OK, so it works now (I had my directory structure incorrect) but the only > > way I have successfully changed languages on the fly is by using > > os.environ['LANG'] = 'no'. > > That is the way it is supposed to work: The user shall set her LANG > environment variable, and then all programs shall print messages in > the user's preferred language. If you want it differently, expect to > write more code yourself. > > > I haven't been able to figure out how to use gettext.translation() > > and install() to change the language. Is there any reason why I > > shouldn't just continue to use the os.environ method? > > If you want to switch languages dynamically (and ignore the user's > LANG setting altogether) I recommend that you directly load the > translation files. > > the_catalog = gettext.translation("domain",languages=["no"]) > > def _(msg): > return the_catalog.gettext(msg) > > Then, whenever you want to switch a language, just change the_catalog. > Alternatively, you could also do > > _ = gettext.translation("domain", languages=["current-lang"]).gettext > > (make sure you rebind _ in a scope so that all your modules see that > change) > > Notice that gettext.translation also allows specification of the > locale directory. If you don't even want to use the > LC_MESSAGES/lang.mo directory structure, you can use > > the_catalog = gettext.GNUTranslation(open(mofile)) > > in which case control for opening the right mofile is completely in > your hands. > > HTH, > Martin > From sironja at web.de Sun Dec 2 05:13:32 2001 From: sironja at web.de (Vlado) Date: 2 Dec 2001 02:13:32 -0800 Subject: PyClass_New and __getattr__ References: <9370329.0111220232.670574e2@posting.google.com> Message-ID: <9370329.0112020213.6d9acfe2@posting.google.com> Ok. Works now see: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/54352 Bye, Vlado From skip at pobox.com Wed Dec 12 15:20:16 2001 From: skip at pobox.com (Skip Montanaro) Date: Wed, 12 Dec 2001 14:20:16 -0600 Subject: lost interest? In-Reply-To: <3c178a5c.36573229@news.laplaza.org> References: <20011208001123.A5989@casa.parque> <3C14FEBD.AD52B516@attbi.com> <3c178a5c.36573229@news.laplaza.org> Message-ID: <15383.48128.639021.289773@beluga.mojam.com> Mats> For those things that are available as a distutils setup, Mats> installation is easy enough - it solves most of the problems. One thing I prefer about CPAN over distutils is the way it builds things. Instead of trying to be a completely self-contained tool, it generates a Makefile (on Unix-like systems at least) and invokes make. I presume in the Windows world it generates something compatible with that environment. Distutils doesn't check dependencies properly. It's not a major concern when simply building and installing some package once, but if the environment the package lives in changes, distutils may not rebuild everything it needs to. -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From pj at sgi.com Wed Dec 19 17:01:17 2001 From: pj at sgi.com (Paul Jackson) Date: 19 Dec 2001 22:01:17 GMT Subject: ANN: ciphon 0.3.4 References: <20011219092711.31a8282a.gry@ll.mit.edu> Message-ID: <9vr2nd$1j493$1@fido.engr.sgi.com> |> Sorry, given the recent discussions, I thought people |> following the list would have already known. You're not addressing a handful of people who are all focused on the same thing. You are addressing a City's worth of people, with focus and attention spans all over the place. A new thread with subject "ANN: spam 1.2.3" is certain to be glanced at by many folks, most of whom probably didn't even notice the enthralling spam thread of yesterday. Even (though its not the case here) if the new "spam" module was only of interest to connoisseur's of fine British cuisine, a couple of words as to what it is allows the many lurkers to move along more easily. -- I won't rest till it's the best ... Manager, Linux Scalability Paul Jackson 1.650.933.1373 From howard_b_golden at yahoo.com Fri Dec 14 23:34:39 2001 From: howard_b_golden at yahoo.com (Howard B. Golden) Date: Sat, 15 Dec 2001 04:34:39 GMT Subject: New motto/slogan: "Batteries Included, Warts Removed!" Message-ID: With the forthcoming release of 2.2, I'm proposing a new motto/slogan. ;-) Actually, I just want to send my congratulations and thanks to everyone involved! --Howard From gh_pythonlist at gmx.de Thu Dec 20 23:51:40 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Fri, 21 Dec 2001 05:51:40 +0100 Subject: calling external programs In-Reply-To: References: Message-ID: <20011221045137.GA2547@lilith.hqd-internal> Le 21/12/01 ? 03:10, bougle gluce ?crivit: > I was wanting to write a python program for linux that > can call upon external programs. for instance the newsreader > that I use is able to call my favorite text editor to edit > this post, when I quit and save the text it saves it to a > specific file then posts the text. > > I think I understand how I might use system() to call upon > another program. what I don't understand is how is it possible > to take the user back to the calling program. for > instance how do I end up back in my newsreader after I'm finished > editing this post? and how did the editor know where to save > the file? The newsreader will most likely do something like this: import os editor = "vim" tempfile = os.tmpnam() # Invoke editor os.system(" ".join(editor, tempfile)) # Read back the text in order to post it text = open(tempfile).read() # Then delete the temporary file, ... Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From nbecker at fred.net Sun Dec 30 15:48:33 2001 From: nbecker at fred.net (nbecker at fred.net) Date: 30 Dec 2001 15:48:33 -0500 Subject: /usr/bin/env: python: No such file or directory References: <9vivft$593$1@peabody.colorado.edu> <171220010818339518%jwbaxter@spamcop.net> <9vnvue$m5d$1@peabody.colorado.edu> <9vo6ng$mhs$1@nntp6.u.washington.edu> Message-ID: >>>>> "Aloysius" == Aloysius Toh writes: Aloysius> Redhat 7.2 has both 1.5 and 2.1 Yes. Since RedHat scripts require 1.5, they should say so explicitly. This would enable you to install 2.1 or 2.2 or whatever you like without conflicts. From keyton at weissinger.org Mon Dec 3 23:40:21 2001 From: keyton at weissinger.org (A. Keyton Weissinger) Date: Mon, 3 Dec 2001 23:40:21 -0500 Subject: the purpose of this list??? In-Reply-To: Message-ID: I second that motion. Maybe a python-indentation-wars-list is in order? ;-) Keyton -----Original Message----- From: python-list-admin at python.org [mailto:python-list-admin at python.org]On Behalf Of Nicholas FitzRoy-Dale Sent: Monday, December 03, 2001 10:44 PM To: python-list at python.org Subject: Re: the purpose of this list??? On 3 Dec, Gabe Newcomb wrote: > So I just joined the list an hour ago. I've read 4 of the messages and half > of them involve some form of flaming. If we're going to argue about how to > do something, that's one thing, but please, people, if you're trying to make > points just to preserve your image, give it a rest. It's a waste of all our > time. This is the most flame-free list I've ever been on, and once the weirdos in the corner stop muttering about indentation it'll be even better ;-) -- - Nicholas FitzRoy-Dale http://www.lardcave.net Feel my three-toed wrath! - Catie -- http://mail.python.org/mailman/listinfo/python-list From arigo at ulb.ac.be Tue Dec 4 11:27:12 2001 From: arigo at ulb.ac.be (Armin Rigo) Date: Tue, 4 Dec 2001 17:27:12 +0100 Subject: Psyco at SourceForge Message-ID: Hello everybody, I have opened a "Psyco" project at SourceForge: http://sourceforge.net/projects/psyco/ I suggest that people interested in Psyco post a welcome and start discussion in the mailing list that I am currently opening there. This will allow me to stop (mis)using python-dev at python.org and this newsgroup for all minor announces. The source code I have uploaded at SourceForge (and in a .tgz archive at the Psyco homepage) is version 0.3.4, which is an important rewrite over the previous version. I have tried to address the two 'bad design' issues I mentionned in ISSUES.txt: * pycompiler.c-and-friends are much clearer now, thanks to a clean interface in vcompiler.h and processor.h to all the gory details; * the structure of the Python-dependent part Psyco now very closely follows that of the Python interpreter. Anyone used to the Objects/xxx.c files of Python should feel at home with Psyco's objects/pxxx.c files. In fact, they are just a rewrite of the Python interpreter into some "meta-C" code useable by the specializer of Psyco. If you gave up while trying to read the code of 0.3.3 please have another look now :-) Thanks, Armin Rigo. From tdpham at email.com Wed Dec 5 13:47:27 2001 From: tdpham at email.com (Thomas Pham) Date: Wed, 05 Dec 2001 11:47:27 -0700 Subject: Strip HTML tags from downloaded files Message-ID: <20011205184727.14933.qmail@email.com> When I use urlretrieve to download a file from the web, the raw text file have HTML tags embedded at the beginning and the end of the file. Is there anyway to strip all the HTML tags from the file? Thanks, -- _______________________________________________ 1 cent a minute calls anywhere in the U.S.! http://www.getpennytalk.com/cgi-bin/adforward.cgi?p_key=RG9853KJ&url=http://www.getpennytalk.com From max at alcyone.com Tue Dec 18 18:12:51 2001 From: max at alcyone.com (Erik Max Francis) Date: Tue, 18 Dec 2001 15:12:51 -0800 Subject: /usr/bin/env: python: No such file or directory References: <9vivft$593$1@peabody.colorado.edu> <171220010818339518%jwbaxter@spamcop.net> <9vnvue$m5d$1@peabody.colorado.edu> <3C1F9B6E.19471D84@alcyone.com> Message-ID: <3C1FCD73.F7DCB32@alcyone.com> Trond Eivind Glomsr?d wrote: > Having the best compiler for a year and a half can hardly be called a > fiasco for us - it is a problem that there were no decent official > releases to ship, though. So good, in fact, that it prompted an immediate press release from the GCC team that it was a development version, was never intended as an official release, and a recommendation not to use it. http://gcc.gnu.org/gcc-2.96.html Note that additionally, the ABI in 2.96 was different than in _both_ 2.95.x and 3.x. That's what one gets for releasing a development snapshot as if it were a true release. -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ Laws are silent in time of war. \__/ Cicero Esperanto reference / http://www.alcyone.com/max/lang/esperanto/ An Esperanto reference for English speakers. From ed_play at yahoo.co.uk Thu Dec 20 15:46:35 2001 From: ed_play at yahoo.co.uk (Ben Ainsworth) Date: 20 Dec 2001 12:46:35 -0800 Subject: Raw sockets References: <2c55c8be.0112130949.761bc120@posting.google.com> <7934d084.0112131952.2ae7c239@posting.google.com> Message-ID: <2c55c8be.0112201246.627ab31c@posting.google.com> amuys at shortech.com.au (Andrae Muys) wrote in message news:<7934d084.0112131952.2ae7c239 at posting.google.com>... > ed_play at yahoo.co.uk (Ben Ainsworth) wrote in message news:<2c55c8be.0112130949.761bc120 at posting.google.com>... > > Is there a good intro to using raw sockets with python on the web? I > > want to try writing a variant of traceroute using tcp instead of icmp. > > > > Might I suggest you first check out Stevens 'TCP/IP Illustrated Vol 1' > as it will explain in excelent detail how traceroute is built using > UDP not ICMP :). > > Andrae Muys Thanks, but on Windows traceroute is all ICMP (except DNS requests). Ben From sander at haldjas.folklore.ee Sun Dec 23 10:56:14 2001 From: sander at haldjas.folklore.ee (Sander Vesik) Date: Sun, 23 Dec 2001 15:56:14 +0000 (UTC) Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic References: Message-ID: <1009122972.599277@haldjas.folklore.ee> In comp.lang.scheme IsraelRT wrote: > On 22 Dec 2001 06:07:37 -0800, newscheme at hotmail.com (New Scheme) > wrote: >>> Or an anonymous troll who is too scared to use his real name ? >> >>You obviously didn't read David Rush's rant. Are you suffering from a >>bit of selective amnesia? > Still posting anonymously ? Oh, please! This is a totally irrelevant small detail. > Coward. It would have been nice of you to actualy refute his claims, and not just namecall. -- Sander +++ Out of cheese error +++ From gleki at gol.ge Wed Dec 12 17:30:39 2001 From: gleki at gol.ge (Giorgi Lekishvili) Date: Wed, 12 Dec 2001 14:30:39 -0800 Subject: neral networks Message-ID: <3C17DA8F.931CAE22@gol.ge> hello all! I wonder if someone could indicate on a Python-written Neural Netowork resources... Will SciPy ever contain it? Thank you, Giorgi From jblazi at hotmail.com Mon Dec 24 05:10:50 2001 From: jblazi at hotmail.com (Janos Blazi) Date: Mon, 24 Dec 2001 11:10:50 +0100 Subject: Looping constructs References: <3c25d37e_9@news.newsgroups.com> Message-ID: <3c26fefc$1_10@news.newsgroups.com> > Hmmmmm, Perl esoterica? Isn't that redundant? :) > I thought the whole point of the language was to enable > aficionados to minimize typing by using runes instead of > English-like constructs. :) I think Perl is a wonderful language. When I had to chose between Perl and Python I chose Python and I have not regretted my choice yet. But I could be happy with Perl as well. I think we should not make an issue of religion of choosing the right programming language. And I still maintain that in my eyey Perl's richness is an advantage. J.B. -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- From robin at brainexeculink.com Sat Dec 29 16:02:12 2001 From: robin at brainexeculink.com (robin at brainexeculink.com) Date: Sat, 29 Dec 2001 16:02:12 -0500 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <458b194a.0112282052.1123341@posting.google.com> Message-ID: <7$--$$_----___-$$$@news.noc.cabal.int> rcena at epcor.ca (Resty Cena) wrote: >Whichever can provide what it is that VB >developers like about VB on top of what Python and Ruby natively offer >will hit the jackpot. To me these are: (a) Visual drag-and-drop >application builder with data aware controls, and (b) good support for >the big databases (Oracle, Sybase, Informix). Yes. Snap-in database support -- not only for the big databases but for lightweight solutions as well -- makes VB popular. And it's a big reason people use PHP (to wander into another branch of this thread). Python needs standard database modules with a high degree of interface conformance -- more than what the current DB API provides. And these need to *work*. I can't tell you how much time our company wasted looking for the best PostgreSQL interface, for example. Since I'm talking databases, I wish someone with more time and brains than I would pick up the Gadfly project and bring it up to date. We need a pure Python SQL database. That too would help "sell" the language. As far as GUIs go, either Boa Constructor or something like the anygui project has the potential to be the Python "killer app". A third application domain that needs to grow in maturity and standardisation is server-side web pages. Not everyone wants to write their own framework (though I have). There should be an out-of-the-box module that easily integrates Python with Apache and takes care of most of the dirty work. Standardisation is more important than sophistication. I would love for all the brilliant Python contributors to stop right here at version 2.2 and put all their talents into these three areas. The core language is just fine, thank you. The existing modules are mostly very good. What is needed are database, gui, and web components to turn this language into a full development package. The payoff would be immense. >With VB.NET, VB >programmers will ask, "What's the point?" Might as well dive into C#. I did precisely one project in VB way back in version 2-3 days. It didn't take me very long to say "What's the point?" Then I went out and bought some C++ books. [shudder] VB is popular even though it doesn't work. PHP is popular even though it works in a small domain. But both products work "well enough". That's the key. Python does not yet work "well enough" in the most common problem domains. It requires too much wheel re-invention. ----- robin robin at brainexeculink.com (remove "brain" to reply) ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.tele.dk!small.news.tele.dk!134.75.7.11!nntp.kreonet.re.kr!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: robin at brainexeculink.com Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:27:51 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774587 27193 211.57.49.2 (31 Dec 2001 04:56:27 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:56:27 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From bokr at accessone.com Thu Dec 20 15:51:57 2001 From: bokr at accessone.com (Bengt Richter) Date: Thu, 20 Dec 2001 20:51:57 GMT Subject: age of new pythonistas [was: The Editor Poll results are in!] References: <3bfd7f87@news.airtel.net> <9u4cbu$2ts$1@news.xmission.com> <9udn1g$64c$1@brokaw.wa.com> Message-ID: <3c224f96.865756852@wa.news.verio.net> On Sun, 2 Dec 2001 09:05:52 -0800, "Alan Winston" wrote: >> it'd also be cool to see the relative age of new pythonistas -- I suspect >> that they're young, but this is completely unfounded. > >51 here. > What I wonder about is the dev group, starting with Guido and Tim ;-) From careye at spamcop.net Thu Dec 27 19:09:31 2001 From: careye at spamcop.net (Carey Evans) Date: 28 Dec 2001 13:09:31 +1300 Subject: Finding out that Python is in interactive mode in sitecustomize.py References: <3C2B8F47.4CEACF6E@olen.to> Message-ID: <87g05wgq84.fsf@psyche.dnsalias.org> Joonas Paalasmaa writes: > How can I find out that Python is started in interactive mode in > sitecustomize.py ? A search on http://groups.google.com/ for "python test interactive" comes up with this as the second result: import sys if hasattr(sys, "ps1"): # probably interactive else: # probably not interactive -- Carey Evans http://home.clear.net.nz/pages/c.evans/ From DaveP at dpawson.freeserve.co.uk Tue Dec 4 00:38:44 2001 From: DaveP at dpawson.freeserve.co.uk (Dave Pawson) Date: 4 Dec 2001 05:38:44 GMT Subject: 2.1.1 and regexp References: Message-ID: "Fredrik Lundh" wrote in news:ThUO7.736$l93.296168 @newsb.telia.net: > Dave Pawson wrote: >> Can anyone straighten me out on >> the history / future of regexp in python please. >> Present (2.1.1) documentation implies that re will be >> replaced by sre. >> http://www.python.org/doc/current/lib/module-re.html > > no, it says that the "pre" engine may go away. > > user code should use "re", unless they have a good reason > for not doing so. Now I'm even more confused :-) Trying to use the xpath part of 4suite, which uses re.compile. A new installation, 2.1.1 with xml 0.66 and 4suite 0.11.1, gives me an error compile is not an attribute of re. This works with 2.1, same versions of xml and 4suite. Any further enlightenment please Fredrik? I thought I was caught in a mid-change gap. Regards DaveP From abulka at netspace.net.au Tue Dec 25 23:45:24 2001 From: abulka at netspace.net.au (Andy Bulka) Date: 25 Dec 2001 20:45:24 -0800 Subject: urllib checks IE settings for proxy but ignores useful 'ProxyOverride' key Message-ID: <13dc97b8.0112252045.36a0697@posting.google.com> It seems that urllib.py has the smarts to look up the proxy settings in the windows registry settings that you control via the IE browser. It checks the keys 'ProxyEnable' and 'ProxyServer' (to get the actual proxy host/port value). But urllib.py does NOT have the smarts to check the key 'ProxyOverride' which has a range of tcp ip addresses to NOT use proxies on, as well as whether to bypass proxies for local addresses (the value of the key 'ProxyOverride' contains '' if this option is turned on). Surely this is an important omission and should be introduced into the next version of python? -Andy Bulka WindowWare Multimedia www.atug.com/andypatterns > Julius Welby (jwelby at waitrose.com) wrote on Date: 2001-06-07 10:52:47 PST > > At work I'm running Python 2.1 on W2k and using IE5.5 as my web browser. > > To access the web I have to go through a proxy server, which requires > authentication. > > Problem: For a particular project, I want to access URL's on our *local* > network, not on the web. > > If I have a proxy set in IE5.5, I cant use urllib.urlopen to connect to a > local resource, even though I've set IE not to use the proxy for local > addresses, and specified the servers concerned in the "Do not use proxy > server for addresses begining with:" field. (Belt and braces? Probably.) > > To sucessfully use Python to access local pages I have to turn off the "Use > proxy server" setting in IE5.5, so I can't use the web while I'm working > with Python. This is becoming more of a problem as I want to be able to run > Python based web services off my PC. > > Can anybody give me any guidance how I can stop IE5.5 settings affecting > urllib.urlopen, or even getting Python to recognise all of the settings (so > not trying to use the proxy for local URLs)? From tim at vegeta.ath.cx Fri Dec 21 17:58:16 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Fri, 21 Dec 2001 22:58:16 GMT Subject: text file References: Message-ID: friend4allin graced us by uttering: > I need some help regarding this one.I am reading contents from a > textfile and then putting the same into data structures say a list. > can any one you help me with this... If I understand you correctly, you want to populate a list with the contents of a textfile, such as one line per element of list/array? f = open('textfile', 'r') lines = f.readlines() Watch out if your textfile gets too large, though. If this isn't what you want, try giving us an example of what you have and what you want it to be afterwards. HTH Tim Hammerquist -- What about WRITING it first and rationalizing it afterwords? :-) -- Larry Wall in <8162 at jpl-devvax.JPL.NASA.GOV> From mwh at python.net Fri Dec 14 05:36:51 2001 From: mwh at python.net (Michael Hudson) Date: Fri, 14 Dec 2001 10:36:51 GMT Subject: Wrap C function which takes variable lengthed parameters? References: <6p5j1u0oag2ofkam8o7fig5dvkfc2392hk@4ax.com> <3C19990E.BE0F3FA@alcyone.com> <3C19AC0B.7ABD04DF@xs4all.nl> <1gbj1u8pm1t63ao6bjq98jlh66glf78fnu@4ax.com> Message-ID: "{-- Rot13 - Hateme" writes: > oh, I think I can change the C source to take single va_list > arguement instead of a list of variable length arguements. This is a good step :) > But still I have no idea how to construct a list of arguements > passed in from python. There are no standard function calls to > create a va_list by handle. I'm not quite sure what you are asking (probably my fault), but you might want to look at the implementation of, say, Py_BuildValue and Py_VaBuildValue in the Python source (they're in Python/modsupport.c, I think ... yup). HTH, M. -- "An infinite number of monkeys at an infinite number of keyboards could produce something like Usenet." "They could do a better job of it." -- the corollaries to Gene Spafford's Axiom #2 of Usenet From aleax at aleax.it Mon Dec 17 18:54:27 2001 From: aleax at aleax.it (Alex Martelli) Date: Mon, 17 Dec 2001 23:54:27 GMT Subject: Package Question - please help. References: Message-ID: Jason Orendorff wrote: ... >> I've added c:\package1 to the path >> (by adding it in the registy -- is there an easier way?). > > Sure. You can use the PYTHONPATH environment variable > or your Python program can modify the sys.path variable at runtime. Or, often simplest, you can put a textfile with any name, extension .pth, listing the directories you want to add to the path, one per line, in the site-packages directory on Unix-oids or the C:\Python21 (or similar) on Windows-oids. Then, site.py, which is run at each Python run unless you specifically inhibits, parses your .pth file and modifies sys.path itself. Alex From tanzer at swing.co.at Mon Dec 3 02:08:15 2001 From: tanzer at swing.co.at (Christian Tanzer) Date: Mon, 03 Dec 2001 08:08:15 +0100 Subject: Draft PEP: string interpolation with backquotes In-Reply-To: Your message of "Sun, 02 Dec 2001 17:08:05 EST." <20011202170805.A36879@hishome.net> Message-ID: Oren Tirosh wrote: > > > The expression may be any valid Python expression not containing > > > the backquote character. > > > > This is an unnecessary difference with current backtick expressions. It's > > not particularly pretty to look at, but nested backtick expressions are > > unambiguous and work fine. Artificially restricting them in this context > > would be a wart (not to mention that you couldn't reuse the compiler code > > that compiles them now). > > I am aware of this. The reason for this restriction is simplicity. > String interpolation is meant for short expressions, often just a > single name. In my proposed implementation most of the processing > occurs at the tokenizer while parsing nested backtick expressions > unambigously is a job for the parser so this keeps the implementation > simple. A possible approach I have considered is to allow nested > backticks inside interpolations as long as they are surrounded by at > least one level of parens/braces etc. The tokenizer already counts > paren levels for expressions extending across newlines. Did you consider using the $() notation instead of backticks? bash 2.x supports this and it is much easier to read (in particular when nested). It also would avoid the overloading of the backticks with two completely different meanings. Just my 2c, Christian -- Christian Tanzer tanzer at swing.co.at Glasauergasse 32 Tel: +43 1 876 62 36 A-1130 Vienna, Austria Fax: +43 1 877 66 92 From jwbaxter at spamcop.net Sat Dec 29 00:40:45 2001 From: jwbaxter at spamcop.net (John W. Baxter) Date: Fri, 28 Dec 2001 21:40:45 -0800 Subject: Two languages, too similar, competing in the same space. References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> Message-ID: <281220012140453133%jwbaxter@spamcop.net> In article , Paul Prescod wrote: > When programmers ask to write code in a scripting language, managers > will say: "You want us to write in one of those flavour-of-the-month > languages?" It seems the curse of the scripting language world to > forever fork off new languages just as older ones gain a little bit of > acceptance. My manager (the company owner) says "you want to write in something other than Python??? You better have a darn good reason." ;-) --John From claird at starbase.neosoft.com Thu Dec 27 21:38:45 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 27 Dec 2001 20:38:45 -0600 Subject: REPOST: Embeddability (was: Python Popularity: Questions and Comments) References: <3C2A9D33.67FEC261@earthlink.net> <3C2BC584.53199AD5@cti.ecp.fr> Message-ID: <3$--$$_----_-%--%$@news.noc.cabal.int> In article <3C2BC584.53199AD5 at cti.ecp.fr>, Stephane SOPPERA wrote: . . . >My question is: can ruby be also used as a scripting language for another >app (not written in ruby)? >If the answer is yes: is it used in any application? . . . Yes, and yes. I'm unable to reach any of the Web resources I know that discuss this point, but, yes, Ruby's fine for embedding and extending--quite comparable to Python, in fact. Somebody built a vim with Ruby as an extension language. There are more serious examples, even, although I can think of no specific ones just now. The regular c.l.r denizens surely can do better. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: claird at starbase.neosoft.com (Cameron Laird) Newsgroups: comp.lang.python Subject: cmsg cancel <67E54B47BD89CB93.F31156BB065B59F8.45903B6CE0C1ED74 at lp.airnews.net> Control: cancel <67E54B47BD89CB93.F31156BB065B59F8.45903B6CE0C1ED74 at lp.airnews.net> Date: Mon, 31 Dec 2001 04:01:10 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775604 27193 211.57.49.2 (31 Dec 2001 05:13:24 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:13:24 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From Bruce at EckelObjects.com Sat Dec 29 12:31:59 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Sat, 29 Dec 2001 09:31:59 -0800 Subject: Fate of win32all? In-Reply-To: <3C2BABD5.1070907@skippinet.com.au> References: <7876a8ea.0112212116.2ebabc23@posting.google.com> <3C2BABD5.1070907@skippinet.com.au> Message-ID: <200112290931590860.00340468@mail.rdc1.sdca.home.com> >Thanks to everyone who replied to this thread - I really appreciate the >supportive words. I am very sure I will land on my feet, so there is no >need to worry (now if someone would just tell that to my girlfriend :) Women are wired different -- they look to security first. I find it's easier for me if I can keep that in mind, so I can deal with their strong reactions to anything unsettling (like going independent). It would seem to me that your special abilities would make you very desirable as a consultant -- being able to do *anything* quickly and easily on Windows is always a valuable thing. >FWIW, it is this very community spirit that makes Python such a pleasure >to be involved in - so that yourselves as much as me - if not for this >spirit I would not have been here in the first place! That's one thing that makes me feel so great about Python, and to want to spend all my time here -- the community is the best I've seen. C++ was fine (I gained a great deal of understanding from years on the standards committee), but there was a lot of academic-style infighting that I had to ignore. Java has always had the Sun wall around it; I've never felt part of any community there (perhaps its because I've known Stroustrup and others on a reasonably personal basis, through the community, for many years, but Gosling and the folks at Sun have always seemed aloof. Perhaps it's something I did). But the Python folks are so great, so civilized, so international (or rather, non-national), with a tendency towards reason and thought and away from shrillness. Something happened somehow that seems to have generated a self-enlightening organism, that just draws people into it and maybe even rearranges their brains a bit. We need to bottle this and distribute it to the world at large. Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From phd at phd.pp.ru Mon Dec 17 02:47:34 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Mon, 17 Dec 2001 10:47:34 +0300 Subject: Tar for python? Better compressed file archives 'r us? In-Reply-To: <200112170639.fBH6dpk26965@bigboy.bizarsoftware.com.au>; from richard@bizarsoftware.com.au on Mon, Dec 17, 2001 at 05:40:58PM +1100 References: <200112170639.fBH6dpk26965@bigboy.bizarsoftware.com.au> Message-ID: <20011217104734.D32702@phd.pp.ru> On Mon, Dec 17, 2001 at 05:40:58PM +1100, Richard Jones wrote: > Does anyone have tar written in python? http://www.demonseed.net/~jp/code/tarfile.py Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From chrishbarker at attbi.com Thu Dec 27 14:10:07 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Thu, 27 Dec 2001 11:10:07 -0800 Subject: REPOST: Re: Efficient storage of floats References: <3c272d5e$0$202$626a54ce@news.free.fr> Message-ID: <8$--$$_----_%__-%$@news.noc.cabal.int> Francois Petitjean wrote: > > I have to read a number of points coordinates (npoints). Different > structures can be used to store these numbers: > 2. The coordinates can be stored in an array > acoords = array.array('f') This is crying out to be done with Numeric Arrays (http://sourceforge.net/projects/numpy): import Numeric: coords = Numeric.zeros((3,npoints),Numeric.Float) > Using acoords : x,y,z = acoords[3*kpt],acoords[3*kpt+1],acoords[3*kpt+2] x,y,z = acoords(n) The possible n-d arrays of Numeric make this kind of thing MUCH easier, and you will get the efficient storage you want. Numeric arrays use the same amont of storage a C array would use for the same type, plus the overhead of the Array object, which would be negligable compared to the data for a large array. Asside for that, you now have a data an object type that supports effiecent computation, wiht nice easy notation: transformed_coords = acoords * 5 to multiply all the coordanates by 5, or: transformed_coords = acoords * (x_scale, y_scale, z_scale) Etc, etc, etc. If you are working with a lot of numbers, you are crazy not to use Numeric. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Chris Barker Newsgroups: comp.lang.python Subject: cmsg cancel <3C2B720F.209C3A04 at attbi.com> Control: cancel <3C2B720F.209C3A04 at attbi.com> Date: Mon, 31 Dec 2001 02:36:31 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775672 27193 211.57.49.2 (31 Dec 2001 05:14:32 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:14:32 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From James_Althoff at i2.com Tue Dec 11 21:09:08 2001 From: James_Althoff at i2.com (James_Althoff at i2.com) Date: Tue, 11 Dec 2001 18:09:08 -0800 Subject: PEP 276 Simple Iterator for ints (fwd) Message-ID: Span: The Next Generation ... :-) Borrowing from Nick Mathewson and myself, here is another implementation of intervals that uses relational operators instead of the highly popular / and // of "span" fame. This time the class is called "ints" (as in Nick's example). Because relational operators are automatically "and-ed" together when cascaded, instances of class ints require side effects to maintain state. This means that a single instance ("span", for example) won't work. Instead, it is necessary to do ints() always. Another limitation (compared to "span") is that one-sided relational shortcuts are only partially supported. Because the magic methods for relational operators don't have leftside and rightside versions it isn't possible (unless I'm missing something) to distinguish (in the magic methods) between "ints() < 5" and "5 > ints()", for example. So to keep things simple within the bounds of this limitation, the current implementation returns (for one-sided shortcuts) [] (an empty list) except for the common cases of "ints() < n" and "ints() <= n" where n is positive. In both cases, 0 (inclusive) is the start of the interval. (Actually, "n > ints()" and "n >= ints()" do the same thing because of the limitation noted above). "Steps" are implemented using a (positive) "step" constructor argument as in "ints(step=2)", for example. This example implementation supports non-integer bounds as requested by interested posters (note to David :-). Also, this implementation doesn't use xrange and so you can do a closed interval that includes sys.maxint (by popular demand, not ;-). Examples and code are included below. (To take the next step and go from "-5 <= ints() <= 5" to "-5 <= ... <= 5" we would need syntax changes that make "..." an alternate spelling for "ints()" when used in a relational expression. I have no idea if such a thing is feasible.) Happy interval-ing, Jim =================================================== C:\>python Python 2.2b1 (#25, Oct 19 2001, 11:44:52) [MSC 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> ... after imports, etc. >>> >>> for i in -5 <= ints() <= 5: ... print i, ... -5 -4 -3 -2 -1 0 1 2 3 4 5 >>> >>> for i in -5 < ints() < 5: ... print i, ... -4 -3 -2 -1 0 1 2 3 4 >>> >>> for i in 5 >= ints() >= -5: ... print i, ... 5 4 3 2 1 0 -1 -2 -3 -4 -5 >>> >>> for i in ints() < 5: ... print i, ... 0 1 2 3 4 >>> >>> for i in -5 <= ints(step=2) <= 5: ... print i, ... -5 -3 -1 1 3 5 >>> >>> for i in -4.5 < ints() < 4.5: ... print i, ... -4 -3 -2 -1 0 1 2 3 4 >>> >>> for i in 4.0 >= ints(step=2) >= -4.0: ... print i, ... 4 2 0 -2 -4 >>> >>> for i in ints() < 4.5: ... print i, ... 0 1 2 3 4 >>> >>> import sys >>> >>> for i in sys.maxint - 2 <= ints() <= sys.maxint: ... print i, ... 2147483645 2147483646 2147483647 >>> ... test examples >>> runtests() passed: 1 -5 <= ints() <= 5 [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5] passed: 1 -5 <= ints() < 5 [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4] passed: 1 -5 < ints() < 5 [-4, -3, -2, -1, 0, 1, 2, 3, 4] passed: 1 -5 < ints() <= 5 [-4, -3, -2, -1, 0, 1, 2, 3, 4, 5] passed: 1 5 >= ints() >= -5 [5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5] passed: 1 5 >= ints() > -5 [5, 4, 3, 2, 1, 0, -1, -2, -3, -4] passed: 1 5 > ints() > -5 [4, 3, 2, 1, 0, -1, -2, -3, -4] passed: 1 5 > ints() >= -5 [4, 3, 2, 1, 0, -1, -2, -3, -4, -5] passed: 1 -5 <= ints(step=2) <= 5 [-5, -3, -1, 1, 3, 5] passed: 1 -5 <= ints(step=2) < 5 [-5, -3, -1, 1, 3] passed: 1 -5 < ints(step=2) < 5 [-4, -2, 0, 2, 4] passed: 1 -5 < ints(step=2) <= 5 [-4, -2, 0, 2, 4] passed: 1 5 >= ints(step=2) >= -5 [5, 3, 1, -1, -3, -5] passed: 1 5 >= ints(step=2) > -5 [5, 3, 1, -1, -3] passed: 1 5 > ints(step=2) > -5 [4, 2, 0, -2, -4] passed: 1 5 > ints(step=2) >= -5 [4, 2, 0, -2, -4] passed: 1 ints() <= 5 [0, 1, 2, 3, 4, 5] passed: 1 ints() < 5 [0, 1, 2, 3, 4] passed: 1 5 >= ints() [0, 1, 2, 3, 4, 5] passed: 1 5 > ints() [0, 1, 2, 3, 4] passed: 1 ints() >= 5 [] passed: 1 ints() > 5 [] passed: 1 5 <= ints() [] passed: 1 5 < ints() [] passed: 1 ints() <= -5 [] passed: 1 ints() < -5 [] passed: 1 ints() >= -5 [] passed: 1 ints() > -5 [] passed: 1 -5 <= ints() [] passed: 1 -5 < ints() [] passed: 1 -5 >= ints() [] passed: 1 -5 > ints() [] passed: 1 sys.maxint-1 < ints() <= sys.maxint [2147483647] passed: 1 1.5 <= ints() <= 4.5 [2, 3, 4] passed: 1 1.5 <= ints() < 4.5 [2, 3, 4] passed: 1 1.5 < ints() < 4.5 [2, 3, 4] passed: 1 1.5 < ints() <= 4.5 [2, 3, 4] passed: 1 1.0 <= ints() <= 4.0 [1, 2, 3, 4] passed: 1 1.0 <= ints() < 4.0 [1, 2, 3] passed: 1 1.0 < ints() < 4.0 [2, 3] passed: 1 1.0 < ints() <= 4.0 [2, 3, 4] passed: 1 -4.5 <= ints() <= -1.5 [-4, -3, -2] passed: 1 -4.5 <= ints() < -1.5 [-4, -3, -2] passed: 1 -4.5 < ints() < -1.5 [-4, -3, -2] passed: 1 -4.5 < ints() <= -1.5 [-4, -3, -2] passed: 1 -4.0 <= ints() <= -1.0 [-4, -3, -2, -1] passed: 1 -4.0 <= ints() < -1.0 [-4, -3, -2] passed: 1 -4.0 < ints() < -1.0 [-3, -2] passed: 1 -4.0 < ints() <= -1.0 [-3, -2, -1] passed: 1 ints() <= 4.5 [0, 1, 2, 3, 4] passed: 1 ints() < 4.5 [0, 1, 2, 3, 4] passed: 1 ints() <= 4.0 [0, 1, 2, 3, 4] passed: 1 ints() < 4.0 [0, 1, 2, 3] passed: 1 ints() > 4.5 [] passed: 1 4.5 < ints() [] ================================================= # Example implementation for Python 2.2: from __future__ import generators from math import floor,ceil class ints: import operator testDict = { # i is in interval if this test is true (1,0):operator.__lt__, # up == 1, upperClosed == 0 (1,1):operator.__le__, # up == 1, upperClosed == 1 (0,0):operator.__gt__, # up == 0, lowerClosed == 0 (0,1):operator.__ge__} # up == 0, lowerClosed == 1 def __init__(self,step=None): if step is not None and step <= 0: raise ValueError self.step = step # None or integer > 0 self.lower = None # lower bound of interval self.lowerClosed = None # 1: yes, 0: no self.upper = None # upper bound of interval self.upperClosed = None # 1: yes, 0: no self.up = None # 1: increasing interval, 0: decreasing interval def __iter__(self): '''return an iterator that generates integers in the interval.''' if self.upper is None: return # interval is [] if no upper bound specified start,stop,delta,test = self.getBounds() # delta is positive or negative i = start while 1: if not test(i,stop): break yield i i += delta def getBounds(self): lower = self.lower upper = self.upper lowerClosed = self.lowerClosed upperClosed = self.upperClosed up = self.up delta = self.step # fill in missing data if delta is None: delta = 1 if lower is None: lower = 0 up = 1 if lowerClosed is None: lowerClosed = 1 if up is None: up = 1 if up: start = lower floorStart = floor(start) if not (floorStart == start and lowerClosed): start = floorStart + 1 stop = upper test = self.testDict[up,upperClosed] else: start = upper ceilStart = ceil(start) if not (ceilStart == start and upperClosed): start = ceilStart - 1 stop = lower delta = -delta test = self.testDict[up,lowerClosed] start = int(start) return start,stop,delta,test def __lt__(self,n): self.upper = n self.upperClosed = 0 if self.up is None: self.up = 0 # on first encounter, assume decreasing return self def __le__(self,n): self.upper = n self.upperClosed = 1 if self.up is None: self.up = 0 # on first encounter, assume decreasing return self def __gt__(self,n): self.lower = n self.lowerClosed = 0 if self.up is None: self.up = 1 # on first encounter, assume increasing return self def __ge__(self,n): self.lower = n self.lowerClosed = 1 if self.up is None: self.up = 1 # on first encounter, assume increasing return self def __nonzero__(self): return 1 # force evaluation of both sides of two-way relationals #$ Testing def test(testItem): import sys interval = eval(testItem[0],globals(),{'sys':sys}) result = list(interval) == testItem[1] print 'passed:', result, '', testItem[0], ' ', list(interval) if not result: print interval print list(interval) print testItem[1] def runtests(): import sys testList = [ ('-5 <= ints() <= 5', range(-5,6)), ('-5 <= ints() < 5', range(-5,5)), ('-5 < ints() < 5', range(-4,5)), ('-5 < ints() <= 5', range(-4,6)), (' 5 >= ints() >= -5', range(5,-6,-1)), (' 5 >= ints() > -5', range(5,-5,-1)), (' 5 > ints() > -5', range(4,-5,-1)), (' 5 > ints() >= -5', range(4,-6,-1)), ('-5 <= ints(step=2) <= 5', range(-5,6,2)), ('-5 <= ints(step=2) < 5', range(-5,5,2)), ('-5 < ints(step=2) < 5', range(-4,5,2)), ('-5 < ints(step=2) <= 5', range(-4,6,2)), (' 5 >= ints(step=2) >= -5', range(5,-6,-2)), (' 5 >= ints(step=2) > -5', range(5,-5,-2)), (' 5 > ints(step=2) > -5', range(4,-5,-2)), (' 5 > ints(step=2) >= -5', range(4,-6,-2)), ('ints() <= 5', range(0,6)), ('ints() < 5', range(0,5)), ('5 >= ints()', range(0,6)), ('5 > ints()', range(0,5)), ('ints() >= 5', []), ('ints() > 5', []), ('5 <= ints()', []), ('5 < ints()', []), ('ints() <= -5', []), ('ints() < -5', []), ('ints() >= -5', []), ('ints() > -5', []), ('-5 <= ints()', []), ('-5 < ints()', []), ('-5 >= ints()', []), ('-5 > ints()', []), ('sys.maxint-1 < ints() <= sys.maxint', [sys.maxint]), ('1.5 <= ints() <= 4.5', [2,3,4]), ('1.5 <= ints() < 4.5', [2,3,4]), ('1.5 < ints() < 4.5', [2,3,4]), ('1.5 < ints() <= 4.5', [2,3,4]), ('1.0 <= ints() <= 4.0', [1,2,3,4]), ('1.0 <= ints() < 4.0', [1,2,3]), ('1.0 < ints() < 4.0', [2,3]), ('1.0 < ints() <= 4.0', [2,3,4]), ('-4.5 <= ints() <= -1.5', [-4,-3,-2]), ('-4.5 <= ints() < -1.5', [-4,-3,-2]), ('-4.5 < ints() < -1.5', [-4,-3,-2]), ('-4.5 < ints() <= -1.5', [-4,-3,-2]), ('-4.0 <= ints() <= -1.0', [-4,-3,-2,-1]), ('-4.0 <= ints() < -1.0', [-4,-3,-2]), ('-4.0 < ints() < -1.0', [-3,-2]), ('-4.0 < ints() <= -1.0', [-3,-2,-1]), ('ints() <= 4.5', [0,1,2,3,4]), ('ints() < 4.5', [0,1,2,3,4]), ('ints() <= 4.0', [0,1,2,3,4]), ('ints() < 4.0', [0,1,2,3]), ('ints() > 4.5', []), ('4.5 < ints()', []), ] print for testItem in testList: test(testItem) print From phr-n2001d at nightsong.com Wed Dec 12 13:49:07 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 12 Dec 2001 10:49:07 -0800 Subject: lost interest? References: <20011208001123.A5989@casa.parque> <3C14FEBD.AD52B516@attbi.com> Message-ID: <7xn10oz330.fsf@ruckus.brouhaha.com> Chris Barker writes: > A big problem I have seen is people not wanting to use exactly the > module they really nedd because it is "not part of the standard > distirubion". If it was a whole lot easier to find, get and install > third-party packages, perhaps this concern would go away. No, not really. It's annoying to to have to install any 3rd party package no matter how easy it is, plus it's a security risk. I try to avoid depending on any 3rd party modules if I possibly can. I really dislike the way so many Perl applications depend on CPAN stuff. One of Python's selling points is "batteries included", which means NOT having to depend on 3rd party modules. From sdm7g at Virginia.EDU Mon Dec 10 10:34:39 2001 From: sdm7g at Virginia.EDU (Steven Majewski) Date: Mon, 10 Dec 2001 10:34:39 -0500 (EST) Subject: Calling a generator multiple times In-Reply-To: Message-ID: On Sun, 9 Dec 2001, Tim Peters wrote: > [Steven Majewski] > > ... > > Generators, functions and methods are just slight variations on each > > other. > > Absolutely. People should consider *all* callable objects in 2.2 to be > generators -- it's just that if the body doesn't contain "yield", then the > language helpfully calls .next() once for you by magic . > Well, I know I don't have to tell Tim that, semantically speaking, functions and subroutines are just a specialized subcase of semi-coroutines (which are a specialized case of coroutines). -- Steve Majewski From j.barelds at good-it.com Tue Dec 11 16:17:35 2001 From: j.barelds at good-it.com (Johan Barelds) Date: Tue, 11 Dec 2001 22:17:35 +0100 Subject: Help newbie! Message-ID: <9v5t5g$sp2$1@news.hccnet.nl> Hi, I am playing around with Python and when i want to do the "replace" command i get the following output: ====================================================================== >>> replace("hello","hel","hol") Traceback (most recent call last): File "", line 1, in ? NameError: name 'replace' is not defined ======================================================================== What do i have to do to get the command "replace" working? Thanks! -- Kind Regards / Met vriendelijke groet, Johan Barelds From mcfletch at rogers.com Fri Dec 7 15:12:17 2001 From: mcfletch at rogers.com (Mike C. Fletcher) Date: Fri, 07 Dec 2001 15:12:17 -0500 Subject: Multi-isinstance idiom (Re: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)) References: <3C0EAEBF.61858076@cosc.canterbury.ac.nz> Message-ID: <3C1122A1.9090609@rogers.com> The lambda form would be slow (extra function call overhead for each call, and it _always_ does every check, so never short-circuits once it knows the answer is true). Same basic problem with the list comprehension, modulo the overhead of the function call (i.e. no short-circuiting). AFAIK, list comprehensions are basically just syntactic sugar around regular loops, so they aren't likely any faster than a for loop. If that's changed, it would be good to know. Enjoy, Mike Brian McErlean wrote: > "Mike C. Fletcher" wrote in message news:... > >>That doesn't seem to keep the semantics, it only works if the tested >>class is an actual sub-class of your combination class, not if it's a >>child of just one of the parents (that is, it's an "and" test with an >>extra class added as well). If you want an or test, how about: >> >>try: >> raise f >>except (future.Step, yada, yada): >> blah >>except: >> stuffWhenNotSubClass >> >>Problem is that it's nothing like intuitive, an explicit function like: >> >>def ismultiinstance( test, classes ): >> for classObject in classes: >> if isinstance( test, classObject): >> return 1 >> return 0 >> >>Would be much easier to read, though not very computationally efficient >>(extra function call, loop overhead) compared to letting the C exception >>machinery handle the project. >> >> > > Since an empty list is false, how about: > > classes = [future.Step, future.Status, future.Announce, > possibility.Observe, future.Incarnate, future.Start] > > if filter(lambda c,test=test: isinstance(test,c), classes): > # body > > It should be reasonably fast, since the actual looping is in C, though its > probably ugly enough that you should still put it in its own ismultiinstance > function. > Alternatively the list comprehension equivalent: > > if [c for c in classes if isinstance(test,c)]: > # do something. > > > Brian McErlean. > -- _______________________________________ Mike C. Fletcher http://members.rogers.com/mcfletch/ From claird at starbase.neosoft.com Thu Dec 27 21:38:45 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 27 Dec 2001 20:38:45 -0600 Subject: Embeddability (was: Python Popularity: Questions and Comments) References: <3C2A9D33.67FEC261@earthlink.net> <3C2BC584.53199AD5@cti.ecp.fr> Message-ID: <67E54B47BD89CB93.F31156BB065B59F8.45903B6CE0C1ED74@lp.airnews.net> In article <3C2BC584.53199AD5 at cti.ecp.fr>, Stephane SOPPERA wrote: . . . >My question is: can ruby be also used as a scripting language for another >app (not written in ruby)? >If the answer is yes: is it used in any application? . . . Yes, and yes. I'm unable to reach any of the Web resources I know that discuss this point, but, yes, Ruby's fine for embedding and extending--quite comparable to Python, in fact. Somebody built a vim with Ruby as an extension language. There are more serious examples, even, although I can think of no specific ones just now. The regular c.l.r denizens surely can do better. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From logiplexsoftware at earthlink.net Sun Dec 23 00:02:48 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Sat, 22 Dec 2001 21:02:48 -0800 Subject: Fate of win32all? In-Reply-To: <3C242A7F.2060805@skippinet.com.au> References: <7876a8ea.0112212116.2ebabc23@posting.google.com> <3C242A7F.2060805@skippinet.com.au> Message-ID: <20011222210248.1e4ae96e.logiplexsoftware@earthlink.net> On Sat, 22 Dec 2001 06:38:49 GMT Mark Hammond wrote: > Unfortunately, I am no longer employed by ActiveState :( I suppose thank-you's are no substitute for a paycheck, but nevertheless: Thank you very much for your contributions to Python. Your Win32 extensions are what make it possible in many cases to say "yes, Python can do that" on the Windows platform. Good luck and Merry Christmas. -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From shalehperry at attbi.com Mon Dec 24 22:49:31 2001 From: shalehperry at attbi.com (Sean 'Shaleh' Perry) Date: Mon, 24 Dec 2001 19:49:31 -0800 (PST) Subject: [OT] Quantum Python (Re: Properties fun with 2.2) In-Reply-To: <3C27CFC0.5AB401F7@geneva-link.ch> Message-ID: On 25-Dec-2001 Boris Borcic wrote: > Yeah, (takes a palm-reader tone) I see very exotic species > of properties germinating in many a pythoneer's mind. > > I for one would try to sell python to a new niche market, > in mathematics... we'd just describe a new "style" of mathematical > gadgets, all dying to get classified by life-long experts, > and best modelled by arcane python properties ;-) > > In any case, an example toy-modelling Heisenberg's uncertainty > principle looks like a must. Rules over the consistency > of value mimicking the behavior of complementary > QM observables before enchanted student eyes... > Have you looked at the Quantum modules for perl? It would be interesting to see them implemented in python. From phd at phd.pp.ru Fri Dec 21 11:10:47 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Fri, 21 Dec 2001 19:10:47 +0300 Subject: ANN: eGenix.com mx BASE Extension Package 2.0.3 In-Reply-To: <3C235C5E.C4E2BB12@astro.cornell.edu>; from loredo@astro.cornell.edu on Fri, Dec 21, 2001 at 10:59:26AM -0500 References: <3C235C5E.C4E2BB12@astro.cornell.edu> Message-ID: <20011221191047.P8259@phd.pp.ru> On Fri, Dec 21, 2001 at 10:59:26AM -0500, Tom Loredo wrote: > A dumb question I've long wondered about: What does the "mx" stand for > in the various mx packages? The author's name is Marc-Andre. mx = "Marc's eXtensions". Just so simple. But what are "kj" and "kw" in kjBuckets and kwParsing (by Aaron Watters) is much more hard to guess. To the direct question Aaron replied "It is something for me to know and for you to guess" :) Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From ol1 at v10a.com Tue Dec 18 05:54:32 2001 From: ol1 at v10a.com (o polite) Date: Tue, 18 Dec 2001 11:54:32 +0100 Subject: pymacs and rlcompleter Message-ID: <200112181235.fBICZd706819@relay.wineasy.se> I miss a couple of things in emacs python-mode. 1) Folding a la pythonwin, scite 2) command completion a al rlcompleter, pythonwin, scite Any hope of getting these functions with the promising pymacs? -- o polite From timr at probo.com Thu Dec 20 01:03:14 2001 From: timr at probo.com (Tim Roberts) Date: Wed, 19 Dec 2001 22:03:14 -0800 Subject: Bitwise manipulation on python References: <9f8911e3.0112121523.32df6bb4@posting.google.com> Message-ID: smilenic at cheerful.com (nicole) wrote: > >I am a newbie to python. >I was trying to do a xor bitwise on python using ^. >However, it seem to show the correct thing when I do 101 ^ 011 = 110 >but when i do 1101 ^ 1111, it returns 26. >Can anyone explain why this is happening? >Am i using the function correctly? >I am trying to xor two binary numbers. That may be what you are TRYING to do, but what you're ACTUALLY doing is xoring two DECIMAL numbers. Integer constants in Python, as with virtually every language in the world, are decimal. 1,101 decimal xored with 1,111 decimal equals 26 decimal. The fact that 101 ^ 011 = 110 happens to be true in decimal as well as binary is just a cruel joke that the universe is playing on you. Next, try reducing the fraction 16 / 64 by cancelling out the 6s. -- - Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From sholden at holdenweb.com Wed Dec 19 09:34:54 2001 From: sholden at holdenweb.com (Steve Holden) Date: Wed, 19 Dec 2001 09:34:54 -0500 Subject: Tkinter+ backspace characters (and an re.sub problem) References: <3c202041$1_6@goliath.newsgroups.com> Message-ID: "David Mallwitz" wrote in message news:3c202041$1_6 at goliath.newsgroups.com... > Hello group, > The Tkinter Text widget doesn't understand '\b' or '\x08' as the > backspace character when sent a string containing either of them. Nor does > it understand '^H' as a substitute for '\b'. > I've done some googling, but haven't found a solution other than doing a > regexp sub on the string before sending it to the text widget. That seemed > like a good idea, but I'm not able to construct the regexp in a way that > will handle stacked backspace characters. > Any ideas on how to tell the widget to process a backspace? Or on how to > construct an RE that will match multiple '\b's? > > For example: > >>>string = 'all work and no play makes Jack\x08\x08\x08\x08Dave a dull boy' > >>> print string ###this works as you would expect it to > all work and no play makes Dave a dull boy > >>>root = Tk() > >>>text = Text(root) > >>>text.pack() > >>>text.insert(END, string) > ### prints 'all work and no play makes Jack||||Dave a dull boy' on the > widget > >>>a = re.compile('.\x08') > >>> a.sub('', string) ###fails - would have thought there should be 3 > '\x08's left, or none at all > 'all work and no play makes Jac\x08Dave a dull boy' > >>> David: If I understand you correctly, you are expecting the Text widget to respond to data values in the same way as it would respond to keyboard events. This isn't likely to happen, so you are left with having to do the preocessing yourself. If, on the other hand, you are saying that the backspace KEY isn't being actioned then there would seem to be a fundamental problem with your Tkinter installation (I know it works for me). If the former case is what applies, where are these characters coming from? Given that Tkinter is a GUI, why are you processing keystrokes from elsewhere? regards Steve -- http://www.holdenweb.com/ From oren-py-l at hishome.net Sat Dec 8 07:31:57 2001 From: oren-py-l at hishome.net (Oren Tirosh) Date: Sat, 8 Dec 2001 07:31:57 -0500 Subject: Calling a generator multiple times In-Reply-To: ; from jkraska@san.rr.com on Fri, Dec 07, 2001 at 01:20:42AM +0000 References: <200112061113290670.0100F457@mail.rdc1.sdca.home.com> <3C10135D.C101176A@cosc.canterbury.ac.nz> Message-ID: <20011208073157.C77659@hishome.net> On Fri, Dec 07, 2001 at 01:20:42AM +0000, Courageous wrote: > After I posted my message, it occured to me that I wasn't > addressing a key part of the semantics, namely the ability > for multiple consumers to generate the generator multiple > times. The problem with a generic restartable generator is what to do about any arguments to the generator function. If you want the consumer to be able to blindly iter() your generator as if it were a list or any other container you must pack your arguments along. Here's a functor object for doing that: class xiter: def __init__(self, func, *args): self.func = func self.args = args def __iter__(self): return self.func(*self.args) Notes: The resulting object behaves like a container: it has an __iter__ method with no arguments that may be called multiple times, returning independent iterators of the same source. If the underlying function uses only its arguments and does not modify them these iterators should step through the same sequence. This is not specific to generator functions. It can work with any function that returns an iterator. Why xiter? This is inspired by xrange and xreadlines. They are iterable objects that act as a deferred-execution version of a function with the same name sans the 'x'. In the case of xreadlines the analogy isn't perfect. The function xreadlines.xreadlines is started with __call__, not __iter__ so it does not emulate a container. Since it takes no arguments it could have been an object's __iter__ method and that object would then behave as a container. An xrange object emulates a container correctly - it can produce multiple, independent iterators of itself. Oren From usenet at NOSPAM-irmen.cjb.net Sat Dec 22 13:41:26 2001 From: usenet at NOSPAM-irmen.cjb.net (Irmen de Jong) Date: Sat, 22 Dec 2001 19:41:26 +0100 Subject: Platform-independent GUID creation? References: <9vtn13$aq9$1@panix3.panix.com> Message-ID: "Aahz Maruch" wrote in message news:a029l8$ctn$1 at panix3.panix.com... > Nice try. (That's partly serious, partly sarcasm.) It probably works > for limited applications, but it's definitely not a guaranteed GUID. > One of the big problems with your method is that the widespread adoption > of NAT combined with excessive use of "private" IP addresses means that > there's a lot of IP address duplication out there. Yes, I realised that. But it had to be portable. So I took the IP address, the process ID and a random number. There's no guarantee here (certainly not!) that the number is unique, but the chances are pretty slim that you get an identical number. I don't have a better solution. If anybody has a better (Pythonic) GUID generator, I'd be very interested. Regards Irmen de Jong From wex at flarg.com Fri Dec 21 16:18:01 2001 From: wex at flarg.com (Daniel Wexler) Date: Fri, 21 Dec 2001 21:18:01 GMT Subject: distutils problem with interdependent modules Message-ID: I have a moderately complex set of C extension modules that have interdependencies in the C code. I have this system compiling and working as separate modules (i.e.. not a package) with my own makefile system. It compiles and runs perfectly on both Linux and Windows. I am having difficulty in setting up the proper linking as I convert to a package format using distutils. Here's a simplified description of the problem: C1, C2 - two pure C libraries (i.e.. not Python extensions) P1, P2 - two C extension modules C2 requires functions in C1 P1 requires functions in C2 P2 requires functions in P1 and C1 In my current, working, makefile (and VC++ project file) system, when I build the .so for C2, I add a hardcoded path to the C1 DSO using something like this: ld -shared --whole-archive C2.a /usr/local/lib/flarg/C1.so -o C2.so It sucks having to use a hardcoded path since you cannot really build and install very well. This is because on Linux, the LD_LIBRARY_PATH is only used to find libraries that use the file name format: "libfoo.so", or in my case "libC1.so" rather than just "C1.so". The same sort of problem happens when I try to link the other C extension modules, since they also have to specify the pure C and other C extension modules on the link line. The naming problem might not be so bad for my pure C libraries, but it seems strange, and actually against the distutils naming scheme, to import a Python C extension using "import libfoo" as opposed to "import foo", right? Are there any examples of a Python C extension package with interdependent modules that I can look at? I have the beginnings of a setup.py file that correctly finds all the files but has trouble building. I start by manually compiling the two pure C libraries using 'os.system("make -C lib/C2")' and then let the setup() function take over afterwards. It seems to start building my first python C extension correctly, but I'm having trouble with the link step. Specifically, I don't know how I should properly reference the dependent libraries. For example, if I use the "extra_objects" keyword, then I have to put in an extension (contrary to what the documentation says, which I don't understand) like this: extra_objects=["lib/C1/C1.so", "lib/C2/C2.so"] The documentation indicates I should leave off the .so, but when I do it doesn't append .so on the link line (I haven't tried it in Windows yet). Instead, I guess I can rename my modules using the "libC1" prefix, which then allows me to use the "libraries" and "library_dirs" keywords. I'm just about to try that out, but I thought I'd check around on the newsgroups to see if this has been addressed first. A separate questions is regarding the package_dir option and how it affects the file names used in the Extension() constructor. The documentation lead me to believe that if I had this: package_dir = {'parc' : 'lib'}, packages = ['parc', 'parc.P1', 'parc.P2'], Then my extension files should live in /lib/{P1,P2}, and I would expect to use just the local file name in the Extension() constructor, but instead I find that I have to put the entire path to the source file like this: ext_modules = [Extension("parc.P1", ["lib/P1/foo.c", "lib/P1/bar.c"])] Thanks for any help, Daniel Wexler wex at flarg.com From rumjuggler at cryptarchy.org Sat Dec 22 19:10:50 2001 From: rumjuggler at cryptarchy.org (Ben Wolfson) Date: Sun, 23 Dec 2001 00:10:50 GMT Subject: sys.excepthook and syntax errors Message-ID: Occasionally when I'm in the python prompt and want to change working directories, I forget where I am and type "cd whatever" instead of "os.chdir(whatever)". Obviously this doesn't work. So I tried overriding sys.excepthook so that when I did try the former, it would have the same effect as the latter, but would otherwise report the error correctly. To my surprise, it still wouldn't work most of the time. That is, I could do this: >>> cd whatever File "", line 1 cd whatever ^ SyntaxError: invalid syntax >>> and it didn't seem that sys.excepthook was called at all. This, however, worked fine: >>> exec "cd whatever" >>> I can understand why sys.excepthook wouldn't get called for syntax errors when running python non-interactively, but it seems that it should be possible for interactive use. -- Barnabas T. Rumjuggler You're going to set me up as a kind of slovenly attached pig that Jack Kornfeld can slice down in his violent zen compassion? -- Larry Block From jkraska at san.rr.com Fri Dec 28 13:16:44 2001 From: jkraska at san.rr.com (Courageous) Date: Fri, 28 Dec 2001 18:16:44 GMT Subject: REPOST: Re: [Q] Deepcopy with Python 2.2 ? References: <440c5c6a.0112280847.55c92de7@posting.google.com> Message-ID: <0$--$$_-----$%%-$$@news.noc.cabal.int> >Any help would be appreciated! Use the source, Luke. C// ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Courageous Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:44:40 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775164 27193 211.57.49.2 (31 Dec 2001 05:06:04 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:06:04 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From gat at jpl.nasa.gov Sat Dec 1 02:06:16 2001 From: gat at jpl.nasa.gov (Erann Gat) Date: Fri, 30 Nov 2001 23:06:16 -0800 Subject: A modest indentation proposal References: <3C0773C2.A12D0BAC@pacific.net.hk> Message-ID: In article , "Steve Holden" wrote: > Perhaps it wouldn't be "illegal". I think the point was that there may well > be existing Python programs which are currently syntactically correct whose > meaning would be altered by the adoption of your rule. If under present > syntax I write > > def a(x,y): > stm1 > stm2 > stm3; > > this is currently legal Python in which stm3 is not a part of the function > body. Would your rule treat this as a syntax error, or observe the > indentation and accept it? Or something else? It would, if the 'activate-paranoid-indentation-mode' flag were enabled, signal a syntax error, or if that's unacceptable, issue a warning, e.g. "Warning: the block structure defined by indentation does not match that implied by punctuation. Check your indentation." Or something like that. BTW, I am assuming that there's not a huge installed base of Python code with trailing semicolons (since they're useless at the moment). E. From max at alcyone.com Fri Dec 7 03:34:30 2001 From: max at alcyone.com (Erik Max Francis) Date: Fri, 07 Dec 2001 00:34:30 -0800 Subject: strict python? References: <3C1060E4.756F33B2@earthlink.net> <3C107172.6866DC18@alcyone.com> <9ups92$ers$1@peabody.colorado.edu> <3C10776C.8BB710EF@alcyone.com> <9upu2a$g4v$1@peabody.colorado.edu> Message-ID: <3C107F16.A9032BE8@alcyone.com> Fernando P?rez wrote: > While on the topic of pychecker, I've been a bit disappointed. Not > meaning to demerit the developers, I'm sure it's been a ton of hard > work, but when I've used it I tend to get way too many spurious > warnings and very little substance. Well, maybe I just don't know how > to use it well, I really haven't looked at it in detail. I've seen a fair number. I've seen it improving with time, however. -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ Laws are silent in time of war. \__/ Cicero Esperanto reference / http://www.alcyone.com/max/lang/esperanto/ An Esperanto reference for English speakers. From aleax at aleax.it Fri Dec 28 10:04:32 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 16:04:32 +0100 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <5$--$$_----_---$_$@news.noc.cabal.int> "Fredrik Juhlin" wrote in message news:mailman.1009544733.30338.python-list at python.org... > On Fri, Dec 28, 2001 at 12:27:35PM +0100, Alex Martelli wrote: > > "Steve Lamb" wrote in message > > news:slrna2nhfo.nme.grey at teleute.dmiyu.org... > > > On Thu, 27 Dec 2001 17:48:13 +0000, phil hunt > > > > > wrote: > > > > Python runs quickly on my 300 MHz box, which is 3 times slower > > > > than the slowest PC you can buy today. It can only get more popular. > > > > > > Well, if you take the measure of just pure Mhz.... 4 times slower. ;) > > > > FIVE or more. 1.5 GHz desktop machines are hardly news these days. > I'm afraid you missed the word "slowest" in the original statement, Alex :) Ooops yes -- so did Steve, I think. You CAN still buy PCs whose CPU's are claimed to run at 900 MHz *AND LESS* (so even the "3 times" in the OP was incorrect:-). Alex ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Alex Martelli" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:23:41 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775324 27193 211.57.49.2 (31 Dec 2001 05:08:44 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:08:44 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From cmkleffner at gmx.de Thu Dec 6 09:50:49 2001 From: cmkleffner at gmx.de (cmkl) Date: 6 Dec 2001 06:50:49 -0800 Subject: pyrepl-0.6 References: Message-ID: <3b091a1c.0112060650.1f185978@posting.google.com> Really cool, during development I'm able to put several lines with pyrepl.python_reader.ReaderConsole(vars(), 0, None).interact() within the code, even inside functions! All I need is 'import pyrepl.python_reader' at the beginnig of the module. Now I can estimate the state of the programm interactivly within the scope of the function - break pyrepl with CTRL - proceed with the script and take a break at the next line with pyrepl.... Some kind of debugging with hardcoded breakpoints or 'debbuging for dummies'. This is the thing I was looking for! Carl Neil Schemenauer wrote in message news:... > Michael Hudson wrote: > > This is pyrepl 0.6, a readline-a-like for Python, which seems to be > > being released on 2001-11-27. > ... > > * sane multi-line editing > > This is cool. We have a little script that we use to interact with our > object database (ZODB). It's used to do ad hoc queries or maintenance > on the database. Usually we run it with "python -i". I installed the > files in the pyrepl distribution in site-packages and added a > __init__.py in order to make it a package. Next, I added the following > lines to the end of the script: > > from pyrepl.python_reader import ReaderConsole > ReaderConsole(globals(), 0, None).interact() > > It works great. Thanks Michael. > > Neil From chrishbarker at attbi.com Wed Dec 12 13:09:20 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Wed, 12 Dec 2001 10:09:20 -0800 Subject: lost interest? References: <20011208001123.A5989@casa.parque> <9v5enr079j@enews4.newsguy.com> <15382.20257.107891.262699@12-248-41-177.client.attbi.com> Message-ID: <3C179D50.35EA16A4@attbi.com> Alex Martelli wrote: > To me, it suggests something different: that authors are duplicating > functionality or doing without it rather than reusing, say, mx.DateTime or > other packages offering low-level, reusable functionality -- because nobody > wants their distributed packages to be harder to install and use, and > therefore less frequently used, by requiring dependencies on others without > a cpan-ish infrastructure in place. I absolutely agree. I make a point of following discussions related to Numeric on this list, and in the last few months there have been MANY discussions that went something like this: OP: What is the best way to multiply all the elements of a long list of numbers by all the elements of another long list of numbers? Me (or someone else) Use Numeric. OP: I don't want my users to have to install a separate package ME: It's really not that big a deal, and you can distribute it with your app. OP: I really only want to use the standard lib. Besides, Numeric seems overkill for what I want to do. So is map or list comprehensions a better way to do this? By the way, I also need to take the sine of all those numbers, and I may have to work with 2-d arrays in the future. ME: Then you really, really, want Numeric OP: I need this code to run on various machines that are centrally administered, I can't install Numeric on all of them and the sysadmins are not willing to do it for me... etc, etc, etc. Fill in similar conversations for PIL, mxDatetime, wxPython, etc. This really is an issue! Another example is tkPlotCanvas. It was originally written using Numeric (which makes lots of sense) and I have seem various versions that have been adapted to "not require Numeric". This is sad for me. Note: There are movements affoot to get both a decent DateTime package into the lib, and Numeric2, but even if this happens, there will be many other very useful packages that will never make it inot the standard lib. > I'm ready to bet a good lunch at Bologna's best restaurant, > wine included, that dependencies will become much more common, i.e., that > reuse will indeed have been encouraged. There's no way I'm taking that bet! Unless maybe you'll cover airfare to Italy as well :-) -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From fredrik at pythonware.com Fri Dec 21 11:28:20 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 21 Dec 2001 16:28:20 GMT Subject: Platform-independent GUID creation? References: <9vtn13$aq9$1@panix3.panix.com> Message-ID: Aahz Maruch wrote: > The problem is that the DCE/OSF GUID standard specifies using the MAC > address of the network card as part of a GUID. There isn't a portable > way to get that, unfortunately. or luckily, if you look at it from a security/privacy perspective. From fbartlet at optonline.net Fri Dec 28 20:44:16 2001 From: fbartlet at optonline.net (Frederick H. Bartlett) Date: Sat, 29 Dec 2001 01:44:16 GMT Subject: printing from Word using win32com Message-ID: <3C2D2007.AD251D51@optonline.net> How do I get rid of the UnicodeError in something = myWord.ActiveDocument.Paragraphs for item in something: try: print str(item).encode('latin-1') except UnicodeError: print "XXX There was a Unicode Error." Thanks! From al_dass at yahoo.com Wed Dec 26 20:46:20 2001 From: al_dass at yahoo.com (Al Dass) Date: 26 Dec 2001 17:46:20 -0800 Subject: REPOST: Re: SSL Sockets in Windows References: Message-ID: <2$--$$-$$$$%__$$_$@news.noc.cabal.int> Check it out... unzip and put in your \DLLs folder... but be sure to save the orginals. http://home.attbi.com/~al.dass/dev/python/2.1.1/win32_socket_ssl/python_2_1_1_ssl_socket.zip Cheers, Al Dass ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: al_dass at yahoo.com (Al Dass) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:34:43 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775984 27193 211.57.49.2 (31 Dec 2001 05:19:44 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:19:44 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From chrishbarker at attbi.com Tue Dec 11 13:27:42 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Tue, 11 Dec 2001 10:27:42 -0800 Subject: lost interest? References: <20011208001123.A5989@casa.parque> <3C14FEBD.AD52B516@attbi.com> <3dzo4pputt.fsf@ute.mems-exchange.org> Message-ID: <3C16501E.D817323D@attbi.com> Andrew Kuchling wrote: > Also, those of us using Debian already have dependency information for > Python modules through apt. Isn't this only true if it's been built as a .deb? > It's not much fun to do a lot of work > implementing a parallel Python solution that will still be less > functional, as apt will also handle dependencies on non-Python > software or libraries, a difficult task for a Python-only system. > Switching to Debian has neatly killed my urge to work on a catalog. The same is true for rpm based systems, but let's face it , distutils was created for a reason. It would be very helpful if there could be ONE way for people to do it, on ALL platforms. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From tundra at tundraware.com Mon Dec 10 23:50:03 2001 From: tundra at tundraware.com (Tim Daneliuk) Date: Tue, 11 Dec 2001 04:50:03 GMT Subject: Populating a list References: <32c382ad.0112091404.6cfe4a56@posting.google.com> <3C154077.CA89133B@tundraware.com> Message-ID: <3C159023.D2D6F681@tundraware.com> Tim Daneliuk wrote: > > mlorfeld wrote: > > > > I am new to python (about 72 hours into learning), and am having > > problems with reading a file (sate abbreviations) with one item per > > line and populating each line into a list. The problem is that each > > item ends with \012 after each state ie WI\012. > > > > Here is the code that I am using: > > > > f=open('/home/mlorfeld/states.txt', 'r+') > > states=f.readlines()#populates a list from file > > f.close > > print states > > I think the following works portably so you do not have to fiddle w/ EOL > conventions: > > f=open("xxx.txt") > x=f.read().splitlines() > f.close() > > x is now populated with the content of the line regardless of how it ends > (or at least this works on a FreeBSD system using a WinDoze text file). > Whoops, this does NOT achieve the desired effect on Win32. The second line should instead be: x=f.read().split("\n") ------------------------------------------------------------------------------ Tim Daneliuk tundra at tundraware.com From brian at sweetapp.com Tue Dec 18 20:07:03 2001 From: brian at sweetapp.com (Brian Quinlan) Date: Tue, 18 Dec 2001 17:07:03 -0800 Subject: [XML-SIG] Pyana 0.2.0 released In-Reply-To: <200112182126.fBILQ8A03097@localhost.localdomain> Message-ID: <006601c18829$789ff4b0$445d4540@Dell2> Uche wrote: > > But, since you are being so picky, I tested the latest Pyana release > > (0.2.0) against the latest 4suite release (0.11.1), using the test > > script that I attached in the previous e-mail*: > > Hey, reading is not such a black art, you know. I specifically said > 4Suite in current CVS. Sorry, I think that the argument is slowly shifting and I'm not doing a very good job of keeping up :-) My understanding was that you took issue with my unsubstantiated claim that: "So, right now, Pyana is probably your best bet for high-performance XSLT processing in Python while PIRXX offers Xerces SAX2 interfaces." I don't think that I am being disingenuous by only comparing the latest release version of my product to the latest release version of yours. I do not encourage end users to use the CVS version of Pyana or Xalan but perhaps your CVS tree is more stable and you do. In which case I am sorry for comparing apples to oranges. Also note that I did say "right now" because I knew that both 4suite optimizations were in the works and that J?rgen would eventually get around to doing XSLT bindings in PIRXX. > The CVS version of 4Suite is even easier to install than 0.11.1, so you > must just not want to follow my challenge... I tried to install it but I got a lot of compilation errors in "Ft/Xml/src/domlette/xmlcharhelp.h" (I can send you the error log if you'd like). But I notice that you archive your CVS tree. Could you point me to a shapshot that includes your optimizations but compiles cleanly on Windows? Also, if there is a more optimal code fragment to execute the 4suite test, please send that as well. Thanks a lot! Brian From shiver at yubc.net Tue Dec 25 00:47:06 2001 From: shiver at yubc.net (I.J.) Date: Tue, 25 Dec 2001 06:47:06 +0100 Subject: string compare question.Please Help!!! References: Message-ID: If you ar trying to compare strings as if they are numbers, you cant! >>>cmp('10.66.73.78','10.255.255.255') 1 because when comparing strings, comparation begins from first characters of both strings and continues until ascii values are diferent, like sorting of filenames... So '1' is equal to '1', '0' is equal to '0', '.' is equal to '.' but '6' has greater ascii than '2', and cmd() returns 1. In the same way '2' is greater than '100'. This should work ip1,ip2='10.66.73.78','10.255.255.255' #split string into four substrings ip1,ip2=ip1.split( '.'),ip2.split( '.') #convert strings into numbers ip1,ip2=[long(elem) for elem in ip1],[long(elem) for elem in ip2] true=0 #compare numbers for n in range(4): if ip1[n]>ip2[n]: true=1 break elif ip1[n] From fperez528 at yahoo.com Sun Dec 2 13:40:26 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Mon, 03 Dec 2001 18:08:26 +2328 Subject: the purpose of this list??? References: Message-ID: <9uh7p0$fm0$1@peabody.colorado.edu> Gabe Newcomb wrote: > Hee hee. Of course the response I get IS snooty, although I get the > point about gathering statistics. I won't get into a whole thing on > that (since that would be hypocritical, per my original mail), other > than to say I wasn't intending anything statistically significant > Heuristics, baby! > > I was simply saying it's a waste of our time to send flames (the > joke is I got my own little one in response, I guess). > > Thanks Fernando :) > Yes, I was being snotty on purpose, of course :-) Glad to see you take it in stride. Welcome aboard! Cheers, f From store_li at sina.com Tue Dec 18 10:53:59 2001 From: store_li at sina.com (Kick) Date: Tue, 18 Dec 2001 23:53:59 +0800 Subject: How can I display unicode in Tk widget References: <9vkqm7$fqo83$1@ID-12869.news.dfncis.de> Message-ID: <9vnou6$gpvgr$1@ID-12869.news.dfncis.de> Thank you! I have Tcl/Tk installed on my system, then How can I make it display with correct encoding? Again, thank you for your professional answer. "Martin von Loewis" wrote in message news:j4heqolqqp.fsf at informatik.hu-berlin.de... > "Kick" writes: > > > Is there any function or something else that can make me use Unicode in Tk? > > On Windows, Tcl doesn't find its encoding database, thus it cannot > find out how to convert the Unicode string for display. Setting > TCL_LIBRARY may help. > > It is questionable whether this is a bug in Tcl or Python: It is a bug > in Python, for not installing Tcl libraries in a place where Tcl will > find them, and it is a bug in Tcl, for not offering an API to tell it > a different location for the codecs database. > > Regards, > Martin From cliechti at gmx.net Sat Dec 29 19:41:29 2001 From: cliechti at gmx.net (Chris Liechti) Date: 30 Dec 2001 01:41:29 +0100 Subject: REPOST: Re: values of sys.platform? for a serial port lib References: <3C2E543D.4BFB07D@engcorp.com> Message-ID: <2$--$$_----__%--%$@news.noc.cabal.int> Peter Hansen wrote in news:3C2E543D.4BFB07D at engcorp.com: > Between links on Unix, third-party serial port devices under > Windows which might not use the COMx convention, and other such > variations, I'd strongly recommend you *not* try to use an > index origin of 0 but instead pass the open() routine (or > whatever you have) a *string* naming the serial port. i want it to run mainly on win32 and linux. the user of the lib should not need to care about device names. i use a function to create the device string so the real numbering with numbers and/or letters is no problem. i also have an optional argument to specify the port string, but when this is used it isn't portable anymore. > By the way, does your win32 implementation work well with > threads, if one thread is trying to read from the port while > the other is trying to write to it? i haven't tested it that way. i use it in a multi-threaded environment, but the class that accesses the serial port (and generates binary communication frames) uses means from the module threading. the lib just calls the underlying functions from the os, so no thread safety from there. chris -- Chris ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Chris Liechti Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:04:41 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774450 27193 211.57.49.2 (31 Dec 2001 04:54:10 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:54:10 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From dufw1 at quinda.com Wed Dec 12 11:02:49 2001 From: dufw1 at quinda.com (Duffy O'Craven) Date: Wed, 12 Dec 2001 16:02:49 GMT Subject: Why doesn't default property invoke for if statement? Message-ID: When using my component, I am hoping to avoid making script writing error-prone. So I want to require exactly the same expression for print as for anywhere else in the script. But I am also hoping that reference to an object, which in many contexts is just a boolean, can use the default binding id(0) aspect of COM. Unfortunately if Trans.Status.Value: print Trans.Status print "case 2", if 0 != Trans.Status: print Trans.Status print "case 3", if Trans.Status: print Trans.Status prints case 2 0 case 3 0 I think that print Trans.Status invokes the default property of Status, which is Status.Value, but I think that if Trans.Status: does not. Status is of type interface IEnum : IDispatch { [propget, id(1), helpstring("property Text")] HRESULT Text([out, retval] BSTR *pVal); [propput, id(1), helpstring("property Text")] HRESULT Text([in] BSTR newVal); [propget, id(0), helpstring("property Value")] HRESULT Value([out, retval] long *pVal); [propput, id(0), helpstring("property Value")] HRESULT Value([in] long newVal); }; an excerpt of the the type of Trans is: interface ITransaction : IDispatch { [propget, id(5), helpstring("property Status")] HRESULT Status([out, retval] IEnum* *pVal); }; Why doesn't the default binding property invoke for if statement? Can I achieve my goal of exactly the same expression for print as for anywhere else in the script? - Duffy O'Craven From donn at u.washington.edu Tue Dec 18 14:51:12 2001 From: donn at u.washington.edu (Donn Cave) Date: 18 Dec 2001 19:51:12 GMT Subject: /usr/bin/env: python: No such file or directory References: <9vivft$593$1@peabody.colorado.edu> <171220010818339518%jwbaxter@spamcop.net> <9vnvue$m5d$1@peabody.colorado.edu> Message-ID: <9vo6ng$mhs$1@nntp6.u.washington.edu> Quoth Fernando Prez : ... | If redhat is too lazy to upgrade their code in anaconda and other tools to | use python2, at least they could have the courtesy of putting explicitly | python1.5 calls in their OWN stuff, instead of forcing upon their users a | broken convention. | | I normally use mandrake (had been away from redhat for years) and only last | week was forced to deal with redhat again. What an ugly, messy excuse for a | linux distribution. Does mandrake use Python for system software? The last big go-round on this, the upshot as I recall it was that any Python software had better be released with a dedicated interpreter. More or less like what you propose. It's too bad it has to be that way. On one hand, it's unrealistic to expect all developers to foresee this problem, and on the other it seems pretty expensive for small to medium projects - maybe Redhat can afford to tuck away 10Mb of their own python for their system software, but even for them it's probably not exactly a selling point for Python. I have never used Redhat Linux, but I would have to give them credit for deploying Python software, and blame the Python community as much as Redhat for the problem. -- Why won't Redhat upgrade their software? -- To what version? Assuming it takes some time, and they start with the official 2.x release, when they're finally shipping the upgraded software, will 2.x even still be current, or at least capable of running recently written Python software? What a thankless task! Donn Cave, donn at u.washington.edu From allanwind at mediaone.net Wed Dec 12 21:05:29 2001 From: allanwind at mediaone.net (Allan M. Wind) Date: Wed, 12 Dec 2001 21:05:29 -0500 Subject: mod_python vs mod_snake In-Reply-To: <83elm0b4va.fsf@panacea.canonical.org> References: <83elm0b4va.fsf@panacea.canonical.org> Message-ID: <20011213020529.GA19378@digit-safe.dyndns.org> On 2001-12-12 14:44:25, Kragen Sitaker wrote: > allanwind at mediaone.net (Allan M. Wind) writes: > > I like mod_snake more (in part because it claims support for Apache > > 2.x), but you might find that there are more people using mod_python > > (e.g. more community knowledge / support). PyApache would also satisfy > > your need from how you describe your need and seem to most mature. > > It sounds like you've tried all three. Is that correct, and what was > your experience like? Yes, I have tried all 3. It is really subjective, but I disliked mod_python and instead used mod_snake for which I have written an authentication module and CGIs against (it is lot easier in python against mod_snake than C). I like the fact that mod_snake runs standard CGIs (just realize that instantiation of default values in function calls works different than expected with a persistent CGI). That said, mod_snake has bugs ;-) PyApache is not very well documented and the text file that is there seems out of date, it's persistency mechanism relies on a special variable name. PyApache does have a really nice feature of being able to run with only the compiled code for your CGIs (e.g. don't need to have your source laying around). I might end up writing my own, "thinner" than mod_snake. /Allan -- Allan M. Wind email: allanwind at mediaone.net P.O. Box 2022 finger: awind at digit-safe.dyndns.org (GPG/PGP) Woburn, MA 01888-0022 USA -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 240 bytes Desc: not available URL: From clams17 at yahoo.com Fri Dec 7 16:23:48 2001 From: clams17 at yahoo.com (Spiffy) Date: Fri, 07 Dec 2001 21:23:48 GMT Subject: string conversion and formatters References: Message-ID: Doh! Wow, you guys are the best...the BEST!! Thanks for your help. What a great community thang Python's got going here. Hopefully, I will be able to contibute in a meaningful way someday... Here's my re-write and ...IT WORKS NOW!! #Decimal/Hex Convertor def print_options(): print """Options: 'a' Decimal to Hex 'b' Hex to Decimal 'c' print options 'd' quit""" choice = "c" while choice != "d": if choice == "a": dec = input("Decimal: ") print "Hex: %X" % dec elif choice == "b": hek = raw_input("Hex: ") print "Decimal: %d" % int(hek,16) elif choice == "c": print_options() choice = raw_input("option: ") Now I just need to write a GUI for it! Wish me luck... From soppers3 at cti.ecp.fr Sun Dec 30 15:40:19 2001 From: soppers3 at cti.ecp.fr (Stephane SOPPERA) Date: Sun, 30 Dec 2001 21:40:19 +0100 Subject: wxBitmapFromImage function in wxPython? Message-ID: <3C2F7BB3.577D3712@cti.ecp.fr> I read in the documentation of wxPython that this function exists: wxBitmapFromImage(image, depth=-1) Convert a wxImage to a wxBitmap. But the Python does not know it. When I use it, it return an Nameerror exception. (I use the from wxPython.wx import * command) It's not in dir(wxPython.wx). I'm using python 2.1. Is that function really exists? What could be another solution to do the same thing? Thanks in advance, -- Stephane SOPPERA http://stephane.soppera.free.fr From rdsteph at earthlink.net Sat Dec 29 20:22:12 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sun, 30 Dec 2001 01:22:12 GMT Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <4VlX7.6657$l93.1694996@newsb.telia.net> Message-ID: <3C2E6D60.81031B00@earthlink.net> You are probably aware of the Stackless Python project, I don't know off hand where its web site is, and it's not a compiler I don't think, but a different implementation of a Python interpreter that is a little faster in program execution (a lot faster ??). I know it's not what you are after exactly, but I guess if you want speed of execution, it could be of interest. I bet someday someone or some group creates an "optimized" compiler for Python, but I hear it would be an enormously difficult and complex job. My guess is that, if Python becomes popular *enough*, then someone will find the difficulty worth tackling. On another related tangent, I hope someday someone makes a .Net implementation of Python. Mark Hammond, who was I think involved in ActiveState's prototype effort to do just that, has stated how difficult a job it is. But again, if Python becomes popular enough then someone may do it. One last aside, I keep seeing news about Mono, there was a nice interview/article in, I think Linux Journal recently by Miguel de Icaza (sp?) and it sounds like they are making real progress. I wonder, would a Python.Mono be just as difficult as a Python.net (I guess it would). Would a Python.mono and a Python.net be do-able as a joint project? Wouldn't a Python.Mono be nice ;-)))) Ron Stephens From mwh at python.net Thu Dec 20 06:07:14 2001 From: mwh at python.net (Michael Hudson) Date: Thu, 20 Dec 2001 11:07:14 GMT Subject: /usr/bin/env: python: No such file or directory References: <9vivft$593$1@peabody.colorado.edu> <171220010818339518%jwbaxter@spamcop.net> <9vnvue$m5d$1@peabody.colorado.edu> <23891c90.0112200300.6c2a13cb@posting.google.com> Message-ID: paul at boddie.net (Paul Boddie) writes: > Having written the above, I now anticipate an example of distutils' > triviality... ;-) from distutils.core import setup setup(scripts=['script.py']) I think. It's nice to include author_email & things, but that should suffice. I agree distutils is a bit overkill for demonstration scripts & such, but I can't really conceive of a better system. Cheers, M. From aleax at aleax.it Tue Dec 11 08:31:31 2001 From: aleax at aleax.it (Alex Martelli) Date: Tue, 11 Dec 2001 14:31:31 +0100 Subject: reference counting for garbage collection References: <1008011593.29363.0.nnrp-10.c1c3e1d9@news.demon.co.uk> Message-ID: <9v51rk02eg9@enews4.newsguy.com> "Gareth McCaughan" wrote in message news:slrna1aaba.1pab.Gareth.McCaughan at g.local... ... > It's arguably bad style to rely on objects going away as > soon as they're no longer referenced, because if Python > switches over completely to a "real" GC some time in the > future then it will stop being true. No "if" or "future" needed -- http://www.jython.org/ -- it is Python, it works, it's here today, and it DOES "switch over completely to a real GC" (that of the JVM it's running on). With http://java.sun.com/j2se/1.4/ and the 2.1 beta version of Jython, it's getting SO good it's unbelievable. OK, both Java 2 SDK 1.4 _and_ Jython 2.1 are still betas, but I think they're definitely already worth trying out. Wouldn't it be a pity if the only thing standing between your Python application and the ability to deploy it on a JVM was the application's widespread reliance on "objects going away ASAP"...?-) Alex From nbecker at fred.net Tue Dec 11 08:19:53 2001 From: nbecker at fred.net (N Becker) Date: 11 Dec 2001 05:19:53 -0800 Subject: constructors for lists and tuples Message-ID: <1f5252d4.0112110519.2617d639@posting.google.com> what are the constructors for lists and tuples? I wanted to make a list of a known size and then populate it. Based on my experience with C++ and STL, I expected to find a constructor that took a size. I would expect to find like: list (size, init=None) 2 problems. 1) I don't know how to do this 2) I don't know where to find documentation on this. All the modules document the constructors for their extensions, but looking at the library reference, I didn't see anything documenting the complete behaviour of the builtin list or tuple. From jessw at loop.com Fri Dec 28 18:51:19 2001 From: jessw at loop.com (Jesse W) Date: Fri, 28 Dec 2001 15:51:19 -0800 Subject: ANNOUNCE: netdraw.py In-Reply-To: <002801c18f83$0de78910$6401a8c0@mojave> Message-ID: <3C2C94F7.5693.8F8A761@localhost> Issac wrote: > Here's a networked drawing program for collaborative drawing with two > people. Wow. I have tried various networking things, but never got any of them to work. This is cool. By the way, I make a slightly more full-featured drawing program off the same base you used.(See my website address below) I think I will combine your netowrking code with my better paint program. Should be done soon... > Anything you draw on your side will show up on your friend's side and > vice-versa. > Issac Thank you, Jesse W http://members.loop.com/~jessw From richard at bizarsoftware.com.au Mon Dec 17 16:24:26 2001 From: richard at bizarsoftware.com.au (Richard Jones) Date: Tue, 18 Dec 2001 08:24:26 +1100 Subject: Tar for python? Better compressed file archives 'r us? In-Reply-To: <20011217114320.A1411@localhost.localdomain> References: <200112170639.fBH6dpk26965@bigboy.bizarsoftware.com.au> <20011217114320.A1411@localhost.localdomain> Message-ID: <200112172123.fBHLNFk36729@bigboy.bizarsoftware.com.au> On Tuesday 18 December 2001 3:43 am, Drew Csillag wrote: > On Mon, Dec 17, 2001 at 05:40:58PM +1100, Richard Jones wrote: > > In the meantime, I'm creating the zip file with ZIP_STORED and > > compressing the result... > > > > -rw-rw-r-- 1 builder builder 2635321 Dec 17 16:20 zope.zip.gz > As to why the .zip.gz is still considerably larger than the tar.gz, > it's because zip files (this holds for .gz files too) don't compress > well, if at all because *most* of the redundany has been eliminated > already [snip algorithm discussion] Note I said that I used ZIP_STORED. There's no compresssion in the zip file before I gzip it. That's why it was odd :) Thanks for the reader code! Richard From henrik at moskau.hmotakef.homeip.net Sat Dec 29 17:48:15 2001 From: henrik at moskau.hmotakef.homeip.net (Henrik Motakef) Date: 29 Dec 2001 22:48:15 +0000 Subject: REPOST: Re: The Fiery Bush Python One True Universal Web Server... References: <3C2CBACB.FBF3C3C9@mindspring.com> <3C2D47F0.6DF7C8BE@mindspring.com> <3C2DF5FF.E332F4EE@mindspring.com> <3C2E61FD.4CA44C0@earthlink.net> Message-ID: <1$--$$_----__%$-_$@news.noc.cabal.int> Ron Stephens writes: > Would it be possible to create a module that could be plugged into a > Python program, that would automatically, when called, go to a > specific web site containing a Python interpreter and run the > original Python program remotely, give the results track over the > web... You mean something like a Web Service? mfg Henrik ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!zeus.visi.com!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Henrik Motakef Newsgroups: comp.lang.python Subject: cmsg cancel <87g05thccw.fsf at moskau.hmotakef.homeip.net> Control: cancel <87g05thccw.fsf at moskau.hmotakef.homeip.net> Date: Mon, 31 Dec 2001 04:22:40 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774462 27193 211.57.49.2 (31 Dec 2001 04:54:22 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:54:22 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From logiplexsoftware at earthlink.net Fri Dec 28 19:25:34 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Fri, 28 Dec 2001 16:25:34 -0800 Subject: Python on the desktop In-Reply-To: References: <94e3fce8.0112210053.2568529d@posting.google.com> <3C238618.9F54E5CA@attbi.com> Message-ID: <20011228162534.67d1d6f7.logiplexsoftware@earthlink.net> On Sat, 29 Dec 2001 00:17:59 GMT Courageous wrote: > > > Well, see, hegemoney is a play on words see. On one hand, you have > hegemony. On the other, you have money. Together, you get hegemoney. > This would make the comment a jab at Microsoft, see? :) > > You've got what on your hand? And there was money involved? Isn't that illegal? g'night ;-) -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From bsturk at news.rcn.com Mon Dec 17 22:43:48 2001 From: bsturk at news.rcn.com (Brian Sturk) Date: 18 Dec 2001 03:43:48 GMT Subject: pty/fork and SIGINT Message-ID: I'm using the pty module to to "control" a shell process and I'm having a hard time getting SIGINT to be sent to the processes spawned within it, i.e. ping . I've tried registering a handler via signal.signal and externally sending it SIGINT with the pid returned from fork() using kill, and also using the returned pid from fork() to send it a signal.SIGINT from within the script. Nothing I've tried seems to work. The script is a little large to post here but it basically is run within the editor vim so there are a few variables at work. I'm wondering if the problem is that I'm never returning control to the editor since I continually have data to be read(). I'm not a signal/process guru so I'm unsure where to look. Any pointers/help would be great... -- .-----------------------------------------------------,-------. | Brian M. Sturk - http://www.nh.ultranet.com/~bsturk \ C/C++ | .> )\,^a__ |--------------------------| bsturk at nh.ultranet.com | Java | ( _ _)/ /-." ~ | http://www.telengard.com `---------------------------`------| `( )_ )/ | Telengard Technologies Inc. - NT/*nix UI & device drivers | _<_s_<_s '-------------------------------------------------------------' From eeskoe at yahoo.com Tue Dec 18 20:12:13 2001 From: eeskoe at yahoo.com (Erika Skoe) Date: Tue, 18 Dec 2001 19:12:13 -0600 Subject: deleting from bsddb References: Message-ID: <9vop8f$s10$1@news.doit.wisc.edu> thanks "Jason Orendorff" wrote in message news:mailman.1008652461.23857.python-list at python.org... > Erika Skoe wrote: > > i don't see the syntax anywhere for deleting an element from a bsddb. any > > hints? > > db = bsddb.hashopen("myfile.db", 'w') > del db['username'] > > -- > Jason Orendorff http://www.jorendorff.com/ > > From grey at despair.dmiyu.org Fri Dec 28 13:29:41 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Fri, 28 Dec 2001 18:29:41 -0000 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2C8A86.50C74E60@earthlink.net> Message-ID: <5$--$$_-----$%$__$@news.noc.cabal.int> On Fri, 28 Dec 2001 15:12:20 GMT, Hans Nowak wrote: > Hey, you guys, stop dissing my box like that! >=) > (900 MHz, bought last month...) Hey, I'm allowed. Winbox for games: 667mhz, 512Mb RAM. Linux server/workstation: 450Mhz, 384Mb RAM (although I can drop another 450 in) Linux Laptop: 667Mhz, 128Mb RAM. You trump me on all three. -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Steve Lamb Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:24:49 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775157 27193 211.57.49.2 (31 Dec 2001 05:05:57 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:05:57 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From lac at strakt.com Sat Dec 8 13:00:37 2001 From: lac at strakt.com (Laura Creighton) Date: Sat, 08 Dec 2001 19:00:37 +0100 Subject: Good book for Learning Python?? In-Reply-To: Your message of "Sat, 08 Dec 2001 00:41:54 GMT." <9urnki+qeq5@eGroups.com> References: <9urnki+qeq5@eGroups.com> Message-ID: <200112081800.fB8I0bua027012@ratthing-b246.strakt.com> You need to give us more information. A good book for somebody who has never programmed before and wants to learn how to program in Python is different from a Good Book for somebody who has 15 years experience programming Java, C and C++. What, in particular, do you want the book to do? Laura Creighton From aahz at panix.com Fri Dec 28 11:37:37 2001 From: aahz at panix.com (Aahz Maruch) Date: 28 Dec 2001 08:37:37 -0800 Subject: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> Message-ID: In article , Cameron Laird wrote: > >I don't know what you mean by the "official inauguration" >of the 'Net. I'm guessing Alex refers to the switchover from ARPAnet to NSFnet or from NSFnet to Internet. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 3 days and counting From fredrik at pythonware.com Sun Dec 16 15:10:32 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sun, 16 Dec 2001 20:10:32 GMT Subject: Python Hosting Questions References: Message-ID: Dave Butler wrote: > I am searching for a new hosting company because my existing host does not > provides many services/technologies (like Python) that I would like to use. > While I evaluate potential hosts, I am uncertain as to which questions I > should be asking. Perhaps CLP can help me with my list of questions as it > relates to Python. Here are my Python questions for the web hosting > companies: > > 1) Which version of Python is installed (it seems it should be at least 2.0 > or 2.1) > 2) Is Mod_python supported? www.cornerhost.com is worth checking out (we're using them for portions of pythonware.com). they know Python, and the support is more than excellent, this far. (I think the answers to your questions are 2.0, and yes) From eric.brunel at pragmadev.com Tue Dec 11 11:22:06 2001 From: eric.brunel at pragmadev.com (Eric Brunel) Date: Tue, 11 Dec 2001 17:22:06 +0100 Subject: Problems using tkSimpleDialog References: <314b29e9.0112110704.1b42edd4@posting.google.com> Message-ID: <9v5boc$2auh$1@norfair.nerim.net> Hi Simon, The problem is simple: Tk needs to be initialized before the "tkSimpleDialog" module can work. Just do: import Tkinter root = Tkinter.Tk() before calling tkSimpleDialog.askstring, and it will magically solve the problem. What happens is that if you don't explicitely set the "parent" option for your dialog, a default one is chosen which is "the" instance of the Tk class for your application, corresponding to its main window. Apparently, if this instance was not created "manually", the "tkSimpleDialog" module does not create one automatically. Hope this helps. - eric - "Simon Brunning" a ?crit dans le message news: 314b29e9.0112110704.1b42edd4 at posting.google.com... > I an having trouble with this module. I'm running Python 2.1 on Win NT > 4. > > Here is what I am doing: > > Python 2.1.1 (#20, Jul 20 2001, 01:19:29) [MSC 32 bit (Intel)] on > win32 > Type "copyright", "credits" or "license" for more information. > >>> import tkSimpleDialog > >>> tkSimpleDialog.askstring('Title in here', 'Prompt here') > Traceback (most recent call last): > File "", line 1, in ? > File "D:\dev\python\lib\lib-tk\tkSimpleDialog.py", line 287, in > askstring > d = apply(_QueryString, (title, prompt), kw) > File "D:\dev\python\lib\lib-tk\tkSimpleDialog.py", line 177, in > __init__ > Dialog.__init__(self, parent, title) > File "D:\dev\python\lib\lib-tk\tkSimpleDialog.py", line 71, in > __init__ > self.geometry("+%d+%d" % (parent.winfo_rootx()+50, > AttributeError: 'None' object has no attribute 'winfo_rootx' > >>> > > Interestingly, I *do* see the required dialog here, along with an > empty window titled 'tk'. Entering anything into the dialog gets me: > > Exception in Tkinter callback > Traceback (most recent call last): > File "D:\dev\python\lib\lib-tk\Tkinter.py", line 1285, in __call__ > return apply(self.func, args) > File "D:\dev\python\lib\lib-tk\tkSimpleDialog.py", line 127, in ok > self.cancel() > File "D:\dev\python\lib\lib-tk\tkSimpleDialog.py", line 132, in > cancel > self.parent.focus_set() > AttributeError: 'None' object has no attribute 'focus_set' > > What am I doing wrong? > > Cheers, > Simon B. From sfam at mailandnews.com Thu Dec 20 01:05:01 2001 From: sfam at mailandnews.com (Kaden) Date: 20 Dec 2001 06:05:01 GMT Subject: Newbie Programming References: <84fd22ef.0112192032.14c75f8a@posting.google.com> Message-ID: <9vrv2d$ack$3@news.xmission.com> On 19 Dec 2001 20:32:54 -0800, Evan Roman wrote: > I have just begun programming in Python a couple months ago. While i > feel like i am doing OK, i don't think im getting any better. The > problem is i can't think of anything to program... I think I have most > of the fundamentals down, but i can't think of any ways to use them. > I was just wondering if there was some website that gives ideas of > little projects to do so that one could sharpen his programming > skills. Thanx in advance for all the help. Then don't try to write things from scratch. When you learned to write, it would of been much easier to read something someone else wrote and then add your two cents worth than for you to sit down and write your own novel, correct? So why try to do that with programming? Go to someplace like sourceforge and look at their python snippits. If you find something there that sounds kind of useful, or even sort of silly but fun, download it. Run it once or twice and find something that it needs. Add a new feature. Fix a bug. Rewrite it to be more efficient. This allows you to already have the bulk of the work done for you, and you can try and read what the author has done and figure out why he did things the way he did. Then, using that as a template, you can write a few lines of code that work with what he's already written and change the way the program works. From christophertavares at earthlink.net Wed Dec 19 00:53:32 2001 From: christophertavares at earthlink.net (Chris Tavares) Date: Wed, 19 Dec 2001 05:53:32 GMT Subject: How to know that a second application has finished? References: <3C1F6F21.C03A3ABC@cicei.ulpgc.es> Message-ID: "Enrique" wrote in message news:3C1F6F21.C03A3ABC at cicei.ulpgc.es... > Hi, > Let me put my question again, in a different and more > general form. I have a Python program that launches a GUI > application in a separate window via COM. I am using Python > 2.1.1 with win32 extensions in MS-Windows (win95/98/NT) > > Is it possible to suspend the main Python program until the > COM application has finished? (has been closed). > I want to resume from that point onwards. How the main > program gets information of the state of other applications > launched from it? > > Thanks in advance > Enrique Castro It kind of depends on the app you're starting. Does it have some method to tell the calling app that it's quitting? The general way to do this under Win32 is to get the process handle somehow (usually via a call to CreateProcess) and call WaitForSingleObject. You could do some tricks to get the process handle another way, BUT this won't work in your situation. The problem is this: COM servers don't exit as long as there's an outstanding reference to that server's objects. Now, consider this: Client calls CoCreateInstance - er, win32com.Client.Dispatch, sorry :-) Server is created Client waits for server to exit Server waits for final reference to go away before exitting Boom, deadlock. Seems to me your choices are: 1) Use CreateProcess to start the other app instead of creating a COM server. 2) Modify the server so that it gives you an OnClosing event (or something of the sort) or, my favorite, 3) Modify the server's interface so that it has a "DoYourThingAndDontReturnTillYoureDone" method. Then the client just calls that, the server doesn't return until the user's done, and then you can clean up and go away. -Chris -Chris From nospam at bigfoot.com Thu Dec 27 11:24:42 2001 From: nospam at bigfoot.com (Gillou) Date: Thu, 27 Dec 2001 17:24:42 +0100 Subject: long lines in HTML attachments References: <7a256ac1.0112270203.77efb6f2@posting.google.com> Message-ID: Encode your mail body with quoted printable encoding (see doc of module "quopri"). This way, the recipient's mail client is supposed to re-built the lines broken by quoted-printable encodings. I tested this successfully with OE5, Netscape messenger and StarOffice Mail. Don't forget to add this header to your mail: "Content-Transfer-Encoding: quoted-printable" Or download Python 2.2 that has a new "email" standard package that handles email messages (parse and marshal/serialize) as Python objects (easier to handle than playing with the various packages you may need for handling emails). Heard that this package is available separately and may work with older Python versions but I have no URL for this (Google for this). HTH --Gilles "Iddo" a ?crit dans le message news: 7a256ac1.0112270203.77efb6f2 at posting.google.com... > Hi, > > I am trying to use smtplib and mimecntl to email an attached html > document. The trouble is that the html document contains some very > long physical lines (500 chars). It is important that those lines be > preserved as such, since I use
 formatting in the htdoc. Some
> mail clients (e.g. Pine 4.40) truncate or insert a linefeed in those
> lines, creating a mess. Any way of attaching my long-lined files and
> getting them through intact? Following is a code snippet of what I do.
> Any help would be appreciated.
>
> Thanks,
>
> Iddo
> ---------------------------------- CUT HERE --------------------------
>
>
> def email_with_attachments(to_addr, subject, msg_string, attachment):
>     f = mimecntl.MIME_document("",type='text/plain')
>     f.write(msg_string)
>     # Create the message + attachment
>     attach = mimecntl.MIME_recoder()
>     att_file = open(attachment[1],"r")
>     att_stream = att_file.read()
>     attach.write(att_stream)
>
attach['content-type']=mimecntl.MIMEField('content-type',attachment[0],
>
> name=attachment[1])
>     attach['content-length']=mimecntl.MIMEField(
>                                    'content-length',
>                                    len(att_stream))
>     attach['content-disposition']=mimecntl.MIMEField(
>                                    'content-disposition',
>                                    'attachment',
>                                     filename=attachment[1])
>     msg = mimecntl.MIME_document((f,attach),
>                                   From='myself at myserver.org',
>                                   To=to_addr,Subject=subject)
>     # send msg using smtp
>     smtp = smtplib.SMTP('localhost')
>     smtp.sendmail('myself at myserver.org',to_addr,msg.dump())
>     smtp.quit()
> if __name__ == '__main__':
>     attach_info = ('text/html','/my/html_file.html')
>     email_with_attachments('you at youraddress','hi there',attach_info)




From jeff at ccvcorp.com  Tue Dec  4 14:18:22 2001
From: jeff at ccvcorp.com (Jeff Shannon)
Date: Tue, 04 Dec 2001 11:18:22 -0800
Subject: Python evangelists unite!
References:  <9u77i8$a5j$1@slb0.atl.mindspring.net> <91acf731.0111301017.31cd71a5@posting.google.com> <9ufdth$155$1@slb5.atl.mindspring.net> <91acf731.0112031205.2782a5f9@posting.google.com> <9uhpkh$9u7$1@slb5.atl.mindspring.net> <91acf731.0112040753.49b930cd@posting.google.com>
Message-ID: <3C0D217E.A5683D37@ccvcorp.com>

Jason Voegele wrote:

> I think an example is in order.  Say I have a class called "Book",
> that represents a book having a title, an author, a date of
> publication, etc.  In my application, I might instantiate a million
> Book objects.  But say that I only need to store one of them in the
> database.  Given the ability to add members to a specific object, I
> can add persistence support methods (such as object_id, mark_modified,
> etc.) to the single book instance that I need to store in the
> database.  (More precisely, the database binding could add these
> methods for me!)  If Ruby did not have this ability, the Book class
> would have to inherit from some sort of Persistent class.  This would
> mean that all one million books have these methods and variables to
> support persistence, even though only one book object actually needs
> them.

As a minor note, in general, methods don't create much "baggage" -- there is only
a single code object, as part of the class object, for each method, regardless of
how many instances of that class you create.  So you really aren't saving a
significant amount of much of anything by doing this.  I suppose that if every
instance needs a set of data members in order to support persistence, then you're
"wasting" that memory space for objects that won't be persisted, but in general,
this is not often a concern.

The *real* advantage for dynamically adding methods/attributes to an object, comes
when you don't have control over the original object.

If I have a commercial library to manage some task, and I want to store objects
from *that* library in my own object database, then I don't have the option of
having library objects inherit from some Persistent root class.  In Python this
can be solved in two ways, one of which is mix-in multiple inheritance, the other
of which is dynamically adding whatever methods and attributes are needed, as they
are needed.

In other words, it's not a solution for avoiding baggage, it's a solution for not
being *able* to put the needed "baggage" in place.   :)


Jyrinx  wrote:

> > (Of course, in Python
> > there's no such thing as a trivial subclass definition; you've got to
> > overload __init__ specifically and call __init__'s in each base class. This
> > ticks me off to no end.)

This is, of course, only true if the base *requires* initialization--many mix-in
classes don't--they simply provide methods and class-level data attributes,
without explicitly setting instance attributes in an __init__().


Jeff Shannon
Technician/Programmer
Credit International




From ront at soph-ware.com  Sun Dec  2 01:44:03 2001
From: ront at soph-ware.com (Ron Turner)
Date: Sun, 02 Dec 2001 06:44:03 GMT
Subject: Do 2.2 and 2.1.1coexist well?
Message-ID: 

Is it safe to install and run both 2.2 and 2.1.1 on the same machine? I
realize that the directory structures are nicely separated, but I am not
certain whether there may be DLLs or other files that would cause contention
or loss of state. We don't seek to launch simultaneous sessions. We just
need to maintain the two installations, if possible.

Related: Does the "Non-Administrative Install" option (under Advanced
Options in the 2.2 Wise Install Wizard) offer a straightforward way to
ensure the separation described above? That directs the DLLs to be installed
within the 2.2's own directory structure.




From aahz at panix.com  Fri Dec 28 15:25:03 2001
From: aahz at panix.com (Aahz Maruch)
Date: 28 Dec 2001 12:25:03 -0800
Subject: O'Reilly book production (was Re: Wine applicability)
References: <3C2A9D33.67FEC261@earthlink.net>   <3c2cca88.13089772@127.0.0.1>
Message-ID: 

In article <3c2cca88.13089772 at 127.0.0.1>,
(Five Fresh) Fish  wrote:
>
>Silly, really.  O'Reilly should use the best software for the task, not the
>most popular.

Note carefully that O'Reilly *does* normally support XML (and actually
prefers it, IIRC).  I was just asking Alex what made Word necessary for
Nutshell, to make sure that wouldn't be an issue for me.
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

Tenth Virtual Anniversary: 3 days and counting


From mkelly2002NOSPAM at earthlink.net  Sun Dec 30 13:05:26 2001
From: mkelly2002NOSPAM at earthlink.net (Michael Kelly)
Date: Sun, 30 Dec 2001 18:05:26 GMT
Subject: win32all-141 for Python 2.2
References: <3C2D4676.5060700@skippinet.com.au> <3C2E6515.6A957604@bellatlantic.net>
Message-ID: <1olu2ucng1gn5gkl6p4vh2354evfgp7khk@4ax.com>

On Sun, 30 Dec 2001 00:51:24 GMT, David Lees
 wrote:

>An
>error occurs during win32all-141 installation saying that an AXScripting
>Engine can not be registered. 

For what it's worth when I installed the python 2.1 from
python.org the registration for WSH didn't work on my
machine(Win98 2nd. ed.) so I downloaded the
ActivePython 2.1 and it worked out of the box.

I dunno' if it's the same issue on your system.


Mike

--

"I don't want to belong to any club that would have me as a member."
    -- Groucho Marx


From mixo at beth.uniforum.org.za  Tue Dec 11 01:25:50 2001
From: mixo at beth.uniforum.org.za (mixo)
Date: Tue, 11 Dec 2001 08:25:50 +0200
Subject: reading from a serial port (boot)
Message-ID: <3C15A6EE.9050408@beth.uniforum.org.za>

My serial port permission look like this:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
crw-rw----    1 root     uucp       4,  64 Dec 11 07:54 ttyS0
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Now I have a script that starts up as the machine boots and
read from the serial port. My problem is, it does not get
anything from the port, unless I manualy start it as 'root'.
What do I need do /change to get it to start reading at
boot time?

P.S
     The script to start the daemon has the following  permissions
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-rwxr-xr-x    1 root     root         1463 Dec 10 17:29 myscript.sh
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

     The daemon itself,
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-rwxr-xr-x    1 root     root         3678 Dec 10 16:04 mydaemon.py
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



From tweek154 at yahoo.com  Wed Dec 26 14:30:33 2001
From: tweek154 at yahoo.com (tweek)
Date: 26 Dec 2001 11:30:33 -0800
Subject: dtuple and sql functions
Message-ID: 

i am dealing with converting the date format from a MySQL database and
i'd prefer to use the built in sql function than convert it using
python.  here is what im trying to accomplish:


flist = ["AssignedTo", "DATE_FORMAT(DueDate, '%m/%e/%Y')"]
descr = dtuple.TupleDescriptor([[n] for n in flist])

sql = """SELECT %s FROM joblog""" % ", ".join(flist)
c.execute(sql)
temp = c.fetchall()


now unfortunately the field name is now called:
temp.DATE_FORMAT(DueDate, '%m/%e/%Y')

which should be invalid anyways.  what i want is to use it as
temp.DueDate


Tweek


From nospam at bigfoot.com  Tue Dec 18 16:02:10 2001
From: nospam at bigfoot.com (Gillou)
Date: Tue, 18 Dec 2001 22:02:10 +0100
Subject: SOAP public server anywhere ?
Message-ID: <9voag4$21n3$1@norfair.nerim.net>

Hi,

Is there some SOAP public server available somewhere for test purposes.
I mean something like Meerkat that provides IT news to XML-RPC clients.

TIA

--Gillou





From bas at andrew.cmu.edu  Mon Dec 24 19:25:26 2001
From: bas at andrew.cmu.edu (Bruce Sherwood)
Date: Mon, 24 Dec 2001 19:25:26 -0500
Subject: [Visualpython-users] New Windows VPython
In-Reply-To: <000601c18cd1$3b05e4a0$3d60f6d1@ArtSiegel>
Message-ID: <4199579036.1009221926@HYPERON.REM.CMU.EDU>

You've jumped the gun, but your input is useful nevertheless.

The new Windows version of VPyhon available at vpython.org does NOT 
automatically invoke the new division operators. What it does is PERMIT but 
not require users of VPython to put "from __future__ import division" in 
their programs and have things work correctly, even if they use explicit 
Numeric arrays (as for example is the case in some VPython demo programs). 
So there still is no "VPython fork".

It is true however that I have been thinking quite seriously of making just 
such a version of VPython, possibly only a local version just for our 
physics students. In the absence of "true division" they make "mistakes" 
that are very hard to find and fix. If we do make such a version, we'll 
offer it to others along with a version that doesn't invoke this 
automatically. Alternatively, we'll just teach our students to insert the 
import __future__ statement to avoid the problems they have been 
encountering. This problem stands out in high relief for us because it is 
very nearly the only significant problem they have with Python. (For 
example, our students don't have any problems whatsoever with case 
sensitivity, the other problem that was reported for some novice programmer 
populations.)

I hope this clarifies for you the VPython situation. What I fixed makes it 
possible to use true division with Numeric, not force you to do so.

This said, I should also however point out that while the serious 
difficulties students had with classic division in both the Alice and 
VPython projects got Guido and others thinking about the issue, it is my 
understanding that these projects were NOT ultimately the basis for 
implementing a path toward a different approach to division. Rather, Guido 
and colleagues came to a new vision of the status of numeric values in 
Python, and a way to unify different kinds of integer in such a way that it 
shouldn't matter whether a quantity happens to be an integer or a float.

Bruce Sherwood

--On Monday, December 24, 2001 18:17 -0500 Arthur Siegel 
 wrote:

> ----- Original Message -----
> From: "Bruce Sherwood" 
> To: 
> Sent: Monday, December 24, 2001 5:11 PM
> Subject: [Visualpython-users] New Windows VPython
>
>
>> At vpython.org is a new VPython for Windows that patches gaps in the
>> Numeric module used in some VPython demo programs (and automatically
>> imported by Visual). The update makes division of Numeric arrays work
>> properly in the presence of "from __future__ import division". The
>> patches to Numeric have been submitted to the keepers of the Numeric
>> project.
>>
>> Bruce Sherwood
>>
>
>
> Bruce -
>
> I am in the strange position of being a vocal advocate of
> VPython, and a vocal critic of the decision on the division
> operator, at least to the extent it was made to accommodate
> VPython and similar projects.  And precisely, as I stated at
> the time of the wars,  because Numeric is the dog and VPython
> the tail when it comes to handling numerics, and as I stated at
> the time, the change is inconsistent, or at least inelegantly consistent,
> with Numeric typing, and, as I stated at the time of the wars, the
> change could be expected to lead to a deeper level of confusion
> and more insidious bugs if folks try to use VPython without being
> aware of the Numeric typing and coercian rules - to which the
> divison change is, almost by intent, an open invitation.
>
> And I inflamed an already difficult relationship with Guido and others
> in the community as a result of my position, or at least its vehemence,
> and my method of communciating my position.
>
> There was no VPython fork of Python as Guido had apparently thought,
> but as of today, apparently there *is* a VPython fork of Numeric.
>
> That a project of mine, that is dear to me, is dependent on VPython and
>  so -
> at least temporarily, a fork of Numeric, is - I think you might be able
> to understand - quite upsetting.
>
> Art
>
>
>
>
>
>





From h4rv3st at web.de  Thu Dec 13 12:01:15 2001
From: h4rv3st at web.de (Daniel T. Bender)
Date: Thu, 13 Dec 2001 18:01:15 +0100
Subject: Games Made w/ Python
References: <9v9gss$5hr$1@nntp9.atl.mindspring.net>  <3C189BAF.2070502@student.cs.york.ac.uk>
Message-ID: <9vamq1$e67so$1@ID-22517.news.dfncis.de>

"Andrew Wilkinson" 

> I've found it's excellent, I knocked up a quick wrapper for a DirectX
> graphics engine and have been programming an entire game using python. I
> get speed of development because of python, and speed of execution
> because all the drawing code is in compiled c++. It's perfect!
> When the game gets nearer completion I will move the python code over to
> c++.

this is quite cool, do you have the wrapper available somewhere?
if not, would you consider making it public or a sf project?

i definitly want to try that one :))

Harvest T. Moon




From deltapigz at telocity.com  Fri Dec 21 20:07:49 2001
From: deltapigz at telocity.com (Adonis Vargas)
Date: Fri, 21 Dec 2001 20:07:49 -0500
Subject: wxPython w/ IDLE under WinXP Pro
Message-ID: <3c23dcd2$1_2@nopics.sjc>

i am unable to use wxPython under WinXP Pro??? although the demo works just
fine???

(using within IDLE>F5)
everytime i attempt to load the lib i get this error:
Traceback (innermost last)
  File "c:\dev\python\test.py", line 2, in ?
    from wxPython.wx import *
SystemError: C:\Code\c1\Objects\listobject.c:88: bad argument to internal
function

(using IDLE interactive shell)
on the other hand if i load it in the interactive shell i get:
Python 2.2c1 (#27, Dec 14 2001, 13:15:16) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
IDLE Fork 0.8 -- press F1 for help
>>> from wxPython.wx import *
>>>

and it works fine when using directly with python.exe or pythonw.exe.

just wondering if there is a fix out since i use IDLE as my editor.

or anyone could sugguest a better/superior editor?




From aahz at panix.com  Sat Dec 29 16:46:58 2001
From: aahz at panix.com (Aahz Maruch)
Date: 29 Dec 2001 13:46:58 -0800
Subject: REPOST: Re: OT: Gender-based security? (was Re: Fate of win32all?)
References: <7876a8ea.0112212116.2ebabc23@posting.google.com>   
Message-ID: <2$--$$_----___%%%$@news.noc.cabal.int>

In article ,
Sheila King   wrote:
>
>Heck, maybe I'm a man in a woman's body????

I dunno.  I'm sure that a ... thorough ... examination can be arranged.
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

Tenth Virtual Anniversary: 2 days and counting

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!nnxp1.twtelecom.net!newsfeed.cs.wisc.edu!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: aahz at panix.com (Aahz Maruch)
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 04:09:57 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774545 27193 211.57.49.2 (31 Dec 2001 04:55:45 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:55:45 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From gmcm at hypernet.com  Sun Dec 23 20:15:16 2001
From: gmcm at hypernet.com (Gordon McMillan)
Date: 24 Dec 2001 01:15:16 GMT
Subject: Book "python programming patterns". anybody read this??
References:     
Message-ID: 

Peter Milliken wrote:

> Actually, I doubt there is any intersection - or perhaps I should
> qualify that by an intersection in the realms of code that you and only
> you will ever have to look at or maintain.
> 
> I side with Roy's opinions purely because it is almost never the code
> author that has to maintain the code (at least on systems I have worked
> on over the last 20 years :-)). 

This is ridiculous. I said I had to study some things to understand what was 
going on, and that has become "ewww, it must be bad code".

Every API has two sides. One side is supposed to be easy to use and 
understand. The other side almost certainly isn't. If the internals of 
Python dictionaries were easy to understand, their performance would suck.

If you're only interested in using APIs, this book probably isn't for you. 
But it's presumptuous to equate "challenging" with "bad".

-- Gordon
http://www.mcmillan-inc.com/


From wpmelcher at snet.net  Mon Dec 17 09:39:10 2001
From: wpmelcher at snet.net (Bill Melcher)
Date: Mon, 17 Dec 2001 14:39:10 GMT
Subject: Take 2: PEP draft for expression embedding
References:    <9vj0eq$593$2@peabody.colorado.edu> 
Message-ID: 

"Oren Tirosh"  wrote in message
news:mailman.1008591382.9467.python-list at python.org...
> On Sun, Dec 16, 2001 at 01:31:52PM +2328, Fernando P?rez wrote:
> > Sorry for being lazy, but since you've already done the search homework,
> > would you mind pointing to Frederik's post on i()? I've never seen it
and I'm
> > quite intrigued.
>
> It's ridiculously, why-didn't-we-think-of-this-before-ly simple:
>

Kwai Chang Caine would say: "There is always another way"

To reverse what Senior Wences hand puppet,  Johnny, used to say (on the Ed
Sullivan Show): "Easy for you, difficult for me" 

Although I have a lot of assembler experience, at Python I am a raw newbe,
but am learning.

Thanks, I'll put this 'trick' in my ever growing tool kit.

--
Cheers, Bill
TANSTAAFL!





From phd at phd.pp.ru  Mon Dec 10 04:03:37 2001
From: phd at phd.pp.ru (Oleg Broytmann)
Date: Mon, 10 Dec 2001 12:03:37 +0300
Subject: A common GUI define like rebol VID?
In-Reply-To: <9v12k6$ak9$1@mail.cn99.com>; from trytop@21cn.com on Mon, Dec 10, 2001 at 09:21:55AM +0800
References: <9v12k6$ak9$1@mail.cn99.com>
Message-ID: <20011210120337.E18573@phd.pp.ru>

On Mon, Dec 10, 2001 at 09:21:55AM +0800, luckey wrote:
> I don't understand why not python define a common GUI like REBOL VID ?

   Because Python is The Real Programming Language, not a small GUI toy.
How do you think to implemet that comman GUI on a Palm? Amiga? DOS? (Python
works on many, many different platforms, not only on XWindows and that
broken M$ Ophis GUI).

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.



From ssthapa at classes.cs.uchicago.edu  Fri Dec 28 17:27:52 2001
From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa)
Date: Fri, 28 Dec 2001 22:27:52 GMT
Subject: A new forum is up! Q: what means nntp
References: <40dbad98.0112262238.73fc14f9@posting.google.com>     
Message-ID: 

Anne & Lynn Wheeler  wrote:
>
>claird at starbase.neosoft.com (Cameron Laird) writes:
>> RFC 765  FILE TRANSFER PROTOCOL                        June     1980
>> RFC 821  SIMPLE MAIL TRANSFER PROTOCOL                 August   1982
>> RFC 854  TELNET PROTOCOL SPECIFICATION                 May      1983
>> RFC 850  Standard for Interchange of USENET Messages   June     1983
>> RFC 977  Network News Transfer Protocol                February 1986
>
>765 is the latest standard .... there is a trail of previous RFCs that
>were replaced by the latest ... going back to 

    Actually I believe rfc765 and rfc959 (FTP protocol) is superceded by 
rfc1123 which outlines and corrects the specifications for the ftp, telnet, 
smtp, and dns protocols. In particular interest to me, rfc1123 indicates that 
pasv responses in the ftp protocol don't have to have the format of 
227 (h1,h2,h3,h4,p1,p2). This was something that the python ftplib assumed until
the 2.2 release and which caused problems with anonftpd.

-- 
----------------------------------------------------------------------------
	   		              |
Suchandra Thapa                       | "There are only two kinds of math . 
s-thapa-11 at NOSPAMalumni.uchicago.edu  | books. Those you cannot read beyond 
			              | the first sentence, and those you 
			              | can not read beyond the first page."
			              |                     -C.N. Yang
----------------------------------------------------------------------------


From loewis at informatik.hu-berlin.de  Wed Dec 19 19:25:30 2001
From: loewis at informatik.hu-berlin.de (Martin von Loewis)
Date: 20 Dec 2001 01:25:30 +0100
Subject: problems building 2.1.1 on HP-UX 10.20
References: 
Message-ID: 

msoulier at nortelnetworks.com (Michael P. Soulier) writes:

> Any idea what's wrong?

That's very strange; it looks to me that Python has been
miscompiled. Did you use gcc, by any chance?

Regards,
Martin



From bill_mckinnon at interloper.net  Tue Dec  4 22:44:03 2001
From: bill_mckinnon at interloper.net (Bill McKinnon)
Date: 4 Dec 2001 19:44:03 -0800
Subject: try: and while/continue don't mix? Bizarre behavior with function calls.
Message-ID: <6ac595a2.0112041944.75dab62b@posting.google.com>

Ok, this one had me swearing I was going insane for a few minutes. I
whittled a 500 line snippet of code that was acting strangely down to
this example:

--
import sys, re

def func(lines):
    print "func() called."
    dataRe = re.compile(r'(\d+)')
    inserted = {}
    while 1:
        print "  Entering while loop."
        if len(lines) == 0:
            break
        line = lines[0]
        lines = lines[1:]
        match = dataRe.search(line)
        if not match:
            continue
        str = match.groups()
        try:
            if inserted.has_key(str):
                continue
            inserted[str] = 1
        except "invalidValue":
            pass
        print "  Exiting while loop."
    print "Exiting function."


# mainline
lines = ["11111", "11111"]    
func(lines)
--

   Can anyone explain to me how getting this for output is not a bug
in Python? The function is getting called twice:

--
func() called.
  Entering while loop.
  Exiting while loop.
  Entering while loop.
  Entering while loop.
func() called.
  Entering while loop.
Exiting function.
--

   This is happening with "ActivePython 2.1, build 210 ActiveState"
and with Python 2.1 under Linux that I built myself. Things that are
interesting to note:

- Making the lines list contain an odd number of identical values
makes the   problem go away.

- Commenting out either the if inserted.has_key(str): / continue lines
OR the   assignment to inserted[str] line makes the problem go away.

- Removing the try: block makes the problem go away.

- Removing the regex stuff makes the problem go away.

   I'm guessing that jumping in and out of the try: block with the
continue call is fouling something up. I'd be delighted to find out
that I'm doing something wrong and that it's not a python interpreter
level thing. Can anyone shed any light on this one? Thanks...

- Bill


From fperez528 at yahoo.com  Sat Dec  1 09:03:52 2001
From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=)
Date: Sun, 02 Dec 2001 13:31:52 +2328
Subject: Whatever happened to String Interpolation?
References: <9u6dbn$nsj$1@peabody.colorado.edu> <837ks6se4c.fsf@panacea.canonical.org> <9uc26v$akh$1@peabody.colorado.edu> 
Message-ID: <9ue35a$sbi$1@peabody.colorado.edu>

Oren Tirosh wrote:

> On Sat, Dec 01, 2001 at 07:03:19PM +2328, Fernando P?rez wrote:
>> Exactly my point. I think when I mentioned my need of inserting %
>> in strange dynamic strings I inadvertedly set the discussion
>> off-course. That was just a side comment, and by no means the meat
>> of my point. My important point is that Ping's PEP allows a _clear_
>> way of saying
>> 
>>         "x is $x, f(x) is $f(x)"
> 
> Will this do?
> 
> i"x is `x`, f(x) is `f(x)`"
> 
> Take a look at http://www.tothink.com/python/interpp
> 

I saw your pep, but reading Tim Peter's comments worries me, he seems 
to point to very valid concerns.

However, whether yours or Ping's, it seems that string interpolation 
*is* important to more than one or two people. I hope something 
eventually makes it.

Cheers,

f


From pieter.claerhout at pandora.be  Thu Dec 27 14:02:37 2001
From: pieter.claerhout at pandora.be (Pieter Claerhout)
Date: Thu, 27 Dec 2001 20:02:37 +0100
Subject: windows dialup connections
In-Reply-To: 
Message-ID: <000001c18f09$0ce49870$893676d5@tsjernochill>

take a look at the win32ras module. It does most of that stuff...


Pieter

-----Original Message-----
From: python-list-admin at python.org
[mailto:python-list-admin at python.org]On Behalf Of dk
Sent: Thursday, December 27, 2001 7:22 PM
To: python-list at python.org
Subject: windows dialup connections


Are there any bits of code out there to deal with the establishment, status
and just general manipulation of dialup connections under windows 9x, 2000,
NT? I'm having a hard time finding any if they exist. Should I be looking
under the win32api extensions?(I hope not ;-) Any pointers to more info
would be helpful. Thanks.

-DK



-- 
http://mail.python.org/mailman/listinfo/python-list




From jkraska at san.rr.com  Fri Dec  7 12:33:52 2001
From: jkraska at san.rr.com (Courageous)
Date: Fri, 07 Dec 2001 17:33:52 GMT
Subject: Calling a generator multiple times
References: <200112061113290670.0100F457@mail.rdc1.sdca.home.com>   
Message-ID: 

>That would reduce the power of generators in Python.  There would be no
>way to create a generator without starting it.

I don't think that's necessarily a bad thing, but what I feel
firmly about is that the current semantics versus syntax of
generators in python is obviously wrong.

Just about anything would be better, up to and including the
use of additional keywords. I simply feel strongly that as
long as a generator masquerades as a method, it ought to
behave like one, and that should be its default behavior.

If one wanted to create but not start, one might use "generate,"
e.g.:

f = generate g()
f()
f()
f()

Without "generate," you'd get invocation and generation behavior
at the same time.

C//



From laurent.pointal at laposte.net  Sun Dec  2 13:48:09 2001
From: laurent.pointal at laposte.net (Laurent Pointal)
Date: 02 Dec 2001 18:48:09 GMT
Subject: More assignment/copy novice confusion
References: 
Message-ID: 

[posted and mailed]

"Arthur Siegel"  wrote in 
news:mailman.1007306883.27068.python-list at python.org:

> Given a class:
> 
>>>> class  p:
>              def __init__(self,a):
>                  self.a=a
> Then -


 
>>>> m=p([1,2,3])
>>>> r=m
>>>> m.a=([1,2,4])
>>>> m.a
> [1, 2, 4]
>>>> r.a
> [1, 2, 4]
> 
> clear enough.



> But -
> 
>>>> m=p([1,2,3])
>>>> r=p([])

Here r and m reference two **different** objects of class p, with their own 
attributes.
Try "r is m", and it will reply 0.

>>>> r.a=m.a

Here m.a and r.a, which are attributes of different objects, reference the 
same list.

>>>> m.a=[1,2,4]

And now m.a reference another list.

>>>> m.a
> [1, 2, 4]
>>>> r.a
> [1, 2, 3]

You have stored orinal m.a list into r.a and then replaced m.a list, so you 
see the original in r.a and the new in m.a. 
Its normal.



> And -
> 
>>>> m=p([1,2,3])
>>>> r=m

Here r and m reference the SAME object, so modifying m data is like 
modifying r data.
Try "r is m", and it will reply 1.

>>>> r.a=m.a

This is not needed, as r and m are the same object, r.a and m.a are the 
same.

>>>> m.a=[1,2,4]

And again, m.a is r.a as m is r.

>>>> m.a
> [1, 2, 4]
>>>> r.a
> [1, 2, 4]

Its normal.

> I know this isn't the tutorial list.  
> 
> But - on the theory that my confusion 
> on these kinds of issues is widely shared 
> among novices - I thought it worth bringing
> up for discussion, clarification.

Hope my comments help.

> Is anything here affected by the new style classes?

A-priori, no.

> 
> Art

A+

Laurent.


From lac at strakt.com  Wed Dec  5 06:25:24 2001
From: lac at strakt.com (Laura Creighton)
Date: Wed, 05 Dec 2001 12:25:24 +0100
Subject: A modest indentation proposal 
In-Reply-To: Message from gat@jpl.nasa.gov (Erann Gat) 
   of "Tue, 04 Dec 2001 11:40:44 PST."  
References:   <3C0BBC1A.6E4154F@home.net>  <3C0BF0E8.2F9E2641@attbi.com>  <3C0D0CBF.33CF9EDF@attbi.com>   
Message-ID: <200112051125.fB5BPOua018753@ratthing-b246.strakt.com>

See:
http://groups.google.com/groups?q=emacs+pinard+group:comp.lang.python&hl=en&as_qdr=w&rnum=1&selm=mailman.1007080481.29616.python-list%40python.org

Now you can hack your emacs in python, thanks to  
Fran?ois Pinard (pinard at iro.umontreal.ca).  

Laura Creighton


From com-nospam at ccraig.org  Mon Dec 31 08:21:01 2001
From: com-nospam at ccraig.org (Christopher A. Craig)
Date: 31 Dec 2001 08:21:01 -0500
Subject: Python equivalent to @lines = 'command';
In-Reply-To: 
References: 
	
	
Message-ID: 

Christer Frovik <013-139047 at telia.com> writes:

> I wish those pyTHON (giggle) tutorials would include more of 
> these 'neat recepies'.

That isn't really its intention.  You may want to try the Python
Cookbook:
http://aspn.activestate.com/ASPN/Cookbook/Python


-- 
Christopher A. Craig 



From gh_pythonlist at gmx.de  Mon Dec 10 12:52:11 2001
From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=)
Date: Mon, 10 Dec 2001 18:52:11 +0100
Subject: How to change IP Address by Python program on Win Platform
In-Reply-To: <9v2fh1$pa9$1@ih292.ea.unisys.com>
References: <9v2aqb$mbt$1@ih292.ea.unisys.com>  <9v2fh1$pa9$1@ih292.ea.unisys.com>
Message-ID: <20011210175209.GA973@lilith.hqd-internal>

Le 10/12/01 ? 16:05, Joel Quinet ?crivit:
> [about changing IP address from Python]
> Windows Platform and more generally NT and 2K
> Sorry for that.

IIRC you cannot change the IP address on NT without rebooting. A common
solution is to create several hardware profiles with different network
settings (IP address, gateway, ...), then select the appropriate
hardware profile when booting.

I'm certain it's possible to change the IP address programmatically on
Windows NT 5.x, but as as far as I can see, the relevant API functions
aren't exposed to ActiveState's win32 extensions, yet.

According to the following sources, you should be able to do all that
from Python now (NT 4 requires registry changing and reboot; NT 5.x
obviously requires invoking a win32 commandline program called
netsh.exe). Caveat: I've personally never done this.

http://www.codeguru.com/internet/change_ip_address.shtml
http://www.codeguru.com/mfc/comments/21102.shtml

Gerhard
-- 
mail:   gerhard  bigfoot  de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))



From reynolds at panix.com  Fri Dec  7 10:03:15 2001
From: reynolds at panix.com (Brian Reynolds)
Date: 7 Dec 2001 10:03:15 -0500
Subject: Trouble building python modules under Solaris 8(SPARC)
Message-ID: <9uqlnj$9vv$1@panix3.panix.com>

I'm having trouble building both PIL and SciPy.  I'm running Solaris
8(SPARC) on a SunBlade 100.  I'm using gcc 2.95.3 as the compiler
using the Sun linker and assembler.  I get errors similar to the
following (taken from the SciPy build):

[lots of similar lines snipped]
                           0x5ac       /usr/local/lib/librfftw.a(fcr_32.o)
ld: fatal: relocations remain against allocatable but non-writable sections
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

It looks like the compiler is trying to make a relocatable object out
of a static library (fftw in this case).

Any hints on how to get this to work?

-- 
Brian Reynolds                  | "Dee Dee!  Don't touch that button!"
reynolds at panix.com              | "Oooh!"
http://www.panix.com/~reynolds  |    -- Dexter and Dee Dee
NAR# 54438                      |       "Dexter's Laboratory"


From Duxbuz at bbtinternet.com  Sat Dec  8 07:16:15 2001
From: Duxbuz at bbtinternet.com (Ian)
Date: Sat, 8 Dec 2001 12:16:15 -0000
Subject: python log() function
Message-ID: <9ut07m$qni$1@plutonium.btinternet.com>

Hello I am new to python and am trying to use it to work out a sum
log(20/7) / log(2)
which gives result
1.0

I am expecting to get 1.51 as a result, and using different langs such as
perl or php, I get the desired result of 1.51

It seems to me that python only goes to a certain decimal place, not as much
as the other compilers, can this be altered in anyway?

Ta.




From dalke at dalkescientific.com  Thu Dec 27 04:53:47 2001
From: dalke at dalkescientific.com (Andrew Dalke)
Date: Thu, 27 Dec 2001 02:53:47 -0700
Subject: REPOST: Re: Python Popularity: Questions and Comments
References: <3C2A9D33.67FEC261@earthlink.net>
Message-ID: <5$--$$-$$$$%_%__-$@news.noc.cabal.int>

Ron Stephens:
>How is Python doing popularity wise?

I can tell you that it's doing well in computational chemistry.
I know several places that have switched to doing development
in Python over Perl or other VHLLs.  I think it's because of
Python's readability and its easy ability to add new data types
which act like native objects.

In structural biology it also seems to be popular.  I know
of several Python projects (PyMol, VMD, MMTK, MSMS, Chimera), a
couple old ones in Tcl, none in Perl, none in Ruby.  Although
I'm biased by prefering Python, so I'm sensitized to Python
projects.

In bioinformatics, Perl is still the most popular, although
we (the Biopython project) are trying.  :)

>Python, while fabulously successful, is at an interesting point in its
>growth curve. It will be difficult to maintain the extremely high rate
>of growth exhibited so far; new contenders are possible problems; and
>the recessionary economy could also negatively impact Python's growth.

It's impossible to undergo a meteoric growth forever.  Exponential
growths must turn into S-curves.  So why should there be a need for
an extremely high growth rate?

>1. Ruby is an especially interesting competitor to Python. I have been
>monitoring the Ruby newsgroup, and it shows incredible growth and
>vitality. Furthermore, Ruby is aimed right at the heart of Python's
>niche.

I looked at Ruby last summer.  I read the documentation and
followed the newsgroup for a couple months.  I was able to follow
what was going on, but didn't want to see myself explaining it to
non-software developers; that is, the chemists, biologists, and
physicists who use the tools I develop.

I don't see how it's aimed at "the heart of Python's niche" -- what
do you see as Python's niche?  I see it as a language which is
usable by beginning programmers and enjoyable by experienced
developers.  I don't see Ruby really fitting the first of those.

(I don't see how '@var' obviously means "instance variable" nor
'$var' for "global variable", while Python's is much easier to
explain, since the 'self.' makes it more apparant.  I like that
Python doesn't have an implicit return of the last evaluated
expression, making it easier to find them.  I like that I can
say "methods inside of __s are special" as compared to Ruby where
you have to memorize that things like "to_s", "initialize", have
special meaning.  I like that empty function calls still need
a () in the declaration.  I don't like that Ruby promotes adding
methods to existing classes, since I think that can lead to
conflict.  I think 'abs(x)' is better than 'x.abs' or 'x.abs()'.
I'm forgetful, so I don't like special syntax shortcuts, like
  a = %w{ ant bee cat dog elk }
for
  a = ["ant", "bee", "cat", "dog", "elk"]
(especially since it can be written
  a = "ant bee cat dog elk".split() )
I don't like that regular expressions are treated with special
syntax.  I don't like having aliases, as Hash.indexes/indicies,
Array.len/size.  Ohh, and Hash has three equivalents in
has_key?(key) / key?(key) / include?(key) .

At the implementation level, I like that the C Python implementation
uses native threads rather than it's own threading package.  That
lets me work with other threaded libraries more easily.  I like that
the C garbage collector is built on reference counting, since I
need the guaranteed semantics more than I need lesser implementation
complexity. )


>If we view Microsoft's Visual Studio, especially Visual Studio.net's C#
>and VB, as the official 800 lb. gorilla of software development; and if
>we view Java as the 400 lb. gorilla pretender to the throne; and if we
>view Borland's Delphi and Kylix as no more than a smart leader of a
>chimp; then everything else is the pack of open source chimps.

Luckily, I work in a field where most people use unix for real
development, so solutions based on C# and VB just don't exist, and
there's a huge installed based of C and FORTRAN code.  I do know one
company doing some work with Kylix under Linux.

So I can't really comment on this paragraph.

>The open source world is still led by PERL, but PERL is truly more of a
>text processing, web CGI, scripting specialist; not so much of a direct
>threat to Python.

Why can't we all just get along?

Seriously, in my usual environment there are half a dozen "real"
programming languages in use (C, C++, FORTRAN, Python, Perl, Tcl),
a couple times more homebrew scripting languages (related to the
different scientific packages in use), and a slew of programs
which are only accessable through the command-line.

> Python aims to be a powerful general purpose
>programming language, in addition to being a very easy to learn and easy
>to use scripting language. And who can say that Python does not succeed
>very well in all of the above?

Is this what you see as Python's niche?  Someone in the Perl group
would say exactly the same thing, as would someone from Smalltalk,
and from Ruby, and from Tcl, and from ....

>But Ruby is also a more general purpose, object oriented, relatively
>easy to read, language.

What do you mean by "more general purpose"?  I didn't see all that
much in Ruby which was more general purpose than Python, especially
now with the closing of the type/class dichotomy.  I guess the
biggest ability is being able to send a block to be evaluated.
I know Smalltalk-ers love it, but to me things like

3.times do
  print "Ho! "
end

aren't as easy to explain or understand as

for i in range(3):
  print "Ho! "

(I know, I've been contaminated by years of BASIC, PASCAL, C,
and C++, but so have my clients.)

> Ruby folks include those who like its more
>Perl-like syntax, but Ruby's core converts believe that its pure,
>absolute object oriented nature exceeds those of Python and make it more
>worthy to long term success.

I know there's the argument that Ruby is "pure", but I think the
whole "functions are really private members of the Object base
class" idea is a sign of impurity, done because people are used to
writing functions and not having to define a static class method
like one might have to do for Java.  But I think impurity is a
good thing.  So I think the call for purity to be a wrong argument.
> They seem to see Ruby as a more modern, up-to-date version
> of Python.

I thought most people see Ruby as a more modern version of
Perl than Python.  I definitely see it as a cross between
Perl and Smalltalk, with some ideas derived from Python.

> They see Python as a compromise between object oriented and
> procedural programming.

And that's bad because ... why?  Compromise is often seen as
bad, yet the world works on it.  Others replace the term
"compromise" with "synthesis" or "fusion" or "hybrid" or many
other words.  The phrase "multiparadigm" is another fun one.

>Be that as it may, I suspect that much of Ruby's momentum is simply due
>to its newness; all things new are seen as sexy in this world of ours.
>But nonetheless, Ruby has the following going for it.

I agree with you.  I also think people are willing to give Ruby
a try, because they don't want to be seen as a fuddy-duddy.

>Now, its more like a 4:3 ratio, with Python getting say, 4000 per month,
>and Ruby 3000. At this rate, Ruby could pass Python is  afew months, by
>this measure!

How do they get any work done?  I can barely follow the outlines
of most of c.l.py these days.  Oh, and much of the development email
is on a pretty high-traffic mailing list, so c.l.py doesn't reflect
all the Python traffic.  Then there's the various lists like for
Jython and Zope, which get some Python questions.

Again, talking about the fields I'm in, I've been presenting
Python at computational chemisty and biology conferences for
the past three years.  I keep waiting for someone to ask me
"what aout Ruby?", but as of yet no one has.

There is one site for Ruby in bioinformatics -- bioruby.org.
That site seems to be down right now, but as I recall, the
packages they had were pretty minimal.  They had a presentation
at the last Bioinformatics Open Source Conference, but it
didn't show any real advantages over the equivalent Perl.
We were pushing to get a BioRuby developer at the upcoming
Bioinformatics hackathon (promo: co-sponsored by O'Reilly and
Electric Genetics, with support from the Open Bioinformatics
Foundataion, AstraZeneca, and your's truely, Dalke Scientific
Software :)  We couldn't get anyone.

>b. Ruby is getting alot of favorable press, and new books are coming out
>now. First, Pickaxe , now, Matz' own Ruby in a Nutshell and several
>others soon to be or already here.

If books are a good metric, then there's also plenty of new Python
books coming out (as you know from your dozen plus reviews :).
And Perl ones.  And Java ones.  It's just easier to notice when
there are only a few books.

>c. Ruby actually seems to be a nice language to me. Its object oriented
>features seem well thought out and yet its still easy to comprehend.

I had problems with it.  I could comprehend Python's features
from the documentation.  I still can't from the Ruby on-line docs.
One thing is that Ruby objects seem so heavy-weight to me.  For
example, Hash has support for a built-in default object, and
for "freezing" hash.  So if I wanted to make a Hash-like object,
I need to do quite a bit, I think.

(Again, I got into Python about 6 years ago, when the dictionary
object which much lighter weight than it is now, and I learned
about the changes when the occured instead of all at once.  Still,
Python's dictionary seems conceptually easier to understand and
use than Ruby's.)

>d. Ruby has some smart and aggressive coders doing libraries,
>extensions, Java version etc. etc. etc., tehy are agressive and
>motivated; tehy think they will see world domination ;-)))

They will leanr how to sepll 'tehy'?  :)

Python, Perl, and Java also have "smart and agressive coders" etc.
For example, I've seen nothing in Perl or Ruby to match
Marc-Andre Lemburg's mxTextTools, which I use for my Martel
parser.

>2. The economy is hurting Python's open source development model.

It is?  I guess I started when Guido worked at Stichting
Mathematisch Centrum, before CNRI, and I don't think then he could
ever work full time on Python.  The recent spate of development
progress has actually worried me, since I'm not able to follow
all this new work, like __getattribute__ and __slots__ and
new-style classes.

>Without Mark Hommond's win32 work, Python would be a mere shell
>of its current self.

A lot of that work was when he was a contractor, before working
with ActiveState.  I know PythonWin 1.5.2 has no ActiveState
copyright notice in it.

I can't make any real statement about the people you mentioned.
I can say Python developed without a lot of dedicated resources
for it, so I'm not going to worry about it.  Besides, why should
it affect Python any less than other projects?


>3. Third, Python faces the laws of large numbers. It is exceedingly hard
>to continue a growth spurt past a certain point. Maybe were at that
>point, maybe not. But ask yourself this; Two years from now, will you
>see more Python success stories, more growth, or a leveling out? Five
>years from Now?

So?  What's the growth curve in C?  Do you see more C success stories?
More growth, or a leveling out?

I expect to have success stories of my own in the 2-5 year range.

Frankly, for a while I was learning about better and better ways
to develop software:  BASIC -> Pascal -> C -> C++, then C/C++ augmented
with Tcl, then Perl, then Python augmented by C/C++, which is
where I'm at now.  I also tried out a dozen other languages,
including Prolog, APL, Lisp, and other classics, and read about
more languages, including Smalltalk and Eiffel.

As far as I can tell, I think the basics of the Ruby/Smalltalk/
Perl/Python/C/C++/Java/... class of languages are pretty well
understood.  I don't think Ruby or any similar language can
offer anything sufficiently new enough to get many people to
change.  The only new topic my limited prognositications can
make for the future is aspect oriented programming, and I don't
know enough of that to make any firm statement.

BTW, I think what's going to happen in Python's future is
1) refactoring browsers, like what Smalltalk has, 2) better
performance through some sort of typing, and 3) the development
of more specialized libraries for different domains.  (Please
bear in mind that I'm biased by being a library and application
programmer.)

>Ten years from now, will Python still be Relevant? Oh, I know that
>Python will still be being used, and the community will still exist, but
>will it really be a thing that seems to Matter, like it does now.

I hope not.  I want to have new tools and new ways of thinking
on programming.  It's still a lot of hassle to develop new code,
and I'm a slacker in the Gen-X mold, with a short attention span.
(Okay, the length of this response belies that statement :)  Still,
I want something better then Python, and I hope that in ten years
we'll at least start using it.  I also hope I'll recognize it
early enough, like I did with Python.

Mind you, Python's data model is still simple enough that it can
be ported to other systems without much effort.


                    Andrew
                    dalke at dalkescientific.com

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: "Andrew Dalke" 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 05:19:20 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775861 27193 211.57.49.2 (31 Dec 2001 05:17:41 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:17:41 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From phr-n2001d at nightsong.com  Mon Dec 31 12:55:27 2001
From: phr-n2001d at nightsong.com (Paul Rubin)
Date: 31 Dec 2001 09:55:27 -0800
Subject: Triangle Trigonometry
References: 
Message-ID: <7xitannuk0.fsf@ruckus.brouhaha.com>

thelmagonzales99 at yahoo.com (Thelma F. Gonzales) writes:
> I'm trying to write a script that will calculate an unknown angle in a
> triangle. I have the value for the side adjacent and the side opposite
> of the angle in question, therefore I need to use the tangent
> function. I understand how to determine this value in decimal units,
> however I need degree units. I can reach down and pick up my trusty
> calculator and hit the inverse key and then the tangent key and viola
> I have my degree measurement. But, alas I do not want to use my old
> calculator to measure a few thousand angles, and I cannot figure out
> how to do this using the math module. Does anyone know how to invoke
> the "inverse" function in python?
> 
> Perhaps one of you kind folks can help me out, for I am completely
> frustrated.

There's no "inverse" function.  The inverse of the tangent function is
a separate function called the arctangent.  math.atan(x) gives the
arctangent of x.  math.atan2(x,y) gives the arctangent of x/y.
For what you're doing, you probably want atan2, which does the
right thing when y=0, and so forth.

Note that these functions give you the answer in radians.
To convert radians to degrees, multiply by 180/pi.


From timr at probo.com  Sun Dec 30 17:17:06 2001
From: timr at probo.com (Tim Roberts)
Date: Sun, 30 Dec 2001 14:17:06 -0800
Subject: REPOST: Re: regex question: backreferences in brackets
References: 
Message-ID: <9$--$$_----____-%$@news.noc.cabal.int>

Jeremy Jones  wrote:
>
>I want to be able to match any character other than a character that I already matched and have a named (or numbered) group for.  For example:
>
>"""
>match_string = 'XXX|1|22|333|4444:'
>test_compile = re.compile(r'XXX(.)[^|]{1}\1[^|]{2}\1[^|]{3}\1[^|]{4}(.)')
>mymatch = test_compile.match(match_string)
>if mymatch:
>	print "Found a match"
>	print mymatch.group(0)
>else:
>	print "No match found"
>"""
>
>The format of the strings that I am trying to match are 3 specific 
>characters followed by some delimter followed by N number of characters
>other than the delimiter followed by the delimiter, etc.  

For this specific problem, wouldn't a string.split solution be more
efficient and understandable?

  matches = match_string.split( match_string[3] )

--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Tim Roberts 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 03:18:30 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774041 27193 211.57.49.2 (31 Dec 2001 04:47:21 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:47:21 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From pnorvig at google.com  Thu Dec  6 14:55:52 2001
From: pnorvig at google.com (Peter Norvig)
Date: Thu, 06 Dec 2001 11:55:52 -0800
Subject: Class equivalence?
References: <200112061149540390.01224BA2@mail.rdc1.sdca.home.com>
Message-ID: <3C0FCD48.8103B48B@google.com>

>>> issubclass(Daisy, Flower)
1

'is' tests for object identity. 'issubclass' tests for class
inheritance.  Also 'isinstance' tests for class membership:

>>> isinstance(Daisy(), Daisy)
1
>>> isinstance(Daisy(), Flower)
1
>>> isinstance(Flower(), Daisy)
0
>>> 

Bruce Eckel wrote:
>>> 
> >>> class Flower: pass
> >>> class Daisy(Flower): pass
> >>> Daisy is Flower
> 0
> 
> What am I missing here?



From jcromwell at ciena.com  Fri Dec  7 12:27:09 2001
From: jcromwell at ciena.com (Cromwell, Jeremy)
Date: Fri, 7 Dec 2001 09:27:09 -0800 
Subject: list comprehensions to effect visitors
Message-ID: 

Peter,
I thought we weren't supposed to help people with their homework?

I know, you just want  to encourage an author  whose written some good books on other languages  to
complete his Python book for the benefit  of all of us.

subliminal-messages-need-never-be-queued-ly yr's,
**********************************************************
Jeremy Cromwell
CIENA Core Switching Division
jcromwell at ciena.com



-----Original Message-----
From: Peter Hansen [mailto:peter at engcorp.com]
Sent: Thursday, December 06, 2001 7:11 PM
To: python-list at python.org
Subject: Re: list comprehensions to effect visitors


Bruce Eckel wrote:
> 
> I am in fact feverishly translating "Thinking in Patterns" into
> "Thinking in Python" to prepare for my tutorial at the Python
> conference, which is due monday. I was certain it would be an
> enormous job as it was with C++ and Java to write these examples,
> but as usual Python changes everything, and I might even hit the
> deadline.

Why not post some of the samples here as a translation exercise?

I'm sure there would be a few people interested in helping
translate some of them over the weekend.  People with no lives.
(No, not people like me.  I meant *other* people... ;-)

the-c.l.p-community-is-a-large-part-of-python's-advantages-ly yr's,
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com
-- 
http://mail.python.org/mailman/listinfo/python-list



From gh_pythonlist at gmx.de  Tue Dec 25 03:35:48 2001
From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=)
Date: Tue, 25 Dec 2001 09:35:48 +0100
Subject: How do I access DoS thru Python?
In-Reply-To: <40dbad98.0112242348.46af380f@posting.google.com>
References: <40dbad98.0112242348.46af380f@posting.google.com>
Message-ID: <20011225083545.GA1245@lilith.hqd-internal>

Le 24/12/01 ? 23:48, Andrew Nguyen ?crivit:
> Well, the subject answers it...

No, it doesn't. It's very often a complete waste of time for both sides
if the one who asked makes us guess. So please be a little bit more
elaborate in your questions.

Gerhard
-- 
mail:   gerhard  bigfoot  de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))



From hfoffani at yahoo.com  Fri Dec  7 07:31:11 2001
From: hfoffani at yahoo.com (Hernan M. Foffani)
Date: Fri, 7 Dec 2001 13:31:11 +0100
Subject: Lists of attributes
References:  
Message-ID: <20011207073156.545$34@news.newsreader.com>

"Bruce Eckel"  escribi?
>
> Aha! Now, is it possible to install two different versions of
> Python on my Win98 machine at the same time? I ask because I need
> to run the ActiveState build for Python-COM stuff...

It is possible to have two different Python releases in the same box.
For instance, Python 2.1 (any 2.1 family) and Python 2.2 (any 2.2
family). The standard install procedure lets you do this.
I don't know if it's possible to install two different releases of
the same family, ie: 2.2a2 and 2.2b1
Beware, please, as you seem to have an important deadline RSN!

FYI, I didn't install ActiveState Python, so I can't confirm you
this:
It might be possible to install ASPython 2.1.1.212 and Python
Standard Distrib 2.2b1 in the same box, but I'm not 100% sure.

Regards,
-Hernan








From lac at strakt.com  Wed Dec 12 08:02:51 2001
From: lac at strakt.com (Laura Creighton)
Date: Wed, 12 Dec 2001 14:02:51 +0100
Subject: problems subclassing a PMW widget 
In-Reply-To: Your message of "Tue, 11 Dec 2001 23:24:14 GMT."
Message-ID: <200112121302.fBCD2pua005292@ratthing-b246.strakt.com>

> Greg Goodman:
> Either I'm doing something wrong, or the Pmw widgets aren't meant to be
> subclassed.  I'm hoping it's me.

I have very bad news for you.  I could never get it to work and
neither could anybody else I talked to.  I hope you only need one
widget, because its not just that one it is damn near all of them that
you discover you can subclass only so much and then its all over.
You need to check out tix to see if that kit has what you want.  You
might want to look at the Tkinter 3000 from Pythonware.  You
definitely want to look at their IDE because if you can get their
Tkinter builder to build what you want you will be so pleased.  There
may be other things you should do, but they never occurred to me.
And I was looking all alternatives to : 

If that does not work you may get my life.  Project slips for *MONTHS*
in part because I have to get up every day and face coding another
widget.  The only widgets I actually care about are new ones that
you design yourself, so this is a day of tedium and no joy which is
not what I founded this company for.  I could get pleanty of that
without working so damn hard.  And when you take a break you see
that pleanty of people here can't find something more creative to
do than argue about tabs and spaces.  I have a PEP to fix that
coming right up when Barry gets around to it.  It occurs to me:
I have enough coding projects on my todo list to last me about
7 lifetimes.  I am in no way ego bound possessive of nearly all
of them.  If you don't have anything more interesting to do -- want
some?

But back to the megawidgets.
I needed to subclass them _a lot_.  Sending you ours will not fix
your life (unless you have an _extremely_ weird life ).

If somebody now posts a fix (Mail to Greg McFarlane the maintainer
as well please -- he doesn't have the fix) you will get your choice.
I can die of joy that there was one after all, or out of frustration
for having pointlessly wasted my life.  Not sure there are any other
options out there for me.  But I would like to see a fix.

Laura Creighton



From store_li at sina.com  Tue Dec 18 23:31:20 2001
From: store_li at sina.com (Kick)
Date: Wed, 19 Dec 2001 12:31:20 +0800
Subject: It's Tk's fault
Message-ID: <9vp5bv$gvfps$1@ID-12869.news.dfncis.de>

I have done some experiment:

Using the same code to retrieve data from database:

1. Display data using console by print clause
2. Display data using HTML using gb2312 encoding.
3. Display data using wxPython
4. Display data using Tk

Only tk display a wrong char. I know Tk is easy to use and modify. So is
there any one who can help me to display Chinese code correctly in Tk
widget?

Great Thanks!!




From bob at passcal.nmt.edu  Tue Dec 11 19:00:37 2001
From: bob at passcal.nmt.edu (Bob Greschke)
Date: Tue, 11 Dec 2001 17:00:37 -0700
Subject: Getting at an item in a list of tupples
Message-ID: <9v66mi$17mi$1@newshost.nmt.edu>

Here's what I've got

   a = []
   a.append((ints, floats, strings))
   a.append((ints, floats, strings))
   a.append((ints, floats, strings))
   a.append((ints, floats, strings))
   ...

I want to do something like

   print max(of all of the floats)
   print min(of all of the floats)

In general, how do you get at the floats (or ints, or strings)?  We
can see doing something with map() calling a function that returns the
second item, but isn't there something a little simpler?

Thanks!

Possibly Stupid





From peter.milliken at gtech.com  Mon Dec  3 22:51:27 2001
From: peter.milliken at gtech.com (Peter Milliken)
Date: Tue, 4 Dec 2001 14:51:27 +1100
Subject: Python evangelists unite!
References: 
Message-ID: <9uhh97$b346@news1.gtech.com>

Agreed Jim :-), there are many shades of grey in between. Note that I have
never said that you *can't* do it in Python - just that I believe there are
better languages for larger programs i.e. the cost of production would be
less in some languages than if you did it in Python - this must also be
tempered with exactly what you are coding i.e. Python is very, very good at
certain things, therefore if your program would benefit from those features
of the language then by all means - there are rarely any absolutes in this
world :-).

Just like you can produce large programs in C++ (but I wouldn't personally
:-)) - just out of curiousity, why was the C++ version of the product
replaced by a Jython version? Too difficult/expensive to update to the new
requirements?

Any ideas of what the maintenance costs of the C++ version were in
comparison to any other language? Was the Jython version cheaper, more
expensive or the same in terms of productions costs as the C++ version? What
were the problems encountered by the various teams using Jython? It has
always interested me what the selection process is in choosing a language
for a project - do you know how and why Jython was chosen? Was it because of
popular aclaim or was some formal comparision of various languages
performed? If there was some formal selection process, what languages were
considered? What features of Jython caused it to be selected? i.e. what
features where missing in the other languages under consideration.

Peter

 wrote in message
news:mailman.1007425027.30019.python-list at python.org...
>
> Peter Milliken wrote:
> >Obviously you haven't worked at the architectural
> >level of any *large* projects (10's or even 100's of programmers)
> otherwise
> >you would never make the statements you do. Ignorance is bliss I guess
:-)
>
> But since all things are not simply "black or white" you might want to
keep
> in the back of your mind the fact that our company has written a
successful
> commercial product that comprises several hundreds of thousands of lines
of
> Jython code written by several dozen programmers working in multiple
> locations throughout the world and has been in production use for over a
> year and is expected to be supported for many years to come (the C++
> product that it replaced has been supported in production use for over
> seven years and counting).
>
> Jim
>
>
>




From tripps81 at yahoo.com  Fri Dec 21 04:47:25 2001
From: tripps81 at yahoo.com (Tripp Scott)
Date: Fri, 21 Dec 2001 16:47:25 +0700
Subject: marshalling data structures between perl <-> php <-> python
Message-ID: <5.1.0.14.2.20011221164328.031b3b50@202.95.131.154>

aside from using XML-RPC, what python module can i use to 
marshall data structures (possibly a combination of lists, 
dictionaries, and scalars of ints, floats, ascii strings, and 
null values) between these three languages? i prefer a compact, 
common binary format rather than XML.

t




From mwh at python.net  Mon Dec  3 05:53:49 2001
From: mwh at python.net (Michael Hudson)
Date: Mon, 3 Dec 2001 10:53:49 GMT
Subject: termios
References: <3C0B392D.3080801@beth.uniforum.org.za>
Message-ID: 

mixo  writes:

> Here is the situation : I want to connect to device
> that connected on a serial port (ttySx - linux speak).
> My problem : all the functions in 'termios' require a file
> descriptor. Is there a way open 'ttySx' and get a file
> descriptor? For instance will,
>    fd = open ('/dev/ttyS0')
> actually work?

os.open?

open("blah").fileno?

(Actually, passing a file object to the termios functions will work in
2.2.)

Cheers,
M.

-- 
  Well, yes.  I don't think I'd put something like "penchant for anal
  play" and "able to wield a buttplug" in a CV unless it was relevant
  to the gig being applied for...
                                 -- Matt McLeod, alt.sysadmin.recovery


From loewis at informatik.hu-berlin.de  Fri Dec 21 12:18:06 2001
From: loewis at informatik.hu-berlin.de (Martin von Loewis)
Date: 21 Dec 2001 18:18:06 +0100
Subject: Another distutils question
References: <9vumpp$hn2$1@peabody.colorado.edu>
Message-ID: 

Fernando =?ISO-8859-1?Q?P=E9rez?=  writes:

> For the distutils gurus out there: how can I specify a hierarchy of nested 
> directories to be copied somewhere?

For PyXML, we use an enhanced install_data command, that supports
manifest-style file lists. You can find it in the PyXML CVS, under
xml/setupext.

HTH,
Martin



From jason at jorendorff.com  Tue Dec 11 19:00:16 2001
From: jason at jorendorff.com (Jason Orendorff)
Date: Tue, 11 Dec 2001 18:00:16 -0600
Subject: input
In-Reply-To: 
Message-ID: 

"Preben"  wrote:
> How do I make a unbufferedinput from the user?
> (So they don't have to hit enter to send)

import msvcrt  ## Windows only
msvcrt.kbhit() tells if input is ready,
msvcrt.getch() gets it without displaying the character,
msvcrt.getche() gets it and also displays the character (e for echo).

or

import termios, tty  ## Unix only
Use termios.tcgetattr() first, to get the normal terminal settings.
Use tty.setcbreak() or tty.setraw() to set the terminal to behave
   in various weird ways.  cbreak is probably what you need.
Use termios.tcsetattr() to restore normal settings when you're done.

# -------------------------------------------------------------------
import termios, TERMIOS, tty
from sys import stdin, stdout

STDIN_FILENO = 0
old_settings = termios.tcgetattr(STDIN_FILENO)
tty.setcbreak(STDIN_FILENO)

try:
    while 1:
        x = stdin.read(1)
        if x == 'q':
            break
        print "you typed chr #%i" % ord(x)
finally:
    # Restore the previous settings
    termios.tcsetattr(STDIN_FILENO, TERMIOS.TCSAFLUSH, old_settings)
# -------------------------------------------------------------------


> Is it possible to make it so that you don't see what you're
> typing.. e.g. to logins?
> or maybe replacing the output with * ??

import getpass
pw = getpass.getpass("enter password: ")

-- 
Jason Orendorff    http://www.jorendorff.com/




From mwh at python.net  Tue Dec 18 15:52:20 2001
From: mwh at python.net (Michael Hudson)
Date: Tue, 18 Dec 2001 20:52:20 GMT
Subject: Cygwin socket library status enquiry
References:   <20011218131502.GA2268@dothill.com>   <2JJT7.22497$PA.5674@atlpnn01.usenetserver.com>    
Message-ID: 

"Steve Holden"  writes:

[snip]
> It has already been reported (thirteen days ago) as
> 
> 
> http://sourceforge.net/tracker/?group_id=5470&atid=105470&func=detail&aid=48
> 9709
> 
> and it apparently looks like it won't be fixed in the 2.2 timeframe -- it
> needs attention from the Cygwin team, who aren't synchronized to Python
> releases. So I have just added a note that the bug applies to 2.2c1/Win98 as
> well. We'll see what happens...

Well, that bug is assigned to me, and there's a comment (also from me)
describing how to get round it (build _socket statically), which is
duplicated in the README (in a section written by me and Jason and
checked in by me) to the same effect.

It's safe to say I knew about this .  I should have warned you
about it, though -- sorry about that.

> I'll see what I need to omit to get it to build, and follow up if I
> make progress.

You need to build _socket statically.

I might see if I can bodge setup.py so that it screams at you if you
try to build a dynamic _socket module on cygwin.

Cheers,
M.

-- 
  While preceding your entrance with a grenade is a good tactic in
  Quake, it can lead to problems if attempted at work.    -- C Hacking
               -- http://home.xnet.com/~raven/Sysadmin/ASR.Quotes.html


From sholden at holdenweb.com  Tue Dec 11 08:14:35 2001
From: sholden at holdenweb.com (Steve Holden)
Date: Tue, 11 Dec 2001 08:14:35 -0500
Subject: trouble with import odbc
References: <9v3aj4$9ke$1@news.netmar.com>
Message-ID: 

 wrote in message
news:9v3aj4$9ke$1 at news.netmar.com...
>
> Anyone ever seen this error given the code after that:
>
>  File "odbc.py", line 1, in ?
>    import dbi, odbc, sys
>  File "odbc.py", line 4, in ?
>    s = odbc('postgresql/postgres/n4pk1n')
> TypeError: object of type 'module' is not callable
> -----------------
> import dbi, odbc
>
> s = odbc('postgresql/postgres/n4pk1n')
> cur = s.cursor()
> cur.execute('select * from discounts')
> print cur.description
> for tup in cur.description:
>         print tup[0], print
> while 1:
>         rec = cur.fetchmany(10)
>         if not rec: break
>         print rec
>
>
> Finding it very hard to chase stuff like this down.  What the heck does
that
> error message mean?  Maybe some nutrinos caused two bits on my hardrive to
> swap so that the module is corrupt and isn't callable?  Whatever.  Anyway,
> Thanks in advance!  wryder at taz.cs.wcupa.edu
>
First you have to go into the ODBC settings (Start Menu | Settings | Control
Panel, double click on ODBC) and create a System DSN pointing to the
database you want to use. This will require you to have a PostgreSQL ODBC
driver loaded, whcih I assume you've done.

Then you should call

    conn = odbc.odbc("DSNName")

to make the connection to your database. The error message is an exact
description of what you are doing wrong. You would get the same thing if you
wrote

    import sys
    sys("Hello")

regards
 Steve
--
http://www.holdenweb.com/







From roy at panix.com  Tue Dec 25 17:04:44 2001
From: roy at panix.com (Roy Smith)
Date: Tue, 25 Dec 2001 17:04:44 -0500
Subject: How best to check for existance of an attribute?
References:  
Message-ID: 

Michael Hudson  wrote:
> By using hasattr?

Doh!  Thanks.  I probably knew about hasattr() once (I first learned python 
about 4 years ago), but forgot about it.

It's kind of wierd -- I just "discovered" the insert() and pop() list 
methods the other day, browsing the docs.  I'm sure I read about them when 
I was just learning the language, but they didn't seem to get bound to any 
brain cells.  I wonder what else I've forgotten about the language?


From mwh at python.net  Sun Dec 23 06:50:30 2001
From: mwh at python.net (Michael Hudson)
Date: Sun, 23 Dec 2001 11:50:30 GMT
Subject: RELEASED - Python 2.2 final
References: 
Message-ID: 

"Brian Quinlan"  writes:

> Anyone know what ActiveState is doing with respect to ActivePython? Is
> ActivePython 2.2 final going to be out soon?

According to:

http://aspn.activestate.com/ASPN/Mail/Message/python-dev/955367

there will be a ActivePython 2.2.  Dunno about "soon", but it seems
likely.

Cheers,
M.


From donn at u.washington.edu  Tue Dec 18 16:59:37 2001
From: donn at u.washington.edu (Donn Cave)
Date: 18 Dec 2001 21:59:37 GMT
Subject: Python as RedHat/SysV service
References: <9voavb$rpj$1@nntp2-cm.news.eni.net>
Message-ID: <9voe89$119q$1@nntp6.u.washington.edu>

Quoth "Stuart D. Gathman" :
| I have a system service written in python.  On RedHat systems, this
| service is conveniently installed and started by placing a script in
| /etc/rc.d/init.d to start,stop,reload, etc the service.  The standard
| methods for checking whether a service is running or sending it a signal
| rely on the process name: e.g. 'inetd'.  In this case, the process name is
| always 'python2'.
|
| Is there a way to change the process name of a running python program?  Or
| is it better to craft a new version of 'pidof' that works for python
| processes?  Has anyone dealt with this before?

As you noticed, that "standard method" isn't a very good one!  What
about other services that run under their own name but fork, like sshd?

Many services, including sshd for example, write their process ID to a
well known file - might be in /etc/budgie.pid, /var/run/budgie.pid, etc.,
depending mostly on the platform.  (Could be defined as _PATH_VARRUN in
paths.h, on fairly modern platforms.)

Then all you have to do is verify that no other process has taken that
ID since then, so you don't kill something else by accident.  Your service
can lock the file, for example, and if it's still locked then it must
be the right file.

	Donn Cave, donn at u.washington.edu


From mixo at beth.uniforum.org.za  Tue Dec  4 05:36:29 2001
From: mixo at beth.uniforum.org.za (mixo)
Date: Tue, 04 Dec 2001 12:36:29 +0200
Subject: 'ioctl ' call in python (serial port reading)
References: <3C0C8FF3.7060500@beth.uniforum.org.za> <20011204110657.139799b7.use-net@schabi.de>
Message-ID: <3C0CA72D.7040304@beth.uniforum.org.za>

Markus Schaber wrote:

> Hi,
> 
> On Tue, 04 Dec 2001 10:57:23 +0200
> mixo  wrote:
> 
> 
>>I am current trying to drop 'RTS' (Request To Send)
>>on a serial port. In 'c' I do the following :
>>
>>++++++++++++++++++++++++++++++++++++++++++++++++
>>.
>>.
>>
>>int fd, mdlns;//fd is a  file discriptor
>>.
>>.
>>
>>ioctl (fd, TIOCMGET, &mdlns);
>>mdlns &= ~TIOCM_RTS;
>>ioctl (fd, TIOCMSET, &mdlns);
>>.
>>.
>>.
>>+++++++++++++++++++++++++++++++++++++++++++++++
>>
>>What would the equivilent code in 'python' be?
>>How can I disable 'RTS' on a serial port?
>>
> 
> Usually, on unixoid Python incarnations, you have the fcntl module which provides an ioctl call. The os module allows you to work with fd filedescriptors.
> 
> With those, you should be able to translate your example 1:1 to python.
> Just look into the documentation for the os and fnctl module.
> 
> markus
> 

Yes, "unixoid Python incarnations" have the functions. But, here is the 
thing, in the above code, the variable "mdlns" is an integer, but 
"&mdlns" is an address. How do I get around that?




From anthony at interlink.com.au  Sat Dec 22 20:49:08 2001
From: anthony at interlink.com.au (Anthony Baxter)
Date: Sun, 23 Dec 2001 12:49:08 +1100
Subject: Preserving program structure 
In-Reply-To: Message from "Steven Feil"  
   of "Sun, 23 Dec 2001 01:43:07 GMT."  
Message-ID: <200112230149.fBN1n8O28327@mbuna.arbhome.com.au>

Alternately, if you've got tabs&spaces all mixed up and confused, something 
like the command 'expand' will do the right thing with removing tabs.

Anthony

-- 
Anthony Baxter        
It's never too late to have a happy childhood.




From Daniel.Kinnaer at Advalvas.be  Thu Dec 27 08:28:03 2001
From: Daniel.Kinnaer at Advalvas.be (Daniel)
Date: Thu, 27 Dec 2001 14:28:03 +0100
Subject: Running a script in windows
References: 
Message-ID: <638m2u8frhvp7be8piena9q1ll7cf07qac@4ax.com>

On Thu, 27 Dec 2001 20:51:49 +0900, Jonathan Gardner
 wrote:

>I know this comes up a lot, but I can't seem to find the answer in the 
>archives. (If the answer is RTFM, please let me know where.)
>
>I don't have a windows box on my desk. A friend of mine does, but I can't get 
>to it. He is trying to run a program I wrote, but the error message is coming 
>up too fast for him to catch it. How can you keep that error message window 
>around longer in Win2K? (BTW, let's pretend he doesn't know how to use the 
>DOS prompt.)
>
>Jonathan


Use the command window (c:\winnt\system32\cmd.exe or click
"Start->Run" and write "cmd" click on "Ok") and call the python module
like 'python myscript.py -v'   (-v if youre program has argv)

Hope this helps.   Best regards,   Daniel


From mkelly2002NOSPAM at earthlink.net  Mon Dec  3 15:24:50 2001
From: mkelly2002NOSPAM at earthlink.net (Michael Kelly)
Date: Mon, 03 Dec 2001 20:24:50 GMT
Subject: COM "out" Variant Array params and such
References:  <3C0AC811.4000406@ActiveState.com>
Message-ID: 

On Mon, 03 Dec 2001 00:30:03 GMT, Mark Hammond 
wrote:

>The correct way to call this should be:
>
>VariantArrayOfStrings = MyIniFile.ReadSections("Section name")

Just to update you I got my component to work as expected.
I'm happy to find all the bugs were in my code. :)
I changed the ReadSections type methods to out retval
and recoded and they work.  The strange error with
"returned error without exception" or whatever that
message was disappeared when I used the
pywintypes.Time() to convert default times and
dates in the DIniFile.ReadTime type method calls.
Passing in a raw float as a default time or date to
return if there was nothing in the .ini file seems to
have tripped a type eror or some such.

So, looks like nothing's broken and I'll get this puppy to work. :)
Thanks again for the help.


Mike

--

"I don't want to belong to any club that would have me as a member."
    -- Groucho Marx


From km-list-python at miazine.net  Tue Dec 18 05:19:33 2001
From: km-list-python at miazine.net (Kirill Miazine)
Date: Tue, 18 Dec 2001 11:19:33 +0100
Subject: implementing a timer?
In-Reply-To: <9vn0gv$ll6$1@colo.mobo-it.nl>
References: <9vn0gv$ll6$1@colo.mobo-it.nl>
Message-ID: <20011218111933.H15950@poff.miazine.net>

* waalp  [20011218 10:56]:
> I'm trying to make a script that will check if i have mail every let's say
> 10 minutes.So i tought let's use something like a timer. But i can't find
> any documentation on how to implement something like this.
> 
> I'm a beginner so it could be that i haven't looked in the right places.
> Could somebody please help?

import time
time.sleep(600) # sleep for 600 seconds

-- 
Kirill



From fdrake at acm.org  Mon Dec  3 16:25:48 2001
From: fdrake at acm.org (Fred L. Drake)
Date: Mon,  3 Dec 2001 16:25:48 -0500 (EST)
Subject: [development doc updates]
Message-ID: <20011203212548.5590C28698@cj42289-a.reston1.va.home.com>

The development version of the documentation has been updated:

    http://python.sourceforge.net/devel-docs/

Added documentation for the ScrolledText module.



From tim at vegeta.ath.cx  Mon Dec  3 22:18:39 2001
From: tim at vegeta.ath.cx (Tim Hammerquist)
Date: Tue, 04 Dec 2001 03:18:39 GMT
Subject: python editor poll
References: <3bfd7f87@news.airtel.net>  <3C03CFAC.6A29863@earthlink.net>    
Message-ID: 

Quinn Dunkan  graced us by uttering:
> On Thu, 29 Nov 2001 23:19:44 +0100, J?rgen A. Erhard  wrote:
>>And in my case... Emacs, since I happened to run across uEmacs in my
>>Amiga days (first editor that felt *good*).  (As if anyone wanted to
>>know that ;-)
> 
> vim was originally an amiga editor, I think.  Or at least had ports
> early on.  The first time I ran across vim was version 1.something
> on a Fred Fish CD, and I had been using uEmacs at the time :)

IIRC, Bram's forward to the New Rider's Vim book mentions that Bram
himself was using Amiga when he decided he wanted to use vi. The rest,
as they say, is history.

Tim Hammerquist
-- 
Obviously I was either onto something, or on something.
    -- Larry Wall on the creation of Perl


From aleax at aleax.it  Fri Dec 28 11:14:32 2001
From: aleax at aleax.it (Alex Martelli)
Date: Fri, 28 Dec 2001 17:14:32 +0100
Subject: REPOST: Re: How best to check for existance of an attribute?
References:  <3c28f373$0$79558$6e49188b@news.goldengate.net>
Message-ID: <9$--$$_----_---$_$@news.noc.cabal.int>

"Greg Krohn"  wrote in message
news:3c28f373$0$79558$6e49188b at news.goldengate.net...
> "Roy Smith"  wrote in message
> news:roy-DD8C6B.16193025122001 at news1.panix.com...
> > I've got a function which augments an object passed to it by adding a
new
> > attribute.  Something like this:
> >
> > def addStuff (obj):
> >    obj.newAttr = "stuff"
> >
> > I want it to be an error to call addStuff() more than once for a given
    ...
> This is what I would do:
>
> def addStuff (obj):
>     if hasattr(obj, 'stuff'):
>         raise MultipleCallError
>     else:
>         setattr(obj, 'stuff', None)

class Tricky:
    newAttr = "aDefault"

dick = Tricky()


Now, addStuff(dick) would fail.  Is this what the OP wants?  Maybe (some
of his examples "ways to do it" would behave the same way) but it doesn't
quite sound right given the specs of "calling more than once".

The point is just that hasattr also finds the attributes in the object's
class.  If you only want attributes _in the object itself_, NOT ones the
object gets from its class, it's a bit trickier, depending on what exact
range of cases you want to handle (e.g., can obj be assumed to have a
__class__ attribute, as in Python 2.2, or do you have to check for that,
too?).  Assuming only objects with a __class__ are of interest (or that
only Python 2.2 and up is of interest), then, maybe, a sentinel-like
approach might be simplest:

def addStuff(obj):
    class Unique: pass
    inclass = getattr(obj.__class__, 'stuff', Unique())
    inobject = getattr(obj, 'stuff', inclass)

    if inobject is inclass:
        obj.newAttr = "stuff"
    else:
        raise MultipleCallError, obj

This might still fail, depending on interning of "stuff",
for:
    addStuff(obj.__class__)
    addStuff(obj)
where the second call would be wrongly diagnosed as multiple.  Is
there a need to support this usage?

Testing if obj.__dict__.has_key('stuff') might often help,
but would still fail in 2.2 if obj didn't have a __dict__.
Is THIS a problem?

Only the OP knows...


Alex

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: "Alex Martelli" 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 02:03:26 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775273 27193 211.57.49.2 (31 Dec 2001 05:07:53 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:07:53 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From shalehperry at attbi.com  Sun Dec 30 00:08:43 2001
From: shalehperry at attbi.com (Sean 'Shaleh' Perry)
Date: Sat, 29 Dec 2001 21:08:43 -0800 (PST)
Subject: Reg-Ex and lambda optimization
In-Reply-To: 
Message-ID: 

> 
>     Is the re.match('^db.*$',s) compiled each iteration of the loop lookup?
> 
> I don't notice this being slow, but was curious if this was bad coding.
> 

from sre.py in 2.2:

def match(pattern, string, flags=0):
    """Try to apply the pattern at the start of the string, returning
    a match object, or None if no match was found."""
    return _compile(pattern, flags).match(string)

def _compile(*key):
    # internal: compile pattern
    p = _cache.get(key)
    if p is not None:
        return p
    pattern, flags = key
    if type(pattern) not in sre_compile.STRING_TYPES:
        return pattern
    try:
        p = sre_compile.compile(pattern, flags)
    except error, v:
        raise error, v # invalid expression
    if len(_cache) >= _MAXCACHE:
        _cache.clear()
    _cache[key] = p
    return p

So the first time you get all of the way through _compile, after that the cache
hits and you hit the first return on line 3.  One extra dictionary lookup
and one function call each re.match call may or may not matter in the grand
scheme of things.



From akuchlin at mems-exchange.org  Fri Dec 14 10:24:48 2001
From: akuchlin at mems-exchange.org (Andrew Kuchling)
Date: 14 Dec 2001 10:24:48 -0500
Subject: Fallen Angels, Originators of Evil on Planet Earth?
References: 
Message-ID: <3ditb9q0xr.fsf@ute.mems-exchange.org>

news at originsofevil.com writes:
> Fallen Angels, Originators of Evil on Planet Earth?

And they multitask, too!  From _Demon Possession Handbook for Human
Service Workers_, at http://diskbooks.org/part1.html:

	10. Demonic Time-Sharing 
	
	Back in the days when Jesus walked the earth and evicted a
	legion [6,000] demons out of one man, the world population was
	a fraction of what it is today. In fact, population experts
	believe the number of people alive today exceeds all the
	people who have died since the dawn of creation. Let's assume
	that the number of demons is fixed and that number is the same
	today as it was when Adam and Eve walked in the Garden of
	Eden. This means that demons today have to cover more
	territory -- in terms of human beings -- than at any time in
	the history of the human race. One way demons can accomplish
	this feat is through what computer experts refer to as
	time-sharing. In the computer world, a large main-frame
	computer can be used by many people at the same time, without
	those users even knowing about the existence of each
	other. When telephone lines are used, people from all over the
	world can access the same computer simultaneously. The
	computer works with each user in turn and does so with such
	speed that each simultaneous user has the illusion of being
	the only person logged on at that time. The Internet uses a
	form of time-sharing. It may not be as fast as you would like,
	but it's time sharing.

	Demons may work the same way. Although they are not
	omnipresent in the same sense as God is everywhere at the same
	time, apparently they can move from point to point at very
	high speeds. Assuming that their minimum speed of travel is
	the speed of electricity, 186,000 miles per second, a single
	demon can trouble a large number of people in the course of a
	few minutes. This is like a computer is able to work with a
	large number of customers, through time-sharing.

I can well believe that demons are involved in threaded programming.

--amk


From loewis at informatik.hu-berlin.de  Sun Dec  9 13:54:02 2001
From: loewis at informatik.hu-berlin.de (Martin von Loewis)
Date: 09 Dec 2001 19:54:02 +0100
Subject: Does 'super' exist?
References:   
Message-ID: 

"Bruce Eckel"  writes:

> Thanks. Looks like the syntax for calling the base-class B's
> constructor would then be:
> super(B, self).__init__()
> I see the value of super() for MI but I was thinking I might get a
> free ride in the form of less typing for SI base-class calls. Oh
> well.

Please understand that the type unification stuff only got as far as
doing semantics; all of the syntax is left for later. There is still a
lot to be desired; I don't like having to write __slots__ for example
- I'd prefer proper syntax.

Likewise, super doesn't add any new syntax - it really is a call that
you are performing (even though super is a type object, so it isn't a
function call). I guess proposals for syntax are welcome.

Regards,
Martin


From vvainio at karhu.tp.spt.fi  Wed Dec 12 03:05:44 2001
From: vvainio at karhu.tp.spt.fi (Ville Vainio)
Date: 12 Dec 2001 10:05:44 +0200
Subject: age of new pythonistas [was: The Editor Poll results are in!]
References: 
Message-ID: 

cruciatuz  writes:

> like to learn programming in a professional way to earn money with it.

Get a "normal" programming job, and just start doing some things in
python. People will probably see how fast you can crank out good code
with it. Also, because python programming is fun, you can implement
features that would be too boring to implement in C++ & likes.

As for the poll: age == 25.

-- 
Ville Vainio - http://www.tp.spt.fi/~vvainio - ICQ #115524762
 Wild geese have no intention to cast a reflection
 Water has no mind to assume their form


From dk at dk.com  Thu Dec 27 13:22:02 2001
From: dk at dk.com (dk)
Date: Thu, 27 Dec 2001 12:22:02 -0600
Subject: REPOST: windows dialup connections
Message-ID: <5$--$$_----_%_-%_$@news.noc.cabal.int>

Are there any bits of code out there to deal with the establishment, status
and just general manipulation of dialup connections under windows 9x, 2000,
NT? I'm having a hard time finding any if they exist. Should I be looking
under the win32api extensions?(I hope not ;-) Any pointers to more info
would be helpful. Thanks.

-DK

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: "dk" 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 02:18:41 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775687 27193 211.57.49.2 (31 Dec 2001 05:14:47 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:14:47 +0000 (UTC)
X-Report: Report abuse to abuse at uswest.net
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From tim at vegeta.ath.cx  Tue Dec 18 09:32:58 2001
From: tim at vegeta.ath.cx (Tim Hammerquist)
Date: Tue, 18 Dec 2001 14:32:58 GMT
Subject: Python equivalent to @lines = 'command';
References: 
Message-ID: 

Christer Frovik <013-139047 at telia.com> graced us by uttering:
> Is is possible to spawn a command (any command not just ls) and
> have all the lines that the command outputs stored in a list?
> 
> In PERL this is done quite nicely in a single statement:
> 
>   @files = `ls -1`;
> 
> and you can then iterate over @files and do whatever you want.
> Any ideas, or should i stick with Perl for my mindless scripts?

Not familiar with PERL, but I'm quite familiar with Perl.

You seem to be looking to pipe a command's output to a variable
(which is all Perl's backticks really do). Look at the os.popen family
of functions, in this case, os.popen()

    import os
    lines = os.popen('ls -1').readlines()
    for line in lines:
        process(line)

or

    import os
    pipe = os.popen('ls -1')
    for line in pipe.readlines():
        process(line)

Tim Hammerquist
-- 
As a computer, I find your faith in technology amusing.


From hgg9140 at seanet.com  Fri Dec 28 16:05:47 2001
From: hgg9140 at seanet.com (Harry George)
Date: 28 Dec 2001 13:05:47 -0800
Subject: ANN: pyperlish 1.4
Message-ID: 

pyperlish is a python emulation of essential perl mechnaisms, allowing
use of perl-based idioms.  particularly useful for perl-ists
considering using python (or attempting to port code to python).
Originally named "pyperl", but that name was usurped by Zope, so we
gone to pyperlish.  

See:
  http://www.seanet.com/~hgg9140/comp/pyperlish-1.2/doc/index.html

Download at:
  http://www.seanet.com/~hgg9140/comp

Recent changes:
2001-12-28: 1.2
  Converted tests to uniuttest style.  Converted docstring to pydoc
  style.  Fixed "split" to properly detect no maxcnt.

2001-09-29: 1.1
  Renamed from pyperl to pyperlish, to avoid conflict with 
  Zope's new pyperl.


-- 
Harry George
hgg9140 at seanet.com



From pinard at iro.umontreal.ca  Mon Dec 31 11:50:41 2001
From: pinard at iro.umontreal.ca (=?iso-8859-1?q?Fran=E7ois?= Pinard)
Date: 31 Dec 2001 11:50:41 -0500
Subject: Cancel flood (was Re: [RE][POST]: Re: Python Popularity: Questions and Comments)
In-Reply-To: 
References: <3C2A9D33.67FEC261@earthlink.net>
	
	<2$--$$_----_-%$%%$@news.noc.cabal.int>
	
	
Message-ID: 

[Aahz Maruch]

> NOTE: if you're going to followup to one of the resurrected articles,
> please remove the "REPOST: " from the Subject: line.  I generally ignore
> all such articles (and may even stick them in my killfile); I'm sure
> I'm not the only one.

Indeed.  I lower the priority of any message containing REPOST anywhere
in the subject, like this message I'm replying to.  I mangled REPOST while
replying, for not triggering your own filter :-).  (I know, you just check
it when it appears at the very beginning.)

P.S. - I read this message nevertheless because your name was on it!

-- 
Fran?ois Pinard   http://www.iro.umontreal.ca/~pinard



From robin at jessikat.fsnet.co.uk  Sat Dec 15 14:27:02 2001
From: robin at jessikat.fsnet.co.uk (Robin Becker)
Date: Sat, 15 Dec 2001 19:27:02 +0000
Subject: RELEASED Python 2.2 release candidate 1 is out!
References: 
 
Message-ID: 

In article , Tim Peters
 writes
>[Robin Becker]
>> just looking at http://www.python.org/2.2/ I see only references to
>> Python 2.2b2! Is this the same as 2.2c1 or is the page lagging behind?
>
>It says 2.2c1 for me -- try clearing your browser cache and reloading the
>page?
>
>
I don't have caching or any proxies, but now it says 2.2c1 :)
-- 
Robin Becker


From mwh at python.net  Mon Dec  3 05:52:18 2001
From: mwh at python.net (Michael Hudson)
Date: Mon, 3 Dec 2001 10:52:18 GMT
Subject: A Python bytecode assember?
References: <9uf0kd$1r4r$1@agate.berkeley.edu>
Message-ID: 

Daniel Yoo  writes:

> Hi everyone,
> 
> I'm planning to do a small project with Python's bytecode, and I'd
> like to know if anyone's written a bytecode assember for it?

I think my crapy one in bytecodehacks is the only one.

> I've taken a look at Michael Hudson's 'bytecodehacks' package at:
> 
>     http://bytecodehacks.sourceforge.net/
> 
> but the code looks like it hasn't been touched since March 2000.  

That's about right.

> Can anyone talk about their experiences with bytecodehacks?

What do you want to know? :)

> I need a bytecode assember that supports jumps, so if someone's
> hacked up bytecodehacks to support this, I'll be a very happy
> person.

bytecodehacks might be a reasonable start for something like this, but
you'd probably want to do work to support newer Pythons.  I'm unlikely
to get round to this.

Jeremy Hylton's compiler package may be a better bet.

Cheers,
M.

-- 
  If you give someone Fortran, he has Fortran.
  If you give someone Lisp, he has any language he pleases.
    -- Guy L. Steele Jr, quoted by David Rush in comp.lang.scheme.scsh


From andy47 at halfcooked.com  Mon Dec  3 17:22:30 2001
From: andy47 at halfcooked.com (Andy Todd)
Date: 3 Dec 2001 22:22:30 GMT
Subject: Difference between 'import' and 'from ... import'
References:  
Message-ID: 

Patrick,

"Patrick K. O'Brien"  wrote in
: 

>I got the following:
>
>C:\Code\Gadfly> python
>Python 2.1.1 (#20, Jul 20 2001, 01:19:29) [MSC 32 bit (Intel)] on win32
>Type "copyright", "credits" or "license" for more information.
>>>> import gadfly
>kjParser.py:16: DeprecationWarning: the regex module is deprecated;
>please use t
>he re module
>  import regex
>C:\PYTHON21\lib\regsub.py:15: DeprecationWarning: the regsub module is
>deprecate
>d; please use re.sub()
>  DeprecationWarning)

That's what I get if I try;

>>> from Gadfly import gadfly

Of course, use of regex instead of re is a whole different kettle of fish 
;-) but if anyone has any patches for the gadfly code that will 'upgrade' 
it I'd be a willing beta tester. Bearing in mind that I can't even import 
the module I'm a little nervous hacking the code myself.

>>>> gadfly
>
>>>> dir(gadfly)
>['GF_Cursor', '__builtins__', '__doc__', '__file__', '__name__',
>'error', 'gadfl
>y', 'sql', 'sqlbind', 'sqlgen', 'verbosity']
>>>>

And then the modules are loaded into the local namespace and everything is 
hunky dory. 

>
>In other words, it worked. All I did was download, unzip, "python
>gfinstall.py", and then what you see above. What didn't work for me was
>what you said worked for you:
>
>C:\Code>python
>Python 2.1.1 (#20, Jul 20 2001, 01:19:29) [MSC 32 bit (Intel)] on win32
>Type "copyright", "credits" or "license" for more information.
>>>> from Gadfly import gadfly
>Traceback (most recent call last):
>  File "", line 1, in ?
>ImportError: No module named Gadfly
>>>>
>
>Indeed, on my machine the Gadfly directory does not have an __init__.py
>file, so Gadfly is *not* a package. Does this help at all?

Certainly does, that nailed it. I must have created an __init__.py 
inadvertently by using 'from ... import'. By removing the file I can 
'import gadfly'. Strange error though.

You are a legend. Thanks very much.

Regards,
Andy
-- 
Content free posts a speciality


From jadestar at idiom.com  Sat Dec 29 11:56:18 2001
From: jadestar at idiom.com (James T. Dennis)
Date: 29 Dec 2001 16:56:18 GMT
Subject: pty.spawn() and friends
Message-ID: 

 I've been trying to learn more Python and I've been sticking with 
 the somewhat obscure kinds of things that I've routinely needed to
 do as a system administrator.  I came across the pty module as a
 primitive alternative to using expect and it seems like I should
 be able to so simple work with it.

 So naturally I tried to implement the simplext expect script
 (autopasswd) as a Python script using the pty.spawn() function.

 This doesn't work as I'd expect.  First the documentation states
 that pty.spawn():

	spawn a process, and connect its controlling terminal with 
	the current process's [sic] io [sic].  This is often used to 
	baffle programs with insist on reading from the controlling
	terminal.

 ... well it certainly baffles the programmer that tries to use it.

 My expectation was that this would spawn the program in question
 ("/usr/bin/passwd" for my tests) and allow me to print to its input
 and read from its output; under programmatic control.  I would thus
 have to cross-wire the inputs and outputs of the child process with
 some sort of handle, object, or file descriptor on my (parent) process.

 However it seem like pty.spawn() doesn't do any cross-wiring.  It
 seems to simply start a sub-process that interacts with my terminal,
 basically like the os.system() function.  (The difference is that
 pty.spawn() takes a tuple of arguments while os.system() takes a 
 string and passes it to a shell for parsing and execution).

 That seems pretty lame.  It's like the author of the pty module
 didn't know what the author of the os module was doing and provided a
 gratuitously similar function with no actual relevance to psuedo-ttys
 and no additional functionality.  In so doing, they've raised 
 (my) expectations and failed to satisfy them.

 What pty.spawn() *should* do (to meet with reasonable expectations
 that it would have something to do with spawning subprocesses *UNDER
 THE CONTROL OF A psudo-tty*) is return a file-like object to which
 one can write (commands or "keystrokes") and from which one could read
 (responses, prompts, potentially screen updates).  

 Ideally this would come with some convenience methods, and 
 members/constants (possibly inherited from a common module with 
 curses, and/or tty, to allow one to send keystrokes by their symbol 
 names (rather than having to manually fuss with escape sequences) and 
 receive data as structures of character/attribute data).  (Imagine 
 being able to run a child ncurses monitoring process and automatically
 programmatically respond to a specific bit of text "turning red" or
 "going on the blink").

 None of this would be nearly so irritating if USAGE EXAMPLES had been 
 provide to explain what the programmer should expect of the program.
 Naturally I had to fuss with it for some time before figure out that
 it really was a lame and redundant function rather than my own 
 lack of skill.  The fact that the reference docs give a couple of
 optional arguments: [,master_read[,stdin_read]] which are supposed 
 to be:

		functions which read from a file-descriptor

 ... complicates it further.  What kind of function could I write 
 that "reads from a file-descriptor" but which takes no arguments 
 telling it *which* file-descriptor! 
 
 At first I thought this was trying to say to call pty.spawn() with
 one argument to act sort of like os.system(), or two arguments
 (a tuple and a function invocation) to spawn a process under the
 control of that function.  (Envisioning something where *that function's*
 stdin and stdout where wired up to the spawned process' stdout and 
 stdin respectively).  (If that was the case I'd expect that the optional
 third argument would be another controlling function for handling 
 the child process' stderr; communications between the two would be
 "merely a matter of programming").

 Ugh!  Between this and the equally frustrating Python curses docs
 I'm pretty grumpy.




From akuchlin at mems-exchange.org  Thu Dec 20 17:02:37 2001
From: akuchlin at mems-exchange.org (Andrew Kuchling)
Date: 20 Dec 2001 17:02:37 -0500
Subject: Python 1.5.x vs Python 2.x.x
References: <3C180FF7.DEAEA6C6@radical.ca> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu>  <9vruil$ipm$1@peabody.colorado.edu>  <7xlmfxvbx7.fsf@ruckus.brouhaha.com> <3dbsgt7f0e.fsf@ute.mems-exchange.org> <7xbsgttv1w.fsf@ruckus.brouhaha.com>
Message-ID: <3dlmfxy2gy.fsf@ute.mems-exchange.org>

Paul Rubin  writes:
> I expect these bugs are known already, but earlier in the 2.3 cycle
> I'd have reported them anyway.

Why would you expect them to be known already?

--amk


From rob at pythonemproject.com  Fri Dec 28 22:46:52 2001
From: rob at pythonemproject.com (Rob)
Date: Sat, 29 Dec 2001 03:46:52 GMT
Subject: REPOST: Re: need help with class of arrays which have attibutes
References:  
Message-ID: <8$--$$_----_-%$%%$@news.noc.cabal.int>

Emile van Sebille wrote:
> 
> "Rob"  wrote in message
> news:pan.2001.12.28.15.45.35.83.2001 at ieee.org...
> > Hi,
> >
> > I'm trying to contruct a class of arrays which have attributes.  This one
> > respresents a wire[] array which can have x,y,z etc coordinates.  I just
> > can't figure out how to do it.  Here is what I have so far:  (it uses
> > Numpy)
> 
> 
> You need to review and work some with classes.  Start with section 9 in the
> tutorial http://www.python.org/doc/current/tut/node11.html and look at the
> __init__ references, which is used to initialize class instances.
> 
> HTH,
> 
> --
> 
> Emile van Sebille
> emile at fenx.com
> 
> ---------

-- 
The Numeric Python EM Project

www.pythonemproject.com


Hi Emile,  I've been reading the books and experimenting with different
kinds of classes, but it just doesn't seem possible to use an array as a
basis for a number of class attributes.  For example,
wire=conductor (i.e. class)  wire[1].x1=30  wire[2].x2=40  etc.    Rob.

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.cwix.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Rob 
Newsgroups: comp.lang.python
Subject: cmsg cancel <3C2D3C2C.C9EF5AFE at pythonemproject.com>
Control: cancel <3C2D3C2C.C9EF5AFE at pythonemproject.com>
Date: Mon, 31 Dec 2001 01:43:23 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774886 27193 211.57.49.2 (31 Dec 2001 05:01:26 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:01:26 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From vvainio at karhu.tp.spt.fi  Thu Dec 13 03:41:25 2001
From: vvainio at karhu.tp.spt.fi (Ville Vainio)
Date: 13 Dec 2001 10:41:25 +0200
Subject: tabs vs spaces, what do IDEs use?
References:           <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com>  <3c17d349$1@207.229.64.20>
Message-ID: 

"Peter Bismuti"  writes:

> I've noticed that both JBuilder (if I remember correctly) and
> VisualStudio.net use tabs as the default for indenting with a width of 4.
> This is certainly a strong piece of anecdotal evidence that refutes this
> idea that "normal" people uses spaces for indenting.

"Normal" people use emacs, exclusively.

-- 
Ville Vainio - http://www.tp.spt.fi/~vvainio - ICQ #115524762
 Wild geese have no intention to cast a reflection
 Water has no mind to assume their form


From brian at sweetapp.com  Thu Dec  6 22:31:17 2001
From: brian at sweetapp.com (Brian Quinlan)
Date: Thu, 6 Dec 2001 19:31:17 -0800
Subject: Lists of attributes
In-Reply-To: <200112061915120890.02BA0C95@mail.rdc1.sdca.home.com>
Message-ID: <005e01c17ecf$a1ed5460$445d4540@Dell2>

Bruce wrote:
> >__subclasses__ was added very recently (8 weeks, 3 days to be
> > exact) so it might not be in your Python build (when you start 
> > Python, it reports its build date so you can check).
> 
> Aha! Now, is it possible to install two different versions of
> Python on my Win98 machine at the same time? I ask because I need
> to run the ActiveState build for Python-COM stuff...

Yes, it is possible. What version of ActivePython do you currently have
installed (I work for ActiveState, BTW)? 

You cannot have two versions of Python with the same major and minor
version numbers installed at once (*) i.e. you cannot have ActivePython
2.2.0 Alpha and PythonLabs Python 2.2b2. If you have ActivePython 2.2
installed, I would recommend uninstalling it, installing ActivePython
2.1 and then installing PythonLabs Python 2.2b2. You will be able to
using the last stable Python for your Win32 development and the
bleeding-edge release for fooling about.

(*) with a bit of hackery, anything is possible of course, including
this
(**) only the truly insane (like Guido) try to develop on W9x.

Cheers,
Brian




From jason at jorendorff.com  Sat Dec  8 13:36:29 2001
From: jason at jorendorff.com (Jason Orendorff)
Date: Sat, 8 Dec 2001 12:36:29 -0600
Subject: help with regular expression
In-Reply-To: 
Message-ID: 

> I am writing a program in which I need to search an arbitrary string
> and return the part between a certain opening sequence, and a closing
> sequence.  [...]  I want to be able to "escape" the ending
> sequence with either double quotes (">>") or single quotes ('>>').

  r"""<<(('>>'|">>"|>(?!>)|[^>])*)>>"""

See http://www.python.org/doc/current/lib/re-syntax.html
for the meaning of (?!>).

-- 
Jason Orendorff
http://www.jorendorff.com/




From roy at panix.com  Sun Dec 30 11:14:36 2001
From: roy at panix.com (Roy Smith)
Date: Sun, 30 Dec 2001 11:14:36 -0500
Subject: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.)
References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de>  <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> <3C2E498B.6DC757E0@stroeder.com> <3C2E6A51.589E7F1D@earthlink.net> <3C2F2920.89841C81@stroeder.com>
Message-ID: 

Michael Stroder  wrote:
> Seriously, I'm sick of all the security announcements regarding
> buffer overflows and such. Not to speak of memory leaks. That's
> stone age.

On the other hand, a language like Python has its own set of potential 
security holes.  I guess the classic would be some variation on 
exec(readline()) or eval(readline()).  Sure, you're never supposed to write 
anything like that, but people do it (exactly the same can be said of not 
checking for buffer overflows in C).

If I was a bad guy looking to hack into machines by spoofing servers 
written in python, I'd throw:

   os.popen ('echo owned::0:0:YouAreOwned:/:/bin/sh >> /etc/passwd')

at every open port I could find and see what happened.  Do it to enough 
machines and you might strike gold eventually.  Would you suggest we 
eliminate eval() and exec() from the language?  Maybe taintPython? :-)

It's also possible to write memory leaks in python.  Consider something 
like:

packetLog = []
while 1:
   request = getPacketFromSocket()
   packetLog.append (request)
   doStuffWithPacket (request)

It's pretty dumb to write something like that, but it certainly is a memory 
leak.


From sholden at holdenweb.com  Mon Dec  3 22:09:37 2001
From: sholden at holdenweb.com (Steve Holden)
Date: Mon, 3 Dec 2001 22:09:37 -0500
Subject: Baffled by httplib and SSL!
References: 
Message-ID: 

"Ray Van Dolson"  wrote...
> I'm having some real frustrating problems making an HTTPS client using
> httplib.  Here's the code I've got and the errors I'm getting:
>
> def post_url2(url, params, cookies = None):
>     """Another feeble attempt"""
>     global DEBUG
>     h = httplib.HTTPSConnection('www.dotster.com')
>     h.set_debuglevel(DEBUG)
>     params = urllib.urlencode(params)
>     headers = {'Content-Type': 'application/x-www-form-urlencoded'}
>     if cookies != None:
>         cookieString = cookies.pop(0)
>         for cookie in cookies:
>             cookieString = cookieString + "; " + cookie
>         headers['Cookie'] = cookieString
>     h.request('POST', url, params, headers)
>     while 1:
>         response = h.getresponse()
>         if response.status != 100:
>             break
>         h._HTTPConnection__state = httplib._CS_REQ_SENT
>         h._HTTPConnection__response = None
>     return response
>
> post_url2("https://blahblah", {"fdsafa": "dfjadja"}, \
> ["SessionTest=enabled"])
>
> Here's the debug output:
>
> send: 'POST https://www.dotster.com/account/login/login.asp HTTP/1.1\r\n'
> send: 'Host: www.dotster.com:443\r\n'
> send: 'Accept-Encoding: identity\r\n'
> send: 'Content-Length: 33\r\n'
> send: 'Cookie: SessionTest=enabled\r\n'
> send: 'Content-Type: application/x-www-form-urlencoded\r\n'
> send: '\r\n'
> send: 'Acct_Name=private&Password=private'
>
Since I am not yet using this library I will limit my observation to the
fact that the scheme (https:) and the host (//www.dotster.com) are normally
implied by a) the connection port (443 by default) and b) the connected
host. I would therefore have expected the first line to be

send: 'POST /account/login/login.asp HTTP/1.1\r\n'

but I don't know if this is what's causing your problem.

regards
 Steve

> And now it just hangs.  Just sits there doing nothing until I hit ctrl-c--
> here's the traceback:
>
> Traceback (most recent call last):
>   File "./test.py", line 10, in ?
>     main()
>   File "./test.py", line 7, in main
>     return common.post_url2
> ("https://www.dotster.com/account/login/login.asp", {'Acct_Name':
> 'private', 'Password': 'private'}, ["SessionTest=enabled"])
>   File "./common.py", line 72, in post_url2
>     response = h.getresponse()
>   File "/usr/lib/python2.2/httplib.py", line 570, in getresponse
>     response = self.response_class(self.sock, self.debuglevel)
>   File "/usr/lib/python2.2/httplib.py", line 98, in __init__
>     self.fp = sock.makefile('rb', 0)
>   File "/usr/lib/python2.2/httplib.py", line 607, in makefile
>     buf = self.__ssl.read()
> KeyboardInterrupt
>
> As you can see it's hanging at the sock.makefile() line in httplib (within
> the HTTPResponse class).  This appears to be some sort of SSL glitch, but
> I have found almost NO documentation on SSL in Python and really don't
> know where to start.  The posts on Google were far and few between and
> didn't really offer much help.
>
> Has anyone out there worked much with httplib and SSL sites?  Your
> expertise would be greatly appreciated!
>
> Thanks,
> Ray Van Dolson




From fperez528 at yahoo.com  Wed Dec 12 09:20:48 2001
From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=)
Date: Thu, 13 Dec 2001 13:48:48 +2328
Subject: which book?
References: 
Message-ID: <9vb49o$oe6$1@peabody.colorado.edu>

Preben wrote:

> I've been recommended to buy a Python book,
> but I'm not sure which one I should buy..
> 
> Somebody told me to buy Python2.1 Bible.
> Anybody got an opinion?

My personal 'ideal' combination: 'Learning Python' to get going, and 'Python 
Essential Reference' beyond there. But the most useful of all might be the 
set of built-in docs, which is great. When you get to deep details, you may 
need the vast reference of 'Programming Python'.

I tend to be partial to books by O'Reilly and NewRiders (though the latter 
could learn from the former in the binding and font size depts) as they seem 
to have some of the best indexing around, plus a very low tolerance for fluff 
and 'every reader is an idiot' crap. But I've also heard good things about 
books like 'Core Python', and I'm sure others may give you pointers. Check out

        http://www.awaretek.com/plf.html

for a very comprehensive list of book reviews.

If you are under windows, there seems to be a very nicely packaged version of 
all the essential on-line docs at 

        http://www.orgmf.com.ar/condor/pytstuff.html

Under Linux, you can just bookmark the index file for the local copy of the 
html docs (or the web one if you have constant high bandwidth). The above 
'python shelf' for windows seems to integrate everything very nicely though,  
with a good global searcher. Anyone up to make a similar thing under linux, 
using htdig?

Cheers,

f


From erik at pacific-shores.com  Sun Dec  2 21:03:46 2001
From: erik at pacific-shores.com (Erik Myllymaki)
Date: Mon, 03 Dec 2001 02:03:46 GMT
Subject: serial port frustrations on win32
Message-ID: <64BO7.14943$%B6.4538241@news2.rdc1.bc.home.com>

I put together a script to move SMDR records from a phone system into a SQL
database. It works great on my win2k laptop but it doesn't work on the nt
server (4.0 sp6a) that it is going to ultimately run on.

I've narrowed it down to not getting past a waitformultipleobjects() call -
hangs indefintely. I took that function straight from the
win32comport_demo.py file in the win32\Demos folder of the standard install.

I ran win32comport_demo.py and it works great on the win2k lapop, but once
again it hangs at the same point on the NT server(i won't include the whole
file):

    def _ComPortThread(self):
        overlapped = OVERLAPPED()
        overlapped.hEvent = CreateEvent(None, 0, 0, None)
        while 1:
            # XXX - note we could _probably_ just use overlapped IO on the
win32file.ReadFile() statement
            # XXX but this tests the COM stuff!
            rc, mask = WaitCommEvent(self.handle, overlapped)
            if rc == 0: # Character already ready!
                SetEvent(overlapped.hEvent)
            rc = WaitForMultipleObjects([overlapped.hEvent, self.eventStop],
0, INFINITE)
^^^^^^^^^^^^^^^^
 -hangs here forever-


Any help appreciated.

--
Erik Myllymaki
erik at pacific-shores.com




From tim.one at home.com  Sun Dec  2 14:44:22 2001
From: tim.one at home.com (Tim Peters)
Date: Sun, 2 Dec 2001 14:44:22 -0500
Subject: Draft PEP: string interpolation with backquotes
In-Reply-To: <20011202080626.A76724@hishome.net>
Message-ID: 

[Oren Tirosh]
> PEP: XXXX
> Title: String interpolation with backquotes
> Author: oren at hishome.net (Oren Tirosh)
> Created: 2-Dec-2001

Just a few comments at the start:

> Specification
>
>     A new character prefix "i" is defined for strings.  This prefix
>     precedes the "u" and "r" prefixes, if present.

Seems overspecified:  "U" and "R" are also legit prefixes, so "I" should be
too.  The order of prefixes shouldn't matter (just as it doesn't matter now
for mixing 'u'/'U' and 'r'/'R').

>     The prefix "i" stands for "interpolation" or "in-line".  Within
>     a string with an "i" prefix an expression enclosed in backquotes is
>     converted into its string representation

That's ambiguous, and this is a real problem:  Python generally has two
forms of "string representation", str() and repr().  Unfortunately for the
proposal, backticks are a shortcut for repr() but str() is probably more
useful in this context.

>     and embedded into the string. An empty interpolation ("``") is
>     not allowed.

The Reference Manual already defines the grammar production
string_conversion for what a backtick expression has to look like; just
refer to that; if you attempt to reword it, it will create problems.  Like
this one:

>     The expression may be any valid Python expression not containing
>     the backquote character.

This is an unnecessary difference with current backtick expressions.  It's
not particularly pretty to look at, but nested backtick expressions are
unambiguous and work fine.  Artificially restricting them in this context
would be a wart (not to mention that you couldn't reuse the compiler code
that compiles them now).




From zhangsc at neusoft.com  Thu Dec 13 22:15:29 2001
From: zhangsc at neusoft.com (=?gb2312?B?1cXJ2bPb?=)
Date: Fri, 14 Dec 2001 11:15:29 +0800
Subject: bind question
Message-ID: <005b01c1844d$952b84d0$4301010a@sky>

I have a question about socket bind,my program is follows:
from socket import *
import select
import re
import string
import time
import sys
HOST='10.1.1.27'
PORT=21567
BUFSIZ=1024
ADDR=(HOST,PORT)
ippat=re.compile(r'[0-9]+([.][0-9]+){3}')
udpCliSock=socket(AF_INET,SOCK_DGRAM)
data=""
try:
 while 1:
   while data=="":
     data=raw_input('ip address:')
     data=data.strip()
     if ippat.match(data) is not None:
       break
     else:
       print data,"does not like an ip address"
       print "input again!"
       data=""
   udpCliSock.sendto(data,ADDR)
   udpCliSock.close()
   HOST=gethostbyname(gethostname())
   ADDR=(HOST,PORT)
   udpCliSock=socket(AF_INET,SOCK_DGRAM)
   udpCliSock.bind(ADDR)
   f = udpCliSock.makefile()
   while 1:
     (r,w,e) = select.select([f], [], [], 5.0)
     if not r:
       print "out of time!"
       break    
     else:
       data, addr = udpCliSock.recvfrom(BUFSIZ)
       if data:
         print data
         break
   udpCliSock.close()
   HOST='10.1.1.27'
   ADDR=(HOST,PORT)
   udpCliSock=socket(AF_INET,SOCK_DGRAM)
except KeyboardInterrupt:
   sys.exit(0)
udpCliSock.close()

When I run it,it raise a error:
$ python c33.py
ip address: 202.112.237.15
out of time!
Traceback (most recent call last):
  File "c33.py", line 30, in ?
    udpCliSock.bind(ADDR)
socket.error: (112, 'Address already in use')

Why is it error? How to correct it? Any ideas will be appreciated!
         Thanks.
              Edward


-------------- next part --------------
An HTML attachment was scrubbed...
URL: 

From bkc at Murkworks.com  Sun Dec 30 11:43:06 2001
From: bkc at Murkworks.com (Brad Clements)
Date: Sun, 30 Dec 2001 11:43:06 -0500
Subject: Win32all and Mark. time to bring back win32-reg-users?
Message-ID: <3c2f44b5_7@news.newsgroups.com>

 Just a thought, worth it to me..



--
Brad Clements, DevNet Sysop 5
Developer Network Sysop Team






-----=  Posted via Newsfeeds.Com, Uncensored Usenet News  =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
 Check out our new Unlimited Server. No Download or Time Limits!
-----==  Over 80,000 Newsgroups - 19 Different Servers!  ==-----


From mwh at python.net  Tue Dec  4 05:20:18 2001
From: mwh at python.net (Michael Hudson)
Date: Tue, 4 Dec 2001 10:20:18 GMT
Subject: whats new in 2.2 (was A modest indentation proposal)
References: 
Message-ID: 

Quinn Dunkan  writes:

> Classic classes are only activated when you inherit from 'object'.

I've not been reading this thread (hey, it was about indentation), but
I'd just like to point out that this is 180 degrees wrong -- as Quinn
probably knew?

Cheers,
M.

-- 
  (Unfortunately, while you get Tom Baker saying "then we 
   were attacked by monsters", he doesn't flash and make 
  "neeeeooww-sploot" noises.)
      -- Gareth Marlow, ucam.chat, from Owen Dunn's review of the year


From stephen at theboulets.net  Tue Dec  4 09:36:40 2001
From: stephen at theboulets.net (Stephen Boulet)
Date: Tue, 04 Dec 2001 08:36:40 -0600
Subject: Using *just* the IDLE editor
References: <3C0C4FE1.5B218CE0@st-annes.oxford.ac.uk>
Message-ID: 

If you start it using idle.pyw, it won't open the shell. It's in the bin 
directory.

-- Stephen

Michael Williams wrote:

> Hi,
> 
> I'd like to set up (or strip out components or rewrite, but hopefully
> it won't be that complex) IDLE so that when I start it up with
>     
>     $ idle 
> 
> I just get the IDLE editor and not the interactive shell. (I need to
> avoid starting the shell for uninteresting reasons). The -e option
> allows the opening of the editor window, but doesn't prevent opening
> of the interactive shell. I'm afraid I don't have enough experience of
> Python (esp Tk) to go through the code and work out what's being done
> by idle.py so I would be very grateful if someone could point me in
> the direction of a command line argument to prevent the shell
> appearing or module I could strip out of the IDLE directory to allow
> me to just use the editor.



From pinard at iro.umontreal.ca  Fri Dec 21 19:42:30 2001
From: pinard at iro.umontreal.ca (=?iso-8859-1?q?Fran=E7ois?= Pinard)
Date: 21 Dec 2001 19:42:30 -0500
Subject: vi or emacs for editing Python on Linux?
In-Reply-To: 
References: 
Message-ID: 

[maxm]

> I would like to know the strong/weak point in using either for Python.
> I know this is close to religion.  But are there any rational reasons
> to use one instead of the other for Python?

It is true that people often have religious feelings about it.  It might
depend of where you come from, that is, what was your previous editor of
choice.  I vaguely remember that, when I learned Emacs, I was comfortable
using Borland's editor, with Wordstar keybindings, and I found it very
confusing switching between editors that were both fond on using control
characters, each in their way.  Wordstar was much more logical with the
disposition of key caps! :-) In fact, I hated Emacs for a while...

With time, I learned to appreciate Emacs power.  My opinion is that Emacs is
worth learning, if you spent a great deal of time with computers: you will
be much rewarded by speed, proficiency, flexibility.  But if you only visit
computers once in a while, Emacs is probably not worth the time investment.
If you want to get intimate with your editor, Emacs may be frightening.

For many years, I found `vi' to be quick at start, but dumb on the road.
`vi' much improved over the years, it appears to have grown up a long way.
Even if most people around me use Emacs, a few people I much admire for their
cleverness and productivity are `vi' lovers.  So, `vi' is surely not so bad!
Notably, my `vi' friends do not much use `vi' extensibility, so I guess
there is a difference in attitude, that goes beyond the choice of editors.

If you are in hurry to get out of an editor as soon as you entered it,
choose `vi'. :-) It may look like an inflammatory statement, but not at all.
My friends fly between windows and tools, in and out of the editor, all
the time.  They are like that, and no kidding, I think that this permanent
urge is part of their productivity.  For one, I'm more like an artist who
likes polishing his humble works.  I start Emacs when I boot a machine,
and nest comfortably within it for doing most of my things (reading mail
and news, compiling, connecting to remote machines, etc.).

-- 
Fran?ois Pinard   http://www.iro.umontreal.ca/~pinard




From chrishbarker at attbi.com  Fri Dec 14 15:56:48 2001
From: chrishbarker at attbi.com (Chris Barker)
Date: Fri, 14 Dec 2001 12:56:48 -0800
Subject: Unsung Python modules
References: <3dsnad226b.fsf@ute.mems-exchange.org>
Message-ID: <3C1A6790.FD0C9002@attbi.com>

Andrew Kuchling wrote:

> What's your favorite unsung module?

Numeric., although it has been sung (so has PIL). I do think it is
underutilized. Most folks seem to think it is "overkill" unless you are
doing serious number crunching (which I do), but I think is is very
useful even if you are working with small enough data sets that the
performance gains don't buy you anything. Being able to work with arrays
of Numbers (N-d arrays, no less) without all those loops, (or maps, or
list comprehension's) is just too nice!

Also, slicing arrays of greater than 1 dimension is often indispensable.

-Chris




-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at attbi.net                ---           ---           ---
                                     ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------


From matt at lorfeld.com  Tue Dec 18 16:24:29 2001
From: matt at lorfeld.com (mlorfeld)
Date: 18 Dec 2001 13:24:29 -0800
Subject: Loading CGI select
Message-ID: <32c382ad.0112181324.4e3a10d0@posting.google.com>

I would like to load the options into a select from a list in python. 
I have only seen how to explicitly define items in a list rather than
retrieving them from a file.  Is this possible?


From skip at pobox.com  Tue Dec 18 19:24:44 2001
From: skip at pobox.com (Skip Montanaro)
Date: Tue, 18 Dec 2001 18:24:44 -0600
Subject: Dictionaries as records
In-Reply-To: 
References: 
Message-ID: <15391.56908.339408.537184@12-248-41-177.client.attbi.com>

    Bill> I have a file with 200K records and 16 fields.  This file is
    Bill> parsed and each row is put into a dictionary and the dictionary is
    Bill> added to a list.  The raw file is only about 50mb.

    Bill> I was shocked to see that my memory use jumped to 500MB!  When I
    Bill> delete the list the memory is returned to the system, so I know
    Bill> that the memory is being used in the dictionaries.

    ...

    Bill> Can someone who has faced this issue and found a workaround please
    Bill> fill me in. I know one can use a list of lists or a list of
    Bill> tuples, but had rather stick to the dictionaries because of some
    Bill> library issues.

You might want to consider storing it in an on-disk mapping object.  Check
out the anydbm, bsddb, gdbm modules and the like.  Aside from not chewing up
gobs of RAM, script startup should be faster as well, because you won't have
to parse the file and initialize the dict.

-- 
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)



From Steven.Suchting at computer.org  Thu Dec  6 09:13:16 2001
From: Steven.Suchting at computer.org (StationSteve)
Date: Thu, 6 Dec 2001 14:13:16 GMT
Subject: Newbie - Exporting Excel Spreadsheet
References: <673dc1dc.0112051334.370c75f2@posting.google.com>
Message-ID: <3C0F7CFC.B7E73192@computer.org>

You might want to go to your local bookstore and find a copy of "Python -
Programming on Win32", by Mark Hammond & Andy Robinson, published by
O'Reilly (Crocodile on the cover). Chapter 9 talks about Excel, and I
found it *VERY* useful in some work I did in controlling Excel from a
Python program.
SteveS.

James Fugard wrote:

> TIA for any help that I may get. I have a small project that I'm
> trying to do in Python...and I'm a hack at best! Here is what I'm
> trying to do. Call and capture a row in an Excel spreadsheet and then
> use manipulate the data in the cell of the various columns.
>
> Here is what I've been able to get some far:
>
> # Call all used modules
> import os,win32api,glob,odbc,dbi,time
> # Make the database connection using the system DNS
> MyConnection = odbc.odbc('Client_Data_Log')
> MyCursor = MyConnection.cursor()
> MyCursor.execute('SELECT * FROM "Client Data Log$"') # the sheet name
> print MyCursor.fetchall()
>
> This will give me everything + a bunch of dbi time stuff. If someone
> could tell me where to find info on calling a particular cell or a
> piece of sample code to follow(like G12 for example) that would be
> great. Thanks again. James



From Bruce at EckelObjects.com  Tue Dec 25 22:46:21 2001
From: Bruce at EckelObjects.com (Bruce Eckel)
Date: Tue, 25 Dec 2001 19:46:21 -0800
Subject: Thinking in Python Revision 0.1 Available for Download
Message-ID: <200112251946210130.02DCC837@mail.rdc1.sdca.home.com>

Just under the wire, I've manage to post the first early alpha
version (0.1) of "Thinking in Python." You can go to the page that
connects you to the download here:
http://www.mindview.net/Books/TIPython

Please note:
1) This is not an introductory book. I couldn't bring myself to
write yet another introductory language tutorial, and there are
already plenty of good ones out there. This is "Design Patterns in
Python," so I can use any language features or advanced techniques
that I want, without apology (hooray!).

2) This is an early translation of "Thinking in Patterns," so parts
of it have not yet been translated. I've tried to mark those
chapters, but please be patient.

The source code is in the download package. When you unzip
everything (remember to use the -a flag with unzip if you're on
Unix), the code will be put into subdirectories for each chapter.

In addition, this book debuts my new 'BackTalk' comment collection
system that I built in Zope.


Most current information can be found at:
http://www.mindview.net/Etc/notes.html
===================
Bruce Eckel    http://www.BruceEckel.com
Contains free electronic books: "Thinking in Java 2e" & "Thinking
in C++ 2e"
Please subscribe to my free newsletter -- just send any email to:
join-eckel-oo-programming at earth.lyris.net
My schedule can be found at:
http://www.mindview.net/Calendar
===================





From r.b.rigilink at chello.nl  Fri Dec  7 04:20:10 2001
From: r.b.rigilink at chello.nl (Roeland Rengelink)
Date: Fri, 07 Dec 2001 09:20:10 GMT
Subject: staticmethod and __call__
References: 
Message-ID: <3C1089FC.617D6D7B@chello.nl>

Hi,

The reason this doesn't work is that ItemGenerator() never looks for a
static attribute __call__ in its own definition. __call__ is used to
define the meaning of instance(). Or, put differently, obj(*args,
**kwargs) is equivalent to obj.__class__.__call__(obj, *args, **kwargs).
Now, the __class__ of a class is its metaclass. Hence, ItemGenerator()
looks for the __call__ method in its metaclass. 

So, what's the metaclass of ItemGenerator? Well, unfortunately for
classic (pre-2.2) classes that's not really obvious. Unless you've used
the Don Beaudry hook (you don't wanna know) to roll your own metaclass,
you can't point to an object and say that's the metaclass of
ItemGenerator. For new style classes (derived from object or one of the
other build-ins), the answer is given by the call type(ItemGenerator),
which turns out to be 'type'. That is 'type' is the metaclass of all
build in types (including itself). Since the type of a new style
instance is its class, this means (a.o.) that in Python 2.2 
obj(*args, **kwargs) is simply equivalent to 
type(obj).__call__(obj, *args, **kwargs)

Python 2.2 also introduces staticmethods. This has led some of us to try
to do the same thing you do here. Namely use staticmethod to try to
override the metaclass method. However, the general rule is that
staticmethod can't be used to force an override for methods defined in
the metaclass. I (now) think this is a good thing. Why? Well consider
exactly this example. The meaning of obj() is now very straightforward.

obj() => type(obj).__call__(obj)

If we allowed staticmethod to override, it would become something like

if (isinstance(type(obj), type) and 
    hasattr(obj, '__call__') and 
    isinstance(obj.__call__, staticmethod)):
    return obj.__call__()
else:
    return type(obj).__call__(obj)
	
So, what use are staticmethods?

I think Guido resisted introducing static methods for a long time with
an argument that goes something like:

"Classes are for generating instances and defining their behaviour. If
you just want a namespace, use modules (or dictionaries)."

I.e. somethink like

--- items.py
import random
rgen = random.Random()

class Item:
    __init__(self, val):
       self.val = val
    def f(self):
       print 'An item with value', self.val

items = [Item('a'), Item('b'), Item('c')]

def ItemGenerator():
    return rgen.choice(items)
---

--- use_it.py ---
import items
myitems = [items.ItemGenerator() for i in range(5)]
for i in myitems:
    i.f()
---

I have the feeling the argument against static methods still applies in
most cases, probably augmented with:

"... and if you really, really want do _that_, use metaclasses"

Hope this helps,

Roeland

Bruce Eckel wrote:
> 
> I seem to have trouble getting __call__ to behave as a static
> method:
> 
> class Item:
>   def f(): print 'An Item'
> 
> Item.a = 'a'
> Item.b = 'b'
> Item.c = 'c'
> 
> class ItemGenerator:
>   import random
>   rgen = random.Random()
>   items = [j for j in vars(Item).values() if isinstance(j, Item)]
>   def __call__():
>     return ItemGenerator.rgen.choice(ItemGenerator.items)
>   __call__ = staticmethod(__call__)
> 
> items = [ItemGenerator() for i in range(5)]
> for i in items:
>   i.f()
> 

-- 
r.b.rigilink at chello.nl

"Half of what I say is nonsense. Unfortunately I don't know which half"


From dgrisby at uk.research.att.com  Mon Dec 17 05:35:49 2001
From: dgrisby at uk.research.att.com (Duncan Grisby)
Date: 17 Dec 2001 10:35:49 GMT
Subject: python and SOAP??
References:   <9valdt$ik6$1@pea.uk.research.att.com> <59E456FD3AD1FE80.FF0578E51CFDE7B5.7FEBAE7CEB1F44D9@lp.airnews.net>
Message-ID: <9vkhq5$kde$1@pea.uk.research.att.com>

In article <59E456FD3AD1FE80.FF0578E51CFDE7B5.7FEBAE7CEB1F44D9 at lp.airnews.net>,
 Cameron Laird  wrote:

[...]
>That was unintentional on my part, of course.
>I esteem CORBA's (or IIOP's) platform-neutrality
>and language independence.  The only argument
>there is that it seems to remain difficult for
>many languages to construct high-quality CORBA
>bindings--maybe harder than corresponding SOAP
>ones, although I'm well aware of the defects in
>the latter.

I don't think CORBA is particularly hard to implement. There is a lot
of it, because it aims to specify a much larger range of facilities
than SOAP, but none of it is particularly tricky. I suppose one thing
that makes it harder to implement a CORBA language binding is that
many languages have a standard binding. This means the implementor has
to implement it to adhere to an interface designed by someone else,
rather than inventing their own. SOAP has no such issue, since it's
just a wire protocol. I think CORBA's approach is a good thing, since
it means application code is portable between ORBs.

>From what I understand of SOAP, CORBA interoperability and standards
compliance is much more solid than SOAP's. That's probably because
CORBA is so much more mature.

>Unicode's the sticking point.  Again, I under-
>stand that, in principle, CORBA does a good job
>of transporting any kind of data (is this a
>good point, by the way, for a gratuitous snipe
>at SOAP's performance?).

You said it :-)

>  On a practical level,
>though, multi-byte codesets have not been a
>focus for most CORBA implementations, and I be-
>lieve the majority still only support
>single-byte for (IDL) "string".  True?

False. Some people have been slow to implement it (I include myself
here), largely due to lack of demand, but the majority of ORBs do
support wide strings now.

>I'm cross-posting this to c.o.c, to ensure we
>reach a fully accurate answer.  This is my
>summary:  at this point, it's easier to find a
>SOAP binding that "does the right thing" with
>Unicode than it is to track down such an ORB.

I suppose that depends on what you mean by "does the right thing", but
Unicode in CORBA is being used. I know of a large deployed application
transporting Unicode strings between Python with (pre-release)
omniORBpy 2 and Java with Visibroker 4.5, for example.

>The one question I have about this is whether
>I'm being unfair to (IDL) "wstring".  I'm in-
>experienced with CORBA; my impression, though,
>is that wstring isn't the solution one wants.

I suppose it depends on what you want. CORBA wstring is not as simple
as "Unicode", since it supports arbitrary code sets, and automatic
conversion between them. The baseline for interoperability is UTF-16,
though, so all ORBs (that support wstring) should support Unicode. If
you really want to transmit Unicode as UTF-16, for example, without
any possibility of translation by the ORB, you can just use
sequence.

Cheers,

Duncan.

-- 
 -- Duncan Grisby  \  Research Engineer  --
  -- AT&T Laboratories Cambridge          --
   -- http://www.uk.research.att.com/~dpg1 --


From phd at phd.pp.ru  Thu Dec  6 08:08:13 2001
From: phd at phd.pp.ru (Oleg Broytmann)
Date: Thu, 6 Dec 2001 16:08:13 +0300
Subject: pickle question
In-Reply-To: <9unov6$c4on9$1@hades.rz.uni-sb.de>; from uwe@rocksport.de on Thu, Dec 06, 2001 at 12:40:06PM +0000
References: <9unov6$c4on9$1@hades.rz.uni-sb.de>
Message-ID: <20011206160813.Z32540@phd.pp.ru>

On Thu, Dec 06, 2001 at 12:40:06PM +0000, Uwe Schmitt wrote:
> I pickled some data on my local unix machine. When I try
> to read this data on a windows machine, nothing is pickled
> at all.

   Did you open the pickled file in binary mode?

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.



From sh at hob.cx  Wed Dec 19 06:09:49 2001
From: sh at hob.cx (Sean Holdsworth)
Date: Wed, 19 Dec 2001 11:09:49 +0000
Subject: Optimization of an RE substitution
Message-ID: 

First some background to this. I've been working on software which makes
use of the smtplib module and noticed that for certain inputs I was
seeing very high resource usage; both memory and processor. I was curious
about this because the software has been heavily used without problem for
several months and the problem only showed up in the last few days.
Sending a particular 7MB mail message was taking about 10 minutes of
processor time and using about 600MB of memory. Normally I would expect
figures of a few seconds and maybe 20MB for this size input.

On investigation the thing that was unusual about the 7MB file was
the number of empty lines in the message body; for whatever reason
the bulk of the text was aproximately 6 million consecutive end of
line characters. I eventually tracked down what I was seeing to what I
think must be a pathological case for the underlying regular expression
library; a perl script which presumably uses the same library shows the
same behavior.

Here's some code that illustrates the problem.

import re, time
CRLF = '\r\n'
msg = '\r' * 100000
start = time.time()
msg = re.sub(r'(?:\r\n|\n|\r(?!\n))', CRLF, msg)
elapsed = time.time() - start
print '%0.2f' % elapsed
print len(msg)

The line with the re.sub call is taken from the smtplib module and is used
to ensure that a mail message has proper CRLF terminated lines as per the
SMTP protocol requirements. Anyway, this got me thinking if there was a
more efficient way of carrying out this task. I had a stab at it with the
following.

import string, time
CRLF = '\r\n'
msg = '\r' * 100000
start = time.time()
table = string.maketrans('\r\n', '\0\0')
msg = string.replace(msg, CRLF, '\0')
msg = string.translate(msg, table)
msg = string.replace(msg, '\0', CRLF)
elapsed = time.time() - start
print '%0.2f' % elapsed
print len(msg)

Then I remembered that I'm supposed to be handling 8 bit clean data...
I realise that even if I come up with a more efficient method of
doing this I'll still have to use a modified version of smtplib but
I'd be interested to hear people's suggestions and comments.

Sean


From erik at naggum.net  Sat Dec 22 07:45:25 2001
From: erik at naggum.net (Erik Naggum)
Date: Sat, 22 Dec 2001 12:45:25 GMT
Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic
References:   
Message-ID: <3218013921984060@naggum.net>

* newscheme at hotmail.com (New Scheme)
| Its time to reinvigorate scheme.

  No, it is not.  It is time to leave Scheme behind.  It used to be a
  language that brought many new ideas into _one_ language, but all of the
  good ideas have been picked up by other, better languages.  Common Lisp,
  Perl, Python, Ruby, and Java have all benefited from the little group of
  impractical purists who designed this minimalistic language experiment.
  Look, Tengwar is more widely used than Scheme these days.  The features
  unique to Scheme today are those that are universally considered bad
  ideas.  Worse: Perl, Python, Ruby, and Java have more of the Lisp nature
  than Scheme does, whether they admit to it or not, and better developed
  and more widely used to boot.  It is time to close the book on Scheme and
  let it wither and die, which it will if you leave the kind of people you
  have seen respond to you alone to destroy it from within.

  If you still want a functional programming paradigm, there are lots and
  lots of more recent academic experiments that should be at least as
  useless as Scheme for real work, but which could be a little harder to
  teach, since they actually try to do _something_ and are not just trying
  to make a language optimized for reimplementation of itself by students.

  If you are not welcome in the Scheme community, take a hint: Leave.  They
  do not even need to be provoked to attack individual people, as you have
  seen, so they are clearly bad people.  Do not try to change bad people:
  It makes the bad people worse and wastes your time (that is the lesson I
  learned from trying to deal with Scheme freaks as if they were people).
  Try instead to find good people who welcome the ability to think.

  Ask yourself what you actually _like_ in Scheme.  Chances are you can get
  it, better implemented and better understood, in any number of other
  languages.  The only thing you probably cannot get in other languages is
  a full implementation of the language itself done as a student project.
  If you want that, just create your own language like everybody else who
  has ever actually tried to used Scheme does, anyway.

///
-- 
  The past is not more important than the future, despite what your culture
  has taught you.  Your future observations, conclusions, and beliefs are
  more important to you than those in your past ever will be.  The world is
  changing so fast the balance between the past and the future has shifted.


From peter.milliken at gtech.com  Mon Dec  3 23:39:49 2001
From: peter.milliken at gtech.com (Peter Milliken)
Date: Tue, 4 Dec 2001 15:39:49 +1100
Subject: Python evangelists unite!
References: 
Message-ID: <9uhk3s$b3m8@news1.gtech.com>

Sorry Jim, you are one up on me here, I have never had to face this
situation. Thanks for the tip. Could you provide a real example of where you
might want this? (if it isn't too long to give! :-)). You have made me
curious.



 wrote in message
news:mailman.1007079579.26398.python-list at python.org...
>
> Peter Milliken wrote:
> >There is no real justification that works for these "features" of
python -
>
> OTOH, there *are* plenty of good *reasons* for them.
>
> Consider "adding attributes to instances".  Languages that don't support
> this feature directly require some kind of a workaround since this is
> something that one simply needs to do from time to time.  A typical
> workaround is to define, as part of a class's definition, a catch-all
> property whose value is a hashtable.  Clients add "instance-specific"
> attributes to a given instance "on the fly" by adding name-value pairs to
> the instance's hashtable.  Java/Swing's JComponent (with its
> putClientProperty and getClientProperty methods) is a good example of this
> type of workaround.
>
> Jim
>
>
>




From fperez528 at yahoo.com  Thu Dec 20 08:39:32 2001
From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=)
Date: Fri, 21 Dec 2001 13:07:32 +2328
Subject: Distutils question
References: <9vu28t$4g9$1@peabody.colorado.edu>   
Message-ID: 

Steve Holden wrote:
> 
> Erm, Fernando means, of course, "...bug those folks a bit". At least, I hope
> he does. Otherwise see the recent post under "Huge dicts..."

thanks for the correction. You know, us foreigners...

Anyway, I looked up the 'huge dict' posts and didn't see anything distutils 
related. What did you have in mind?

btw, the recent postings to the distutils mailing list seem to point to 
improvements, and the current docs (on the web, not the ones from python 2.1) 
are indeed better. So I might wait out for 2.2 to come out before complaining 
too loudly. 

I really hope distutils fully matures, it seems very nice but yesterday 
trying to do things outside of the very narrowly defined options of stetup() 
felt like a huge PITA. Maybe I'm just dumb.

cheers,

f.


From cjensen at bioeng.ucsd.edu  Wed Dec  5 14:10:48 2001
From: cjensen at bioeng.ucsd.edu (Curtis Jensen)
Date: Wed, 05 Dec 2001 11:10:48 -0800
Subject: affects on extended modules
References: <3C051775.A8D4FD66@bioeng.ucsd.edu> <83pu5zrvbl.fsf@panacea.canonical.org>
Message-ID: <3C0E7138.FD485D1D@bioeng.ucsd.edu>

Kragen Sitaker wrote:
> 
> Curtis Jensen  writes:
> > We have created a python interface to some core libraries of our own
> > making.  We also have a C interface to these same libraries.  However,
> > the the python interface seems to affect the speed of the extended
> > libraries.  ie.  some library routines have their own benchmark code,
> > and the time of exection from the start of the library routine to the
> > end of the library routine (not including any python code execution),
> > takes longer than it's C counterpart.
> 
> In the Python version, the code is in a Python extension module,
> right?  A .so or .dll file?  Is it also in the C counterpart?  (If
> that's not it, can you provide more details on how you compiled and
> linked the two?)
> 
> In general, referring to dynamically loaded things through symbols ---
> even from within the same file --- tends to be slower than referring
> to things that aren't dynamically loaded.
> 
> What architecture are you on?  If you're on the x86, maybe Numeric is
> being stupid and allocating things that aren't maximally aligned.  But
> you'd probably notice a pretty drastic difference in that case.
> 
> ... or maybe Numeric is being stupid and allocating things in a way
> that causes cache-line contention.
> 
> Hope this helps.

Thanks for the responce.  The C counterpart is directly linked together
into one large binary (yes, the python is using a dynamicaly linked
object file, a .so).  So, That might be the source of the problem.  I
can try and make a dynamicaly linked version of the C counterpart and
see how that affects the speed.  We are running on IRIX 6.5 machines
(mips).
Thanks.

-- 
Curtis Jensen
cjensen at bioeng.ucsd.edu
http://www-bioeng.ucsd.edu/~cjensen/
FAX (425) 740-1451


From wganz at texoma.net  Tue Dec  4 02:39:09 2001
From: wganz at texoma.net (Will Ganz)
Date: Mon, 3 Dec 2001 23:39:09 -0800
Subject: Help with COM example from the PPWin32 book
In-Reply-To: 
Message-ID: 

Platform:
Windows 98SE, Excel2000, PythonWin 2.1.1 (#20, Jul 26 2001, 11:38:51)
HP-6648C(K6-2 550 w/192megs RAM, 20gig hd w/11gig free)

Problem:
The COM example on pages 68/69 from the 'caiman' book doesnt work. Gives a
error of 438 when VBA code from Excel is executed.

Discussion:
>>>>>> SimpleCOMServer.py <<<<<<<<<<<<<<
#simple COM Server demo

class PythonUtilities:
    _public_methods_ = [ 'SplitString' ]
    _reg_progid_ = "PythonDemos.Utilities"
    _reg_clsid_ = "{B91A4120-E716-11D5-9D0B-FFFFFF000000}"

def SplitString( self, val, item=None ):
    import string
    if item != None: item = str(item)
    return string.split(str(val), item)

if __name__ == '__main__':
    print "Registering COM server . . . . . . . ."
    import win32com.server.register
    win32com.server.register.UseCommandLine(PythonUtilities)

Invoked with c:\>python SimpleCOMServer.py
Output:
Registering COM server . . . . . . . .
Registered: PythonDemos.Utilities

In PythonWin Editor goto
Tools
COM browser
Registered Categories
Python COM Server
IID: PythonDemos.Utilities, double click to get
{B91A4120-E716-11D5-9D0B-FFFFFF000000}

So, I know that this is registered. Right??

In Excel's VBA Editor the following code is entered

Sub TestPython()

Set PyUtil = CreateObject("PythonDemos.Utilities")
response = PyUtil.SplitString("Hello from Python")

For Each Item In response
    MsgBox Item
Next

End Sub

Invoked by clicking on the Run button on the toolbar and it gives an error
of,

Run-time error '438'
Object doesn't support this property or method

When Debug is clicked, the yellow highlight is on this line:

response = PyUtil.SplitString("Hello from Python")

Yes, I have RTFM, RTFFAQ, STFA(Searched the archive), BMFB(Bought more
books), RTFT(Read those too), used Google, looked at Mark Hammond's site &
looked at his ppt files, and all to no avail.

Does anyone know what is going on here??

Thanks for the help,


Will




From allanwind at mediaone.net  Mon Dec  3 08:11:22 2001
From: allanwind at mediaone.net (Allan M. Wind)
Date: Mon, 3 Dec 2001 08:11:22 -0500
Subject: Minimum set of libraries for dynamic linking?
Message-ID: <20011203081122.A29075@digit-safe.dyndns.org>

How does one under Linux determine the minimum set of libraries needed
for dynamicly linking a program with an embedded python (2.2)
interpreter (library)?  I understand that missing symbols will cause the
link process to fail, but there seem to be cases where my program links
but segmentation fail when I do anything interesting?

I would like to understand the _method for finding the set of libraries_
rather than just a working set which I got from Demo/embed/Makefile
(with LIBPYTHON replaced with the .so version):

LIBPYTHON=      $(blddir)/libpython$(VERSION).a
LIBS=           -lnsl -ldl -lreadline -ltermcap -lieee -lpthread -lutil
LDFLAGS=        -Xlinker -export-dynamic
SYSLIBS=        -lm

e.g. are one supposed to match the libraries for libpython2.2.so (say,
found via ldd for instance) or the python binary itself?  Or should it
really work if the thing link?

Thanks in advance for your insight,


/Allan
-- 
Allan M. Wind			email: allanwind at mediaone.net
P.O. Box 2022			finger: awind at digit-safe.dyndns.org (GPG/PGP)
Woburn, MA 01888-0022
USA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
URL: 

From LLoeffler at home.com  Tue Dec 11 11:38:51 2001
From: LLoeffler at home.com (Luke)
Date: Tue, 11 Dec 2001 10:38:51 -0600
Subject: Hi All
References: <3C162B65.27E6B107@hongkong.com>
Message-ID: <3C16369B.2010902@home.com>

that's GREAT.



From peoter_veliki at hotmail.com  Sun Dec  2 18:41:45 2001
From: peoter_veliki at hotmail.com (Peoter Veliki)
Date: Sun, 2 Dec 2001 15:41:45 -0800
Subject: splitting using '\' as a delimiter
Message-ID: 

    
I have strings like this:

string = 'value\key'

that I would like to split.  If I try splitting the string like this:

alias = string.split('\\',string)

I get:

alias = ['\']    

How can I do this?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 

From lokie.spods at ntlworld.com  Mon Dec 31 14:58:06 2001
From: lokie.spods at ntlworld.com (lokie.spods)
Date: Mon, 31 Dec 2001 19:58:06 -0000
Subject: Cancel messages
References:  <6e43133.0112310938.6f93f585@posting.google.com>
Message-ID: 

"Rob Mitchell"  wrote in message
news:6e43133.0112310938.6f93f585 at posting.google.com...
> Gerhard H?ring  wrote in message
news:...
> > Le 28/12/01 ? 07:18, Syver Enstad ?crivit:
> > > [...]
> > > ========= WAS CANCELLED BY =======:
> > > Path:
news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol
.net!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!sj
c1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozema
il.com.au!not-for-mail
> > > Message-ID: 
> > > Control: cancel 
> > > Subject: cmsg cancel 
> > > From: Syver Enstad 
> > > Newsgroups: comp.lang.python
> > > X-No-Archive: yes
> > > Lines: 2
> > > NNTP-Posting-Host: wonenara.ozemail.com.au
> > > X-Trace: ozemail.com.au 1009643103 203.108.164.177 (Sun, 30 Dec 2001
03:25:03 EST)
> > > NNTP-Posting-Date: Sun, 30 Dec 2001 03:25:03 EST
> > > Organization: OzEmail Ltd, Australia
> > > Distribution: world
> > > Date: Sat, 29 Dec 2001 13:32:11 GMT
> > >
> > > This message was cancelled from within Mozilla.
> >
> > Just curious.
> >
> > What's going on here? A mailman bug from the mail <-> news gateway, or
> > somebody coverage-testing their Mozilla?!
>
> It's HipCrime, who does this sort of thing all the time.  Google has
> archived thousands of these rogue cancels all originating from
> 203.108.164.177 on December 13, 14, 15, 16, 17, 18, 20, 21, 29, 30, &
> 31:
>
> http://groups.google.com/groups?q=203.108.164.177&num=100&hl=en&scoring=d
>

He is rather well known isn't he.
He's also well known to the realtime spamfiltering lists:
http://www.orbz.org/b.php?203.108.164.177
http://spamcop.net/w3m?action=checkblock&ip=203.108.164.177
http://www.ordb.org/lookup/rbls/?host=203.108.164.177

I suspect that he'll be in a few more by the time this propergates :-)'s

> I would first try complaining to abuse at ozemail.com.au , & then if the
> rogue cancels continue after that date, to the newsfeeds propagating
> the rogue cancel forgery floods to the rest of Usenet, as shown on the
> Path line.  For example, for the header above, one would complain to
> concentric.net, home.com, look.ca, etc.  If the abuse still continues
> after that, these newsfeeds should be asked to block Ozemail entirely
> until it demonstrates itself to be a responsible ISP.
>
> Rob

Heres the AUP for ozemail :-
http://www.ozemail.com.au/info/about/userpolicy/acceptusepolicy.html

As they seem to be part of Yahoo, I suspect that a barrage of complaints
from ourselves will get someones account fried.

Anthony McDonald
--
Spammers please note all spam sent to this address immediately raises a
complaint with your network administrator.




From sill at sill.silmarill.org  Tue Dec  4 09:31:19 2001
From: sill at sill.silmarill.org (Andrei Kulakov)
Date: Tue, 04 Dec 2001 14:31:19 GMT
Subject: Any magazines about Python?
References: <3c0cd177.5568479@news>
Message-ID: 

In article <3c0cd177.5568479 at news>, Phredd Phlintstone wrote:
> I like to read away from my computer, and am wondering if any of the
> popular computer magazines have regular articles/columns about Python?
> I am very newbie, and starting to understand just the most basic
> programming principles from the Gauld book, "Learn to Program Using
> Python."  I know about online resources but am wondering if my local
> magazine rack has any promise.  Thanks
> Please post any responses to this to this newsgroup.

I really doubt it. Magazines don't usually have a periodic section for
a specific language.. I've seen python mentioned here and there, but
until there's a magazine focused squarely on python (and that probably
wont' happen in foreseeable future), you'll have to get by with
printouts of online articles and such.

 - Andrei


-- 
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: cy.silmarill.org


From tim at zope.com  Wed Dec  5 12:11:33 2001
From: tim at zope.com (Tim Peters)
Date: Wed, 5 Dec 2001 12:11:33 -0500
Subject: zip vs 0-length files again
In-Reply-To: 
Message-ID: 

[Robin Becker]
> Tim Peters posted stuff about winzip and .tgz files in the pas, but it
> was alleged that .zip's were OK. I have a freeBSD 4.4 built zipfile with
> 7 length zero __init__.py files. At least one of these fails to be
> extracted on a client's NT box. I am enquiring as to the version of
> zip/winzip being used. With my version 8 under win2k this doesn't
> happen. Can anyone recall more specific details of the problem?

Only that in the cases that came up last time, everyone reported problems
with with 0-length files in .tar format (ditto .tgz) under WinZip, but
nobody reported problems with 0-length files in .zip format under WinZip.
Several inquiries (from me) to WinZip tech support got no response.  A bug
with restoring empty *folders* was documented as fixed in WinZip 6.3.




From wurmy at earthlink.net  Tue Dec  4 15:28:03 2001
From: wurmy at earthlink.net (Hans Nowak)
Date: Tue, 04 Dec 2001 20:28:03 GMT
Subject: DOS, Socket support?
References: <9uj5ed$55m@news.or.intel.com>
Message-ID: <3C0D2FCB.320EF667@earthlink.net>

Brian Geddes wrote:
> 
> All -
> 
> I'm searching for a version of Python (1.5.2 or newer, preferably) compiled
> for DOS, that has includes support for TCP/IP sockets (socket.py).  After a
> bit of searching on the web I'm almost convinced that such a version does
> not exist, but I thought I'd check here before I gave up my search, as
> you've all been quite helpful in the past.  :)
> 
> I have found Python 1.5.2 compiled for DOS, but it was the executable only.
> I don't know the internals of socketmodule.c, but does anyone have an idea
> how difficult it would be to modify and recompile it for DOS?

Depends. *Compiling* it with the socket module is not that much of
a problem... I used to do that with DJGPP. I don't know for sure
though if I used a third-party library or that it came with DJGPP.
That's *compiling* -- the socket module didn't work well, although
I've been able to check mail with it (poplib.py), but not much more.

I think, to get a working socket module on DOS, you'll need to look
for a third-party library, and then somehow integrate it with the
Python module.

Unfortunately I am stuck on a box with WinXP now, so my DOS stuff
doesn't work well anymore (especially DJGPP seems to suffer from 
this)... so I cannot be of much more help right now. :-(

--Hans


From daves_spam_dodging_account at yahoo.com  Thu Dec 13 16:45:15 2001
From: daves_spam_dodging_account at yahoo.com (David Brady)
Date: Thu, 13 Dec 2001 13:45:15 -0800 (PST)
Subject: Ordered dictionaries?
Message-ID: <20011213214515.61016.qmail@web21106.mail.yahoo.com>

Hello,

One last Perl module that I need to replace to
complete my Python toolkit is a custom module that let
me create a dictionary whose keys were settable and
retrievable in a particular order.  Essentially, this
let us have a list whose ordered elements were also
accessible by name.

Has anyone done this?  If not, what class operators
would I need to override to create my own class that
does this?

Example of how it would work, assuming OrderedDict was
a working class of what I wanted:

>>> od = OrderedDict()
>>> od['Alice'] = 'Anderson'
>>> od['Bob'] = 'Bradley'
>>> od.append('Christiansen')
>>> od.['Dave'] = 'Dobson'
>>> od.keys()
['Alice', 'Bob', 2, 'Dave']
>>> od.values()
['Anderson', 'Bradley', 'Christiansen', 'Dobson']
>>> od[3]
'Dobson'
>>> od[7] = 'Johnson'
# Notice assignment does not trigger IndexError
>>> od.values()
['Anderson', 'Bradley', 'Christiansen', 'Dobson']
>>> len(od)
8
>>> for i in range(len(od)): print od[i]
Anderson
Bradley
Christiansen
Dobson
None
None
None
Johnson

...etc.  Notice that this is making the python list
act more like a Perl list, which may not be desirable.
 Also, I don't know if the None object "exists" in
terms of taking up space in the list, my thinking is
that it shouldn't; that trying to access an undefined
element should create the None object and return it
rather than padding the list with statically-created
None objects.

Anyway, if anyone has already done this, I'd love to
see it; if not, some tips about where to start would
be wonderful.  Is there a canonical list of all the
__functions__ a Python object can have, when they are
called and why, and what they must do if implemented
by a user?

Thank you,

-dB

=====
David Brady
daves_spam_dodging_account at yahoo.com
I'm feeling very surreal today... or *AM* I?

__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com



From martin.franklin at westgeo.com  Thu Dec 13 17:40:53 2001
From: martin.franklin at westgeo.com (Martin Franklin)
Date: Thu, 13 Dec 2001 22:40:53 +0000
Subject: Ordered dictionaries?
References: 
Message-ID: <9vbaom$5fio$1@mail1.wg.waii.com>

David Brady wrote:

> Hello,
> 
> One last Perl module that I need to replace to
> complete my Python toolkit is a custom module that let
> me create a dictionary whose keys were settable and
> retrievable in a particular order.  Essentially, this
> let us have a list whose ordered elements were also
> accessible by name.
> 
> Has anyone done this?  If not, what class operators
> would I need to override to create my own class that
> does this?
> 
> Example of how it would work, assuming OrderedDict was
> a working class of what I wanted:
> 
>>>> od = OrderedDict()
>>>> od['Alice'] = 'Anderson'
>>>> od['Bob'] = 'Bradley'
>>>> od.append('Christiansen')
>>>> od.['Dave'] = 'Dobson'
>>>> od.keys()
> ['Alice', 'Bob', 2, 'Dave']
>>>> od.values()
> ['Anderson', 'Bradley', 'Christiansen', 'Dobson']
>>>> od[3]
> 'Dobson'
>>>> od[7] = 'Johnson'
> # Notice assignment does not trigger IndexError
>>>> od.values()
> ['Anderson', 'Bradley', 'Christiansen', 'Dobson']
>>>> len(od)
> 8
>>>> for i in range(len(od)): print od[i]
> Anderson
> Bradley
> Christiansen
> Dobson
> None
> None
> None
> Johnson
> 
> ...etc.  Notice that this is making the python list
> act more like a Perl list, which may not be desirable.
>  Also, I don't know if the None object "exists" in
> terms of taking up space in the list, my thinking is
> that it shouldn't; that trying to access an undefined
> element should create the None object and return it
> rather than padding the list with statically-created
> None objects.
> 
> Anyway, if anyone has already done this, I'd love to
> see it; if not, some tips about where to start would
> be wonderful.  Is there a canonical list of all the
> __functions__ a Python object can have, when they are
> called and why, and what they must do if implemented
> by a user?
> 
> Thank you,
> 
> -dB
> 
> =====
> David Brady
> daves_spam_dodging_account at yahoo.com
> I'm feeling very surreal today... or *AM* I?
> 
> __________________________________________________
> Do You Yahoo!?
> Check out Yahoo! Shopping and Yahoo! Auctions for all of
> your unique holiday gifts! Buy at http://shopping.yahoo.com
> or bid at http://auctions.yahoo.com
> 
> 


One way to go would be:


from UserDict import UserDict


class OrderedDict(UserDict):
    def __init__(self):
        UserDict.__init__(self)
        
    
    def keys(self):
        keys=self.data.keys()
        keys.sort()
        return keys

    def values(self):
        values=self.data.values()
        values.sort()
        return values

    def __setitem__(self, key, value):
        if type(key)==type(1):
            # key is index 
            try:
                key=self.keys()[key]
            except IndexError:
                return None
            self.data[key]=value
        else:
            self.data[key]=value
        
   
    def __getitem__(self, key):
        if type(key)==type(1):
           # key is index so return value of nth sorted key
           try:
               return self[self.keys()[key]]
           except IndexError:
               return None
               
        else:
            return self.data[key]
   
if __name__=='__main__':
    od = OrderedDict()
    od['Alice'] = 'Anderson'
    od['Bob'] = 'Bradley'
    od['Jim'] = 'Smith'
    od['Sarah'] = 'Zac'
    od['Dave'] = 'Dobson'
    od[3] = 'Johnson'



Martin









From tim at vegeta.ath.cx  Thu Dec 27 03:47:14 2001
From: tim at vegeta.ath.cx (Tim Hammerquist)
Date: Thu, 27 Dec 2001 08:47:14 GMT
Subject: REPOST: Re: The Python community needs a lighter heart to it.
References: <40dbad98.0112261431.3e928cf2@posting.google.com>
Message-ID: <1$--$$-$$$$%_-$_$$@news.noc.cabal.int>

Andrew Nguyen  graced us by uttering:
> The python community is a bunch of people who can't take a joke.
> (Or at least make one:))

The hell you say!

> Also, usenet SUXXOR (sucks) because itttt issss
> soooo cunfuseeeng...

u r 2 l337 4 m3. (but at least you translated for us lamerz)

The mailing list would be an obvious choice for someone who can't
wrap his head 'round a newsgroup.  Honestly, complaining about usenet
with a mailing list available is like complaining about Linux
with AOL available. (hint, hint)

> Why not switch to an EZBoard? Why have maling lists that are too
> confusing?

You sure this isn't an EZBoard advert?  Besides, how many maling
lists are you a part of? Are you maled frequently?

(couldn't resist)

> I for one say that we create a NEW forum!

All in favor? ... Motion declined. Next order of business?

> I bet you, that if we put a link on the python homepage with a link
> to an EZBoard, python would be Much more popular. The most exciting
> topic I have seen to date is 'Fun with Classess in Python 2.2'.

Whoa, hold it right there! I _totally_ forgot that this was all some
kind of popularity contest. We should throw a Pythonista dance!

    [ Meanwhile, at the 1st Annual EZBoard  ]
    [ Dance, trouble is brewing...          ]
    "Hey."
    "Hey."
    "Nice class you got there."
    "Thanks. Hacked it up last week."
    "Mind if I inherit from it sometime?"
    "Um, sure."
    . . .
    "Did you hear the DJ play 'YMCA'?"
    "Yeah, right after 'Lady in Red'."
    "This isn't as cool as the EZBoard (TM) post said it would be."
    "No it isn't. All the women went to the usenet party."
    "Bummer."
    "Yeah."

=)

Your boredom is not cause per se to change the society at large.

Tim Hammerquist
-- 
In fond remembrance of (and good riddance to) Jeff K.

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!news.tele.dk!small.news.tele.dk!134.75.7.11!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Tim Hammerquist 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 04:39:55 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775878 27193 211.57.49.2 (31 Dec 2001 05:17:58 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:17:58 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From fperez528 at yahoo.com  Mon Dec 10 10:46:35 2001
From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=)
Date: Tue, 11 Dec 2001 15:14:35 +2328
Subject: Help newbie!
References: <9v5t5g$sp2$1@news.hccnet.nl> 
Message-ID: <9v60ho$5qu$1@peabody.colorado.edu>

Oleg Broytmann wrote:

> On Tue, Dec 11, 2001 at 10:17:35PM +0100, Johan Barelds wrote:
>> >>> replace("hello","hel","hol")
>> Traceback (most recent call last):
>>   File "", line 1, in ?
>> NameError: name 'replace' is not defined
>> ========================================================================
>> What do i have to do to get the command "replace" working?
> 
>    Either "from string import replace", or
> 
> import string
> string.replace(...
> 
> Oleg.

No need to import anything:

new_string = 'hello'.replace('hel','hol')

Cheers,

f


From waalp at pissed.co.uk  Tue Dec 18 05:18:24 2001
From: waalp at pissed.co.uk (waalp)
Date: Tue, 18 Dec 2001 11:18:24 +0100
Subject: implementing a timer?
References: <9vn0gv$ll6$1@colo.mobo-it.nl> 
Message-ID: <9vn1pj$ql0$1@colo.mobo-it.nl>

"Sylvain Thenault"  schreef in bericht
news:slrna1u5j5.2a0.syt at gemini.logilab.fr...
> On Tue, 18 Dec 2001 10:56:44 +0100, waalp  wrote:
> >I'm trying to make a script that will check if i have mail every let's
say
> >10 minutes.So i tought let's use something like a timer. But i can't find
> >any documentation on how to implement something like this.
> >
> >I'm a beginner so it could be that i haven't looked in the right places.
> >Could somebody please help?
>
> see method "sleep" in the module "time"
>
> --
> Sylvain Thenault
>
>   LOGILAB           http://www.logilab.org
>

Thanks... that was just the pointer i needed!

Peter




From DeepBleu at DeepBleu.org  Fri Dec 28 09:15:39 2001
From: DeepBleu at DeepBleu.org (DeepBleu)
Date: Fri, 28 Dec 2001 08:15:39 -0600
Subject: A new forum is up! Q: what means nntp
References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B5E9F.FF1C2CC@bellatlantic.net>   <3C2B941D.B1E45AA5@htp-tel.de>
Message-ID: 

Tom
NNTP is an internet protocol like SMTP, POP3 and HTTP for communication.
Also, it is the oldest one and it used to be the most instructive before AOL
hit the scene along with the 'gold rush' :)
Ask your ISP if they offer NNTP support through their own server.  Then you
can get an NNTP viewer/reader/poster/archiver/etc.... (On Windows, Outlook
Express acts also as a newsgroup reader.  Another good program is Agent.
Check www.stroud.com for the latest programs under the NNTP section).
Having done that you can choose/subscribe in your favourite newsgroups (like
comp.lang.python).
NNTP and newsgroups offer fantastic archiving mechanisms that no web forum
can ever aspire to in the present time.
Hope this helps.
DeepBleu

"Tom Karas"  wrote in message
news:3C2B941D.B1E45AA5 at htp-tel.de...
> Hello out there.
>
> > >It depends on how you view this 'forum.'  As far as I am concerned,
> > >**nothing** beats NNTP newsgroups viewed in a dedicated NNTP viewer.
>
> What means nntp ?
>
>
> Just my 2 cent question
>
> Best regards
> Tom Karas
>
> --
> The early bird catches the worm.   Trust the computer industry to
> shorten the term
> If you want something else for     "Year 2000" to Y2K. It was this kind
> of thinking
> breakfast, get up later.           that got us in trouble in the first
> place. Adrian Tyvand




From awinston at scn.org  Mon Dec  3 12:43:36 2001
From: awinston at scn.org (Alan Winston)
Date: Mon, 3 Dec 2001 09:43:36 -0800
Subject: splitting using '\' as a delimiter
References:  <200112030021.fB30LCM01808@mail.swissonline.ch>  <0b8m0ug185sd7reci9i863v0mia8e45hji@4ax.com>
Message-ID: <9ugdk9$ccl$1@brokaw.wa.com>

> [snip]
> This little inconsistency remains even with the new syntax:
>
>    string_to_be_split.split( delimiters )
>    regular_expression.split( string_to_be_split )

But at least this is much clearer.


Alan Winston
Seattle




From osuchw at ecn.ab.ca  Thu Dec 27 11:07:27 2001
From: osuchw at ecn.ab.ca (waldekO)
Date: 27 Dec 2001 08:07:27 -0800
Subject: Running a script in windows
References: 
Message-ID: 

Jonathan Gardner  wrote in message news:...
> I know this comes up a lot, but I can't seem to find the answer in the 
> archives. (If the answer is RTFM, please let me know where.)
> 
> I don't have a windows box on my desk. A friend of mine does, but I can't get 
> to it. He is trying to run a program I wrote, but the error message is coming 
> up too fast for him to catch it. How can you keep that error message window 
> around longer in Win2K? (BTW, let's pretend he doesn't know how to use the 
> DOS prompt.)
> 
> Jonathan

As the last line of your program put something like this

raw_input('\nPress Enter key to close')

It will keep DOS window open and you will be able to read error message.


From tjiit at yahoo.com  Wed Dec 26 13:37:12 2001
From: tjiit at yahoo.com (tjiit)
Date: Wed, 26 Dec 2001 19:37:12 +0100
Subject: strange Tkinter problem
References:  <3C297E61.70701@home.com>  
Message-ID: 

snip!
[ how to use threads and solve my problem ]

I implemented this already before my 1st post. I just wondered that
Tkinter first executes the network code and returns afterwards instead
doing these 2 things simultanous. I had a complete false understanding
how such GUI things work. 
Thank you for your advice!

   - tjiit


From jeff at ccvcorp.com  Wed Dec 19 12:57:11 2001
From: jeff at ccvcorp.com (Jeff Shannon)
Date: Wed, 19 Dec 2001 09:57:11 -0800
Subject: dynamic modules
References: <9vo01n$9j8$1@news.tpi.pl> <3c1f9f6f$1@brateggebdc5.br-automation.co.at>
Message-ID: <3C20D4F7.FB269AAA@ccvcorp.com>


Werner Schiendl wrote:

> Hi,
>
> you can create a type (a class) instead of a plain module.
>
> When the reference count drops to zero, the instance will then be deleted.
>
> It is probably possibly to create a singleton class, that always returns one
> single instance if there is one instead of creating a new one every time.
> But I never tried that.
>
> hth
> Werner

ActiveState's Python cookbook has a Singleton recipe at

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52558

and also the even-better Borg pattern from Alex Martelli:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531

Though, if the intent is to be able to clear out a large chunk of memory, I'm
not positive that either of these patterns will work.  In both cases, even if
you delete all the instances of your singleton/borg class, the class object
itself may still hold a reference to the shared data.  I suppose that, if you're
confident that you're done with it, perhaps you could delete the class object as
well....   something to look into, anyhow.

Jeff Shannon
Technician/Programmer
Credit International




From BPettersen at NAREX.com  Tue Dec 11 18:43:16 2001
From: BPettersen at NAREX.com (Bjorn Pettersen)
Date: Tue, 11 Dec 2001 16:43:16 -0700
Subject: PEP 276 Simple Iterator for ints (fwd)
Message-ID: <60FB8BB7F0EFC7409B75EEEC13E20192158C97@admin56.narex.com>

> From: Bengt Richter [mailto:bokr at accessone.com] 
> 
> On Tue, 27 Nov 2001 10:27:31 -0800, James_Althoff at i2.com wrote:
> 
> >
> >Greg Ewing wrote:
> >>While trying to think of a range syntax that looks unambiguously 
> >>half-open without clashing with list or tuple constructors, the 
> >>following blindingly obvious solution occurred to me:
> >>
> >>  for 0 <= i < 5:
> >>    ...
> >
> >Greg,
> >
> >Since this looks like a suggestion for replacing xrange in 
> the general 
> >case, did you have any thoughts on how one might specify a 
> step value?
> >
> 
> How about if a bare [x:y:z] were interepreted as an 
> abbreviation for slice(x,y,z) and you defined what one might 
> expect as an iterator for the slice type?
> 
> Then you could write
>     for i in [0:5]:   # or [:5]
>         ...

PEP 204 (http://python.sourceforge.net/peps/pep-0204.html) suggested
exactly this and was rejected.

-- bjorn



From philh at comuno.freeserve.co.uk  Sun Dec 30 19:41:06 2001
From: philh at comuno.freeserve.co.uk (phil hunt)
Date: Mon, 31 Dec 2001 00:41:06 +0000
Subject: REPOST: Re: Is learning Python "extraordinary"?
References:  
Message-ID: <7$--$$_----__-%%%$@news.noc.cabal.int>

On Sat, 29 Dec 2001 22:23:03 GMT, Courageous  wrote:
>
>Don't be afraid to stroke your own rhubarb,

Does it get bigger when you do that? :-)

 as it were, on a
>college admissions test. You don't get points for modesty and
>a self-deprecating nature on that type of thing. Trust me on
>this. Brag.

Absolutely. 

-- 
*** Philip Hunt *** philh at comuno.freeserve.co.uk ***

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: philh at comuno.freeserve.co.uk (phil hunt)
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 01:38:44 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009773999 27193 211.57.49.2 (31 Dec 2001 04:46:39 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:46:39 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From pj at sgi.com  Thu Dec  6 20:04:31 2001
From: pj at sgi.com (Paul Jackson)
Date: 7 Dec 2001 01:04:31 GMT
Subject: Calling a generator multiple times
References:  <3C0FD573.B1EB891E@bioreason.com> 
Message-ID: <9up4iv$e3796$1@fido.engr.sgi.com>

Bruce wrote:
|> [i for i in foo where bar]

Shouldn't that be:

    [i for i in spam where eggs]

One must learn to think in Python, mustn't one ?
-- 

                          I won't rest till it's the best ...
                          Manager, Linux Scalability
                          Paul Jackson  1.650.933.1373


From chrishbarker at attbi.com  Thu Dec  6 13:36:24 2001
From: chrishbarker at attbi.com (Chris Barker)
Date: Thu, 06 Dec 2001 10:36:24 -0800
Subject: pep proposal : A date object for the standard library
References: <7da8d8f8.0112060346.3e50092f@posting.google.com>
Message-ID: <3C0FBAA8.F1A44304@attbi.com>

sebastien wrote:

> A powerful mxDateTime tools already exist but this package is probably
> to complex to go on the standard distribution[3].

I use mxDateTime frequently, and it is a fabulous package. I have no
idea what Marc-Andr? Lemburg thinks about putting it into the standard
library, but the license he has released it under seems to allow it.
While it may have some extra stuff that wouldn't belong in the standard
library, It makes a whole lot more sense to me to put in a trimmed-down
version that to re-invent this particular wheel.

That being said, I really would like to have a nice DateTime Package as
part of the standard library, however it gets there.

One other note: Others here have pointed out limitations in the
suggested approach when it comes to Nanoseconds, and the like. I would
argue that applications that deal with nanoseconds are of a different
breed than those that deal with day, month, year type calculations.
There is no need for a single package to handle both well.

-Chris


-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at home.net                 ---           ---           ---
http://members.home.net/barkerlohmann ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------


From woodsplitter at rocketmail.com  Sat Dec 22 00:16:38 2001
From: woodsplitter at rocketmail.com (stalin)
Date: 21 Dec 2001 21:16:38 -0800
Subject: Fate of win32all?
Message-ID: <7876a8ea.0112212116.2ebabc23@posting.google.com>

I've used win32all occasionally--always in noncommercial settings--and
have found it helpful.  I'd like to thank Mr. Hammond for developing
the packages and ActiveState for supporting their recent maintenance
by employing Hammond.

Mr. Hammond had personally developed the win32 packages to
considerable maturity before he became involved with ActiveState.  His
employment by ActiveState appears to have come to an untimely end just
recently ( http://mail.python.org/pipermail/python-dev/2001-December/019038.html
).  I don't mean to be insensitive--I'm sure Hammond has a lot on his
mind right now--but I wonder about the fate of win32all.  What role
does ActiveState now play in licensing the package?  Has the original
author lost a degree of his control over it to his former employer?

My suspicion is rooted in the apparent lack of a binary distribution
of win32all for Python 2.2 independent of ActiveState's ActivePython
product.  Queries about a binary distribution of win32all for Python
2.2 have gone unanswered for months:

http://groups.google.com/groups?q=win32all+2.2&hl=en&group=comp.lang.python.*&rnum=1&selm=9ralkq%24rdc%241%40ins22.netins.net

ActiveState's win32all page does not list a binary download for Python
2.2,:
http://aspn.activestate.com/ASPN/Downloads/ActivePython/Extensions/Win32all

although they have developed an ActivePython 2.2 alpha that of course
*incorporates* win32all:
http://www.activestate.com/Products/Download/Download.plex?id=ActivePython

Hammond's personal Starship page makes no mention of a win32all binary
for Python 2.2:
http://starship.python.net/crew/mhammond/win32/Downloads.html

I wrote this message simply because I'd like to know who holds the
reins of win32all, and what their plans for it are.  I am *not* an
anti-ActiveState malcontent looking to spread conspiracy theories,
though I must say that recent developments call the future of the
company into question in my mind.


From infinitystwin.SPAM at IS.BAD.yahoo.com  Wed Dec 12 05:41:33 2001
From: infinitystwin.SPAM at IS.BAD.yahoo.com (Greg Krohn)
Date: Wed, 12 Dec 2001 04:41:33 -0600
Subject: Problems with Tkinter and menus
References: 
Message-ID: <3c173368$0$79564$6e49188b@news.goldengate.net>

"Fredrik Juhlin"  wrote in message
news:mailman.1008148516.7839.python-list at python.org...
> Hello,
>
> I'm trying to make cascading popup menus work in Tkinter. Unfortunately,
I'm
> having little success.
> The problem is that the commands under the second-level menus won't run
when
> clicked on. Actually, it seems like they are not responding to the mouse
at
> all, since hovering on a menu-item doesn't "mark" it.
>
> I've submitted test code to show the problem.
>
> Any help on this would be greatly appreciated!
>
> /FJ
>
[code sniped]

Works fine for me: Win2K/Python 2.1.1/Tcl 8.3.
It prints 'hello!' for 'Command1', 'Foo', and
'Bar'. Have you tried restarting Python? Maybe
something got reassigned somehow.


greg




From philh at comuno.freeserve.co.uk  Wed Dec 12 11:32:46 2001
From: philh at comuno.freeserve.co.uk (phil hunt)
Date: Wed, 12 Dec 2001 16:32:46 +0000
Subject: more fun with PEP 276
References: 
Message-ID: 

On Mon, 10 Dec 2001 16:04:04 -0800, James_Althoff at i2.com  wrote:
>
>wtanksley wrote:
>>>  >>> for i in -5 // span // 5:  # closed-closed
>>>  ...     print i,
>>>  -5 -4 -3 -2 -1 0 1 2 3 4 5
>>
>>Intriguing.  Odd.  Perverted.  Words would fail me, but doggone
>>it, I find myself liking it.
>
>Thanks, Billy.  I was starting to wonder if
>*anyone* was going come around to appreciating
>its quirky wholesome-ness. 
>
>>The scary thing is that despite the ENORMOUS gap between the purpose
>>of the / operator and your abuse of it (help! I'm being repressed!), I
>>can still read this naturally: "span over length of myList".
>>
>>Minor niggle: how would users remember which operator represents which
>>type of range ending?  Do you have a proposed mnemonic?

how about:

   for i in -5 to 5:

or

   for i in -5 to 5 step 2:


Here, "to" and "to...step" are keywords that create an xrange with the
required values; when used deirecvtly in a for loop, the compiler could
presumably optimise that out, but this should still work:

  values = -5 to 5 step 3
  for i in values:
     print i

should result in:
-5
-2
1
4



-- 
*** Philip Hunt *** philh at comuno.freeserve.co.uk ***



From emile at fenx.com  Sun Dec 16 10:23:25 2001
From: emile at fenx.com (Emile van Sebille)
Date: Sun, 16 Dec 2001 07:23:25 -0800
Subject: Idiomatic portable way to strip line endings?
References: 
Message-ID: <9viekc$fkp74$1@ID-11957.news.dfncis.de>

"Tim Hammerquist"  wrote in message
news:slrna1pbik.6jf.tim at vegeta.ath.cx...
> I've been trying to figure out the canonical way to strip the line
> endings from a text file.
>
> In general, I can use:
>
>     line = line[:-1]
> or
>     del line[-1:]
>
> to strip the last character off the line, but this only works on
> operating systems that have a one-byte line separator like Unix/Linux
> ('\n').  The Win32 line separator is 2-bytes ('\r\n'), so this
> solution is not portable.
>


How about:

line.endswith(os.linesep)

--

Emile van Sebille
emile at fenx.com

---------



From stephen.boulet at motorola.com  Tue Dec  4 13:41:32 2001
From: stephen.boulet at motorola.com (Stephen Boulet)
Date: Tue, 04 Dec 2001 12:41:32 -0600
Subject: redistributing Python runtime with an application
References: <3c0cf241$0$13459$39cecf19@nnrp1.twtelecom.net>
Message-ID: <3C0D18DC.270AB659@motorola.com>

You might be looking for py2exe.

-- Stephen

Eric Cifreo wrote:
> 
> I've seen posts and websites saying that the license allows for
> redistribution of Python's core, but I was wondering if there was a smaller
> package or subset (analogous to Java's runtime environment, or JRE) of the
> distribution.  I suppose I could start copying files selectively to a clean
> machine and figure it out that way but didn't want to reinvent the wheel if
> someone has already done this, or at least doumented how one does it.
> Anything out there already?
> 
> Thanks in advance,
> Eric Cifreo
> Austin, TX


From newscheme at hotmail.com  Sat Dec 22 09:07:37 2001
From: newscheme at hotmail.com (New Scheme)
Date: 22 Dec 2001 06:07:37 -0800
Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic
References:    
Message-ID: 

IsraelRT  wrote in message news:...
> On 22 Dec 2001 01:02:35 -0800, newscheme at hotmail.com (New Scheme)
> wrote:
> 
> >Anyone calling for injection of fresh ideas into the language is
> >attacked with a level of spite and religious vehemence rarely seen
> >outside of fundamentalist religious sects.
> 
> Anyone ?
> Or an anonymous troll who is too scared to use his real name ?

You obviously didn't read David Rush's rant.  Are you suffering from a
bit of selective amnesia?


From ed_play at yahoo.co.uk  Thu Dec 13 12:49:48 2001
From: ed_play at yahoo.co.uk (Ben Ainsworth)
Date: 13 Dec 2001 09:49:48 -0800
Subject: Raw sockets
Message-ID: <2c55c8be.0112130949.761bc120@posting.google.com>

Is there a good intro to using raw sockets with python on the web? I
want to try writing a variant of traceroute using tcp instead of icmp.

Thanks,
Ben Ainsworth


From tjreedy at home.com  Thu Dec  6 15:36:08 2001
From: tjreedy at home.com (Terry Reedy)
Date: Thu, 06 Dec 2001 20:36:08 GMT
Subject: Lists of attributes
References: 
Message-ID: 

"Bruce Eckel"  wrote in message
news:mailman.1007668580.29932.python-list at python.org...
> If I have:
>
> class Flower:
>   def accept(self, visitor):
>     visitor.visit(self)
>   def __repr__(self):
>     return self.__class__.__name__
>
> class Gladiolus(Flower): pass
> Flower.gladiolus = Gladiolus()
>
> class Runuculus(Flower): pass
> Flower.runuculus = Runuculus()
>
> class Chrysanthemum(Flower): pass
> Flower.chrysanthemum = Chrysanthemum()
>
> Is there a clever way to get a list containing
> [Flower.gladiolus, Flower.runuculus, Flower.chrysanthemum]
>
> I've got:
> [j for i,j in Flower.__dict__.items() if Flower in
> j.__class__.__bases__]
> But I was hoping for something less awkward...

That strikes me a pretty clever.  Alternatives are to encode
'subclassness' in names or keep explicit list:
class Flower:
  subclasses = []
...
Flower.subclasses.append[Gladiolus] #or whatever you want

Terry J. Reedy






From aahz at panix.com  Mon Dec 24 10:29:25 2001
From: aahz at panix.com (Aahz Maruch)
Date: 24 Dec 2001 07:29:25 -0800
Subject: vi or emacs for editing Python on Linux?
References:   <231220011915029251%jwbaxter@spamcop.net> 
Message-ID: 

In article ,
Bud Rogers   wrote:
>
>Both editors have a substantial learning curve.  It takes some time and 
>effort just to get to the point where you can use them effectively, and 
>more to get comfortable with either one.  Either editor has more power 
>and capabilities than most users will ever use.  Which one is right for 
>any particular user is a matter of taste and circumstance.  I would say 
>for the typical sysadmin who makes lots of small quick edits vi is 
>probably more efficient.  A developer who spends all day editing lots 
>of source files might find the emacs environment more comfortable.   
>Serious emacs users typically start emacs when they log in and leave it 
>running til they quit for the day.  They may have dozens of files open 
>at any given time and bounce back and forth between them.

No, *really* serious emacs users just boot emacs as their OS.
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

Tenth Virtual Anniversary: 7 days and counting


From jkraska at san.rr.com  Wed Dec 19 12:42:43 2001
From: jkraska at san.rr.com (Courageous)
Date: Wed, 19 Dec 2001 17:42:43 GMT
Subject: Update Oreilly books?
References:   <3C1E3805.6090009@home.com> <20011219074308.GA30387@kub.nl> 
Message-ID: 

>I got my Python Pocket Reference 2 Edition yesterday. It's a lot better
>than PPR1. Highly recommended.

How would you compare it to _Essential Python Reference_? I suppose,
at a minium, it would have to be more succcint?

C//



From jjl at pobox.com  Mon Dec 10 12:50:56 2001
From: jjl at pobox.com (John J. Lee)
Date: Mon, 10 Dec 2001 17:50:56 +0000
Subject: Recursing into directories
In-Reply-To: <2b6R7.169854$SF4.5531343@news1.rdc1.sdca.home.com>
References: <2b6R7.169854$SF4.5531343@news1.rdc1.sdca.home.com>
Message-ID: 

On Mon, 10 Dec 2001, Ron wrote:

> Hi,
>
> Is there a built-in class (in dircache, os.path????) that
> recurses thru a directory tree?

os.path.walk?


John



From matt at avaquest.com  Sat Dec  8 18:18:04 2001
From: matt at avaquest.com (Matthew King)
Date: Sat, 08 Dec 2001 18:18:04 -0500
Subject: freeze and minidom problem
Message-ID: <3C129FAC.50906@avaquest.com>

Hi. I'm trying to freeze a script that uses xml.dom.minidom.  I've 
compiled python 2.1.1 from source on RH 7.1 with all the modules that (I 
think) I use statically, including pyexpat. (no modules are reported 
missing at the end of freeze anyway)

The script runs fine, but after freezing I get the "No parsers found" 
exception.  Note that xml.parsers.expat in the frozen script works no 
problem.  it isn't until I try to call xml.dom.minidom.parse() that it 
barfs.

In searching c.l.p, I saw some references to freeze and PyXML... So I 
installed version 0.6.6 (as a .so - haven't tried to add it to 
Modules/Setup yet).   Again unfrozen works OK, but now the frozen 
version barfs on "import xml.parsers.expat" saying that it can't find 
"parsers.expat"?  Maybe this will go away if I statically link?

In case it helps, I've included the script and output from the frozen 
executable below.

Any ideas?  Thanks in advance...

- matt


here's the script:
     s = """"""

     print "testing expat..."
     import xml.parsers.expat

     def start_element(name, attrs):
         print 'from expat:', name

     p = xml.parsers.expat.ParserCreate()
     p.StartElementHandler = start_element

     p.Parse(s)

     print "testing minidom"
     import xml.dom.minidom

     dom = xml.dom.minidom.parseString(s)
     node = dom.getElementsByTagName('tag')[0]
     print "from minidom:", node.nodeName

and now the output from the frozen executable (without PyXML):

testing expat...
from expat: tag
testing minidom
Traceback (most recent call last):
   File "../xmltest.py", line 18, in ?
     dom = xml.dom.minidom.parseString(s)
   File "/home/mking/pytest/lib/python2.1/xml/dom/minidom.py", line 915, 
in parseString
     return _doparse(pulldom.parseString, args, kwargs)
   File "/home/mking/pytest/lib/python2.1/xml/dom/minidom.py", line 901, 
in _doparse
     events = apply(func, args, kwargs)
   File "/home/mking/pytest/lib/python2.1/xml/dom/pulldom.py", line 301, 
in parseString
     parser = xml.sax.make_parser()
   File "/home/mking/pytest/lib/python2.1/xml/sax/__init__.py", line 88, 
in make_parser
     raise SAXReaderNotAvailable("No parsers found", None)
xml.sax._exceptions.SAXReaderNotAvailable: No parsers found

and finally the output from the frozen executable with PyXML:

testing expat...
Traceback (most recent call last):
   File "../xmltest.py", line 5, in ?
     import xml.parsers.expat
ImportError: No module named parsers.expat




From syring at email.com  Wed Dec 26 22:03:42 2001
From: syring at email.com (Karl M. Syring)
Date: Thu, 27 Dec 2001 04:03:42 +0100
Subject: REPOST: Re: Pascal's triangle (beginner)
References: 
Message-ID: <2$--$$-$$$$%_%__-$@news.noc.cabal.int>

"A. Keyton Weissinger"  schrieb
> Good stuff in here, Karl. What are these examples from?


Well, Kirby Urner is a math teacher (http://www.inetarena.com/~pdx4d/ocn),
it seems, and the  question of the original poster looked like some kind
home work problem.

Karl M. Syring



========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: "Karl M. Syring" 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 01:58:54 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775947 27193 211.57.49.2 (31 Dec 2001 05:19:07 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:19:07 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From timr at probo.com  Sun Dec 30 16:21:43 2001
From: timr at probo.com (Tim Roberts)
Date: Sun, 30 Dec 2001 13:21:43 -0800
Subject: Suggested tweak to base64.py
Message-ID: 

Once in a while, I use the base64.py standard library module as a
standalone Base64 decoder.  However, there is a slight problem with this.
Most base64 attachments are encoded because they were binary files to begin
with.  The base64.py test() module writes its results to stdout, which on
Windows is a text file by default.  CR/LF and Ctrl-Z confusion ensues.

I'd like to suggest the following four lines be inserted just before the
end of base64.test():

    ...
        if o == '-t': test1(); return
+   if func == decode and sys.platform == 'win32':
+       import os
+       import msvcrt
+       msvcrt.setmode( sys.stdout.fileno(), os.O_BINARY )
    if args and args[0] != '-':
        func(open(args[0], 'rb'), sys.stdout)
    else:
        func(sys.stdin, sys.stdout)
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.


From aahz at panix.com  Sat Dec 29 13:15:14 2001
From: aahz at panix.com (Aahz Maruch)
Date: 29 Dec 2001 10:15:14 -0800
Subject: OT: Gender-based security? (was Re: Fate of win32all?)
References: <7876a8ea.0112212116.2ebabc23@posting.google.com>  <3C2BABD5.1070907@skippinet.com.au> 
Message-ID: 

[BTW, Bruce, could you please make sure to attribute quotes?  Makes
threads a lot easier to follow.]

In article ,
Bruce Eckel  wrote:
>Mark Hammond:
>>
>>Thanks to everyone who replied to this thread - I really appreciate the 
>>supportive words.  I am very sure I will land on my feet, so there is no 
>>need to worry (now if someone would just tell that to my girlfriend :)
>
>Women are wired different -- they look to security first. 

Nope.  Perhaps you need to be introduced to some of the women I know.
Of course, they *do* tend to prefer Perl....
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

Tenth Virtual Anniversary: 2 days and counting


From jdavis at empires.org  Mon Dec  3 23:59:41 2001
From: jdavis at empires.org (Jeff Davis)
Date: Mon, 03 Dec 2001 20:59:41 -0800
Subject: Python garbage collection question
Message-ID: <9uhlca$dgf$1@news1.ucsd.edu>

I understand that Python uses a reference counting garbage collection 
algoritm. However, I noticed that some other langauges use a "mark and 
sweep" that does not require the INCREF and DECREF calls. Will the python 
development eventually lead up to a different style or is there some 
advantage to the current system? I am not trying to prod python in any 
direction, but I am curious about the garbage collection system.

Thanks,
        Jeff


From m.hadfield at niwa.cri.nz  Thu Dec  6 16:03:04 2001
From: m.hadfield at niwa.cri.nz (Mark Hadfield)
Date: Thu, 6 Dec 2001 21:03:04 +0000 (UTC)
Subject: MINGW
References: <9uo25q$ilp$1@bob.news.rcn.net>
Message-ID: <000801c17e97$d97fd700$d938a8c0@Hadfield>

From: "David Abrahams" 
> Is anyone out there successfully using MINGW for development of
> extensions with recent versions of Python (e.g. 2.1, 2.2b2)? The
> procedures I've found on the web for making it work don't inspire
> confidence. I would appreciate a pointer to a known working
> procedure if anyone can come up with it.

This amy not be adressing exactly the question you ask, but I have
successfully built several extensions for native-Windows Python 2.1 with
Cygwin's gcc compiler in "no-cygwin" (aka "mingw") mode.

---
Mark Hadfield
m.hadfield at niwa.cri.nz  http://katipo.niwa.cri.nz/~hadfield
National Institute for Water and Atmospheric Research




-- 
Posted from clam.niwa.cri.nz [202.36.29.1] 
via Mailgate.ORG Server - http://www.Mailgate.ORG


From pete at shinners.org  Mon Dec  3 21:33:55 2001
From: pete at shinners.org (Pete Shinners)
Date: Mon, 03 Dec 2001 18:33:55 -0800
Subject: A pretty dumb newbie question
References: <20011203212412.12737.00000727@mb-cs.aol.com>
Message-ID: <3C0C3613.2020909@shinners.org>

N64fan2017 wrote:

> How would you calculate square root? I've tried
> x**1/2

couple things to point out. first. in your expression, the "power of" 
operator is happening before the "divide" operator. therefore your 
expression is working like this, "(x**1)/2". adding parenthesis to the 
statement "x**(1/2)" is not going to help you in this situation, why?

dividing two integers gives you an integer result.. therefore
1/2 == 0. if you want to calculate the square root like this, you'll 
want to use floating values, "x**(1.0/2.0)". this will give you the 
correct results you are looking for.

note, you can also call the squareroot function from the python math module:
	import math
	math.sqrt(x)

good luck with python!



From gh_pythonlist at gmx.de  Tue Dec  4 14:44:39 2001
From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=)
Date: Tue, 4 Dec 2001 20:44:39 +0100
Subject: DOS, Socket support?
In-Reply-To: <9uj5ed$55m@news.or.intel.com>
References: <9uj5ed$55m@news.or.intel.com>
Message-ID: <20011204194439.GA2515@lilith.hqd-internal>

On Tue, Dec 04, 2001 at 10:47:37AM -0800, Brian Geddes wrote:
> All -
> 
> I'm searching for a version of Python (1.5.2 or newer, preferably) compiled
> for DOS, that has includes support for TCP/IP sockets (socket.py).  After a
> bit of searching on the web I'm almost convinced that such a version does
> not exist, but I thought I'd check here before I gave up my search, as
> you've all been quite helpful in the past.  :)

I've also never heard of such a best.

> I have found Python 1.5.2 compiled for DOS, but it was the executable only.
> I don't know the internals of socketmodule.c, but does anyone have an idea
> how difficult it would be to modify and recompile it for DOS?

This would be a serious effort, but it is certainly feasible. I don't
have experience as a project manager, so I'm not very qualified for
this, but I'd estimate it would last approx. 6-8 weeks. The toughest
part would be to get a reasonable development environment for DOS up and
running (finding/buying those old compilers), getting Python itself to
compile in it, ...

So it would probably be best to find a programmer who has experience
with DOS programming and already has a development environment set up.

The actual implementation of socketmodule for DOS would hopefully be not
the problem. According to http://www.alumni.caltech.edu/~dank/trumpet/
there are C headers that wrap the Trumpet ABI. This API is almost
certainly a completely different beast than Unix sockets or Winsock, so
the programmer would probably have to #ifdef like hell in the
socketmodule.c file.

Perhaps the following could also work: run the DOS app under Windows 9x
and let a Windows process do the TCP/IP stuff?

Gerhard
-- 
mail:   gerhard  bigfoot  de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))



From mynews44 at yahoo.com  Mon Dec 10 17:48:46 2001
From: mynews44 at yahoo.com (google account)
Date: 10 Dec 2001 14:48:46 -0800
Subject: Is c or c ++ my language for this task... Or is it Python?
References: 
Message-ID: 

"Sean 'Shaleh' Perry"  wrote in message news:...
> > 
> > Anyways, I can't seem to see a piece of software out there that
> > provides this data for me and so undaunted I am going to write it for
> > myself.
> > 
> 
> Since you said dll can I presume Windows?  Either way, look at some of the
> available source code for linux (unix) dvd readers or driver code.  This may
> not help on your OS or directly for your problem but it will show how they are
> getting some of this data.  I believe one of the better ones is called 'xine'.


Thanks for the great response Shaleh.   This will send me on the way
to oblivion very quickly,  I think.    :-)

I am platform independent,  so I can just use this directly.   Maybe
one day I will want to port this functionality to windows, but at this
stage whatever i can get it to work on would be awesome.

:-)

Cha


From aahz at panix.com  Sat Dec 22 10:58:12 2001
From: aahz at panix.com (Aahz Maruch)
Date: 22 Dec 2001 07:58:12 -0800
Subject: Search the difference: Why this function defenition does'nt work?
References: <3C24A967.3070604@student.kun.nl>
Message-ID: 

In article <3C24A967.3070604 at student.kun.nl>,
husam   wrote:
>hi, I'm a beginner to python and try to understand some basic stuff. 
>Hier are two function defenitions , which look the same for me, but the 
>second one does not work. Can anybody explain why?
>
>def fun1 (*args):
>	sum=args[0]
>	for next in args[1:]
>		sum=sum+next
>	return sum
>print fun1('a','b','c')
> >>>abc
>
>
>def fun2 (*args):
>	sum=args[:0]
>	for next in args[1:]
>		sum=sum+next
>	return sum
>
>print fun2('a','b','c')
>
> >>> TypeError: illegal argument type for built-in operation

>>> l=['a','b','c']
>>> l[0]
'a'
>>> l[:0]
[]

That should be enough to figure out your problem.  Next time, try using
the interactive interpreter to test your code.
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

Tenth Virtual Anniversary: 9 days and counting


From brlspam at yahoo.com  Mon Dec 24 10:23:13 2001
From: brlspam at yahoo.com (Bruce Lewis)
Date: 24 Dec 2001 10:23:13 -0500
Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic
References:    <3218013921984060@naggum.net>  <3218081134224960@naggum.net>
Message-ID: 

Erik Naggum  writes:

> Have you thought about how _necessary_ it is for you Scheme freaks to be
> hostile to those who do not agree with you?  E.g., where _did_ the stupid
> need to attack Common Lisp now come from?  So immature and vindictive!

Many of the readers on the various cross-posted groups may think, "how
hypocritical of Erik Naggum to talk about hostility and vindictiveness!"
Not so, gentle readers.  This cannot be the real Erik Naggum; it is an
imposter.

I've read real Erik Naggum postings in the past.  Perhaps I didn't
follow those threads all the way through, but the postings I did read
were clever, witty, and genuinely amusing to read.  The repetitive venom
in this recent thread pales by comparison.

To the imposter, let me say this: You have a long way to go to catch up
with Erik Naggum.  Your postings include echoes of what he's posted in
the past, but that's actually what gave you away.  The real Erik Naggum
would have come up with some new angle for deprecating the Scheme
community.  You wouldn't catch him continuing to beat the "religious
cult" dead horse, though it was quite funny when he first introduced it.
And the references to mental institutions would be more clever.
Whenever he gets back from holiday, I'm sure he'll put you in your
place!

To the other groups, let me say that Common Lisp and Scheme are not
mutually hostile communities.  There are certain high-profile
exceptions, but these (the real ones, at least) can be genuinely fun to
read.

As an act of self-sacrifice for the greater good, I'm setting followups
for this flame war to comp.lang.scheme.  If the pathetic imposter
chooses to ignore followups, he'd better have a posting that's original
and witty.


-- 



From phd at phd.pp.ru  Thu Dec 20 05:27:59 2001
From: phd at phd.pp.ru (Oleg Broytmann)
Date: Thu, 20 Dec 2001 13:27:59 +0300
Subject: launching netscape from python
In-Reply-To: <3C21B743.AB4DBAB6@c-s.fr>; from anthony.harel@c-s.fr on Thu, Dec 20, 2001 at 11:02:43AM +0100
References: <3C21B743.AB4DBAB6@c-s.fr>
Message-ID: <20011220132759.C24403@phd.pp.ru>

On Thu, Dec 20, 2001 at 11:02:43AM +0100, anthony harel wrote:
> I wanted to know the best way to launch netscape (or internet
> explorer) from a python application.
> For the moment I'm using os.system with the command line in
> argument, but I'm sure it's not the best way to do it.
> This have to work under windows and UNIX.

   http://www.python.org/doc/current/lib/module-webbrowser.html

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.



From kragen at pobox.com  Sat Dec  1 18:54:39 2001
From: kragen at pobox.com (Kragen Sitaker)
Date: 01 Dec 2001 18:54:39 -0500
Subject: Converting an integer to base 2
References: 
Message-ID: <83zo52qyww.fsf@panacea.canonical.org>

"Alves, Carlos Alberto - Coelce"  writes:
> Yeah, it works. But not for n=0, when we get the wrong result '' intead '0'.

The representation of 0 as '0' is a special case.  You'll either have
to write special-case code for it or convert your recursive while loop
into a recursive do-while loop that always executes at least once.



From ulf.magnusson at ubm-computing.com  Sun Dec 16 10:56:27 2001
From: ulf.magnusson at ubm-computing.com (Ulf Magnusson)
Date: Sun, 16 Dec 2001 15:56:27 GMT
Subject: Idiomatic portable way to strip line endings?
References: 
Message-ID: 

> In general, I can use:
>
>     line = line[:-1]
> or
>     del line[-1:]

> snip...

> TIA,

There is an easy way to print them without the newline
print "hello world",

Use a comma attached at the end, this ofcourse doesn't modify the
string (strings are unmutable) but it fixes the print output.

the string module also supports the following
rstrip, strip, lstrip
which removes whitespaces (on the right side, the whole string, left side)

Cheers

/U. Magnusson





From johnroth at ameritech.net  Wed Dec 19 08:21:05 2001
From: johnroth at ameritech.net (John Roth)
Date: Wed, 19 Dec 2001 05:21:05 -0800
Subject: Dictionaries as records
References:   <7_XT7.28652$t07.4042756@twister.midsouth.rr.com>
Message-ID: 

"Bill Wilkinson"  wrote in message
news:7_XT7.28652$t07.4042756 at twister.midsouth.rr.com...
>
> "John Roth"
> > Your records seem to average around 250 bytes, so that's about 16
> > characters per field. Object overhead for each object is roughly the
> > same as this (it might be larger, I haven't looked at the headers
> > recently.)
>
> Yes sir, about 250 bytes.  Here is some code that shows what I am
confused
> about. (Hoping my spaces don't get stripped out while being posted)
> There is a big difference between the memory usage of the two sections
of
> code below. I can work around this, but I am a bit curious now.  It
would be
> nice to know why the second part below takes up so much ram (I think
about
> 1.2k per rec?).
>
> #A sample record that looks like the ones I use. Data obfuscated.
> d = {"f":"kdfkjdkfjdkj",
>     "g":"ldjfljdfkjdf",
>     "u":"dkfkjdfkjdfj",
>     "t":"kdjfkjdfkjdkjfkjdf",
>     "u1":"kdjfkjdjdkjfkjdfjkdjf",
>     "ii2":"kjdfkjdfjkdjfkjdfjdfj",
>     "g3":"ldjfljdfkjdf",
>     "u4":"dkfkjdfkjdfj",
>     "g5":"ldjfljdfkjdf",
>     "u6":"dkfkjdfkjdfj",
>     "g7":"ldjfljdfkjdf",
>     "u8":"dkfkjdfkjdfj",
>     "g9":"ldjfljdfkjdf",
>     "u10":"dkfkjdfkjdfj",
>     "g11":"ldjfljdfkjdf",
>     "u12":"dkfkjdfkjdfj",}
>
> #Method 1
> #Just make a bunch of copies of the same record again and again.
> tbl = []
> for x in range(15000):
>     tbl.append(d.copy())

In this case, you have one copy of each of your input
strings, not 15000 copies! The memory usage should be
pretty close to pure dictionary overhead.

> raw_input("Check your Ram usage then press enter")
>
> #Method 2
> #Ok, now change each record just a little bit.
> #Hack off the last two chars from each field and
> #add one new character. Then append the new record
> #to the table.
> tbl = []
> for x in range(15000):
>     t = d.copy()
>     for k in t.keys():
>         t[k] = t[k][:-2] + str(x)[-1]
>     tbl.append(t.copy())
> print "Now check your memory usage again."

Now, each string is a unique object, so around
800 bytes of the 1.5K overhead is due to the
strings..

If I remember your original post, this also supports
the observation that the dictionary approach takes
twice as much memory as the list approach.

Given my relatively limited understanding of
dictionaries, they seem to be about three times
the size I would expect.

Something you might try to see if it makes a
difference is to build the dictionary originally
with the unique strings, rather than updating it. It may
make a huge difference, or it may make no difference
at all.

John Roth




From dpj at world.std.com  Tue Dec  4 13:08:25 2001
From: dpj at world.std.com (David P Jablon)
Date: Tue, 4 Dec 2001 18:08:25 GMT
Subject: CryptKit 0.9: cryptsock
References:  <7xpu5y2szk.fsf@ruckus.brouhaha.com>  <7x667pw8ap.fsf@ruckus.brouhaha.com>
Message-ID: 

References and links for many of the papers in the field of 
password-based public key cryptography can be found at:
http://www.integritysciences.com/links.html

And several relevant submissions to IEEE P1363.2 can be found at:
http://grouper.ieee.org/groups/1363/StudyGroup/submissions.html

In article <7x667pw8ap.fsf at ruckus.brouhaha.com>,
Paul Rubin   wrote:
>Bryan  writes:
>> Thanks for the link, it lead me to research other password-based
>> key-agreement schemes. I found Authentication and Key Agreement via
>> Memorable Password (
>> http://citeseer.nj.nec.com/kwon00authentication.html ) which claims
>> to be the most efficient of all of them ( EKE, PAK, SRP, GXY, AuthA
>> ).  I believe I will implement AMP.  Your input would be
>> appreciated.
>
>I'm not familiar with AMP.  The SRP paper has references to some other
>protocols of this type though.  Main problem I see is patent issues
>around many of them.  I believe SRP was developed in order to avoid
>the EKE patent.

I can confirm that SPEKE was designed to avoid earlier patents.

-- dpj



From fgeiger at datec.at  Sun Dec  2 13:39:18 2001
From: fgeiger at datec.at (F. GEIGER)
Date: Sun, 2 Dec 2001 19:39:18 +0100
Subject: Are there any PEPs for typed arguments?
Message-ID: <9udsh4$3pf$1@rex.ip-plus.net>

Are there any ideas to promote these lines

def meth(a, b, c, d):
   assert type(a) == IntType
   assert type(b) == StringType
   assert isinstance(c, MyClass)
    
   return

into something like this:

def meth(a: IntType, b: StringType, c: MyClass, d):
   
   return

in a future version of Python?

Actually the Python interpreter would change those lines into the former
ones, i.e. it would replace the ": Type" by the appropriate assert
statements, when compiling.

No, this is not about dynamic vs. static typing (at least I think so) as
discussed so many times in the past. Everything else would remain as it is
now. This would just be an abbreviation for writing assert statements and
thus make Python code clearer (and, yes, save a few keystrokes).

Will such ideas make it into Python? And if yes, when?

Or am I the only one who does those asserts over and over again?

Cheers
Franz







From huaiyu at gauss.almadan.ibm.com  Wed Dec  5 14:58:35 2001
From: huaiyu at gauss.almadan.ibm.com (Huaiyu Zhu)
Date: Wed, 5 Dec 2001 19:58:35 +0000 (UTC)
Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)
References:          <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com>  <3C0BD39F.D43D4FF7@mega-nerd.com>  <3c0be454$1@207.229.64.20> <3C0BE5D5.4386B359@mega-nerd.com>
Message-ID: 

On Mon, 03 Dec 2001 20:51:34 GMT, Erik de Castro Lopo 
wrote: 
>
>However, the people who like me prefer using tabs (and nothing but tabs) for 
>indentation need to speak up.

It appears that both sides have already spoken enough and the issue is quite
clear.  So I have been wondering why it continues like a religious war.

It occurred to me that the reason might be that there are two different kinds
of editor behaviors concerning tab, and that users of one kind of editor do
not really understand what the other side is talking about.  I'll call these
editor styles the tab-character editor and the tab-display editor.

When a tab key is hit, the tab-character editor enters the ascii tab
character in the file.  It also displays the character in a way that is
often configurable.  The character is persistent (saving to file, sending to
someone else) and meaningful to Python, while the display is only effective
in the particular editor session.  The display usually takes the size of a
given number of spaces, but it really behaves like a single character to the
arrow keys, delete and backspace keys and to cut and paste.

In contrast, when a tab key is hit, the tab-display editor would translate
that into a sequence of other characters, usually a given number of spaces,
that produces the same display effect.  This display effect is persistent on
file and effective for Python.  The fact that they were entered using the
tab key is not recorded anywhere, probably not even in the current editing
session.  For example, the arrow keys will not move over tab as a single
character, and the delete key need to be hit more than once to delete it.

Many editors can be configured to behave either way (some even do additional
magic with the tab key).  But there might be crippled editors that only
allow one style.  That might be what's behind the claims that "it is not a
matter of personal preference" and "you can not separate style from
content".

So I'd suggest the tab advocates to consider the other side's view.  What if
their editors never allow this to be a _personal_ preference?  What if any
display setting would leak to other programmers?  I have limited experience
with MS native editors.  So I'm not sure if this is the case.  If it is
indeed the case, it can well explain why they do not see there being a
choice, let alone to consider which choice is better.

So we talk about the distinction between logical and visual formats, about
tab the character and tab the position.  But if the editor never allowed
such distinctions, none of these make much sense, and the tab-as-indent
argument might just sound as rhetoric to them.  To users of such editors,
"indent" always means visual indent; the Python block structure is only a
secondary effect.

The all-tab model we are talking about is like this (scheme A)

            A's editor        file exchange         B's editor
    visual <---------- tab <-----------------> tab -----------> visual
                       |                       |
                python |                       | python
                       V                       V
                     indent                  indent

But many of the arguments against it lead me to believe that non-tabbers
think we are talking about something like this (scheme B)

           A's editor           file exchange           B's editor
      tab <----------> space <-----------------> space <----------> tab
       |                                                             |
python |                                                             | python
       V                                                             V
     indent                                                        indent

while their preferred one is (scheme C)

           A's editor           file exchange           B's editor
      tab <----------> space <-----------------> space <----------> tab
                         |                         |
                  python |                         | python
                         V                         V
                       indent                    indent

If the only practical choice is between scheme B and scheme C, it is quite
understandable why C is preferred to B.  Indeed, in that case, there is very
little advantage in using tab at all.

If indeed one side is debating between A and C while the other side is
debating between B and C, and they thought they are in the same debate, that
could explain why the debate continues.  

So my question is this: Is it true that for some people there is never a
choice between all-tab and all-space, only a choice between mix-tab-space
and all-space?

If this so, whatever the merits of all-tab, the final result of the debate
might just be dictated by the simple fact "scheme A is not available as a
practical choice for some users because of the editors they use".


Huaiyu


PS. Space is better for visual formating, such as lining up multiline (), []
and {}, but these are not syntactical indentation concerning Python.  I did
not use tab for the above diagrams as it is visual formating.


From gerson.kurz at t-online.de  Sat Dec 29 14:19:59 2001
From: gerson.kurz at t-online.de (Gerson Kurz)
Date: Sat, 29 Dec 2001 19:19:59 GMT
Subject: Two languages, too similar, competing in the same space.
References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> 
Message-ID: <3c2e1623.22738515@news.t-online.de>

On Sat, 29 Dec 2001 13:40:16 -0500, Roy Smith  wrote:

>gerson.kurz at t-online.de (Gerson Kurz) wrote:
>> Call me oldfashioned, but I don't like exception handling - I like
>> if-then-else and error checking style.
>
>I've been writing lots of parsers lately, for every sort of data file we 
>use..Anyway, genericFileParser includes a parseError() method. A
>specific file  parser subclass can just do:
>
>   If len(blurfl) != 42:
>      self.parseError ('bogus length for blurfl')
>
>and you end raising genericFileParser.ParseError with an argument of 
>something like 'parse error in file foo.baz, line 47: bogus length for 
>blurfl').  The really nice thing is it could have been generated deep in a 
>function call chain, and I don't have to worry about propigating the error 
>indication back up the chain.

Well, you've certainly come to the right person ;) Check

http://p-nand-q.com/languages.htm

for some programming languages I've written, none of the
implementations require exception handling. Also check out "The Great
Python Language Zoo", a bunch of loosely related programming
languages, all implemented in python and all using the same internal
code representation. 

http://p-nand-q.com/gplz/gplz.htm

A very simple syntax plus implementation

http://p-nand-q.com/gplz/dist/easy.txt

Granted, most are not state machines, just backward recursive parsers
- but that's ok by my book ;) 



From hfoffani at yahoo.com  Sun Dec 16 13:30:19 2001
From: hfoffani at yahoo.com (Hernan M. Foffani)
Date: Sun, 16 Dec 2001 19:30:19 +0100
Subject: How 2 invoke python 2 read from text file under W2k
References: <3C1BBECF.E460DBEC@htp-tel.de> <3C1BCA57.C5E59D9B@bellatlantic.net> <3C1CBFE3.B106A192@htp-tel.de>
Message-ID: <20011216133108.098$Dn@news.newsreader.com>

Define a function and call it later. like:

def cooked_or_raw():
    temperature = input("What is the temperature of the spam?")
    if temperature > 50:
        print "The salad is properly cooked."
    else:
        print "Cook the salad some more."

cooked_or_raw()

regards,
-Hernan






From paul at boddie.net  Wed Dec  5 10:50:07 2001
From: paul at boddie.net (Paul Boddie)
Date: 5 Dec 2001 07:50:07 -0800
Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)
References:       <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com>   <3C0C8330.79D0E598@mega-nerd.com> 
Message-ID: <23891c90.0112050750.2bed3aa8@posting.google.com>

Courageous  wrote in message news:...
> >If spaces should creep in Python won't compile the code.
> 
> Spaces almost *have* to creep in, for example, on continuation
> lines. Furthermore, what you're saying isn't true. For example,
> if the person who writes it himself uses a tabstop of 8 and then
> allows spaces to creep in, things will tend to work out.

Can you give an example of how spaces must creep in on continuation
lines? Sorry, I know I should really have followed up by saying, "You
don't understand!!! You're so wrong!" But I'm interested in how other
people write their code - contrary to apparent popular belief.

> All of this, however, is academic. The defacto indentation
> standard for Python is 4 spaces.
> 
> If you run into Python projects managed professionally, you're
> likely to find that their dejure standards are 4 spaces as well,
> and with these, you'll find that in order to not get their tech
> leads really pissed at you, you'll be learning what a soft tab
> stop is, and setting it to 4.

Many of us haven't been lucky enough to encounter commercial Python
projects, but if that's what you mean by "professional" then I'll take
your word for it. I am aware that there's a lot of hostility to tab
usage in various open source projects, but that's really a consequence
of the tools around on many platforms today. I suppose that most
people just go along with whatever has been decided, though, and
that's why the tab/space handling tools need a lot more blatant
publicity - a best practice section on python.org would be nice...

Paul


From jadestar at idiom.com  Sat Dec 29 12:38:12 2001
From: jadestar at idiom.com (James T. Dennis)
Date: 29 Dec 2001 17:38:12 GMT
Subject: os.system commands in CGI on IIS?
References: <46d8afc4.0112140916.838be25@posting.google.com> <3C22400F.8000401@dittmar.net>
Message-ID: 

Daniel Dittmar  wrote:

>> if I execute
>> os.system("copy c:\a.txt c:\b.txt")
>> It does not happen when the cgi page is called from a browser.
>> However if the script is run from the command line, it works fine.

 Try os.system( r"copy c:\a.txt c:\b.txt" )

 ... to make that into a *raw* string (one in which a \ is just
 a \ and not a special character.

> In this specific case, you could use shutil.copy. In general, console 
> applications (like cmd.exe) will not work inside a service or a GUI only 
> program. You might try using the popen2 module, which possibly sets up 
> stdin and stdout just right such that Windows doesn't need the console 
> window. Setting the property 'may interact with desktop' for the IIS 
> service might work as well, but you'll get annoying windows flashing 
> across the screen.

> Daniel

 For this particular example, shutil.copy() is better.  For the
 general case of passing literal strings, esp. MS-DOS compatible 
 filespecs with \'s, use raw strings when you can, mind your 
 escape sequences when you can't.



From jgardn at alumni.washington.edu  Tue Dec 11 20:24:02 2001
From: jgardn at alumni.washington.edu (Jonathan Gardner)
Date: Wed, 12 Dec 2001 10:24:02 +0900
Subject: Python Vim Module - works
In-Reply-To: 
References:   
Message-ID: <200112120127.fBC1RwJ32405@my.knctv.co.kr>

On Tuesday 11 December 2001 12:32 pm, Brian Sturk wrote:
> Check out my terminal buffer python script for vim.  I find it
> useful.   :)
>
>     http://www.nh.ultranet.com/~bsturk/vim.html
>

Make sure this gets on the vim.sourceforge.net site or they know to link to 
you. It is pretty cool.

Jonathan



From charlesh at pop.newsguy.com  Fri Dec 14 12:56:19 2001
From: charlesh at pop.newsguy.com (Charles Hixson)
Date: Fri, 14 Dec 2001 09:56:19 -0800
Subject: Preserving program structure
References: 
Message-ID: <3C1A3D43.9010908@pop.newsguy.com>

I always use only tabs (and I use editors that let me specify 
the size of a tab to be 3).  Idle has lots of nice features, but 
I find that it doesn't work for me for serious development.  On 
Windows I prefer GWD edit.  On Linux ... currently I use NEdit, 
but I'd really prefer something that had a project file. 
Glimmer looked promissing, but ... (I can't remember why I 
dropped it, I think that it interpreted tabs in a strange and 
unuseful way).  But project files are really nice.  (Perhaps 
I'll adapt that wxProject tool that IBM contributed via 
Developer Works -> wxPython.  That will create a stand alone 
project file, which would remedy the main problem with NEdit.

A problem that just about everything except SciTE (Scintilla) 
has is that it may color code the program, but it only prints in 
black and white (if it will print at all).  So far I've usually 
dealt with that by loading the program into SciTE when I want to 
print it.  It isn't a bad editor, but it's a bit primitive, and 
there is appearantly no intention to take it any further (it was 
intended as a demo of what one could do with Scintilla, so 
that's fair).  (This may be a Windows only tool.  I don't 
remember.  On Linux I tend to convert the file to an HTML 
representation and print it from a browser.  But I don't 
currently remember just HOW I do that [my Windows machine has a 
much better printer].)



From nospam at sebsauvage.net  Mon Dec 17 10:43:56 2001
From: nospam at sebsauvage.net (Sébastien SAUVAGE)
Date: 17 Dec 2001 15:43:56 GMT
Subject: CONVERTING TIFF FILES TO JPEG FILES
References: 
Message-ID: 

"kmarkie2002"  wrote in 
news:mailman.1008598520.27127.python-list at python.org:

> Hello-
> I'm looking for a way to convert a TIFF file to a JPEG file.  Is 
> there a free program that I can download for this?
> 

XNView or nconvert

http://www.xnview.com

Freeware.
Can read 300 different file formats.

Works in command-line so that you can call it from Python with system().

-- 
S?bastien SAUVAGE
sebsauvage at sebsauvage dot net
http://sebsauvage.net


From peter at engcorp.com  Mon Dec 10 01:44:24 2001
From: peter at engcorp.com (Peter Hansen)
Date: Mon, 10 Dec 2001 01:44:24 -0500
Subject: Populating a list
References:  
Message-ID: <3C1459C8.6A9D697C@engcorp.com>

Bruce Eckel wrote:
> 
> I would probably do it like this:
> lines = [l.rstrip() for l in open('filename')]
> In Python 2.2 you don't have to say "readlines", as open() produces
> an iterator.
> Using rstrip(), I believe, handles more general cases (some oses
> have two characters to end a line, rather than just one).

Although then you run the risk of removing useful 
information, if trailing whitespace (other than the
line terminating sequence) is supposed to be preserved.

As usual, it depends on the original requirements...

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com


From rdsteph at earthlink.net  Thu Dec 27 05:15:32 2001
From: rdsteph at earthlink.net (Ron Stephens)
Date: Thu, 27 Dec 2001 10:15:32 GMT
Subject: REPOST: Literally thousands of Pythonic online articles
Message-ID: <8$--$$-$$$$%%-$$-$@news.noc.cabal.int>

Bored with the holidays? Then maybe you should check out the list of
online Python related articles generated by Hans Nowak's Pythonic
Webcrawler at http://www.awaretek.com/plf.html

Even though it's still a little rough around the edges, in its alpha
state, one can spend a lot of time browsing the online articles listed
by date of first posting to the web.

Better yet, why not fool around with the source code (it's GPL) and
improve it, add more site configurations to be searched, or even add an
automatic routine to update the list daily or even hourly to a web site.

Anyway, check it out if you wish. It takes a half minute to download the
output.html file using my cable modem (its almost a MB in size); with a
56K connection it could take awhile. But remember its thousands of
links. Also, you can get around the download time angle by downloading
and running the mygale.py script locally on your machine.

Ron Stephens
http://www.awaretek.com

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Ron Stephens 
Newsgroups: comp.lang.python
Subject: cmsg cancel <3C2AF56C.1DDF68E7 at earthlink.net>
Control: cancel <3C2AF56C.1DDF68E7 at earthlink.net>
Date: Mon, 31 Dec 2001 01:55:31 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775834 27193 211.57.49.2 (31 Dec 2001 05:17:14 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:17:14 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From wware at alum.mit.edu  Thu Dec  6 21:59:59 2001
From: wware at alum.mit.edu (Will Ware)
Date: Thu, 06 Dec 2001 21:59:59 -0500
Subject: Python classes for reading/writing/parsing MIDI files
References: <3C0F63F0.20D2B25@alum.mit.edu> <7876a8ea.0112061455.6685b313@posting.google.com>
Message-ID: <3C1030AF.5103FE40@alum.mit.edu>

I fixed the text formatting problem:
http://groups.google.com/groups?hl=en&selm=3C0F67FE.96E7CAE8%40alum.mit.edu

stalin wrote:
>   Have you registered this module with the Vaults of Parnassus?  There
> are several MIDI packages currently listed there; is one of them
> yours?
> http://www.vex.net/parnassus/apyllo.py?find=midi

Hmm. I'll have to look at those. Lots of interesting work there, but mine's
not in there yet. I'd feel better about submitting my thing if I knew I
wasn't obviously replicating something already there.

It looks like midithing is the closest to what I've been trying to do. My
only reservation about adopting it is that I am a lamebrain Red Hat user
who is still stuck on Python 1.5.2 because the RPM system whines about
breaking other stuff if I try to upgrade, and midithing needs a more
current version of Python.


From peter at engcorp.com  Tue Dec 18 00:00:27 2001
From: peter at engcorp.com (Peter Hansen)
Date: Tue, 18 Dec 2001 00:00:27 -0500
Subject: How to make a socket.recv with nonblock?
References: 
Message-ID: <3C1ECD6B.FBAD9BBB@engcorp.com>

> I have a program like that:
> HOST=''
> PORT=21567
> ADDR=(HOST,PORT)
> udpSerSock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
> udpSerSock.bind(ADDR)
> ipsock=socket.socket(socket.AF_INET,10,8)
> while 1:
>  recvpack=ipsock.recv(1024)
>  ....
>  data,addr=udpSerSock.recvfrom(1024) 
> # I want to only make this sentence with nonblock at port 21567
> # notice that this sentence is in loop.

Have you looked in the documentation for the socket module, in the
subsection on the Socket class?  Look for "Socket.setblocking()".

(By the way, "statement" would probably be the better word to
use above.  "sentence" sounds unusual to an English speaker.)

Regards,
-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com


From christine.bartels at teleatlas.com  Tue Dec 18 05:57:49 2001
From: christine.bartels at teleatlas.com (christine.bartels at teleatlas.com)
Date: 18 Dec 2001 02:57:49 -0800
Subject: Improve performance for writing files with format modification
Message-ID: 

Hi!

I need some help to improve a function that formats a string and
writes the result to a file.
...
file = open(filein,"r")
nfile = open(fileout,"w")
while 1:
	fblock = file.readlines(0x2000)
	if not fblock: break
	for i in fblock:
		nfile.write("%20s%10s" % tuple(split(';')))
nfile.close()
...

I want to use python but at the moment the write-function takes so
much time that I prefer gawk for this conversion (3 times faster!). Is
there anybody who knows a way to improve the write-function?

Cheers,
Tine


From sholden at holdenweb.com  Wed Dec 12 22:28:57 2001
From: sholden at holdenweb.com (Steve Holden)
Date: Wed, 12 Dec 2001 22:28:57 -0500
Subject: Platform-independent GUID creation?
Message-ID: 

Does anyone have a readily-portable equivalent to the pythoncom.CreateGuid()
function?

regards
 Steve
--
http://www.holdenweb.com/






From sandskyfly at hotmail.com  Thu Dec  6 07:47:37 2001
From: sandskyfly at hotmail.com (Sandy Norton)
Date: 6 Dec 2001 04:47:37 -0800
Subject: getting the name of a variable
Message-ID: 

When I'm debugging I'm always sticking stuff like "print 'x:', x" in my code.
So is there a handy function that will print a variable name and value such that: 

>>> def print_var_name_and_value(var):
            "prints variable name : value"
            

>>> variable = 'me var'
>>> print_var_name_and_value(variable)
variable : me var


Any responses, pointers, hints would be much appreciated.

thanx.

Sandy


From msoulier at nortelnetworks.com  Wed Dec 19 16:41:43 2001
From: msoulier at nortelnetworks.com (Michael P. Soulier)
Date: 19 Dec 2001 16:41:43 -0500
Subject: problems building 2.1.1 on HP-UX 10.20
Message-ID: 

Hey people. 

So, I managed to configure, build and test with no problems, but when
I try a make install, I get this


[wmerh11c-pegdig-Python-2.1.1]$ gmake install Creating directory
/SRMS/utils/python2.1.1/bin
/home/pegdig/temp/mike/Python-2.1.1/install-sh python
/SRMS/utils/python2.1.1/bin/python2.1 if test -f libpython2.1.so; then
\ /home/pegdig/temp/mike/Python-2.1.1/install-sh -m 644
libpython2.1.so /SRMS/utils/python2.1.1/lib; \ else true; \ fi if test
-f ""; then \ /home/pegdig/temp/mike/Python-2.1.1/install-sh -m 555
/SRMS/utils/python2.1.1/bin; \ else true; \ fi
mkdir ./Lib/plat-hp-uxB
cp ./Lib/plat-generic/regen ./Lib/plat-hp-uxB/regen
export PATH; PATH="`pwd`:$PATH"; \
export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
export EXE; EXE=""; \
cd ./Lib/plat-hp-uxB; ./regen
python$EXE ../../Tools/scripts/h2py.py /usr/include/fcntl.h
'import site' failed; use -v for traceback
Traceback (innermost last):
  File "../../Tools/scripts/h2py.py", line 24, in ?
    import sys, regex, regsub, string, getopt, os
  File "/home/pegdig/temp/mike/Python-2.1.1/Lib/regsub.py", line 13, in ?
    import warnings
  File "/home/pegdig/temp/mike/Python-2.1.1/Lib/warnings.py", line 143
    print >>sys.stderr, "Invalid -W option ignored:", msg
           ^
SyntaxError: invalid syntax

Any idea what's wrong?

Thanks,

Mike

-- 
Michael P. Soulier, QX41, SKY  Tel: 613-765-4699 (ESN: 39-54699)
Optical Networks, Nortel Networks, SDE Pegasus
"...the word HACK is used as a verb to indicate a massive amount
of nerd-like effort."  -Harley Hahn, A Student's Guide to Unix


From rdsteph at earthlink.net  Thu Dec 27 17:56:29 2001
From: rdsteph at earthlink.net (Ron Stephens)
Date: Thu, 27 Dec 2001 22:56:29 GMT
Subject: Two languages, too similar, competing in the same space.
References: <3C2A9D33.67FEC261@earthlink.net>
Message-ID: <3C2BA7B8.35286DE3@earthlink.net>

I appreciate all of the above comments from all of you. To sum up my
position, briefly;

I feel that Ruby is so similar in design, purpose, and objectives to
Python,  that it competes directly with Python for developers' mind share.
However, Ruby does not, in my opinion, offer compelling enough improvements
upon Python, as to justify switching from Python to Ruby. In fact, I much
*prefer* Python to Ruby. But I can see where some significant number of
Python developers *might* prefer Ruby a little bit, because of some minor
differences, enhancements etc. I just don't think that such perceived
"enhancements" create any significant enough improvement to *justify* the
enormous work in the creation of Ruby, as a Python-like clone.

 Bruce Eckles said that, if a language can't give dramatic productivity
improvements over a predecessor language, that it does not justify one's
switching. 10% improvements are not nearly enough, he said. Now, we can
argue until the cows come home whether or not Ruby gives *any* improvements
at all over Python; I suspect it is a matter of taste. But now that Ruby is
out there, it absorbs enormous mind share, and development time to recreate
libraries etc., which are already available in Python,  thus hurting Python.

Of course Perl hackers might have said similar things about Python 10 year
ago ;-))).

And I like and respect Matz and the whole Ruby community. I wish them well.
But I recognize that their success may, on the margins at least, slow down
Python. Ah well, ....

Ron Stephens
http://www.awaretek.com/plf.html



From cuiod-tec at web.de  Wed Dec  5 05:18:21 2001
From: cuiod-tec at web.de (Jens Gelhaar)
Date: 5 Dec 2001 02:18:21 -0800
Subject: COMServer graphical output
Message-ID: 

Hi,

has some one a hint for me, how to create an graphical output from a
COMServer. To be more specific, I would like to create an COMServer,
which receives some data from ACCESS and return an chart (PIDDLE-GIF)
to be shown on the form. But I did not find anything usefull about
this subject, how to transfer binary data or an image thru the COM
Interface.

Thanks Jens


From lists at toadmail.com  Sun Dec  9 18:00:42 2001
From: lists at toadmail.com (Jeremy Whetzel)
Date: 09 Dec 2001 18:00:42 -0500
Subject: Populating a list
In-Reply-To: 
References: 
Message-ID: <873d2kxalh.fsf@toadmail.com>

"A. Keyton Weissinger"  writes:

> You can also do this:
> 
> states = []
> f=open('/home/mlorfeld/states.txt', 'r+').readlines()
> for i in f:
>   states.append(i.rstrip())
> print states
> 
> The rstrip() method, as you can probably guess, strips white spaces from the
> RIGHT end of the string.


Nifty tip... thanks.  =0)


> Not sure on the file closing that Jeremy mentioned (I'm also not that
> adept). But I thought it was probably good to do so -- just in case:
> 
> states = []
> f=open('/home/mlorfeld/states.txt', 'r+').readlines()
> for i in f:
>   states.append(i.rstrip())
> f.close()
> print states


Main reason why I mentioned the thing of leaving out the f.close() at
the end is because, for me at least, it generates an error if I try to
close it since it's not really the open file, but a list of all the
lines read from the file.  Otherwise I definitely would close it, too.

*scratches head*  Unless I'm doing something wrong...

Jeremy



From peter at engcorp.com  Fri Dec  7 22:29:30 2001
From: peter at engcorp.com (Peter Hansen)
Date: Fri, 07 Dec 2001 22:29:30 -0500
Subject: Monitoring the windows clipboard
References: <48dbc3f6.0112071800.7f7fd0b9@posting.google.com>
Message-ID: <3C11891A.1A9ADBC2@engcorp.com>

toflat wrote:
> 
> I have this shareware app that works with text files and has an
> "Automatic paste" feature. When this feature is activated it
> automatically pastes any text that is copied to the windows clipboard
> to whatever file is active in the program. So it has a way of
> monitoring the windows clipboard and pasting the contents to a new
> line in the file whenever something new is added to the clipboard. It
> seems to be pretty instantaneous (i get a little system 'beep').
> 
> Is there a way I can get Python to do the same thing?

Here's an exceptionally primitive try:
#----------------------
import win32clipboard as w
import sys,time
import msvcrt

CLIPFILE = 'clips.txt'

lastData = ''

while 1:
    # hit any key to exit
    if msvcrt.kbhit():
        msvcrt.getch()
        sys.exit(0)

    # don't suck up a lot of CPU
    time.sleep(1)

    # not sure this is adequate, but it works for me
    w.OpenClipboard()
    data = w.GetClipboardData()
    w.CloseClipboard()

    # strip stuff after null terminator
    nullIndex = data.find('\0')
    if nullIndex != -1:
        data = data[:nullIndex]

    # ignore if unchanged
    if data != lastData:
        lastData = data

        # tell user we got something
        print '-' * 40
        print 'Grabbed (((%s)))' % data
        print '\a'      # beep
        # could also do win32api.Beep(0, 0) if you import it

        # append to file with separator line
        file = open(CLIPFILE, 'a')
        print >>file, '-' * 40
        print >>file, data
        file.close()



-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com


From emile at fenx.com  Sun Dec 30 00:42:05 2001
From: emile at fenx.com (Emile van Sebille)
Date: Sat, 29 Dec 2001 21:42:05 -0800
Subject: Help - command line arguments
References: 
Message-ID: 

"Steve Zatz"  wrote in message
news:YpxX7.242028$bs2.45285312 at news02.optonline.net...
> I am new to Python and although I am sure that the following is obvious I
> can't figure the following out or find an answer in any of the texts that
I
> have access to.
>
> My question is:  Can you run a script that takes command line arguments
from
> within the Python shell or from the Python command line?
>
> For example, something like:
>
> test.py -a -b
>
> runs fine from the *Windows XP* command prompt.
>
> From the Python command line, I can do the following:
>
> import test
> test.main()
>
> which doesn't produce an exception but I can't figure out how to input the
> command line arguments.
>
> And from the Python Shell, just running test.main() produces a getopt
> exception which does not occur when it runs from the Python command line.
> (But in either case, I can't figure out how to use command line
arguments.)
>
> Again, any help would be appreciated.  Thanks.
>
>
>

C:\>type test.py
import sys
print sys.argv


C:\>python -c "import os; print os.popen('test.py passed_arg').read()"
['C:\\test.py', 'passed_arg']



Or you could force sys.argv appropriately:

import test
import sys
sys.argv = [test.__file__, 'my_argv1', 'etc...']
test.main()


HTH,

--

Emile van Sebille
emile at fenx.com

---------



From mynews44 at yahoo.com  Mon Dec 10 17:36:31 2001
From: mynews44 at yahoo.com (google account)
Date: 10 Dec 2001 14:36:31 -0800
Subject: Is c or c ++ my language for this task... Or is it Python?
References:  <3c14c628$3_1@mk-nntp-1.news.uk.worldonline.com>
Message-ID: 



> Standard C++, the topic of this newsgroup, has no facilities to do what you
> want. You need to post this question to a newsgroup that supports your
> operating system and/or your hardware - you are off-topic in comp.lang.c++.

Hrm....   apologies proferred.  

I did explain that I really don't know what language to delve into but
that I thought c++ was good for this and was wanting confirmation.   
I guess this is what I have,  however I am now stuck in a position of
not knowing where to post this to.

What language *does* offer what I require?  Where is its ng?

> And please don't cross-post to completely unrelated newsgroups.

Um....   See above,  but I thought it relevent as I was under the
impression I could build a front end gui with python.  Again,  if I am
mistaken, then I would love a pointer as to where to head.

Sorry.

I guess I will look elsewhere.


From logiplexsoftware at earthlink.net  Fri Dec 28 16:17:01 2001
From: logiplexsoftware at earthlink.net (Cliff Wells)
Date: Fri, 28 Dec 2001 13:17:01 -0800
Subject: Python on the desktop
In-Reply-To: 
References: <94e3fce8.0112210053.2568529d@posting.google.com>
	<3C238618.9F54E5CA@attbi.com>
	
	
	
	
	
Message-ID: <20011228131701.5160d8f5.logiplexsoftware@earthlink.net>

On Sun, 23 Dec 2001 07:11:36 GMT
Courageous  wrote:

> Indeed VC kills me some days. Surely thou understoodeth the
> sardonic aspect of my message.

Sorry, the xmas spirit must have desensitized my irony detector =)

-- 
Cliff Wells
Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308
(800) 735-0555 x308



From mcfletch at rogers.com  Fri Dec 28 23:18:05 2001
From: mcfletch at rogers.com (Mike C. Fletcher)
Date: Fri, 28 Dec 2001 23:18:05 -0500
Subject: import path, script path (was Re: module path)
References: <20011228224216.58950.qmail@web21103.mail.yahoo.com>
Message-ID: <3C2D43FD.6090006@rogers.com>

Here's what I do for setup... (the first two are normally done by the 
installer, just here for info)

assoc .py=Python.File
ftype Python.File=C:\bin\lang\py22\python.exe "%1" %*


The key settings...

PATHEXT=.PY;.COM;.EXE;.BAT;.CMD;.WSH
PATH=p:\;C:\bin\lang\py22\python.exe;...

Where PATHEXT makes it possible to treat any file with that extension as 
an executable when looking for commands.  Thus the script setup.py in 
the local directory (or on the path) will be found _before_ setup.exe 
when you type:

	setup install

Adding your python scripting/setup directory as your first path entry 
means you can drop scripts in there to override commands/provide 
commands anywhere in your file-system.


Combine that with a registry key from this .reg file:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor]
"CompletionChar"=dword:00000009
"EnableExtensions"=dword:00000001
"PathCompletionChar"=dword:00000009


And you have a fairly usable command-processor with 
file-completion-on-tab-key and the ability to just type the base name of 
python scripts stored in any directory on your path.

Enjoy all,
Mike


David Brady wrote:

...

> I am running Win9x, Win2k, and WinXP, and have
> JPSoft's excellent 4Dos and 4NT products for them.  In
> them, if you can make python scripts executable by
> typing
> 
> set .py=c:\Python21\Python.exe
> set .pyw=c:\Python21\Python.exe
...

> I have been told that the standard Windows cmd shell
> will do it for you as well, but I don't know how or
> where.

...
_______________________________________
   Mike C. Fletcher
   http://members.rogers.com/mcfletch/





From timr at probo.com  Thu Dec 27 13:59:17 2001
From: timr at probo.com (Tim Roberts)
Date: Thu, 27 Dec 2001 10:59:17 -0800
Subject: dtuple and sql functions
References: 
Message-ID: <5qrm2u8ghafrgfmir1t95nrp3vt58elio6@4ax.com>

tweek154 at yahoo.com (tweek) wrote:

>i am dealing with converting the date format from a MySQL database and
>i'd prefer to use the built in sql function than convert it using
>python.  here is what im trying to accomplish:
>
>
>flist = ["AssignedTo", "DATE_FORMAT(DueDate, '%m/%e/%Y')"]
>descr = dtuple.TupleDescriptor([[n] for n in flist])
>
>sql = """SELECT %s FROM joblog""" % ", ".join(flist)
>c.execute(sql)
>temp = c.fetchall()
>
>
>now unfortunately the field name is now called:
>temp.DATE_FORMAT(DueDate, '%m/%e/%Y')
>
>which should be invalid anyways.  what i want is to use it as
>temp.DueDate

SELECT clauses always allow renaming.  Try this:

  flist = ["AssignedTo", "DATE_FORMAT(DueDate, '%m/%e/%Y') AS DueDate"]

I don't know whether this screws up your TupleDescriptor function.  If so,
you could tweak flist after the call.
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.


From nhodgson at bigpond.net.au  Sun Dec  2 23:25:04 2001
From: nhodgson at bigpond.net.au (Neil Hodgson)
Date: Mon, 03 Dec 2001 04:25:04 GMT
Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)
References:          
Message-ID: 

Peoter Veliki:

> With tabs, each person can set the indenting width to whatever value
> he/she likes best.  As one person pointed out, a tab is a variable.  This
> flexibility is tantamount to a "separation of style and content".  This is
> an argument *for* using tabs.

    It could also be an argument for editors interpreting indentation spaces
differently to post-indentation spaces. If you have a file formatted with 4
space indentation and prefer 2 space indentation, then the editor can simply
interpret each indentation space as taking up half the width that it would
otherwise need.

   Neil





From FelixMeinhold at web.de  Sun Dec  2 19:03:28 2001
From: FelixMeinhold at web.de (Felix Meinhold)
Date: Mon, 3 Dec 2001 01:03:28 +0100
Subject: splitting using '\' as a delimiter
In-Reply-To: 
References: 
Message-ID: <200112030003.fB303TW02243@hex.warschau>

> I have strings like this:
>
> string = 'value\key'
>
> that I would like to split.  If I try splitting the string like this:
>
> alias = string.split('\\',string)
>
> I get:
>
> alias = ['\']
>
> How can I do this?
>
> Thanks

for me, this works:

import string
buffer = r'value\key'
print string.split(buffer,"\\")

used python 2.1.1 on linux

felix



-- 
Hi! I'm a .signature virus! copy me into your .signature file to help me 
spread!



From chrishbarker at attbi.com  Mon Dec 10 13:57:29 2001
From: chrishbarker at attbi.com (Chris Barker)
Date: Mon, 10 Dec 2001 10:57:29 -0800
Subject: Populating a list
References:  
Message-ID: <3C150599.33C3449B@attbi.com>

Bruce Eckel wrote:
> I would probably do it like this:
> lines = [l.rstrip() for l in open('filename')]

hey, I was about to post that!

I've also used map() a lot:

lines = map(string.strip, open('filename').readlines())

> Using rstrip(), I believe, handles more general cases (some oses
> have two characters to end a line, rather than just one).

I use strip() because whitespace athe beginning or end of line is
usually garbage in my applications.

It does handle more general cases, but if the file is opened as a text
file (the default), Python will always translate the line endings into
its native form (one \n). If the file is not native to the system you
are running on, you are SOL.

Kevin Cazabon wrote:
> > f=open('/home/mlorfeld/states.txt', 'r+').readlines()

> The file is still open
> however, you just have no way to close it.  I'd hope that Python would
> close the file once it goes out of scope, but I couldn't guarantee it.

Python does close the file when it's reference count goes to zero, which
will happen as soon as that line is done processing. I'm pretty sure it
is guaranteed, I certainly have never had a problem with it. That's
what's nice about Python's reference counting scheme.

-Chris


-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at attbi.net                ---           ---           ---
                                     ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------


From Tom.Karas at htp-tel.de  Thu Dec 27 17:14:27 2001
From: Tom.Karas at htp-tel.de (Tom Karas)
Date: Thu, 27 Dec 2001 23:14:27 +0100
Subject: A new forum is up! Q: what means nntp
References: <40dbad98.0112262238.73fc14f9@posting.google.com>   <3C2B941D.B1E45AA5@htp-tel.de> 
Message-ID: <3C2B9D43.E3B6407E@htp-tel.de>

Hello all!


Thank you Aahz Maruch.

> >What means nntp ?
> 
> It's a protocol for transferring netnews articles, the way HTTP is a
> protocol for transferring HTML documents.  For more information, poke
> around Google.


From tim at vegeta.ath.cx  Tue Dec 11 22:29:07 2001
From: tim at vegeta.ath.cx (Tim Hammerquist)
Date: Wed, 12 Dec 2001 03:29:07 GMT
Subject: lost interest?
References: <20011208001123.A5989@casa.parque>  <3C14FEBD.AD52B516@attbi.com>  <9v5enr079j@enews4.newsguy.com>   
Message-ID: 

Skip Montanaro  graced us by uttering:
> In Perl, do any of the various options available get blessed by Larry, thus
> killing off all the other wheels?

Yes. The File::Temp module was blessed into the standard perl
distribution as of 5.6.1 (fairly recently).

OTOH, the Perl language remains fairly more consistent and
backwards-compatible within major version numbers. I was surprised that,
while I very much liked the new features in py2.2, it seemed more
drastic than I'm used to coming from Perl.

Then again, neither of these are Bad Things (TM).  ;)

Tim Hammerquist
-- 
It's not the inital skirt length, it's the upcreep.


From gh_pythonlist at gmx.de  Mon Dec 17 07:49:19 2001
From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=)
Date: Mon, 17 Dec 2001 13:49:19 +0100
Subject: Update Oreilly books?
In-Reply-To: <20011217125507.C6285@poff.miazine.net>
References:  <9vkiln$61d$1@mozo.cc.purdue.edu> <20011217125507.C6285@poff.miazine.net>
Message-ID: <20011217124916.GA2773@lilith.hqd-internal>

Le 17/12/01 ? 12:55, Kirill Miazine ?crivit:
> * Alex Russell  [20011217 06:09]:
> > My personal opinion is that you can do better than "Programming Python". I
> > own both editions, and like neither, which is a damn shame since it's
> > O'Rielly, and the author isn't bad at all. It's just that the organization
> > is a mess, there's virtually no reference material, and truly useful topics
> 
> I agree with you here. I expected something like Programming Perl when I
> bought Programming Python (that's why PP was my first Python book). My
> expectations wasn't met. But still the book contains many useful
> examples and thus can be a great source of inspiration.

Me too. I bought the 1st edition and was quite disappointed by the book.
Granted, I mainly bought it for its part on Extension programming, and
that contained some useful tips. But overall the book seemed quite
unfocused. Perhaps the second edition is better, but some comments at
amazon.com suggest it isn't.

What I can recommend for an advanced Python programmer is "Python
Essential Reference" 2nd ed. from David M. Beazley.

Gerhard
-- 
mail:   gerhard  bigfoot  de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))



From ykingma at accessforall.nl  Mon Dec 10 14:38:06 2001
From: ykingma at accessforall.nl (Ype Kingma)
Date: Mon, 10 Dec 2001 20:38:06 +0100
Subject: __del__() in Jython (was Re: __subclasses__() (was OK, now *this* is 
 cool))
References:   <3C112086.5F7072A9@accessforall.nl>  <3C13404D.F7A60179@accessforall.nl>  <3C13CB48.D1357B4C@accessforall.nl> <9v0pon$lf8$1@slb7.atl.mindspring.net>
Message-ID: <3C150F14.68B0C8B8@accessforall.nl>

Andrew,

you wrote:
> 
> Ype Kingma:
> > Jython leaves all it's garbage collection to the Java VM.
> > This simplifies the Jython source code (a lot, no reference
> > counting anywhere). On the downside it is more difficult
> > to have a method executed when an object becomes garbage.
> 
> "more difficut" means it's still possible.  How?
> 

I meant using try/finally.

> I have a Python wrapper on top of a C library.  I use
> __del__ to call the special deallocator for the library
> when the object is no longer needed.
> 
> The library also has bindings for use with Java.  I tried
> using JPython (it was a while ago) but got memory leaks
> all over the place because it doesn't call __del__ methods;
> prefering the Java garbage collector.
> 
> How do I make Jython work with that wrapper?  try/finally
> doesn't work for my needs.
> 
>                     Andrew
>                     dalke at dalkescientific.com

You might try and override the finalize() method of 
java.lang.Object(), and evt. invoke the garbage collector
explicitly.

http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html#finalize()

I never tried overriding finalize() (not even in Java) so ymmv.
To do that you will probably have to make your jython object
a subclass of java.lang.Object. Eg. (warning: untested code)


import java

class JDeletable(java.lang.Object):
    def finalize(self):
        self.__del__() 

    def __del__(self):
        print 'Final curtain for:', repr(self)

JDeletable()

java.lang.System.gc()


As finalize() is rather special you might also consider asking on jython-users
or jython-dev first. Feel free to repost this.


Have fun,

Ype


From ssthapa at classes.cs.uchicago.edu  Mon Dec 17 19:09:34 2001
From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa)
Date: Tue, 18 Dec 2001 00:09:34 GMT
Subject: Python CPAN beta test
References:  
Message-ID: 

Walter Moreira  wrote:
>Traceback (most recent call last):
>  File "./ciphon.py", line 118, in ?
>    if config.getConfig().getParameter('autoupdate') == 'true':
>  File "./config.py", line 266, in getConfig
>    config = Configuration()
>  File "./config.py", line 85, in __init__
>    serverParser)
>  File "/usr/local/lib/python2.1/xml/sax/__init__.py", line 30, in parse
>    parser = make_parser()
>  File "/usr/local/lib/python2.1/xml/sax/__init__.py", line 88, in make_parser
>    raise SAXReaderNotAvailable("No parsers found", None)
>xml.sax._exceptions.SAXReaderNotAvailable: No parsers found
>
>The same exceptions is raised if I call make_parser() from the interpreter. Is
>there something missing in my installation?
>

    Do you have expat installed?  

-- 
----------------------------------------------------------------------------
	   		              |
Suchandra Thapa                       | "There are only two kinds of math . 
s-thapa-11 at NOSPAMalumni.uchicago.edu  | books. Those you cannot read beyond 
			              | the first sentence, and those you 
			              | can not read beyond the first page."
			              |                     -C.N. Yang
----------------------------------------------------------------------------


From tim.one at home.com  Mon Dec 10 20:04:52 2001
From: tim.one at home.com (Tim Peters)
Date: Mon, 10 Dec 2001 20:04:52 -0500
Subject: Small Bug?
In-Reply-To: <9v3k0b$pt2$1@bob.news.rcn.net>
Message-ID: 

[Raymond Hettinger]
> I was testing the type/class unification in 2.2b2 and noted a change in
> behavior between a sub-class of list and a sub-class of UserList.

It's different behavior, but not a change in behavior, since it wasn't
possible to subtype from list before 2.2.

> This is excepted from library code for UserList.Py in Python 2.1.1:
>
>     def __getslice__(self, i, j):
>         i = max(i, 0); j = max(j, 0)
>         return self.__class__(self.data[i:j])
>
> It shows that slices of a userlist are intensionally cast to retain the
> class object being sliced.
>
> In the Python2.2b2, this behavior changes and the slice is returned as a
> list rather than the type of object being sliced.

Yes, that's how it works.  There's a bug report on SourceForge that goes
into more detail, but the short course is that UserList behavior is
unsupportable in general, as the list implementation has no idea how a
subclass constructor needs to be called.  The UserList gimmick works in the
cases it works; so does subclassing list .

Guido recommends that you *not* try to override builtin behaviors when
subtyping from builtin types, but rather restrict yourself to adding new
methods and/or new data members.  If you think you have to override builtin
methods, then you're going to have to override every builtin method of
interest to you (even when you think the desired behavior "is obvious").

> ...
> P.S. I love the new Python.  It's great to not have to use 1L anymore to
> avoid overflow. Generators are cool. Nested scopes are cool. The
> new divison operator is a step in the right direction.  Thanks everyone
> for putting this together in time for Christmas.

Seems a pretty safe bet right now, but don't count your pythons before
they're hatched .




From aahz at panix.com  Sat Dec 29 11:26:25 2001
From: aahz at panix.com (Aahz Maruch)
Date: 29 Dec 2001 08:26:25 -0800
Subject: whrandom (was Re: Python 1.5.x vs Python 2.x.x)
References: <3C180FF7.DEAEA6C6@radical.ca> <7xheqkr05q.fsf@ruckus.brouhaha.com>  
Message-ID: 

In article , Aahz Maruch  wrote:
>In article ,
>James T. Dennis  wrote:
>>
>> While that topic has come up: I find whrandom to be an unsightly
>> name for accessing a set of functions which is so commonly accessed
>> by novice students.  What was wrong with must calling it rand or 
>> random?  Is it pure pedantry?
>
>You're not supposed to use whrandom, although unfortunately the docs
>have been less clear about this historically than they should have been.
>The specific functionality of random is located in whrandom, to provide
>an abstraction layer in case some better pseudo-random algorithm comes
>along.

Uh, never mind, that's only half-right.  You never were supposed to use
whrandom, but the functionality has now been moved to random and the
whrandom module is deprecated.
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

Tenth Virtual Anniversary: 2 days and counting


From mgerrans at ix.netcom.com  Wed Dec  5 04:04:51 2001
From: mgerrans at ix.netcom.com (Matt Gerrans)
Date: Wed, 5 Dec 2001 01:04:51 -0800
Subject: Help setting path on windows
References: <3C0D1802.6D93D957@motorola.com>
Message-ID: <9uko0t$2oa$1@nntp9.atl.mindspring.net>

I can think of at least three methods:

1) HKEY_LOCAL_MACHINE\Software\Python\PythonCore\2.1\PythonPath in Regedit and
add your path to the default path string there.
2) Add it to the PythonPath environment variable in autoexec.bat
3) Import sys, then do a sys.path.append('yourpath') in your script.
4) (oops -- IndexError: list index out of range!) Write a Python script that
uses win32api to do item one for you as needed; something like this should do
the trick:

from sys      import argv
from string   import lower
from string   import find
from win32api import RegOpenKeyEx
from win32api import RegQueryValueEx
from win32api import RegSetValueEx
from win32api import RegCloseKey
from win32con import HKEY_LOCAL_MACHINE
from win32con import KEY_ALL_ACCESS
from win32con import REG_SZ

def addToPyPath( newpart ):
 # Maybe get the version somewhere or search for it, or sort the
 # entries and use the most recent one, or specify which version's
 # path to modify, or finally: don't have several versions of Python
 # installed, like I have.
 keyname = r"SOFTWARE\Python\PythonCore\2.1\PythonPath"
 itemname = ""

 hkey = RegOpenKeyEx( HKEY_LOCAL_MACHINE, keyname, 0, KEY_ALL_ACCESS )
 pypath = RegQueryValueEx( hkey, itemname )[0]

 # If it is not already in the pythonpath, add it!
 if (find( lower(pypath), lower(newpart) ) < 0):
    RegSetValueEx( hkey, itemname, 0, REG_SZ, pypath + ';' + newpart )

 RegCloseKey(hkey)

if __name__ == '__main__':
   if len(argv) > 1:
      addToPyPath( argv[1] )
   else:
      print 'Please specify the part you want added to the Python path.'


- mfg

Stephen Boulet  wrote in message
news:3C0D1802.6D93D957 at motorola.com...
> Can someone help me?
>
> I'd like to be able to do:
>
>   from someModule import *
>
> and have my someModule.py file imported. Thanks.
>
> -- Stephen




From LLoeffler at home.com  Sun Dec 23 11:24:38 2001
From: LLoeffler at home.com (Luke)
Date: Sun, 23 Dec 2001 10:24:38 -0600
Subject: Search the difference: Why this function defenition does'nt work?
References: <3C24A967.3070604@student.kun.nl>  <3C24B3AE.8060103@student.kun.nl> <3C24C8DD.4090300@home.com> <3C259F21.2070604@student.kun.nl>
Message-ID: <3C260546.70701@home.com>

['c'] is a *list* with a character in it.

You can do this [1,2,3] + [1]
but not this [1,2,3] + 'a'

because the first example is concatenating two lists; the second is a 
list and a string.  Your summing code is taking a list and then 
appending strings (single character ones at that) to it.

It has something to do with how + is implemented... Each type of object 
implements something like __concat__ (I don't know if this is correct or 
not--I'm just guessing) which gets called when python sees a +.  It 
expects to see another object of its own type passed to it.  Imagine if 
you were the developer writing a concatenation function to concatenate a 
string type with a list... Say [1,2,3] + "abc".  Do you do this: 
[1,2,3,"abc"] or do you do this: [1,2,3,'a','b','c'].  It is ambiguous.

Luke


> But when I adjust the code to this:
> 
> sum=['c']
> 
> it still does not work, despite the fact that sum is not an undefined 
> object, right?
> 
> 
> 



From setar at gmx.de  Fri Dec  7 09:34:17 2001
From: setar at gmx.de (Oliver Hofmann)
Date: 7 Dec 2001 06:34:17 -0800
Subject: [Q] Overhead for lists as properties?
Message-ID: <440c5c6a.0112070634.4d6e6d03@posting.google.com>

'lo everyone!


Trying to figure out why appending to a list that is a class property
takes so much longer than appending to a class attribute; this seems
not to be the case for getting or setting other class attributes like
integers.

It seems setProperty is not called, btw:

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
       10   37.630    3.763   54.580    5.458 test.py:37(testSettingPropList)
  1000000   16.950    0.000   16.950    0.000 test.py:16(getB)
       10    3.910    0.391    3.910    0.391 test.py:32(testSettingNormList)
       10    1.500    0.150    1.500    0.150 test.py:27(testSettingProp)
       10    1.490    0.149    1.490    0.149 test.py:22(testSettingNorm)
        1    0.240    0.240   61.720   61.720 test.py:41(main)
        0    0.000             0.000          profile:0(profiler)
       20    0.000    0.000    0.000    0.000 test.py:4(__init__)
       20    0.000    0.000    0.000    0.000 test.py:9(__init__)
        1    0.000    0.000   61.720   61.720 profile:0(main())



Test code is appended below; I'm probably missing something obvious
here. 

Any help would be appreciated,


      Oliver

----------------------------
import profile, pstats

class Tester:
    def __init__(self):
        self.a = 0
        self.b = []

class Tester2:
    def __init__(self):
        self.__a = 0
        self.__b = []

    def getA(self): return self.__a
    def setA(self, new): self.__a = new

    def getB(self): return self.__b
    def setB(self, new): self.__b = new

    a = property(getA, setA)
    b = property(getB, setB)

def testSettingNorm():
    foo = Tester()
    for i in xrange(0, 100000):
       foo.a = i

def testSettingProp():
    foo = Tester2()
    for i in xrange(0, 100000):
        foo.a = i

def testSettingNormList():
    foo = Tester()
    for i in xrange(0, 100000):
        foo.b.append(i)

def testSettingPropList():
    foo = Tester2()
    for i in xrange(0, 100000):
        foo.b.append(i)

def main():
    for a in range(0, 10):
        testSettingNorm()
        testSettingProp()
        testSettingNormList()
        testSettingPropList()

if __name__ == '__main__':
    profile.run('main()', 'report')
    p = pstats.Stats('report')
    p.sort_stats('time').print_stats(10)


From ballabio at mac.com  Fri Dec  7 15:43:39 2001
From: ballabio at mac.com (Luigi Ballabio)
Date: Fri, 7 Dec 2001 21:43:39 +0100
Subject: staticmethod and __call__
In-Reply-To: <200112070704540760.0012181D@mail.rdc1.sdca.home.com>
References: 
 <200112070704540760.0012181D@mail.rdc1.sdca.home.com>
Message-ID: 

Bruce,

At 7:04 AM -0800 12/7/01, Bruce Eckel wrote:
>I suppose a generator could be thought of as a special case of a
>factory, but it's generally considered a different kind of entity.

I agree. The problem is, a "generator" in Python 2.2 is a well defined
concept and your previous implementation doesn't fit. In that framework,
an item generator would be something like:

def ItemGenerator():
     import random
     rgen = random.Random()
     items = [j for j in vars(Item).values() if isinstance(j, Item)]
     while 1:
         yield rgen.choice(items)

gen = ItemGenerator()
items = [gen.next() for i in range(5)]

Bye,
	Luigi

-- 



From tim at vegeta.ath.cx  Sat Dec 29 04:22:25 2001
From: tim at vegeta.ath.cx (Tim Hammerquist)
Date: Sat, 29 Dec 2001 09:22:25 GMT
Subject: install Python2.2 question
References:   
Message-ID: 

Alex Martelli  graced us by uttering:
> "Tim Hammerquist"  wrote:
>     ...
>> If you have a sufficient devel environment and you are up to the
>> challenge, you can try to build Python yourself, but it may be more
>> trouble than it's worth if you're new to linux.
> 
> How so?  tar xzf, cd, ./configure, make, sudo make install -- how
> much trouble can that be?

I can rephrase: if you're new to any operating system that comes
standard with development utilities like tar, make, cc. Note that
sudo is not available in all distributions (or even different
releases of the same distribution) of linux. Or those new to a
command line.

True, it is quite simple to type the characters you mention, but try
to explain to some previous Windows-user what he's doing and why he
can't just "download one of them RPM thingies and be done with it."

At times I have a hard enough time trying to convince people to login
as a non-root user and occasionally su, rather than run as root all
the time.

It's a different mindset from Windows and new users can get
overwhelmed.  Look at the options of a configure script, seeing error
messages because his linux distro is broken/missing headers, can
easily cause him to throw his hands up needlessly.

PN: Even clpm suggests using a prepackaged binary "until the user
feels up to compiling his own."

Tim Hammerquist
-- 
LISP programmers know the value of everything and the cost of nothing.
    -- Alan Perlis' corruption of an Oscar Wilde quote


From mwh at python.net  Tue Dec 18 15:26:02 2001
From: mwh at python.net (Michael Hudson)
Date: Tue, 18 Dec 2001 20:26:02 GMT
Subject: Newbie Wondering About Database Support?
References: 
Message-ID: 

richardkessler at matteicos.com (Richard Kessler) writes:

> I have recently discovered Python and am excited about the
> possibility of developing with the language. Unfortunately, I
> develop database centric applications, MS SQL Server, etc. and I do
> not see much talk about Python and access to databases. Am I missing
> something or is Python not intended for that purpose. I would love
> to replace programs currently in VB with Python, but they must be
> able to access databases.

http://www.python.org/topics/database/modules.html

should get you started.

Cheers,
M.

-- 
  The "of course, while I have no problem with this at all, it's
  surely too much for a lesser being" flavor of argument always
  rings hollow to me.                       -- Tim Peters, 29 Apr 1998


From debl2nonspammywhammy at bellatlantic.net  Sun Dec 30 23:30:08 2001
From: debl2nonspammywhammy at bellatlantic.net (David Lees)
Date: Mon, 31 Dec 2001 04:30:08 GMT
Subject: REPOST: Re: introduction to xml in python
References:  
Message-ID: <9$--$$_----__$__-$@news.noc.cabal.int>

There is a brand new OReilly that has just come out called Python & XML,
by Jones and Drake.
http://www.amazon.com/exec/obidos/ASIN/0596001282/qid=1009772857/sr=1-1/ref=sr_1_6_1/107-9962439-7043717

David Lees

John Hunter wrote:
> 
> >>>>> "Rajarshi" == Rajarshi Guha  writes:
> 
>     Rajarshi> Hi, could somebody point me to some code/tutorial
>     Rajarshi> describing how to use Python to parse XML - I tried
>     Rajarshi> delving into the Python docs, but it seems
>     Rajarshi> confusing. Whats the difference between expat and sax?
>     Rajarshi> How can I generate a parsers etc.
> 
> expat is a XML parser by James Clark written in C.  SAX (Simple API
> XML) is an event driven API for XML parsing.  You may need to do a
> little background research on XML parsing and event driven parsers
> before the python docs will start tom make sense to you.
> 
> You may be interested in http://www.4suite.org, which provides a set
> of XML tools for use in python.
> 
> There is also at least one book devoted to XML in python:
> http://vig.pearsoned.com/store/product/0,,store-562_banner-0_isbn-0130211192,00.html
> 
> Have fun,
> John Hunter

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!zeus.visi.com!news-out.visi.com!hermes.visi.com!nnxp1.twtelecom.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: David Lees 
Newsgroups: comp.lang.python
Subject: cmsg cancel <3C2FE9D9.46C7EBEF at bellatlantic.net>
Control: cancel <3C2FE9D9.46C7EBEF at bellatlantic.net>
Date: Mon, 31 Dec 2001 04:53:50 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009773899 27193 211.57.49.2 (31 Dec 2001 04:44:59 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:44:59 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From rockvz at yahoo.com  Tue Dec  4 00:16:24 2001
From: rockvz at yahoo.com (Rock VZ)
Date: Mon, 3 Dec 2001 21:16:24 -0800 (PST)
Subject: license key validation - encryption/decryption
Message-ID: <20011204051624.78143.qmail@web13504.mail.yahoo.com>

 


Hi,

I have a requirement to write a license file in XML.
The xml file will typically consist of a feature name
a "license key" to enable/disable the feature.

How do i generate this "encrypted license key" for
different features for different customers?

How do i validate it at the customer site that the
"key" installed is valid?

For example:
i can have 10 features for the product and each
feature has a encrypted key to enable the feature.

(I would be using python for coding the above.)

thanks
Rock



=====


__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com



From fperez528 at yahoo.com  Mon Dec 10 20:34:58 2001
From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=)
Date: Wed, 12 Dec 2001 01:02:58 +2328
Subject: Whatever happened to String Interpolation?
References: <9u6dbn$nsj$1@peabody.colorado.edu>  <9uerd1$hbk$1@peabody.colorado.edu> 
Message-ID: <9v731i$rsk$1@peabody.colorado.edu>

Ville Vainio wrote:

> Fernando P?rez  writes:
> 
>> That already exists: type 'python Itpl' in google.
> 
> So, it appears to be done already. What's the fuss, then? Wouldn't
> having this in the standard library suffice? Looking at the relatively
> concise syntax on Itpl, why on earth would one want an equivalent
> thing encumbering the core language?

Well, at least having it in the standard library would be IMO a big 
advancement. As it stands now, one often tries to work around it to avoid 
generating an extra dependency for a project.

Syntactic sugar is nice, but I could live with
        
        itpl('blah $foo $bar')

instead of 

        $'blah $foo $bar'

Cheers,

f


From dalke at dalkescientific.com  Sun Dec  2 22:42:53 2001
From: dalke at dalkescientific.com (Andrew Dalke)
Date: Sun, 2 Dec 2001 20:42:53 -0700
Subject: Very new to this
References: <#k0oOh4eBHA.1192@cpimsnntpa03> <#EQGkj4eBHA.1188@cpimsnntpa03> <3C0AB92D.2010407@home.com> <#3jVur4eBHA.1404@cpimsnntpa03> <3C0AEF74.3080005@home.com>
Message-ID: <9uesrd$pm4$1@slb7.atl.mindspring.net>

Luke wrote:
>If you aren't struggling, you aren't learning.

Which doesn't mean that more struggling means more learning.
Some things are needlessly hard.

                    Andrew
                    dalke at dalkescientific.com





From lokie.spods at ntlworld.com  Wed Dec 19 16:53:45 2001
From: lokie.spods at ntlworld.com (lokie.spods)
Date: Wed, 19 Dec 2001 21:53:45 -0000
Subject: I used os.waitpid,but I still can't Zombie process?
References: 
Message-ID: 

"??????"  wrote in message
news:mailman.1008727643.15703.python-list at python.org...
I still want to kill Zombie process which cause by child process,so I use
os.waitpid,But I found Zombie is still exist,why? my program is follows:
...
while 1:
  ...
  ret=os.fork()
  if ret==0:
     HOST=udpaddr
     PORT=21567
     ADDR=(HOST,PORT)
     udpSerSock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
     udpSerSock.sendto(data,ADDR)
     udpSerSock.close()
     break
  os.waitpid(ret,os.WNOHANG);

Where is my program's error? How to correct my program? Any idea will be
appreciated.
      Edward

Depends on what your trying to do.

If your intent is to spawn a child to do the work, and wait till its
completed, then replace os.WNOHANG with 0 in the os.waitpid call. Naturally
the question would become why spawn a process your going to wait for when
you could do the work inline and save the overhead of a fork call.

If as the code imply's your looking to continually spawn processes and
cleanup the zombies as they happen, then replace RET with -1 in the
os.waitpid call. I'd also advise looping on the return tuple to ensure you
remove as many dead processes as possible per loop.

However you can save a lot of overhead from the loop, by creating a handler
for SIGCHLD and calling waitpid(-1, os.WNOHANG) from within the handler. See
Pythons signal module for more details of that option.

Anthony McDonald





From skip at pobox.com  Tue Dec 11 17:55:23 2001
From: skip at pobox.com (Skip Montanaro)
Date: Tue, 11 Dec 2001 16:55:23 -0600
Subject: lost interest?
In-Reply-To: 
References: <20011208001123.A5989@casa.parque>
        
        <3C14FEBD.AD52B516@attbi.com>
        
        <9v5enr079j@enews4.newsguy.com>
        
        
Message-ID: <15382.36571.773967.809034@beluga.mojam.com>

    Alex> If it encourages more reuse of code in module A by the author of
    Alex> module B, I think it would be a VERY good influence "in the Python
    Alex> world".  Why *shouldn't* the useful 3rd-party modules we use be
    Alex> free to rely on other useful 3rd-party modules yet?!

    Skip> Python authors are free to rely on any modules they like,
    Skip> third-party or otherwise.  That they don't suggests to me that
    Skip> there's generally fairly little need to do that, at least for
    Skip> widely used packages.

    Tim> That may be true, but it just seems so hard to believe that, in so
    Tim> many non-interdependent modules, no one's reinventing the wheel in
    Tim> the least.

Yeah, people reinvent the wheel all the time.  If one wheel or another is
better, Darwinian selection tends to work pretty well to get rid of the bent
or not-so-shiny ones.  This process is sometimes sped up when Guido chooses
a new wheel for his next bike (distribution).  Recent case: unit testing.
There were, as I recall, three fairly "common" unit test modules.  Python
now has two of them (unittest (aka PyUnit) and doctest) in the core.  (It
works to have two in this case because they address somewhat different
niches.)  I can't remember what the third unit test module was anymore.

One area where Darwinian selection is still at work is in web application
servers.  I doubt any of the options (Zope, Quixote, etc) will ever be
incorporated into the core.  They will all either find niches or disappear.

In Perl, do any of the various options available get blessed by Larry, thus
killing off all the other wheels?

Skip



From mwh at python.net  Tue Dec  4 04:53:49 2001
From: mwh at python.net (Michael Hudson)
Date: Tue, 4 Dec 2001 09:53:49 GMT
Subject: a comment about PEPs
References:   
Message-ID: 

philh at comuno.freeserve.co.uk (phil hunt) writes:

> On Mon, 3 Dec 2001 11:15:44 GMT, Michael Hudson  wrote:
> >philh at comuno.freeserve.co.uk (phil hunt) writes:
> >
> >> Whenever I have a peek at c.l.p, there are usually several threads going
> >> suggesting improvements to the langauge.
> >> 
> >> Why is this?
> >
> >Because threads that start with "Python's fantastic!!" don't usually
> >garner many followups?  Same sort of thing as "no news is good news".
> >
> >The advantage of PEPs is if someone writes one and it gets rejected
> >there's a chance (and only a chance) of heading off the discussion the
> >next time around.
> 
> Who decides whether PEPs are approved/rejected? The BDFL?

More or less.  From PEP 1:

  Once the authors have completed a PEP, they must inform the PEP
  editor that it is ready for review.  PEPs are reviewed by the BDFL
  and his chosen consultants, who may accept or reject a PEP or send
  it back to the author(s) for revision.

Basically like any other language decision; Guido might listen to us,
but the D in his name means he doesn't have to.

Cheers,
M.

-- 
31. Simplicity does not precede complexity, but follows it.
  -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html


From James_Althoff at i2.com  Thu Dec  6 18:49:28 2001
From: James_Althoff at i2.com (James_Althoff at i2.com)
Date: Thu, 6 Dec 2001 15:49:28 -0800
Subject: staticmethod and __call__
Message-ID: 

Bruce Eckel wrote:
>I seem to have trouble getting __call__ to behave as a static
>method:
>
>class Item:
>  def f(): print 'An Item'
>
>Item.a = 'a'
>Item.b = 'b'
>Item.c = 'c'
>
>class ItemGenerator:
>  import random
>  rgen = random.Random()
>  items = [j for j in vars(Item).values() if isinstance(j, Item)]
>  def __call__():
>    return ItemGenerator.rgen.choice(ItemGenerator.items)
>  __call__ = staticmethod(__call__)
>
>
>items = [ItemGenerator() for i in range(5)]
>for i in items:
>  i.f()
>
>Output:
>Traceback (most recent call last):
>  File "test.py", line 18, in ?
>    i.f()
>AttributeError: ItemGenerator instance has no attribute 'f'
>
>It doesn't seem to be making the __call__

We are presented with several mysteries here. 

For one, "isinstance(j, Item)" is going to fail since none of class Item's
attributes have values that are instances of class Item itself.  So
ItemGenerator.items is the empty list [].

Also, __call__ is normally added to a class like ItemGenerator to make its
*instances* callable -- the ItemGenerator class object already responds to
(), it being a class object -- so making __call__ a static method seems
unusual.  Nonetheless, it will be called if ItemGenerator() is changed to
ItemGenerator()() (note the extra paren.s).

Having called __call__ as a static method on an ItemGenerator instance
(which is probably not what was desired), however, "i.f()" will still
generate an error because of "def f():" not being "def f(self):".

Seems like there should be a more straightforward way. 

Jim





From cat_stack at erraticimpact.zzn.com  Tue Dec  4 19:30:48 2001
From: cat_stack at erraticimpact.zzn.com (cat3)
Date: 4 Dec 2001 16:30:48 -0800
Subject: Help! string from buffer to socket
Message-ID: <8b70ef6a.0112041630.53976082@posting.google.com>

I'm trying to write a class that allows arbitrary strings to be added
to the data to be sent on a socket.  A certain amount of data will be
collected from the buffer when the socket is ready for sending.  I
don't have lots of network or OOP experience, but am trying to get a
simple class together that can do this.  I'm stuck on my read and feed
methods.  Can someone give me a fresh pair of eyes and maybe a little
wisdom?  Thanks!

Here's what I have so far:

class DataFifo:
import socket

# constructor
	def __init__(self):
		# initialize properties
		arbSTRING = string(raw_input("Enter a string: " ))
		
	def feed(self, feed):
		self.feed = (arbSTRING)
#should I turn the string into a list and read four elements of the
list at a #time?  Use string.split(string, '.')?
	
	def read(self, read):
	        #read = list[0:3]  ????
		self.read = read 
	
	def send_fifo(self, send_fifo):
		s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
	    s.connect("www.teleias.com", 80)
		s.listen(1)
		conn, addr = s.accept()
		print 'Connected by', addr
	while 1:
		data = conn.recv(1024)
		if not data: break
		conn.send(arbSTRING)  #data to be sent
		conn.close()


From srowley at ids.net  Sat Dec 15 08:57:17 2001
From: srowley at ids.net (Stephen Rowley)
Date: 15 Dec 2001 05:57:17 -0800
Subject: MSVC 6.0 SWIG LINKING ERRORS
Message-ID: <924efc60.0112150557.6e5b3024@posting.google.com>

I'm not an experienced user of msvc or of swig. 
keep getting these linking errors when i try to build the simple
example in swig-1.3.9 .   i haven't made any changes to the files and
i've set my enviromental variables so i can't figure what's going on.


LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
example.exe : fatal error LNK1120: 1 unresolved externals


any help would be greatly appreciated been messin with this off and on
for a week now.

steve


From kalle at gnupung.net  Wed Dec 12 09:39:47 2001
From: kalle at gnupung.net (Kalle Svensson)
Date: Wed, 12 Dec 2001 15:39:47 +0100
Subject: mod_python vs mod_snake
In-Reply-To: 
References: 
Message-ID: <20011212153947.B10409@proton.lysator.liu.se>

[Xavier Defrang]
> Hi,
> 
> I've got a Python CGI performing XSLT transforms and I experience really
> poor performance because it has to import plenty of modules.
> 
> I was then thinking using an interpreter embedded within Apache 1.3. I
> want to rely at least on a minimal application framework so I don't feel
> like using pcgi.
> 
> Now the question is should I use mod_python or mod_snake?  Both have pros
> and cons... mod_python looks more mature, more documented and has a
> much simpler architecture than mod_snake.

Not an answer to your question, but...  You might want to take a look at Maki
(http://maki.sourceforge.net/).

"""
maki is an attempt to glue together a simple, flexible framework that allows
you to use XML, XSLT, Apache, and Python to serve web pages. It is a
mod_python handler for Apache that is intended to handle requests made to your
server for XML files.
"""

Peace,
  Kalle
-- 
Kalle Svensson (kalle at gnupung.net) - Laziness, impatience, hubris: Pick two!
English: http://www.gnupung.net/  Svenska: http://www.lysator.liu.se/~kalle/
Stuff: ["http://www.%s.org/" % x for x in "gnu debian python emacs".split()]



From greg at cosc.canterbury.ac.nz  Sun Dec  9 23:19:30 2001
From: greg at cosc.canterbury.ac.nz (Greg Ewing)
Date: Mon, 10 Dec 2001 17:19:30 +1300
Subject: pep proposal : A date object for the standard library
References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <3C0FBAA8.F1A44304@attbi.com> <3C100EFF.6EEA6C7A@cosc.canterbury.ac.nz> <9ur204$9fp$1@slb7.atl.mindspring.net>
Message-ID: <3C1437D2.99EB509B@cosc.canterbury.ac.nz>

Andrew Dalke wrote:
> 
> Some chemists work in attoseconds

Hmmm... according to ttp://physics.nist.gov/cuu/Units/prefixes.html,
the smallest officially defined SI prefix is currently yocto,
which is 10^-24. Any advance on that? :-)

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg


From tuttledon at mailandnews.com  Fri Dec  7 18:01:50 2001
From: tuttledon at mailandnews.com (Don Tuttle)
Date: Fri, 07 Dec 2001 23:01:50 GMT
Subject: Lists of attributes
References:  
Message-ID: 

"Bruce Eckel"
> Aha! Now, is it possible to install two different versions of
> Python on my Win98 machine at the same time? I ask because I need
> to run the ActiveState build for Python-COM stuff...


Take a look at http://www.pythonware.com/downloads/index.htm
They simple extract to a folder.  On registry involved.

Don




From daniel at dittmar.net  Thu Dec 20 14:46:23 2001
From: daniel at dittmar.net (Daniel Dittmar)
Date: Thu, 20 Dec 2001 20:46:23 +0100
Subject: os.system commands in CGI on IIS?
References: <46d8afc4.0112140916.838be25@posting.google.com>
Message-ID: <3C22400F.8000401@dittmar.net>

 > if I execute
 > os.system("copy c:\a.txt c:\b.txt")
 > It does not happen when the cgi page is called from a browser.
 > However if the script is run from the command line, it works fine.

In this specific case, you could use shutil.copy. In general, console 
applications (like cmd.exe) will not work inside a service or a GUI only 
program. You might try using the popen2 module, which possibly sets up 
stdin and stdout just right such that Windows doesn't need the console 
window. Setting the property 'may interact with desktop' for the IIS 
service might work as well, but you'll get annoying windows flashing 
across the screen.

Daniel



From phr-n2001d at nightsong.com  Mon Dec  3 16:10:35 2001
From: phr-n2001d at nightsong.com (Paul Rubin)
Date: 03 Dec 2001 13:10:35 -0800
Subject: CryptKit 0.9: cryptsock
References:  <7x667pw8ap.fsf@ruckus.brouhaha.com> <874rn9ysw9.fsf@saltationism.subnet.hedonism.cluefactory.org.uk> 
Message-ID: <7xg06s57sk.fsf@ruckus.brouhaha.com>

Bryan  writes:
> > If I was going to implement something now, I'd certainly use SRP.
> 
> Thanks for the input. What are your thoughts about EC-PAK? 
> http://citeseer.nj.nec.com/mackenzie01more.html

For something like cryptsock, these password schemes are all
vulnerable to an online dictionary attack even though they protect
against offline attacks.  The only way to stop an online attack is
with a lockout, that disables the account after N failed attempts or N
attempts in a 24 hour period or anything like that.  The lockout must
count ALL bad attempts, not just attempts from a specific IP address,
because crackers often use computer viruses to launch attacks from
large numbers of addresses spead out over long periods of time.  But
as soon as a lockout exists, it makes a denial of service attack.

Conclusion: it's best to use a high-entropy authentication key if you
don't really need a low-entropy one.  The only advantage of passwords is
that people can remember them for human-to-machine communication.  For
machine-to-machine communication (the key is stored in a configuration
file), it's not that inconvenient to use a large random key, so there's
no need to mess with fancy password protocols.



From aahz at panix.com  Mon Dec 31 12:54:53 2001
From: aahz at panix.com (Aahz Maruch)
Date: 31 Dec 2001 09:54:53 -0800
Subject: Cancel messages
References:   <3c3097c7$0$79590$e2e8da3@nntp.cts.com>
Message-ID: 

In article <3c3097c7$0$79590$e2e8da3 at nntp.cts.com>,
Howard Knight  wrote:
>Aahz Maruch (aahz at panix.com) wrote:
>>
>> I don't think that cancels affect python-list, but the admins should
>> probably set up a filter to ignore the REPOST: articles based on the
>> X-Reposted-By: header.
>
>Actually, a better filter would be the "resurrector" pseudo site in the
>Path line.  That way, if anyone else besides Guido resurrects posts, it
>will filter those out too.  Here's a sample of one of Guido's Path
>lines:
>
>   Path: ...!news.noc.cabal.int!resurrector!guidorepost!not-for-mail

Possibly; what I meant, though, was filtering on the *existence* of
X-Reposted-By:, not the value of the header.  That ought be more
efficent and just as accurate.
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

Tenth Virtual Anniversary: TODAY!


From danielk at aracnet.com  Thu Dec  6 09:03:11 2001
From: danielk at aracnet.com (Daniel Klein)
Date: Thu, 06 Dec 2001 06:03:11 -0800
Subject: getting the name of a variable
References: 
Message-ID: <4iuu0ukgrhokpphmg31t1lj6qks67irr23@4ax.com>

Assuming the variable is user-defined (not in __builtins__) and is not
local to the function/method...

>>> x = 42
>>> y = ['a','b','c']
>>> def varname(var):
	print str(var) + " : " + str(globals()[var])

>>> varname('x')
x : 42
>>> varname('y')
y : ['a', 'b', 'c']
>>> 

Daniel Klein


On 6 Dec 2001 04:47:37 -0800, sandskyfly at hotmail.com (Sandy Norton)
wrote:

>When I'm debugging I'm always sticking stuff like "print 'x:', x" in my code.
>So is there a handy function that will print a variable name and value such that: 
>
>>>> def print_var_name_and_value(var):
>            "prints variable name : value"
>            
>
>>>> variable = 'me var'
>>>> print_var_name_and_value(variable)
>variable : me var
>
>
>Any responses, pointers, hints would be much appreciated.
>
>thanx.
>
>Sandy




From mcherm at destiny.com  Thu Dec 13 12:16:22 2001
From: mcherm at destiny.com (Michael Chermside)
Date: Thu, 13 Dec 2001 12:16:22 -0500
Subject: More fun with PEP 276
Message-ID: <3C18E266.7080403@destiny.com>

Jim wrote:

> p.s. And Note that PEP 276 itself (merely) suggests
> adding an iterator to class int which could exist
> independently from any or none of the above.  (I know,
> we've been around that circle before, too. ).


Yeah. Is there a way to express my support for the limited and 
well-reasoned proposal that is in PEP 276 itself without commiting 
myself at all on the broad flurry of OTHER proposals folks have made here?

-- Michael Chermside






From pj at sgi.com  Wed Dec 19 17:39:11 2001
From: pj at sgi.com (Paul Jackson)
Date: 19 Dec 2001 22:39:11 GMT
Subject: index()-like behavior that returns all occurences...
References: <3C2110BE.8060300@my-deja.com>
Message-ID: <9vr4uf$1job0$1@fido.engr.sgi.com>

|> x = [ [1], [1,2], [], [1,2,3], [], [2], [12] ]
|> 
|> I want to find the index of all of the empty lists. In other words, I'd 
|> like a function foo that would behave like this:
|> 
|>  >> foo(x)
|> [2 4]

Well, you could do a one liner with the lambda, map, zip, filter routines:

    map (lambda x: x[0], filter (lambda x: not x[1], zip (range(len(x)), x)))

But this has _got_ to be less readable than the simple for loop,
even to whomever it was that championed getting map, reduce and
filter into the Python language in the first place.
-- 

                          I won't rest till it's the best ...
			  Manager, Linux Scalability
                          Paul Jackson  1.650.933.1373


From aahz at panix.com  Fri Dec 21 01:14:31 2001
From: aahz at panix.com (Aahz Maruch)
Date: 20 Dec 2001 22:14:31 -0800
Subject: implementing a timer?
References: <9vn0gv$ll6$1@colo.mobo-it.nl>
Message-ID: <9vuk07$sql$1@panix3.panix.com>

In article <9vn0gv$ll6$1 at colo.mobo-it.nl>, waalp  wrote:
>
>I'm trying to make a script that will check if i have mail every let's say
>10 minutes.So i tought let's use something like a timer. But i can't find
>any documentation on how to implement something like this.
>
>I'm a beginner so it could be that i haven't looked in the right places.
>Could somebody please help?

Now that everyone has given you Python-based answers, let me suggest
that you may be looking in the wrong direction.  For things like this, it
frequently works better to use the scheduling capabilities of your OS.
For Unix boxen, that means cron.  Don't remember what it is for Windoze.

The main problem with solutions based on time.sleep() is that if you
want to cleanly kill the application, you have to wait for the sleep
interval to expire.  That can be rather messy.
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

Tenth Virtual Anniversary: 11 days and counting


From aahz at panix.com  Thu Dec 20 22:50:25 2001
From: aahz at panix.com (Aahz Maruch)
Date: 20 Dec 2001 19:50:25 -0800
Subject: tkinter with multithreads
References: 
Message-ID: <9vubi1$7fq$1@panix3.panix.com>

In article ,
Ricardo Quesada   wrote:
>
>    I'm running python 2.0.1 with windows 2000,
>    and i'm using multiple interpreters to run different python modules 
>(like in mod-python),
>    and everything works ok, except when I try to excecute two Tk 
>modules simultaneously.

Generally speaking, you can only have one Tk handle per process.
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

Tenth Virtual Anniversary: 11 days and counting


From h.jehadalwan at student.kun.nl  Sat Dec 22 11:24:14 2001
From: h.jehadalwan at student.kun.nl (husam)
Date: Sat, 22 Dec 2001 17:24:14 +0100
Subject: Search the difference: Why this function defenition does'nt work?
References: <3C24A967.3070604@student.kun.nl> 
Message-ID: <3C24B3AE.8060103@student.kun.nl>

Aahz Maruch wrote:

> In article <3C24A967.3070604 at student.kun.nl>,
> husam   wrote:
> 
>>hi, I'm a beginner to python and try to understand some basic stuff. 
>>Hier are two function defenitions , which look the same for me, but the 
>>second one does not work. Can anybody explain why?
>>
>>def fun1 (*args):
>>	sum=args[0]
>>	for next in args[1:]
>>		sum=sum+next
>>	return sum
>>print fun1('a','b','c')
>>
>>>>>abc
>>>>>
>>
>>def fun2 (*args):
>>	sum=args[:0]
>>	for next in args[1:]
>>		sum=sum+next
>>	return sum
>>
>>print fun2('a','b','c')
>>
>>
>>>>>TypeError: illegal argument type for built-in operation
>>>>>
> 
>>>>l=['a','b','c']
>>>>l[0]
>>>>
> 'a'
> 
>>>>l[:0]
>>>>
> []
> 
> That should be enough to figure out your problem.  Next time, try using
> the interactive interpreter to test your code.
> 


Why is it bad to say:
sum=[]



From uche.ogbuji at fourthought.com  Tue Dec 18 14:27:29 2001
From: uche.ogbuji at fourthought.com (Uche Ogbuji)
Date: Tue, 18 Dec 2001 12:27:29 -0700
Subject: [XML-SIG] Pyana 0.2.0 released 
In-Reply-To: Message from "Brian Quinlan"  
   of "Mon, 17 Dec 2001 18:41:10 PST." <003501c1876d$746c1570$445d4540@Dell2> 
Message-ID: <200112181927.fBIJRTZ02513@localhost.localdomain>

> This is a multi-part message in MIME format.
> 
> ------=_NextPart_000_0036_01C1872A.6648D570
> Content-Type: text/plain;
> 	charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
> 
> Uche Ogbuji wrote:
> 
> > > PIRXX is focused on providing Xerces XML services to Python. The
> current
> > > release of PIRXX provides SAX2 interfaces but I believe that =
> J=FCrgen
> is
> > > working on DOM support.
> > >
> > > So, right now, Pyana is probably your best bet for high-performance
> XSLT
> > > processing in Python while PIRXX offers Xerces SAX2 interfaces.
> >=20
> > Are you basing this on actual benchmarks?  In particular, I'd be
> surprised
> > if Pyana was faster overall than current CVS of 4XSLT, Since Xalan
> isn't,
> > as I measure it.
> 
> I am basing this on the timings of largish transformations that I was
> doing around 2 months ago. Since then I haven't really compared them and
> I have never run any formal benchmarks.=20
> 
> Note that one of the big problems with timing Xalan from the command
> line is that it is very slow to load, especially on windows. I just
> timed "import Pyana" on my PIV 1.7GHz and it took 0.74s. But the beauty
> of using Pyana instead of something like "popen('xalan ..." is that the
> load time becomes a one-time cost for the application.
> 
> For fun, I just downloaded:
> http://www.datapower.com/XSLTMark/download/XSLTMark_2_1_0.zip
> 
> And wrote the attached script. I did this without expending any effort
> trying to understand the benchmark suite; I just test each .xml/.xsl
> pair. Notice that all of the source/stylesheet documents are small so
> the advantage should go to 4suite.
> 
> I don't want to get 4suite from CVS so why don't you get Pyana:

No.  I'm no more interested in running a benchmark between the two than you 
are.  I have much better things to do, like actually working to improve 
4suite.  Therefore, I know better than to make such unsubstantiated comments 
as "foo is your best bet for high-performance XSLT processing".

I'm sure we can all just get along: multiple XSLT implementations for Python 
is a Good Thing.


-- 
Uche Ogbuji                               Principal Consultant
uche.ogbuji at fourthought.com               +1 303 583 9900 x 101
Fourthought, Inc.                         http://Fourthought.com 
4735 East Walnut St, Boulder, CO 80301-2537, USA
XML strategy, XML tools (http://4Suite.org), knowledge management





From mwh at python.net  Sun Dec 30 16:47:25 2001
From: mwh at python.net (Michael Hudson)
Date: Sun, 30 Dec 2001 21:47:25 GMT
Subject: Origin of ly y'rs signature style
References: 
Message-ID: 

"Emile van Sebille"  writes:

> I know I've read a good article or post on the origin and adoption
> of the "xx-xx-xx ly y'rs" signoffs brought to the python group by
> Tim Peters.  After some searching this morning I couldn't relocate
> that article/post.  Does anyone have a link to it?

There's something about it in AMK's python quotes collection:

    http://www.amk.ca/quotations/python-quotes/index.html

and there may be something in the Tim Peters shrine:

    http://www.python.org/tim_one/

Cheers,
M.


From jdgorman at ieee.org  Thu Dec  6 00:08:25 2001
From: jdgorman at ieee.org (John Gorman)
Date: Thu, 06 Dec 2001 05:08:25 GMT
Subject: license key validation - encryption/decryption
References:  <20011205113138.709c0fc5.use-net@schabi.de>
Message-ID: <3C0EFD74.5000403@ieee.org>

... Then pick up a copy of "Secrets and Lies" by Schneier, published in 
2000 by Wiley and find out what his current perspective is.  The preface 
starts out, "I have written this book partly to correct a mistake." 
Schneier then goes on to describe a plethora of problems that arise in 
electronic security.  Key management is definitely a problem.
-JG

Markus Schaber wrote:

> Hi,
> 
> On Mon, 3 Dec 2001 21:25:16 -0800 (PST)
> Rock VZ  wrote:
> 
> 
>>How do i generate this "encrypted license key" for
>>different features for different customers?
>>
>>How do i validate it at the customer site that the
>>"key" installed is valid?
>>
> 
> Independently of the language and the file format, you should read a good book about cryptography. 
> 
> "Bruce Schneier: Applied Cryptography" is known to be one of the best books about this subject.
> 
> markus
> 



From spon at cisco.com  Wed Dec 19 18:22:35 2001
From: spon at cisco.com (Tom McDermott)
Date: Thu, 20 Dec 2001 10:22:35 +1100
Subject: re.compile bug?
References: <16d79c8d.0112140658.6bd40400@posting.google.com>
Message-ID: <3C21213B.2DB2A896@cisco.com>

John Dell'Aquila wrote:
> 
> Compilation fails with VERBOSE flag but works otherwise.
> 
> bash-2.05$ python
> ActivePython 2.1.1, build 212 (ActiveState)
> Python 2.1.1 (#20, Jul 26 2001, 11:38:51) [MSC 32 bit (Intel)] on win32
> Type "copyright", "credits" or "license" for more information.
> >>> import re
> >>> comment = "([^#]*)(#.*)?$"
> >>> re.compile(comment)
> 
> >>> re.compile(comment, re.VERBOSE)
> Traceback (most recent call last):
>   File "", line 1, in ?
>   File "d:\PYTHON21\lib\sre.py", line 90, in compile
>     return _compile(pattern, flags)
>   File "d:\PYTHON21\lib\sre.py", line 136, in _compile
>     raise error, v # invalid expression
> sre_constants.error: unbalanced parenthesis
> >>>
> --
> John Dell'Aquila

John,
	From http://python.org/doc/current/lib/Contents_of_Module_re.html:

X 
VERBOSE
     This flag allows you to write regular expressions that look nicer.
     Whitespace within the pattern is ignored, except when in a
character
     class or preceded by an unescaped backslash, and, when a line
contains
     a "#" neither in a character class or preceded by an unescaped
     backslash, all characters from the leftmost such "#" through the
end
     of the line are ignored. 

So - the re is recognizing the second hash as a comment delimiter,
and the second set of parens is now unbalanced.

Solution: protect the hash with a backslash:

comment = "([^#]*)(\#.*)?$"


Cheers,
	Tom


From use-net at schabi.de  Wed Dec  5 05:31:38 2001
From: use-net at schabi.de (Markus Schaber)
Date: Wed, 5 Dec 2001 11:31:38 +0100
Subject: license key validation - encryption/decryption
References: 
Message-ID: <20011205113138.709c0fc5.use-net@schabi.de>

Hi,

On Mon, 3 Dec 2001 21:25:16 -0800 (PST)
Rock VZ  wrote:

> How do i generate this "encrypted license key" for
> different features for different customers?
> 
> How do i validate it at the customer site that the
> "key" installed is valid?

Independently of the language and the file format, you should read a good book about cryptography. 

"Bruce Schneier: Applied Cryptography" is known to be one of the best books about this subject.

markus
-- 
"GPL software is not free - the cost is cooperation"


From aleax at aleax.it  Fri Dec 28 07:03:03 2001
From: aleax at aleax.it (Alex Martelli)
Date: Fri, 28 Dec 2001 13:03:03 +0100
Subject: module path
References: 
Message-ID: 

"Garett Shulman"  wrote in message
news:n1an2u4rvau9f86r5dcl895lokb05354pr at 4ax.com...
> I would like to store my modules and scripts in a folder other than
> the python folder. Does anyone have any suggestions as to what I need
> to do in order to be able to import the scipts in the interpreter? Is
> there a path that the interpreter searches which I could modify?

Yes, and that path is a list, named 'path', in standard module 'sys'.

You can do, for example:
    import sys
    sys.path[0:0] = '/my/directory'
and on successive imports, "/my/directory" will be tried before other
directories on sys.path.

There are also more permanent ways to alter sys.path.  The handiest
one is to put a textfile, any name, extension .pth, in the Python
directory (the site-packages one, under Linux; just C:\Python22,
under Windows).  yourfile.pth can list any number of directories,
one per line; they will all be added to sys.path during startup
(by module site.py).  This makes your directories be appended AFTER
others in the path, though.  You can also define environment variable
PYTHONPATH, or, on Windows, hack the registry.


Alex





From jdhunter at nitace.bsd.uchicago.edu  Sat Dec 29 22:10:36 2001
From: jdhunter at nitace.bsd.uchicago.edu (John Hunter)
Date: Sat, 29 Dec 2001 21:10:36 -0600
Subject: REPOST: Re: Is learning Python "extraordinary"?
References: 
Message-ID: <4$--$$_----___-_$$@news.noc.cabal.int>

>>>>> "Jesse" == Jesse W  writes:

    Jesse> Going back to the salt mines of college essay writing,

Write some python code that writes extraordinary college essays.  Now
that would be extraordinary.  Search
http://groups.google.com/advanced_group_search for 'write-thesis'
limiting the newsgroup to gnu.emacs.help.  Read the posts for
inspiration.

Take care to be clear in your essay since none of your application
readers will have heard of python, likely.

Good luck!
John Hunter

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: John Hunter 
Newsgroups: comp.lang.python
Subject: cmsg cancel 
Control: cancel 
Date: Mon, 31 Dec 2001 01:20:01 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774412 27193 211.57.49.2 (31 Dec 2001 04:53:32 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:53:32 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From peterb at cortland.com  Tue Dec  4 03:40:53 2001
From: peterb at cortland.com (Peter Bismuti)
Date: Tue, 4 Dec 2001 00:40:53 -0800
Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces)
References:          <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com>  <3C0BD39F.D43D4FF7@mega-nerd.com> 
Message-ID: <3c0be454$1@207.229.64.20>

So much for cooler heads prevailing....(deep sigh).


> > YOu people are ***NUTS***.
>
>     Yes, we're nuts because we've had to deal with people like you.
>
> > How hard is it to find an editor that treats tabs correctly and allows
> > the tab width to be set to something other than 8?
>
>     Quite easy, which is the problem.  Or are you ignoring my rather basic
but
> not uncommon example of code which gets messed up when people are able to
> modify indention levels.  For me it is *NOT* a matter of preference and
never
> was.  I can read indention levels of 2, 4, 6 and 8 (though I rarely
encounter
> 6) in Turbo Pascal, C, Perl, Python and HTML.  In fact in most I *prefer*
two.
> But when formatting matters for clarity of code I am damned glad I can see
> what the original author intended and not what I preferred!
>
> > Get a grip people.
>
>     We have a grip, tighten yours.
>
> --
>          Steve C. Lamb         | I'm your priest, I'm your shrink, I'm
your
>          ICQ: 5107343          | main connection to the switchboard of
souls.
>     To email: Don't despair!   |  -- Lenny Nero, Strange Days
> -------------------------------+------------------------------------------
---
> --
> http://mail.python.org/mailman/listinfo/python-list
>




From setar at gmx.de  Fri Dec 28 11:47:05 2001
From: setar at gmx.de (Oliver Hofmann)
Date: 28 Dec 2001 08:47:05 -0800
Subject: REPOST: [Q] Deepcopy with Python 2.2 ?
Message-ID: <2$--$$_----_-%-$%$@news.noc.cabal.int>

'lo everyone!

I've had a few problems with copying objects lately when they 
reference each other. My understanding is that deepcopy should 
take care of that due to the memo - dictionary; this does not 
seem to be the case. 

The following code works fine if Base does _not_ inherit 
from object. If it does the result is:

RuntimeError: maximum recursion depth exceeded

Any help would be appreciated!

Thanks,

     Oliver


---8<-----
import copy

class Base(object):
    def __init__(self):
        self.parent = None
        object.__init__(self)

class Hit(Base):
    def __init__(self):
        self.hsps = []
        Base.__init__(self)
    
class HSP(Base):
    def __init__(self):
        self.data = [1, 2, 3]
        Base.__init__(self)

def main():
    a = Hit()
    b = HSP()
    c = HSP()
    d = HSP()
    a.hsps.extend([b, c, d])
    b.parent = a
    c.parent = a
    d.parent = a

    z = copy.deepcopy(a)

if __name__ == '__main__':
    main()

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: setar at gmx.de (Oliver Hofmann)
Newsgroups: comp.lang.python
Subject: cmsg cancel <440c5c6a.0112280847.55c92de7 at posting.google.com>
Control: cancel <440c5c6a.0112280847.55c92de7 at posting.google.com>
Date: Mon, 31 Dec 2001 03:17:44 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: 
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775234 27193 211.57.49.2 (31 Dec 2001 05:07:14 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:07:14 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.


From postmaster at sict.stc.sh.cn  Mon Dec 17 02:51:51 2001
From: postmaster at sict.stc.sh.cn (postmaster at sict.stc.sh.cn)
Date: Mon, 17 Dec 2001 15:51:51 +0800
Subject: Delivery Status Notification (Failure)
Message-ID: 

This is an automatically generated Delivery Status Notification.

Delivery to the following recipients failed.

       hobby at ncn.net
       jpfaine at ncn.net
       joyce at ncn.net



-------------- next part --------------
An embedded message was scrubbed...
From: python-list at cwi.nl
Subject: CD-ROM.  This will include a variety of recipients
Date: Mon, 17 Dec 2001 00:15:49 -0800
Size: 4865
URL: 

From mdlch at altavista.net  Fri Dec 21 19:17:49 2001
From: mdlch at altavista.net (marco)
Date: 21 Dec 2001 19:17:49 -0500
Subject: vi or emacs for editing Python on Linux?
References: 
Message-ID: 

"maxm"  writes:

> One of my biggest problems in switching is my editor. On windows I use
> Ultraedit as a general editor, and i type really fast in it. Knowing the
> shortcuts and all. Every time I boot up one of my Linux machines I have a
> hard time editing files under the arcane unix editors. I have tried both
> emacs and vim and I disklike both!

Maybe Nedit is good for Windows people: www.nedit.org
(but I use emacs myself -- those "arcane" editors are
tried and true).

--
mdlch at altavista.net
Gunnm: Broken Angel
http://reimeika.ca/


From jeff at ccvcorp.com  Thu Dec 27 13:16:00 2001
From: jeff at ccvcorp.com (Jeff Shannon)
Date: Thu, 27 Dec 2001 10:16:00 -0800
Subject: Range of characters?
References:  <3C2A074D.8214E5E0@earthlink.net> 
Message-ID: <3C2B655F.92E3896E@ccvcorp.com>


Chris Dutton wrote:

> in article 3C2A074D.8214E5E0 at earthlink.net, Mari Mcdade at
> wurmy at earthlink.net wrote on 12/26/01 12:27 PM:
>
> > You don't need the string module, really, but using the literal
> > string "ABCDEFGHIJKLMNOPQRSTUVWXYZ" seemed a bit ugly. ;-)
>
> Well, this is even less ugly then.
>
> from string import uppercase as u
> for c in u:
>     print "%sython" % c

I disagree that this is less ugly--it needlessly obfuscates the code,
since at the for-loop, it's totally opaque as to what it is that
you're iterating over.  I *much* prefer having it read the very
explicit 'string.uppercase' to having it only cryptically refer to
'u'.

Jeff Shannon
Technician/Programmer
Credit International





From b_mcerlean at yahoo.com  Tue Dec  4 09:54:06 2001
From: b_mcerlean at yahoo.com (Brian McErlean)
Date: 4 Dec 2001 06:54:06 -0800
Subject: Where's the error?
References: <9uibrc$199$1@newstoo.ericsson.se>
Message-ID: 

"Bror Johansson"  wrote in message news:<9uibrc$199$1 at newstoo.ericsson.se>...
> I have tried, retried, and retried again to understand why Python 2.1 tells
> me this:
> 
> Traceback (most recent call last):
>   File "D:\Src\Python\renamevobtag.py", line 12, in getlsvobresults
>     regline =
> re.compile('^(\*)?\s+\\([^\s]+)\s+\\\\([^\s]+)\s+(p(rivate)|(ublic))\s*$')
>   File "d:\python21\lib\sre.py", line 90, in compile
>     return _compile(pattern, flags)
>   File "d:\python21\lib\sre.py", line 136, in _compile
>     raise error, v # invalid expression
> error: unbalanced parenthesis
> 
> when approaching this line:
> 
>     regline =
> re.compile('^(\*)?\s+\\([^\s]+)\s+\\\\([^\s]+)\s+(p(rivate)|(ublic))\s*$')
> 
> Can anyone help me clear my eyesight?
> 
> I can of course switch over to 'split', but I want to get rid of the extra
> backslashes.
> 
> /BJ

When using regexps, remember that python interprets "\" characters for
the strings, so by the time it reaches re.compile, the string reads:


'^(*)?s+\([^s]+)s+\\([^s]+)s+(p(rivate)|(ublic))s*$'

The first \\ has become a single \ before the "(", which is treated as
a literal "(" for the regex, rather than a group, hence the unbalanced
parameters.

The easiest way to fix it is to use rawstrings.  Prepend an "r" before
the string to bypass python's string escaping.

ie.
  re.compile(r'^(\*)?\s+\\([^\s]+)\s+\\\\([^\s]+)\s+(p(rivate)|(ublic))\s*$')

this should match lines like:    r"* \abc123! \\xyz  private
...anything..."

Hope this helps.

Brian McErlean


From bosahv at netscapenospam.net  Tue Dec 25 06:40:41 2001
From: bosahv at netscapenospam.net (Bo Vandenberg)
Date: Tue, 25 Dec 2001 11:40:41 GMT
Subject: SQLBase - Support?
References: 
Message-ID: 

Are you by any chance doing something with Visual Manufacturing?


"Nicolas Keller"  wrote in message
news:a057d8$hie$06$1 at news.t-online.com...
> Hi!
>
> I'm looking for a possibility to connect to a Gupta SQLBase Server with
> Python. As the application will run under Linux (and Zope for the
frontend)
> I guess that it's not possible to use ODBC?
>
> Any hints?
>
> Thanks and merry xmas :)
>
> Nicolas Keller
>
>




From alexis.layton at post.harvard.edu  Sat Dec 15 15:24:08 2001
From: alexis.layton at post.harvard.edu (Alexis Layton)
Date: Sat, 15 Dec 2001 20:24:08 GMT
Subject: PEP 276 and future iteration PEPs
References: 
Message-ID: <3C1BB211.4040007@post.harvard.edu>

I also am in favor of the simple proposal submitted in PEP 276.

For future iteration PEPs, I think I would be more comfortable with 
explicit specification
of the index variable(s), as in

for i in 0 <= i < 5

as opposed to infering the loop variable as in

for 0 <= i < 5

But I would rather we had a broader class of integer generator syntax such
as the much malinged [0 ... 5], especially if it can properly describe 
non-terminating
generators. (or is that iterators? It's not really an iterator until you 
put it in a loop...).

Alexis Layton
alexis.layton at post.harvard.edu



From chrishbarker at attbi.com  Tue Dec  4 12:42:41 2001
From: chrishbarker at attbi.com (Chris Barker)
Date: Tue, 04 Dec 2001 09:42:41 -0800
Subject: Newbie: searching an English dictionary for a reg exp
References: <3c09f02f.97177874@news.akl.ihug.co.nz>  <3c0b1bbe.173865154@news.akl.ihug.co.nz> 
Message-ID: <3C0D0B11.1060A4F9@attbi.com>

Check out:

http://py-howto.sourceforge.net/regex/regex.html

I've found it very usefull.

-Chris

-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at home.net                 ---           ---           ---
http://members.home.net/barkerlohmann ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------


From kirill at xyz.donetsk.ua  Fri Dec 21 05:13:55 2001
From: kirill at xyz.donetsk.ua (Kirill Simonov)
Date: Fri, 21 Dec 2001 12:13:55 +0200
Subject: It's Tk's fault
In-Reply-To: <9vungu$hqp9s$1@ID-12869.news.dfncis.de>; from store_li@sina.com on Fri, Dec 21, 2001 at 03:12:40PM +0800
References: <9vp5bv$gvfps$1@ID-12869.news.dfncis.de>  <9vrji0$hbcov$1@ID-12869.news.dfncis.de>  <9vungu$hqp9s$1@ID-12869.news.dfncis.de>
Message-ID: <20011221121355.A1231@xyz.donetsk.ua>

On Fri, Dec 21, 2001 at 03:12:40PM +0800, Kick wrote:
> "Kirill Simonov"  wrote in message
> >
> > Try to convert data to unicode before using it:
> >
> >     data = unicode(data, 'gb2312')
> >
> > Maybe, you need to download additional codecs from
> > "http://sourceforge.net/projects/python-codecs/".
>
> I have tried but it doesn't work. Python don't know the name of that encode
> method.

You need to download additional codecs from SourceForge.


Kirill




From chrishbarker at attbi.com  Wed Dec 19 14:25:49 2001
From: chrishbarker at attbi.com (Chris Barker)
Date: Wed, 19 Dec 2001 11:25:49 -0800
Subject: /usr/bin/env: python: No such file or directory
References:  
Message-ID: <3C20E9BD.CDED5B5A@attbi.com>

"Carl D. Roth" wrote:

> If you want to run python 2 instead of python 1.5 on that system,
> change the 'env' line to refer to 'python2' or 'python2.2'.

This an discussion that came and went as part of one of the discusions
about an incompatable change to Python.

Frankly, while you can certainly start chaning the #! line to point to
the version you need on *nix, that won't help with other OSs. Some folks
suggested a *.py2 extension for Windows, which might work.

Personally, I'd love to see a native Python solution this problem: some
sort of version keyword that would specify what version was required,
and ideally, whatever was in the $PATH called "python" would look for
that keyword, and dispatch the script off to whatever was required. This
would be an all OS solution. On a given system, it would probably be
best if it was not required that al versions actually be installed, but
an error mesage that siad something about a version mismatch would be a
whole lot more useful that just having the scrip tfail in some wierd
way.

It's too late for any solution of this nature to resolve 1.5.* vs 2.*
problems, but at least we could solve this for the future. I'm sure
others on this list could come up with better ideas thatn mine, but I'm
convinced that there really needs to be a Python solution to this
problem, rather than tossing it of to the admistrators of every system
out there!

-Chris



-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at attbi.net                ---           ---           ---
                                     ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------


From sholden at holdenweb.com  Tue Dec 11 08:17:37 2001
From: sholden at holdenweb.com (Steve Holden)
Date: Tue, 11 Dec 2001 08:17:37 -0500
Subject: run Tkinter app with no console window?
References: <9v3bhv$m4e$1@news.harvard.net>
Message-ID: 

"Carty Castaldi"  wrote in message
news:9v3bhv$m4e$1 at news.harvard.net...
> Hi.  I am just learning python and like it quite a bit.  I have written
some
> small/useful apps with Tkinter UIs and would like to be able to run them
on
> Windows with no console window or the console window completely hidden.
Any
> help appreciated.
>
Call them "*.pyw" if you are starting them by double-clicking, or just run
them with pythonw instead of python, and they will run with no console.

regards
 Steve
--
http://www.holdenweb.com/







From max at alcyone.com  Fri Dec 14 01:15:42 2001
From: max at alcyone.com (Erik Max Francis)
Date: Thu, 13 Dec 2001 22:15:42 -0800
Subject: Wrap C function which takes variable lengthed parameters?
References:  <6p5j1u0oag2ofkam8o7fig5dvkfc2392hk@4ax.com>
Message-ID: <3C19990E.BE0F3FA@alcyone.com>

Courageous wrote:

> Ouch! There's a way to do this, if I recall. Something to do
> with generating the varargs and prepping it correctly. Whether
> or not you can do this _portably_ is not something that I recall.

Yes.  Varargs can be used to make a va_list and pass that into another
function.  Use of varargs and va_list are ANSI compliant.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Laws are silent in time of war.
\__/ Cicero
    Esperanto reference / http://www.alcyone.com/max/lang/esperanto/
 An Esperanto reference for English speakers.


From Tom_Good1 at excite.com  Tue Dec  4 19:53:14 2001
From: Tom_Good1 at excite.com (Tom Good)
Date: 4 Dec 2001 16:53:14 -0800
Subject: minidom
References: <9uhr26$nfs$1@newsg1.svr.pol.co.uk> <3C0C7DD5.AC50A8CB@engcorp.com>  <3C0CE9DA.128BBF4A@engcorp.com>
Message-ID: 

Peter Hansen  wrote in message news:<3C0CE9DA.128BBF4A at engcorp.com>...
> Martin von Loewis wrote:
> > 
> > Peter Hansen  writes:
> > 
> > > For one, you should probably start your XML document with
> > >  or it won't be valid XML (but that's
> > > not necessary for this case.)
> > 
> > That is not true. Presence of the XML declaration is not a validity
> > constraint in XML.
> 
> Is it not required in any way at all?  I always thought 
> it was.
> 
> > > >>> from xml.dom import minidom
> > > >>> doc = minidom.parseString(open('test.xml').read())
> > > >>> doc.getElementsByTagName('DESCRIPTION')[0].childNodes[0].nodeValue
> > > u'EngineStart Leak'
> > 
> > Actually, obtaining the text by looking at the first child is
> > unreliable: The first child may be a comment, and the text may be
> 
> Yes, this was not intended to be good style, or generally useful,
> but merely an inspiration to the OP to use the interactive
> console as a start in learning more about the API.  I could 
> have made that clearer.

Maybe something like this could be used to be more general...

e = doc.getElementsByTagName('DESCRIPTION')[0]
alltext = [a.nodeValue for a in e.childNodes if a.nodeType == a.TEXT_NODE]
string.join(alltext)


From brian at sweetapp.com  Mon Dec 17 21:41:10 2001
From: brian at sweetapp.com (Brian Quinlan)
Date: Mon, 17 Dec 2001 18:41:10 -0800
Subject: [XML-SIG] Pyana 0.2.0 released 
In-Reply-To: <200112180053.fBI0raf31725@localhost.localdomain>
Message-ID: <003501c1876d$746c1570$445d4540@Dell2>

Uche Ogbuji wrote:

> > PIRXX is focused on providing Xerces XML services to Python. The
current
> > release of PIRXX provides SAX2 interfaces but I believe that J?rgen
is
> > working on DOM support.
> >
> > So, right now, Pyana is probably your best bet for high-performance
XSLT
> > processing in Python while PIRXX offers Xerces SAX2 interfaces.
> 
> Are you basing this on actual benchmarks?  In particular, I'd be
surprised
> if Pyana was faster overall than current CVS of 4XSLT, Since Xalan
isn't,
> as I measure it.

I am basing this on the timings of largish transformations that I was
doing around 2 months ago. Since then I haven't really compared them and
I have never run any formal benchmarks. 

Note that one of the big problems with timing Xalan from the command
line is that it is very slow to load, especially on windows. I just
timed "import Pyana" on my PIV 1.7GHz and it took 0.74s. But the beauty
of using Pyana instead of something like "popen('xalan ..." is that the
load time becomes a one-time cost for the application.

For fun, I just downloaded:
http://www.datapower.com/XSLTMark/download/XSLTMark_2_1_0.zip

And wrote the attached script. I did this without expending any effort
trying to understand the benchmark suite; I just test each .xml/.xsl
pair. Notice that all of the source/stylesheet documents are small so
the advantage should go to 4suite.

I don't want to get 4suite from CVS so why don't you get Pyana:
http://prdownloads.sourceforge.net/pyana/Pyana-0.2.0.win32-py2.1.exe
(very easy Windows installer for Python 2.1 [you can probably figure out
how to transform that URL for Python 2.0 ;-)])

Then you can run this script against Pyana and (with a few tweeks)
against 4suite. Here are Pyana's results on my machine:

C:\Dev\Me\Pyana\pyana\Test>python benchmark.py
time to import Pyana: 0.0785s # Cached by Windows?
time to execute axis: 0.0080s (675 bytes of output)
time to execute bottles: 0.0145s (12075 bytes of output)
time to execute brutal: 0.0156s (4191 bytes of output)
time to execute chart: 0.0110s (3837 bytes of output)
time to execute current: 0.0060s (320 bytes of output)
time to execute game: 0.0080s (457 bytes of output)
time to execute html: 0.0066s (504 bytes of output)
time to execute identity: 0.0043s (218 bytes of output)
time to execute inventory: 0.0088s (2070 bytes of output)
time to execute metric: 0.0132s (640 bytes of output)
time to execute number: 0.0074s (788 bytes of output)
time to execute oddtemplate: 0.0071s (173 bytes of output)
time to execute priority: 0.0083s (587 bytes of output)
time to execute products: 0.0085s (439 bytes of output)
time to execute queens: 0.0900s (1772 bytes of output)
time to execute tower: 0.1555s (70729 bytes of output)
time to execute trend: 0.0513s (8382 bytes of output)
time to execute union: 0.0058s (128 bytes of output)
time to execute xpath: 0.0062s (225 bytes of output)
time to execute xslbench1: 0.0204s (7011 bytes of output)

Cheers,
Brian
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: benchmark.py
URL: 

From idoerg at cc.huji.ac.il  Tue Dec  4 02:24:33 2001
From: idoerg at cc.huji.ac.il (Iddo Friedberg)
Date: Tue, 4 Dec 2001 09:24:33 +0200
Subject: upload file via form
Message-ID: 

Hi,

This seems like a FAQ, but looking at the newsgroups, manuals etc. I could
not find a reference to this.

I am trying to load a file to the server via a form. Here's the form:



 Try This


Upload a file!

And here's the CGI script which is supposed to read and display the contents: #!/usr/local/bin/python import cgi form = cgi.FieldStorage() if form['userfile'].file: contents = form['userfile'].file.value else: contents = "Nothing here!" print "Content-type: text/html" print print "
"
print contents
print "
" I always get a "Nothing here!" What am I doing wrong? I'm using an Apache1.3, on Linux RH7.1. Yours, Iddo -- Iddo Friedberg | Tel: +972-2-6758647 Dept. of Molecular Genetics and Biotechnology | Fax: +972-2-6784010 The Hebrew University - Hadassah Medical School | email: idoerg at cc.huji.ac.il POB 12272, Jerusalem 91120 | Israel | http://bioinfo.md.huji.ac.il/marg/people-home/iddo/ From jafo at tummy.com Thu Dec 20 23:35:41 2001 From: jafo at tummy.com (Sean Reifschneider) Date: Thu, 20 Dec 2001 21:35:41 -0700 Subject: ciphon 0.3.4 In-Reply-To: ; from ssthapa@classes.cs.uchicago.edu on Thu, Dec 20, 2001 at 05:14:55PM +0000 References: <9vsq4f$hk6cn$1@ID-59885.news.dfncis.de> Message-ID: <20011220213541.B5080@tummy.com> On Thu, Dec 20, 2001 at 05:14:55PM +0000, Suchandra Thapa wrote: >Thomas Heller wrote: >>How do I upload a package? Can ciphon do this? > Currently, ciphon doesn't allow this. I have a distutils patch which, at the time I submitted it, would allow the user to add a "--submit" to one of the options for building distutils packages so that the resulting file would be uploaded. I've been asked to re-submit it so that it can hopefully make it into the post-2.2 distutils, but then I've also been asked to change the way it works as well. ;-/ > Yes, ciphon should probably try to use the standard library as much as >possible. I will investigate this but my main focus right now is to get Hopefully, Thomas was offering to submit some patches? ;-) Sean -- Any technology distinguishable from magic is insufficiently advanced. -- Gregory Benford Sean Reifschneider, Inimitably Superfluous tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python From skip at pobox.com Sun Dec 23 10:04:01 2001 From: skip at pobox.com (Skip Montanaro) Date: Sun, 23 Dec 2001 09:04:01 -0600 Subject: Take 3 - multiple arguments to str() In-Reply-To: <20011223072114.A89844@hishome.net> References: <20011223072114.A89844@hishome.net> Message-ID: <15397.62049.513947.454175@12-248-41-177.client.attbi.com> Oren> The multiple argument version of str may be used to defeat the Oren> print statement's automatic spacing and for general formatting of Oren> strings with embedded expressions. Oren> print str("X=",x," Y=",calc_y(x)) Why bother? Print is a convenience. If you need precise control you can either use %-formatted strings or the file object's write method. Seems unnecessary to me. -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From LLoeffler at home.com Sun Dec 2 22:20:20 2001 From: LLoeffler at home.com (Luke) Date: Sun, 02 Dec 2001 21:20:20 -0600 Subject: Very new to this References: <#k0oOh4eBHA.1192@cpimsnntpa03> <#EQGkj4eBHA.1188@cpimsnntpa03> <3C0AB92D.2010407@home.com> <#3jVur4eBHA.1404@cpimsnntpa03> Message-ID: <3C0AEF74.3080005@home.com> If you aren't struggling, you aren't learning. From gh_pythonlist at gmx.de Mon Dec 10 13:00:28 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Mon, 10 Dec 2001 19:00:28 +0100 Subject: Recursing into directories In-Reply-To: <2b6R7.169854$SF4.5531343@news1.rdc1.sdca.home.com> References: <2b6R7.169854$SF4.5531343@news1.rdc1.sdca.home.com> Message-ID: <20011210180027.GB973@lilith.hqd-internal> Le 10/12/01 ? 17:22, Ron ?crivit: > Hi, > > Is there a built-in class (in dircache, os.path????) that > recurses thru a directory tree? > > I've written one using dircache.listdir, but if there is some- > thing pre-written, I'd rather use that... Only a function: os.path.walk And because I usually want a class, too, I didn't find it especially useful. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From chris.gonnerman at newcenturycomputers.net Thu Dec 27 08:31:58 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Thu, 27 Dec 2001 07:31:58 -0600 Subject: The Python community needs a lighter heart to it. References: <40dbad98.0112261431.3e928cf2@posting.google.com> Message-ID: <004701c18eda$e0ac7da0$0101010a@local> ----- Original Message ----- From: "Tim Hammerquist" > Andrew Nguyen graced us by uttering: > > Why not switch to an EZBoard? Why have maling lists that are too > > confusing? > > You sure this isn't an EZBoard advert? Besides, how many maling > lists are you a part of? Are you maled frequently? > > (couldn't resist) Don't blame you a bit, laughed my head off (now where did it get to?) > > I for one say that we create a NEW forum! > > All in favor? ... Motion declined. Next order of business? When Guido and the bot family are there, I'll be there. I haven't heard anything like that, have you? > Your boredom is not cause per se to change the society at large. I second that motion. I just have one question: Who is Andrew Nguyen and why should we follow him around anyway? From jkraska at san.rr.com Sat Dec 1 13:33:03 2001 From: jkraska at san.rr.com (Courageous) Date: Sat, 01 Dec 2001 18:33:03 GMT Subject: Let's make Python really strict about indentation References: <3C087F11.4030706@post.harvard.edu> Message-ID: On 01 Dec 2001 18:03:51 GMT, Laurent Pointal wrote: >Alexis Layton wrote in >news:3C087F11.4030706 at post.harvard.edu: > > >> Of course, we could always become REALLY, REALLY strict and never allow >> a mixture. > >Yes... its the solution I adopt, my editor (ConTEXT on Windows) is >configured to replace tabs by 4 spaces and never insert tab char in my >sources. While I am sure most people understood what you meant, to be clear, you must have certainly meant that your editor "replaces a tab, when struck, with enough spaces to get to the next tab stop." Inserting four spaces on a tab would be genuinely annoying, yes? :)) C// From mkelly2002NOSPAM at earthlink.net Mon Dec 31 17:28:44 2001 From: mkelly2002NOSPAM at earthlink.net (Michael Kelly) Date: Mon, 31 Dec 2001 22:28:44 GMT Subject: does python support overloaded methods?(py newbie) References: Message-ID: On Mon, 31 Dec 2001 16:52:16 -0000, "karthik_tamu" wrote: >wanted to confirm this. Overloading method names(with parameters >belonging to different types) is possible in python??. Hmmmm, seems like this is a bigger deal in compiled languages since it's usually more hassle to deal with an indefinite number of arguments. Scripting languages often have some catch-all syntax to get all the rest of the args. In your example avoiding an "if tree" might consist of a dictionary with currency type as key and procedures to manipulate that type as the value. Then you would just call it: dollars = currency_calc[SomeCurrencyType].(some_amount) Mike -- "I don't want to belong to any club that would have me as a member." -- Groucho Marx From djmitchell at optushome.com.au Sun Dec 30 07:08:15 2001 From: djmitchell at optushome.com.au (djmitchell) Date: Sun, 30 Dec 2001 23:08:15 +1100 Subject: REPOST: Re: Zope Documentation (was RE: Python Popularity: Questions and Comments) References: Message-ID: <3$--$$_----__$-%%$@news.noc.cabal.int> Bill Tate wrote: > I understand the "zen" thing, but it's not something that business > people are going to care about when they making a decision about > whether to use it or not. Yep, exactly. My last boss was a "who cares what it is? If it's open source and you techos recommend it, we'll give it a try" kind of guy. If we could present a justification in terms of risk/benefit that looked good, he gave us his blessing. I switched him from thinking development=C++/Java to Perl and Python, we replaced Solaris and AIX boxes with Linux, and we saved our employers enormous quantities of money. When I tried to talk him into looking at Zope, I found there was no frame of reference I could use - no comparisons with J2EE or n-tier COM, which are probably about the closest alternatives in terms of development approach If he was to let me take on some work using Zope, his problems were: - trying to convince his superiors that this unheard-of Zope thing was better in some vaguely-defined way than J2EE and large COM solutions - how to estimate the design/dev times using Zope. At least with J2EE and COM there's some body of evidence out there as to how long projects take from conception to production. We'd proven that Python compared to C++ gave something around 10:1 reduction in dev times, but Zope isn't Python - how was Zope going to perform on hardware from vendor X. We already had reasonable expectations as to how J2EE performed on specific hardware, and could budget our hardware purchases with some degree of confidence. The Zope web site suggests "it runs fast", but there's no data at all that I could find to back it up I knew I was on a loser even as I was saying something like "it's a better Java than Java" as I was describing Zope's platform independence. When I had to resort to crap platitudes like this, even though I believe it, I knew nobody holding development purse strings was going to let me finish the spiel. Zope seems to have an "it's better than the rest; just take our word for it" mentality attached to it, and solid comparisons with other tools or performance data just doesn't appear to be out there. Sun took this tack with Java in the early days, and MS did with COM/MTS a few years ago, and large corporates had a belief that Sun and MS wouldn't let their customers down (else they'd lose market share and shareholders would get upset). With Zope not having a major corporation behind it, and the NASDAQ collapse in 2000, there's that much less blind faith available for Zope. Even a small pilot or proof-of-concept implementation costs serious dollars, and that type of money just isn't around any more. I'd LOVE to use Zope for something grander than my personal site holding my resume and pictures of my kids, but if I couldn't convince one of the most receptive managers I've ever had, it seems like an impossible task. It's sort of like the conceptual leap that was required to embrace OO development several years ago; there was a large body of evidence as to how non-OO development worked in "best practice" scenarios, lots of project managers skilled in non-OO development and a general feeling of comfort that the old ways worked. Why change to OO, and take on all the unknown development risks? Based on the available documentation, Zope seems to need this sort of "death or glory" approach, and hardly anyone seems willing to take these risks at present. Although I'd love to see the next Yahoo! or Amazon startup use Zope, there's just no way the men holding the chequebooks would allow it. If anyone's got any suggestions as to how Zope can be made into less of a perceived business risk, I'd love to help make it happen, but it seems beyond me at present. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: djmitchell Newsgroups: comp.lang.python Subject: cmsg cancel <3c2f03f4$0$2592$afc38c87 at news.optusnet.com.au> Control: cancel <3c2f03f4$0$2592$afc38c87 at news.optusnet.com.au> Date: Mon, 31 Dec 2001 03:30:43 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774263 27193 211.57.49.2 (31 Dec 2001 04:51:03 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:51:03 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From sdm7g at Virginia.EDU Sat Dec 8 15:43:19 2001 From: sdm7g at Virginia.EDU (Steven Majewski) Date: Sat, 8 Dec 2001 15:43:19 -0500 (EST) Subject: Calling a generator multiple times In-Reply-To: Message-ID: On Sat, 8 Dec 2001, Courageous wrote: > > >If it _was_ "plain wrong" it wouldn't be the way it is. > > One of the objections to what I've written has been, on several > occasions, "After you've worked with them for a while, you'll > not have any problems with them" or some equivalent. What's > wrong-headed about this kind of thinking is that this is true > of original programmers everywhere. They always generally > understand their own code. Embedding a keyword deep in a function > definition and then having this embedding make the function > in effect behave entirely differently isn't just wrong, it's > bizarre. > Normally, I'ld agree with you that 'once you get used to them' isn't a good excuse. But, in the case of generators, I don't think I've seen any proposals which make what's going on much more clear. The problem is that there's a lot of syntactic magic sugar dust being sprinkled here (something that Python usually avoids) and so it's hard to capture the semantics accurately with a simple syntax. Semantically, this: def g(n): m = 0 while n < m: yield n m += 1 is equivalent to something like this: class g(generator): def __init__(self,n): # make local vars into instance vars # and do the initial stuff before the loop self.n = n self.m = 0 def next(): tmp = self.m self.m += 1 return tmp Function g() might be better named 'make_g()' . ( As Bruce Eckel noted, it's a generator factory function ). In Lisp, we would implement something like this as a macro 'make-generator, but Python doesn't handle that type of code manipulation. ( The above is only an approximate translation of the semantics of something that's implemented in a very different manner. ) In addition, there's really two levels of indirection going on to confuse folks: there's the indirection in the generator definition, which is really the definition of the generator that will be produced by the syntactically invisible virtual generator factory, and there's the indirection in the way the iteration protocol invisibly and automagically calls the generator's 'next' method until StopIteration is raised. And when you use these generators in a for loop, they two bits of confusion seem to cancel each other out. "for i in g(10):" really behaves just like it's definition. I'm guessing that this fact was one of the selling points for this syntax -- that if you didn't look under the hood and just USED them, they would not be confusing. I'm not sure that supposition has been born out, but they do get less confusion with use. Perhaps it would be better to spend another keyword, along with 'def' and 'class' , to distinguish 'generator factories'. Besides the fact that Guido and Python have both been conservative in spending their keywords, I think one reason I haven't favored any of the earlier suggestions was that they seemed to try to stress a difference between generators and function, which seemed to be an exaggerated difference. Generators, functions and methods are just slight variations on each other. The real difference is between functions and factories. -- Steve Majewski From rnd at onego.ru Sun Dec 2 03:53:19 2001 From: rnd at onego.ru (Roman Suzi) Date: Sun, 2 Dec 2001 11:53:19 +0300 (MSK) Subject: InterScan NT Alert Message-ID: Yes. It's interesting to think about it: emails with so called viruses are just pieces of data which (usually) conform to electronic mail RFCs, Internet standards. WHY DO I NEED TO KNOW some data coming to my mailbox is somehow special? I received several warnings. And some ISPs even simply block emails with "viruses". Internet is transparent no more, thanks to B.G. monopoly. >million square mile area*. >Ya know, this crap reminds me of the old days where we had losing mailers >telling people about failures that they could do nothing about, and >wouldn't affect delivery of mail (Like telling me that some machine 5000 >miles away suffered a power failure, and thus, was temporarily not >accepting mail, but I shouldn't worry, because it was queued up.) > >It's like these pieces of software are so damn proud they actually caught >a virus for once, they feel they need to tell everyone they did it. >I'm surprised it didn't start picking out every site along the mail route, >and emailing everyone it could find at that site, telling them >too. Of course, they'll probably just marry it to spam mail >software, to get this type of effect. >Hey, look! Component reuse! > >God forbid this piece of crap antivirus software be smart enough to just >log this, tell only the sender, and move on. Maybe if someone was really >paranoid, it could alert the administrator. Does it really need to alert >everyone (And what exactly is the receiver supposed to do, since they >don't have a virus anyway)? I'm half expecting to be watching CNN, and >see "AntiVirus Catcher detected viruses, The World has been notified" >scroll across the bottom. > >Apparently, the component to take care of notifying only the right >people hasn't been written yet. >But don't worry, they'll get to it right after they figure out how to >count the number of viruses it found in the message, and change the output >text. Sincerely yours, Roman Suzi -- _/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/ _/ Sunday, December 02, 2001 _/ Powered by Linux RedHat 6.2 _/ _/ "Old MacDonald had a computer with an EIE I/O" _/ From tchur at optushome.com.au Sun Dec 9 14:20:00 2001 From: tchur at optushome.com.au (Tim Churches) Date: Mon, 10 Dec 2001 06:20:00 +1100 Subject: Python and MS SQL server 7.0 References: <9uu5rr$8ed$1@news.worldonline.be> Message-ID: <3C13B960.13F8959F@optushome.com.au> ph wuidart wrote: > > Hello, > > I am beginner to Python and Tkinter.I interested to have module to connect > MS SQL server 7.0 with Python (not ODBC) Dave Cole of Object Craft in Melbourne, Australia has written a Python-to-MS SQL Server interface module - see http://www.object-craft.com.au/projects/mssql/ Make sure you give him some feedback! Tim C From jkraska at san.rr.com Sun Dec 23 02:11:36 2001 From: jkraska at san.rr.com (Courageous) Date: Sun, 23 Dec 2001 07:11:36 GMT Subject: Python on the desktop References: <94e3fce8.0112210053.2568529d@posting.google.com> <3C238618.9F54E5CA@attbi.com> Message-ID: >> Standard C++ shall not^H^H^H include a GUI toolkit nor^H^H^H and >> shall it^H^H likewise be bound to a specific operating system >> [insert:,.... >for (int i;;) > ; >for (int i;;) > ; > >With /Za this will compile. Indeed VC kills me some days. Surely thou understoodeth the sardonic aspect of my message. C// From rdsteph at earthlink.net Sat Dec 29 19:43:44 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sun, 30 Dec 2001 00:43:44 GMT Subject: REPOST: Re: Python and Ruby: a comparison References: <3C2B9A61.EE1618DB@earthlink.net> <2WpX7.1145$0s5.714029@news20> Message-ID: <9$--$$_----__$%_-$@news.noc.cabal.int> Very interesting idea. Unfortunately, I doubt if it woudl be possible. For one thing, very few people would be willing to compromise on syntax. Ruby folks would rightfully be loath to give up their end-begin block delimiters, and likewise we Python folks would not want o give up our whitespace block delimiters. Also, backwards portability would be a big problem. However, for what its worth, the PERL 6 implements, whom I met and conversed with at the MIT Lightweight Languages conference, are definitely truing, as a goal, to create a PERL 6 runtime environment that can easily and credibly, someday later on, run Perl, Ruby, and Python. I suppose that could be additional runtime environments for these languages, just like Jython is an additional runtime environment for Python. Maybe that could work, and give some of the advantages of "bringing the tow (or , in this case, three) streams if development back togethers into one mighty river. I am a doubter about this, btu who knows? By the way, their is a very interesting email list spawned form that conference that you and others might be interested in, Conrad, it has had quite a bit of discussion about Ruby and python both, among many many other languages, and is inhabited by creators of many language and other worthy and redoubtable academic computer scientists (mostly LIsp-Scheme gurus ;-)).. The list is at ll1-discuss at ai.mit.edu and i believe that there is at least a partial archive of old messages at http://www.ai.mit.edu/~gregs/ll1-discuss-archive-html/threads.html which again, contains many Ruby threads, or at least threads comparing Ruby to other languages (and Python also ;-)))) Conrad Schneiker wrote: > "Ron Stephens" wrote: > > > I initiated a thread over on comp.lang.python which has turned into > > somewhat of a comparison between Ruby and Python, their relative > > strengths and weaknesses. The thread is titled Python Popularity: > > Questions and Comments. > [...] > > By teh way, I admire Ruby. Although I am a Python hacker at heart, I > > enjoy this newsgroup, the Ruby community, and I think Matz is doing an > > outstanding job. I do believe though, that Python and Ruby are aimed at > > a very similar problem domains with similar philosophies; and that is > > what I began to talk about on comp.lang.python and that got the thread > > going. > > [In this and other somewhat related threads] Some people have (in different > words) lamented the "language fork" (as it were) with respect to providing > the major dynamic OO alternative to Perl (and Java and C++). Others have > pointed out that Python and Ruby appeal to somewhat different tastes and > that they draw newcomers from only partially overlapping pools of people. > Nevertheless, there is some inevitable division of potential resources and > mind share. > > Othes have pointed out various relatively moderate but nagging problems in > Ruby and Python which persist due to backwards compatibility, which won't be > fixed until the (highly speculative) advent of major overhalls where full > backwards compatibility is not completely manditory--i.e. Ruby.next and > Python 3000. > > So my question is: at such a presently entirely hypothetical future > juncture, is there any practical and desirable middle ground for a common > single successor language to the current generations of Python and Ruby? > > Conrad ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E645C.429536E8 at earthlink.net> Control: cancel <3C2E645C.429536E8 at earthlink.net> Date: Mon, 31 Dec 2001 03:35:35 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774458 27193 211.57.49.2 (31 Dec 2001 04:54:18 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:54:18 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From andreas at mtg.co.at Mon Dec 3 05:23:09 2001 From: andreas at mtg.co.at (Andreas Kostyrka) Date: Mon, 3 Dec 2001 11:23:09 +0100 Subject: A modest indentation proposal In-Reply-To: References: Message-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am Montag, 3. Dezember 2001 06:20 schrieb Quinn Dunkan: > On Sat, 1 Dec 2001 16:28:26 -0800 (PST), brueckd at tbye.com > Hmm, can't think of whether I do this or not, but I'm no expert. I do know > there are a lot of clever dynamic things you can do in python, but with the > exception of a few gettattr()s and setattr()s I've almost always regretted > using them. Well, actually I've discovered a pattern in my use of __getattr__ (and other clever features) over the years: 1.) newbie-mode: no __getattr__ 2.) newbie-mode: __getattr__ conclusion: got burned multiple times 3.) experienced-mode: no __getattr__, it's satanic, where is my holy water? 4.) experienced-mode: __getattr__ use only when it makes sense. Actually the "globalness" of __getattr__ is IMHO it's biggest drawback, as it makes writing correctly working ones (in the face of subclassing and other uses) quite difficult. Additionally, it's rather trivial to kill the performance by one ill designed __getattr__ method in a program. > support the operations (len() for instance). You can seriously mess up > your day by having __del__ and __getattr__ within 15 feet of each other. Well, it's obviously that using __getattr__ in combination of some other __magic__ methods is rather something for "Advanced" Python developers. > __del__ is understandably dangerous magic, but the other two are so useful > I'm continually tempted to use them. (minor complaint about __del__: it > gets called if __init__ throws, so be careful about unlocking resources > that were maybe never locked---there's no way to tell if they were or not). Well, __del__ is not Jython compatible. Not that it would matter to me, but it's something to keep in back of one head. > The latest changes in 2.2 do a lot to address this, I think. At the cost > of two kinds of classes and method lookup rules and a semi smalltalk style Well, old style classes will be depracted some time in the future. Being so fundamental as it is, it will take a long time. > And we already have more than enough magic method names, but there are more > every day, I can barely keep up with them. __all__, __dynamic__, __eq__ > vs. __cmp__, __help__ __I'm__ __losing__ __my__ __mind__. Well, thats a problem. Especially if the documentation isn't perfect. (Actually, it's quite funny to discover what the __metaclass__ token does ;) ) > Since new magic attributes seem to pop up every day, what about existing > __getattr__-using code that had all the holes patched up, but is now going > to explode because suddenly python wants to look up an __eq__ method where > it never did before? well, I personally prefer this design: def __getattr__(self,k): # special ones we need to deal with. if k=="__repr__": pass elif k.startswith("__"): raise AttributeError,k else: # deal here with the "normal" stuff pass > Hmm, try this rule of thumb: avoid type(). Distinguishing between None and > a value is very handy and valid in a reference oriented language. But if > you use type() only when you really mean it, you shouldn't have trouble > with too-clever guess-what-you-mean functions. Well, my rule of thumb: type() is only allowable for pure utility functions. Andreas - -- Andreas Kostyrka; Raiffeisenstr. 16/9; 2320 Zw?lfaxing Tel: +43/676/4091256; Fax: +43/1/7065299 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8C1KSHJdudm4KnO0RAk29AKCak0bjaoIQntDuNNuRT/ccX7YGgQCfSxw9 Y7NV4V+kEHlxUif1WXx1XoY= =rxFc -----END PGP SIGNATURE----- From gh_pythonlist at gmx.de Tue Dec 4 13:18:23 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Tue, 4 Dec 2001 19:18:23 +0100 Subject: Script at boot In-Reply-To: <200112041712.fB4HCQi01133@igate.highmark.com> References: <200112041712.fB4HCQi01133@igate.highmark.com> Message-ID: <20011204181821.GA2163@lilith.hqd-internal> On Tue, Dec 04, 2001 at 12:18:01PM -0500, brian.hare at highmark.com wrote: > I'm not a python programmer (yet), but I am a JavaScript programmer to a > degree. > > My questions is this: Can a Python script be made to run at every > boot/reboot? > > My project is this: I've got Familiar linux running on an Ipaq handheld > PC. I need a script to run every time the device is rebooted. Is this > possible with python? It's kind of the equivalent of putting something in > startup folder of windoze I suppose.... Just like in other Linuxen, the startup scripts can be found in /etc/init.d. These are normally shell scripts which can easily invoke a Python script. The normal way to proceed is to copy /etc/init.d/skeleton to, say /etc/init.d/custom and then edit the custom init script to your liking. But you're not finished, yet. On a SysV style Unix, the symlinks in /etc/rc[0-6].d determine when the script is actually executed (in single or multi-user mode or when shutting down). I'm no expert here, so for more details, I'd recommend to read some docs on the Linux boot process ("man init" or some such). Here's a sample init script (the file /etc/init.d/custom): #! /bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin SCRIPT=/root/bin/myscript case "$1" in start) echo "Doing my custom initializations." $SCRIPT ;; esac The actual Python script is in /root/bin . I tried a dummy one (Be sure to make a chmod +x to make it executable). #!/usr/bin/python print "My custom script." Because my iPAQ with Qt Palmtop Environment doesn't have a nice script to set the symlinks, I'd just set a symlink myself, for example: ln -s /etc/init.d/custom /etc/rc2.d/S20custom Btw. I do all such adminstrative operations while being logged in via ssh. This requires a PPP connection to the host PC. (And knowledge of via or having another console editor installed). Low-level operations like watching the boot process (for verifiying your script actually gets executed, for example) are best done with using minicom over the serial console. Details for setting up ssh and minicom and much more valuable information can be found on the Wiki at http://www.handhelds.org/ They also have several mailing list with people who know more than me. There are also a #handhelds.org and #ipaq IRC channels on irc.openprojects.net. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From DeepBleu at DeepBleu.org Thu Dec 27 10:09:45 2001 From: DeepBleu at DeepBleu.org (DeepBleu) Date: Thu, 27 Dec 2001 09:09:45 -0600 Subject: REPOST: Re: Fate of win32all? References: <7876a8ea.0112212116.2ebabc23@posting.google.com> Message-ID: <4$--$$_----_%-$-_$@news.noc.cabal.int> One word that I feel like sharing here: Mark Hammond is a hero of mine. Have I owned my own company I would hire him for lots of money :) Wishing Mark all the best in his professiol endeavours. DeepBleu "stalin" wrote in message news:7876a8ea.0112212116.2ebabc23 at posting.google.com... > I've used win32all occasionally--always in noncommercial settings--and > have found it helpful. I'd like to thank Mr. Hammond for developing > the packages and ActiveState for supporting their recent maintenance > by employing Hammond. > > Mr. Hammond had personally developed the win32 packages to > considerable maturity before he became involved with ActiveState. His > employment by ActiveState appears to have come to an untimely end just > recently ( http://mail.python.org/pipermail/python-dev/2001-December/019038.html > ). I don't mean to be insensitive--I'm sure Hammond has a lot on his > mind right now--but I wonder about the fate of win32all. What role > does ActiveState now play in licensing the package? Has the original > author lost a degree of his control over it to his former employer? > > My suspicion is rooted in the apparent lack of a binary distribution > of win32all for Python 2.2 independent of ActiveState's ActivePython > product. Queries about a binary distribution of win32all for Python > 2.2 have gone unanswered for months: > > http://groups.google.com/groups?q=win32all+2.2&hl=en&group=comp.lang.python. *&rnum=1&selm=9ralkq%24rdc%241%40ins22.netins.net > > ActiveState's win32all page does not list a binary download for Python > 2.2,: > http://aspn.activestate.com/ASPN/Downloads/ActivePython/Extensions/Win32all > > although they have developed an ActivePython 2.2 alpha that of course > *incorporates* win32all: > http://www.activestate.com/Products/Download/Download.plex?id=ActivePython > > Hammond's personal Starship page makes no mention of a win32all binary > for Python 2.2: > http://starship.python.net/crew/mhammond/win32/Downloads.html > > I wrote this message simply because I'd like to know who holds the > reins of win32all, and what their plans for it are. I am *not* an > anti-ActiveState malcontent looking to spread conspiracy theories, > though I must say that recent developments call the future of the > company into question in my mind. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "DeepBleu" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:09:42 GMT Organization: The World's Usenet -- http://www.Supernews.com Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775735 27193 211.57.49.2 (31 Dec 2001 05:15:35 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:15:35 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From dalke at dalkescientific.com Fri Dec 14 22:59:11 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Fri, 14 Dec 2001 20:59:11 -0700 Subject: perl style formating References: Message-ID: <9vehpt$scq$1@slb3.atl.mindspring.net> Les Ander: >say i wanted to print out 3 variable in the following format: >$name is left justified and has the width of size 10 >$comment is left justified and starts at column 11 and ends at 40 >$line starts at 41 and is of variable length) >>> name = "Les" >>> comment = "posted to c.l.py" >>> line = "xyzzy" >>> print "%(name)-10s %(comment)-30s%(line)s" % vars() Les posted to c.l.py xyzzy 0 1 2 3 4 01234567890123456789012345678901234567890123456789 >in perl i would write it as: > >format OUT = >@<<<<<<<<<< >@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >@* >$name, $comment, $line; >. >$~="OUT"; Ahhh, that's a different question. I've never used Perl's format mechanism despite the tens of 1,000s of Perl I wrote. However, trying it out just now I see that "<<<" will truncate if there's more than 3 characters in the result. The code I gave in Python doesn't do that. But then, your spec didn't ask for it. There was a story I heard in school about some other student who switched majors a few times. Typically it takes about 120 credit hours to graduate, though a few people might get up near 200. He managed to get more than 250 hours (so twice what most people need to graduate). His grades were good, so his total number of "grade points" (A = 4.0 = best, B = 3.0, ...) was over 1,000. Some part of the program truncated grade points to three digits -- effectively doing modulo 1000 -- then used the result to compute the GPA (grade points / credit hours). When submitting his transcript to prospective employers he had to include a note pointing out why his GPA was near 0.0 (failure) instead of near 4.0. So Perl's truncation method might not be the best. Then again, Python's might not be best when dealing with strict column based formats. A 3rd option is FORTRAN, which fills overflowed fields with "*" to show the field could not be properly expressed, and do so without disturbing the column locations. (It is FORTRAN after all.) In other words, don't complain that the Python solution isn't the same as the Perl one because it might be that neither have the best/most appropriate solution. (Hmmm, from Stanford, learning Python, from google you've used bioperl -- wonder if I'm (indirectly) through Jeff and Biopython the reason for your learning Python. ;) Andrew dalke at dalkescientific.com From djc at object-craft.com.au Wed Dec 19 05:10:41 2001 From: djc at object-craft.com.au (Dave Cole) Date: 19 Dec 2001 21:10:41 +1100 Subject: [Sybase module] Erich Franz Stocker please read Message-ID: It looks like our ISP has been added to some sort of SPAM offender database so I cannot reply via email (bummer)... [snip] ----- The following addresses had permanent fatal errors ----- (reason: 550 This network disallowed due to SPAM attempts) ----- Transcript of session follows ----- ... while talking to funhouse.gsfc.nasa.gov.: >>> MAIL From: <<< 550 This network disallowed due to SPAM attempts 554 5.0.0 Service unavailable [snip] > I'm trying to see if I can get your sybase module installed on an > SGI where all the libraries on built using the SGI n32 > format. Looking at the setup.py module, I'm assuming that that it > uses gcc whose modules are not usable with an sgi one. I think that distutils uses the same compiler which was used to build Python. I have never looked too deeply into things but I suspect that it works that way. > We used the python setup.py install option to put your module in > place and it did build it successfully (I"m assuming with gcc) and > installed it in the correct place. > > However, when I run a test script, I get the run error: > > /develop/people/stocker{303}>python sypthon.pl > Traceback (most recent call last): > File "sypthon.pl", line 3, in ? > import Sybase > File "/usr/local/lib/python2.1/site-packages/Sybase.py", line 7, in ? > from sybasect import * > ImportError: 6550135:python: rld: Fatal Error: unresolvable symbol in > /usr/local/lib/python2.1/site-packages/sybasect.so: srv__get_xdrrecv > > When I look into sybasect.c I don't even see a direct call to > srv__get_xdrrecv. You might need to include some extra libraries in the syb_libs list in setup.py. I have not received reports of people using the module on SGI as yet so you could be the first... Look in the Sybase documentation and samples to see which libraries are used to build programs on SGI. There should be sample/ctlibrary directory somewhere in your Sybase installation. > I thought I would try to build the so object with the SGI c compiler > but you don't have a make file for the c files making up this so. > Do all the .o just get linked together into the sybasect.so module? I am fairly sure that the problem is not that obscure. It looks like we just have to find out an extra library to place in the syb_libs variable in setup.py. - Dave -- http://www.object-craft.com.au From aahz at panix.com Mon Dec 31 10:08:50 2001 From: aahz at panix.com (Aahz Maruch) Date: 31 Dec 2001 07:08:50 -0800 Subject: Cancel messages References: <3c307f1c$1_6@news.newsgroups.com> Message-ID: In article <3c307f1c$1_6 at news.newsgroups.com>, Brad Clements wrote: >"Aahz Maruch" wrote in message >news:a0psh4$nbs$1 at panix3.panix.com... >> >> Let's just say that the mental health profession is falling down on the >> job. Unfortunately, one of the side effects of these cancel floods is >> that we get counter-flooded by people resurrecting the original article. >> If you have any say over your netnews server, you should probably set it >> up to reject both cancels and resurrections. > >But I see one of my posts "Reposted", but I didn't do it. >Something is "automatically" reposting cancelled messages. Correct. When these cancel floods hit, there are bots that automatically resurrect the canceled posts. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: TODAY! From jadestar at idiom.com Sat Dec 29 11:56:18 2001 From: jadestar at idiom.com (James T. Dennis) Date: 29 Dec 2001 16:56:18 GMT Subject: REPOST: pty.spawn() and friends Message-ID: <5$--$$_----___%$%$@news.noc.cabal.int> I've been trying to learn more Python and I've been sticking with the somewhat obscure kinds of things that I've routinely needed to do as a system administrator. I came across the pty module as a primitive alternative to using expect and it seems like I should be able to so simple work with it. So naturally I tried to implement the simplext expect script (autopasswd) as a Python script using the pty.spawn() function. This doesn't work as I'd expect. First the documentation states that pty.spawn(): spawn a process, and connect its controlling terminal with the current process's [sic] io [sic]. This is often used to baffle programs with insist on reading from the controlling terminal. ... well it certainly baffles the programmer that tries to use it. My expectation was that this would spawn the program in question ("/usr/bin/passwd" for my tests) and allow me to print to its input and read from its output; under programmatic control. I would thus have to cross-wire the inputs and outputs of the child process with some sort of handle, object, or file descriptor on my (parent) process. However it seem like pty.spawn() doesn't do any cross-wiring. It seems to simply start a sub-process that interacts with my terminal, basically like the os.system() function. (The difference is that pty.spawn() takes a tuple of arguments while os.system() takes a string and passes it to a shell for parsing and execution). That seems pretty lame. It's like the author of the pty module didn't know what the author of the os module was doing and provided a gratuitously similar function with no actual relevance to psuedo-ttys and no additional functionality. In so doing, they've raised (my) expectations and failed to satisfy them. What pty.spawn() *should* do (to meet with reasonable expectations that it would have something to do with spawning subprocesses *UNDER THE CONTROL OF A psudo-tty*) is return a file-like object to which one can write (commands or "keystrokes") and from which one could read (responses, prompts, potentially screen updates). Ideally this would come with some convenience methods, and members/constants (possibly inherited from a common module with curses, and/or tty, to allow one to send keystrokes by their symbol names (rather than having to manually fuss with escape sequences) and receive data as structures of character/attribute data). (Imagine being able to run a child ncurses monitoring process and automatically programmatically respond to a specific bit of text "turning red" or "going on the blink"). None of this would be nearly so irritating if USAGE EXAMPLES had been provide to explain what the programmer should expect of the program. Naturally I had to fuss with it for some time before figure out that it really was a lame and redundant function rather than my own lack of skill. The fact that the reference docs give a couple of optional arguments: [,master_read[,stdin_read]] which are supposed to be: functions which read from a file-descriptor ... complicates it further. What kind of function could I write that "reads from a file-descriptor" but which takes no arguments telling it *which* file-descriptor! At first I thought this was trying to say to call pty.spawn() with one argument to act sort of like os.system(), or two arguments (a tuple and a function invocation) to spawn a process under the control of that function. (Envisioning something where *that function's* stdin and stdout where wired up to the spawned process' stdout and stdin respectively). (If that was the case I'd expect that the optional third argument would be another controlling function for handling the child process' stderr; communications between the two would be "merely a matter of programming"). Ugh! Between this and the equally frustrating Python curses docs I'm pretty grumpy. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "James T. Dennis" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:43:53 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774685 27193 211.57.49.2 (31 Dec 2001 04:58:05 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:58:05 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From marklists at mceahern.com Thu Dec 20 20:09:26 2001 From: marklists at mceahern.com (Mark McEahern) Date: Thu, 20 Dec 2001 17:09:26 -0800 Subject: Files In-Reply-To: Message-ID: Q: Where can I get information about managing files A: http://www.python.org/ From philh at comuno.freeserve.co.uk Mon Dec 3 13:21:02 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Mon, 3 Dec 2001 18:21:02 +0000 Subject: a comment about PEPs References: Message-ID: On Mon, 3 Dec 2001 11:15:44 GMT, Michael Hudson wrote: >philh at comuno.freeserve.co.uk (phil hunt) writes: > >> Whenever I have a peek at c.l.p, there are usually several threads going >> suggesting improvements to the langauge. >> >> Why is this? > >Because threads that start with "Python's fantastic!!" don't usually >garner many followups? Same sort of thing as "no news is good news". > >The advantage of PEPs is if someone writes one and it gets rejected >there's a chance (and only a chance) of heading off the discussion the >next time around. Who decides whether PEPs are approved/rejected? The BDFL? -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From fgeiger at datec.at Mon Dec 17 03:29:06 2001 From: fgeiger at datec.at (F. GEIGER) Date: Mon, 17 Dec 2001 09:29:06 +0100 Subject: [OT] Python and UMLStudio Message-ID: <9vkadh$g43$1@newsreaderg1.core.theplanet.net> In Nov. Nomad posted a question, whether there's anyone having written already templates for UMLStudio, enabling it to generate Python code. So I decided to have a look at UMLStudio itself and must say, that it looks quite good. I consider to buy it but, as it's not that cheap, I have 2 q's: 1) Is anyone here knowing the software better than I (just could play a bit with it, as the eval does not allow saving models, that are not *tiny*). Opinions? 2) Is there already a Python enabling template for UMLStudio out there? Cheers Franz From sasoft at gmx.de Thu Dec 27 22:16:11 2001 From: sasoft at gmx.de (cruciatuz) Date: Thu, 27 Dec 2001 22:16:11 -0500 Subject: A new message board is up In-Reply-To: <3C2B829A.DD0AED79@ccvcorp.com> References: <40dbad98.0112262232.1868734e@posting.google.com> <3C2B724D.E4D31E24@ccvcorp.com> <3C2B74B8.D2FE36F5@stroeder.com> <3C2B829A.DD0AED79@ccvcorp.com> Message-ID: <20011228031611.GA1478@blackscarab> On Thu, Dec 27, 2001 at 12:20:42PM -0800, Jeff Shannon wrote: > For an open, technical forum in which long-term archiving is > desirable, Usenet is definately a preferable medium. For informal > social groups, web forums can make a nice alternative to mailing > lists. ... and there wouldn't be much more spam as in this mailinglist ;) -- Stefan Antoni ---------------------------- Don Dez 27 22:15:12 EST 2001 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 240 bytes Desc: not available URL: From nospam at mega-nerd.com Mon Dec 3 14:34:25 2001 From: nospam at mega-nerd.com (Erik de Castro Lopo) Date: Mon, 03 Dec 2001 19:34:25 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> Message-ID: <3C0BD39F.D43D4FF7@mega-nerd.com> Courageous wrote: > > >Perhaps you might want to put some kind of processing step into your > >revision control procedures or tools. I think I raised this issue > >before on comp.lang.python but some people think it's more interesting > >to get religious about tabs vs. spaces instead. > > I've considered that on many occasions; one such step might be to > simply REJECT a commit of a .py file with tabs in it. YOu people are ***NUTS***. How hard is it to find an editor that treats tabs correctly and allows the tab width to be set to something other than 8? Get a grip people. Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam at mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ "Don't be fooled by NT/Exchange propaganda. M$ Exchange is just plain broken and NT cannot handle the sustained load of a high-volume remote mail server" -- Eric S. Raymond in the Fetchmail FAQ From dhhnews0 at hotmail.com Sun Dec 9 09:18:20 2001 From: dhhnews0 at hotmail.com (Dan Howard) Date: Sun, 09 Dec 2001 14:18:20 GMT Subject: Tkinter vs wxPython? Opinions/Experiences Message-ID: I'm a newbie at Python and about to create my first set of GUI applications. I would like to run them on Windows and Linux ( and possibly MAC). I'm trying now to decide whether to use Tkinter or wxPthyon. Would appleciate views, opinions and experiences... Thanks - Dan From jorjun at mac.com Mon Dec 3 07:47:38 2001 From: jorjun at mac.com (jorjun) Date: Mon, 03 Dec 2001 12:47:38 +0000 Subject: New updates needed for an old computer language humor piece References: Message-ID: <3C0B746A.2050205@mac.com> RPGIII: CSKEY READE CUSTOMER 23 *IN23 DOWEQ *OFF *IN23 IFNE *IN29 SETON *IN29 CSFOOT IFNE 'SHOT' MOVEL 'SHOT' CSFOOT UPDAT CUSTOMER ENDIF SETOF *IN29 ENDIF CSKEY READE CUSTOMER 23 ENDDO Ric Werme wrote: > The following wandered into my mail box for the first time in a year > or two. Since I've been learning a bit of Python this year, it seems > to me an update is needed. > > For Logo, perhaps: Draw a foot, draw a gun, but the bullet comes out > the handle and misses the foot altogether. > > -Ric Werme > > -------------------------------------------------- > > THE PROGRAMMER'S QUICK GUIDE TO THE LANGUAGES > > The proliferation of modern programming languages (all of which seem to > have stolen countless features from one another) sometimes makes it > difficult to remember what language you're currently using. This handy > reference is offered as a public service to help programmers who find > themselves in such a dilemma. > > > TASK: Shoot yourself in the foot. > > C: You shoot yourself in the foot. From laurent.pointal at laposte.net Wed Dec 5 17:49:33 2001 From: laurent.pointal at laposte.net (Laurent Pointal) Date: 05 Dec 2001 22:49:33 GMT Subject: Printing from Windows References: <9ui1ki$lfv$1@news.netpower.no> Message-ID: "David Brown" wrote in news:9ui1ki$lfv$1 at news.netpower.no: ... > Are there any good ways to make a printout from a Python program? I'll > be running mostly on Windows, but I'd much prefer a cross-platform > solution for later migration to Linux. ... > Any hints or ideas would be much appreciated. To build the output, you may look at ReportLab, at http://www.reportlab.com/, which will build PDF file. After, maybe using the webbrowser module and requesting it to print the document, or finding another way but I dont know one which will be platform independant. A+ Laurent. From ws-news at gmx.at Tue Dec 18 05:14:12 2001 From: ws-news at gmx.at (Werner Schiendl) Date: Tue, 18 Dec 2001 11:14:12 +0100 Subject: implementing a timer? References: <9vn0gv$ll6$1@colo.mobo-it.nl> Message-ID: <3c1f17be$1@brateggebdc5.br-automation.co.at> Hi Peter, you can use the sleep function from the time module, for example: >>> import time >>> >>> i = 0 >>> while i < 10: ... print i ... time.sleep(10) ... i+=1 ... This prints the numbers 0 to 9 with 10 seconds delay after each one. To get minutes, multiply by 60. You can also specify fractional values to get shorter periods that a second. hth Werner "waalp" wrote in message news:9vn0gv$ll6$1 at colo.mobo-it.nl... > I'm trying to make a script that will check if i have mail every let's say > 10 minutes.So i tought let's use something like a timer. But i can't find > any documentation on how to implement something like this. > > I'm a beginner so it could be that i haven't looked in the right places. > Could somebody please help? > > Thanks, > Peter > > From debl2NonoNoSpammy at bellatlantic.net Sun Dec 2 23:48:46 2001 From: debl2NonoNoSpammy at bellatlantic.net (David Lees) Date: Mon, 03 Dec 2001 04:48:46 GMT Subject: age of new pythonistas [was: The Editor Poll results are in!] References: <3bfd7f87@news.airtel.net> <9u4cbu$2ts$1@news.xmission.com> <9udn1g$64c$1@brokaw.wa.com> Message-ID: <3C0B0402.B640F1DD@bellatlantic.net> Same here, 51, wrote first program 38 years ago. Discovered Python close to a year ago, but have programmed in it sporatically(sp.). Great language. debl From josegomez at gmx.net Tue Dec 4 09:01:33 2001 From: josegomez at gmx.net (josegomez at gmx.net) Date: Tue, 4 Dec 2001 14:01:33 +0000 (UTC) Subject: Numerical Python Question References: <9uieop$bncra$1@hades.rz.uni-sb.de> Message-ID: <9uikvt$cvi$2@hermes.shef.ac.uk> Uwe Schmitt wrote: > As hilb is a n x n matrix and x is n x 1 the result b should be n x 1. > But the program outputs a n x n matrix !!! The way I understand it is that you need to have a matrix multiplication (which is different to a 2D array multiplication). For this you need matrixmultiply. An example from the manual: >>> print a [[0 1 2] [3 4 5]] >>> print b [1 2 3] >>> print a*b [[ 0 2 6] [ 3 8 15]] >>> print matrixmultiply(a,b) [ 8 26] Hope this helps Jos? -- Jos? L G?mez Dans PhD student Tel: +44 114 222 5582 Radar & Communications Group FAX; +44 870 132 2990 Department of Electronic Engineering University of Sheffield UK From syver-en+usenet at online.no Fri Dec 28 01:18:03 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 28 Dec 2001 07:18:03 +0100 Subject: SSL Sockets in Windows References: Message-ID: Hi Al, I'm not exactly an expert on SSL :-). I know it's what goes on behind the scenes when my browser uses an https url and communication is encrypted and whatnot. Do you have (or can you refer me to) a quick example to check that SSL is indeed working on Python? -- Vennlig hilsen Syver Enstad From loewis at informatik.hu-berlin.de Fri Dec 28 18:20:05 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 29 Dec 2001 00:20:05 +0100 Subject: REPOST: Re: ETA for Win32all under Python 2.2? References: Message-ID: <6$--$$_-----$$%__$@news.noc.cabal.int> David Brady writes: > P.S. There's a longstanding rule in my family: you're > not allowed to complain about anything you could fix > yourself. I'd offer to help, but "a beating" was the > funnier of the two threats. :-) Did you even try to build the package from source??? The source code that was used for 2.1 should work without modification for 2.2, too (if it doesn't, please submit a bug report). Regards, Martin ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Martin von Loewis Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:26:55 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774989 27193 211.57.49.2 (31 Dec 2001 05:03:09 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:03:09 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From nas at python.ca Mon Dec 10 18:30:18 2001 From: nas at python.ca (Neil Schemenauer) Date: Mon, 10 Dec 2001 15:30:18 -0800 Subject: FW: Strange behaviour of __del__ In-Reply-To: ; from TomH@optiscan.com on Tue, Dec 11, 2001 at 08:11:26AM +1100 References: Message-ID: <20011210153018.B4732@glacier.arctrix.com> Tom Harris wrote: > If 'a' is not defined, how does Python find, let alone call a method on it. Reset your brain: http://effbot.org/guides/python-objects.htm 'a' is a reference, not an object. If you want to do any serious Python programming you need to understand the information in the referenced page. Neil From garyr at fidalgo.net Sun Dec 9 21:20:26 2001 From: garyr at fidalgo.net (Gary Richardson) Date: Sun, 9 Dec 2001 18:20:26 -0800 Subject: Polish the interface of applications References: <9uqdgq$j1a$1@pegasus.csx.cam.ac.uk> Message-ID: You could do something like: from Tkinter import * root = Tk() root.iconbitmap('your_filename.ico') ... Also, if you search Google with the phrase 'Tk icon' you will find other ways to do this. Gary Richardson "Xiao-Qin Xia" wrote in message news:9uqdgq$j1a$1 at pegasus.csx.cam.ac.uk... > Hi, everybody, > > When I run my applications based on Tkinter, there is always a TK icon at > the left of the title line of the window (northerwest of window), is there > any way to replace it with my own icon (.bmp, jpg or gif)? > The other thing is when the application (main.py) is running under windows > XX, there is always a DOS window opened besides my application window. Is > there any way to avoid displaying the DOS window? > > Cheers, > > Xiao-Qin Xia > > From chrishbarker at attbi.com Thu Dec 27 14:10:07 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Thu, 27 Dec 2001 11:10:07 -0800 Subject: Efficient storage of floats References: <3c272d5e$0$202$626a54ce@news.free.fr> Message-ID: <3C2B720F.209C3A04@attbi.com> Francois Petitjean wrote: > > I have to read a number of points coordinates (npoints). Different > structures can be used to store these numbers: > 2. The coordinates can be stored in an array > acoords = array.array('f') This is crying out to be done with Numeric Arrays (http://sourceforge.net/projects/numpy): import Numeric: coords = Numeric.zeros((3,npoints),Numeric.Float) > Using acoords : x,y,z = acoords[3*kpt],acoords[3*kpt+1],acoords[3*kpt+2] x,y,z = acoords(n) The possible n-d arrays of Numeric make this kind of thing MUCH easier, and you will get the efficient storage you want. Numeric arrays use the same amont of storage a C array would use for the same type, plus the overhead of the Array object, which would be negligable compared to the data for a large array. Asside for that, you now have a data an object type that supports effiecent computation, wiht nice easy notation: transformed_coords = acoords * 5 to multiply all the coordanates by 5, or: transformed_coords = acoords * (x_scale, y_scale, z_scale) Etc, etc, etc. If you are working with a lot of numbers, you are crazy not to use Numeric. -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From steffen.ries at sympatico.ca Sun Dec 16 09:46:31 2001 From: steffen.ries at sympatico.ca (Steffen Ries) Date: Sun, 16 Dec 2001 14:46:31 GMT Subject: PyGTK on Windoze References: <3C1A2250.6060108@haftmann-online.de> Message-ID: Fredegar writes: > Hi! > > I have found a PyGTK port for Windoze at > http://hans.breuer.org/ports/ > > After installation, the following error occured: > > >>> import gtk > Traceback (most recent call last): > File "", line 1, in ? > import gtk > File "c:\programme\python21\lib\gtk.py", line 21, in ? > import _gtk > ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden. The binaries provided on this site are for python-1.5.2 and python-2.0. Looks like you are using python-2.1, did you compile the extensions yourself? The downloaded binaries won't work. > I have already copied the whole GTK stuff (by Tor Lillquist) to the > python dll directory. > > Has anyone experiences with this situation or can give me a hint? hth, /steffen -- steffen.ries at sympatico.ca <> Gravity is a myth -- the Earth sucks! From ryan.phillips at csus.edu Fri Dec 28 19:12:27 2001 From: ryan.phillips at csus.edu (Ryan Phillips) Date: 29 Dec 2001 00:12:27 GMT Subject: REPOST: Re: Allegro interface for Python References: <3c2cfc94$1@news.vogel.pl> Message-ID: <5$--$$_----_---_$$@news.noc.cabal.int> I would think so. Perhaps SWIG could be used to create the python bindings. -ryan "Tomasz W?jcik" wrote in message news:3c2cfc94$1 at news.vogel.pl... > Have you found anything interesting? > Is it possible???? > > > ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp.gblx.net!newsfeed.cwix.com!newsfeed.mathworks.com!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Ryan Phillips" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:19:46 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774958 27193 211.57.49.2 (31 Dec 2001 05:02:38 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:02:38 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jason at jorendorff.com Wed Dec 19 17:42:58 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Wed, 19 Dec 2001 16:42:58 -0600 Subject: Python CGI & File Permissions In-Reply-To: <5a4226f0.0112181650.6a954d5e@posting.google.com> Message-ID: > I had a similar problem when trying to create a directory with > os.mkdir(path, mode). Even though I passed 0777 as mode, it only > created it as -rwxrw-rw-. The documentation says that should work, > but it didn't for me (Python 1.5.2 and 2.1) This is probably your umask at work. This is a Unix feature, not a Python bug. "umask" prevents you from creating files with certain dangerous permissions. You can set it in Python: os.umask(). Anyway, creating directories with 777 permissions is bad! Instead, run your CGI script as the appropriate user. http://httpd.apache.org/docs/suexec.html bwaskiew at indiana.edu (Brian Waskiewicz) wrote: > > I'm trying to use a Python CGI script to write a text file on a > > Unix/Apache webserver. The problem is that the file created is owned > > by 'nobody' and has permissions '-rw-r--r--'. I need to read and > > append to the file in other scripts, so I need some way of changing > > the file permissions. I tried os.chmod() and that didn't work. See above. ## Jason Orendorff http://www.jorendorff.com/ From niemeyer at conectiva.com Mon Dec 3 20:50:19 2001 From: niemeyer at conectiva.com (Gustavo Niemeyer) Date: Mon, 3 Dec 2001 23:50:19 -0200 Subject: Embedding Python in C++ application: Question #1 In-Reply-To: <8a12e538.0112031616.674f37e8@posting.google.com> References: <8a12e538.0112031616.674f37e8@posting.google.com> Message-ID: <20011203235019.A30725@ibook.distro.conectiva> [...] > I can iterate, but whenever I have frequent iteration over > lots of things my intuition is to push the iteration as far > down as practical. I would prefer to use a function, Convert(), [...] Is it because of performance!? In this case, if you ever find some function like this, you'll be just delegating the task to the other function. If it's not about performance, I don't think an iteration looks so ugly. But that's just my opinion of course. ;-) -- Gustavo Niemeyer [ 2AAC 7928 0FBF 0299 5EB5 60E2 2253 B29A 6664 3A0C ] -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 240 bytes Desc: not available URL: From loewis at informatik.hu-berlin.de Sun Dec 2 09:08:42 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 02 Dec 2001 15:08:42 +0100 Subject: pygettext examples? References: Message-ID: teg at redhat.com (Trond Eivind =?iso-8859-1?q?Glomsr=F8d?=) writes: > gettext.textdomain(PROGNAME) > _=gettext.gettext I would recommend against setting the textdomain globally. Instead, always use dgettext. That makes it possible to use your code as a library in a different program as well, with little coding overhead. Regards, Martin From aleax at aleax.it Mon Dec 17 19:00:34 2001 From: aleax at aleax.it (Alex Martelli) Date: Tue, 18 Dec 2001 00:00:34 GMT Subject: Preserving program structure References: <3C1A5960.4A27136D@attbi.com> <1EyS7.6544$ia7.942739@news6-win.server.ntlworld.com> Message-ID: David Dawkins wrote: ... > The impression I get is "avoid IDLE". I'm a vi fan, so I'll find a way to > emulate the "Ctrl-F5" (run script) feature. IDLE's fine, but vim is a better vi -- look at if_python.txt in the vim docs (/usr/share/doc/vim-common-6.0/doc/if_python.txt in my vim 6.0 installation on Linux, for example), and you'll see you need very little emulation indeed -- :pyf already runs a python file (script) in VIM... Alex From jason at jvoegele.com Wed Dec 5 11:32:06 2001 From: jason at jvoegele.com (Jason Voegele) Date: 5 Dec 2001 08:32:06 -0800 Subject: Python evangelists unite! References: <9u77i8$a5j$1@slb0.atl.mindspring.net> <91acf731.0111301017.31cd71a5@posting.google.com> <9ufdth$155$1@slb5.atl.mindspring.net> <91acf731.0112031205.2782a5f9@posting.google.com> <9uhpkh$9u7$1@slb5.atl.mindspring.net> <91acf731.0112040753.49b930cd@posting.google.com> <3C0D217E.A5683D37@ccvcorp.com> <9ukbaj$thh$1@slb0.atl.mindspring.net> Message-ID: <91acf731.0112050832.947307f@posting.google.com> "Jyrinx" wrote in message news:<9ukbaj$thh$1 at slb0.atl.mindspring.net>... > Gotcha. Well, at this point I can see the use for singleton methods in an > object database, but I'm still not convinced of the need in a general > language. In a more self-contained program, how often do you suddenly find > yourself with someone else's object at runtime and need to add functionality > like that? One example I can think of is in a Web server implementation I was working on. HTTP requires the line separator to be "CRLF" (carraige-return line-feed). Ruby's IO methods use either '\n' or a platform-specific line separator. Part of my application accepted a socket connection back to the browser as a parameter. This method generated a response and wrote it to the IO object passed in. Instead of doing this everywhere: print("Content-type: text/html \r\n") I just did this: def my_method(io) def io.print(text) self.print(text << "\r\n") end io.print("Content-type: text/html") end I changed the print method of the single instance of IO that I was using, so this change did not affect other IO objects in the system. Granted, I didn't *need* to do this, since I could have just added the "\r\n" to the end of each print, but it's a lot easier and less error-prone to do it OnceAndOnlyOnce. > Besides, if I may continue stubbornly to stick by my favorite > contender :-) , I should think it would be trivial to have a Python library > to add this sort of runtime extension, if it isn't easy already. (Great. > I've argued myself in a circle - Ruby supports this paradigm too well; well, > maybe it could be useful; well, it's not hard in Python either :-) ... ) > Anyway, this looks to me like a useful feature best relegated to a standard > library, more than a major feature of a general-purpose language. I suppose it's one of those things where if you don't have it you don't miss it, but once you've gotten used to it you'd be annoyed by its absence. > I could be wrong, though ... where else have you guys found singleton > methods useful? It happens very frequently in Ruby, since any class method is a singleton method of the Class object for that class instance :) But that of course is specific to the Ruby object model. (Maybe it works like this in Smalltalk to? I don't know.) In everyday application programming, I admit I don't use it all that often, but I like to have it there when I need it. But consider that any use of the Decorator pattern is easily implemented using singleton methods. Jason From oren-py-l at hishome.net Sun Dec 2 10:03:41 2001 From: oren-py-l at hishome.net (Oren Tirosh) Date: Sun, 2 Dec 2001 10:03:41 -0500 Subject: Whatever happened to String Interpolation? In-Reply-To: <9uc26v$akh$1@peabody.colorado.edu>; from fperez528@yahoo.com on Sat, Dec 01, 2001 at 07:03:19PM +2328 References: <9u6dbn$nsj$1@peabody.colorado.edu> <9ubecn$ped$1@peabody.colorado.edu> <837ks6se4c.fsf@panacea.canonical.org> <9uc26v$akh$1@peabody.colorado.edu> Message-ID: <20011202100341.A87570@hishome.net> On Sat, Dec 01, 2001 at 07:03:19PM +2328, Fernando P?rez wrote: > Exactly my point. I think when I mentioned my need of inserting % in > strange dynamic strings I inadvertedly set the discussion off-course. > That was just a side comment, and by no means the meat of my point. > My important point is that Ping's PEP allows a _clear_ way of saying > > "x is $x, f(x) is $f(x)" Will this do? i"x is `x`, f(x) is `f(x)`" Take a look at http://www.tothink.com/python/interpp The difference from Ka-Ping Yee's proposal runs much deeper than the use of backquotes instead of $. The expressions between backquotes are real python expressions that get syntax checked at compile time and generate bytecode. You may want to write your string formats in one place and pass them as arguments to be formatted in another context. To do this you can simply wrap your string in a lambda function: fmt = lambda: i"x is `x`, f(x) is `f(x)`" When this function is called in a different context the magic of nested scopes will do the rest. If you feel this is too much "black magic" you can also pass arguments to the lambda function. Oren Tirosh From sarat_venugopal at yahoo.com Fri Dec 21 03:53:17 2001 From: sarat_venugopal at yahoo.com (Sarat Venugopal) Date: 21 Dec 2001 00:53:17 -0800 Subject: Python on the desktop Message-ID: <94e3fce8.0112210053.2568529d@posting.google.com> Hi all, I am fairly new to Python, in the sense that I haven't written anything substantial in it, although I have gone through all the major books so far. Coming from a strong, industrial strength C++ application development background, let me make some quick observations. Needless to say, I am quite fascinated with the language primarily beacause of the strong emphasis on readability and maintainability of the code(Indentation, namespaces and the works). I guess if speed is the only issue, Python should suffice for a number of applications. 1. If python is to permeate the realm of commercial desktop (in whatever scope), we need the ability to convert it into a native executable(I have taken a look at some of the limited solutions available from individuals). I read somewhere, it may never be possible in Python. Can anyone throw light on this? Most commercial applications wouldn't want to expose the source code or even leave it as byte-code(Note: ActiveState has announced a compiler for Perl) 2. Absence of a standard GUI, which really fits the major platforms. For a lanuage like Python, this is really a handicap. Would I do it in Tkinter on Windows? No way. I guess that's why there are so many other independent implementations out there. There is so much fragmentation of effort here(Analogous to KDE, GNOME,...on Linux). 3. Does the community see Python as a full-fledged programming language? I remember Zope being projected as the killer app for Python. Does that mean Python is going to hide behind web servers, be yet another general/web scripting language and probably a rapid prototyping tool? I guess the language deserves a better treatment. What do you people think? Cheers, Sarat "Merry Christmas!" From dgallion1 at yahoo.com Thu Dec 6 23:02:45 2001 From: dgallion1 at yahoo.com (Darrell) Date: 6 Dec 2001 20:02:45 -0800 Subject: zope external method question... References: <9uo252$lh8$1@news.netmar.com> Message-ID: Make sure your module is in yourSite\Extensions. There are as you might imagine mailing lists on zope.org --Darrell bryder at afilias.info wrote in message news:<9uo252$lh8$1 at news.netmar.com>... > Can anyone tell me what might prevent the standard Python external methods in > Zope not to work? Specifically, no matter what I do when I try to create the > external method in the Zope UI it tells me it can't find the module. and, > this is in an environment where Perl unrestricted methods ARE working. > From issac at myfirstlink.net Fri Dec 28 04:35:57 2001 From: issac at myfirstlink.net (Issac) Date: Fri, 28 Dec 2001 03:35:57 -0600 Subject: ANNOUNCE: netdraw.py Message-ID: <002801c18f83$0de78910$6401a8c0@mojave> Here's a networked drawing program for collaborative drawing with two people. The first person to start the program runs the script with no arguments: $ python netdraw.py The second person must specify the host, unless it's just localhost: $ python netdraw.py my_friends_host.widgets.com Anything you draw on your side will show up on your friend's side and vice-versa. Issac -----%<----- #!/usr/bin/env python """ netdraw.py: not exactly a paint prog. just a networked line drawing demo version 0.0.0 paint program by dave michell. networking added by issac (Dec. 2001). """ import Tkinter,sys,socket,string,struct,thread def recv_nbytes(sock, nbytes): '''\ def recv_nbytes(sock, nbytes): Receive n bytes from the socket. _Effective TCP/IP_ p. 51 ''' count = nbytes buf = '' while count > 0: chunk = sock.recv(count) assert len(chunk) <= count count = count - len(chunk) buf = buf + chunk assert len(buf) == nbytes return buf class NetDrawApp: DEFAULT_PORT = 50007 DEFAULT_HOST = 'localhost' MAX_NUM_CLIENTS = 1 # changing this will break the code a little def __init__(self): self.set_up_socket() self.root = Tkinter.Tk() self.drawing_area = Tkinter.Canvas(self.root) self.drawing_area.pack() self.drawing_area.bind("", lambda evt, x=self: x.motion(evt)) self.drawing_area.bind("", lambda evt, x=self: x.b1down(evt)) self.drawing_area.bind("", lambda evt, x=self: x.b1up(evt)) self.b1 = "up" self.xold = None self.yold = None thread.start_new_thread(self.read_lines_from_socket, ()) def read_lines_from_socket(self): while 1: # get the next line from the socket line_rec = recv_nbytes(self.sock, nbytes = 16) x0,y0,x1,y1 = struct.unpack('iiii', line_rec) self.drawing_area.create_line(x0,y0,x1,y1,smooth=1) self.root.update() #print 'got the line and drew it' def set_up_socket(self): if len(sys.argv) < 2: self.hostname = NetDrawApp.DEFAULT_HOST else: self.hostname = sys.argv[1] if len(sys.argv) < 3: self.portnum = NetDrawApp.DEFAULT_PORT else: self.portnum = string.atoi(sys.argv[2]) self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: # if peer is already up, act like a client self.sock.connect((self.hostname, self.portnum)) print 'connected to '+self.hostname+' on port '+`self.portnum` except: print "waiting for connection on port "+`self.portnum` # peer is not up yet, so we'll just wait around like a server self.listen_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.listen_sock.bind(('', self.portnum)) self.listen_sock.listen(NetDrawApp.MAX_NUM_CLIENTS) self.sock, self.addr = self.listen_sock.accept() print 'got connection from '+`self.addr` def b1down(self, event): self.b1 = "down" # you only want to draw when the button is down # because "Motion" events happen -all the time- def b1up(self, event): self.b1 = "up" self.xold = None # reset the line when you let go of the button self.yold = None def motion(self, event): if self.b1 == "down": if self.xold != None and self.yold != None: # here's where you draw it. smooth. neat. event.widget.create_line(self.xold, self.yold, event.x,event.y,smooth=1) line_rec = struct.pack('iiii', self.xold, self.yold, event.x, event.y) #print 'sending data' try: self.sock.send(line_rec) except: print 'error sending data: ',sys.exc_info()[0] else: pass # print 'done sending data' self.xold = event.x self.yold = event.y def run(self): try: self.root.update() self.root.mainloop() except Tkinter.TclError: try: self.root.destroy() except: pass def main(): app = NetDrawApp() app.run() if __name__ == "__main__": main() --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.310 / Virus Database: 171 - Release Date: 12/19/2001 From sholden at holdenweb.com Fri Dec 21 12:00:33 2001 From: sholden at holdenweb.com (Steve Holden) Date: Fri, 21 Dec 2001 12:00:33 -0500 Subject: MimeWriter and smtplib: long list of 'To:' recipients References: <9vvks6$27qr$1@norfair.nerim.net> Message-ID: "Gillou" wrote in message news:9vvks6$27qr$1 at norfair.nerim.net... > Hi, > > My application sends mail to a list of 'To' recipients but there are > problems when the list is long. > I have no access to the Postfix error log so I dunno what's the problem. All > recipients addresses are OK. > I use the MimeWriter like this: > > fullmail = StringIO() > mw = MimeWriter(fullmail) > mw.addheader('To', 'jdoe at mailme.com, sombody at somewhere.com, > lotsofothers at lotsofdomains.com') > # Add other headers > ... > mw.endheaders() > ... > > Is there something I missed ? > Perhaps a little more information would be helpful. Is the MimeWriter library apparently formatting a correct message? If so, presumably the error occurs in smtplib? If so, can you give us the error message and traceback, plus some of the code surrounding the point of error? If everything appears to happen correctly in your Python program but you get bounce mails because some of the messages cannot be delivered (even though you are pretty sure the addresses are good) then you have an ISP-related issue, which you will typically only solve by talking with the ISP's technical support folk (assuming, that is, that they have any). regards Steve -- http://www.holdenweb.com/ From kirill at xyz.donetsk.ua Tue Dec 25 11:48:48 2001 From: kirill at xyz.donetsk.ua (Kirill Simonov) Date: Tue, 25 Dec 2001 18:48:48 +0200 Subject: national characters In-Reply-To: ; from emwoj@poczta.onet.pl on Tue, Dec 25, 2001 at 11:26:23AM +0100 References: Message-ID: <20011225184848.A706@xyz.donetsk.ua> On Tue, Dec 25, 2001 at 11:26:23AM +0100, emwoj wrote: > How can I use polish characters (cp1250) in Idle under Windows 1. Create the file "Python21/sitecustomize.py" and write: import locale, sys encoding = locale.getdefaultlocale()[1] if encoding: sys.setdefaultencoding(encoding) 2. Open the file "Python21/Lib/lib-tk/FixTk.py", remove all lines, and write: import sys, os if not os.environ.has_key('TCL_LIBRARY'): tcl_library = os.path.join(sys.prefix, "tcl", "tclX.Y") os.environ['TCL_LIBRARY'] = tcl_library 3. Open the file "Python21/Tools/idle/Percolator.py", go to the line 23. You need to insert two lines of code into the function "insert": def insert(self, index, chars, tags=None): # Could go away if inheriting from Delegator if index != 'insert': # You need to add chars = unicode(chars) # these lines. self.top.insert(index, chars, tags) 4. Open the file "Python21/Tools/idle/PyShell.py", go to the line 470. You need to add two lines: line = self.text.get("iomark", "end-1c") if type(line) == type(u""): # You need to add line = line.encode() # these lines. self.resetoutput() \Xi From hoel at germanlloyd.org Fri Dec 21 03:14:39 2001 From: hoel at germanlloyd.org (Berthold Höllmann) Date: 21 Dec 2001 09:14:39 +0100 Subject: Anyone stil using CXX Message-ID: Hello, Is there anyone out there using the CXX package for writing C++ extension for Python? I'm looking for some more examploes on the usage and for a mailinlist for sharing problems, solutions, and experiences. Cheers Berthold -- Dipl.-Ing. Berthold H?llmann __ Address: hoel at germanlloyd.org G / \ L Germanischer Lloyd phone: +49-40-36149-7374 -+----+- Vorsetzen 32/35, P.O.Box 111606 fax : +49-40-36149-7320 \__/ D-20459 Hamburg, D-20416 Hamburg From qrczak at knm.org.pl Sun Dec 9 16:59:26 2001 From: qrczak at knm.org.pl (Marcin 'Qrczak' Kowalczyk) Date: Sun, 9 Dec 2001 21:59:26 +0000 (UTC) Subject: strict python? References: <3C1060E4.756F33B2@earthlink.net> Message-ID: Fri, 07 Dec 2001 06:34:20 GMT, Hans Nowak pisze: > Well, 'self.func' is a perfectly valid Python expression, > just like '3'. Not very useful when used like this, but > still, perfectly valid. It would be easy to define Python's syntax differently, such that only some forms of expressions are valid as statements. Of course it would break compatibility. A small problem is that you can't know whether x.func has side effects: it can throw an exception if the attribute doesn't exist, and it can call a side-effecting __getattr__. But I believe that disallowing this would not be a problem if the language was designed today (you can always work around this by assigning the result to a dummy variable). -- __("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ QRCZAK From tripps81 at yahoo.com Fri Dec 21 11:33:28 2001 From: tripps81 at yahoo.com (Tripp Scott) Date: Fri, 21 Dec 2001 23:33:28 +0700 Subject: marshalling data structures between perl <-> php <-> python In-Reply-To: <15395.17467.559226.856294@12-248-41-177.client.attbi.com> References: <5.1.0.14.2.20011221164328.031b3b50@202.95.131.154> <5.1.0.14.2.20011221164328.031b3b50@202.95.131.154> Message-ID: <5.1.0.14.2.20011221232604.08995b00@202.95.131.154> At 21/12/2001 21:16, Skip Montanaro wrote: > Tripp> aside from using XML-RPC, what python module can i use to > Tripp> marshall data structures (possibly a combination of lists, > Tripp> dictionaries, and scalars of ints, floats, ascii strings, and > Tripp> null values) between these three languages? i prefer a compact, > Tripp> common binary format rather than XML. >Dunno about "common", but there is a Python version of marshal that Guido >wrote for JPython. You could translate that to Perl and PHP. I have a copy >lying about if you need it. i guess it wouldn't hurt. yes, thank you. >XML-RPC streams could also be compressed using zlib and the equivalent >libraries on Perl and PHP. That would make it both compact and binary. ;-) ah, i'm sure someone would say something to that effect :-) frequent compression-decompression might be prohibitive for my case (a simple RPC system), but it might not. i just remember SOAP and, hearing that .NET uses it a lot, and SOAP messages are yet another examples of XML documents. t From tatebll at aol.com Sat Dec 29 17:11:23 2001 From: tatebll at aol.com (Bill Tate) Date: 29 Dec 2001 14:11:23 -0800 Subject: Zope Documentation (was RE: Python Popularity: Questions and Comments) References: Message-ID: "A. Keyton Weissinger" wrote in message news:... > I have had similar experiences trying to get my head around Zope. I write > J2EE applications with a group of folks. I was expecting a Pet Shop or at > least an EJB-like spec of the lay of the land. > > If someone asked me -- someone who considers himself a huge Pythonista -- > what Zope was all about, I'd have to say I didn't have a real clue. > > Now, it just so happens that I also write on the side for O'Reilly and > others. If any of you guys at DC want to email me back, I would be happy to > help spread the gospel according to Zope/Python. But it needs to have > serious facts (comparisons between similar setups for J2EE/M$), more serious > specifications (an EJB-like container approach based in Python, for example, > would be huge -- difficult certainly, but huge), and even more serious > examples. I agree with Bill. I want to see the full thing broken into > pieces. > > Keyton Keyton, you raise a very good point. Right now, I CAN'T help even if I wanted to. I can guarantee you that the message that I would be communicating about zope would be greatly different from that espoused on zope.org. The kind of things you mention (comparisons with J2EE and MS alternatives) are precisely the kind of facts I would want plastered right where everyone can see them. Making a business case for Zope in clear, unambiguous quantitative terms that technical and non-technical people understand and want to know. I understand the "zen" thing, but it's not something that business people are going to care about when they making a decision about whether to use it or not. From craig at redtree.com Sun Dec 23 00:15:01 2001 From: craig at redtree.com (Craig Morris) Date: Sun, 23 Dec 2001 05:15:01 GMT Subject: inproc server with gordon mcmillan's installer Message-ID: <1009084826.534637@critter.monarch.net> While it seems simple to get a local com server working with Gordon McMillan's installer package, I am having trouble figuring out how to make the inproc stuff (introduced in version 5) work. I can't seem to find an example or much doc on this. If anyone could point me towards some, I would be grateful. -- Craig Morris Fernie, BC, Canada http://redtree.com From investornews at usa.net Tue Dec 4 17:19:29 2001 From: investornews at usa.net (Investor News) Date: Tue, 4 Dec 2001 17:19:29 Subject: The Best Smart Card Story You've Never Heard Message-ID: An HTML attachment was scrubbed... URL: From hgg9140 at seanet.com Sat Dec 29 20:16:28 2001 From: hgg9140 at seanet.com (Harry George) Date: 29 Dec 2001 17:16:28 -0800 Subject: How to do "ANN:"? Message-ID: A couple of times I've tried to annouce package upgrades using "ANN:" entries to c.l.p and c.l.p.a, but nothing shows up. Is there a magic decoder ring? Most recently, updates for mkpythonproj, pdx, and pyperlish. -- Harry George hgg9140 at seanet.com From henrik at moskau.hmotakef.homeip.net Mon Dec 3 13:45:31 2001 From: henrik at moskau.hmotakef.homeip.net (Henrik Motakef) Date: 03 Dec 2001 18:45:31 +0000 Subject: Finding strings with exceptions References: Message-ID: <87snasgn1w.fsf@moskau.hmotakef.homeip.net> David Brady writes: > The old class name (changed to protect the innocent) > is BarThingy. The new name is fooBarThingy. Because > the new class name contains the old one, simple > find-and-replace goes wonky. In the reverse case, I > could put something in the regex that says, "also find > an optional prefix 'foo'." But what I really want to > do is find the class everywhere EXCEPT where that > 'foo' prefix exists. Anyone know a good way to do > this? What you are looking for is called a "negative lookbehind assertion, and looks like this: >>> import re >>> re.compile("(?>> re.search("fooBarThingie") >>> re.search("BarThingie") Nice syntax, huh? hth Henrik From jlh at home.com Sun Dec 2 01:22:17 2001 From: jlh at home.com (Jeff Hinrichs) Date: Sun, 2 Dec 2001 00:22:17 -0600 Subject: How is sys.path initialized without a PYTHONPATH? References: Message-ID: <0f5101c17af9$b0bb12e0$6702a8c0@gato> Quote from http://www.activestate.com/Corporate/Events/Speeches/extensions.pdf "sys.path is the path which is traversed when looking for a module (during an import): >>> import sys >>> sys.path ['', 'h:\\David\\py', 'C:\\Program Files\\Python, ...] . '' refers to the current directory. . The search is sequential left to right until success (or end is reached) . Value at startup determined by PYTHONPATH env't variable & Registry on win32 . Can be dynamically changed: >>> sys.path.insert(0, '/home/da/python') . Special .pth files placed in key directories can modify the path as well! " ----- Original Message ----- From: "A. Keyton Weissinger" To: Sent: Saturday, December 01, 2001 11:03 PM Subject: How is sys.path initialized without a PYTHONPATH? > I am using ActiveState's ActivePython 2.1. I do NOT have a PYTHONPATH > environment variable set on my machine. When I fire up the interpreter > shell, and do the following: > > >>> import sys > >>> print sys.path > > I get the following: > > ['', 'C:\\Python21\\Pythonwin', 'C:\\Python21\\win32', > 'C:\\Python21\\win32\\Lib', 'C:\\Python21', 'C:\\Python21\\DLLs', > 'C:\\Python21\\lib', 'C:\\Python21\\lib\\plat-win', > 'C:\\Python21\\lib\\lib-tk', 'C:\\Python21\\Numeric', 'C:\\Python21\\PPM'] > > Where is the list being generated since I have no PYTHONPATH variable? Can I > configure this somehow to include more places (without having to append() to > the sys.path in the interpreter shell)? > > Thank you... > > Keyton > > > -- > http://mail.python.org/mailman/listinfo/python-list > From daniel.dittmar at sap.com Wed Dec 12 09:00:52 2001 From: daniel.dittmar at sap.com (Daniel Dittmar) Date: Wed, 12 Dec 2001 15:00:52 +0100 Subject: __getattr__ related question References: Message-ID: <9v7nul$qa1$1@news1.wdf.sap-ag.de> Use return getattr (self.component, name) instead of accessing the class dict. This will return a 'bound' method where the self parameter is already filled in. Daniel "dominikush" wrote in message news:mailman.1008160755.17684.python-list at python.org... > Dear Pythonics, > > the __getattr__ method causes me some headache. To prohibit unwanted > method calls of an object, I shield it by an interface object. So, > all method calls are addressed to the interface object. That means > the user calls > > capsuleInterface.send("Hallo") > > instead of directly calling capsule.send("Hallo"), see example > below. The __getattr__ in Port catches the call and returns the > send() method of Capsule. However, evaluating the method fails > > >>> capsuleInterface.send("Hallo") > Traceback (most recent call last): > File "", line 1, in ? > TypeError: not enough arguments; expected 2, got 1 > > Clearly, the send() method expects the arguments self and data, but > self is missing! How do I get it right? How can I add the self value > (it should be the capsule object) to the parameter list before the > method retrieved by __getattr__ is evaluated? > > Gruss > > Dominikus > > --- Example --- > > class Port: > def __init__(self,component): > self.component = component > self.methods = [] > def registerMethod(self,methodName): > self.methods.append(methodName) > def __getattr__(self,name): > if name in self.methods: > try: > return self.component.__class__.__dict__[name] > except KeyError, error: > raise AttributeError, error > raise AttributeError, name+" is not known to port" > > class CapsuleInterface(Port): > pass > > class Capsule: > def send(self,data): > print "Capsule sends",data > > capsule = Capsule() > capsuleInterface = CapsuleInterface(capsule) > capsuleInterface.registerMethod("send") > > From laz at strakt.com Thu Dec 13 06:21:15 2001 From: laz at strakt.com (Fredrik Juhlin) Date: Thu, 13 Dec 2001 12:21:15 +0100 Subject: Problems with Tkinter and menus In-Reply-To: <9v9vu2$r6g$1@norfair.nerim.net> References: <9v9vu2$r6g$1@norfair.nerim.net> Message-ID: <20011213112115.GA2366@strakt.com> On Thu, Dec 13, 2001 at 11:31:06AM +0100, Eric Brunel wrote: > Apparently, the code like you wrote it actually works on Windows, but I > remember that I had a similar problem on Linux, and it was caused by a > problem in the menu hierarchy: have you tried to create menu0 before menu1 > and create menu1 as a son of menu0, like in: > menu0 = Tkinter.Menu(root, tearoff=0) > menu1 = Tkinter.Menu(menu0, tearoff=0) > menu1.add_command(label="Foo", command=hello) > # ... > Just try it: it may solve your problem. And doing it this way still works on > Windows. This worked fine! And like so many other thing, painfully obvious once someone points it out :) Thanks a lot! //FJ From russell_turpin at hotmail.com Mon Dec 3 19:16:05 2001 From: russell_turpin at hotmail.com (Russell Turpin) Date: 3 Dec 2001 16:16:05 -0800 Subject: Embedding Python in C++ application: Question #1 Message-ID: <8a12e538.0112031616.674f37e8@posting.google.com> I'm embedding Python in a commercial C++ application, in order to provide a scripting capability. The application provide some functions that need to be surfaced on the scripting side, one of which returns a lot of data. On the Python side, this data should be received as an array of objects. (The array itself is part of a larger object, but that doesn't seem relevant here.) Thinking about how to do this, the Py_ interface presents some difficulties, though I hope this is due largely to my inexperience with it. The first problem is that it seems designed to convert a known, fixed number of values: pResult = Py_BuildValue("[(iid), (iid)]", a[0]->x, a[0]->y, a[0]->z, a[1]->x, a[1]->y, a[1]->z); That would be cool if the array always had two elements, rather than anywhere from two to a few thousand. Of course, I can iterate, but whenever I have frequent iteration over lots of things my intuition is to push the iteration as far down as practical. I would prefer to use a function, Convert(), that generates a Python tuple or object from the C++ object of which a[] is an array, and then pass this to something that builds the Python array: pResult = Py_BuildArray("O&", Convert(), a, iStart, iStop); Py_BuildArray doesn't exist to my knowledge. It would apply Convert() to each instance of a[] from a[iStart] to a[iStop], creating a Python array of the resulting Python objects. Is there something like this? Is there a better way of doing this than just iterating on Py_BuildValue()? Am I missing something obvious? All help much appreciated! Russell From duncan at NOSPAMrcp.co.uk Wed Dec 5 03:57:26 2001 From: duncan at NOSPAMrcp.co.uk (Duncan Booth) Date: Wed, 5 Dec 2001 08:57:26 +0000 (UTC) Subject: COM servers from within a Python service (on Win2k) References: Message-ID: Andrew Bennetts wrote in news:mailman.1007522528.18068.python-list at python.org: > I've searched Google, and haven't found any answers to this... > > Is it possible for a Python service to also be a COM server? The > obvious reason to do this would be to control the service via the COM > interface. Yes it is possible. > > Can anyone show me how to make this work? > I have emailed you a working example. It is a minimal service which contains a COM server. -- Duncan Booth duncan at rcp.co.uk int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3" "\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure? From dyoo at hkn.eecs.berkeley.edu Wed Dec 26 00:17:00 2001 From: dyoo at hkn.eecs.berkeley.edu (Daniel Yoo) Date: Wed, 26 Dec 2001 05:17:00 +0000 (UTC) Subject: idle References: Message-ID: : is the Python IDLE open source? If you're interested in contributing to IDLE, you might find this link useful: http://idlefork.sourceforge.net/ According to Python's copyright notice: http://python.org/doc/Copyright.html The Python (and IDLE) license is "Open Source" as defined by the Open Source Initiative. Good luck to you. From syang at xplantechnology.com Wed Dec 5 01:24:52 2001 From: syang at xplantechnology.com (Scott Yang) Date: 4 Dec 2001 22:24:52 -0800 Subject: license key validation - encryption/decryption References: Message-ID: <89f46af4.0112042224.78bbac90@posting.google.com> Rock VZ wrote in message news:... > Hi, > > I have a requirement to write a license file in XML. > The xml file will typically consist of a feature name > a "license key" to enable/disable the feature. > > How do i generate this "encrypted license key" for > different features for different customers? > > How do i validate it at the customer site that the > "key" installed is valid? > > For example: > i can have 10 features for the product and each > feature has a encrypted key to enable the feature. > > (I would be using python for coding the above.) > > thanks > Rock Hi. My situation is very similar to yours. The product that my company is developing also uses an XML based license file with the number of licenses, available packages and expiry date encoded in. I've been investigating ways to do public key cryptography in Python for a while, but with little success. I know there are modules that integrate with OpenSSL, but that's still difficult to do on Windows, which is our primary platform. In the end, we just sign the licenses using GnuPG. At the client side, the application also invokes GnuPG using pipes with status going to the standard error. It then verifies whether the signature has the right finger print before it parses the XML data... Cheers, -- Scott Yang PGP: 0xF9DCFA8C Xplan Technology Pty Ltd. Software Architect. From dalke at dalkescientific.com Sun Dec 9 03:17:17 2001 From: dalke at dalkescientific.com (Andrew Dalke) Date: Sun, 9 Dec 2001 01:17:17 -0700 Subject: raise third argument question References: Message-ID: <9uv76q$bj4$1@slb2.atl.mindspring.net> Campbell: >I don't suppose it would be possible to stick a pin in another running >thread with the raise statement and a suitable third parameter? I haven't seen any other answers, so under the hypothesis that people will correct me if I'm wrong, here's my answer... No, it isn't possible to do this. At least not this way. >My threads are all execfile()'ing bits of code written by people other >than myself, and sometimes they are not too bright about using tight >while 1: loops, and other nasties, which do not include any of the ... >Please let this be possible - i have a long-running headache :) You might do is play around with sys.settrace. This is often used for writing debuggers, as in http://www.python.org/doc/current/lib/node262.html You might be able to use it to generate an exception in the thread. That is, have the callback function get the thread id then see if it's a user function and has been called too often / run for too long. If so, call thread.exit() or whatever is appropriate for your code. Two problems with that approach might be: - I don't know if the callback is affected by threads or is even thread-safe - user code could still catch and ignore the exit exception, so at best it prevents "simple" errors. Also, that interface is being rewritten for 2.2, and the new code is called 'hotshot.' Fred Drake will present it at Python10. There is no documentation even in the current CVS about it (and what's in _hotshot.c isn't very helpful to the uninitiated). Andrew dalke at dalkescientific.com From sstory at nc.rr.com Tue Dec 25 15:32:00 2001 From: sstory at nc.rr.com (Steve Story) Date: Tue, 25 Dec 2001 20:32:00 GMT Subject: idle Message-ID: <4n5W7.104500$RE3.18654002@typhoon.southeast.rr.com> is the Python IDLE open source? From hfoffani at yahoo.com Wed Dec 26 05:46:20 2001 From: hfoffani at yahoo.com (Hernan M. Foffani) Date: Wed, 26 Dec 2001 11:46:20 +0100 Subject: Python2.2 in Linux RH7.2 - Newbie References: Message-ID: <20011226054623.236$GB@news.newsreader.com> > I don't seem able to call up tkinter. Now I am probably doing > something incorrectly. If someone could be kind enough to walk > me through this process in baby steps bearing in mind my newbie > status. Did you install python from the rpms? If so, did you download and install the tkinter rpm? A minimal program taken from Lundh's "An Introduction to Tkinter": from Tkinter import * root = Tk() w = Label(root, text="Hello, world!") w.pack() root.mainloop() Regards, -Hernan From bernie at pacific.net.hk Sat Dec 1 00:07:47 2001 From: bernie at pacific.net.hk (Bernie) Date: Sat, 01 Dec 2001 05:07:47 GMT Subject: Just started, need help! References: Message-ID: <3C0865E2.CA1A21AD@pacific.net.hk> Have you missed the ':' at the end of the if clause? (Assume you are using IDLE). Kyle Thompson wrote: > > Hi, > When I do an input command, I hit enter so I may then do the if and else > command but when I hit enter it try's to run the input command. How do I > make it not run when its being made and just run when I'm done with a part > and want to run it? > -Thanks From gmcm at hypernet.com Mon Dec 24 08:25:55 2001 From: gmcm at hypernet.com (Gordon McMillan) Date: 24 Dec 2001 13:25:55 GMT Subject: distutils problem with interdependent modules References: Message-ID: Daniel Wexler wrote: [snip] > I don't get it. How should I be segmenting my code? > I have two Python C extensions, FOO and BAR. BAR is > dependent on FOO. How should these be compiled, linked > and used together? What you're *supposed* to do is use CObjects (which basically wrap a void pointer) to pass the C-level API between them. That is, remove all *formal* dependencies of BAR on FOO. Have BAR load FOO using PyImport_Import (or one of it's kin) and then pull a CObject out of it's dict, unwrap it and use the function pointers in it. Depending on the complexity of the API, this may be as much of a PITA as using implicit loading and solving the interdependcy problems. -- Gordon http://www.mcmillan-inc.com/ From clpy at snakefarm.org Wed Dec 12 12:04:48 2001 From: clpy at snakefarm.org (Carsten Gaebler) Date: Wed, 12 Dec 2001 18:04:48 +0100 Subject: resource module broken? Message-ID: <3C178E30.D38CAD60@snakefarm.org> Hi there, if I got the docs right, the following tells me that my python interpreter doesn't consume any memory: >>> import resource >>> resource.getrusage(resource.RUSAGE_SELF) (0.069999999999999993, 0.0, 0, 0, 0, 0, 139, 482, 0, 0, 0, 0, 0, 0, 0, 0) >>> Elements 3, 4 and 5 denote the memory usage but are all zero. Can't be true, right? Regards Carsten. -- The looneys are out there - join SETI at home. From skip at pobox.com Fri Dec 21 09:23:57 2001 From: skip at pobox.com (Skip Montanaro) Date: Fri, 21 Dec 2001 08:23:57 -0600 Subject: threading.py -> winthreading.c : Some results In-Reply-To: <3C2334F0.1AF46B3C@geneva-link.ch> References: <3C2334F0.1AF46B3C@geneva-link.ch> Message-ID: <15395.17917.154444.125857@12-248-41-177.client.attbi.com> Boris> Jason Orendorff wrote: >> Condition.wait(timeout) runs 500x faster. Boris> Sounds like an oxymoron if it isn't one. Or a zen koan. Unbeknownst to most people, time runs directly in a special hardware register on most CPUs (check Appendix T of most CPU reference manuals). Compiled languages can take advantage of this and generate much faster code to check the current time. Interpreted languages like Python are forced to check the clock on the wall, so they timeout more slowly. ;-) -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From eppstein at ics.uci.edu Wed Dec 5 22:21:43 2001 From: eppstein at ics.uci.edu (David Eppstein) Date: Wed, 05 Dec 2001 19:21:43 -0800 Subject: PEP 276 Simple Iterator for ints (fwd) References: Message-ID: In article , "Delaney, Timothy" wrote: > > I meant translating > > > > for 0 <= i < 10: > > print i > > > > into > > > > i = 0 > > while i < 10: > > print i > > i += 1 > > > > There is no iterator here. > > This would not work with either the old or the new semantics of for loops. > It would mean that you would have for loops which in this one particular > case behaved differently to all other cases. That would classify as a severe > wart. I agree: if "for x in list" doesn't change subsequent iterations if you rebind x or list within the loop body, neither should "for x <= i < y" or whatever similar syntax one uses. So that means, it should construct an iterator and then act as if it were called by "for i in iterator" (I hesitate to write an explicit formula for the iterator because of difficulty getting it right when x or y may be non-integer). -- David Eppstein UC Irvine Dept. of Information & Computer Science eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/ From James_Althoff at i2.com Wed Dec 5 17:46:06 2001 From: James_Althoff at i2.com (James_Althoff at i2.com) Date: Wed, 5 Dec 2001 14:46:06 -0800 Subject: Python evangelists unite! Message-ID: Peter Milliken wrote: >Just like you can produce large programs in C++ (but I wouldn't personally >:-)) - just out of curiousity, why was the C++ version of the product >replaced by a Jython version? Too difficult/expensive to update to the new >requirements? Yes, those were factors. But actually, the market (for large, sophisticated ERP/Exchange systems) has changed pretty dramatically the past couple of years. In the early-to-mid nineties customers in this market wanted/expected C++ servers talking to Windows/MFC/C++ clients. In the late nineties the market shifted dramatically to where customers demanded Java-based servers interacting with HTML in web browsers (or Java desktop applications in some cases). Java was seen by many in this market as providing - better portability across different kinds of servers, - increased interoperability between services from multiple vendors, - better leverage of "plumbing" and advanced transaction services (using J2EE containers), - better productivity, reliability, and subsequent lower cost of ownership, among other things. This market today is nearly 100% Java. C++ based products don't sell anymore (again in this specific market). >Any ideas of what the maintenance costs of the C++ version were in >comparison to any other language? Was the Jython version cheaper, more >expensive or the same in terms of productions costs as the C++ version? I don't have accurate measures but most of the developers here believe that our new Java/Jython-based system yielded 5X to 10X productivity increases in development over the equivalent/previous C++ system and that the maintenance ratio is at least as good. >What were the problems encountered by the various teams using Jython? It has >always interested me what the selection process is in choosing a language >for a project - do you know how and why Jython was chosen? Was it because of >popular aclaim or was some formal comparision of various languages >performed? If there was some formal selection process, what languages were >considered? What features of Jython caused it to be selected? i.e. what >features where missing in the other languages under consideration. The biggest problem with using Jython was convincing the team to use it. My experience is that developers are very interested (with good cause ;-) in populating their resumes with experience that is directed at the center of the market. At the time we started this new technology our C++ developers were far more interested in putting Java on their resumes than Python. Since I was the CTO and Senior VP of development, though, I basically dictated the choice of Jython. Of course, to be fair, I sold the concept by first developing (with my own rusty hand) a prototype system in a month that amazed and dazzled all the C++ developers. They were astonished to see that such a system could be created by one (old and cranky ;-) person in such a short amount of time. The other factor that helped in our case was the fact that the technology -- by market demand -- had to be Java *and* we were convinced that we needed a scripting language as part of our technology. I sold Jython as being the best possible scripting language for Java. The reason *I* was sold on Jython was because of its being a complete, dynamic (not statically type-checked), OO language that interfaced seamlessly with Java. I like to view Jython/Python as a "high-level, application language" and Java as a "low-level, systems language". :-) Jim From mwh at python.net Wed Dec 12 08:07:38 2001 From: mwh at python.net (Michael Hudson) Date: Wed, 12 Dec 2001 13:07:38 GMT Subject: Import random References: Message-ID: "Daniel Pote" writes: > Hi, > > Just joined this group after trying to compile mailman on HP-UX 11.00. > It seems to be something wrong when trying to import random. > > Compiling /opt/mailman/Mailman/versions.py ... > Traceback (most recent call last): > File "bin/update", line 31, in ? > from Mailman import Utils > File "/opt/mailman/Mailman/Utils.py", line 32, in ? > import random > File "/opt/python/lib/python2.1/random.py", line 93, in ? > _verify('NV_MAGICCONST', 1.71552776992141) > File "/opt/python/lib/python2.1/random.py", line 88, in _verify > raise ValueError( > ValueError: computed value for NV_MAGICCONST deviates too much (computed 0, expe > cted 1.10415e+09) > > Same result if i run python and types: import random > > Can anyone help me on this ? > > I have installed python 2.1 package from hpux.connect.org.uk Someting is very, very wrong somewhere. What happens if you type >>> from math import exp, sqrt >>> 4 * exp(-0.5)/sqrt(2.0) into the interpreter? Cheers, M. -- Two decades later, well-known hacker Henry Spencer described the Perl scripting language as a "Swiss-Army chainsaw", intending to convey his evaluation of the language as exceedingly powerful but ugly and noisy and prone to belch noxious fumes. -- the jargon file From chrishbarker at attbi.com Mon Dec 10 13:28:13 2001 From: chrishbarker at attbi.com (Chris Barker) Date: Mon, 10 Dec 2001 10:28:13 -0800 Subject: lost interest? References: <20011208001123.A5989@casa.parque> Message-ID: <3C14FEBD.AD52B516@attbi.com> Justin Sheehy wrote: > I'd ask a different question from yours. Why is it a problem that > Python doesn't have an equivalent to CPAN? "Perl has it" isn't > enough. In order for a number of people to put time and work into > this, it has to pose enough of a problem in its absence that those > people will have real motivation to make it happen. A big problem I have seen is people not wanting to use exactly the module they really nedd because it is "not part of the standard distirubion". If it was a whole lot easier to find, get and install third-party packages, perhaps this concern would go away. I am working on a program with Python right now. When we upgraded to 2.1, we had to find and install: Python, Numeric, mxDateTime, PIL, and wxPython. On both Linux and Windows machines. I would have been a whole lot happier it I could have gotten all that from one place! By the way, where can I find info about Siphon? -Chris -- Christopher Barker, Ph.D. ChrisHBarker at attbi.net --- --- --- ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From loewis at informatik.hu-berlin.de Fri Dec 28 12:54:22 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 28 Dec 2001 18:54:22 +0100 Subject: REPOST: Re: Two languages, too similar, competing in the same space. References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> Message-ID: <9$--$$_-----$$%%_$@news.noc.cabal.int> Ron Stephens writes: > I feel that Ruby is so similar in design, purpose, and objectives to > Python, that it competes directly with Python for developers' mind > share. I think it competes with Perl much more than with Python, if for no other reason that there are probably more Perl developers out there than Python developers. > And I like and respect Matz and the whole Ruby community. I wish them well. > But I recognize that their success may, on the margins at least, slow down > Python. Python is a programming language, so it does not have, in itself, "speed", meaning it cannot be slowed down. Perhaps you meant that it will decrease the growth rate of the number of Python developers world-wide. That is hard to find out, as there are two many other factors involved, and because it is difficult to find out how things would have developed without Ruby. Perhaps ypu meant that the rate in which Python releases appear will be affected, or the rate in which changes are made to Python. I do not think this is true. People contributing to Python development are unlikely to switch to Ruby, since they have already invested quite some time into that project, which they might consider lost if they switch to another language. Regards, Martin ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Martin von Loewis Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:11:58 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775182 27193 211.57.49.2 (31 Dec 2001 05:06:22 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:06:22 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From tim.one at home.com Sun Dec 9 11:47:14 2001 From: tim.one at home.com (Tim Peters) Date: Sun, 9 Dec 2001 11:47:14 -0500 Subject: Calling a generator multiple times In-Reply-To: Message-ID: [Steven Majewski] > ... > And when you use these generators in a for loop, they two bits of > confusion seem to cancel each other out. "for i in g(10):" really > behaves just like it's definition. I'm guessing that this fact > was one of the selling points for this syntax -- that if you didn't > look under the hood and just USED them, they would not be confusing. Yes it was, just as the low-level details of __getitem__ and IndexError in the pre-2.2 iteration protocol remain blissfully unknown to most Python programmers. The driving force in both cases was to make "for ... in ..." work smooth as phlegm on a brass doorknob, despite that phlegm and brass doorknobs aren't all that attractive in isolation . > I'm not sure that supposition has been born out, but they do get > less confusion with use. All evidence to date says people learn how to use generators in the for-loop context easily. If they're going to use .next() explicitly, then they have some conceptual work to do -- even if they're not mucking with generators. > Perhaps it would be better to spend another keyword, along with > 'def' and 'class' , to distinguish 'generator factories'. In practice, starting the docstring with "Generate ..." instead of "Return ..." is clear enough. > ... > Generators, functions and methods are just slight variations on each > other. Absolutely. People should consider *all* callable objects in 2.2 to be generators -- it's just that if the body doesn't contain "yield", then the language helpfully calls .next() once for you by magic . From mwh at python.net Mon Dec 10 06:07:38 2001 From: mwh at python.net (Michael Hudson) Date: Mon, 10 Dec 2001 11:07:38 GMT Subject: Most popular Python modules/extensions? References: Message-ID: Gerhard H?ring writes: > Le 08/12/01 ? 04:01, Robert Feldt ?crivit: > > Hi, > > > > Are there any stats on the most popular/downloaded Python > > extensions/modules? Any info relating to this appreciated. > > Difficult. Sourceforge has download statistics: > http://sourceforge.net/foundry/python-foundry/ > > I'd bet that mxDateTime, part of the mxExtensions is the single most > popular download, because it's needed by almost every database module. Mmm, maybe. NumPy is another that is probably used by an awful lot of people (who probably don't hang around here, by and large). Cheers, M. -- But since your post didn't lay out your assumptions, your goals, or how you view language characteristics as fitting in with either, you're not a *natural* candidate for embracing Design by Contract <0.6 wink>. -- Tim Peters, giving Eiffel adoption advice From paul1brian at yahoo.com Tue Dec 4 13:56:59 2001 From: paul1brian at yahoo.com (Paul Brian) Date: Tue, 4 Dec 2001 18:56:59 -0000 Subject: Using Pythonwin as ASP editor Message-ID: <1007492220.13392.0.nnrp-07.c1c3e1d9@news.demon.co.uk> Dear all, I am using Pythonwin as an editor for occasional ASP pages (I know I know, but I am trying to cut down). Unfortunately something in its default formatting of text makes it underline in squiggly red and green all the Python code encapsualted in <% %> Does anyone know how to stop it doing that - the formatting tool under "Edit/options" just does not seem to have the right options and I have only ever glanced at Scintilla and have no idea where the config files for it are in Pythonwin. The docs do not seem to point it out. I expect I am just missing something very obvious, but would be grateful for any how to on making it format how I like. Cheers P Brian From nospam at bigfoot.com Tue Dec 11 12:09:53 2001 From: nospam at bigfoot.com (Gillou) Date: Tue, 11 Dec 2001 18:09:53 +0100 Subject: Hi All References: <3C162B65.27E6B107@hongkong.com> Message-ID: <9v5e86$2fn2$1@norfair.nerim.net> Welcome in our sect ! From kseehof at neuralintegrator.com Wed Dec 5 13:33:35 2001 From: kseehof at neuralintegrator.com (Ken Seehof) Date: Wed, 5 Dec 2001 10:33:35 -0800 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <23891c90.0112040300.77f64f8e@posting.google.com> <23891c90.0112050738.60ed8b25@posting.google.com> Message-ID: <00b601c17dbb$971b7540$eb4bb43f@kens> I'm pretty sure everything that can be said about tabs has been said. In fact there's probably enough material for a book or two: "A Concise History of Tab Usage", or "Professional Tabulation and Indentation Strategies for Python Programmers", or maybe "Tab Usage for Complete Idiots". I am promoting some new legislation that is currently being considered in Congress. The new law will require that all programming languages must treat the tab character as a syntax error by June 2004. Some details have not yet been resolved, such as whether or not to permanently remove tab from the new ASCII standard (this would have the side effect of decrementing the ordinal values of all characters after 9). It is estimated that this will save the computer industry several billion dollars worth of programming time every year. Most of the savings are expected to be due to decreased newsgroup volume on tab related topics. For example, it is estimated that the total time spent by everyone on this newsgroup reading this message is approximately 182 hours and 27 minutes that could have been spent programming, or $21,894.00. When you take into consideration all programming languages that permit hard tabs, there are thousands of useless messages just like this one every week! Ken Seehof kseehof at neuralintegrator.com www.neuralintegrator.com From woodsplitter at rocketmail.com Sun Dec 30 01:00:58 2001 From: woodsplitter at rocketmail.com (stalin) Date: 29 Dec 2001 22:00:58 -0800 Subject: REPOST: Re: values of sys.platform? for a serial port lib References: Message-ID: <4$--$$_----__%$%-$@news.noc.cabal.int> Chris Liechti wrote in message news:... > i've written a portable serial port library. it runs now on linux and win32 Are you aware of Isaac Barona's Universal Serial Port Python Library? http://balder.prohosting.com/ibarona/en/python/uspp/uspp_en.html Isaac says on his web page: """ I started looking for Python modules to access serial port and I found the following projects: * win32comport_demo from the win32 extension module * win32comm module of wheineman at uconect.net * Sio Module of Roger Rurnham (rburnham at cri-inc.com) * pyxal (Python X10 Abstraction Layer) of Les Smithson (lsmithson at open-networks.co.uk) but they were not multi-platform, were just a wrap of propietary libraries or were just simple examples of serial port access. """ How do the design goals of your library differ from USPP? How do you intend to license it? USPP uses the IMHO restrictive GPL. Disclaimer: I've never used USPP. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: woodsplitter at rocketmail.com (stalin) Newsgroups: comp.lang.python Subject: cmsg cancel <7876a8ea.0112292200.593d01e8 at posting.google.com> Control: cancel <7876a8ea.0112292200.593d01e8 at posting.google.com> Date: Mon, 31 Dec 2001 01:34:00 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774358 27193 211.57.49.2 (31 Dec 2001 04:52:38 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:52:38 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From loewis at informatik.hu-berlin.de Fri Dec 28 18:37:56 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 29 Dec 2001 00:37:56 +0100 Subject: mod_python and threads References: Message-ID: "Achim Domma" writes: > I'm playing around with mod_python and I like it, but I don't understand how > it handles multiple threads. I think apache holds a pool of threads to > handle request, so what happens if mod_python uses only one subinterpreter > per virtual server ? That depends on the Apache version, the operating system, and the configuration. To my knowledge, on Unix, Apache 1.3 will not use threads. > Are request handled in a serial way or do I have to write threadsafe > code ? Depends too much on the system you are using to answer this question. Regards, Martin From travis at vaught.net Mon Dec 17 14:03:42 2001 From: travis at vaught.net (Travis N. Vaught) Date: 17 Dec 2001 11:03:42 -0800 Subject: Scientific Libraries in Python References: Message-ID: Horatio Davis wrote in message news:... > It's probably about time this thread moved off the general Python list to > some place more specialized. As soon as the scipy.org people unstick their > list server and let me successfully subscribe (hint, hint) I'll try there. > > Cheers, > > Horatio Should be unstuck now...thanks for everyone's patience. From fperez528 at yahoo.com Sat Dec 15 09:03:52 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Sun, 16 Dec 2001 13:31:52 +2328 Subject: Take 2: PEP draft for expression embedding References: Message-ID: <9vj0eq$593$2@peabody.colorado.edu> Oren Tirosh wrote: > I was wondering what 'way' you are referring to so I searched for your > previous postings and found the nice little i() function. It's a pity that > it almost got lost amidst all the noise and flames. I guess I can live with > an overhead of 4 characters per embedded expression. It is readable, > compact and thankfully does not make use of eval() hacks like the Itpl > module. Sorry for being lazy, but since you've already done the search homework, would you mind pointing to Frederik's post on i()? I've never seen it and I'm quite intrigued. thanks, f From dlNONNSPAMrubin at yahoo.com Thu Dec 20 01:17:21 2001 From: dlNONNSPAMrubin at yahoo.com (Daniel) Date: Wed, 19 Dec 2001 22:17:21 -0800 Subject: Importing modules for cgi's Message-ID: <3C218270.C331131E@yahoo.com> Hi, I installed a database api module in python and added the path to my PYTHONPATH. In order for my cgi to work, though, I have to invoke my cgi from a shell script that first sets the PYTHONPATH so the module will be foud when the cgi runs. Is there a simpler way? I'd prefer not having to have the shell script. Is there a way for python to always know about my module without using PYTHONPATH? Another thing I tried that doesn't work is modifying sys.path at the start of the cgi script. It seems that this has to be set (via the shell script) before the cgi script starts. Thanks, Daniel From ryan.phillips at csus.edu Fri Dec 28 16:19:55 2001 From: ryan.phillips at csus.edu (Ryan Phillips) Date: 28 Dec 2001 21:19:55 GMT Subject: REPOST: Re: Authentication, urllib, and httplib... References: Message-ID: <3$--$$_----_---_$$@news.noc.cabal.int> This should help: http://www.zope.org/Members/peterb/http_auth -Ryan "Vincent A. Primavera" wrote in message news:mailman.1009571133.29349.python-list at python.org... > Hello, > Trying to write a program to pull several Excel format reports off of a > website which we at my company are spending alot of time on doing > manually once a week. The page has a form with several fields to be > filled in before submitting. Here's the problem, I can access the page > with urllib's urlopen() but not with httplib's HTTPConnection.request() > as I am getting a 401 Authorization Required error. How can I be > prompted for the user and password info as I am with urlopen()? Or > better yet pass these parameters? > > Thanks in advance, > Vincent A. Primavera > > P.S. I have all of the necessary field names with exception to the > username and password... > > ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Ryan Phillips" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:29:40 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775047 27193 211.57.49.2 (31 Dec 2001 05:04:07 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:04:07 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From phd at phd.pp.ru Mon Dec 3 04:25:50 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Mon, 3 Dec 2001 12:25:50 +0300 Subject: a long shot -> sending output to a browser question In-Reply-To: <39510D193FE46F2C.E86A8069386D11D6.8E418F956E3B5E03@lp.airnews.net>; from claird@starbase.neosoft.com on Sun, Dec 02, 2001 at 09:27:20PM -0600 References: <28d73ad6.0112011316.25e17eb2@posting.google.com> <834rnasdnm.fsf@panacea.canonical.org> <39510D193FE46F2C.E86A8069386D11D6.8E418F956E3B5E03@lp.airnews.net> Message-ID: <20011203122550.C2490@phd.pp.ru> On Sun, Dec 02, 2001 at 09:27:20PM -0600, Cameron Laird wrote: > "Multipart" is another answer. Netscape browsers > (but no others, ever?) arguably conformed to standards It is called "server push", and many browsers support it. Even M$IE had support for server push, but lost it not so long ago. Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From sh at hob.cx Wed Dec 19 07:55:10 2001 From: sh at hob.cx (Sean Holdsworth) Date: Wed, 19 Dec 2001 12:55:10 +0000 Subject: Optimization of an RE substitution References: Message-ID: On Wed, 19 Dec 2001 11:13:46, Duncan Booth wrote: >sh at hob.cx (Sean Holdsworth) wrote in news:slrna20tbt.2o4.sh at elf.hob.cx: > >> Then I remembered that I'm supposed to be handling 8 bit clean data... >> I realise that even if I come up with a more efficient method of >> doing this I'll still have to use a modified version of smtplib but >> I'd be interested to hear people's suggestions and comments. > >Doesn't this have the effect you want: > msg = string.replace(msg, '\r\n', '\n') > msg = string.replace(msg, '\r', '\n') > msg = string.replace(msg, '\n', '\r\n') Hi Duncan, Er... yes! Now why didn't I spot that earlier? I guess I was too fixated on the idea of converting all line breaks into some sort of token and then converting back, to realise what the obvious token should be. I'll do some more timing but I think that might solve the problem. Thanks, Sean From zhangsc at neusoft.com Sun Dec 16 21:34:35 2001 From: zhangsc at neusoft.com (=?gb2312?B?1cXJ2bPb?=) Date: Mon, 17 Dec 2001 10:34:35 +0800 Subject: How to kill Zombie process? Message-ID: <026b01c186a3$5e10b8f0$4301010a@sky> When I use ret=os.fork(),it will create a parent process and child process,when child process exists,it will creaet a Zombie process,How to kill it in parent's process? For example: udpSerSock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) while 1: message=recvfrom(BUFSIZ) ret=os.fork() if ret==0: udpSerSock.close() ip=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) #something deal .... ip.close() break #ps -a I will find a Zombie process 5463 pts/3 00:00:01 python 5465 pts/3 00:00:00 python #Zombie process How to kill it? Any ideas will be appreciated,Thanks! Edward -------------- next part -------------- An HTML attachment was scrubbed... URL: From pj at sgi.com Sat Dec 8 00:58:32 2001 From: pj at sgi.com (Paul Jackson) Date: 8 Dec 2001 05:58:32 GMT Subject: list comprehensions to effect visitors References: <3C1162D5.570DCEC6@engcorp.com> <9uro8u$ec0q0$1@fido.engr.sgi.com> <3C11852A.AD2709BE@engcorp.com> Message-ID: <9usa68$edb0s$1@fido.engr.sgi.com> |> I'm quite possibly overly sensitive ... That, or I'm underly sensitive. Heaven knows. -- I won't rest till it's the best ... Manager, Linux Scalability Paul Jackson 1.650.933.1373 From greg at cosc.canterbury.ac.nz Mon Dec 3 00:38:45 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Mon, 03 Dec 2001 18:38:45 +1300 Subject: Draft PEP: string interpolation with backquotes References: <9ueh23$9e8$1@peabody.colorado.edu> <9uern5$hbk$2@peabody.colorado.edu> Message-ID: <3C0B0FE5.2B173246@cosc.canterbury.ac.nz> Fernando P?rez wrote: > > phil hunt wrote: > > >> > >> "x is $x, f(x) is $f(x)" > >> > >>This to me is readable, unambiguous and very useful. > > > > To me it implies the same as: > > > > "x is %(x)s, f(x) is %(f)s(x)" % { 'x': x, 'f': f} > > > No. $_whatever_ means: fully evaluate _whatever_, as far as it can be > evaluated, Um, in that case, "x is $x, f(x) is $f(x)" would mean the same as "x is %s is %s" % ((x, f(x)), f(x)) which I don't think is quite what was intended. Also, what is the parser supposed to make of things like $"x is $x & y is $y" ? Is it supposed to be smart enough to realise that it has to stop after "x" and not try to interpret the rest as an '&' operator followed by a variable followed by an 'is' operator followed by a syntax error? I think that "as far as it can be evaluated" is too fuzzy a specification. Even if the parser can be taught to understand exactly what it means, I'm not sure that humans can... -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From johnroth at ameritech.net Sat Dec 8 10:07:50 2001 From: johnroth at ameritech.net (John Roth) Date: Sat, 8 Dec 2001 07:07:50 -0800 Subject: lost interest? References: Message-ID: "Walter Moreira" wrote in message news:mailman.1007781383.30878.python-list at python.org... > Hi. > > I've been reading some of the catalog-sig archives and I wonder why the > interest of the community about something like CPAN is so small. When a > message about this thing pops up in c.l.py, it receives only one or two > answers and the thread dies, and in catalog-sig usually happens something > similar. What's the difference between the Vaults of Parnassus and CPAN? I can usually find what I want on the Vaults. John Roth From tundra at tundraware.com Tue Dec 11 00:10:02 2001 From: tundra at tundraware.com (Tim Daneliuk) Date: Tue, 11 Dec 2001 05:10:02 GMT Subject: Populating a list References: <32c382ad.0112091404.6cfe4a56@posting.google.com> <3C154077.CA89133B@tundraware.com> <3C159023.D2D6F681@tundraware.com> Message-ID: <3C159483.FF112BFB@tundraware.com> Tim Daneliuk wrote: > > Tim Daneliuk wrote: > > > > mlorfeld wrote: > > > > > > I am new to python (about 72 hours into learning), and am having > > > problems with reading a file (sate abbreviations) with one item per > > > line and populating each line into a list. The problem is that each > > > item ends with \012 after each state ie WI\012. > > > > > > Here is the code that I am using: > > > > > > f=open('/home/mlorfeld/states.txt', 'r+') > > > states=f.readlines()#populates a list from file > > > f.close > > > print states > > > > I think the following works portably so you do not have to fiddle w/ EOL > > conventions: > > > > f=open("xxx.txt") > > x=f.read().splitlines() > > f.close() > > > > x is now populated with the content of the line regardless of how it ends > > (or at least this works on a FreeBSD system using a WinDoze text file). > > > > Whoops, this does NOT achieve the desired effect on Win32. The second > line should instead be: > > x=f.read().split("\n") Oh, never mind, the original version does work - I fatfingered the test code... Sigh. The modified version does work, but is limited to DOS type text files, whereas the original version does appear to be platform neutral. ------------------------------------------------------------------------------ Tim Daneliuk tundra at tundraware.com From rnd at onego.ru Sun Dec 2 07:49:20 2001 From: rnd at onego.ru (Roman Suzi) Date: Sun, 2 Dec 2001 15:49:20 +0300 (MSK) Subject: url-string transformation: from relative to absolute In-Reply-To: <20011202134114.A12397@blackscarab> Message-ID: On Sun, 2 Dec 2001, cruciatuz wrote: >it's a little bit embarassing to ask this question, but ... :( > >Question: >I got a little script for fetching news from a website (attached) >My problem is that the links in the fetched site are all relative. >example: > > >i want to prepend: >http://www.pro-linux.de/ > >not a very complicated thing, i know. but i couldn't figure out HOW. >anybody knows a solution? function urlparse.urljoin() Sincerely yours, Roman Suzi -- _/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/ _/ Sunday, December 02, 2001 _/ Powered by Linux RedHat 6.2 _/ _/ "Old MacDonald had a computer with an EIE I/O" _/ From db3l at fitlinxx.com Thu Dec 13 15:10:26 2001 From: db3l at fitlinxx.com (David Bolen) Date: 13 Dec 2001 15:10:26 -0500 Subject: popen3 on windows and interactive subprocesses References: Message-ID: bsturk at news.rcn.com (Brian Sturk) writes: > I have a script that is run from within the editor vim. It uses > popen2.popen3 to run cmd.exe. I then grab stdout and submit commands > to it via stdin. It works pretty well right now except for one thing. > When I spawn an *interactive* process, like ftp or cleartool I no longer > see anything on stdout after it's launched. Is this possibly because > the app is writing directly to the win32 console? Any help/ideas greatly > appreciated. It depends on the application. It could be that it is writing directly to the console, but it could also just be that it is buffering its output since it is no longer talking directly to a console. Interactive applications often show this quickly because they print a prompt, but no newline, and then wait for input. The lack of newline prevents line buffering from flushing that line. You'll see this issue even with Python itself unless you manually specify non-buffered with '-u' on the command line. I don't know of a good way under Windows to defeat this unless the application has such an option. Under Unix, you can use something like a pty to make the application think it's actually talking to a terminal although doing so portably across systems can be a black art mastered by few (such as 'expect'). -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l at fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/ From just at xs4all.nl Thu Dec 13 03:11:10 2001 From: just at xs4all.nl (Just van Rossum) Date: Thu, 13 Dec 2001 09:11:10 +0100 Subject: distutils, shared libraries and Mac OS X References: <3C17C2B5.8060607@avaquest.com> Message-ID: <3C1864A2.285103F0@xs4all.nl> Matthew King wrote: > > Hi. I was just installing Sketch on Mac OS X 10.1.1 and ran into the > following problem with Python 2.1.1 distutils. > > Shared libraries on OS X have the .dylib extension and because of this > find_library_file() was failing to find my tcl/tk libraries... > > As a fix, in distutils/unixccompiler.py I made the following change: > > 76c76,78 > < > --- > > import sys > > if sys.platform[:-1] == "darwin": # Mac OS X > > shared_lib_extension = ".dylib" > > this worked, but I'm curious if there was a better way to do it? > > any advice would be appreciated. Ask your question on the MacPython list, there are more people there that might be able to help. Tkinter support on OSX is still experimental, so I don't think it'll be easy. Just From wpmelcher at snet.net Thu Dec 13 11:13:11 2001 From: wpmelcher at snet.net (Bill Melcher) Date: Thu, 13 Dec 2001 16:13:11 GMT Subject: Problems with Tkinter and menus References: <9v9vu2$r6g$1@norfair.nerim.net> Message-ID: <7s4S7.3800$uR5.1208563727@newssvr10.news.prodigy.com> I am running Python 2.1.1 under Win98 and tried: import Tkinter def hello(): print "hello!" root = Tkinter.Tk() menu0 = Tkinter.Menu(root, tearoff=0) menu1 = Tkinter.Menu(root, tearoff=0) menu1.add_command(label="Foo", command=hello) menu1.add_command(label="Bar", command=hello) menu0.add_command(label="Command 1", command=hello) menu0.add_cascade(label="Menu 1", menu=menu1) frame = Tkinter.Frame(root, width=200, height=200) frame.pack() def showMenu(event): menu0.post(event.x_root, event.y_root) frame.bind("", showMenu) Tkinter.mainloop() No hello, no menus and no errors reported. The origional version posted by Fredrik Juhlin showed the same behavior. Any ideas? -- Cheers, Bill TANSTAAFL! From LLoeffler at home.com Thu Dec 6 11:42:32 2001 From: LLoeffler at home.com (Luke) Date: Thu, 06 Dec 2001 10:42:32 -0600 Subject: Is it possible to kill a thread ? References: <9unnfb$6fp$1@wanadoo.fr> Message-ID: <3C0F9FF8.60207@home.com> I think you may want to set the thread as a daemon thread, so when it is the only thread left running, it will automatically stop. From the documentation: "The entire Python program exits when no active non-daemon threads are left. " From eeskoe at yahoo.com Sun Dec 16 21:35:12 2001 From: eeskoe at yahoo.com (Erika Skoe) Date: Sun, 16 Dec 2001 20:35:12 -0600 Subject: dictionary viewer References: Message-ID: <9vjlc3$kcq$1@news.doit.wisc.edu> thanks, and thanks to Fred L. Drake, Jr. "Michal Wallace" wrote in message news:mailman.1008537920.3637.python-list at python.org... > On Sun, 16 Dec 2001, Erika Skoe wrote: > > > are there any tools for viewing a dictionary and its contents in some > > formatted form? i have pickled dictionaries which are made of several > > layers of nested dictionaries, and would like a way to view the whole thing > > at once. > > > check out the standard pprint module. > > Cheers, > > - Michal http://www.sabren.net/ sabren at manifestation.com > ------------------------------------------------------------ > Give your ideas the perfect home: http://www.cornerhost.com/ > cvs - weblogs - php - linux shell - perl/python/cgi - java > ------------------------------------------------------------ > > From shalehperry at attbi.com Wed Dec 12 19:55:31 2001 From: shalehperry at attbi.com (Sean 'Shaleh' Perry) Date: Wed, 12 Dec 2001 16:55:31 -0800 (PST) Subject: Sorting things into bins In-Reply-To: <20011213002503994.AAA248@mail.climatedata.com@SUEW2000> Message-ID: Does this point you in the right direction? >>> s = '0102' >>> s[-2:] '02' From kragen at pobox.com Sun Dec 2 04:33:39 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 02 Dec 2001 04:33:39 -0500 Subject: variable scoping across imports? References: <7b408077.0112010826.47a6a758@posting.google.com> <3C093C3F.10AB6FF0@earthlink.net> <83adx2sela.fsf@panacea.canonical.org> Message-ID: <83g06uq83w.fsf@panacea.canonical.org> "Fredrik Lundh" writes: > when you run "python x.py", that script runs in the > __main__ namespace. Oops, I didn't make the connection that x.py was also __main__. I guess I should try not to post so late. Thanks. From sag at hydrosphere.com Wed Dec 19 11:44:06 2001 From: sag at hydrosphere.com (Sue Giller) Date: Wed, 19 Dec 2001 09:44:06 -0700 Subject: Transpose of 1 element array in COM object crashes python Message-ID: <20011219164200916.AAA275@mail.climatedata.com@SUEW2000> I am getting a COM error when I try to transpose a 1 element array from within a COM object. The array is created by subclassing UserArray. After the error, the application crashes and causes PythonWin to die. My questions are: why can't I get the transpose to work in a COM situation, even tho it will work from the interactive window, and, even if I cant' do this, why would the exception cause everything to die? I know that transposing a 1 element array is silly, but in the code I could be transposing an array of any size, it just happens to be 1 element in this case. It all works fine for arrays of > 1 element. While I could special case for a 1 element case, I would expect things to work for this, and am wondering if there are other caveats out there to worry about. The data in the array just before the transpose is: year: value: 1791045.0 shape: (1,) The code is: try: data = Numeric.transpose(year) except: raise #data = [0] I had been setting it to this, but things crashed with no information, so I put in the raise to figure out what's going on The error raised is: com_error: (-2147352567, 'Exception occurred.', (0, 'Python COM Server Internal Error', 'Unexpected Python Error: exceptions.ValueError: invalid axis for this array', None, 0, - 2147467259), None) After this, everything dies. I'm using Python '2.1.1 (#20, Jul 20 2001, 01:19:29) [MSC 32 bit (Intel)]', Numeric 20.2.0 From info at pythonware.com Wed Dec 12 09:02:07 2001 From: info at pythonware.com (PythonWare) Date: Wed, 12 Dec 2001 15:02:07 +0100 Subject: ANN: PythonWorks Pro 1.3 Message-ID: <04f001c18315$9fa90290$0900a8c0@spiff> a pythonware newsflash: Secret Labs AB has released a new, much improved version of their integrated development environment for Python. PythonWorks is a rapid application development tool, designed for efficient development in Python. PythonWorks includes editors, a debugger, a user-interface design tool, project browser, deployment tools, integrated on-line help, and a scriptable environment. PythonWorks is well suited to many tasks, including: + Prototyping of user interfaces and full applications + Building test frameworks + Rapid development and deployment of complete applications + Cross-platform system administration (system automation) New features in 1.3 include Python 2.1.1 as internal run environment, expanded Jython/JPython support, automatic external run environment generation, greatly improved layout editor, pad splitting, numerous editor enhancements, new built-in functions (pychecker, diff, etc), new dialogues for project management, speed improvements, and a whole host of other refinements! An online version of Fredrik Lundh's "The Standard Python Library" is included in the PythonWorks Pro 1.3 help system. To learn more, visit the PythonWorks product site at: http://www.pythonware.com/products/works/ You can also mail us at info at pythonware.com regards, the pythonworks team From mhammond at skippinet.com.au Thu Dec 20 18:00:17 2001 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 20 Dec 2001 23:00:17 GMT Subject: age of new pythonistas [was: The Editor Poll results are in!] References: <3bfd7f87@news.airtel.net> <9u4cbu$2ts$1@news.xmission.com> <9udn1g$64c$1@brokaw.wa.com> <3c224f96.865756852@wa.news.verio.net> Message-ID: <3C226D85.1080308@skippinet.com.au> Bengt Richter wrote: > On Sun, 2 Dec 2001 09:05:52 -0800, "Alan Winston" wrote: > > >>>it'd also be cool to see the relative age of new pythonistas -- I suspect >>>that they're young, but this is completely unfounded. >>> >>51 here. >> >> > What I wonder about is the dev group, starting with Guido and Tim ;-) Guido is a few years older than me, and Tim a few years older than him :) But-my-age-is-secret ly, Mark. From freebird317 at hotmail.com Fri Dec 28 15:29:50 2001 From: freebird317 at hotmail.com (~Jason~) Date: Fri, 28 Dec 2001 20:29:50 GMT Subject: REPOST: Help with TCL Message-ID: <8$--$$_----_-$%_$$@news.noc.cabal.int> I am trying to learn programming. I am running XP Pro. and when I try to run tcl I get the following error [File"",line 1, in ? tclsh80 nameerror: name tclsh80' is not defined] why am I getting this error and how do I correct it. I even changed it to tclsh83 which is what the folder says my version is. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If GOD be for us, who can be against us? ~ Romans 8:31~ Jason Lehman freebird317 at hotmail.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "~Jason~" Newsgroups: comp.lang.python Subject: cmsg cancel <2D4X7.19180$uM.182933 at rwcrnsc54> Control: cancel <2D4X7.19180$uM.182933 at rwcrnsc54> Date: Mon, 31 Dec 2001 01:57:21 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775083 27193 211.57.49.2 (31 Dec 2001 05:04:43 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:04:43 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From news at davidglasser.net Fri Dec 28 12:49:03 2001 From: news at davidglasser.net (David Glasser) Date: Fri, 28 Dec 2001 12:49:03 -0500 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <1008303437.718558@cswreg.cos.agilent.com> <9vbvi5$cm0$1@peabody.colorado.edu> <7xhequjsgl.fsf@ruckus.brouhaha.com> <9vc581$g0h$1@peabody.colorado.edu> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> <9vruil$ipm$1@peabody.colorado.edu> <7xlmfxvbx7.fsf@ruckus.brouhaha.com> <3dbsgt7f0e.fsf@ute.mems-exchange.org> <7xheqkr05q.fsf@ruckus.brouhaha.com> <7xy9jwozuo.fsf@ruckus.brouhaha.com> Message-ID: <1f54m7x.dx3fy7122k534N%news@davidglasser.net> Paul Rubin wrote: > I haven't used it in my own code. Some of the Red Hat configuration > scripts use it. I found that out when I installed Python 2.1 on my > Red Hat system, replacing Python 1.5, and the installation scripts > broke because they could no longer import "rand". Grr, growl, gnash. I'm just sort of curious -- why do *configuration scripts* need to get random numbers? Does Red Hat only have a 50% chance of installing certain packages? -- David Glasser news at davidglasser.net http://www.davidglasser.net/ From usenet at lophty.com Sun Dec 2 09:47:32 2001 From: usenet at lophty.com (brian donovan) Date: Sun, 02 Dec 2001 09:47:32 -0500 Subject: Newbie : Installing Python locally in acct on shared server Message-ID: <3C0A3F04.3090206@lophty.com> Quick background : I am a Python newbie and I think that I fit into a large demographic of potential Python users - the users who can't/don't learn to use Python because they don't have access to up-to-date installations (other than the one that they can set up on the machine in their apartment). I am comfortable programming in Perl and PHP because they have been installed on the systems that I've worked with as well as on the servers where I host. I would like to begin to pick up Python, but my hosts' admins are unwilling/unable to get a newer version installed. They have, however, told me that I'm more than welcome to install whatever version of Python that I like on my own account. I have attempted unsuccessfully, multiple times to install Python 2.1.1. It's been a couple of months and I'd like to try again. situation ----------------------------------------------- Apache 1.3.2, Linux My account name is "luser". My account is located in /home/luser I've gunzipped and untarred the .tgz and now I have a directory /home/luser/Python-2.1.1 I'd like to be able to point scripts to /home/luser/Python or /home/luser/Python-2.1.1. ----------------------------------------------- I've read the README and Makefle that accompany the distro and tried to use the --prefix=/home/user/Python when I ./configure part of the # ./configure, make, make test, make install dance and have gotten basic "hello world" type scripts pointing at this install to work, but anything that imported a module (any module) failed. If anyone could post the correct commands to get me up and running, you would be helping not only me, but probably countless others who are in the same position as well. Very grateful, brian From opengeometry at yahoo.ca Wed Dec 5 19:25:05 2001 From: opengeometry at yahoo.ca (William Park) Date: Wed, 5 Dec 2001 19:25:05 -0500 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) In-Reply-To: <3C0EACD6.B2191A44@cosc.canterbury.ac.nz>; from greg@cosc.canterbury.ac.nz on Thu, Dec 06, 2001 at 12:25:10PM +1300 References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BD39F.D43D4FF7@mega-nerd.com> <3c0be454$1@207.229.64.20> <3C0BE5D5.4386B359@mega-nerd.com> <3C0EACD6.B2191A44@cosc.canterbury.ac.nz> Message-ID: <20011205192505.B1704@node0.opengeometry.ca> On Thu, Dec 06, 2001 at 12:25:10PM +1300, Greg Ewing wrote: > In summary, my positions on the various issues are: > * Space-only block indentation should be allowed. > * Tab-only block indentation should be allowed. > * Mixed indentation should probably be rejected always, > or at least by default, although I can live with having > to say -tt. > * Python shouldn't care about spacing used for purposes > other than block indentation, although pragmatically > it's best done with spaces only. > * People in both camps should get used to the idea of > using conversion tools to deal with each other's code > and stop hating each other, or George Bush may target > you next after Afghanistan. :-) One solution that has been proposed long ago (and many time since) is end-block keywords like shell. -- William Park, Open Geometry Consulting, . 8 CPU cluster, NAS, (Slackware) Linux, Python, LaTeX, Vim, Mutt, Tin From tmagna at online.no Wed Dec 26 10:29:14 2001 From: tmagna at online.no (Brandvik) Date: Wed, 26 Dec 2001 16:29:14 +0100 Subject: Pascal's triangle (beginner) Message-ID: <2oqj2ucmbo2658uq1dq3v8quc6f116d8tq@4ax.com> I've just started learning Python and I'm wondering how one could write a function that would print pascals triangle up to a certain number. It would be great if some of you guys could give me some hints on how such a script would look. It is not important that the output is in the form of a triangle -- I'm just wondering how to calculate the values and print them like this: 1 11 121 1331 14641 etc... BTW, this is my first post here... -Brandvik From mac at dgp.toronto.edu Tue Dec 4 01:53:40 2001 From: mac at dgp.toronto.edu (Maciej Kalisiak) Date: Tue, 04 Dec 2001 06:53:40 GMT Subject: "print 0.1==0.1" -> TypeError; what did I do? Message-ID: <87pu5vqxvv.fsf@dgp.toronto.edu> I'm writing some extensions in C. I've only dabbled in this for the past 4 days, but had relative success with it, as far as getting what I want to work. I'm stuck though with one (seemingly) small glitch: after my extension executes, all of a sudden real numbers start to misbehave. For example, "print 0.1 == 0.1" results in: TypeError: bad argument type for built-in operation (OTOH, "print 1 == 1" works fine) I don't know much of the internals of Python, so this isn't giving me any hints as to what the problem is. Can anyone offer any hints of what to look at, as far as debugging goes? What could cause this type of behaviour? I'm using Python 2.1, if it matters. -- Maciej Kalisiak|mac@] "Never wrestle with a pig. When you do, two things dgp.toronto.edu|www.] happen: (1) You get dirty, and (2) The pig likes it." dgp.toronto.edu/~mac] From zope at thewebsons.com Mon Dec 3 14:58:41 2001 From: zope at thewebsons.com (Ben Ocean) Date: Mon, 03 Dec 2001 11:58:41 -0800 Subject: Editing a Path Message-ID: <5.1.0.14.0.20011203115705.00a17cf0@thewebsons.com> This may be slightly OT, but I need to edit my path /usr/bin/python such that it renders python2.1 instead of python1.5.2 I built python2.1 from source on an RH71 box. How do I update the path? TIA, BenO From grey at despair.dmiyu.org Tue Dec 4 12:31:30 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Tue, 04 Dec 2001 17:31:30 -0000 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> <23891c90.0112030353.1406b494@posting.google.com> <3C0BD39F.D43D4FF7@mega-nerd.com> <23891c90.0112040239.72e92f5@posting.google.com> Message-ID: On 4 Dec 2001 02:39:19 -0800, Paul Boddie wrote: > If you have a file which uses only "hard tabs" for indentation, and > someone then modifies their indentation level in an editor which > supports "hard tabs", and that person then uses "hard tabs" to indent > code in that file, then there isn't a problem. Yes, there is. Hard tabbers, like you, forget that not all indention, even for the most stout hard tabber will always be tabs. If you haven't figured that out yet, you haven't been coding long enough. > If, on the other hand, someone loads the file into such an editor and > starts slapping the space bar to indent code, then you do have a > problem. No, I don't. Because when the file is saved all indention is in spaces. Never a tab shall be written out, period. In that manner there are no problems. Furthermore I am not flaming people who use hard tabs. I am upset at people who are arguing for hard tabs who, for three days, blatently ignored a simple example which blew their argument out of the water. I am further upset by blundering nits who waltz into the discussion, throw out what a tab means in two entirely unrelated contexts, and then things he's the flippin' mossiah! -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From pcc at ecet.vtc.edu Sun Dec 30 22:45:30 2001 From: pcc at ecet.vtc.edu (Peter) Date: Sun, 30 Dec 2001 22:45:30 -0500 Subject: Manipulating Win32 attributes; newbie question. References: Message-ID: In article , pieter.claerhout at pandora.be says... > These functions are declared in the win32api module... Thanks... I think I got what I need now. I was looking at the wrong help (for my purposes). Peter From pgut001 at cs.auckland.ac.nz Wed Dec 5 08:42:09 2001 From: pgut001 at cs.auckland.ac.nz (Peter Gutmann) Date: Wed, 05 Dec 2001 13:42:09 -0000 Subject: CryptKit 0.9: cryptsock References: <7xpu5y2szk.fsf@ruckus.brouhaha.com> <7x667pw8ap.fsf@ruckus.brouhaha.com> Message-ID: dpj at world.std.com (David P Jablon) writes: >References and links for many of the papers in the field of >password-based public key cryptography can be found at: >http://www.integritysciences.com/links.html >And several relevant submissions to IEEE P1363.2 can be found at: >http://grouper.ieee.org/groups/1363/StudyGroup/submissions.html >In article <7x667pw8ap.fsf at ruckus.brouhaha.com>, >Paul Rubin wrote: >>Bryan writes: >>> Thanks for the link, it lead me to research other password-based >>> key-agreement schemes. I found Authentication and Key Agreement via >>> Memorable Password ( >>> http://citeseer.nj.nec.com/kwon00authentication.html ) which claims >>> to be the most efficient of all of them ( EKE, PAK, SRP, GXY, AuthA >>> ). I believe I will implement AMP. Your input would be >>> appreciated. >> >>I'm not familiar with AMP. The SRP paper has references to some other >>protocols of this type though. Main problem I see is patent issues >>around many of them. I believe SRP was developed in order to avoid >>the EKE patent. >I can confirm that SPEKE was designed to avoid earlier patents. ... but is itself patented, thus making it of academic interest only. (Seems like half the password-assisted PKCs around exist mostly to avoid patents on other password-assisted PKCs). Peter. From prabhu at cyberwaveindia.com Thu Dec 6 23:48:20 2001 From: prabhu at cyberwaveindia.com (Prabhu Ramachandran) Date: 6 Dec 2001 20:48:20 -0800 Subject: Scientific Libraries in Python References: Message-ID: <375ad208.0112062048.1e9930c@posting.google.com> Hi, Travis, thanks for the information on LGPL and also on the list of things that SciPy can do. My mail is still badly messed up so I'm trying to track this thread via google. Horatio Davis wrote in message news:... > On 1 Dec 2001, Kragen Sitaker wrote: > [Travis on LGPL] [Kragen raises point against LGPL citing potential problems] > > Right. Their only obligation would be to let people drop in newer > > versions of MayaVi. So, for example, Mathematica or IDL could add > > MayaVi as a plotting option if you released it under the LGPL. > These packages already have visualization options which, surprisingly, > they seem happy with. If they wanted to add the VTK as their visualization > library, they could do so now, because VTK is free-as-in-beer. If they > want to move away from their proprietary languages and use Python to work > with the VTK... at the risk of further embarrassing Prabhu, I respectfully > submit that MayaVi would eat them for breakfast. Umm, I'm not sure I understand. Did you really mean that MayaVi would be able to eat the Mathematica and IDL graphics for breakfast? I haven't used them much to actually comment on that but if they do choose to use MayaVi for their visualization then it isn't really possible to eat them for breakfast is it? Anyway thanks for the compliments. > It would just gain bigger teeth if the rest of us could use it (and > Scigraphica, for that matter) without being GPL'd for our troubles. Thats true. I believe that the LGPL was designed for helping libraries in growing bigger teeth. My head is spinning after reading the LGPL license. I think I need to read it more carefully and spend some time on it. Understanding licenses is a pain. *sigh* prabhu From sasoft at gmx.de Sat Dec 1 13:39:25 2001 From: sasoft at gmx.de (cruciatuz) Date: Sat, 1 Dec 2001 13:39:25 -0500 Subject: password question on startup In-Reply-To: <9uai36$796f8$1@ID-69142.news.dfncis.de>; from mail@andreas-penzel.de on Sat, Dec 01, 2001 at 01:22:52PM +0100 References: <9uai36$796f8$1@ID-69142.news.dfncis.de> Message-ID: <20011201133924.A1651@blackscarab> On Sat, Dec 01, 2001 at 01:22:52PM +0100, Andreas Penzel wrote: > Hello NG! > > I want that on the programm-start the user has to give user-id and password. > The password should not be seen on the screen, only e.g. stars. > > What to do? import getpass getpass.getuser() # returns the current username getpass.getpass() # returns an entered password (doesn't show pass on # screen) have a look at the documentation of getpass, too. i hope this helps -- Stefan Antoni ---------------------------- Sam Dez 1 13:35:33 EST 2001 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 240 bytes Desc: not available URL: From lucio at movilogic.com Thu Dec 20 14:47:44 2001 From: lucio at movilogic.com (Lucio Torre) Date: Thu, 20 Dec 2001 16:47:44 -0300 Subject: Huge Dicts and perfomance References: Message-ID: <3C224060.6040300@movilogic.com> Jason Orendorff wrote: >This is an interesting problem. I have a few questions... > >>I am making an application where i want to store links betwen nodes. So >>i have a dictionary where i store the objects. >> >>dict[0][objectname] = object >> >>the [0] is because i to signify a link betwen obj-a and obj-b, i do: >> >>dict[1][(obj-a, obj-b)] = obj(a, b) >> >>and so on, to six levels deep. >> > >I think I see. Is it kind of like this? > dict[0][a.name] = a > dict[1][(a.name, b.name)] = LinkObject(a, b) > >But I still can't tell what you mean by "six levels deep". >Is it like this? > dict[2][(a.name, b.name, c.name)] = LinkObject(a, b, c) > dict[3][(a.name, b.name, c.name, d.name)] = LinkObject(a, b, c, d) > etc. > >Or is it like this? > dict[2][(link1.name, link2.name)] = MetaLinkObject(link1, link2) > dict[3][(mlink1.name, mlink2.name)] = MetaMetaLinkObject(mlink1, mlink2) > etc. > >Or something else? > Its like this: dict[2][(a.name, b.name, c.name)] = LinkObject(a, b, c) dict[3][(a.name, b.name, c.name, d.name)] = LinkObject(a, b, c, d) > >>and i also store links betwen dict[x][y] and other nodes (the stored >>object has those links) >> > >All right... part of what's confusing me is the words "object", >"link", and "node". Does "node" mean "any object or link"? >Or is "node" == "object"? > i have a node, a node can hold objects: n = node(a,b,c,d) then i have links betwen nodes: l = link( node(a,b), node(b,c) ) > > >>and i want to say for example, if i have a and b, what other nodes >>usually come togheter? so i follow the links and find the root nodes (z, >>x) and the groups (a, z) and (s, x). >> > >What does "usually come together" mean? > Ok, that was not a good way to phrase my question :) i start from a node y. The node has links to other nodes. and links have costs. i want to know what nodes can be reached spending less than x,. starting from node y this algorithm is not the problem, just what representation would you recoment to hold huge ammounts of data that can allo me to do this. > >>the main problem of course is that doing it this way, performance sucks. >>I took me nothing to code it, but it takes to much to run (more than >>coding). So, any ideas on how to achieve my goal in a better (faster) way? >> > >If you could be clearer about what you are trying to do, I think >someone here could help. If you post a little bit of sample code, >you'll get more responses. > I hope this does not deter the interest in my problem, but i actually dont know what im doing :) Im playing with words, texts and dictionaries and toying with python thanks a lot, Lucio. From greg at cosc.canterbury.ac.nz Sun Dec 9 23:25:03 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Mon, 10 Dec 2001 17:25:03 +1300 Subject: pep proposal : A date object for the standard library References: <7da8d8f8.0112060346.3e50092f@posting.google.com> <9uq2km$d0g$1@news.btv.ibm.com> Message-ID: <3C14391F.510EB54C@cosc.canterbury.ac.nz> Peter Mayne wrote: > > 00:00 o'clock, November > 17, 1858. This is the Smithsonian base date and time for the astronomical > calendar. All right, so does anyone know why the Smithsonian chose this date? Does it correspond to any important celestial occurrence, or event in the history of astronomy? -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From skip at pobox.com Fri Dec 21 12:36:24 2001 From: skip at pobox.com (Skip Montanaro) Date: Fri, 21 Dec 2001 11:36:24 -0600 Subject: Mild bug: pipermail/python-dev In-Reply-To: References: Message-ID: <15395.29464.408790.49376@beluga.mojam.com> Terry> This page http://mail.python.org/pipermail/python-dev/ has a link Terry> to an archive for a message mis-dated (one hopes) February 2005! Terry> Seems like mild bug somewhere but I have no idea where or where Terry> to report. This is a known problem. I believe Pipermail uses the timestamp in the Date: header, which is generated by the sender. If their clock is off (as /F's apparently was when he sent the message in question), you get a bogus entry in the archive. I believe the solution would be to use the timestamp in the Date: field unless it appears to be too far in the future or the past (probably using different thresholds for future and past), in which case it should either use the the timestamp in the From_ field or the current time. -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From rumjuggler at cryptarchy.org Mon Dec 31 02:14:49 2001 From: rumjuggler at cryptarchy.org (Ben Wolfson) Date: Mon, 31 Dec 2001 07:14:49 GMT Subject: REPOST: Re: wxBitmapFromImage function in wxPython? References: <3C2F7BB3.577D3712@cti.ecp.fr> <5$--$$_----__%$%-$@news.noc.cabal.int> Message-ID: On 30 Dec 2001 19:54:08 -0800, woodsplitter at rocketmail.com (stalin) wrote: >X-Reposted-By: resurrector at mindspring.com (Guido the Resurrector) >X-Comments: GtR Repost: The following Usenet article was cancelled, more >X-Comments: than likely by someone other than the original poster. Please >X-Comments: see the end of this posting for a copy of the cancel. >X-Comments: Guido the Resurrector can be contacted at >X-Comments: resurrector at mindspring.com. The time machine is one thing, but this is just a little too much. Guido runs the risk of getting struck down by lightning if he keeps this up. -- Barnabas T. Rumjuggler You're going to set me up as a kind of slovenly attached pig that Jack Kornfeld can slice down in his violent zen compassion? -- Larry Block From chris.gonnerman at newcenturycomputers.net Sun Dec 23 01:09:24 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Sun, 23 Dec 2001 00:09:24 -0600 Subject: Time for a Fresh Scheme Standard: Say Goodbye to the RnRS Relic References: Message-ID: <00a001c18b78$637912e0$0101010a@local> ----- Original Message ----- From: "Tim Peters" > [Chris Gonnerman] > > Who are these people, and what are they doing in this list? > > This comes from the Usenet (comp.lang.python) side of the list -- > language wars are often massively cross-posted to irrelevant > groups, because one person does so for dubious reasons, Dorks. > and then > everyone else doesn't bother to trim the x-posted newgroups from > their replies. Lazy. > > I bear no malice toward any language (unless you count disgust > > with Visual Basic or confusion with Perl) and would not engage > > in such heated battle with anyone over any language. > > Wuss. and proud of it... :) actually I try to limit my participation in battles of wits to those who have them (present company included). From chris.gonnerman at newcenturycomputers.net Fri Dec 14 08:11:19 2001 From: chris.gonnerman at newcenturycomputers.net (Chris Gonnerman) Date: Fri, 14 Dec 2001 07:11:19 -0600 Subject: Connection reset by peer References: <010c01c18460$47ebff20$4301010a@sky> Message-ID: <003f01c184a0$d3323000$0101010a@local> What the heck are you trying to do here? I've been looking at this code for some time now and I can't figure out exactly what you are doing or why; this is NOT a normal UDP socket connection because you have screwed with the ethernet adapter and then attempted to handle the IP packet directly. Probably the reason no one will answer you is they are as puzzled as me. Why go to so much trouble to send UDP data when you can just use the socket module "normally" to do so, in much less code? ----- Original Message ----- From: ??? To: python-list Sent: Thursday, December 13, 2001 11:29 PM Subject: Connection reset by peer I encountered a question,when I deal with UDP socket connection,my programs existed.I have two programs,one is server.py,another is client.py ,I run them in two computers,server.py is at 10.1.1.27,client is at 10.1.1.67 ,my programs are follows: server.py #It works at IP address of 10.1.1.27 import socket,struct import os import string os.system("ifconfig eth0 promisc") Ethhdr='!BBBBBBBBBBBBH' Eth_len=struct.calcsize(Ethhdr) IPhdr='!bbhhhbbhll' IPhdr_len=struct.calcsize(IPhdr) UDPhdr='!HHHH' UDPhdr_len=struct.calcsize(UDPhdr) ipsock=socket.socket(socket.AF_INET,10,8) while 1: recvpack=ipsock.recv(1024) if len(recvpack) <= (Eth_len+IPhdr_len+UDPhdr_len): continue data=struct.unpack(Ethhdr,recvpack[:Eth_len]) if data[12]==2048: ipdata=struct.unpack(IPhdr,recvpack[Eth_len:Eth_len+IPhdr_len]) if ipdata[6]==socket.IPPROTO_UDP: udpdata=struct.unpack(UDPhdr,recvpack[Eth_len+IPhdr_len:Eth_len+IPhdr_len+UDPhdr_len]) if udpdata[1]==21567 or udpdata[0]==21567: #I get udpaddr from IP header of 32bit source ip address, #and I get udpdata[0] from UDP header of 16bit source port number. udpaddr="%i.%i.%i.%i" % (ipdata[8]>>24 & 255,ipdata[8]>>16 & 255,\ ipdata[8]>>8 & 255,ipdata[8] & 255) addr=udpaddr,udpdata[0] print type(addr) print addr #for some program design reason,I can't use data,addr=udpSerSock.recvfrom(BUFSIZ) to get addr, #because data,addr=udpSerSock.recvfrom(BUFSIZ) is conflict with recvpack=ipsock.recv(1024) udpSerSock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) data='hello! I have received message' udpSerSock.sendto(data,addr) udpSerSock.close() client.py #It works at IP address of 10.1.1.67 from socket import * import string HOST='10.1.1.27' PORT=21567 BUFSIZ=1024 ADDR=(HOST,PORT) udpCliSock=socket(AF_INET,SOCK_DGRAM) data=raw_input('>') udpCliSock.sendto(data,ADDR) print udpCliSock.getsockname() data, addr = udpCliSock.recvfrom(BUFSIZ) if data: print data udpCliSock.close() First,I run server.py at 10.1.1.27 $python server.py Then I run client.py at 10.1.1.67 $python client.py >hello The running result of server.py: ('10.1.1.67', 1165) $ The running result of client.py,it raise a error: ('0.0.0.0', 1165) Traceback (most recent call last): File "client.py", line 11, in ? data, addr = udpCliSock.recvfrom(BUFSIZ) socket.error: (104, 'Connection reset by peer') I know that my server.py don't use normal way to return data to client.py ,but I need this way! How to correct my programs? Any ideas will be appreciated! Thanks. Edward -------------- next part -------------- An HTML attachment was scrubbed... URL: From Tom.Karas at htp-tel.de Thu Dec 27 16:35:25 2001 From: Tom.Karas at htp-tel.de (Tom Karas) Date: Thu, 27 Dec 2001 22:35:25 +0100 Subject: REPOST: Re: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B5E9F.FF1C2CC@bellatlantic.net> Message-ID: <9$--$$_----_-$-%_$@news.noc.cabal.int> Hello out there. > >It depends on how you view this 'forum.' As far as I am concerned, > >**nothing** beats NNTP newsgroups viewed in a dedicated NNTP viewer. What means nntp ? Just my 2 cent question Best regards Tom Karas -- The early bird catches the worm. Trust the computer industry to shorten the term If you want something else for "Year 2000" to Y2K. It was this kind of thinking breakfast, get up later. that got us in trouble in the first place. Adrian Tyvand ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.berkeley.edu!ucberkeley!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Tom Karas Newsgroups: comp.lang.python Subject: cmsg cancel <3C2B941D.B1E45AA5 at htp-tel.de> Control: cancel <3C2B941D.B1E45AA5 at htp-tel.de> Date: Mon, 31 Dec 2001 01:39:12 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775581 27193 211.57.49.2 (31 Dec 2001 05:13:01 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:13:01 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From hgg9140 at seanet.com Fri Dec 28 16:09:31 2001 From: hgg9140 at seanet.com (Harry George) Date: 28 Dec 2001 13:09:31 -0800 Subject: ANN: mkpythonproj 1.4 Message-ID: mkpythonproj generates full GNU-style projects, with setup,py, unittest-style tests, pydoc-compliant modules, and additional documentation. Individual modules can also be generated (e.g., after a project has been started). The structure of the modules is driven by templates. See: http://www.seanet.com/~hgg9140/comp/mkpythonproj-1.4/doc/index.html Download from: http://www.seanet.com/~hgg9140/comp/ Recent changes: 2001-12-28: v1.4 - Converted basic documentation to GNU style text files (CHANGES, README, etc.). 2001-10-30: v1.3 - Seperated "BODY" template, so other bodies can be used. - Provide for alternative #!commands -- Harry George hgg9140 at seanet.com From tjreedy at home.com Sat Dec 29 16:20:37 2001 From: tjreedy at home.com (Terry Reedy) Date: Sat, 29 Dec 2001 21:20:37 GMT Subject: REPOST: Re: Was that to inpolite? Re: Call for a small program References: <3C2BAEF3.CC34B8DD@htp-tel.de> <3C2E0D55.9EC9B67F@htp-tel.de> Message-ID: <6$--$$_----__%_$_$@news.noc.cabal.int> "Tom Karas" wrote in message news:3C2E0D55.9EC9B67F at htp-tel.de... > Hello out there. > > A few quick questions: > > Was my "Call" to inpolite? Sorry, don't remember rest of title or what it was about. > Was it the wrong place / newsgroup to ask? > > I just wonder, because there wasn?t even a reaction like "Go away" or > "Plonk / Killfile" We are mostly too polite to say such things unless a person is really obnoxious, which you definitely do not seem to be as evidenced by this query. At any one time, there is only a limited mindspace available for actively discussed threads. Sometimes deserving topics slip in between. Sometimes I see a post that 'calls' for a response, but I do not know what to say, or assume that someone else will (or maybe has already) answer. > This may sound odd, but i would be even willing to pay for a solution that would > fit the basic needs (running on windows and linux and some features) Willingness to pay is 'odd' only in that it tends to be unusual. Did you mention this originally? Terry J. Reedy ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Terry Reedy" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:03:40 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774556 27193 211.57.49.2 (31 Dec 2001 04:55:56 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:55:56 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From tripps81 at yahoo.com Fri Dec 7 12:38:47 2001 From: tripps81 at yahoo.com (Tripp Scott) Date: Sat, 08 Dec 2001 00:38:47 +0700 Subject: simple, lightweight component based development in python? In-Reply-To: <3c10a79e$0$24733$7a628cd7@news.club-internet.fr> References: Message-ID: <5.1.0.14.2.20011208003836.06ca4a00@202.95.131.154> yes, i've taken a look and printed out the pyro manual. it sure is cool, but not exactly a component framework. i might take bits of it (the remote object part) should i build my own framework. t At 07/12/2001 06:37, Jiba wrote: >What about Pyro ? > >I've never tried it but it looks great. It is pure-Python, but only Python. > >http://pyro.sourceforge.net/ > >Jiba > >-- >http://mail.python.org/mailman/listinfo/python-list From drollo at cns.net.au Mon Dec 10 08:48:29 2001 From: drollo at cns.net.au (David Rollo) Date: Mon, 10 Dec 2001 13:48:29 GMT Subject: Good book for Learning Python?? References: Message-ID: <3C14BD80.7CD91CF6@cns.net.au> Don Tuttle wrote: > > If that's not you, get the new book by Chris Fehily "Visual Quickstart Guide > to Python". IMHO this is now the best book for programmers to learn how > Python works. It's inexpensive ($21.99 US). It's short. And after you've > read it, it's still valuable as a quick reference. > > But what really sets this book apart from all the rest is the massive amount > of code examples and resultant output. Each example progresses from simple > to increasingly complex. > > There are now a lot of good Python books but this is one I'd call a must > have for anyone new to Python. (and maybe not so new ;-) ... And a hearty re-endorsement from someone completely new to Python. Fehily's book is also remarkably clear and well-written. The code examples, which have been very cleverly chosen, double as an ideal self-testing device, although Fehily is also smart enough not to make a feature of that. I'm about 3/4 of the way through it, and it's been a really fascinating read ... although perhaps that's also got something to do with it being Python. David Rollo From ajs at ix.netcom.com Sat Dec 1 23:29:08 2001 From: ajs at ix.netcom.com (Arthur Siegel) Date: Sat, 1 Dec 2001 23:29:08 -0500 Subject: variable scoping across imports? Message-ID: <000701c17aea$020c9700$a9e1fea9@carol> Kragen Sitaker wrote: > Hans Nowak writes: > > Let's see... you start x.py... x imports y... y imports x again... > > at that moment x.z0 is None. Now y has a copy of x's namespace with > > z0 == None. This is, however, not the same as the global namespace > > you're currently in. set() changes z0 to 33, but it does *not* > > affect the x module that was imported by y. > > I don't think things work this way, actually Fredick Lundh - >assuming Hans meant to write "reference to" instead >of "copy of", it does work that way. Ahem. Art From ykingma at accessforall.nl Fri Dec 7 15:03:30 2001 From: ykingma at accessforall.nl (Ype Kingma) Date: Fri, 07 Dec 2001 21:03:30 +0100 Subject: OK, now *this* is cool References: Message-ID: <3C112086.5F7072A9@accessforall.nl> Bruce, you wrote: > > I think so, at least. Based on Tim's pointer about __subclasses__() > in 2.2, I can automatically generate an instance of all of my > subclasses. > > class Flower(object): > def __repr__(self): > return self.__class__.__name__ > > class Gladiolus(Flower): pass > class Runuculus(Flower): pass > class Chrysanthemum(Flower): pass > class Rose(Flower): pass > class CrystalPassion(Rose): pass > > print [Klass() for Klass in Flower.__subclasses__()] > > Output: > [Gladiolus, Runuculus, Chrysanthemum, Rose] > print [Klass.__name__ for Klass in Flower.__subclasses__()] would be easier to understand. Somehow it doesn't feel right to define __repr__ as only self.__class__.__name__ since repr() is normally used as the inverse of eval(). Did you consider defining __str__() instead? Btw. thanks a lot for TIJ. Have fun, Ype P.S. Did they really make __subclasses__() a method? From phd at phd.pp.ru Sun Dec 9 04:54:23 2001 From: phd at phd.pp.ru (Oleg Broytmann) Date: Sun, 9 Dec 2001 12:54:23 +0300 Subject: Is your mortgage APR as low as 4.13? -pdha In-Reply-To: <612c4t78vf.qenm6l238aeb85kg4aqc@erate.savingszone.com>; from giqqh@benjq.chinahot.net on Sun, Dec 02, 2001 at 03:11:09AM -0600 References: <612c4t78vf.qenm6l238aeb85kg4aqc@erate.savingszone.com> Message-ID: <20011209125422.B11375@phd.pp.ru> On Sun, Dec 02, 2001 at 03:11:09AM -0600, giqqh at benjq.chinahot.net wrote: > >>>> FINANCING A PROPERTY CAN BE A TRYING EXPERIENCE! I have problem running this thing :( phd at phd 1 >> python Python 2.1.1 (#1, Aug 8 2001, 19:17:29) [GCC 2.95.2 20000220 (Debian GNU/Linux)] on linux2 Type "copyright", "credits" or "license" for more information. >>> FINANCING A PROPERTY CAN BE A TRYING EXPERIENCE! File "", line 1 FINANCING A PROPERTY CAN BE A TRYING EXPERIENCE! ^ SyntaxError: invalid syntax Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From shulmang at colorado.edu Thu Dec 27 18:21:06 2001 From: shulmang at colorado.edu (Garett Shulman) Date: Thu, 27 Dec 2001 23:21:06 GMT Subject: REPOST: module path Message-ID: <6$--$$_-----$$-__$@news.noc.cabal.int> I would like to store my modules and scripts in a folder other than the python folder. Does anyone have any suggestions as to what I need to do in order to be able to import the scipts in the interpreter? Is there a path that the interpreter searches which I could modify? ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Garett Shulman Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:04:30 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775510 27193 211.57.49.2 (31 Dec 2001 05:11:50 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:11:50 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From mhammond at skippinet.com.au Fri Dec 28 23:28:13 2001 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 29 Dec 2001 04:28:13 GMT Subject: win32all-141 for Python 2.2 Message-ID: <3C2D4676.5060700@skippinet.com.au> I have made a new win32all release for Python 2.2. Hrmm - it seems I can't login to starship :( So I have temporarily placed it at: http://users.bigpond.net.au/mhammond/win32all-141.exe The only new known issue is that "Active Debugging" will probably not work - using the Microsoft Debuggers when using Python in an ASP or IE page will fail. I will move this to starship, including details of exactly what has changed, ASAP. Mark. From hptcam at tin.it Thu Dec 27 14:27:11 2001 From: hptcam at tin.it (Annunci & Co.) Date: Thu, 27 Dec 2001 20:27:11 +0100 Subject: (no subject) Message-ID: <030a01c18f0c$7bb19660$5490d33e@tin.it> Annunci & Co. Annunci & Co., il sito italiano di annunci completamente e del tutto gratuiti, offre l'inserimento degli stessi in pi? di 30 (trenta) categorie completamente differenti in lingua Italiana, Inglese, Francese e Tedesco. Inoltre offre lo spazio pubblicitaro con banner nella lingua desiderata e pubblicati ovunque necessiti una conoscenza approfondita della propria attivit?. http://space.virgilio.it/hpcamm/annuncieco/index.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From buzzard at urubu.freeserve.co.uk Tue Dec 18 12:01:12 2001 From: buzzard at urubu.freeserve.co.uk (Duncan Smith) Date: Tue, 18 Dec 2001 17:01:12 -0000 Subject: gmpy / binary() References: <9vns33$j9j$1@news6.svr.pol.co.uk> Message-ID: <9vnsqk$e9t$1@news5.svr.pol.co.uk> Different again sending output to text file. >>> bit_stuff.combinations(14,6) Text file contains: 63 ? 16128 ? I presume the extra space before the second '?' is significant. Duncan From djrassoc01 at mindspring.com Sun Dec 30 00:10:53 2001 From: djrassoc01 at mindspring.com (Dr. David J. Ritchie, Sr.) Date: Sat, 29 Dec 2001 23:10:53 -0600 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2CBACB.FBF3C3C9@mindspring.com> <3C2D47F0.6DF7C8BE@mindspring.com> <3C2DF5FF.E332F4EE@mindspring.com> <3C2E849D.8242B65D@engcorp.com> Message-ID: <8$--$$_----__$%--$@news.noc.cabal.int> Yes, someone pointed out in private e-mail that thanks to the ability to supplant the import function one could implement the ability to import from a remote node relatively easily. The hierarchy for import of packages is the other way round compared to http://my.node.com:port/path/to/module but I suppose that could be worked out. Also, as someone asked privately one would have to decided what protocal would be used: ftp, http:, telnet: (just joking, I think). One could even invent one's own protocol "pyt://" (still joking). I would be inclined to think ftp because one is basically doing file transfers but http: would have some interesting aspects such as the ability to be importing a remote module into one's program and have the import hyperlink to some other site and then to another and so on. The security aspects would be pretty horrendous. One would sort of get driven to having the virtual machine within which this byte code executes be in a sandbox and walled off from the file system of the machine it is on and so on. Sounds like one is implementing java all over again to me (which is of course how I got started--figuring out what features you would have to add to Python to make it competitive (?) with Java) but it is an interesting sand castle to build and then tear down when the tide of reality comes in again... Peter Hansen, P.Eng. of peter at engcorp.com wrote... > The idea is sound, but for now I think really practical > only on a company intranet. Internet connectivity is > still too unreliable to make this very effective > except for strictly Internet-related applications > (i.e. those which have no intrinsic purpose when an > Internet connection is not available.) > > That said, I suppose a little local caching would provide > a reliable backup after the first invocation had succeeded. > > And none of this would be in any way difficult to implement > even now, since you can just substitute your own implementation > of __import__(). > > I hear all the comments about security though and what would you do if the machine you whose module you wanted was unavailable on the net and so on. These were the same things that were being thrown up eight-to-ten years ago at the beginning of the web. See my recent talk about "Bringing the Web To Fermilab": < http://home.fnal.gov/%7Eritchie/OTHERtasks/Bringing%20the%20Web%20to%20Fermilab.htm > for some examples. In particular, in preparing for the talk, one person told me about the initial concerns thrown up by techies about the web being something that no one would use because "what if the links weren't up?" and "what about the data just being any old thing that someone put up and therefore wasn't valid?" She said that of course all this about invalid and unreliable data was the case but in fact the response of the average human being (as opposed to the techies) was not to refuse to adopt the web but it was instead something even scarier--they opted TO BELIEVE THE INFORMATION THEY FOUND THERE. So, with that example, the lack of reliability in a remote module import scheme may not be something that kills it off. Thanks for interesting discussions from all parties who sent me e-mail or responded publically. --D. -- Dr. David J. Ritchie, Sr. djrassoc01 at mindspring.com http://home.mindspring.com/~djrassoc01/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Dr. David J. Ritchie, Sr." Newsgroups: comp.lang.python Subject: cmsg cancel <3C2EA1CC.D1F77BB4 at mindspring.com> Control: cancel <3C2EA1CC.D1F77BB4 at mindspring.com> Date: Mon, 31 Dec 2001 01:14:31 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774396 27193 211.57.49.2 (31 Dec 2001 04:53:16 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:53:16 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From wex at flarg.com Mon Dec 24 03:26:15 2001 From: wex at flarg.com (Daniel Wexler) Date: Mon, 24 Dec 2001 08:26:15 GMT Subject: distutils lib path Message-ID: <1FBV7.3347$bE5.1290856513@twister1.starband.net> Is there a way to get the name of the platform-specific subdirectory name of the build/lib*** directory in my setup.py file? For example, when I compile under Linux using Python 2.1, the directory name I want is: build/lib.linux-i686-2.1 While, under Windows, the directory name I want is: build/lib.win32-2.1 Also, is there a way to have distutils perform some arbitrary commands after building each extension module? Or perhaps to callback to a python function that I can define (which then can do arbitrary things)? In my case I want to move or create links to the resulting .lib or .so files that are built by distutils. Thanks, Dan Wexler From josegomez at gmx.net Tue Dec 4 09:18:27 2001 From: josegomez at gmx.net (josegomez at gmx.net) Date: Tue, 4 Dec 2001 14:18:27 +0000 (UTC) Subject: Reading mixed ASCII/bin file-HOW? Message-ID: <9uilvj$djm$1@hermes.shef.ac.uk> Hi all, I want to read a number of files, all of which have a header, and then some data. More often than not :-), the data will be binary. The file looks a bit like this: 31/05/00 16:59:01 COMMENTS Cal - C Band. 12 cm tri ENDOFCOMMENTS NETWORK ANALYSER SETTINGS 4, Start Freq (GHz) 6, End Freq (GHz) 1601, No. of Freqs per Step The order of the parameters (and units) is always the same, so what I want to do is to read all that information into a dictionary. For the previous example, that'd be data = {'Date':"31/05/00", 'Time':"16:59:01", 'Comments':"Cal - C Band, 12 cm tri", 'StartFreq':4.0, 'EndFreq':6.0, 'NumFreq':1601} Now, I don't reallu understand how this is done, but I guess that I could parse it through a number of readline() calls. There has to be a better way though... OK, and now we get to the problem of what to do if the file is mixed binary/ascii. Basically, after the header, I get a "delimiter" in ASCII and a bunch of datapoints (to be calculated from the information on the header). Also, if the data isn't binary and is ascii, I get a lot of lines containing to numbers. In general, these datapoints fit neatly into a 2D complex array, and I have to convert the pairs of reals into complex number (Re+j*Im), for both ASCII and binary types. As you can see, I'm very much a newbie, and I am used to dealing with this sort of things in fortran 77. I was wondering if any kind soul might be able to help :-) Cheers, Jos? written in ASCII, and a lump of datapoints -- Jos? L G?mez Dans PhD student Tel: +44 114 222 5582 Radar & Communications Group FAX; +44 870 132 2990 Department of Electronic Engineering University of Sheffield UK From mwh at python.net Tue Dec 18 11:51:59 2001 From: mwh at python.net (Michael Hudson) Date: Tue, 18 Dec 2001 16:51:59 GMT Subject: Cygwin socket library status enquiry References: <20011218131502.GA2268@dothill.com> <2JJT7.22497$PA.5674@atlpnn01.usenetserver.com> Message-ID: "Steve Holden" writes: > "Michael Hudson" wrote in message > > I'd like to include some more up to date information in the README -- > > currently all it says is "we don't know the current state of play wrt > > cygwin on 95/98/Me." > > > > This applies to anyone else who has access to the relavent software > > too, of course. > > Haven't downloaded candidate 1 yet, but I'll try to do so in the next few > hours and give it a try on Windows 98. I presume you won't mind about the > 2.2-specific feature tests failing ... Huh? Of course I'd mind! I think I must have misunderstood you here... > I refreshed my Cygwin installation yesterday (if only Python > packages installed so easily!) so I hope this will be recent enough. Yeah, I meant "in the last few weeks", so yesterday is fine! Thanks a bunch! Cheers, M. -- > Look I don't know. Thankyou everyone for arguing me round in > circles. No need for thanks, ma'am; that's what we're here for. -- LNR & Michael M Mason, cam.misc From fperez528 at yahoo.com Wed Dec 19 13:42:15 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Thu, 20 Dec 2001 18:10:15 +2328 Subject: Distutils question Message-ID: <9vu28t$4g9$1@peabody.colorado.edu> I have the following problem with distutils: I want to put a certain directory with data files in a place where, after installation, my Python code will be able to find it. The problem with the data_files option is that things can end up in places that depend on python config details (/usr, /usr/local, etc) and later my running script will have no way of knowing where to find the information. I'm sure that people who have used distutils for big projects have run into this, but the distutils docs are very limited. The problem is in general: how to distribute data files which your own programs will later need to acces? data_files is ok for docs and similar things, and scripts and package are fine for python code, but what do I do for other data? Sorry if there's a simple way out of this, but I've been ploughing through the distutils docs and source and can't find a clean answer. Any help would be greatly appreciated. Cheers, Fernando. From gat at jpl.nasa.gov Mon Dec 3 13:15:58 2001 From: gat at jpl.nasa.gov (Erann Gat) Date: Mon, 03 Dec 2001 10:15:58 -0800 Subject: A modest indentation proposal References: <3C0BBC1A.6E4154F@home.net> Message-ID: In article <3C0BBC1A.6E4154F at home.net>, Chris Barker wrote: > I if get this straight, you seem to think that the indentation issue is > the ONLY thing getting in the way of NASA adopting Python. No, that is not the case. In fact, you seem to have made this up out of whole cloth. > By the way, did you suggest to the LISP community that LISP should > optionally use something other than all those parentheses? That seems to > be the main unimportant stumbling block when people used to C/C++ > consider LISP. Yes, as a matter of fact I did. I even implemented it (it's easy to do within standard Lisp), as have dozens of other people. The only reason I haven't implement this suggestion myself is that I don't know how. > By the way, to an organization that is considering adopting a new > language, I would think that the fact that the language is NOT likely to > change with every new request would be a good thing! MAybe we are all > just being tested? ;-) Yes, I suppose you could say this was a test of sorts. Indentation is not the only issue that meets with objections, but it is the one that is easiest to solve. My goal in making the suggestion that I did was as much to see what kind of responses it would get as to actually get the suggestion implemented. E. From henrik at moskau.hmotakef.homeip.net Sat Dec 29 17:26:40 2001 From: henrik at moskau.hmotakef.homeip.net (Henrik Motakef) Date: 29 Dec 2001 22:26:40 +0000 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: <4$--$$_----__%$-_$@news.noc.cabal.int> Paul Everitt writes: > I'm interested in hearing more about the Pet Shop example you > mentioned. Is it a canonical example that is written up somewhere > else for a different system? "The JavaTM Pet Store Demo is a sample application from the Java 2 Platform, Enterprise Edition Blue Prints (J2EETM BluePrints) program at Java Software, Sun Microsystems. It demonstrates how to use the capabilities of the J2EE 1.3 platform to develop flexible, scalable, cross-platform enterprise applications" (http://developer.java.sun.com/developer/sampsource/petstore/index.html) "Compared to the Java Pet Store, Microsoft claims that the .NET version requires one-third the lines of code (LOCs) and provides 28 times faster average response times (for 450 concurrent users), requires one-sixth the CPU-utilization, and scales much better as the number of users increases." (http://www.onjava.com/pub/a/2001/11/28/catfight.html) hth Henrik ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Henrik Motakef Newsgroups: comp.lang.python Subject: cmsg cancel <87k7v5hdcv.fsf at moskau.hmotakef.homeip.net> Control: cancel <87k7v5hdcv.fsf at moskau.hmotakef.homeip.net> Date: Mon, 31 Dec 2001 04:41:35 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774469 27193 211.57.49.2 (31 Dec 2001 04:54:29 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:54:29 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From ykingma at accessforall.nl Sat Dec 15 14:03:34 2001 From: ykingma at accessforall.nl (Ype Kingma) Date: Sat, 15 Dec 2001 20:03:34 +0100 Subject: Recursive update of arbitrarily nested dicts References: Message-ID: <3C1B9E80.FB732387@accessforall.nl> maxm wrote: > > I am writing a module where I am updating nested dicts, and it has this > method: > > def addDayToTrack(self, trackId, year, theDay, day): > if not self.tracks.has_key(trackId): > self.tracks.update({trackId:{year:{theDay:day}}}) > elif not self.tracks[trackId].has_key(year): > self.tracks[trackId].update({year:{theDay:day}}) > elif not self.tracks[trackId][year].has_key(theDay): > self.tracks[trackId][year][theDay] = day > > oh and self.tracks={} > > But clearly this could be solved more generally by a recursive function. > Something like: > > def addDayToTrack(self, trackId, year, theDay, day): > # recursive update > self.rUpdate(self.tracks, {trackId:{year:{theDay:day}}}) > > Now my only problem is that recursive method "rUpdate(targetDict, > itemDict)". > > Knowing this group, many other has written a method like this before me. > Does anybody have one at hand? > > The idea is that it should traverse the targetDict, updating keys and values > as apropriate. > > Anyhoo ... I will try it myself, but recursion is not my pot of tea though. > > regards Max M It's a while ago that I did recursion, and I know beforehand that better solutions will be posted. In general recursion has 4 ingredients: - check for simple (non recursive) case and handle it - divide problem into smaller problem(s) - recurse on the smaller problem(s) - create the solution from the solution(s) to the smaller problem(s). In this case there is only one smaller problem, and there is no solution to be assembled from the solutions to the smaller problem. (warning: untested code) def rUpdate(nestedDict, keys, value): # keys should be a tuple or a list firstKey, remainingKeys = keys[0], keys[1:] # divide the problem if len(remainingKeys) == 0: # non recursive case # Evt. raise an exception when nestedDict[firstKey] is a dict nestedDict[firstKey] = value # actual update. else: if not nestedDict.has_key[firstKey]: # make sure there is sub dict to recurse on nestedDict[firstKey] = {} rUpdate(nestedDict[firstKey], remainingKeys, value) # recurse on smaller problem. This happens to be tail recursion, because the solution ends in a recursive call. Compilers can do nice things to simplify tail recursion to a loop. (I wonder whether there is such a compiler for python already.) Have fun, Ype From loewis at informatik.hu-berlin.de Sun Dec 9 13:50:55 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 09 Dec 2001 19:50:55 +0100 Subject: freeze and minidom problem References: <3C129FAC.50906@avaquest.com> Message-ID: Matthew King writes: > Any ideas? Thanks in advance... My guess is that freeze doesn't detect that expatreader is used, so it imports none of the SAX code. For Python 2.2, we put # tell modulefinder that importing sax potentially imports expatreader _false = 0 if _false: import xml.sax.expatreader into xml.sax.__init__.py; that should allow you to freeze minidom/sax. There is another complication that modulefinder can't learn to also freeze _xmlplus when looking for xml. This should be no problem for you, since minidom should work fine in Python 2.1. Regards, Martin From cypher_dpg at yahoo.com Fri Dec 28 10:23:50 2001 From: cypher_dpg at yahoo.com (Jeremy Jones) Date: Fri, 28 Dec 2001 10:23:50 -0500 Subject: regex question: backreferences in brackets Message-ID: <20011228102350.A13050@cerberus.liberty> From the Python Library Reference on regular expressions, I read (in section 4.2.1 - concerning backreferences): """ \number Inside the "[" and "]" of a character class, all numeric escapes are treated as characters. """ I want to be able to match any character other than a character that I already matched and have a named (or numbered) group for. For example: """ match_string = 'XXX|1|22|333|4444:' test_compile = re.compile(r'XXX(.)[^|]{1}\1[^|]{2}\1[^|]{3}\1[^|]{4}(.)') mymatch = test_compile.match(match_string) if mymatch: print "Found a match" print mymatch.group(0) else: print "No match found" """ The format of the strings that I am trying to match are 3 specific characters followed by some delimter followed by N number of characters other than the delimiter followed by the delimiter, etc. The above code snipped works and matches the string perfectly. I guess my question is this: how can I match any other character except for the delimiter without knowing it beforehand (which I won't know what it is beforehand)? I am thinking use the backreference to the delimiter (i.e. \1), but you can't but that in the brackets. I tried putting \1 in the brackets and it sort of worked. But when I changed one of the numbers to a |, it still matched, which isn't what I want (and actually, it doesn't match if I leave the | hard-coded). I also tried using named backreferences like (?P.) rather than (.) and tried putting (?P=delimiter) in the brackets and no luck. Any suggestions? TIA. Jeremy Jones From mwh at python.net Fri Dec 28 11:00:21 2001 From: mwh at python.net (Michael Hudson) Date: Fri, 28 Dec 2001 16:00:21 GMT Subject: pth files - can they prepend to sys.path? References: Message-ID: "Skip Montanaro" writes: > Is it possible to force a directory mentioned in a .pth file to be > inserted at the beginning of sys.path instead of appended to the > end? You realise the handling of .pth files is done in site.py? The answer seems to be no, though presumably there's nothing stoppoing you supporting .pthplus files in a sitecustomize.py. Cheers, M. From hgg9140 at seanet.com Fri Dec 28 16:16:07 2001 From: hgg9140 at seanet.com (Harry George) Date: 28 Dec 2001 13:16:07 -0800 Subject: REPOST: UML/XMI et al Message-ID: <2$--$$_-----$$_$_$@news.noc.cabal.int> I'm working with several CASE tools, some of which have XMI interfaces. I want to drive code in and out of them (and generate SQL code for several DBMS's) using python. Anyone working in this area? I have already done a generator for UML/XMI DTD --> python classes, and MySQL and PostgreSQL SQL code generators. Also looking at tcm and dia (e.g., hooking up to dia2code). -- Harry George hgg9140 at seanet.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.tele.dk!small.news.tele.dk!134.75.7.11!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Harry George Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:19:17 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775041 27193 211.57.49.2 (31 Dec 2001 05:04:01 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:04:01 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From syring at email.com Wed Dec 26 11:23:25 2001 From: syring at email.com (Karl M. Syring) Date: Wed, 26 Dec 2001 17:23:25 +0100 Subject: Pascal's triangle (beginner) References: <2oqj2ucmbo2658uq1dq3v8quc6f116d8tq@4ax.com> Message-ID: "Brandvik" schrieb im Newsbeitrag news:2oqj2ucmbo2658uq1dq3v8quc6f116d8tq at 4ax.com... > I've just started learning Python and I'm wondering how one could > write a function that would print pascals triangle up to a certain > number. It would be great if some of you guys could give me some hints > on how such a script would look. It is not important that the output > is in the form of a triangle -- I'm just wondering how to calculate > the values and print them like this: > 1 > 11 > 121 > 1331 > 14641 > etc... > > BTW, this is my first post here... Look at http://www.inetarena.com/~pdx4d/ocn/python/series.html for the answer on this and several related questions that my come up. Karl M. Syring From jeff at ccvcorp.com Thu Dec 20 13:31:30 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Thu, 20 Dec 2001 10:31:30 -0800 Subject: Looping in Python References: <9vl8os$gcs$1@bob.news.rcn.net> <7934d084.0112172036.486d4672@posting.google.com> Message-ID: <3C222E81.7D6EFB5C@ccvcorp.com> Andrae Muys wrote: > With python 2.2 we now have access to Generators, which can achieve > the same thing. Consider the following... > > from __future__ import generators > > def frange(start,stop,step=1.0): > while start < stop: > yield start > start += step > > l = [] > for i in frange(1.0, 10.0): > l.append(i) > print l > [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0] Of course, using floating point steps has its dangers: for i in frange(1.0, 2.0, 0.1): repr( i ) '1.0' '1.1000000000000001' '1.2000000000000002' '1.3000000000000003' '1.4000000000000004' '1.5000000000000004' '1.6000000000000005' '1.7000000000000006' '1.8000000000000007' '1.9000000000000008' This being inherent in the nature of floating-point, of course, but someone's bound to complain... ;) Your frange() generator also doesn't handle negative steps, obviously, but that should be easy enough to fix. Jeff Shannon Technician/Programmer Credit International From greg at cosc.canterbury.ac.nz Mon Dec 10 00:45:34 2001 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Mon, 10 Dec 2001 18:45:34 +1300 Subject: Calling a generator multiple times References: <0gn21usqeasqa1bp4sveh0vjagtmbmfpof@4ax.com> <3C11FE92.1218662@letterror.com> Message-ID: <3C144BFE.F0D3659@cosc.canterbury.ac.nz> Just van Rossum wrote: > > I mentioned the > archives of python-iterators list before, but I think the PEP is a better > reference: > http://python.sourceforge.net/peps/pep-0255.html I don't think reading the list discussions is going to change anyone's mind. I read them all the first time around, and they didn't change mine. The crux of the matter seems to be in this paragraph from the PEP: In practice (how you think about them), generators *are* functions, but with the twist that they're resumable. The mechanics of how they're set up is a comparatively minor technical issue, and introducing a new keyword would unhelpfully overemphasize the mechanics of how generators get started (a vital but tiny part of a generator's life). This could perhaps do with some elaboration. What I think it's saying is that, the vast majority of the time, generators will be called in the context of a for loop: for x in some_generator(some_args): ... Now, in that case, if you squint at it and don't question anything too closely, you can pretend it's Icon and that the generator proceeds normally until it hits a yield at which point it starts behaving something like a couroutine. As long as you're willing to accept that fiction, you don't need to know about the magic going on when the generator is first called -- it's an implementation detail. But if you stop and think "Hey, wait a minute, how does that actually *work*?" and start playing around with the generator on its own, the magic starts showing through, and generators stop looking like ordinary functions at all. It's at *that* point that some of us get the very strong feeling that there is something wrong with declaring a generator just like a function. Telling us to go read the discussions or the PEP does nothing to dispel that feeling. We've been there, and have come to a different conclusion. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From jason at tishler.net Tue Dec 18 16:12:36 2001 From: jason at tishler.net (Jason Tishler) Date: Tue, 18 Dec 2001 16:12:36 -0500 Subject: Cygwin fork() rebase solution (was Re: dll_list::load_after_fork() blues ...) In-Reply-To: <20011212085744.A2400@dothill.com> References: <008101c1819b$021aa860$a300a8c0@nhv> <20011212085744.A2400@dothill.com> Message-ID: <20011218211235.GA2476@dothill.com> On Wed, Dec 12, 2001 at 08:57:44AM -0500, Jason Tishler wrote: > On Mon, Dec 10, 2001 at 11:52:08AM -0500, Norman Vine wrote: > > Michael Hudson writes: > > >FWIW, and I don't know how much that is, all tests pass if I link _socket > > >statically. Oh, and this is building without threads, it seems. I'll do > > >a new build with threads and see if anything changes, but I doubt it. > > > > GREAT IDEA ! > > > > I just rebuilt python 2.1.1 with threads and linking _socket statically > > and all seems to work :-) > > > > [snip] > > I just tried the above and it works. However, it only works if one has > not fiddled around with rebasing their DLLs. > > Although this is a good short-term workaround (and the one that I will > probably use when I release Python 2.2), I think that we should focus > our efforts on trying to solve this problem at its root cause -- Cygwin > fork() and DLL base address conflicts. Otherwise, when something else > changes we will be back in the same situation. I believe that I have found a rebase solution to the Cygwin fork() problem that has been causing Cygwin Python some grief lately. I added an offset option to the attached rebase tool. If I spread the DLLs out by an extra 0x10000, then the fork() problem seems to be mitigate. The following is the command line necessary to build rebase: $ g++ -O2 -o rebase rebase.cc -limagehlp After rebasing the necessary Cygwin DLLs: $ cd /usr/bin $ rebase -d -b 0x68000000 -o 0x10000 cygXpm-X4.dll cygXpm-noX4.dll \ cygbz21.0.dll cygcrypto.dll cygform5.dll cygform6.dll \ cyggdbm.dll cyghistory4.dll cyghistory5.dll cygintl.dll \ cygitcl30.dll cygitk30.dll cygjbig1.dll cygjpeg6b.dll cygmenu5.dll \ cygmenu6.dll cygncurses++5.dll cygncurses++6.dll cygncurses5.dll \ cygncurses6.dll cygpanel5.dll cygpanel6.dll cygpcre.dll \ cygpcreposix.dll cygpng2.dll cygreadline4.dll cygreadline5.dll \ cygregex.dll cygssl.dll cygtcl80.dll cygtclreg80.dll cygtiff3.dll \ cygtk80.dll cygz.dll I am able to build Python *without* the following patch: http://sourceforge.net/tracker/index.php?func=detail&aid=491107&group_id=5470&atid=305470 After rebasing the necessary Cygwin and Python DLLs: $ cd /usr/bin $ rebase -d -b 0x68000000 -o 0x10000 cygXpm-X4.dll cygXpm-noX4.dll \ cygbz21.0.dll cygcrypto.dll cygform5.dll cygform6.dll \ cyggdbm.dll cyghistory4.dll cyghistory5.dll cygintl.dll \ cygitcl30.dll cygitk30.dll cygjbig1.dll cygjpeg6b.dll cygmenu5.dll \ cygmenu6.dll cygncurses++5.dll cygncurses++6.dll cygncurses5.dll \ cygncurses6.dll cygpanel5.dll cygpanel6.dll cygpcre.dll \ cygpcreposix.dll cygpng2.dll cygreadline4.dll cygreadline5.dll \ cygregex.dll cygssl.dll cygtcl80.dll cygtclreg80.dll cygtiff3.dll \ cygtk80.dll cygz.dll ~/src/PythonCvs/nothreads/libpython2.2.dll \ ~/src/PythonCvs/nothreads/build/lib.cygwin-1.3.6-i686-2.2/*.dll I can run the full regression test without any failures *even though* _socket is a shared module. I encourage those interested in Cygwin Python to determine whether or not the above rebase solution works for them too. I'm particular interested in 9x/Me reports since I do not have access to those platforms. Please post your results to the Cygwin and Python mailing lists. If my findings are corroborated, then I will work with the Cygwin team to integrate rebase into setup.exe so that rebasing automatically occurs every time that setup.exe is run. Thanks, Jason -------------- next part -------------- /* * Copyright (c) 2001 Jason Tishler * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id: rebase.cc,v 1.5 2001/12/18 20:21:19 jtishler Exp $ */ #include #include #include #include #include #include #include #include #include using namespace std; string PosixToWin32(const string& aPosixPath); void ParseArgs(int argc, char* argv[]); unsigned long StringToUlong(const string& aString); void Usage(); ULONG theImageBase = 0; BOOL theDownFlag = FALSE; ULONG theOffset = 0; int theArgsIndex = 0; void main(int argc, char* argv[]) { ParseArgs(argc, argv); ULONG aNewImageBase = theImageBase; for (int i = theArgsIndex; i < argc; i++) { if (theDownFlag) aNewImageBase -= theOffset; string aFile = PosixToWin32(argv[i]); ULONG anOldImageSize, anOldImageBase, aNewImageSize; ULONG aPrevNewImageBase = aNewImageBase; BOOL aStatus = ReBaseImage( const_cast(aFile.c_str()), // CurrentImageName 0, // SymbolPath TRUE, // fReBase FALSE, // fRebaseSysfileOk theDownFlag, // fGoingDown 0, // CheckImageSize &anOldImageSize, // OldImageSize &anOldImageBase, // OldImageBase &aNewImageSize, // NewImageSize &aNewImageBase, // NewImageBase time(0)); // TimeStamp // ReBaseImage seems to never returns false! DWORD aStatus2 = GetLastError(); if (aStatus2 != 0) { cerr << "ReBaseImage() failed with last error = " << GetLastError() << endl; exit(2); } cout << aFile << hex << ": new base = " << ((theDownFlag) ? aNewImageBase : aPrevNewImageBase) << ", new size = " << aNewImageSize + theOffset << endl; if (!theDownFlag) aNewImageBase += theOffset; } exit(0); } string PosixToWin32(const string& aPosixPath) { char aWin32Path[MAX_PATH]; cygwin_conv_to_win32_path(aPosixPath.c_str(), aWin32Path); return aWin32Path; } void ParseArgs(int argc, char* argv[]) { const char* anOptions = "b:do:"; for (int anOption; (anOption = getopt(argc, argv, anOptions)) != -1;) { switch (anOption) { case 'b': theImageBase = StringToUlong(optarg); break; case 'd': theDownFlag = TRUE; break; case 'o': theOffset = StringToUlong(optarg); break; default: Usage(); exit(1); break; } } if (theImageBase == 0) { Usage(); exit(1); } theArgsIndex = optind; } unsigned long StringToUlong(const string& aString) { stringstream ss; unsigned long aUlong; string::size_type anIndex = aString.find("0x"); if (anIndex == 0) ss << hex << string(aString, 2, aString.size() - 2); else ss << aString; ss >> aUlong; return aUlong; } void Usage() { cerr << "usage: rebase -b BaseAddress [-d] -o Offset ImageFileName ..." << endl; } From arosadesaron at zipmail.com.br Thu Dec 6 21:08:02 2001 From: arosadesaron at zipmail.com.br (Keila - Curitiba) Date: Fri, 7 Dec 2001 00:08:02 -0200 Subject: CONVITE HP ALERTA Message-ID: <200112070203.fB723tD51297@smtp.ieg.com.br> Ol?! Veja meu site pessoal. Basta clicar no endere?o abaixo. GARANTO SER SUI-GENERIS - CLIQUE ABAIXO: http://www.pastorinha.atfreeweb.com Mais de 162.000 internautas visitaram a PG., existe 6 ?lbuns: Se voc? quiser, por favor, indique minha Home Page, a outros Internautas. Mais detalhes, se comunique, passe um e-mail, que responderei brevemente. Dentro da Home Page, ao lado das fotos, voc? poder? saber muito mais sobre mim! Obrigada. e-mail: arosadesaron at zipmail.com.br Beijos:- Keila - Curitiba - Pr - Podes falar comigo, direto dela. Brevemente uma Carta Aberta. - Embora derrubem a p?gina eu a subo em 3 horas novamente. "Esta mensagem ? enviada com a complac?ncia da nova legisla??o sobre correio eletr?nico, Se??o 301, Par?grafo (a) (2) (c) Decreto S. 1618, T?tulo Terceiro aprovado pelo "105? Congresso Base das Normativas Internacionais sobre o SPAM". Este E-mail n?o poder? ser considerado SPAM quando incluir uma forma de ser removido. Para ser removido de futuros correios, simplesmente responda indicando no Assunto: REMOVER" From pete at shinners.org Mon Dec 31 00:07:58 2001 From: pete at shinners.org (Pete Shinners) Date: Mon, 31 Dec 2001 05:07:58 GMT Subject: how to get traceback from segfault signal handler? Message-ID: <3C2FF490.9080307@shinners.org> i'd really-really like to get the python traceback from inside my own installed signal handler. i have a semi-big set of c extension modules, and it's sadly not too shocking for things to crash. (nothing of python's fault, for sure). but it would really aid everyone involved if a stacktrace could be printed, similar to a normal exception. the main problem it seems to come down to, i can't get ahold of the interpreter lock, because the thread execution is stopped. something like "PyThreadState_Get_VoidWarranty()" would really help me out? From bbollenbach at home.com Sun Dec 9 11:35:27 2001 From: bbollenbach at home.com (Brad Bollenbach) Date: Sun, 09 Dec 2001 16:35:27 GMT Subject: It's hard to find documentation References: <9uuith$qb8$1@peabody.colorado.edu> Message-ID: In article <9uuith$qb8$1 at peabody.colorado.edu>, Fernando P?rez wrote: > As already discussed, the website is absolutely useless. > > But at the python command prompt, just type 'from pydoc import help'. > > Then type one of: > help function_name > help 'keywords' > help 'modules' > help 'topics' > > or just plain help. The system is quite impressive. Also, don't > forget the fabulous pydoc -g which runs the module doc system as a > webserver on port 7464. I'm well aware of pydoc. Using your instructions on how to use it, we /still/ aren't able to locate the top-level document Bruce was interested in: mothra at mothra:~$ python2.1 Python 2.1.1 (#1, Nov 11 2001, 18:19:24) [GCC 2.95.4 20011006 (Debian prerelease)] on linux2 Type "copyright", "credits" or "license" for more information. >>> from pydoc import help >>> help("Extending and Embedding the Python Interpreter") no Python documentation found for 'Extending and Embedding the Python Interpreter' >> If I wanted it badly enough, I would have done so already. :) > > Ka-Ping Yee already did. Kudos to Ka-Ping Yee. He obviously wanted it more than I did, but it still doesn't provide the extreme ease of use (particularly for accessing top-level documents with minimal effort) that, for example, perldoc does. (That isn't a Perl plug, but the name "pydoc" implies that it wanted to be Python's equivalent of perldoc.) Brad From gh_pythonlist at gmx.de Sat Dec 8 15:46:21 2001 From: gh_pythonlist at gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Sat, 8 Dec 2001 21:46:21 +0100 Subject: lost interest? In-Reply-To: <20011208225631.GA6172@blackscarab> References: <200112081559.fB8FxOJ22691@my.knctv.co.kr> <20011208225631.GA6172@blackscarab> Message-ID: <20011208204618.GA890@lilith.hqd-internal> Le 08/12/01 ? 17:56, cruciatuz ?crivit: > On Sun, Dec 09, 2001 at 12:54:02AM +0900, Jonathan Gardner wrote: > > > On Sunday 09 December 2001 12:07 am, John Roth wrote: > > > However, the interactive mode of CPAN (perl -MCPAN -e shell) is pretty cool. > > You can specify mirrors to download from pretty easily, it will check what > > you got and figure out what you need, and it has a few nice touches that > > makes it really useful. Something like this would be useful for Python in > > general. However, I find the traditional do-it-yourself easy and sufficient. > > That's just me, so... > THIS is cpan? > If i understand you right, you can deal with perl modules like you can > with debian's apt-get tool? (i just tried the command "perl -MCPAN -e shell") > > I'd really like something like that for python, based on "setup.py", but > with the option to download the package directly. > > something like: $> py-get module install > > this would cool :) Check out the ActiveState Python distribution. Their ppm tool can do this and more. Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From aleax at aleax.it Fri Dec 28 11:22:25 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 17:22:25 +0100 Subject: REPOST: Re: regex question: backreferences in brackets References: Message-ID: <0$--$$_----_---%%$@news.noc.cabal.int> "Jeremy Jones" wrote in message news:mailman.1009552952.16557.python-list at python.org... ... """ match_string = 'XXX|1|22|333|4444:' test_compile = re.compile(r'XXX(.)[^|]{1}\1[^|]{2}\1[^|]{3}\1[^|]{4}(.)') mymatch = test_compile.match(match_string) if mymatch: print "Found a match" print mymatch.group(0) else: print "No match found" """ The format of the strings that I am trying to match are 3 specific characters followed by some delimter followed by N number of characters other than the delimiter followed by the delimiter, etc. The above code snipped works and matches the string perfectly. I guess my question is this: how can I match any other character except for the delimiter without knowing it beforehand (which I won't know what it is beforehand)? I am thinking use the backreference to the delimiter (i.e. Simplest might be something like: def clevermatch(match_string): try: myre = r'XXX(.)[^|]{1}\1[^|]{2}\1[^|]{3}\1[^|]{4}(.)'.sub('|', re.escape(match_string[3])) except IndexError: return None else return re.match(myre, match_string) i.e., tweak the re pattern appropriately before using it as a re. Alex ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Alex Martelli" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:30:50 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775269 27193 211.57.49.2 (31 Dec 2001 05:07:49 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:07:49 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From dodo_imp at hotmail.com Sun Dec 16 07:31:45 2001 From: dodo_imp at hotmail.com (Luca Bruderer) Date: Sun, 16 Dec 2001 13:31:45 +0100 Subject: Problems with Gadfly References: Message-ID: Hi I have problems to run the gadfly db server: When I start it with the command: C:\Python22\Lib\site-packages\gadfly>python gfserver.py 2222 test dr_test admin I get this error: Traceback (most recent call last): File "gfserver.py", line 101, in ? main() File "gfserver.py", line 89, in main S = Server(int(port), db, dr, pw, startup) NameError: global name 'Server' is not defined The os is winxp. thx in advance From aleax at aleax.it Fri Dec 28 06:26:48 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 12:26:48 +0100 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9901.998345FB@earthlink.net> Message-ID: <6$--$$_--__-%$__$$@news.noc.cabal.int> "Steve Lamb" wrote in message news:slrna2nhl5.nme.grey at teleute.dmiyu.org... > On Thu, 27 Dec 2001 21:53:41 GMT, Ron Stephens wrote: > > Now, my perception is that most Ruby developers run under Linux or some > > other Unix. I wonder what percentage of Python developers run Windows, and > > what percentage run Linux? I have no idea, does anyone have a guess? If you > > put my back to the wall to make a prediction, I'd guess that more than half > > of us on this newsgroup use windows. Anyone? > > Well, sure, worded that way. I /use/ Windows. I need something for my > games and while Linux suits 99.5% of my productivity needs it isn't quite > there in the games market. I don't do much gaming, but I still have to use Windows (mostly in win4lin under Linux) for a few needs (e.g., SOME durned webpages that I need won't show correcty under any browser except Internet Explorer). Not to mention that think3 is a mostly-Windows shop, too. Linux is my preferred platform for most tasks, except that my firewall/etc machine runs OpenBSD (sometimes security is more important than richness of features, support for strange hardware, and so on). Python runs just great on all of these platforms, and more besides. Alex ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail Message-ID: Control: cancel Subject: cmsg cancel From: "Alex Martelli" Newsgroups: comp.lang.python X-No-Archive: yes Lines: 2 NNTP-Posting-Host: wonenara.ozemail.com.au X-Trace: ozemail.com.au 1009643056 203.108.164.177 (Sun, 30 Dec 2001 03:24:16 EST) NNTP-Posting-Date: Sun, 30 Dec 2001 03:24:16 EST Organization: OzEmail Ltd, Australia Distribution: world Date: Sat, 29 Dec 2001 12:35:57 GMT This message was cancelled from within Mozilla. From jkraska at san.rr.com Mon Dec 17 18:26:19 2001 From: jkraska at san.rr.com (Courageous) Date: Mon, 17 Dec 2001 23:26:19 GMT Subject: do not know what is wrong python under win2k References: <3C1E752E.8864E2E9@htp-tel.de> <5KuT7.15581$PA.12409@atlpnn01.usenetserver.com> <3C1E7E22.D6169237@htp-tel.de> Message-ID: >This was the problem - i always thought i had to type this in in the >open interpreter shell. You can get the interpreter to interpret a python file by importing it, ala: >>>> import spam.py I do this often. It's generally best to learn to live in the interpreter for testing things. If there are specific methods or attributes you want to invoke or access, you can then do so by such forms as >>>> spam.someVariable ...or... >>>> spam.someFunction() C// From dale at riverhall.NOTHANKS.co.uk Fri Dec 21 14:16:02 2001 From: dale at riverhall.NOTHANKS.co.uk (Dale Strickland-Clark) Date: Fri, 21 Dec 2001 19:16:02 +0000 Subject: PyGame on Lamp References: Message-ID: Oleg Broytmann wrote: >http://www.onlamp.com/pub/a/python/2001/12/20/pygame.html > >Oleg. I had a quick look at Pygame a couple of days ago and downloaded one of the project games: Solar Wolf. It's not at all bad and the kids love it. It's also a slick, self-contained install and doesn't need Python. I'm impressed. -- Dale Strickland-Clark Riverhall Systems Ltd From jsmith at imaphost.com Wed Dec 12 12:47:33 2001 From: jsmith at imaphost.com (Joe Smith) Date: Wed, 12 Dec 2001 17:47:33 GMT Subject: more fun with PEP 276 References: Message-ID: > > In article , > philh at comuno.freeserve.co.uk (phil hunt) wrote: > > > how about: > > > > for i in -5 to 5: > > > > or > > From rdsteph at earthlink.net Fri Dec 28 19:42:54 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Sat, 29 Dec 2001 00:42:54 GMT Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9E04.9957801F@earthlink.net> Message-ID: <9$--$$_----_-%$$%$@news.noc.cabal.int> Hmm that's really a shame. Surely someone , somehow, could do a better job of documenting Zope. I hope the managers of Digital Creations are aware of the problem; this is certainly not the first time I've heard of it, although your description was most telling. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Ron Stephens Newsgroups: comp.lang.python Subject: cmsg cancel <3C2D1210.2E30B9C9 at earthlink.net> Control: cancel <3C2D1210.2E30B9C9 at earthlink.net> Date: Mon, 31 Dec 2001 02:27:45 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774952 27193 211.57.49.2 (31 Dec 2001 05:02:32 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:02:32 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From fperez528 at yahoo.com Mon Dec 17 10:41:06 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Tue, 18 Dec 2001 15:09:06 +2328 Subject: /usr/bin/env: python: No such file or directory References: <9vnvue$m5d$1@peabody.colorado.edu> <9vo6ng$mhs$1@nntp6.u.washington.edu> Message-ID: <9voeu0$2sn$1@peabody.colorado.edu> Trond Eivind Glomsr?d wrote: >> Why won't Redhat upgrade their software? > > Compatiblity. Programs for RHL 7 should run just fine on 7.2 as well. > > When we start a new series, we will upgrade to the newest python > available at the time, port the software using python to that and > stick with this release for that series of Red Hat Linux releases. > I see someone from RH is listening, so let me ask again, and apologies for any inflammatory language in my first post. But the issue made me waste so many hours this past week that I wasn't in a particularly good mood about it. I understand you compatibility issues. On the other hand, I'm sure you realize you are breaking an extremely widely used convention by installing the currently standard series of python as /usr/bin/python2, since that means the idiom '#!/usr/bin/env python' won't work for many people, and it will be particularly suprising to those who assumed they had installed Python 2.x. I know, they can always go and fix all their scripts, but that puts an undue burden on the user, it seems to me. I see a few options for RedHat to do things 'right' for your users in terms of providing a saner python environment without breaking your own internal setup: 1) Upgrade your internal anaconda and other system code to work with Python 2.x, *without requiring it*. This way you could ship 7.2 with python 2.x as the default python and the same programs would still run under python 1.x in older redhat releases. This shouldn't be too hard at all, since almost all of python 1.5 code runs unchanged under 2.x. In fact I suspect the code may actually work already, once the support packages are copied to the right place (haven't had time to try). If that's the case, it is a real shame that you put pyhton1.5 as the system default without any real techical justification. or 2) Change *only* the first line in your system python scripts to explicitly point to /usr/bin/python1.5. I don't know if this would change anything with respect to your older releases, but the code itself wouldn't be affected. Again, this would allow python 2.x to be the default at /usr/bin/python with absolutely minor changes to all your system scripts. And if someone is going to install system 7.2 scripts on a 7.1 machine, as bizarre as that sounds, a simple fix would be for them to link python1.5 to python. These seem to be perfectly reasonable solutions, while the current setup leaves the users in a particularly unpleasant situation: any code you run with '#!/usr/bin/env python' will trigger a call to python1.5, which may cause it not to run (if it needs python2 features), but you can't change the system default without breaking fundamental functionality. So could you explain to us why RedHat chose not to allow their users to use python2 as the standard system default, even though as I pointed, there are very reasonable ways of maintaining compatibility for your own scripts? Regards, F. From quinn at retch.ugcs.caltech.edu Thu Dec 20 15:36:48 2001 From: quinn at retch.ugcs.caltech.edu (Quinn Dunkan) Date: 20 Dec 2001 20:36:48 GMT Subject: Inheriting Python modules? References: <%LKT7.2764$NB2.64678@news2.nokia.com> Message-ID: On Tue, 18 Dec 2001 17:10:19 GMT, Timo Linna wrote: >Hi, > >How should "dynamic module inheritance" be implemented with Python? > >Example: > >It should be possible to write: "import defaults" so that it would first >import everything from common.defaults -module and after that other stuff >from product.defaults-module. Content of both modules should be accessible >through one common (defaults) interface so that the caller wouldn't have to >know from which module the code is actually accessed. > >I would NOT like to create "dummy" logical defaults-module which would >simply import both modules - things should happen automatically at runtime. Anyway, untested: class Multi_namespace: def __init__(self, namespaces): self.namespaces = namespaces def __getattr__(self, attr): for ns in self.namespaces: try: return getattr(ns, attr) except AttributeError: pass raise AttributeError(attr) m = Multi_namespace(map(__import__, (sys, os))) print m.path print m.access If you like that sort of thing, you could stuff 'm' into sys.modules. Speaking of which, here's a fun way to bind a lot of names: class c: pass for k, v in lot_of_names: setattr(c, k, v) sys.modules['c'] = c from c import * From fperez528 at yahoo.com Thu Dec 6 08:58:54 2001 From: fperez528 at yahoo.com (Fernando =?ISO-8859-1?Q?P=E9rez?=) Date: Fri, 07 Dec 2001 13:26:54 +2328 Subject: numerical packages for 1.5.2? References: Message-ID: <9ur8nk$fg6$1@peabody.colorado.edu> Mark Fardal wrote: > > Hi, > > I'd like to do some scientific/numerical work with Python. On the > computers accessible to me, Python 1.5.2 is quite common but Python > 2.x is not to be found anywhere. I don't have root password to most > of these computers. I'd also like to share my code with > collaborators, and don't want to make them upgrade Python itself > (which is significantly harder than upgrading Python packages). So, > it looks like Python 1.5.2 is it for now. These are mostly > Linux/x86 systems with a few SGIs. > > Given that restriction, what version of Numeric should I be using? > Is > there a version of SciPy that will work on 1.5.2? Are there known > bugs in any of these versions I should watch out for? > > thanks > Mark Fardal > University of Victoria Why don't you just create a ~you/local/ directory and build py2.1 there? It will take a half hour, and the improvements are substantial. You can just tell your friends to have an alias that points to ~you/local/bin/python for them to use it without upgrading anything. Just an idea, since you lose some important features with python<2.0 for numeric (such as rich comparisons: a <3C22400F.8000401@dittmar.net> Message-ID: <8$--$$_----___%$%$@news.noc.cabal.int> Daniel Dittmar wrote: >> if I execute >> os.system("copy c:\a.txt c:\b.txt") >> It does not happen when the cgi page is called from a browser. >> However if the script is run from the command line, it works fine. Try os.system( r"copy c:\a.txt c:\b.txt" ) ... to make that into a *raw* string (one in which a \ is just a \ and not a special character. > In this specific case, you could use shutil.copy. In general, console > applications (like cmd.exe) will not work inside a service or a GUI only > program. You might try using the popen2 module, which possibly sets up > stdin and stdout just right such that Windows doesn't need the console > window. Setting the property 'may interact with desktop' for the IIS > service might work as well, but you'll get annoying windows flashing > across the screen. > Daniel For this particular example, shutil.copy() is better. For the general case of passing literal strings, esp. MS-DOS compatible filespecs with \'s, use raw strings when you can, mind your escape sequences when you can't. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "James T. Dennis" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:14:10 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774668 27193 211.57.49.2 (31 Dec 2001 04:57:48 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:57:48 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From Administrator Mon Dec 3 02:20:07 2001 From: Administrator (Administrator) Date: Mon, 3 Dec 2001 00:20:07 -0700 Subject: ScanMail Message: To Recipient virus found and action taken. Message-ID: <050401c17bca$ef7cac60$0e0fbb82@corp.es.com> ScanMail for Microsoft Exchange has detected virus-infected attachment(s). Sender = Baunehoej Efterskole Recipient(s) = python-list at python.org Subject = Re: Scanning Time = 12/03/2001 00:20:07 Engine/Pattern = 5.600-1011/173 Action on virus found: The attachment docs.DOC.pif contains WORM_BADTRANS.B virus. ScanMail has Deleted it. Warning to administrator. ScanMail has detected a virus. 12/03/2001 12:20 AM TORINO docs.DOC.pif/Deleted python-list at python.org Baunehoej Efterskole Re: From infinitystwin.SPAM at IS.BAD.yahoo.com Tue Dec 25 16:49:30 2001 From: infinitystwin.SPAM at IS.BAD.yahoo.com (Greg Krohn) Date: Tue, 25 Dec 2001 15:49:30 -0600 Subject: How best to check for existance of an attribute? References: Message-ID: <3c28f373$0$79558$6e49188b@news.goldengate.net> "Roy Smith" wrote in message news:roy-DD8C6B.16193025122001 at news1.panix.com... > I've got a function which augments an object passed to it by adding a new > attribute. Something like this: > > def addStuff (obj): > obj.newAttr = "stuff" > > I want it to be an error to call addStuff() more than once for a given > object. The simpliest way to do this would be with something like perl's > defined() function: > > def addStuff (obj): > if defined (obj.newAttr): > raise MultipleCallError > else: > obj.newAttr = "stuff" > > What's the best way to simulate defined()? I could think of a few > possibilities. For example, either of the following seem like they would > work: > > def addStuff (obj): > if 'newAttr' in dir (obj): > raise MultipleCallError > else: > obj.newAttr = "stuff" > > def addStuff (obj): > try: > obj.newAttr > raise MultipleCallError > except AttributeError: > obj.newAttr = "stuff" > > Any reason to pick one over the other, or perhaps a third way? This is what I would do: def addStuff (obj): if hasattr(obj, 'stuff'): raise MultipleCallError else: setattr(obj, 'stuff', None) But then again, that's just me. greg From duncan at NOSPAMrcp.co.uk Tue Dec 4 07:21:40 2001 From: duncan at NOSPAMrcp.co.uk (Duncan Booth) Date: Tue, 4 Dec 2001 12:21:40 +0000 (UTC) Subject: Where's the error? References: <9uibrc$199$1@newstoo.ericsson.se> Message-ID: "Bror Johansson" wrote in news:9uibrc$199$1 at newstoo.ericsson.se: > regline = > re.compile('^(\*)?\s+\\([^\s]+)\s+\\\\([^\s]+)\s+(p(rivate)|(ublic))\s* > $') > > Can anyone help me clear my eyesight? > I suggest you either try using raw strings here, or you escape all the backslashes. If you copy the string into a variable and print it you should see the problem pretty quickly: >>> s = '^(\*)?\s+\\([^\s]+)\s+\\\\([^\s]+)\s+(p(rivate)|(ublic))\s*$' >>> s '^(\\*)?\\s+\\([^\\s]+)\\s+\\\\([^\\s]+)\\s+(p(rivate)|(ublic))\\s*$' >>> print s ^(\*)?\s+\([^\s]+)\s+\\([^\s]+)\s+(p(rivate)|(ublic))\s*$ >>> It looks to me as though the second ( is escaped in the regular expression, but the second ) is not. -- Duncan Booth duncan at rcp.co.uk int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3" "\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure? From realefab at tiscalinet.it Thu Dec 20 08:10:40 2001 From: realefab at tiscalinet.it (Fabrizio) Date: Thu, 20 Dec 2001 14:10:40 +0100 Subject: How to generate XML Message-ID: <3c21e330@news.opennet.it> Does anybody know if there are modules to generate XML? I know there is SAX, but it is only for parsing, isn't it? Thank. Fab From syver-en+usenet at online.no Sun Dec 2 08:50:32 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 02 Dec 2001 14:50:32 +0100 Subject: Help with classes References: <9uc9v5$g69$1@news.xmission.com> <3C09C85E.94379059@earthlink.net> <9ucl56$jjq$1@news.xmission.com> Message-ID: Kaden writes: > On Sun, 02 Dec 2001 06:21:24 GMT, Hans Nowak wrote: > I know these errors look pretty stupid to the experienced readers, No, you were right on track all the time, entertaining to read about. Everybody has to begin somewhere. Keep up the good work. -- Vennlig hilsen Syver Enstad From rcena at epcor.ca Sat Dec 29 09:21:51 2001 From: rcena at epcor.ca (Resty Cena) Date: 29 Dec 2001 06:21:51 -0800 Subject: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <458b194a.0112282052.1123341@posting.google.com> Message-ID: <458b194a.0112290621.4134fdaa@posting.google.com> "Kevin Altis" wrote in message news:... > I couldn't agree more. Thus you won't be surprised that in many ways that is > the sweet spot that PythonCard is aiming at. You'll need wxPython 2.3.2 or > higher and Python 2.x to give it a try, but you can at least look at screen > shots if nothing else. > > http://pythoncard.sourceforge.net/ > > We are moving towards a component model, which will give you many of the > capabilities you are familiar with from using COM. There is a layout editor > (the resourceEditor sample) and automatic event binding and event handlers > that should look a lot like what you have used with VB. You can already > build standalone Windows executables using py2exe. > Yes, I've been following the progress of PythonCard (and Boa Constructor) very intently (I did some educational stuff in HyperCard a long time ago). I must congratulate you and the team for the tremendous progress made in such a short time. Tim Churches made this list in another posting. I'd put (a), (b), and (e) as my top priority. The main things which PythonCard needs are: a) A drag-and-drop form editor (I believe this is being worked on) b) Automated bindings of data-aware controls to underlying databases. c) A drag-and-drop SQL query editor. d) A banded report writer like Access or Crystal reports. e) A really easy installation routine which handles the database installation/adminstration as well. f) Excellent documentation. Best wishes, rmc > "Resty Cena" wrote in message > news:458b194a.0112282052.1123341 at posting.google.com... > > The real source of growth for both Python and Ruby are the 3M VB > > developers worldwide. Whichever can provide what it is that VB > > developers like about VB on top of what Python and Ruby natively offer > > will hit the jackpot. To me these are: (a) Visual drag-and-drop > > application builder with data aware controls, and (b) good support for > > the big databases (Oracle, Sybase, Informix). I'm going through the > > gui chapters of Mark Lutz' PP2E, and while I can see that handcrafting > > gui this way gives me a lot of control, I'm thinking I don't want to > > do this -- I'm a database application developer. I want to write a > > dynamic work order system and I have no ambition to become a system > > tool maker. And so do the 3M VB developers. > > > > VB used to be a toy language. Not too long ago no respectable company > > would use VB for their corporate systems. It did not start to become > > an enterprise solution until VB3. What happened there? > > > > VB 6 will be retired in favor of VB.NET. Personally I think that the > > direction VB has taken, towards a verbose C#, is misguided. VB should > > have evolved into something like Python or Ruby. With VB.NET, VB > > programmers will ask, "What's the point?" Might as well dive into C#. > > Or look around for something else. > > > > Hopefully by that time -- 18 months from now? -- Python and/or Ruby > > will have what it is VB programmers cannot live without. > > > > Folks, come up with (a) and (b) above, then start posting at c.l.vb. > > > > > > Paul Prescod wrote in message > news:... > > > Dave Thomas wrote: > > > > > > > > ... Instead, Ruby will attract folks from outside the > > > > Python world. Ruby and Python differ in philosophy and _feel_. Some > > > > folks like one, some the other. I don't see it as competition. I see > > > > it as choice. > > > > > > Is there really a difference? Pepsi and Coke are choices. They are also > > > in competition. They have a somewhat different taste but are more > > > similar than different. In the long run, there will come a day when > > > they've taken as much of the market share of other drinks away as they > > > will, and the primary competition will be between the two of them. > > > > > > Paul Prescod From joel.quinet at be.unisys.com Mon Dec 10 10:05:01 2001 From: joel.quinet at be.unisys.com (Joel Quinet) Date: Mon, 10 Dec 2001 16:05:01 +0100 Subject: How to change IP Address by Python program on Win Platform References: <9v2aqb$mbt$1@ih292.ea.unisys.com> Message-ID: <9v2fh1$pa9$1@ih292.ea.unisys.com> Windows Platform and more generally NT and 2K Sorry for that. Joel "John Hunter" wrote in message news:m2itbftbe1.fsf at mother.paradise.lost... > >>>>> "Joel" == Joel Quinet writes: > > Joel> Hi all, I have to change my IP address on my laptop > Joel> frequently for testing. I am borring to do it by setting... > Joel> I would like to do it by Python script. > > Joel> How can I do that ? > > You will need to tell us your platform before anyone can begin to > answer this question. > > John Hunter > > From bas.vangils at home.nl Sun Dec 23 06:48:22 2001 From: bas.vangils at home.nl (Bas van Gils) Date: Sun, 23 Dec 2001 12:48:22 +0100 Subject: vi or emacs for editing Python on Linux? In-Reply-To: <200112231119.fBNBJAJ02753@my.knctv.co.kr> References: <200112231119.fBNBJAJ02753@my.knctv.co.kr> Message-ID: <20011223114822.GB6718@kub.nl> On Sun, Dec 23, 2001 at 08:19:56PM +0900, Jonathan Gardner wrote: > Bottom line: You have to spend at least a week using both editors before you > can make a good decision. I agree with Jonathan. I started of on linux/unix using pico, and moved on towards vim, mainly because my co-workers used it. After a while I tried using Emacs and found it a nice editor as well, after struggling with the key-strokes :-) There's two things that I missed in the thread so far. The first is that 'idle' wasn't mentioned. For Python-programming I use Idle fairly often and I'm quite happy with it. The second is the `way of life' in both Emacs and vim. I found that when I was using Emacs , I opened many buffers and kept only 1 instance of Emacs running at a time. With (g)vim, however, I usually have many instances running with only 1 or 2 buffers open. Oh, before I forget. I think the commands in (g)vim, often, are more 'logical' then the keystrokes in Emacs, but that's a matter of taste. hope-this-helps'ly yours Bas -- Bas van Gils - http://members.home.nl/bas.vangils Build a system that even a fool can use, and only a fool will want to use it. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available URL: From hoel at germanlloyd.org Thu Dec 20 11:49:07 2001 From: hoel at germanlloyd.org (Berthold Höllmann) Date: 20 Dec 2001 17:49:07 +0100 Subject: Extending python with CXX Message-ID: Hekko, I'm currently writing a python extension module using CXX. Now I come to a point where I have to track down a problen that gives me /usr/software/Python-1.5.2-sun4-sol251/share/python1.5/CXX/cxx_extensions.cxx:1011: failed assertion `ob_refcnt == 0' at some point of my code. Are there any more advanced demos for CXX where I can look for classes that make use of other self defined CXX extension classes. I'm afraid I'm still lost in reference counting. The debugger is not realy helpful. libwadpy points to an empty source line in my sourcecode. Is there any mailing list devoted to CXX? Thanks for your help Berthold -- Dipl.-Ing. Berthold H?llmann __ Address: hoel at germanlloyd.org G / \ L Germanischer Lloyd phone: +49-40-36149-7374 -+----+- Vorsetzen 32/35 P.O.Box 111606 fax : +49-40-36149-7320 \__/ D-20459 Hamburg D-20416 Hamburg From loewis at informatik.hu-berlin.de Wed Dec 26 19:20:02 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 27 Dec 2001 01:20:02 +0100 Subject: REPOST: Re: Properties fun with 2.2 References: Message-ID: <0$--$$-$$$$%__%-$$@news.noc.cabal.int> "Mike C. Fletcher" writes: > The "only defined properties" thing can be done with a __slots__ > definition in the object, but then there's no __dict__ in which to store > the data (there must be some way to say "store in the slot", I just > don't see it right now). Delegating to a different attribute might be appropriate: class X(object): __slots__ = ['_a'] def set_a(self, val): self._a = val def get_a(self): return self._a a = property(get_a, set_a) Regards, Martin ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Martin von Loewis Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:15:49 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009776224 27193 211.57.49.2 (31 Dec 2001 05:23:44 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:23:44 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From aleax at aleax.it Thu Dec 6 10:08:05 2001 From: aleax at aleax.it (Alex Martelli) Date: Thu, 6 Dec 2001 16:08:05 +0100 Subject: newbie str to int References: <9pbetr$jp83@imsp212.netvigator.com> Message-ID: <9uo1ki$7lm$1@serv1.iunet.it> "Wojtek Walczak" wrote in message news:slrna0ppdm.ck.gminick at hannibal.localdomain... > Dnia Wed, 03 Oct 2001 23:11:00 GMT, Andrei Kulakov napisa?(a): > >On Tue, 2 Oct 2001 12:22:29 +0800, James wrote: > >> I am switching from Perl to Python, and would > >> like to convert string '123abc' to integer 123. > >> foo = int('123abc') # error > >> foo = string.atoi('123abc') #error > >> foo = eval('123abc') # error > >import string > >lst = "" > >for char in "123abc": > > if char in string.digits: > > lst += char > > else: > > break > >num = int(lst) > or sth like that: > > a = '123abc456gfh' > b = [] > > for i in a: > if i.isdigit(): > b = b +i > print b # 123456 This doesn't reproduce Perl behavior (Perl would take this string as worth 123, not 123456). Anyway, if yours is the behavior that is indeed required, rather than Perl's, then a very fast alternative might be: import string no_translation = string.maketrans('', '') non_digits = string.translate(no_translation, no_translation, string.digits) def ww_string_to_int(astring): return int('0'+string.translate(astring, no_translation, non_digits)) As seems to be most often the case in my usage of the speedy string.translate function, I don't really want any translation; rather, I use the 'deletion' ability of the function. string.translate(s, table, deletechars) returns a copy of s [if you pass as 'table' a don't-translate table, like here], without the characters found in the string passed as argument deletechars. So, the first call to string.translate, used during module initialization, is actually getting the complement of string.digits (since the table no_translation is a string of all 256 1-byte characters); the second call, inside function ww_string_to_int, is removing non-digits, i.e., keeping only the digits. I prepend a '0' to make sure a string containing no digits at all evaluates to 0 (you could alternatively do this with a try-except, of course). If the original poster needs the *prefix* of the string made up of digits, unfortunately there is no such direct support in the string module. Using the re module and a regular expression such as r'^(\d+)' is one obvious possibility, but if one must avoid re's then one has to code something like: def op_string_to_int(astring): for i in range(len(astring)): if not astring[i].isdigit(): return int('0'+astring[:i]) return int('0'+astring) Alex From James_Althoff at i2.com Wed Dec 5 17:10:08 2001 From: James_Althoff at i2.com (James_Althoff at i2.com) Date: Wed, 5 Dec 2001 14:10:08 -0800 Subject: Python evangelists unite! Message-ID: Peter Milliken wrote: >Sorry Jim, you are one up on me here, I have never had to face this >situation. Thanks for the tip. Could you provide a real example of where you >might want this? (if it isn't too long to give! :-)). You have made me >curious. Sure thing. Java/Swing is a large and sophisticated GUI framework (written in Java -- we access it via Jython). There is a superclass JComponent that defines a large number of fields and methods that are inherited by most other GUI components in the framework. We have found several examples where you want to mark some of your components in order to give them special treatment. Here's one. For the ui of an application we want to be able to mark one or more of the many buttons (or other controls) that might appear in a given panel as being "emphasized". The emphasized controls are what the user would normally click most of the time and we want these to be highlighted in some prescribed way (according to our corporate guidelines for UI look and feel). Swing is designed in a flexible way that lets you easily change the look of a component. So it is easy for us to go to that part of the code and change the drawing algorithm to suit our needs. But *only* if we know *which* components need to be drawn with emphasis. So we need to be able to mark the emphasized controls in some fashion. One option is to subclass the controls to add such an attribute. However, we can't subclass JComponent because it is the superclass of all the other controls. And we don't want to subclass each of the other controls because there are *many* of them. And, in any case, the added attribute would not be generic to all of them, and we would have to maintain lots of extra classes, etc. There are a lot of problems with this approach. Another approach is to maintain some kind of list of the emphasized controls. But this is nasty because then you need to create a globally defined list (because it is accessed all over the application) -- which is rarely a good idea. The global list, for one thing, causes garbage collection problems because it has extra references to the emphasized controls. So then you need to add lots of extra code to try to manage the extra references. Or you need to use advanced techniques like weak references. Again, it is a mess. The *easy* and *straightforward* solution is just to add an "emphasized" attribute to each component *instance* that is to be emphasized. The drawing code can test for the attribute. If the attribute exists, then the code draws the control in the emphasized way. If not, it draws the control in the usual way. The Swing designers -- not knowing our application, of course -- did not include an "isEmphasized" property in JComponent. And Java doesn't allow one to add instance-specific attributes. But the Swing designers did realize that people would need to do this kind of thing so they included a catchall hashtable in JComponent that clients can use to add (putClientProperty) and read (getClientProperty) "instance-specific" attributes. Generally, when you deal with user interface widgets (in a large GUI framework) a lot, you tend to see lots of cases where instance-specific attributes (both fields and methods) come in handy. Jim ============================================ wrote in message > Peter Milliken wrote: > >There is no real justification that works for these "features" of python - > > OTOH, there *are* plenty of good *reasons* for them. > > Consider "adding attributes to instances". Languages that don't support > this feature directly require some kind of a workaround since this is > something that one simply needs to do from time to time. A typical > workaround is to define, as part of a class's definition, a catch-all > property whose value is a hashtable. Clients add "instance-specific" > attributes to a given instance "on the fly" by adding name-value pairs to > the instance's hashtable. Java/Swing's JComponent (with its > putClientProperty and getClientProperty methods) is a good example of this > type of workaround. > > Jim From mwh at python.net Thu Dec 6 10:20:53 2001 From: mwh at python.net (Michael Hudson) Date: Thu, 6 Dec 2001 15:20:53 GMT Subject: pyrepl-0.6 References: <3b091a1c.0112060650.1f185978@posting.google.com> Message-ID: cmkleffner at gmx.de (cmkl) writes: > Really cool, > > during development I'm able to put several lines with > > pyrepl.python_reader.ReaderConsole(vars(), 0, None).interact() > > within the code, even inside functions! > > All I need is 'import pyrepl.python_reader' at the beginnig of > the module. Now I can estimate the state of the programm interactivly > within the scope of the function - break pyrepl with CTRL - proceed > with the script and take a break at the next line with pyrepl.... > > Some kind of debugging with hardcoded breakpoints or > 'debbuging for dummies'. This is the thing I was looking for! Heh, that is quite a neat idea. Certainly one that hadn't occurred to me. BTW, pyrepl can integrate itself somewhat into pdb (see pyrepl.py for details), but it's not that thorough yet. Cheers, M. -- same software, different verbosity settings (this one goes to eleven) -- the effbot on the martellibot From brueckd at tbye.com Thu Dec 27 12:12:28 2001 From: brueckd at tbye.com (brueckd at tbye.com) Date: Thu, 27 Dec 2001 09:12:28 -0800 (PST) Subject: Python Popularity: Questions and Comments In-Reply-To: Message-ID: On Thu, 27 Dec 2001, A. Keyton Weissinger wrote: > If it is as "X" as we all say/know/feel-in-our-hearts that it is, why is > there so very little real commercial appeal? Why are there not industrial > strength application servers being based on Python? Why are there not big > public companies trying to sell products that improve upon Python in all its > Python-ness? Why is company X not moving all their dreck VB/COBOL/PL/1/etc > code onto Python instead of investing the huge amount of > money/time/resources into moving it to Java? To me, the fact that so many people are moving to Java at all means that a lot of times those decisions have little to do with technology and lots to do with hype (more favorably termed "momentum"). IMO Python *is* going the direction you hope, and it is getting there at the right pace. Python is gaining momentum: in the past year a ton of books have come out (indicating more people willing to write about it and more publishers believing that there are enough readers to make a book worthwhile) and there are almost as many new ones on the way. There are bazillions of SourceForge Python projects and many more that are just private projects. Over and over we hear of stuff like "the new game X uses Python as its scripting engine". I'm at my 3rd job where I "get" to use Python, and this time not just one of our main products uses Python, but our *primary* product is in Python. I can pick up any recent Dr. Dobbs' and Python is at least mentioned, if not used, in every issue. Compare all this to a year ago. IMO c.l.py traffice *should* go down over time as the language matures. Problems in the language get fixed, online and offline resources get better, other groups form around specific aspects of Python (Zope, pygame, various SIGs), and you're left with newbies who can't use Google, a block of people who like to discuss new features, announcements of new stuff, and porn spam. As far as pace goes, I personally don't want an overnight Python revolution. Apart from the fact that I like getting more done than my C++ and Java friends ;-), it would be harmful for everyone to jump on board all at once. Java is a good example of this: industry heavyweights have jumped on (helping momentum, to be sure) and have been able to pressure the language into going really weird directions. Instead of more applets we see Java venturing into the app server/middleware realm. What the heck!? Worse, with too much hype you get people trying to use the language inappropriately (using a screwdriver as a chisel) and they go away feeling disappointed. For example, I'm overly biased against Java because I once worked at a company that insisted on using it for their middleware. It was a mess and I can't think about Java applications without getting queasy (I was able to maintain some sanity thanks to Jython though). Python still has some maturing to do, and with it will come the tools you want (compare the number of IDEs available vs, say, 2 years ago. In 2 years they'll be even better). That being true, however, the domain of problems for which Python is well-suited right now is absolutely *huge*. In the realm of possible applications, Python has a few niches where it pummels everything else, an enormous block where it does very, very well, a smaller chunk where it does just okay, and an even smaller chunk where it shouldn't be used at all. > Why should I have to settle on using Python only for prototypes? Or scripts? > Or pseudo-code-to-be-converted-into-Java? You don't, you choose to. Start with a small project, get it done, and show your boss that it was quick to do, the code is clean and easy to maintain, and isn't buggy. Repeat with a more important project. If you can provide solid evidence that something is beneficial, management will see the value in that. If they don't, and you honestly feel you've made a good argument in favor of Python, choose to work somewhere else. I mean, if Python is the right tool for the job and you've made a good case for using it and they refuse with silly reasons, it makes you wonder how other business decisions are made. > Have you met the "average professional developer" lately? He/She is a > Visual Basic "guru" of 3-5 (whopping) years experience. He calls open > source "share ware" and states emphatically the following: "Why would > I mess with THAT stuff? None of those open source cowboys code to > 'Microsoft' standards." Yay! Job security for us! > Python will either grow into a real live alternative to industrial strength > languages like Java or it will continue to be an esoteric language that I > hesitate before putting on my resume. I put Python first on my language list ahead of the "standard" languages because it's a good way to get a feel for their development mentality, it's an easy choice to defend, and it's usually what I would prefer to use. Why would you ever work for a company where you had to be ashamed of Python? A company might have very good reasons for not using Python, but if they are incapable of at least seeing the value in it (and not ridiculing you for listing it on your resume), then I suggest you look elsewhere for a job. When the roles are reversed, I'm skeptical of any developer's resume that lists only the standard (C/C++/Java) languages. If they don't even mention one or more of Python/Ruby/Eiffel/Dillan/etc (the "lesser knowns"), then I grill them to find out why. Maybe it's just because they haven't used them enough to feel comfortable listing them, which is okay. Or are they just not curious? Do they feel that C++ is great? Are they just a sheep? Are they unable to see the weaknesses in the tools they already use? In either case, listing Python on there is a Good Thing. -Dave From James_Althoff at i2.com Thu Dec 6 19:29:48 2001 From: James_Althoff at i2.com (James_Althoff at i2.com) Date: Thu, 6 Dec 2001 16:29:48 -0800 Subject: PEP 276 Simple Iterator for ints (fwd) Message-ID: Greg Ewing wrote: >David Eppstein wrote: >> >> if "for x in list" doesn't change subsequent iterations if you >> rebind x or list within the loop body, neither should "for x <= i < y" >> or whatever similar syntax one uses. So that means, it should construct an >> iterator and then act as if it were called by "for i in iterator" > >I think relying on the semantics of changing the >loop variable in a loop is a bad idea in the first >place, so the difference wouldn't worry me. > >In any case, you can get the same semantics quite >easily without the need for an iterator: keep the >real loop counter in a hidden variable, and assign >it to the user's loop variable before each iteration. I agree with David. I think there should be an iterator, lightweight though it might be. for x <= i < y: # alt. spelling of: for i in xrange(x,y) for x <= i <= y: # alt. spelling of: for i in xrange(x,y+1) for x < i < y: # alt. spelling of: for i in xrange(x+1,y) for x < i <= y: # alt. spelling of: for i in xrange(x+1,y+1) (not counting the sys.maxint boundary case). or # same meaning: for i in x <= ... < y: for i in x <= ... <= y: for i in x < ... < y: for i in x < ... <= y: In any case, it would be nice for the syntax to support the creation of an interval-like object that I could pass around, save, and use later (in a for-loop, list function, "in" statement, or any other iterator-based context). Jim From aleax at aleax.it Fri Dec 28 11:38:42 2001 From: aleax at aleax.it (Alex Martelli) Date: Fri, 28 Dec 2001 17:38:42 +0100 Subject: REPOST: Re: A new forum is up! Q: what means nntp References: <40dbad98.0112262238.73fc14f9@posting.google.com> Message-ID: <4$--$$_----_---%%$@news.noc.cabal.int> "Cameron Laird" wrote in message news:E6BE2136ABF306B9.F6485048E0D07105.E913F194464E51CC at lp.airnews.net... ... > >based on UUCP, as I recall) well before the Internet was officially > >inaugurated (1983, wasn't it?). ... > I don't know what you mean by the "official inauguration" > of the 'Net. ftp://ftp.isi.edu/in-notes/museum/ARPANET_News.mail Pretty early on, in this document (part dated July 1980): """The ARPANET Network Control Program (NCP) will be replaced by two DOD protocols, the DOD Standard Transmission Control Protocol (TCP) and the Internet Protocol (IP). ARPANET FTP and TELNET protocols will also be updated and standardized. Planning for this transition is still under development.""" A TCP-only experiment (no NCP) was (much later) announced for October 1, 1982. At the same time you see the announcement: """ SMTP MUST BE IMPLEMENTED BY 1 JAN 1983 SMTP will become the official network mail protocol. All hosts with mail service should plan on implementing SMTP by 1 Jan. 1983 for sending and receiving network mail. SMTP is completely separate from FTP, and is handled by a distinct server. This is quite different in detail from the current mail-handling procedures. Questions about """ SMTP was clearly SPECIFIED earlier, but Jan 1, 1983, was when it came into effect (note the mention that SMTP is separate from FTP: earlier, mail was handled by an FTP extension; and this was still "current mail-handling procedure" in late 1982, as we see). On Dec 22, 1982, we then read: """ The Defense Data Network Program Management Office (DDN-PMO) is committed to the implementation of TCP/IP and related protocols effective 1 Jan 1983. Starting 00:01 (est) 1 Jan 1983 use of NCP will not be permitted unless specific exception is granted by the DDN-PMO """ The transition was made on Jan 1 1983, as planned, with TACs supporting old NTP until Feb 1 1983. University of Delaware relayed mail between TCP and NTP hosts in the meantime (a few hosts were only due to switch in May). MILNET was announced (split from ARPANET) in March 1983. Although the rest was still called "Experimental ARPANET", given that it had switched to Internet Protocol and was now separated from the Military part, it seems reasonable to me to consider 1983 as the year of the official inauguration of the Internet, no? Alex ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Alex Martelli" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:01:34 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775203 27193 211.57.49.2 (31 Dec 2001 05:06:43 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:06:43 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From bill-bell at bill-bell.hamilton.on.ca Fri Dec 28 09:45:39 2001 From: bill-bell at bill-bell.hamilton.on.ca (Bill Bell) Date: 28 Dec 2001 06:45:39 -0800 Subject: REPOST: Re: COM Registration Attributes References: <3C105C56.7080909@ActiveState.com> <5edaf477.0112141237.3f1471b2@posting.google.com> Message-ID: <6$--$$_----_-%-%%$@news.noc.cabal.int> I have been wondering again about the best way of handling a collection of Windows registry key additions, deletions or changes as part of registering a Python COM server. I can think of a few options: 1. Just use RegCreateKey, etc in the available library. 2. Create a wrapper for atl.dll to provide an automation interface useable by Python so that the Python coder can simply embed instructions as .rgs scripts in his/her Python scripts. 3. Write a module (probably using 'shlex') that parses .rgs scripts and makes the necesssary calls to RegCreateKey, etc. 4. Wrap atl.dll and make it part of the standard Windows distribution. I find doing it the first way makes for code that it hard to read and, therefore, hard to maintain. Option 2 ain't too bad; however, to implement it for general use by the Python community makes it necessary to store an additional DLL somewhere with all the attendant security issues. Option 3 makes it possible to use already available modules with wide distribution; however, it entails maintenance if MS changes the specs for .rgs scripts. (Mind you, isn't this stuff meant to become less of an issue?) Option 4 looks nicest to me. What do others think? Bill bill-bell at bill-bell.hamilton.on.ca (Bill Bell) wrote in message news:<5edaf477.0112141237.3f1471b2 at posting.google.com>... > Mark Hammond wrote, in part: > > > Thanks, Gordon. I just prototyped a simple COM that needs to > > > declare itself safe for Internet Explorer. Looks like I need to continue > > > to do that in the good old-fashioned way, with 'RegOpenKey', etc. > > > Would seem more elegant to be able to use '_reg_options_'. > > A patch to allow _reg_options_ to do this sort of thing (assuming it did > > not break what it does now) would be welcome :) > > I haven't extended _reg_options_. However, since ATL.Registrar lacks > an automation interface I have whipped up a wrapper that provides > access to two of Registrar's methods. > > The following fragment is a typical usage: > > UseCommandLine ( WebPASSCOMServer ) > from win32com.client import Dispatch > from sys import argv > registrar = Dispatch ( 'RegistrarCOMWrapper.Register' ) > regString = \ > ''' > HKCR > { > NoRemove 'CLSID' > { > ForceRemove '{D471BE26-C3C8-4773-B438-041BA612C563}' > { > 'Implemented Categories' > { > '{7DD95801-9882-11CF-9FA9-00AA006C42C4}' > '{7DD95802-9882-11CF-9FA9-00AA006C42C4}' > } > } > } > NoRemove 'Component Categories' > { > NoRemove '{7DD95801-9882-11CF-9FA9-00AA006C42C4}' > NoRemove '{7DD95802-9882-11CF-9FA9-00AA006C42C4}' > } > } > ''' > // following lines parallel the way 'UseCommandLine' works > if '--unregister' in argv: registrar . StringUnregister ( > regString ) > else: registrar . StringRegister ( regString ) > > To me, the nice thing about this approach is that it involves the use > of the '.rgs' scripts that are familiar to people who work with MSVC. > > I have done only very limited trials, on Win2K at that. Would welcome > comment, including a suggestion of where I might put this ugly thing > in case someone else might consider using it. > > BIll ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: bill-bell at bill-bell.hamilton.on.ca (Bill Bell) Newsgroups: comp.lang.python Subject: cmsg cancel <5edaf477.0112280645.246f7229 at posting.google.com> Control: cancel <5edaf477.0112280645.246f7229 at posting.google.com> Date: Mon, 31 Dec 2001 05:09:25 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775374 27193 211.57.49.2 (31 Dec 2001 05:09:34 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:09:34 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From starx at pacbell.net Tue Dec 4 04:06:27 2001 From: starx at pacbell.net (Philip Swartzleonard) Date: 4 Dec 2001 09:06:27 GMT Subject: Tuples -> Function Params? References: Message-ID: Duncan Booth || Tue 04 Dec 2001 12:57:16a: > Philip Swartzleonard wrote in > news:Xns916D6505401FRASXnewsDFE1 at 130.133.1.4: >> a,b,c = self.color glColor3f(a,b,c) >> >> Ok, the question is, is there a way to do this where i don't >> unpack the tuple and pass sepearte arugments? > > Recent versions of Python: > glColor3f(*self.color) > > For older versions, use the apply function. > Thanks, both of you, that will mkae this more friendly i think :). Where can i go to read up on this * notation, i've only vaguely seen it before... -- Philip Sw "Starweaver" [rasx] :: From peter at engcorp.com Thu Dec 20 19:24:34 2001 From: peter at engcorp.com (Peter Hansen) Date: Thu, 20 Dec 2001 19:24:34 -0500 Subject: age of new pythonistas [was: The Editor Poll results are in!] References: <3bfd7f87@news.airtel.net> <9u4cbu$2ts$1@news.xmission.com> <9udn1g$64c$1@brokaw.wa.com> <3c224f96.865756852@wa.news.verio.net> Message-ID: <3C228142.FDDF0918@engcorp.com> Bengt Richter wrote: > > On Sun, 2 Dec 2001 09:05:52 -0800, "Alan Winston" wrote: > > >> it'd also be cool to see the relative age of new pythonistas -- I suspect > >> that they're young, but this is completely unfounded. > > > >51 here. > > > What I wonder about is the dev group, starting with Guido and Tim ;-) Guido is actually only seven, and Tim is nine. The thing is, with a time machine, you can go back in time, tie up your younger self in a closet, and create cool programming languages in your own name after reading all about it in the net archives. These evil deeds could be stopped if only the PSU From soppers3 at cti.ecp.fr Thu Dec 27 20:06:12 2001 From: soppers3 at cti.ecp.fr (Stephane SOPPERA) Date: Fri, 28 Dec 2001 02:06:12 +0100 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> Message-ID: <1$--$$_----_-$--_$@news.noc.cabal.int> Ron Stephens wrote: > > What do you guys think???? > > Ron Stephens > http://www.awaretek.com/plf.html Python City I'm just raising a question to the ones who know both ruby and python. I'm new to python since this morning (learned it in only 8hours, that's a good point for python; I've been looking to the ruby book, which seems to be a tutorial, that will take me more time to read...). I don't know ruby. I've learned python because it can be used as a script language for other application. Actually it is used as a script language for Blender3D (http://www.blender3d.com), and I need to script this soft. My question is: can ruby be also used as a scripting language for another app (not written in ruby)? If the answer is yes: is it used in any application? Thanks, -- Stephane SOPPERA http://stephane.soppera.free.fr ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Stephane SOPPERA Newsgroups: comp.lang.python Subject: cmsg cancel <3C2BC584.53199AD5 at cti.ecp.fr> Control: cancel <3C2BC584.53199AD5 at cti.ecp.fr> Date: Mon, 31 Dec 2001 03:28:00 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775458 27193 211.57.49.2 (31 Dec 2001 05:10:58 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:10:58 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From roblytle at ieee.org Fri Dec 28 18:47:42 2001 From: roblytle at ieee.org (Rob) Date: Fri, 28 Dec 2001 23:47:42 GMT Subject: need help with class of arrays which have attibutes Message-ID: Hi, I'm trying to contruct a class of arrays which have attributes. This one respresents a wire[] array which can have x,y,z etc coordinates. I just can't figure out how to do it. Here is what I have so far: (it uses Numpy) from Numeric import * class arr: a=zeros((20)) class b: x1=0 y1=0 z1=0 x2=0 y2=0 lz2=0 DelX=0.0 DelY=0.0 DelZ=0.0 class Cond(arr,b): c=arr.b def wire(self): return c I have also tried using mapping, but all the array members end up having the same attributes. Here was the try at that one: wire=map(lambda dummy: Cond(), zeros((20))) In this case, Cond was originally the "b" array above, by itself. Thanks for any help you can give! Rob From jadestar at idiom.com Sat Dec 29 10:45:15 2001 From: jadestar at idiom.com (James T. Dennis) Date: 29 Dec 2001 15:45:15 GMT Subject: Newbie Programming References: <84fd22ef.0112192032.14c75f8a@posting.google.com> <7xwuziv3st.fsf@ruckus.brouhaha.com> Message-ID: Paul Rubin wrote: > manutd8611 at softhome.net (Evan Roman) writes: >> I have just begun programming in Python a couple months ago. While i >> feel like i am doing OK, i don't think im getting any better. The >> problem is i can't think of anything to program... I think I have most >> of the fundamentals down, but i can't think of any ways to use them. >> I was just wondering if there was some website that gives ideas of >> little projects to do so that one could sharpen his programming >> skills. Thanx in advance for all the help. > Think of some other area that interests you--photography, flying, > music, or whatever. Then think of some programs you'd like to have, > that are related to that subject. Then write the programs. Get any old college programming textbook (for any high-level programming language like C, Pascal, even Cobol, or whatever). Skip all the stuff about programming in "those" languages and go right for the "Exercises" sections (usually at the end of each chapter). Just do the exercises. Advantage: really old textbooks can be had pretty cheaply. That's O.K. for your purposes since you're only interested in the excercises and problems. Of course you can also work on translating any of the code snippets they give in their examples from "their" programming language into Python. Disadvantage: these are likely to focus on procedural programming rather than OO (object oriented) design. Personally I think people should have a firm foundation in procedural programming before they muddy their minds with lots of OO terminology and concepts --- but others disagree with me and say that learning a procedural approach will make adopting OO harder later. (That is basically parallel to the argument that even older "unstructured" programming techniques impaired one from learning "proper" structured techniques). If you do go through something like a book on Pascal or C, it will help if you think of "classes" (implementations of objects) whenever you see Pascal records or C structs (user defined data types). The big conceptual difference is that you have to think not only of the data's structure (the fields and types of components to your aggregate data types) but also of the operations that are valid for instances of that data type. For example if you have a record of people, and a member (field, element, whatever) called "gender" then it stands to reason that you'll need functions to set a given person's gender --- presumably as new instances of this type of variable are created (or "instantiated" to use the OO terminology). Of course there is the (somewhat unusual) case of a person's gender changing sometime after they are born so you might need to also account for that possibility. In traditional, procedural, programming you'd just worry about the data structures and you'd have to have all of your code that used those records/types enforce any rules about the validity values that might get assigned to them. (Gender might be constrained to "" (unknown) "M" for "Male" and "F" for "Female" or "G" for "Garcon" and "F" for "Fils" or whatever). In OO you'd be encouraged to provide "methods" as part of the data type (the class). Thus the enforcement of data validity checking is conceptually localized to the type of data that's being manipulated. (That's why we might see a code fragment like: person.setGender("Male") in Python). Of course we could apply OO principles in writing our programs in non-OO languages. Some Pascal and C programmers might have provided a person_setGender() function and applied the discipline to perform *all* assignment operations on their person.gender data "member" (field, element, whatever the language at hand calls it) through this function. However, this does get more difficult as the number of structures gets larger and they start to form complex hierarchies of similar but variant types. Thus the main "objective" of an object oriented language is to allow this encapsulation of methods and members (parts of a complex data structure bound to the ways in which they can be manipulated) and to manage variant types (subclasses) in a reasonable way. You might say that OO tries to impose methods on our madness. (O.K., maybe we shouldn't say that). To give a mildly ludicrous example of how one might need such a subclass consider the future when we achieve intersteller travel and we start interacting with hypothetical Thoradians, which as I'm sure you know have nine different genders. In most other respects they have they same characteristics as human "persons" (at least in all the ones that are relevant to our equally hypothetical software application). Naturally we could list all of the Thoradians as being of "unknown" gender, or we could assign two or their nine genders to "male" and "female" and leave the rest as "unknown." Heck, we could even arbitrarily assign any number of their nine genders to each of our three categories. However, if other parts of our object rely on valid values for this field (let us say that we have a person.salutation() method which returns the appropriate form of address for Mr. Mrs. Ms. etc. based, in part, perhaps, on the person's gender), if that is the case then our software's inability to handle the multiplicity of Thoradian sexual variants might actually have some business impact on us. Rather than being mired in our legacy of software, we should be able to provide a new subclass of persons. In that case most of the software that was written to handle persons, even most of it that deals with gender and salutations wouldn't have to be modified. The setGender() and salutation() methods on the Thoradian persons could over-ride the simpler and more limited ones on our plain old Human (Vulcan and Minbari, etc) persons. We can then blithely call on: new_customer.setGender("Glarn") to handle that new Thoradian and address our bill thereto using new_customer.salutation() and the software that was using these data types (objects) would (hopefully) need little or no modification to support them. Two other disadvantages to the "old textbook" approach is that it will provide "toy" problems. That is a set of well-worn old exercises that are easy enough for a first or second year college (or high school) student to do alone in less than a week. (That's how homework works). Also many of these well-worn example problems have been solved by python modules (Hurrah for software re-use) and thus can be trivially done with one or two lines of Python. (For example most of the discussions about building and traversing lists, sorting lists of strings, and that sort of thing are trivial in Python even if they are interesting to first year students of Pascal or C). Even something as simple and innocuous as the old "compute the average of a sequence of numbers" (which is one of the oldest and most basic introductory programming exercises) can have subtle solutions in Python. Here's and example of two different functions which define "averages" (simple arithmetic means): #!/usr/bin/python def average(list): total = 0; count = 0 for each in list: count = count + 1 # or count += 1 in Python 2.x total = total + float(each) # or total += each '' return total/count def avg(l): return reduce(lambda x,y: x+y, map(lambda z: float(z), l)) / len(l) if __name__ == "__main__": import sys args=sys.argv del(args[0]) print average(args) print avg(args) Here we see one version, which is trivially readable and consists of six lines of code, and another which does the same thing in a single line of gobbledygook. A subtlety in this example is that I decided to use sys.argv as my test data set. That returns a list of strings, so I end up needing to use the float() function to coerce each element of this list from a string into a number. (Otherwise I'll build a long string called "total" and try to divide a string by a number which will throw an exception. If I make a simple change to my test suite (and require that the list passed to my functions be numbers rather than strings or anything else) then the comparison of these two versions of the averaging function (arithmetic mean, technically) isn't as lopsided: #!/usr/bin/python def average(list): total = 0; count = 0 for each in list: count = count + 1 # or count += 1 in Python 2.x total = total + each # or total += each '' return total/count def avg(l): return reduce(lambda x,y: x+y, l) / len(l) if __name__ == "__main__": import sys args=sys.argv del(args[0]) ### convert each to a number args = map(lambda x: float(x), args) print average(args) print avg(args) ... moving the map()'ing into __main__ has allowed a trivial simplification of the first version (float(each) simply becomes each) but makes the second one much simpler (to anyone familiar with lambda functions). Of course neither of these is object oriented. The problem hardly lends itself to OO approaches. We could create a class average with two members (current total and current count) and a few methods (constructor/initializer that detects the initialization arguments and (if it's a number) sets the total to that, count = 1 else if it's a sequence (list or tuple) attempts to coerce each into a float, add that to the total and keep incrementing the count. Objects of this class would always return their current value as total / count. They might also overload some common arithmetic and assignment operators such that code like: a = Average(6) a += 2 print a ... would print 4.0 (for example). In some OO languages we could do something like this. However, it would count as abusive mangling of operator overloading. About the only advantage to some "averaging" class would be that objects in that class could keep track of their own count, so that functions calling on them could add values to them, and get the current "running" average without regard for how many values have been added to the average. (This, in general, describes the problem with introducing OO too early in teaching programming: it imposes an additional layer of complexity and abstraction which becomes useful as problems scale beyond one point, but are an impediment up until then). From stephen.boulet at motorola.com Tue Dec 4 13:37:54 2001 From: stephen.boulet at motorola.com (Stephen Boulet) Date: Tue, 04 Dec 2001 12:37:54 -0600 Subject: Help setting path on windows Message-ID: <3C0D1802.6D93D957@motorola.com> Can someone help me? I'd like to be able to do: from someModule import * and have my someModule.py file imported. Thanks. -- Stephen From sjoerd.mullender at oratrix.com Thu Dec 13 10:41:40 2001 From: sjoerd.mullender at oratrix.com (Sjoerd Mullender) Date: Thu, 13 Dec 2001 16:41:40 +0100 Subject: Read and Print ASCII >128 as is in cp437 on DOT-MATRIX printer or file regardless local setting In-Reply-To: Your message of Thu, 13 Dec 2001 15:18:56 +0100. <002f01c183e1$1a006bc0$6f00000a@activmedia.hr> References: <002f01c183e1$1a006bc0$6f00000a@activmedia.hr> Message-ID: <20011213154140.C9760320968@bireme.oratrix.nl> First of all, *by definition* there is no such thing as a ASCII character > 128. ASCII is a 7-bit character set, so values range from 0 to 127. So, you must determine which character set you actually want to convert to. If it is ASCII, fine, but then you won't be able to convert any non-ASCII characters (e.g. accented characters). The short answer is: use unicode(data, 'cp437').encode('us-ascii') where data is the text that you want to convert. Or if you want to convert to ISO 8859-2, use unicode(data, 'cp437').encode('iso-8859-2') However, odds are that you will get an error because the source data cannot be converted to the destination formt. So, an alternative which will ignore all unconvertible characters is: result = [] for c in unicode(data, 'cp437'): try: result.append(c.encode('iso-8859-2')) # or 'us-ascii', or ... except: pass print ''.join(result) On Thu, Dec 13 2001 Hrvoje_Tereek wrote: > Pleas could You help me about my problem? > > > > Summary: Read and Print ASCII >128 as is in cp437 regardless local > setting ! > > System: Win2000, Linux ; locals-cp1250 > > Status: URGENT > > > > Content: > > I have to wrote report generator. For this purpose must be able to read > and print ASCII characters > 128. Not to mention that I need characters > from US ASCII found in Pithon21/Lib/encodings/cp437.py. I'd tried all > encode, decode, codecs trick I have found on Internet but always the > same. ' ASCII is bigger then 128 !!!'. > > Also I have print template file written with Notepad (witch can exactly > reproduce characters such ALT+218) witch I read, manipulate end print > from python. I couldn't trick python to not encode read characters such > ALT+218 in same utf-8 three characters for any ASCII > 128. > > Yes it must be something with locale settings or else but isn't it some > easy-normal way. > > > > Thanks, at front > > > > Yours Python fan, > > Hrvoje Tercek > -- Sjoerd Mullender From tim at vegeta.ath.cx Sun Dec 2 00:27:18 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Sun, 02 Dec 2001 05:27:18 GMT Subject: Whatever happened to String Interpolation? References: <9u6dbn$nsj$1@peabody.colorado.edu> <9ubecn$ped$1@peabody.colorado.edu> <837ks6se4c.fsf@panacea.canonical.org> <9uc26v$akh$1@peabody.colorado.edu> Message-ID: Fernando P?rez graced us by uttering: [ snip ] > "x is $x, f(x) is $f(x)" > > This to me is readable, unambiguous and very useful. Ambiguity: Is that "the result of function f on variable x" or "the value of variable f, with the literal '(x)' after it"? This slippery slope is one of many reasons many Pythonistas don't want creeping featurism to infect their language. (Perl has ways of disambiguating(?) the above expression, but it leads to ugly code Pythonistas love to make fun of. eg: "x is $x, f(x) is @{[&f(x)]}" That's the perl equivalent. ) Tim Hammerquist -- Note that by displacing from "I got confused" to "It got confused", the programmer is not avoiding responsibility, but rather getting some analytical distance in order to be able to consider the bug dispassionately. -- Jargon File 4.3.1 From peter at engcorp.com Sun Dec 23 11:13:40 2001 From: peter at engcorp.com (Peter Hansen) Date: Sun, 23 Dec 2001 11:13:40 -0500 Subject: Looping constructs References: <3c25d37e_9@news.newsgroups.com> Message-ID: <3C2602B3.47EA5685@engcorp.com> Janos Blazi wrote: > > There is one thing I envy Perl programmers: they have several nice looping > constructs and Python has almost none. For exmaple redo unless can be nice > sometimes and they have several others. What do you think about adding such > contructs to Python? This is a frequent quasi-religious discussion around here, with the same general conclusion each time. Many newcomers and a few long-time Pythonistas want such a thing, but the majority seems relatively content with what we already have. I, for one, find it much easier to start my loop with "while 1:" and then stick the logic where it needs to be with "if xxxx: break" and continue and such than to guess at the right mystical loop/until/repeat/never/huh? construct which is used so rarely I never get the logic inversion correct... -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From paul at boddie.net Wed Dec 12 05:53:51 2001 From: paul at boddie.net (Paul Boddie) Date: 12 Dec 2001 02:53:51 -0800 Subject: CGI form repost from browser--how to prevent? References: Message-ID: <23891c90.0112120253.1b7ca876@posting.google.com> bit_bucket5 at hotmail.com (Chris) wrote in message news:... > I'm writing a Python cgi script that does some inserts into a mysql > database based on data in an html form submitted by a user. Is there > any way to prevent the browser from reposting the data from the form > when the user hits refresh in the browser after they have submitted > the form? When this happens, the script receives the same cgi form > data and performs the same inserts on the database. I think maybe > this can be prevented by storing some state info with cookies?? Not > sure (have never used cookies). Any ideas on an easy way to prevent > this? I suppose you could have a sequence number which gets stored in a hidden field in your HTML form. The insertion operation would be dependent on your script then receiving a sequence number of a given value (or possibly higher) from the submitted form; once completed, the next permissible sequence number would be set to a value greater than the one most recently used. Should the browser then resend the data, the old sequence number would be resent, and your script should be able to reject the insertion request (since the anticipated sequence number would be greater than the one received). This is all brought to you straight from the top of my head before any caffeine-based drinks have been consumed, however. Paul From fredrik at pythonware.com Tue Dec 4 10:23:14 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 04 Dec 2001 15:23:14 GMT Subject: Help MULTILINE References: Message-ID: Jean-Christophe Mincke wrote: > I am trying to use to MULTILINE flag of re.compile(). And I am not really > successfull. can you perhaps post a piece of code, tell us what happened, and what you expected it to do instead? From sholden at holdenweb.com Tue Dec 18 09:03:47 2001 From: sholden at holdenweb.com (Steve Holden) Date: Tue, 18 Dec 2001 09:03:47 -0500 Subject: Cygwin socket library status enquiry References: <20011218131502.GA2268@dothill.com> Message-ID: <00a901c187cc$d1079de0$0200000a@holdenweb.com> ----- Original Message ----- From: "Jason Tishler" To: "Andy Todd" Cc: "Steve Holden" ; Sent: Tuesday, December 18, 2001 8:15 AM Subject: Re: Cygwin socket library status enquiry > On Tue, Dec 18, 2001 at 03:45:46AM +0000, Andy Todd wrote: > > "Steve Holden" wrote in > > >Can anyone tell me what's going on? > > Not really. All that I can offer is that Cygwin Python passes test_socket > with the Cygwin (i.e., not Python) caveat below. > > > I believe that there are still some socket problems with Cygwin, although > > most have been addressed by recent versions of the DLL. In particular there > > were problems with Win98 that have now been resolved on my installation. > > Andy brings up a good point -- What platform are you using? 9x/Me or > NT/2000/XP? If 9x/Me, then try under NT/2000/XP. If NT/2000/XP., > then try to post a minimal C test program that exhibits the problem > to cygwin at cygwin.com. > > > I don't think everything is solved with the current port of Python though. > > By searching the Cygwin mailing list for 'python' and 'socket'; > > > > http://cygwin.com/cgi-bin/htsearch?method=and&format=builtin- > > long&sort=time&config=htdig&restrict=%2Fml%2Fcygwin%2F&exclude=&words=py tho > > n+socket > > > > (excuse wrapping of URL) it looks like Jason is still ironing out socket > > problems and has been working on them as recently as a couple of days ago; > > > > http://sources.redhat.com/ml/cygwin/2001-12/msg00639.html > > The root cause of the above problems are completely unrelated to sockets. > They are actually caused by Cygwin's fork() which requires all DLLs in > children to be based at the same address as in the parent. Otherwise, > the Cygwin DLL causes the child to abort during fork(). > This seems like a reasonable requirement/assumption. > Python's test_socket just happens to be one way of tickling this > problem. In fact, the situation has been recently exacerbated since > many libraries that were previously static have just been updated to > be shared (e.g., OpenSSL). Hopefully, a DLL rebasing technique will > solve this fork() problem for Python and other applications. > > Jason > Thanks for the information. Useful to know what we can expect to work and what we can't. It's simply unfortunate that this particular problem affects an area I've been working in. Overall Cygwin is an amazing piece of software, and having Cygwin Python available has been a boon - I was very impressed when the mx tools (including ODBC) built and installed without too much trouble. Thanks for your work on Cygwin Python. I look forward to the DLL rebasing when it happens. regards Steve -- http://www.holdenweb.com/ From store_li at sina.com Sat Dec 15 21:22:07 2001 From: store_li at sina.com (Kick) Date: Sun, 16 Dec 2001 10:22:07 +0800 Subject: Is there any method to run Tk program without dos window? References: <9vejd3$euvji$1@ID-12869.news.dfncis.de> <3c1ae0e8$0$79560$6e49188b@news.goldengate.net> Message-ID: <9vh0jg$f55pa$1@ID-12869.news.dfncis.de> So simple? Thank you! "Greg Krohn" wrote in message news:3c1ae0e8$0$79560$6e49188b at news.goldengate.net... > > "Kick" wrote in message > news:9vejd3$euvji$1 at ID-12869.news.dfncis.de... > > I use Active Python in windows, every time I double click to run a tk > > program, it will bring a dos window. How can I make this hidden? > > > > Thanks for any reply! > > use '.pyw' instead of '.py' > > From dyoo at hkn.eecs.berkeley.edu Mon Dec 3 18:13:20 2001 From: dyoo at hkn.eecs.berkeley.edu (Daniel Yoo) Date: Mon, 3 Dec 2001 23:13:20 +0000 (UTC) Subject: Regular expression as dictionary key? References: <3C0B2DE9.5040308@home.com> <9ugdnp$8fe$1@slb0.atl.mindspring.net> <3C0BBF31.3000105@home.com> Message-ID: <9uh0ug$2luu$1@agate.berkeley.edu> Luke wrote: :> I suspect though that you really just want a way to use a :> regular expression as a key, and created this singular/plural :> example as justification. : Yes and no. This is one of many possible applications. The plural : search is a naive example, but for this application doesn't need to be : excat either since the results are fuzzy anyway. I wonder if there's a way of precomputing the keys so that doing fuzzy searching on them won't be so expensive. The difflib module allows fuzzy searching, but I can imagine that it might be expensive to use. Perl does have a "study()" function that allows the system to speed up any searches on the text later on, so perhaps a similar system could be cooked up with Python's regular expressions? From budr at sirinet.net Mon Dec 24 15:48:54 2001 From: budr at sirinet.net (Bud Rogers) Date: Mon, 24 Dec 2001 14:48:54 -0600 Subject: vi or emacs for editing Python on Linux? References: <231220011915029251%jwbaxter@spamcop.net> Message-ID: Tim Hammerquist wrote: > Bud Rogers graced us by uttering: > [ snip ] >> Inside [Emacs] is an astonishing collection of tools all >> cleverly packed together in the smallest space possible. > > Ok, you're article up until here was relatively unbiased... > > ...but what bias could cause you to use "Emacs" and any inflection of > the word "small" in the same paragraph, no matter how true the rest of > the text? Well, the next two sentences are "The box itself is very high density. It weighs about fifty pounds and takes both hands to carry..." From emile at fenx.com Sun Dec 30 00:49:40 2001 From: emile at fenx.com (Emile van Sebille) Date: Sat, 29 Dec 2001 21:49:40 -0800 Subject: REPOST: Re: How to do "ANN:"? References: Message-ID: <7$--$$_----___%%%$@news.noc.cabal.int> "Harry George" wrote in message news:m3666py0b7.fsf at wilma.localdomain... > A couple of times I've tried to annouce package upgrades using "ANN:" > entries to c.l.p and c.l.p.a, but nothing shows up. Is there a magic > decoder ring? > > Most recently, updates for mkpythonproj, pdx, and pyperlish. You probably forgot the magic incantation: (Baaa baaa... flap flap flap... whoosh... thud.) Include that in an e-mail to the moderators at mailto:clpa-moderators-owners at python.org and you're sure to get in. Wondering-about-the-commercial-benefits-of-ovine-aviation-ly y'rs, -- Emile van Sebille emile at fenx.com --------- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Emile van Sebille" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:56:18 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774364 27193 211.57.49.2 (31 Dec 2001 04:52:44 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:52:44 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From db3l at fitlinxx.com Wed Dec 5 19:54:34 2001 From: db3l at fitlinxx.com (David Bolen) Date: 05 Dec 2001 19:54:34 -0500 Subject: Is Python suitable for some binary file editing? References: <1FD639F0.1DA46084@cns.net.au> Message-ID: Tim Hammerquist writes: > I'd have preferred: > > Replace 2 bytes in place beginning at offset 100 (101st byte): > > f = open('text_input', 'r+b') > f.seek(100) > f.write(chr(123) + chr(0x80)) > f.seek(0,2) > f.close() That would work too, but not for the original request, which was to have a separate copy: David Rollo wrote: > The file conversion is simply making the same change to a handful of > characters at a particular offset, and saving under a new filename. so I don't think he wanted to modify the original files. -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l at fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/ From store_li at sina.com Tue Dec 18 23:35:03 2001 From: store_li at sina.com (Kick) Date: Wed, 19 Dec 2001 12:35:03 +0800 Subject: How can I display unicode in Tk widget References: <9vkqm7$fqo83$1@ID-12869.news.dfncis.de> Message-ID: <9vp5h5$gtbl1$1@ID-12869.news.dfncis.de> I have rename the old FixTk.py and copy what you write into a new file and named it FixTk.py. But unfortunately, nothing changed since I replace the FixTk.py. "Kirill Simonov" wrote in message news:mailman.1008693863.23418.python-list at python.org... > On Tue, Dec 18, 2001 at 12:19:58PM +0100, Martin von Loewis wrote: > > On Windows, Tcl doesn't find its encoding database, thus it cannot > > find out how to convert the Unicode string for display. Setting > > TCL_LIBRARY may help. > > > > It is questionable whether this is a bug in Tcl or Python: It is a bug > > in Python, for not installing Tcl libraries in a place where Tcl will > > find them, and it is a bug in Tcl, for not offering an API to tell it > > a different location for the codecs database. > > This is a bug in "Python2*/Lib/lib-tk/FixTk.py". > Here is the right way to set TCL_LIBRARY. > > FixTk.py > ======== > > # Do not import _tkinter! > import sys, os > > if not os.environ.has_key('TCL_LIBRARY'): > # Tcl is smart enough to check "$TCL_LIBRARY/tclX.Y/../tcl8.3/". > tcl_library = os.path.join(sys.prefix, "tcl", "tclX.Y") > os.environ['TCL_LIBRARY'] = tcl_library > > ======== > > > Kirill. > > From phr-n2001d at nightsong.com Sun Dec 2 17:45:18 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 02 Dec 2001 14:45:18 -0800 Subject: CryptKit 0.9: cryptsock References: <7xpu5y2szk.fsf@ruckus.brouhaha.com> Message-ID: <7x667pw8ap.fsf@ruckus.brouhaha.com> Bryan writes: > Thanks for the link, it lead me to research other password-based > key-agreement schemes. I found Authentication and Key Agreement via > Memorable Password ( > http://citeseer.nj.nec.com/kwon00authentication.html ) which claims > to be the most efficient of all of them ( EKE, PAK, SRP, GXY, AuthA > ). I believe I will implement AMP. Your input would be > appreciated. I'm not familiar with AMP. The SRP paper has references to some other protocols of this type though. Main problem I see is patent issues around many of them. I believe SRP was developed in order to avoid the EKE patent. I'm cross-posting to sci.crypt to solicit some wisdom from that newsgroup. From dk at dk.com Thu Dec 27 13:22:02 2001 From: dk at dk.com (dk) Date: Thu, 27 Dec 2001 12:22:02 -0600 Subject: windows dialup connections Message-ID: Are there any bits of code out there to deal with the establishment, status and just general manipulation of dialup connections under windows 9x, 2000, NT? I'm having a hard time finding any if they exist. Should I be looking under the win32api extensions?(I hope not ;-) Any pointers to more info would be helpful. Thanks. -DK From amuys at shortech.com.au Thu Dec 13 22:52:11 2001 From: amuys at shortech.com.au (Andrae Muys) Date: 13 Dec 2001 19:52:11 -0800 Subject: Raw sockets References: <2c55c8be.0112130949.761bc120@posting.google.com> Message-ID: <7934d084.0112131952.2ae7c239@posting.google.com> ed_play at yahoo.co.uk (Ben Ainsworth) wrote in message news:<2c55c8be.0112130949.761bc120 at posting.google.com>... > Is there a good intro to using raw sockets with python on the web? I > want to try writing a variant of traceroute using tcp instead of icmp. > Might I suggest you first check out Stevens 'TCP/IP Illustrated Vol 1' as it will explain in excelent detail how traceroute is built using UDP not ICMP :). Andrae Muys From ecifreo at austin.rr.com Tue Dec 4 11:00:23 2001 From: ecifreo at austin.rr.com (Eric Cifreo) Date: Tue, 4 Dec 2001 10:00:23 -0600 Subject: redistributing Python runtime with an application Message-ID: <3c0cf241$0$13459$39cecf19@nnrp1.twtelecom.net> I've seen posts and websites saying that the license allows for redistribution of Python's core, but I was wondering if there was a smaller package or subset (analogous to Java's runtime environment, or JRE) of the distribution. I suppose I could start copying files selectively to a clean machine and figure it out that way but didn't want to reinvent the wheel if someone has already done this, or at least doumented how one does it. Anything out there already? Thanks in advance, Eric Cifreo Austin, TX From woodsplitter at rocketmail.com Thu Dec 6 17:55:40 2001 From: woodsplitter at rocketmail.com (stalin) Date: 6 Dec 2001 14:55:40 -0800 Subject: Python classes for reading/writing/parsing MIDI files References: <3C0F63F0.20D2B25@alum.mit.edu> Message-ID: <7876a8ea.0112061455.6685b313@posting.google.com> Will Ware wrote: > Nearly a year ago I wrote some Python classes for MIDI events and objects... Have you registered this module with the Vaults of Parnassus? There are several MIDI packages currently listed there; is one of them yours? http://www.vex.net/parnassus/apyllo.py?find=midi From tim at vegeta.ath.cx Tue Dec 11 02:03:14 2001 From: tim at vegeta.ath.cx (Tim Hammerquist) Date: Tue, 11 Dec 2001 07:03:14 GMT Subject: questions about of writing python scripts References: Message-ID: Andrew Bennetts graced us by uttering: > On Sun, Dec 09, 2001 at 05:26:14PM -0800, ed wrote: >> but c is floating and has not value and a got assgined to it. ... >> in other compiation lang, this type of error will be caught in >> compilaiton time, but I can't using python.. is ther any utility >> or way to catch this type of error way ahead? > > I think what you are looking for is a static analysis tool... try > pychecker. I would've just tried the type() function first. # x is variable # # python 2.2 or later: if type(x) is int: print "x is an integer variable" # # python 2.1 or earlier: import types if type(x) == types.IntType: print "x is an integer variable" # # types.IntType == type(1) ergo: if type(x) == type(1): print "x is an integer variable" Just because Python doesn't _force_ type checking doesn't mean it isn't possible. Tim Hammerquist -- Reality is that which, when you stop believing in it, doesn't go away. -- Philip K. Dick From josegomez at gmx.net Mon Dec 3 09:32:10 2001 From: josegomez at gmx.net (josegomez at gmx.net) Date: Mon, 3 Dec 2001 14:32:10 +0000 (UTC) Subject: Python, Glade and portability? Message-ID: <9ug2da$dqd$1@hermes.shef.ac.uk> Hi, I have written some Python software in the past for my own consumption in Linux. Now, there is a need to use that softare in other "lesser" :-) OS, and I have been asked to port it to windows. I had written the software using Glade and python (and several Python extensions), and I now realise that I'd need to re-write the GUI to accomodate for windows. While this is easy enough to do (I'd just have to re-write the UI module, probably using wxwindows or somesuch), I'd rather not spend time on it, and I was wondering whether anyone knows of an easier solution that might translate the XML produced by glade to something which is useable in Windows. Any help appreciated, Jose -- Jos? L G?mez Dans PhD student Tel: +44 114 222 5582 Radar & Communications Group FAX; +44 870 132 2990 Department of Electronic Engineering University of Sheffield UK From wurmy at earthlink.net Fri Dec 28 22:10:30 2001 From: wurmy at earthlink.net (Hans Nowak) Date: Sat, 29 Dec 2001 03:10:30 GMT Subject: Is this a bug? References: <33e9b770.0112281857.563a36d4@posting.google.com> Message-ID: <3C2D32DC.CE188A04@earthlink.net> Gilbert wrote: > > Hi! > > I am wondering if the following results below imply any bug in Python > 2.2 or 2.1? > When I try to use float numbers, python 2.2 and 2.1.1 shows a little > bit different results (I think it is incorrect) from what I enter. > But python 1.5.2 seems to be okay? What is wrong? This behavior is explained here: http://www.python.org/doc/current/tut/node14.html --Hans From jason at jorendorff.com Wed Dec 19 17:18:18 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Wed, 19 Dec 2001 16:18:18 -0600 Subject: os.system commands in CGI on IIS? In-Reply-To: <46d8afc4.0112140916.838be25@posting.google.com> Message-ID: > os.system("copy c:\a.txt c:\b.txt") Try this: os.system("copy c:\\a.txt c:\\b.txt") As in C, Java, or Perl, \a is a beep; \b is a backspace; and \\ is a backslash. ## Jason Orendorff http://www.jorendorff.com/ From fredrik at pythonware.com Sun Dec 16 07:51:01 2001 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sun, 16 Dec 2001 12:51:01 GMT Subject: Python Imaging Library and fonts References: <9vaoj3$bqr$1@newshost.nmt.edu> Message-ID: Bob Greschke wrote: > How do I convey to the PIL font stuff that I want it to use the > same font as the rest of the frame for its labels and such? PIL > wants to start with font files. I can't seem to find the connection. there is no connection: Tk uses the window system's font renderer, PIL's ImageFont package uses platform- independent bitmap font files. you have to add some code to map Tkinter font strings to the font files you have installed. you can find PIL versions of the standard X window fonts here: http://effbot.org/pil (I suggest falling back on Helvetica if you cannot find a matching font file) From syver-en+usenet at online.no Wed Dec 26 10:56:59 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 26 Dec 2001 16:56:59 +0100 Subject: strange Tkinter problem References: <3C297E61.70701@home.com> Message-ID: tjiit writes: > On Wed, 26 Dec 2001 08:38:09 +0100, Luke wrote: > > > This is behavior common to pretty much all GUI's. Your callback > > function triggered by a button click should run in a new thread, or > > spawn a new thread in which the networking code runs. > Does this mean that the GUI should do this or me? You have to do it. The GUI has no way of knowing that you want to start a thread. It's easy to create threads in python. Use the threading module. import threading Derive a new class from threading.Thread: class MyTask(threading.Thread): Define a run method that does the work you want to have done: def run(self): # code written here will run in it's own thread Call you threads start method: task = MyTask() task.start() Be aware that you should NOT call tkinter methods from the run method of the thread object, because tkinter doesn't support this. Check out the after method in tkinter and the Queue.Queue class for ways to get your data when the thread finishes. See also the reference on the join method and isAlive for the threading.Thread class. Mail or post if you need further help. -- Vennlig hilsen Syver Enstad From mhammond at skippinet.com.au Sun Dec 30 19:24:56 2001 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 31 Dec 2001 00:24:56 GMT Subject: Win32all and Mark. time to bring back win32-reg-users? References: <3c2f44b5_7@news.newsgroups.com> Message-ID: <3C2FB076.3000203@skippinet.com.au> Brad Clements wrote: > Just a thought, worth it to me.. > Maybe :) Let's just see what pans out. If it transpires that I go back to doing what I was before (ie, living from one part-time contract to the next) then I probably will. Thanks for the support though! Mark. From gmcm at hypernet.com Mon Dec 31 09:40:18 2001 From: gmcm at hypernet.com (Gordon McMillan) Date: 31 Dec 2001 14:40:18 GMT Subject: waterfall (was Re: REPOST: Re: Book "python programming patterns". anybody read this??) References: <2$--$$_----___%_$$@news.noc.cabal.int> Message-ID: Alex Martelli wrote: [snip] > This is also known as the "waterfall model" of software development. > > It just doesn't work, as many decades of industry experience have amply > shown. The "waterfall" model comes from the days when most development was mainframe batch systems. It "worked" (to some limited degree) in that environment because of the following conditions: - there were only a half-dozen or so basic building blocks in mainframe batch systems (sort, merge, select, extract...) - the scope of the projects (successfully managed through "waterfall") was generally tiny compared to the scope of the system in which they fit - there were senior people on the project who could balance the "top down" with some "bottom up", but keep it secret Violate any one of those (too many technical choices; too big a system; or people who aren't very familiar with the system's context) and the resultant system was iteration 1 of an iterative prototype too expensive to complete. More generally, you could describe a successful "waterfall" project as an iterative prototype that worked the first time through. What Peter had right was that *thinking* about the problem is always necessary, even in an iterative prototype :-). -- Gordon http://www.mcmillan-inc.com/ From peter at engcorp.com Sat Dec 29 18:51:34 2001 From: peter at engcorp.com (Peter Hansen) Date: Sat, 29 Dec 2001 18:51:34 -0500 Subject: REPOST: Re: Is learning Python "extraordinary"? References: Message-ID: <7$--$$_----__$%_-$@news.noc.cabal.int> "Jesse F. W" wrote: > > I am applying to MIT (as well as many other schools). > MIT describes what they are looking for as students who do or have > done "extraordinary things". My question is this, Is teaching myself > Python (with the aid of the Python tutorials and some help from the > various lists) an "extraordinary thing"? I'm afraid not. All the developers I've hired in the last two years took about a week to become productive with Python after being exposed to it for the first time. Of course, maybe they're *all* extraordinary! I agree with Aahz, however, that learning Python is an extraordinarily intelligent thing to do and should help you _be_ extraordinary at whatever college you go to. For more extraordinary things in relation to college applications, always look here for inspiration (enjoy :-) : http://www.geocities.com/jsfhome/Humstuf/college.html -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Peter Hansen Newsgroups: comp.lang.python Subject: cmsg cancel <3C2E5706.5880983E at engcorp.com> Control: cancel <3C2E5706.5880983E at engcorp.com> Date: Mon, 31 Dec 2001 01:16:05 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774475 27193 211.57.49.2 (31 Dec 2001 04:54:35 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:54:35 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From borcis at geneva-link.ch Fri Dec 21 08:11:12 2001 From: borcis at geneva-link.ch (Boris Borcic) Date: Fri, 21 Dec 2001 14:11:12 +0100 Subject: threading.py -> winthreading.c : Some results References: Message-ID: <3C2334F0.1AF46B3C@geneva-link.ch> Jason Orendorff wrote: > Condition.wait(timeout) runs 500x faster. Sounds like an oxymoron if it isn't one. Or a zen koan. BB From loewis at informatik.hu-berlin.de Fri Dec 21 11:38:46 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 21 Dec 2001 17:38:46 +0100 Subject: if __name__ == "__main__" References: Message-ID: crennert at pbmplus.com (Chris Rennert) writes: > Could someone please fill me in on how the if __name__ == "__main__ > thing works. I am reading through some tutorials and I never really > get a clear definitive answer on that. > Is this like main() in C? No. __name__, on module level, is the name of the module. So if you would modify urllib.py to contain print __name__ then "import urllib" would print urllib Now, the file that you pass on the command line of the interpreter does not have a module name (because it really isn't a module), so __name__ is set to the string "__main__" inside that code. That allows you to write a file that is used both as a module and as a program. HTH, Martin From grante at visi.com Tue Dec 4 12:24:49 2001 From: grante at visi.com (Grant Edwards) Date: Tue, 04 Dec 2001 17:24:49 GMT Subject: The Editor Poll results are in! References: <3bfd7f87@news.airtel.net> <9u4cbu$2ts$1@news.xmission.com> Message-ID: In article , Tim Hammerquist wrote: > Roy Katz graced us by uttering: >> (and I find that Python fits in with my youthful ideals nicely among >> others such as Esperanto & being vegan) > > Is this a 90's thing, where your idealistic fantasies and your > programming LOC must be compatible? I take it Lisp and Smalltalk > went out with polyester, then? I've heard many people say Smalltalk > embodies freedom better than any other language. > > OTOH, as a vegan, perhaps you can tell me: what's "organic coffee"? If I recall my chemistry correctly, "organic" refers to chemical compounds involving carbon, espcially things with carbon-carbon bonds forming chains/rings. Stuff like gasoline, plastics, nerve gas, that sort of thing. -- Grant Edwards grante Yow! RELATIVES!! at visi.com From brian at sweetapp.com Thu Dec 13 03:46:23 2001 From: brian at sweetapp.com (Brian Quinlan) Date: Thu, 13 Dec 2001 00:46:23 -0800 Subject: where has infomation of jython?!!! In-Reply-To: <9v9mmt$212o$1@news.cz.js.cn> Message-ID: <006301c183b2$b3dcbd90$445d4540@Dell2> Zoom Quiet wrote: > please me why www.jython.com can not visited in chinese? > "socket error" always?! Try: http://jython.sourceforge.net/ From tripps81 at yahoo.com Sun Dec 2 14:45:14 2001 From: tripps81 at yahoo.com (Tripp Scott) Date: Sun, 2 Dec 2001 11:45:14 -0800 (PST) Subject: intercepting method call Message-ID: <20011202194514.69471.qmail@web14808.mail.yahoo.com> class A: def __validate__(self, methodName, args): # do some checking def x(self, foo, bar): # do something what i would like is to have some validating routine (either the said object's __validate__() or some method from another object) be automatically invoked whenever the target method x is called. can i do that in Python? t __________________________________________________ Do You Yahoo!? Buy the perfect holiday gifts at Yahoo! Shopping. http://shopping.yahoo.com From knight at baldmt.com Fri Dec 14 00:00:16 2001 From: knight at baldmt.com (Steven Knight) Date: Thu, 13 Dec 2001 23:00:16 -0600 (CST) Subject: ANNOUNCE: SCons 0.01 now available Message-ID: I'm pleased to announce that the first alpha release of SCons, version 0.01, has been released and is available for download. You can download SCons from the download page at the SCons web site: http://www.scons.org/ Or through the download link at the SCons project page at SourceForge: http://sourceforge.net/projects/scons/ RPM and Debian packages and a Win32 installer are all available, in addition to the traditional .tar.gz files. SCons is a software construction tool (build tool, make tool) written in Python. Its design is based on the ScCons design which won the Software Carpentry build tool design competition in August 2000, which is in turn based on the design of the Perl-based Cons build tool. Distinctive features of SCons include: - configuration files are Python scripts, allowing the full use of a real scripting language to solve build problems - a modular architecture allows the SCons Build Engine to be embedded in other Python software - a global view of all dependencies; no multiple passes to get everything built - the ability to scan files for implicit dependencies (#include files); - improved parallel build (-j) support - use of MD5 signatures to decide if a file has changed - easily extensible through user-defined Builder and Scanner objects This alpha release has been a long time coming (we initially hoped to release in September), but the tradeoff is that the extra time has allowed us to provide more functionality than just a toy. Owing to a rigorous testing methodology that we've followed throughout development, we believe the quality and functionality in SCons 0.01 to be sufficient to support "real work" from day one. That said, this *is* an alpha release, and we fully expect that some of you will exercise end cases that our current tests don't cover. We eagerly await your bug reports. An scons-users mailing list has been created for those interested in getting started using SCons. You can subscribe at: http://lists.sourceforge.net/lists/listinfo/scons-users Lastly, I'd like to acknowledge the entire SCons team, who have put in many hours contributing ingenious solutions to a thorny set of problems: Chad Austin, Charles Crain, Steven Leblanc, and Anthony Roach. We're anxious for your feedback, so don't be shy about letting us know what's good, what's not, and how SCons can be improved to help you solve your build problems. On behalf of the SCons team, --SK From peter.milliken at gtech.com Thu Dec 20 22:37:28 2001 From: peter.milliken at gtech.com (Peter Milliken) Date: Fri, 21 Dec 2001 14:37:28 +1100 Subject: Issues with Python 2.2. regex References: <9vtm2e$9fs$06$1@news.t-online.com> Message-ID: <9vuauk$26n1@news1.gtech.com> The re package in previous versions of Python had some form of weird problem with named groups which "changed" in 2.2 - obviously a fix attempt that didn't quite get there :-) I never reported the issue in the previous versions, there is still some form of problem. I never attempted to isolate the behaviour because I was desparate for time to get the code working, then I promptly forgot about it :-). I attempted to use the program the other day with 2.2c1 and found it "broken", a but of kludging around with the previous kludge caused the re expression to work, so something changed! If you have the time to isolate the behaviour properly (I still don't :-)) then please do so, it would be nice to get my kludge out of my code (BTW, I fixed my problem by repeating the named group at the beginning and end of the expression being compiled - it was only the first and last expression that had problems, so I found if I repeated exactly the same name and pattern as the first/last ones then it worked :-) i.e. "(?Ppatt1)(?Ppatt1)(?Ppatt2)(?Ppatt3).....(?Ppattx)(?Ppattx)" Otherwise the first and last patterns were being ignored! Peter "J?rgen Hermann" wrote in message news:9vtm2e$9fs$06$1 at news.t-online.com... > Hi! > > Are there any known changes/problems with named groups in Python 2.2 re? > > Given this: > > (?P^\s*(?P=+)\s.*\s(?P=hmarker) $) > > Python 2.2 reports groups for the nested named parens, while previous > versions do not. If this is unexpected, I'll isolate this effect in a little > script. > > Bye, J?rgen > > From dhhnews0 at hotmail.com Sat Dec 8 08:39:02 2001 From: dhhnews0 at hotmail.com (Dan Howard) Date: Sat, 08 Dec 2001 13:39:02 GMT Subject: Good book for Learning Python?? References: Message-ID: This might help... http://www.amk.ca/bookstore/python.html "gsmickle" wrote in message news:mailman.1007772191.5816.python-list at python.org... > Hello All, > > I am new to the list and would like to get some input on some good > books for learning Python? > > Thanks, > > Greg > > From sfam at mailandnews.com Fri Dec 28 12:40:25 2001 From: sfam at mailandnews.com (Kaden) Date: 28 Dec 2001 17:40:25 GMT Subject: REPOST: Re: Can't exit python with ^D under certain circumstances References: <1c1X7.79465$7l5.52086@atlpnn01.usenetserver.com> Message-ID: <7$--$$_----_---%%$@news.noc.cabal.int> On Fri, 28 Dec 2001 11:33:43 -0500, Steve Holden wrote: > "wealthychef" wrote in message > news:mailman.1009322789.23019.python-list at python.org... >> Hi, this is weird to me, don't know how to fix. >> On my local python installation on machine A in a normal shell, ^ >> D works to exit Python as expected. On machine B on the >> console, ^D also works fine, but if I ssh to machine B from >> machine A and try to exit Python with ^D, Python does not exit, >> instead I get the following strange error message: >> >> >>> ^D >> File "", line 1 >> c >> ^ >> SyntaxError: invalid syntax Have you checked your TERM envariable? Try checking what it's set to while at the local console. Then ssh into the remote machine and check what that one is set to. I've got a machine here at home that sets my TERM to dumb if I ssh into it for some reason. You can imagine the kinds of problems that causes :) If this is the problem, just explicitly set it in your ~/.profile || ~/.bashrc || ~/.cshrc || whatever. Should clear it up. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Kaden Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 05:16:24 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775193 27193 211.57.49.2 (31 Dec 2001 05:06:33 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:06:33 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From phr-n2001d at nightsong.com Sat Dec 1 22:36:31 2001 From: phr-n2001d at nightsong.com (Paul Rubin) Date: 01 Dec 2001 19:36:31 -0800 Subject: CryptKit 0.9: cryptsock References: <7xofljlfgh.fsf@ruckus.brouhaha.com> Message-ID: <7xpu5y2szk.fsf@ruckus.brouhaha.com> Bryan writes: > When you say "shared secret key" do you mean that the remote and local hosts > both have apriori knowledge of the symmetric key? Or are you referring to > some other mutually shared token, like a password? If you meant the latter, > then I agree with you completely and you should see that feature appear in > the next release :) I mean a shared random symmetric key (i.e. something like 32 hex digits), known a priori to both ends. If it's a low entropy token like a password, you need a fairly complicated protocol like SRP to stop it from being found by dictionary attacks against recorded traffic. Including SRP (http://srp.stanford.edu) is a reasonable idea though, since it's good for other things as well. From bedge at troikanetworks.com Fri Dec 7 19:21:05 2001 From: bedge at troikanetworks.com (Bruce Edge) Date: Fri, 07 Dec 2001 16:21:05 -0800 Subject: Regex help References: Message-ID: <_1dQ7.145$Lg2.16569@newsfeed.slurp.net> In , David A McInnis wrote: > > > > > >
Is there a more > efficient way to do this.  It seams like this is executing the search > twice.
>
size=2> 
>
    > patt = re.compile("fax<br>\s*([0-9]{3,3}-[0-9]{3,3}-[0-9]{4,4})", > re.I)
>
    > if patt.search(tststring):
        faxnum > = patt.search(tststring).group(1)
        > print faxnum
>
I cannot just do >
>
    > faxnum = patt.search(tststring).group(1)
>

because if there > is no match, it returns an error
>
size=2> 
>
size=2>David
> Use match rather than search. From jeff at ccvcorp.com Thu Dec 6 13:49:07 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Thu, 06 Dec 2001 10:49:07 -0800 Subject: more fun with PEP 276 References: Message-ID: <3C0FBDA3.C9A24991@ccvcorp.com> James_Althoff at i2.com wrote: > Jeff Shannon wrote: > > >Hmmm... what's the advantage again? Seems like a lot of work > >for not much difference.... > > To match > > for i in span / len(mylist): > > more closely you would use xrange instead of range since range actualizes > the list before iterating the values (which, of course, might not matter in > many cases). Indeed, shouldn't matter in the vast majority of cases (IIRC, xrange() doesn't become advantageous until the interval-size is in the thousands, or higher, and most loops seem to be *much* smaller than that). As a rule, I always use range() unless I *know* that I'm creating a huge list. > So the better comparison is to > > for i in xrange(len(mylist)): > > Although the above is fine, there are a couple of things one can point out: > > - xrange is not an ideal name for something used in such a common idiom. > - a nested function is not ideal for such a common idiom. Overloading the division operator is an even *less* ideal solution for such a common idiom. And since 99% of cases are handled just as effectively by range(), the (putative) awkwardness of the name xrange is not that big of a deal. > - the fact that one has the option of using either range or xrange causes > enough confusion that one observes inquiries and debates from time to time > (on this mailing list, for example) about best/proper usage of each. One sees inquiries and debates about the proper usage of every language feature; this one seems pretty easy to clear up, and doesn't seem to cause any horrible confusion. (Indeed, in most cases, the practical difference is trivial.) > - xrange and range are both oriented to intervals that are closed on the > left and open on the right. If you want to specify an interval that is > open on the left and closed on the right, then you have to do extra > calculations that can be error-prone, e.g., If you *always* have half-open intervals (in the same direction), then you will know, almost without thinking about it, which way any corrections have to be made. If you sometimes have half-open, sometimes closed, sometimes reversed-half-open, sometimes fully open, etc... then you will constantly be having to check what you're doing in *this* case, look back at what you've done, think through in detail what the effects are, etc, etc. (There should be one, and preferably *only* one, obvious way to do it.) > left = getLeftSide() > right = getRightSide() > > for i in xrange(left+1,right+1): # open on left, closed on right -- > not so obvious In most cases, I'd expect the underlying source of the data to behave according to 0-based half-open intervals. If it doesn't, I'd correct it at the interface, instead of in the range()-- left = getLeftSide() - 1 right = getRightSide() - 1 for i in range(left, right): ... Not perfect, perhaps, but at least explicit. > Compared to: > > for i in left / span // right: # open on left, closed on right This looks far less clear to me, sorry. Was // supposed to be open, or closed? Let me search through my reference book again.... > Furthermore, there is no syntactic mechanism in xrange/range that visually > indicates the fact that the left side is closed and the right is open. And > for any other combination (e.g., open on the left, closed on the right) > xrange and range aren't very obvious. They are *always* the same, therefore no visual mechanism is needed. The fact that it says "range" tells me that it's closed left and open right. I don't have to worry about any other possibility. > And using span -- in my experience with this exercise -- didn't seem like > "a lot of work". To me, at least, it seemed quite easy. Using, perhaps not. Implementing it sure looked like it. Yeah, it only has to be done once... and then maintained... and then possibly updated with each new version of Python... etc, etc, etc... All for a way to make range() look different (it looks *more* confusing to me, though obviously not to you). > So I would suggest that one key difference between span and xrange is that > span has a better mechanism for specifying all combinations of > "open/closed"-ness for intervals whereas xrange and range really target > "closed on left / open on right" intervals (which, granted, are very common > -- but not what one needs for all occasions). This is a recipe for confusion. If you can't rely on the half-open interval being always the same, then it *will* bite you eventually, and a lot worse than people currently get bit by range()'s behavior (which is at least predictable). Jeff Shannon Technician/Programmer Credit International From nbecker at fred.net Mon Dec 24 08:31:42 2001 From: nbecker at fred.net (nbecker at fred.net) Date: 24 Dec 2001 08:31:42 -0500 Subject: Python 1.5.x vs Python 2.x.x References: <3C180FF7.DEAEA6C6@radical.ca> <7xhequjsgl.fsf@ruckus.brouhaha.com> <9vc581$g0h$1@peabody.colorado.edu> <97ae44ee.0112181624.2293a692@posting.google.com> <9vr8gp$3af$1@peabody.colorado.edu> Message-ID: The correct solution is obvious. Since RedHat writes packages that need a particular version of python that is not current, they just need to put #!/usr/bin/python1.5 at the start of their packages. From phony_address at yahoo.com Wed Dec 5 15:21:07 2001 From: phony_address at yahoo.com (Phredd Phlintstone) Date: Wed, 05 Dec 2001 20:21:07 GMT Subject: Distant learning Python classes? Message-ID: <3c0e80f6.4856295@news> I am new...not only new to Python, but new to computer programming. I'm eager to learn but am looking for a bit more structure than just reading a book and 'jumping in.' I am reading a book, and it's making sense even... Any online 'distant learning' classes in Python? I've found a few on different languages (free even) at: http://www.free-ed.net/catalog/ but as you see, no Python is offered. Perl, but no Python. If you know of any online learning classes, please post the addresses in the group. Thanks. Please post any responses to this to this newsgroup. From bt98 at doc.ic.ac.uk Fri Dec 28 09:02:20 2001 From: bt98 at doc.ic.ac.uk (Benjamin Tai) Date: Fri, 28 Dec 2001 14:02:20 +0000 Subject: REPOST: scripting on top of structural Message-ID: <3$--$$_----_-$--_$@news.noc.cabal.int> Hi, Please note that this message is posted on Python and Tcl newsgroup, and VTK mailing list. When an application written in a structural language is extended with a scripting language, there are many improved functionalities. 1) Packages for GUI (in C/C++ case) 2) Wider range of libraries, easier interprocess communication. 3) Expose the application to a wider range of community. 4) Simplified syntax, speed up prototyping. 5) Ready to be embedded into foreign application as scripting language functioned as a glue. Such applications, fabricated by a "composition of languages" include Visualization Toolkit (VTK) and Video Conferencing (VIC). However are there any other reasons for such composition? >From the applications mentioned above, scripts only contain high level descriptions of pipeline and datapath respectively. They have limited access to the inner core of the application, thus the behaviour of the engine. Any comments for the following questions are appreciated: Despite the limitation, have I missed out any other potential benefits provided by "composition of languages" on VTK and VIC? Apart from the difference in performance and syntax, are there any reasons to separate the implementation into two languages? Are there any other examples of applicaitons implemented with "composition of languages"? Most importantly, would there be any applicaitons implemented with "composition of languages" that has overcome the limitation described? Thanks Ben ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Benjamin Tai Newsgroups: comp.lang.python Subject: cmsg cancel <3C2C7B6C.DB7EDC32 at doc.ic.ac.uk> Control: cancel <3C2C7B6C.DB7EDC32 at doc.ic.ac.uk> Date: Mon, 31 Dec 2001 04:41:30 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775392 27193 211.57.49.2 (31 Dec 2001 05:09:52 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:09:52 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From fred at balzac.scd.ucar.edu Wed Dec 12 17:12:03 2001 From: fred at balzac.scd.ucar.edu (Fred Clare) Date: 12 Dec 2001 22:12:03 GMT Subject: a lambda in a function Message-ID: <9v8knj$f61$1@news.ucar.edu> Why does interpreting the five lines: def func(): x = 1 add_one = lambda i: i+x j = add_one(100) func() Give me: Traceback (most recent call last): File "test.py", line 6, in ? func() File "test.py", line 4, in func j = add_one(100) File "test.py", line 3, in add_one = lambda i: i+x NameError: There is no variable named 'x' while interpreting the three lines: x = 1 add_one = lambda i: i+x j = add_one(100) works just fine? --------------------------------------------- Fred Clare fred at ucar.edu 303-497-1284 Visualization & Enabling Technologies Section NCAR Scientific Computing Division --------------------------------------------- From osuchw at ecn.ab.ca Thu Dec 27 11:07:27 2001 From: osuchw at ecn.ab.ca (waldekO) Date: 27 Dec 2001 08:07:27 -0800 Subject: REPOST: Re: Running a script in windows References: Message-ID: <2$--$$_----_%-$__$@news.noc.cabal.int> Jonathan Gardner wrote in message news:... > I know this comes up a lot, but I can't seem to find the answer in the > archives. (If the answer is RTFM, please let me know where.) > > I don't have a windows box on my desk. A friend of mine does, but I can't get > to it. He is trying to run a program I wrote, but the error message is coming > up too fast for him to catch it. How can you keep that error message window > around longer in Win2K? (BTW, let's pretend he doesn't know how to use the > DOS prompt.) > > Jonathan As the last line of your program put something like this raw_input('\nPress Enter key to close') It will keep DOS window open and you will be able to read error message. ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: osuchw at ecn.ab.ca (waldekO) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:38:57 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775725 27193 211.57.49.2 (31 Dec 2001 05:15:25 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:15:25 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jdhunter at nitace.bsd.uchicago.edu Wed Dec 5 09:55:54 2001 From: jdhunter at nitace.bsd.uchicago.edu (John Hunter) Date: Wed, 05 Dec 2001 08:55:54 -0600 Subject: httplib slow read References: <48cs0u0a88eef5sacpbo12k1qappf9kodp@4ax.com> Message-ID: >>>>> "Toby" == Toby Dickenson writes: Toby> It could well be a problem with your hand-crafted http Toby> request. I suggest you go with urllib. I needed to set some headers, like Referer and Cookie, which is why I went with httplib. I sniffed port 80 to find out how what was being sent by my browser, and then constructed the headers from that info, so I think my headers were ok. Can't say for sure. I suppose the headers can also be set with the urlencode format of urllib, so this is probably the way to go; thanks for the suggestion. Still curious why the read is so slow with httplib, though. John Hunter From ssthapa at classes.cs.uchicago.edu Thu Dec 20 16:54:30 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Thu, 20 Dec 2001 21:54:30 GMT Subject: lost interest? References: <20011208001123.A5989@casa.parque> <4bLT7.32$aS.11733@news010.worldonline.dk> <9vtgc1$de5$1@panix3.panix.com> Message-ID: Aahz Maruch wrote: >> Yes, I suppose that's true although I thought that there some of the >>core developers working on distutils that might have been interested >>in something like this. > >From some threads on python-dev, even distutils is having trouble >finding developer support these days. Yes, I noticed Andrew's message to distutils-sig about not being able to maintain distutils anymore. However, I think that distutils is mature enough that it could get by with the occasional patch. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From bfg10k at 21cn.com Tue Dec 25 04:29:26 2001 From: bfg10k at 21cn.com (Felix) Date: Tue, 25 Dec 2001 17:29:26 +0800 Subject: how to create IPictureDisp objects with python? Message-ID: i try to host an activex control in my program . the control has a picture property which only accepts "IPictureDisp" interfaces. does anybody know how to create IPictureDisp objects? thanks. From peter at engcorp.com Fri Dec 7 20:23:50 2001 From: peter at engcorp.com (Peter Hansen) Date: Fri, 07 Dec 2001 20:23:50 -0500 Subject: Regex help References: Message-ID: <3C116BA6.EBD2C911@engcorp.com> > David A McInnis wrote: > > Is there a more efficient way to do this. It seams like this is executing the search twice. > > patt = re.compile("fax
\s*([0-9]{3,3}-[0-9]{3,3}-[0-9]{4,4})", re.I) > if patt.search(tststring): > faxnum = patt.search(tststring).group(1) > print faxnum > I cannot just do > faxnum = patt.search(tststring).group(1) > > because if there is no match, it returns an error You could just encapsulate it in a try/except to catch the AttributeError you get when it fails. try: print patt.search(tststring).group(1) except AttributeError: pass -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From thisis at bogus.com Wed Dec 5 13:24:47 2001 From: thisis at bogus.com (Duke) Date: Wed, 5 Dec 2001 13:24:47 -0500 Subject: Learning resources needed References: <9ukp40$90u84$1@ID-106629.news.dfncis.de> Message-ID: <9ulol3$99ebb$1@ID-106629.news.dfncis.de> "Luca Fini" wrote in message news:Pine.LNX.4.33.0112051051230.32312-100000 at localhost.localdomain... > The Tkinter tutorial was good for me. I had a little experience in window > based programming in IDL and some development with LabWindows/CVI. See: > > http://www.pythonware.com/library/tkinter/introduction/index.htm Grazzie tanto Luca! I don't know how I managed to not find it myself, but that's what happened. > > Seems to me that Python is, in a way, competing with Tcl as the scripting > > engine behind the Tk toolkit. If I learn Tcl/Tk first would it be > > relatively simple to move over to Python/Tkinter? > > I do not believe so. I do not know tcl at all but I've had a look to a > "python/tcl/basic" based introduction to programming tutorial > (http://www.crosswinds.net/~agauld/) for the very beginner and tcl looks > very ugly as a programming language. My feeling is that Tk will survive > only because it has very strong bundles with python and perl. >From what I've read it has a few similarities with LISP. I think it [Tcl] too will survive because a) it's installed on a gazillion machines & b) it's very simple to use (including Tk) for quickly building (what starts out as) simple GUI apps. I'm gonna learn it just enough so that I can write supersimple apps in it. There seem to be a lot of pople that badmouth it, yet there seem to be a lot of people who swear by it. That said, I'm going to focus on bettering my Python/Tkinter skills. Thx From grey at despair.dmiyu.org Thu Dec 27 20:10:55 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Fri, 28 Dec 2001 01:10:55 -0000 Subject: REPOST: Re: Python Popularity: Questions and Comments References: <3C2A9D33.67FEC261@earthlink.net> <3C2B9901.998345FB@earthlink.net> Message-ID: <4$--$$_-----$%$__$@news.noc.cabal.int> On Thu, 27 Dec 2001 21:53:41 GMT, Ron Stephens wrote: > Now, my perception is that most Ruby developers run under Linux or some > other Unix. I wonder what percentage of Python developers run Windows, and > what percentage run Linux? I have no idea, does anyone have a guess? If you > put my back to the wall to make a prediction, I'd guess that more than half > of us on this newsgroup use windows. Anyone? Well, sure, worded that way. I /use/ Windows. I need something for my games and while Linux suits 99.5% of my productivity needs it isn't quite there in the games market. Did you mean, perhaps, use Windows exclusively? -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!upp1.onvoy!onvoy.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Steve Lamb Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:50:23 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775451 27193 211.57.49.2 (31 Dec 2001 05:10:51 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:10:51 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From shiver at yubc.net Wed Dec 26 20:56:50 2001 From: shiver at yubc.net (I.J.) Date: Thu, 27 Dec 2001 02:56:50 +0100 Subject: REPOST: is this a bug or what? Message-ID: <3$--$$_--__-$$_-%$@news.noc.cabal.int> >>> M=[[0]*3]*3 >>> M [[0, 0, 0], [0, 0, 0], [0, 0, 0]] >>> M[1][1]=1 >>> M [[0, 1, 0], [0, 1, 0], [0, 1, 0]] Is this new age math? -------------- next part -------------- An HTML attachment was scrubbed... URL: From aahz at panix.com Thu Dec 27 13:10:09 2001 From: aahz at panix.com (Aahz Maruch) Date: 27 Dec 2001 10:10:09 -0800 Subject: A new message board is up References: <40dbad98.0112262232.1868734e@posting.google.com> <40dbad98.0112271006.b98e822@posting.google.com> Message-ID: In article <40dbad98.0112271006.b98e822 at posting.google.com>, Andrew Nguyen wrote: > >and yes, python does need a lighter heart. With friends like these.... -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 4 days and counting From iwk_nospam at xs4all_nospam.nl Tue Dec 11 09:32:49 2001 From: iwk_nospam at xs4all_nospam.nl (iwk) Date: Tue, 11 Dec 2001 15:32:49 +0100 Subject: How to use pty.py? Message-ID: <3C161911.70607@xs4all_nospam.nl> Hi there, I need to pass input to a program at a customers' site which bypasses stin/out and reads/writes to/from a terminal, just like ssh when it asks for a password. So I cannot pipe the data to the program. To the best of my knowledge I should be able to use pty.py to start the program and provide it with the required input. But how? Does anyone have some examples? Thanks & regards, Iwan From sag at hydrosphere.com Wed Dec 12 19:26:53 2001 From: sag at hydrosphere.com (Sue Giller) Date: Wed, 12 Dec 2001 17:26:53 -0700 Subject: Sorting things into bins Message-ID: <20011213002503994.AAA248@mail.climatedata.com@SUEW2000> Is there a quick and simple way to sort a set of values (strings in this case) into a set of bins, based on a subset of the characters in the string? This is a very simplified, small version of what I want to do, but if I can solve this example, I think I can expand it to fix my problem. All strings would be same length. These strings are contained in a list. For example, a set of strings that look like numbers. There is a pattern to the strings, as they represent date:time values and they can't easily be converted to a number. ['0101', '0102', '0103', '0201', '0202', '0203] I might want to sort them into two bins which I will define from the list of string (bins are all values for first 2 chars in the strings): 01, 02, => then 01 contains '0101', '0102', '0103', and 02 contains 0201, 0202 and 0203 or I might want to sort them into three bins (bins are all values for second 2 chars in the strings): 01, 02, 03 => then 01 contains 0101 and 0201, and 02 contains 0102, 0202, and 03 contains 0103 and 0203 The real bins will be built from a longer string than 2 chars. For some reason, I think this should have an elegant solution in python, but I am too much a newbie to see it. Any suggestions? Thanks From BgPorter at NOartlogicSPAM.com Thu Dec 6 09:05:58 2001 From: BgPorter at NOartlogicSPAM.com (Brett g Porter) Date: Thu, 06 Dec 2001 14:05:58 GMT Subject: mp3info and python References: Message-ID: "Dave Pawson" wrote in message news:Xns916F3C471DB7EdavePdpawsonfreeserv at 195.92.195.157... > "Brett g Porter" wrote > > > If there's ID3 data at the end of the file, subtract that from the > > filesize before calculating. > > Is that of a fixed size please? See: http://home.swipnet.se/grd/mp3info/mp3doc.html www.id3.org http://www.dv.co.yu/mpgscript/mpeghdr.htm > the functions imply that the header info is stored in the id3 'header' > if thats the right term. > > > > > If it's a variable bit rate file, you will need to scan through the > > file and count frames, multiplying by the constant # of milliseconds > > per frame. > > No, its not vbr, and I've not seen such a constant in the > file. That's because the constant is implicit. The way that MPEG compressed audio works (in grotesque simplification -- partly because the space vs tab war here makes me sensitive to being OT, partly because I don't want to look like I'm claiming a deeper grasp than I have) is that the compressing part of the codec chunks up the audio into 24 ms long 'frames' (where 24 is the value I remember, but it's been a while...) and analyzes each frame separately (more or less). One of the URLs above has a better explanation > Re my original question, is the total time of the file fixed > in this id3 data, or is it the sum of each frame, possibly where > each frame might be a song on a CD album? The time of the file can be calculated as before once you know the bitrate it was encoded at. A 128K MP3 file occupies 16000 bytes for every second of audio. See above for frame info. > Other id3 heading stuff implies that might be the case. > In which case, how do I skip from one set of header data to another? > > regards DaveP > From pj at sgi.com Thu Dec 6 16:11:21 2001 From: pj at sgi.com (Paul Jackson) Date: 6 Dec 2001 21:11:21 GMT Subject: PEP 276 Simple Iterator for ints (fwd) References: Message-ID: <9uomtp$e1cbj$1@fido.engr.sgi.com> David wrote: |> I redid my lecture notes |> using Greg |> Ewing's "for lb <= var < ub" syntax in place of my previous |> "for var in [lb, lb+1, ... ub]". |> |> I'm happy with the result Ah - you may have exposed my primary concern with this - thanks. It isn't obvious to me which variables are free and which bound. All the examples I happened to read earlier in this thread had only one variable, and used explicit integer constants for the bounds, as in: for 0 <= x < 5: In that case, it's pretty obvious that 'x' is the free variable. But in your notes, you have things such as: for n > i >= 0: for i < j <= n: Here it seems to rely on some assumption that the middle term, i or j, is the free variable. So at least the following two variants: for 0 <= x**2 < 16: # integers x whose square is in range(16) for 0 <= x: # non-negative integers x should not be allowed, because they violate the assumption I just surmised. Or then the assumption gets more subtle. And then you lose me. Pseudo code, such as in David's lecture notes, has the advantage that it can rely on contectual comments, suggestive variable names, and the authors descretion to avoid non-trivial cases. But programming language syntax needs to be parsable by clear rules, even absent (1) comments, (2) suggestive variable names, or (3) discrete authors. -- I won't rest till it's the best ... Manager, Linux Scalability Paul Jackson 1.650.933.1373 From jkraska at san.rr.com Fri Dec 14 18:30:25 2001 From: jkraska at san.rr.com (Courageous) Date: Fri, 14 Dec 2001 23:30:25 GMT Subject: CPython internal design question References: Message-ID: >In this case "im" is (presumably) short for Instance Method, in all cases it >makes it easy to find field references in the code base via simple search >mechanisms, and in some cases it's a helpful reminder of what kind of object >referencing code is mucking with. Note that there are more than 5,000 >instances of the identifier "self" in the C portion of the Python code base. >If you're specifically looking for uses of "self" in instance method >structs, that there are only 18 hits on im_self greatly eases the task. > >the-simpler-the-conventions-the-simpler-the-needed-tools-ly y'rs - tim That makes sense, thanks. I'll have to consider that in light of other projects. It's a good convention. Of course one convention that Python uses internally that really annoys the devil out of me is defining functions like this: ReturnType MyFunction ( ... ); Why? Greppying through the file will fail to yield the return type of the function. BLEACH. I HATE that. :) C// From buzzard at urubu.freeserve.co.uk Wed Dec 5 08:41:46 2001 From: buzzard at urubu.freeserve.co.uk (Duncan Smith) Date: Wed, 5 Dec 2001 13:41:46 -0000 Subject: minidom References: <9uhr26$nfs$1@newsg1.svr.pol.co.uk> <3C0C7DD5.AC50A8CB@engcorp.com> <9ui8sv$7kf$1@newsg4.svr.pol.co.uk> <3C0D198C.7C0AD0E9@alcyone.com> Message-ID: <9ul888$skr$1@newsg1.svr.pol.co.uk> "Erik Max Francis" wrote in message news:3C0D198C.7C0AD0E9 at alcyone.com... > Duncan Smith wrote: > > > OK. I'll give that a go. I was using 'doc = > > xml.dom.minidom.parse(f)' and > > getting 'None' returned from 'nodeValue'. Cheers. > > Note that it's the nodeValue of the child of the element with the tag, > not the nodeValue of the element. > This is the specific bit of information I needed. Thanks to everybody who has responded. Duncan > -- > Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ > __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE > / \ Laws are silent in time of war. > \__/ Cicero > Esperanto reference / http://www.alcyone.com/max/lang/esperanto/ > An Esperanto reference for English speakers. From lac at strakt.com Sun Dec 30 14:47:26 2001 From: lac at strakt.com (Laura Creighton) Date: Sun, 30 Dec 2001 20:47:26 +0100 Subject: A new forum is up! Q: what means nntp In-Reply-To: Message from Peter Hansen of "Fri, 28 Dec 2001 11:49:09 EST." <3C2CA285.BE256C16@engcorp.com> References: <40dbad98.0112262238.73fc14f9@posting.google.com> <3C2B941D.B1E45AA5@htp-tel.de> <3C2CA285.BE256C16@engcorp.com> Message-ID: <200112301947.fBUJlQua025817@ratthing-b246.strakt.com> Peter Hansen doubts he was reading netnews in 1980. Peter Hansen is in Toronto, if I remember correctly, and so his doubts are probably wrong. In 1980 Henry Spencer and I at utzoo made usenet international with the 23rd or 28th usenet site (the lpr paper is too faded to tell now.) We spread usenet to Canadian universities and companies all over Canada. If you were reading it, it was because either Henry or I stayed up past midnight (we alternated nights) to call out first to duke then to decvax, when decvax came on board. Autodialers were very expensive then, and utzoo didn't have any. Google is storing all the old usenet from then by the way, the old utzoo backup tapes (and yes, I made roughly a third of them as well) if you ever get curious as to what things were like then. http://www.google.com/googlegroups/archive_announce_20.html Laura Creighton From nospam at mega-nerd.com Tue Dec 4 03:02:56 2001 From: nospam at mega-nerd.com (Erik de Castro Lopo) Date: Tue, 04 Dec 2001 08:02:56 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <0pvl0ug52ug206qkpne2sjrinb2e8qsvam@4ax.com> Message-ID: <3C0C8330.79D0E598@mega-nerd.com> Courageous wrote: > > >I like the width of 4 spaces also, BUT I use tabs and configured my editor > >to "DISPLAY" tabs as 4 characters in width. > > In my experience, the vast majority of people who do this > inevitably end up mixing tabs and spaces. The moment you do > this, you have defacto chosen an tabwidth for your viewing > audience whether they like it or not. Actually, what the previous poster suggested will prevent problems. If spaces should creep in Python won't compile the code. Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam at mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ Q: What do you call a christian who accidently read the bible with his brain turned on? A: An atheist From steve at ferg.org Fri Dec 14 09:13:48 2001 From: steve at ferg.org (Stephen Ferg) Date: 14 Dec 2001 06:13:48 -0800 Subject: which book? References: Message-ID: I'd recommend the QUICK PYTHON BOOK (or is it PYTHON QUICKLY?) Published by Manning (http://www.manning.com). It is unique in being short and very readable. The best place to start. You will also need a copy of the online documentation, especially the Library Reference. If you don't want to stress your printer by printing off hundreds of pages, instead get Beazley's Python Essential Reference. From emile at fenx.com Sat Dec 15 06:24:54 2001 From: emile at fenx.com (Emile van Sebille) Date: Sat, 15 Dec 2001 03:24:54 -0800 Subject: using IDLE as a syntax highlighting external editor for Zope? References: Message-ID: <9vfc90$f1ajm$1@ID-11957.news.dfncis.de> "Warren Postma" wrote in message news:HrBS7.677$pOp1.55 at news2.bloor.is... > I'm interested in patching Zope to use FTP send and receive to remotely edit > Zope script methods. > > Has anybody else tried this yet? > > Warren > > No patch needed. It's already in there. -- Emile van Sebille emile at fenx.com --------- From Shourya.Sarcar at med.ge.com Fri Dec 21 13:43:16 2001 From: Shourya.Sarcar at med.ge.com (Sarcar, Shourya C (MED)) Date: Fri, 21 Dec 2001 12:43:16 -0600 Subject: getting strings from the shell commands Message-ID: <75968FA028EAD311B3530090279CF80C0B29FEE5@uswaumsx07medge.med.ge.com> i have a shell script which prints some strings on the stdout. how can i get those strings without having to open and parse a (tmp) file from python I want to do something in python LIKE os.system("./myscript") but how can i get the out put into a [list of] strings shourya From thisis at bogus.com Wed Dec 5 04:26:32 2001 From: thisis at bogus.com (Duke) Date: Wed, 5 Dec 2001 04:26:32 -0500 Subject: Learning resources needed Message-ID: <9ukp40$90u84$1@ID-106629.news.dfncis.de> I am looking to learn Python/Tkinter. I'm a competent C/C++/Java programmer, however I don't have any experience with Tcl/Tk. I think I can easily pick up Python from the stuff I found linked on python.org, however I would be interested in any or all resources specifically addressing Tkinter - if there are any which cater to a beginning Python user, all the better. The other alternative is to buy a book. There only seems to be one specific to this (Python and Tkinter Programming, John E. Grayson) and it's gotten mixed reviews as far as I can tell. Should I give Tcl a shot as well? Seems to me that Python is, in a way, competing with Tcl as the scripting engine behind the Tk toolkit. If I learn Tcl/Tk first would it be relatively simple to move over to Python/Tkinter? And oh yeah, I've always hated GOOEY programming and this is the first compromise I am willing to make to get something going on the non-command-line front ;) Thx. P.S. Anyone recommending vxPython instead? My main gripe would be that it wouldn't run in KDE while Tkinter should run in both it & GNOME. Easy[er] Windblows client libs install is a plus. From gdamjan_DELETE_ at on.net.mk Fri Dec 21 08:06:47 2001 From: gdamjan_DELETE_ at on.net.mk (Damjan Georgievski) Date: Fri, 21 Dec 2001 14:06:47 +0100 Subject: SMPP module in Python ? References: Message-ID: <3c233408$1@news.mt.net.mk> > I have SMPP module in my archive. It is not mine, I downloaded it (3-4 > years ago) from the Net and adapted a bit to my needs. I sent patches to > the module author (I found him with Google)... but I repeated the search > now, and it seems he disappeared. I can find the module in my archives. Can you send it to me please, my e-mail is gdamjan_at_on.net.mk -- damjan It's not a bug, it's tradition! From James_Althoff at i2.com Mon Dec 3 19:16:04 2001 From: James_Althoff at i2.com (James_Althoff at i2.com) Date: Mon, 3 Dec 2001 16:16:04 -0800 Subject: Python evangelists unite! Message-ID: Peter Milliken wrote: >Obviously you haven't worked at the architectural >level of any *large* projects (10's or even 100's of programmers) otherwise >you would never make the statements you do. Ignorance is bliss I guess :-) But since all things are not simply "black or white" you might want to keep in the back of your mind the fact that our company has written a successful commercial product that comprises several hundreds of thousands of lines of Jython code written by several dozen programmers working in multiple locations throughout the world and has been in production use for over a year and is expected to be supported for many years to come (the C++ product that it replaced has been supported in production use for over seven years and counting). Jim From des.small at bristol.ac.uk Tue Dec 11 09:14:03 2001 From: des.small at bristol.ac.uk (Dr. Des Small) Date: Tue, 11 Dec 2001 14:14:03 GMT Subject: constructors for lists and tuples References: <1f5252d4.0112110519.2617d639@posting.google.com> Message-ID: nbecker at fred.net (N Becker) writes: > what are the constructors for lists and tuples? [] and () respectively. > I wanted to make a > list of a known size and then populate it. Based on my experience > with C++ and STL, I expected to find a constructor that took a > size. Python isn't C++, thankfully. What you want is >>> foo=10*[None] >>> foo [None, None, None, None, None, None, None, None, None, None] >>> foo[0] = 'a' >>> foo ['a', None, None, None, None, None, None, None, None, None] Des. -- Dr Des Small, Scientific Programmer, School of Mathematics, University of Bristol, Tel: 0117 9287984 From aahz at panix.com Sat Dec 29 13:55:55 2001 From: aahz at panix.com (Aahz Maruch) Date: 29 Dec 2001 10:55:55 -0800 Subject: REPOST: Re: Correct use of Classes? References: Message-ID: <1$--$$_----___%%%$@news.noc.cabal.int> In article , G. Willoughby wrote: > > Can someone please point me to any docs on the net that deal with >correct useage of classes in python. I have been coding with python now for >nearly a year but i haven't really touched on using classes, I know how to >code them but i need a little guidance for when to use them in the real >world. Try http://www.mindview.net/Books/TIPython -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 2 days and counting ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: aahz at panix.com (Aahz Maruch) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:23:27 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774621 27193 211.57.49.2 (31 Dec 2001 04:57:01 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:57:01 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From howardk at cts.com Mon Dec 31 11:52:23 2001 From: howardk at cts.com (Howard Knight) Date: 31 Dec 2001 16:52:23 GMT Subject: Cancel messages References: Message-ID: <3c3097c7$0$79590$e2e8da3@nntp.cts.com> Aahz Maruch (aahz at panix.com) wrote: > I don't think that cancels affect python-list, but the admins should > probably set up a filter to ignore the REPOST: articles based on the > X-Reposted-By: header. Actually, a better filter would be the "resurrector" pseudo site in the Path line. That way, if anyone else besides Guido resurrects posts, it will filter those out too. Here's a sample of one of Guido's Path lines: Path: ...!news.noc.cabal.int!resurrector!guidorepost!not-for-mail Howard From grey at despair.dmiyu.org Sat Dec 22 09:59:17 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Sat, 22 Dec 2001 14:59:17 -0000 Subject: vi or emacs for editing Python on Linux? References: Message-ID: On 21 Dec 2001 19:32:17 -0800, Aahz Maruch wrote: > PS: I don't remember you being on Netcom. 3 words: Pack rat network. :) -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From lac at strakt.com Wed Dec 5 09:00:18 2001 From: lac at strakt.com (Laura Creighton) Date: Wed, 05 Dec 2001 15:00:18 +0100 Subject: Learning resources needed In-Reply-To: Message from "Duke" of "Wed, 05 Dec 2001 04:26:32 EST." <9ukp40$90u84$1@ID-106629.news.dfncis.de> References: <9ukp40$90u84$1@ID-106629.news.dfncis.de> Message-ID: <200112051400.fB5E0Iua019056@ratthing-b246.strakt.com> You need to give a better mailing address than thisis at bogus.com if you want to get mail. Stay away from Tcl if you can help it. Take a look at http://www.pythonware.com/library/tkinter/introduction/index.htm If you find this hard going, then learning Tkinter will be hard for you. Lots of people like wxPython. Lots of people don't. Some of the reasons that some people hate it are exactly the same reasons that some people love it. You will have to try it and see. Laura Creighton From ssthapa at classes.cs.uchicago.edu Tue Dec 18 11:45:19 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Tue, 18 Dec 2001 16:45:19 GMT Subject: ANN: ciphon 0.3.4 Message-ID: I've uploaded a new version of ciphon to sourceforge.net and to anonymous ftp at ftp.community.tummy.com. The recent changes to ciphon are: Ciphon now supports distutils so it can be updated from within itself. Packages that ciphon installs are now recorded so that they won't have to be downloaded again if they are a dependency. RPM should now work for modules that support the bdist_rpm option of distutils There were a few other minor changes but these are the biggest ones. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From rdsteph at earthlink.net Thu Dec 27 19:07:11 2001 From: rdsteph at earthlink.net (Ron Stephens) Date: Fri, 28 Dec 2001 00:07:11 GMT Subject: Python web programming for Newbies article on NewsForge ;-))) Message-ID: <3C2BB84E.233C304A@earthlink.net> Shamelessly trolling for newbies to convert to Python, article makes Newsforge. http://www.newsforge.com/article.pl?sid=01/12/27/1950241&mode=nocomment From claird at starbase.neosoft.com Fri Dec 28 10:21:55 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 28 Dec 2001 09:21:55 -0600 Subject: REPOST: Re: tcl??? References: <%FOW7.8662$7p6.139123@rwcrnsc51.ops.asp.att.net> Message-ID: <1$--$$_----_-%-%%$@news.noc.cabal.int> In article , ~Jason~ wrote: >I am running XP; and the error I am getting when I type in "tclsh80" is >[File"","line 1, in ? tclsh80 NameError: Name tclsh80' is not >defined] . . . I'm more confused than before. You're on a Windows XP host, and you have successfully installed Python (or ActivePython?), correct? What version is that? What application do you launch that suggests you "type tclsh80"? -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: claird at starbase.neosoft.com (Cameron Laird) Newsgroups: comp.lang.python Subject: cmsg cancel <5B2C114B09F60421.20863CA7F38A0CEF.DE1A496BB79AB1C7 at lp.airnews.net> Control: cancel <5B2C114B09F60421.20863CA7F38A0CEF.DE1A496BB79AB1C7 at lp.airnews.net> Date: Mon, 31 Dec 2001 03:39:43 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775356 27193 211.57.49.2 (31 Dec 2001 05:09:16 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:09:16 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From sjoshi at ingr.com Tue Dec 11 11:37:07 2001 From: sjoshi at ingr.com (Sunit Joshi) Date: 11 Dec 2001 08:37:07 -0800 Subject: Py2exe errors !! Message-ID: <8f8ffe67.0112110837.5231c235@posting.google.com> Hello All Can someone tell me what's happening here. I'm trying to invoke py2exe and I keep getting this error error: invalid command 'py2exe' (no module named 'distutils.command.py2exe') I checked the path and everything looks fine. Any pointers are appreciated. thanks Sunit From hfoffani at yahoo.com Tue Dec 25 07:35:44 2001 From: hfoffani at yahoo.com (Hernan M. Foffani) Date: Tue, 25 Dec 2001 13:35:44 +0100 Subject: REPOST: [ANNOUNCE] Microsoft HTML Help of Python 2.2 Docs Message-ID: <7$--$$-$$$$%___--$@news.noc.cabal.int> The latest version of Microsoft HTML Help of Python 2.2 documentation is at http://www.orgmf.com.ar/condor/pytstuff.html#python It's completely free. As you all know, the docs of Python are distributed in a bunch of html files. With MS HTML Help file you get all the docs in 1 file of 2.9 MB that has a table of contents tree and full text search. Best Regards, Hernan.

MS HTML Help of Python 2.2 Docs - Python's 2.2 documentation in MS Help format: 1 file with full text search. (Dec-25-01) -- Hernan M. Foffani hfoffani at yahoo.com www.orgmf.com.ar/condor/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "Hernan M. Foffani" Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:24:00 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775960 27193 211.57.49.2 (31 Dec 2001 05:19:20 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:19:20 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From MarkH at ActiveState.com Tue Dec 11 18:18:13 2001 From: MarkH at ActiveState.com (Mark Hammond) Date: Tue, 11 Dec 2001 23:18:13 GMT Subject: Fatal Error in the interpreter? References: Message-ID: <3C1694D0.5090502@ActiveState.com> Courageous wrote: > On Tue, 11 Dec 2001 21:30:14 +1100 (EDT), Andrew MacIntyre > wrote: > > >>On Mon, 10 Dec 2001, Courageous wrote: >> >> >>>I'm currently using the Debug build from Python as checked >>>out of the current CVS branch (Python22). I have an extension >>>that I've written and compiled successfully, but when I import >>>it, the interpreter crashes: "Fatal Error: Interpreter not >>>initialized (version mismatch?)" >>> > >>>Upon introspection, it appears that the program is crashing >>>from within Py_InitModule(). >>> > >>The one time I saw this (on OS/2 so it may not translate), ISTR that I was >>trying to explicitly load the Python DLL, rather than rely on linkage via >>an import library. >> > > It appears to somehow be associated with some confusion over > python22_d.lib and the likes. Only I believe that I should be > getting the _d.lib when I build in VC, and that should be the > one I'm picking up when I run the interpreter. > > There must be something I don't know. Do I have to explicitly > define a flag? I'd think that the VC build should be able to > pick up on my build configuration -- debug mode. This magic happens in pyconfig.h. The pre-processor _DEBUG triggers both Py_DEBUG, and the default use of the "_d" library. _DEBUG is defined by default in MSVC Debug builds - so it *should* just work. Indeed, it generally does Mark. From mkelly2002NOSPAM at earthlink.net Mon Dec 3 13:18:19 2001 From: mkelly2002NOSPAM at earthlink.net (Michael Kelly) Date: Mon, 03 Dec 2001 18:18:19 GMT Subject: COM "out" Variant Array params and such References: <3C0AC811.4000406@ActiveState.com> Message-ID: On Mon, 03 Dec 2001 00:30:03 GMT, Mark Hammond wrote: >Michael Kelly wrote: >... > > >VariantArrayofStrings is an "out" param - it should not be assigned >anywhere. > I changed to non-retval out param to solve problems with other COM client environments as noted below. >The correct way to call this should be: > >VariantArrayOfStrings = MyIniFile.ReadSections("Section name") I implemented it that way initially but had all kinds of problems with clients in other languages, so I changed it to an out param that was not a retval and that cleared things up for at least VB6, D5 and Vc++6. My initial version was a Custom Interface but when I started experimenting with Python I redid it as a dual-interface IDispatch. I tried the IDispatch version again in VB and D5 with no problems at all. > >You probably need to generate "makepy" support for this to work - but it >seems you have already done that. Yeah, that's really neat. It's nice to be able to just use the CoClass. I tried little test driver apps importing the created module using both the ...IDispatch() to create the instance and just assigning to a variable as in MyIniFile = DIniFile() and both seem to work indentically. I was just hoping this would work smoothly as it would be a nice convenience component for win32 and I'd be glad to post the .dll on a board for download at some point when I've got the hinks out. :) >> type: exceptions.SystemError >> value: error return without exception set > > >This is a bug. Something like that has been fixed recently, but without >more details I can not be sure if it is exactly the same thing. I noticed something that sounded similar on the bug list. Is ActivePython using an older build of win32-all?? There seems to be a download for a newer build on the ActivePython site but it stipulates it's for use with the other dist. I downloaded it but I'm wondering if unpacking on top of ActivePython will hose my installation? Thanks for your replies Mark. I'm having a lot of fun with COM and Python. Mike -- "I don't want to belong to any club that would have me as a member." -- Groucho Marx From igorr at ifi.uio.no Wed Dec 26 19:03:12 2001 From: igorr at ifi.uio.no (Igor V. Rafienko) Date: 27 Dec 2001 01:03:12 +0100 Subject: try-except-finally question Message-ID: Hi, I'm writing a small program that updates a database. An update session depends on a number of external factors, and it is very important to log (to a file) if anything goes wrong. The skeleton code looks something like this: def updateDB(): # some initializing try: try: except ExternalFactorError: except DBError: # yrt # od finally: # yrt # end updateDB The outermost try-finally is needed to free the initialized resources. I have 2 questions: * In the innermost try-except there is a possibility for other exceptions than ExternalFactorError and DBError. How can I catch _all_ other exceptions than these two[*]? I'm not so much interested in error itself, but rather whether it occured. I.e. I'm looking for C++'s "catch (...)" construct in Python. * Is there a more elegant way of writing this function? TIA, ivr [*] is there a type that _all_ python object inherit from? (I know about exceptions.Exception, but I do not want to rely on whether third party modules actually inherit from it) -- Documentation is like sex: when it is good, it is very, very good; and when it is bad, it is better than nothing. -- Dick Brandon From jonas.b at home.se Tue Dec 18 13:29:25 2001 From: jonas.b at home.se (Jonas Bengtsson) Date: Tue, 18 Dec 2001 19:29:25 +0100 Subject: Tkinter message window Message-ID: I want to use a Tkinter window for presenting messages. I use the code as follows: ### root = Tkinter.Tk() textField = Tkinter.Text(self._root) textField.grid(sticky=Tkinter.NW+Tkinter.SE) #adding stuff to textField root.mainloop() ### But when the window is resized the textField remain the same. How do I accomplish the textField to resize along with the main window? TIA! /Jonas From loewis at informatik.hu-berlin.de Wed Dec 26 19:38:24 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 27 Dec 2001 01:38:24 +0100 Subject: REPOST: Re: Where to post Jython questions? References: Message-ID: <8$--$$-$$$$%__%%-$@news.noc.cabal.int> Oleg Broytmann writes: > On Wed, Dec 26, 2001 at 09:45:22AM -0800, Daniel Klein wrote: > > Is the the proper place to post questions/conversations for Jython? If > > not, please advise. > > http://www.jython.org/, Resources, Mailing Lists. Nevertheless, I think questions on Jython are welcome, here, too. Some may turn out to be Python questions proper. Regards, Martin ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Martin von Loewis Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 04:43:05 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009776177 27193 211.57.49.2 (31 Dec 2001 05:22:57 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:22:57 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From wware at alum.mit.edu Fri Dec 7 20:58:32 2001 From: wware at alum.mit.edu (Will Ware) Date: Fri, 07 Dec 2001 20:58:32 -0500 Subject: Python classes for reading/writing/parsing MIDI files References: <3C0F63F0.20D2B25@alum.mit.edu> <7876a8ea.0112061455.6685b313@posting.google.com> <3C111F3C.1B41508C@sage.att.com> Message-ID: <3C1173C8.39FD4761@alum.mit.edu> Garry Hodgson wrote: > i'm interested in being able to display/print sheet music from a given > midi file. does anyone know: > > a) if any of the above packages provide for this? > b) if this is a particularly hard problem? Something to look into is a text-based music notation language called ABC. There is a collection of utilities called abc2midi which can produce both MIDI and printable sheet music in Postscript format. If you're running on Linux, you can use ps2pdf to convert to a PDF document. From loewis at informatik.hu-berlin.de Fri Dec 21 11:56:11 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 21 Dec 2001 17:56:11 +0100 Subject: Can I change a unicode char to gb2312 using python? References: <9vq6d9$gvc5p$1@ID-12869.news.dfncis.de> <9vrk0m$h6rua$1@ID-12869.news.dfncis.de> Message-ID: Oleg Broytmann writes: > There is a seprate project somewhere on sf.net that hs many oriental > encodings. I don't rememeber its name, and cnnot find it... but it should > be there. It's at http://sourceforge.net/projects/python-codecs Regards, Martin From syver-en+usenet at online.no Sun Dec 30 07:39:56 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 30 Dec 2001 13:39:56 +0100 Subject: REPOST: pyro 2.3 remote.py windows fix. Message-ID: <2$--$$_----__-%--$@news.noc.cabal.int> Due to weak support for the signals module under windows, I'll have to comment out two lines from remote.py that is provided in the quickstart example for Pyro 2.2 and 2.3 as these are not defined in the windows version of the signal module (python 2.1.1). signal.signal(signal.SIGINT, interrupt) #signal.signal(signal.SIGHUP, interrupt) #signal.signal(signal.SIGQUIT, interrupt) -- Vennlig hilsen Syver Enstad ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Syver Enstad Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:34:11 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774250 27193 211.57.49.2 (31 Dec 2001 04:50:50 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:50:50 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From usenet at thinkspot.net Sat Dec 29 14:53:46 2001 From: usenet at thinkspot.net (Sheila King) Date: Sat, 29 Dec 2001 11:53:46 -0800 Subject: REPOST: Re: OT: Gender-based security? (was Re: Fate of win32all?) References: <7876a8ea.0112212116.2ebabc23@posting.google.com> <3C2BABD5.1070907@skippinet.com.au> Message-ID: <7$--$$_----___$-_$@news.noc.cabal.int> On 29 Dec 2001 10:15:14 -0800, aahz at panix.com (Aahz Maruch) wrote in comp.lang.python in article : > [BTW, Bruce, could you please make sure to attribute quotes? Makes > threads a lot easier to follow.] > > In article , > Bruce Eckel wrote: > >Mark Hammond: > >> > >>Thanks to everyone who replied to this thread - I really appreciate the > >>supportive words. I am very sure I will land on my feet, so there is no > >>need to worry (now if someone would just tell that to my girlfriend :) > > > >Women are wired different -- they look to security first. > > Nope. Perhaps you need to be introduced to some of the women I know. > Of course, they *do* tend to prefer Perl.... I did want to say something about that. Well, it doesn't apply to me too strongly. I'm the kind of person who changed my major as an undergrad, based on enjoying what I was studying rather than having a career to go to when I finished. (I figured...*something* would turn up.) Just this past year, I quit my job of 18 years, to go to something where my income is not guaranteed in order to enjoy my life more. Heck, maybe I'm a man in a woman's body???? Well, my husband does have the better paying job of the two of us, so maybe that gives me some freedom. And he is very supportive of me. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org/ ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Sheila King Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 02:59:33 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774608 27193 211.57.49.2 (31 Dec 2001 04:56:48 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:56:48 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From usenet at NOSPAM-irmen.cjb.net Tue Dec 4 16:52:45 2001 From: usenet at NOSPAM-irmen.cjb.net (Irmen de Jong) Date: Tue, 4 Dec 2001 22:52:45 +0100 Subject: ANN: Pyro 2.2 is available References: Message-ID: <9ujgje$bh1$1@news1.xs4all.nl> "Courageous" wrote [...] > I used Pyro a while back. I thought it was quite convenient and > very easy to use. Furthermore, the developers seemed responsive. Developer s ? It's only me, sir, and I don't have schizophrenia ;-) Just kidding Irmen de Jong From matt at mondoinfo.com Sun Dec 30 13:47:03 2001 From: matt at mondoinfo.com (Matthew Dixon Cowles) Date: Sun, 30 Dec 2001 18:47:03 GMT Subject: REPOST: Re: Pmw.ScrolledText: selecting a line? References: <9vte32$7rs$1@newshost.nmt.edu> Message-ID: <1$--$$_----__%_-%$@news.noc.cabal.int> On Thu, 20 Dec 2001 12:27:52 -0700, Bob Greschke wrote: >I can click on a point on the graph and get the ScrolledText field to >jump to the corresponding line in the file with .yview(line number), >but how (if possible) can I get the line to then also be 'selected' >or 'highlighted' somehow so the user knows which line the point is >associated with? Dear Bob, You can tag the appropriate line and configure the tag to highlight the text. Here's a small example: >>> from Tkinter import * >>> import Pmw >>> r=Tk() >>> t=Pmw.ScrolledText(r) >>> t.pack() >>> t.insert(END,"one\ntwo\nthree\nfour\nfive\nsix\nseven\n") >>> t.component("text").tag_add("standout","2.0","2.end") >>> t.component("text").tag_configure("standout",background="yellow") Regards, Matt ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.berkeley.edu!ucberkeley!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: matt at mondoinfo.com (Matthew Dixon Cowles) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 01:43:21 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774121 27193 211.57.49.2 (31 Dec 2001 04:48:41 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:48:41 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From inigoserna at terra.es Sun Dec 9 13:36:12 2001 From: inigoserna at terra.es (=?ISO-8859-1?Q?I=F1igo?= Serna) Date: 09 Dec 2001 19:36:12 +0100 Subject: ANN: lfm 0.7 Message-ID: <1007922972.2811.7.camel@lethe.infernus.org> Hello, I've uploaded lfm v0.7 on its web site: http://www.terra.es/personal7/inigoserna/lfm [Note that version 0.6 was never publically released.] lfm is a 'midnight commander'-clone written in Python and licensed under GNU Public License. It should work on any UNIX with a modern (n)curses library and Python curses module compiled in. See README file or visit the web page for more information. Changes since version 0.5: Version 0.7 ("Hello Darling, I'm here") - 2001/11/30: + 'pyview', a new pager/viewer for use with lfm or standalone, internally or externally. It is used as default pager too. Some features: Text / Hex view, backwards & forwards search, goto line/byte, un/wrap mode, documentation, ... + Rewrite 'show filesystems info' to use internal viewer + New 'run_thread' function in which almost every proccess is executed, so they can be stopped and there is a working signal too. 'do_something_on_file' does not use it + Implemented 'show file info' + Check errors when un/compressing + Support for .bz2 + Removed tar 'v' flag in un/compressing + Fixed completition, it should work perfectly now + Added Ctrl-D key to delete the whole content of the EntryLine + Implemented help: README, NEWS, TODO, ChangeLog or COPYING files + Added new function to show special files: html, graphics, ..., so we have defined new programs and file types too + Added new preference: show_output_after_exec, defaults to yes + Fix cursor position after deleting files + Default configuration is now saved inmediately + Many other bugs fixed again (see ChangeLog) As always, comments and suggestions are welcome. Note that my intentions is to end working on lfm as soon as the few features/bugs listed in TODO are implemented/fixed, so if you have some comments please tell me them now. Best regards, I?igo Serna -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 240 bytes Desc: not available URL: From richard at bizarsoftware.com.au Mon Dec 17 01:40:58 2001 From: richard at bizarsoftware.com.au (Richard Jones) Date: Mon, 17 Dec 2001 17:40:58 +1100 Subject: Tar for python? Better compressed file archives 'r us? Message-ID: <200112170639.fBH6dpk26965@bigboy.bizarsoftware.com.au> Does anyone have tar written in python? I've just compared the difference between a .zip and .tgz of the same directory structure, and the sizes are: -rw-rw-r-- 1 builder builder 3796376 Dec 17 15:39 zope.zip -rw-rw-r-- 1 builder builder 2270562 Dec 17 15:55 zope.tgz (the zip is a zope source tree with the C objects built) Having looked at the ZipFile source, I gather that zip compresses the stored files individually, whereas gzip'ing tar files will take advantage of the large amount of similarity between the files in the archive. The result being a loss of 1.5Mb of extraneous download :) In the meantime, I'm creating the zip file with ZIP_STORED and compressing the result... -rw-rw-r-- 1 builder builder 2635321 Dec 17 16:20 zope.zip.gz ... strange, it's still bigger than zope.tgz... but it's still much better than the zip file. Can't be read by unzip, but I don't care in this instance. Anyone else had any fun in this area? Any ideas why .zip.gz is so much bigger than .tgz? Richard ps. no, system() or popen() is not an alternative :) From marklists at mceahern.com Thu Dec 20 11:10:08 2001 From: marklists at mceahern.com (Mark McEahern) Date: Thu, 20 Dec 2001 08:10:08 -0800 Subject: what is the equivalent of LAST_INSERT_ID() in mx.ODBC ? In-Reply-To: <3c22072d$0$35602$edfadb0f@dspool01.news.tele.dk> Message-ID: Here's a discussion I found on Google: http://groups.google.com/groups?hl=en&threadm=1994Dec6.231307.25817%40medicu s.com&rnum=4&prev=/groups%3Fq%3Dlast%2Bgenerated%2Bid%2Bmicrosoft%2Baccess%2 6hl%3Den%26rnum%3D4%26selm%3D1994Dec6.231307.25817%2540medicus.com (wrapping) And a suggestion: Use guids. // m From hgg9140 at seanet.com Sat Dec 29 20:13:45 2001 From: hgg9140 at seanet.com (Harry George) Date: 29 Dec 2001 17:13:45 -0800 Subject: UML/XMI et al References: Message-ID: Martin von Loewis writes: > Harry George writes: > > > I'm working with several CASE tools, some of which have XMI > > interfaces. I want to drive code in and out of them (and generate SQL > > code for several DBMS's) using python. Anyone working in this area? > > Yes, I've been looking into XMI at one time. People also use XSLT to > process XMI. > > > I have already done a generator for UML/XMI DTD --> python classes, and > > MySQL and PostgreSQL SQL code generators. > > Sounds interesting. Are you going to publish that code? Does that use > a custom mapping, or a general one? > I've just put the "pycase" package on: http://www.seanet.com/~hgg9140/comp/index.html This is more like working notes than a finished product. Only the postgres binding is in this bundle. The mappings are generic in the sense that a) the UML/XMI can be regenerated whenever the DTD changes b) pg2py determines the DBMS's table definitons by itself. > Regards, > Martin > -- Harry George hgg9140 at seanet.com From bcocint at 263.net Fri Dec 7 00:49:45 2001 From: bcocint at 263.net (Marketing Dept.) Date: Fri, 7 Dec 2001 13:49:45 +0800 Subject: March into China Message-ID: An HTML attachment was scrubbed... URL: From bup.schaefer at freenet.de Tue Dec 11 23:57:52 2001 From: bup.schaefer at freenet.de (bup_schaefer) Date: Wed, 12 Dec 2001 04:57:52 -0000 Subject: Tkinter - Clipboard Message-ID: <9v6o4g+8p1p@eGroups.com> Hello, with clipboard_append I can copy the text content of a widget in the clipboard. But how is it possible to copy (by the program,not with ctrl-V)the content of the clipboard to a widget? Many Thanks for your answer, Bruno Sch?fer From Mitch.Chapman at bioreason.com Fri Dec 14 11:28:16 2001 From: Mitch.Chapman at bioreason.com (Mitch Chapman) Date: Fri, 14 Dec 2001 09:28:16 -0700 Subject: Model View Presenter GUI pattern? References: <20011213172833.0bfac3c7.gry@ll.mit.edu> Message-ID: <3C1A28A0.F87B6514@bioreason.com> george young wrote: > > Is anyone using the Model View Presenter GUI framework/pattern in python? Yep: http://www.linuxjournal.com/article.php?sid=4702 See the discussion of GladeBase. -- Mitch Mitch.Chapman at bioreason.com From donod at home.com Tue Dec 4 05:12:52 2001 From: donod at home.com (Don O'Donnell) Date: Tue, 04 Dec 2001 10:12:52 GMT Subject: Tuples -> Function Params? References: Message-ID: <3C0CA191.A9293E69@home.com> Philip Swartzleonard wrote: > > Just a quick question, right now i'm doing this: > > self.color = afloat,bfloat,cfloat > . > . (change functions) > . > a,b,c = self.color > glColor3f(a,b,c) > > [actual function dosen't mater except that it isn't something i can > just change] > > Ok, the question is, is there a way to do this where i don't unpack > the tuple and pass sepearte arugments? This would be most convienent. > Function(tuple) doesn't work... and i couldn't seem to find any other info > in the docs... > > -- > Philip Sw "Starweaver" [rasx] :: Philip: What you want is: glColor3f(*self.color) As a matter if interest, you can also pass a dictionary as: func(**dict) i.e.: >>> def triple(a,b,c): ... print "%s : %s : %s" % (a,b,c) ... >>> t = (12, 15, 18) >>> triple(1,2,3) 1 : 2 : 3 >>> triple(*t) 12 : 15 : 18 >>> dic = {'a':'x','b':'y','c':'z'} >>> triple(**dic) x : y : z I can't find it in the docs now either. But I know it's a fairly recent addition. 2.1 perhaps? Cheers, Don From gmcm at hypernet.com Sun Dec 2 09:37:50 2001 From: gmcm at hypernet.com (Gordon McMillan) Date: 02 Dec 2001 14:37:50 GMT Subject: preserving namespaces with sub-packages References: <8FaO7.331$S82.263817@news.uswest.net> Message-ID: Kevin Altis wrote: > framework.widgie.Button [that is, Button is a class in module widgie] [refactors] > framework directory > __init__.py > various module files for the framework > widgie directory > __init__.py > basewidgie.py > button.py [and then] > framework.widgie.button.Button [but wants that referenced as framework.widgie.Button] You have to hack widgie/__init__.py so that Button (and siblings) are top-level attributes. Just be aware that when the programmer has a problem with Button and goes looking for the code, it's not going to be where he expects to find it. > In addition, it would be nice have __init__.py automatically load all > the files in the widgie directory rather than having to hard-code each > filename. Hopefully I'm explaining the problem correctly. Any > suggestions or solutions? No you don't. You don't want button automatically loaded - you want it to disappear! Even without that namespace hackery, doing an "automatic load" of submodules is a generally a poor idea - it makes for a very expensive import. Perhaps the programmer only wanted one submodule, yet he pays for all of them. -- Gordon http://www.mcmillan-inc.com/ From stuart at bmsi.com Wed Dec 5 22:28:01 2001 From: stuart at bmsi.com (Stuart D. Gathman) Date: Wed, 05 Dec 2001 22:28:01 -0500 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: <9umok1$btd$1@nntp1-cm.news.eni.net> On Tue, 04 Dec 2001 19:58:25 -0500, Tim Peters wrote: > [Erik de Castro Lopo] >> Please explian to us rational people why that is nasty. > > I've lost track, but I'm pretty sure it was either because the example > used tabs, or because it used spaces. Alexis Layton posted a really good idea in another thread. Instead of just looking at the indent level, compare indent strings. Indent strings are compared considering TAB as greater than SPACE. This is easily visualized by converting SPACE to 'S' and TAB to 'T'. So leading indentation might be (in increasing indent level): SSSS T TSSSS TT Provided that all tabs precede all spaces in the leading indentation, and that the tab expansion value is sufficiently large (>= 4 in the above example), any editor will display the indentation in a visually consistent manner. It would be reasonable for python to allow mixed tabs + spaces, but require a strict structuring like the above (which is what the "optimize whitespace" option outputs on any editor I've seen, including vi/m). -- Stuart D. Gathman Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154 "Confutatis maledictis, flamis acribus addictis" - background song for a Microsoft sponsored "Where do you want to go from here?" commercial. From urner at alumni.princeton.edu Wed Dec 5 12:15:09 2001 From: urner at alumni.princeton.edu (Kirby Urner) Date: Wed, 05 Dec 2001 09:15:09 -0800 Subject: Large Yahoo ads plonk in middle of posts! Message-ID: I doesn't seem to have spread to mirror of comp.lang.python , archived at Yahoo, but another Yahoo group to which I subscribe now features very large rectangular (not banner) ads right in the text of the post. Not around the edges. Right there in the *body* of the post. So if someone is being quoted, it all gets shoved over to the right to change the formatting of the text. Paradoxically, you have to ask for the source view to get the original formatting. The "formatted view" is the one in which formatting has been destroyed by the injection of alien material. If you want to see what I mean, check: http://groups.yahoo.com/group/synergeo/message/4256 for an example. Is the Python mirror going to have this "feature" soon? I realize the Terms of Service allow Yahoo to show ads, but that this means tolerating large ads in the middle of our own posts pushes the envelope to a new low standard. It's big news in my opinion. It merits mention on Slash-dot. Kirby From ungrzr2 at ubatxbat.pbz Sat Dec 15 04:40:59 2001 From: ungrzr2 at ubatxbat.pbz ({-- Rot13 - Hateme) Date: 15 Dec 2001 09:40:59 GMT Subject: Wrap C function which takes variable lengthed parameters? References: <6p5j1u0oag2ofkam8o7fig5dvkfc2392hk@4ax.com> <3C19990E.BE0F3FA@alcyone.com> <3C19AC0B.7ABD04DF@xs4all.nl> <1gbj1u8pm1t63ao6bjq98jlh66glf78fnu@4ax.com> Message-ID: Courageous wrote in news:skil1usi80143j6khl2ba6c08pm9tv8i40 at 4ax.com: > >>And I really hope python will provide some way to ease >>the wrapping on varargs functions some day. But it is >>hard. > > It's a C problem, not a Python problem. Since Python itself > is coded in C, there will never be any easy, portable solution > to what you describe. Obviously this could be handled by > writing machine-specific inline assembly, however I'm not > convinced the value gained is worth the downside. > This is a C problem but this is also a Python problem. There are no need to wrap a C function for C program. But if you want to use a C function in Python program, you have to wrap the C function. If the function cannot be wrapped, the python program cannot use the C function. In some situation, if a programmer cannot wrap some C functions for Python, he will be forced to give up using Python in his project. It is a problem caused by limitation of C language, though. From aahz at panix.com Sat Dec 29 11:26:25 2001 From: aahz at panix.com (Aahz Maruch) Date: 29 Dec 2001 08:26:25 -0800 Subject: REPOST: Re: whrandom (was Re: Python 1.5.x vs Python 2.x.x) References: <3C180FF7.DEAEA6C6@radical.ca> <7xheqkr05q.fsf@ruckus.brouhaha.com> Message-ID: <4$--$$_----___%$%$@news.noc.cabal.int> In article , Aahz Maruch wrote: >In article , >James T. Dennis wrote: >> >> While that topic has come up: I find whrandom to be an unsightly >> name for accessing a set of functions which is so commonly accessed >> by novice students. What was wrong with must calling it rand or >> random? Is it pure pedantry? > >You're not supposed to use whrandom, although unfortunately the docs >have been less clear about this historically than they should have been. >The specific functionality of random is located in whrandom, to provide >an abstraction layer in case some better pseudo-random algorithm comes >along. Uh, never mind, that's only half-right. You never were supposed to use whrandom, but the functionality has now been moved to random and the whrandom module is deprecated. -- --- Aahz <*> (Copyright 2001 by aahz at pobox.com) Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista Tenth Virtual Anniversary: 2 days and counting ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: aahz at panix.com (Aahz Maruch) Newsgroups: comp.lang.python Subject: cmsg cancel Control: cancel Date: Mon, 31 Dec 2001 03:47:36 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774703 27193 211.57.49.2 (31 Dec 2001 04:58:23 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:58:23 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From jgardn at alumni.washington.edu Tue Dec 11 08:28:29 2001 From: jgardn at alumni.washington.edu (Jonathan Gardner) Date: Tue, 11 Dec 2001 22:28:29 +0900 Subject: Client/server chat program In-Reply-To: <7x667e9xnu.fsf@ruckus.brouhaha.com> References: <7x667e9xnu.fsf@ruckus.brouhaha.com> Message-ID: <200112111332.fBBDWkJ21410@my.knctv.co.kr> On Tuesday 11 December 2001 01:40 pm, Paul Rubin wrote: > You can do it either way. The Unix telnet client uses separate > processes, if I remember correctly. Yes, if you use threads, you do > have to synchronize some of their operations, but the threading > package provides ample mechanisms for that. I don't know about the other unix telnet clients, but the GNU telnet client uses non-blocking select statements. Jonathan From core.lists.python at core-sdi.com Thu Dec 13 17:52:17 2001 From: core.lists.python at core-sdi.com (Ricardo Quesada) Date: Thu, 13 Dec 2001 19:52:17 -0300 Subject: tkinter with multithreads Message-ID: <3C193121.6070106@corest.com> Hi, I'm running python 2.0.1 with windows 2000, and i'm using multiple interpreters to run different python modules (like in mod-python), and everything works ok, except when I try to excecute two Tk modules simultaneously. It seems that they enter in deadlock. One tk modules locks in: file: _tkinter.c function: TkApp_MainLoop() PyThread_acquire_lock(tcl_lock, 1); <---- Here (line 1683 ) And the other Tk modules locks in the tcl library (tck 8.3.4) file: tclTimer.c function: TclServiceIdle.c (*idlePtr->proc)(idlePtr->clientData); <---- Here (line 692) The tk module I'm running is very simple: def say_hi(): print 'hi loco!' def run(): import sys from Tkinter import * root = Tk() Button(root, text='button', command=say_hi).pack() root.mainloop() Any ideas ? thanks, riq. -- ===============[ CORE Security Technologies ]=============== Ricardo Quesada Software Developer ricardo.quesada at corest.com Florida 141 - 2? cuerpo - 7? piso | (C1005AAC) Buenos Aires | Argentina Tel/Fax: (54 11) 4878-CORE (2673) | http://www.corest.com ==================================================== --- for a personal reply use: Ricardo Quesada From daves_spam_dodging_account at yahoo.com Mon Dec 3 12:47:43 2001 From: daves_spam_dodging_account at yahoo.com (David Brady) Date: Mon, 3 Dec 2001 09:47:43 -0800 (PST) Subject: Finding strings with exceptions Message-ID: <20011203174743.19199.qmail@web21109.mail.yahoo.com> Hello, I'm trying to grep through a project, and I've come across this problem many times in the past. Previously, doing this problem in perl, I've just given up because my perl regex skill is "merely competent" and not wizardly. Today I ran into the same problem, and since Python has amazed me countless times already, I figured that it might be possible. What I want to do is find all instances of an expression EXCEPT those that also match another expression. The case in point for today was this: I was called away from my machine in the middle of refactoring some code. I was renaming a class to conform to our project's coding standards, and the new name requires a prefix. The old class name (changed to protect the innocent) is BarThingy. The new name is fooBarThingy. Because the new class name contains the old one, simple find-and-replace goes wonky. In the reverse case, I could put something in the regex that says, "also find an optional prefix 'foo'." But what I really want to do is find the class everywhere EXCEPT where that 'foo' prefix exists. Anyone know a good way to do this? Note that one cannot simply grep all the lines that contain BarThingy and then remove lines that contain fooBarThingy, because a single line might contain both. Hmm, in writing this, I wonder if I could look for foo as an optional group, and call a function that causes the regex to fail if the group is present... hmmmm.... Thanks, -dB ===== David Brady daves_spam_dodging_account at yahoo.com I'm feeling very surreal today... or *AM* I? __________________________________________________ Do You Yahoo!? Buy the perfect holiday gifts at Yahoo! Shopping. http://shopping.yahoo.com From logiplexsoftware at earthlink.net Fri Dec 21 13:27:48 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Fri, 21 Dec 2001 10:27:48 -0800 Subject: Python on the desktop In-Reply-To: References: <94e3fce8.0112210053.2568529d@posting.google.com> Message-ID: <20011221102748.4ec4159f.logiplexsoftware@earthlink.net> On Fri, 21 Dec 2001 17:08:13 GMT Tim Hammerquist wrote: > I can't speak for our BDFL, but I don't think Python was designed for > a hostile take-over of world computer systems. > Likely story, coming from someone with such close ties to the PSU, I bet th -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From wall at adinet.com.uy Mon Dec 17 21:35:17 2001 From: wall at adinet.com.uy (Walter Moreira) Date: Mon, 17 Dec 2001 23:35:17 -0300 Subject: Python CPAN beta test In-Reply-To: ; from ssthapa@classes.cs.uchicago.edu on Tue, Dec 18, 2001 at 12:09:34AM +0000 References: Message-ID: <20011217233517.B25422@casa.parque> On Tue, Dec 18, 2001 at 12:09:34AM +0000, Suchandra Thapa wrote: > Walter Moreira wrote: > >Traceback (most recent call last): > > File "./ciphon.py", line 118, in ? > > if config.getConfig().getParameter('autoupdate') == 'true': > > File "./config.py", line 266, in getConfig > > config = Configuration() > > File "./config.py", line 85, in __init__ > > serverParser) > > File "/usr/local/lib/python2.1/xml/sax/__init__.py", line 30, in parse > > parser = make_parser() > > File "/usr/local/lib/python2.1/xml/sax/__init__.py", line 88, in make_parser > > raise SAXReaderNotAvailable("No parsers found", None) > >xml.sax._exceptions.SAXReaderNotAvailable: No parsers found > > > >The same exceptions is raised if I call make_parser() from the interpreter. Is > >there something missing in my installation? > > > > Do you have expat installed? I looked into Modules/Setup and I found that expat is commented. Thanks. Perhaps this kind of dependence should be more clearly stated, in order to convince more people to try ciphon. Thanks again. -- -------------- Walter Moreira <> Centro de Matematica <> Universidad de la Republica email: walterm at cmat.edu.uy <> Home Page: http://www.cmat.edu.uy/~walterm From jkraska at san.rr.com Sun Dec 2 22:38:29 2001 From: jkraska at san.rr.com (Courageous) Date: Mon, 03 Dec 2001 03:38:29 GMT Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: Message-ID: >let's see, I like 4 spaces, he like 8 and she likes 6 and so on. That I'm sure glad you like 4, because if you were working on my team, that's exactly the way one indents python. And well, if you don't like the coding standard, I suppose you can always find another project, eh? :) C// From buzzard at urubu.freeserve.co.uk Tue Dec 4 05:34:31 2001 From: buzzard at urubu.freeserve.co.uk (Duncan Smith) Date: Tue, 4 Dec 2001 10:34:31 -0000 Subject: minidom References: <9uhr26$nfs$1@newsg1.svr.pol.co.uk> <3C0C7DD5.AC50A8CB@engcorp.com> Message-ID: <9ui8sv$7kf$1@newsg4.svr.pol.co.uk> "Peter Hansen" wrote in message news:3C0C7DD5.AC50A8CB at engcorp.com... > Duncan Smith wrote: > > > > This may be a stupid question, but I'm struggling. I can retreive > > information from an XML file (using minidom) as long as it is a node > > attribute. But I cannot figure out how to get data otherwise. eg. > > > > > > > > EngineStart Leak > > > > good > > > > bad > > > > XPOS etc. no problem. But how (using minidom) do I retreive 'Engine Start > > Leak' and 'good' etc? Anyone know of any good documentation / worked > > examples for minidom? Thanks in advance. > > For one, you should probably start your XML document with > or it won't be valid XML (but that's > not necessary for this case.) You also need to close > the tag at the end with or you'll get a > parse error (SAXParseException). Having done that: > Yes. It was just a snippet pasted from an existing XML document. I should have tidied it up. > >>> from xml.dom import minidom > >>> doc = minidom.parseString(open('test.xml').read()) > >>> doc.getElementsByTagName('DESCRIPTION')[0].childNodes[0].nodeValue > u'EngineStart Leak' > OK. I'll give that a go. I was using 'doc = xml.dom.minidom.parse(f)' and getting 'None' returned from 'nodeValue'. Cheers. Duncan > That should give you a start. Use the interactive prompt > and use dir() a lot. For example: > > >>> dir(doc) > ['childNodes', 'doctype', 'implementation', 'ownerDocument', 'parentNode'] > >>> dir(doc.childNodes[0]) > ['_attrs', '_attrsNS', 'childNodes', 'localName', 'namespaceURI', 'nextSibling', > 'nodeName', 'nodeValue', 'ownerDocument', 'parentNode', 'prefix', > 'previousSibling', 'tagName'] > > The API is effectively the DOM standard, so you shouldn't have > much trouble if you have a reference to that handy. > > -- > ---------------------- > Peter Hansen, P.Eng. > peter at engcorp.com From jason at tishler.net Fri Dec 7 08:58:07 2001 From: jason at tishler.net (Jason Tishler) Date: Fri, 7 Dec 2001 08:58:07 -0500 Subject: dll_list::load_after_fork() blues (was Re: [ python-Bugs-489709 ] Building Fails ...) In-Reply-To: <20011206124426.B1448@dothill.com> Message-ID: <20011207085807.A1152@dothill.com> The ASSume principle applies once again... On Thu, Dec 06, 2001 at 12:44:26PM -0500, Jason Tishler wrote: > I have just reproduced this build problem with Python 2.2b2 too. However, > I don't believe that it is related to the particular Python version one > attempts to build. Actually, setup.py has been enhanced to check the validity of each module by importing it during the build problem. Hence, the probability of a DLL address clash during fork has increased significantly. The attached patch workarounds this problem. I intend to submit this patch (redone against CVS) to the Python patch collector ASAP so that Python 2.2 does not go out the door on 12/19 busted for Cygwin. If you have any objections or better solutions, please speak up sooner rather than later. Note that I still intend to fix the Cygwin Python fork problem, if possible. Hopefully, this workaround will be only temporary. Jason -------------- next part -------------- --- setup.py.orig Fri Dec 7 08:21:56 2001 +++ setup.py Fri Dec 7 08:31:21 2001 @@ -159,6 +159,11 @@ if 'Carbon' in ext.extra_link_args: self.announce('WARNING: skipping import check for Carbon-based "%s"' % ext.name) return + # Workaround for Cygwin: Cygwin currently has fork issues when many + # modules have been imported + if self.get_platform() == 'cygwin': + self.announce('WARNING: skipping import check for Cygwin-based "%s"' % ext.name) + return try: __import__(ext.name) except ImportError: From jgass at dclab.com Tue Dec 4 13:31:00 2001 From: jgass at dclab.com (JG) Date: 4 Dec 2001 10:31:00 -0800 Subject: Environment variables in Windows 2000 References: <9tcobh$qql@news.or.intel.com> <3BFFF06A.F7A3C69@tundraware.com> <3c029b06.260094476@news.laplaza.org> Message-ID: It was possible to modify the parent's environment up until Win 98" using the STRINGS utility. "strings" was able to trace a pointer to it's PSP [program segment prefix block] locate it's parent then trace the parent's PSP back to the original master environment block and then appended the new user environment variable and value to the end of the environment strings. I use strings extensively to set new environment variables. It doesn't work properly in Windows 2k though - sometimes I get an "out of memory" error, but it will never set a user variable. It is available as freeware STRINGS 2.2 Copyright 1991, 1992, 1993 Douglas Boling First published in PC Magazine, December 29, 1992 If anyone out there has any other ideas please let me know. Joseph Gass From chrisperkins99 at rogers.com Thu Dec 20 18:37:14 2001 From: chrisperkins99 at rogers.com (Chris Perkins) Date: Thu, 20 Dec 2001 23:37:14 GMT Subject: Huge Dicts and perfomance References: Message-ID: Please! This sort of filth is not welcome in this group. Find somewhere else to... Oh, wait - that's a "t". Sorry. Never mind. ;-) From kwg at renre-europe.com Thu Dec 13 07:39:56 2001 From: kwg at renre-europe.com (Ken Guest) Date: 13 Dec 2001 12:39:56 +0000 Subject: query regarding NULL result without error in COM code Message-ID: <1008247206.4107.7.camel@lewis> hi, I've run into a "NULL result without error in call_object" system error after using the DefaultDebugDispatcher in the COM code that I'm writing. (This error wasn't being raised before hand, when I didn't specify which dispatcher was to be used. The reason why I'm now using the DefaultDebugDispatcher is that there's an error happening later on in my code that I have to get to the bottom of). The error happens when I try to create a 'COMObjectServer' in some VB code: Set svr = _ VBA.CreateObject("renre.gps_layerstats.Objects.COMObjectServer") Now the python code that I have for this is as follows. (The sample code in the docstring works fine if I don't use that DefaultDebugDispatcher) I've checked through chapter 12 of the "Programming Python on Win32" and through Google and can't find anything that suggests a solution. I'd really appreciate it if someone could please help shed some light on this. thanks k. class COMObjectServer: """ Used for serving out objects via COM. Tested and found to be working with the following code: Private Sub Document_Open() Dim svr As Object Dim obj As Object Set svr = VBA.CreateObject("renre.gps_layerstats.Objects.COMObjectServer") Stop End Sub set obj = svr.object("renre.gps_layerstats.Objects.LatestRunObject") f = obj.num_tabs_required() print f 4 """ _reg_clsid_ = "{AB07AB91-01EE-4FDD-A2D2-3A46E3488AE5}" _reg_desc_ = "renre.gps_layerstats.Objects.COMObjectServer" _reg_progid_ = "renre.gps_layerstats.Objects.COMObjectServer" _reg_class_spec_= "renre.gps_layerstats.Objects.COMObjectServer" _public_methods_ = ["object"] def object(self, class_name): from win32com.server.util import wrap from win32com.server.dispatcher import DefaultDebugDispatcher obj = dynamic_load2(class_name) comobj = wrap(obj, useDispatcher = DefaultDebugDispatcher) return comobj -- The duck quacks. From kragen at pobox.com Sat Dec 1 04:28:23 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 01 Dec 2001 04:28:23 -0500 Subject: Python evangelists unite! References: Message-ID: <83pu5zthl4.fsf@panacea.canonical.org> brucehapman at hotmail.com (brucehapman at hotmail.com) writes: > FRIEND: Besides, that's awful Object Orientation. If I start adding > attributes to an instance of a class, it ceases to be an instance of > that class. If I create a bunch of instances of the same class, they > should be the same; they should have the same members. Your friend obviously greatly overestimates their knowledge of object-orientation (as evidenced by their saying it with Initial Capitals). One of the standard OO dogmas is that if FireTruck is a subclass of Vehicle, then FireTruck instances are (in addition to being FireTruck instances) Vehicle instances. Another standard OO dogma is that subclasses, at least, can define new attributes. If your friend accepts these two dogmas, then he must think that subclassing is "awful Object Orientation", too. > FRIEND: That's pretty cool, but it's not a reason, in and of itself, > to make a language so dynamic. There must be some advantage to being > able to add attributes during runtime. What are they? > ME: Uh... I don't generally add attributes after __init__, myself. I like to be able to summarize what I expect of an object in phrases like "foo is a valid FireTruck object", rather than "foo is a FireTruck object that has had the addStuff method called at some point in the past", because that latter phrase is harder to ensure the truth of. And I don't like using hasattr() and getattr() and __dict__ except when I'm extending the language, doing things that can't be done without them. > FRIEND: And another thing! What's with encapsulation? There's no > private!?!?!? Some languages have encapsulation, and others don't. It doesn't have much to do with whether or not they're object-oriented. From db3l at fitlinxx.com Mon Dec 3 17:04:05 2001 From: db3l at fitlinxx.com (David Bolen) Date: 03 Dec 2001 17:04:05 -0500 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) References: <3C0BE492.5DACEA18@mega-nerd.com> Message-ID: Erik de Castro Lopo writes: > You really ought to try using nothing but tabs for indentation and > setting the tab width in your editor to whatever you prefer. > > This is so easy and works **SO** well. Always curious about this in an "all tab" world - how do you align continuation lines that aren't on a tab stop? -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l at fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/ From mkelly2002NOSPAM at earthlink.net Tue Dec 4 19:16:39 2001 From: mkelly2002NOSPAM at earthlink.net (Michael Kelly) Date: Wed, 05 Dec 2001 00:16:39 GMT Subject: COM "out" Variant Array params and such References: <3C0AC811.4000406@ActiveState.com> <3C0BFFA9.8030707@ActiveState.com> Message-ID: <7hpq0ucde99poapal6jp7geagrn76vg7qs@4ax.com> On Mon, 03 Dec 2001 22:39:29 GMT, Mark Hammond wrote: > >It should work the same way from Python whether retval or out. If you >have *both* a retval and an out param, then you specify both: > >rc, VariantArrayOfStrings = MyIniFile.ReadSections("Section name") Ok. Tried a quick and dirty COM thingy and it worked. I got it now. The multiple assignment thing is still a bit new to me so I wouldn't have thought to look for that syntax. >The latest ActivePython and win32all are identical. The next version of >either/both should have this fix. > Cool. Thanks again. Mike -- "I don't want to belong to any club that would have me as a member." -- Groucho Marx From nika at kassube.de Sun Dec 30 08:36:28 2001 From: nika at kassube.de (Nils Kassube) Date: 30 Dec 2001 14:36:28 +0100 Subject: REPOST: Re: Who needs exceptions (was Re: Two languages, too similar, competing in the same space.) References: <3C2A9D33.67FEC261@earthlink.net> <3C2BA7B8.35286DE3@earthlink.net> <3c2de385.9780406@news.t-online.de> <3c2deb81.11823921@news.t-online.de> <871yhd7red.fsf@kursk.kassube.de> Message-ID: <9$--$$_----__%$__$@news.noc.cabal.int> Cliff Wells writes: > My PC will need to be a _lot_ faster before it can run an OS written in > Python... maybe you should retarget that statement at programmers who I never claimed that an OS should be written in Python. There are several good all purpose languages who are better for this task, e.g. Lisp and Ada. > develop run-of-the-mill applications in C. Like any other language, C has > places where it shines and places where it isn't really appropriate. Yes, it really shines for security and stability problems. Heck, even bit-fiddling is better done using Ada. BTW: int add_two_numbers(int a, int b){ return a+b; } What's the meaning (semantics) of add_two_numbers(23575,23575)? Cheers, Nils -- "Q: What is the difference between C++ programmers and Ada programmers? A: Ada programmers write code that blows up *on*purpose*." (Marin David Condic) ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!enews.sgi.com!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Nils Kassube Newsgroups: comp.lang.python Subject: cmsg cancel <87ellcrfs3.fsf at kursk.kassube.de> Control: cancel <87ellcrfs3.fsf at kursk.kassube.de> Date: Mon, 31 Dec 2001 02:12:57 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774241 27193 211.57.49.2 (31 Dec 2001 04:50:41 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 04:50:41 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From bill_mckinnon at interloper.net Wed Dec 5 14:48:23 2001 From: bill_mckinnon at interloper.net (Bill McKinnon) Date: 5 Dec 2001 11:48:23 -0800 Subject: try: and while/continue don't mix? Bizarre behavior with function calls. References: <6ac595a2.0112041944.75dab62b@posting.google.com> <9uk71v$t02$1@peabody.colorado.edu> Message-ID: <6ac595a2.0112051148.7c4fba3a@posting.google.com> Fernando P?rez wrote in message news:<9uk71v$t02$1 at peabody.colorado.edu>... > it's a known bug, fixed for 2.2. > > there's a reference to it in sourceforge, if you really want to know > (don't have it at hand, sorry). > > morale is: for now, don't use continue in try. > > f. Ok, good to know. Thanks for the response...sounds like I'll upgrade to 2.2 at some point. :) - Bill From loewis at informatik.hu-berlin.de Sun Dec 2 13:48:33 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 02 Dec 2001 19:48:33 +0100 Subject: Are there any PEPs for typed arguments? References: <9udsh4$3pf$1@rex.ip-plus.net> Message-ID: "F. GEIGER" writes: > Will such ideas make it into Python? And if yes, when? Please have a look at PEP 245, which is a specific proposal. > Or am I the only one who does those asserts over and over again? No, there is an entire SIG devoted to this subject, http://www.python.org/sigs/types-sig/ Regards, Martin From maxm at mxm.dk Tue Dec 18 18:35:26 2001 From: maxm at mxm.dk (maxm) Date: Wed, 19 Dec 2001 00:35:26 +0100 Subject: How about adding a sort parameter to dict methods? Message-ID: I have just spend some time writing code to make a dictionary produce sorted output when using the keys, values, and items methods. My guess is that a LOT of people has done this before me. So I just wondered if it wouldn't be a good idea to add a 'sort' parameter to the method to specify if it should be sorted or not. Well .. this code shows what I mean:: from UserDict import UserDict class OrderedDict(UserDict): def __init__(self, dict=None): UserDict.__init__(self, dict) def keys(self, sort=0): keys=self.data.keys() if sort: keys.sort() return keys def values(self, sort=0): values=self.data.values() if sort: values.sort() return values def items(self, sort=None): if sort=='keys': return [(key, self.data[key]) for key in self.keys(sort=1)] elif sort=='values': values = [(self.data[key], (key, self.data[key])) for key in self.data.keys()] values.sort() return [item[1] for item in values] else: return self.data.items() Wouldn't that be nice to have as a standard in the language? I think so. Instead of writing:: keys = theDict.keys(): keys.sort() for key in keys(): value = theDict[key] print key, value it would be possible to just write:: for key, val in theDict.items(sort='keys') print key, val The problem off course is all the people having rolled their own version if dicts with parameters in the keys(), values(), items() methods. Alternatively it could be possible to pass a sort-function as a parameter, then it would be really flexible, but a bit more comlicated. regards Max M From s.thuriez at quantaflow.com Tue Dec 4 12:59:22 2001 From: s.thuriez at quantaflow.com (sebastien) Date: 4 Dec 2001 09:59:22 -0800 Subject: reading character in word Message-ID: <69e00d8d.0112040959.1e3f7541@posting.google.com> Hi, Maybe have you encountered my problem : I do not manage to read accentuated characters such as ??? ... from a microsoft word application using win32com.client. Here is the programm that I used : from win32com.client import constants, Dispatch word= Dispatch('Word.Application') mondoc=word.Documents.Open(r"c:\test.doc") nombre_caracteres=mondoc.Characters.Count for numero_caractere in range (1,int(nombre_caracteres)+1): caractere=mondoc.Characters.Item(numero_caractere) try: print caractere except: print("cannot read character") pass Everything is fine as soon as I do not use characters with coma accent such as ? ? ? in the document... I also tried on my PC to do : test_input=raw_input("entrer phrase avec accents : ") print str(test_input) for char in test_input: print char,ord(char) after enterring word using the ???..there is no problem printing the correct letters (for exemple ?t?). There maybe some option in Word that I should set ?? I hope that someone will have some leads ... Sebastien. From buzzard at urubu.freeserve.co.uk Mon Dec 10 11:06:56 2001 From: buzzard at urubu.freeserve.co.uk (Duncan Smith) Date: Mon, 10 Dec 2001 16:06:56 -0000 Subject: A pretty dumb newbie question References: <20011203212412.12737.00000727@mb-cs.aol.com> <20011210091906.16346.00001379@mb-ma.aol.com> <9v2m4c$bdl$1@newsg3.svr.pol.co.uk> Message-ID: <9v2mil$6fc$1@newsg1.svr.pol.co.uk> Of course x was 8. >>> x=8 >>> x**1/2 4 >>> x**(1/2) 1 >>> x**(1/2.0) 2.8284271247461903 >>> From syver-en+usenet at online.no Sun Dec 2 08:53:54 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 02 Dec 2001 14:53:54 +0100 Subject: Any 'CallDll' and 'npstruct' examples around? References: <92gj0u4f12q0e1qqent07paht5auo5us10@4ax.com> Message-ID: Michael Kelly writes: > I installed calldll and npstruct and was wondering if anyone knew > some links to examples making Win32 Api calls on the net?? > From just looking at the modules I can't quite figure how to > set up to make calls that use structs, esp. nested ones. > If any of the source accompanied an article that would be > especially cool. Me too :-) You have dynwin too of course? There's some good examples for using the windll module in the demo directory, but they don't really explain the struct things, (at least not so I understand it :-). If you find any examples mail me. -- Vennlig hilsen Syver Enstad From danielk at aracnet.com Wed Dec 26 12:45:22 2001 From: danielk at aracnet.com (Daniel Klein) Date: Wed, 26 Dec 2001 09:45:22 -0800 Subject: Where to post Jython questions? Message-ID: Is the the proper place to post questions/conversations for Jython? If not, please advise. Thanks, Daniel Klein From dmallwitz at cox.rr.com Fri Dec 28 22:14:14 2001 From: dmallwitz at cox.rr.com (David Mallwitz) Date: Fri, 28 Dec 2001 22:14:14 -0500 Subject: REPOST: Re: ETA for Win32all under Python 2.2? References: Message-ID: <2$--$$_----_-%_-%$@news.noc.cabal.int> David, Figuring out how to build Win32all from source sounded like an interesting challenge for the long holiday, so I hit Activestate and found a link to the build instructions: http://starship.python.net/crew/mhammond/win32/BuildingExtensions.html . Unfortunately, I'm stuck with VC++ 5.0 and apparently there are serious problems with the header files unless you have VC++ 6.0. Maybe there's a way to compile correctly from GCC under Cygwin - doubtful, but I'll give it a shot. Anyway, all the info you were looking for is off the link above. Best of luck. Dave "David Brady" wrote in message news:mailman.1009584512.27950.python-list at python.org... > > -----Original Message----- > > From: Martin von Loewis > > > > David Brady > > writes: > > > > > P.S. There's a longstanding rule in my family: > > you're > > > not allowed to complain about anything you could > > fix > > > yourself. > > > Did you even try to build the package from source??? > > Did you see the part where I said "anything you could > fix yourself"? You have apparently overlooked my vast > capacity for ignorance. It's vast. It's vaster > than... well, it's really vast, okay? Vast. > > I would *LOVE* to know how to build the package, but I > haven't got a clue where to even begin. I've got a > Windows box, Visual C++ 6.0 and an internet > connection. Where do I go from here? > > Where do I get the package to build? > > How do I build the package? > > If your reply has anything to do with CVS, how the > heck do I get at it from Win32? (Lots of people have > told me they've heard of other people doing this, but > I'm starting to think it's an urban legend.) > > > (if it doesn't, please submit a bug report). > > *sigh* Vast, man, vast. How do I submit a bug > report? > > Thank you kindly for your patience, > > -dB > P.S. Please note, I may be ignorant, but I'm not > stupid. If there is a good place that explains how to > get and build Python and its packages, I'll happily > wade through the documentation. It's *finding* the > documentation that's killing me. > > ===== > David Brady > daves_spam_dodging_account at yahoo.com > I'm feeling very surreal today... or *AM* I? > > __________________________________________________ > Do You Yahoo!? > Send your FREE holiday greetings online! > http://greetings.yahoo.com > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! Check out our new Unlimited Server. No Download or Time Limits! -----== Over 80,000 Newsgroups - 19 Different Servers! ==----- ========= WAS CANCELLED BY =======: Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: "David Mallwitz" Newsgroups: comp.lang.python Subject: cmsg cancel <3c2d3360$1_4 at goliath.newsgroups.com> Control: cancel <3c2d3360$1_4 at goliath.newsgroups.com> Date: Mon, 31 Dec 2001 04:59:47 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009774899 27193 211.57.49.2 (31 Dec 2001 05:01:39 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:01:39 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From duncan at NOSPAMrcp.co.uk Wed Dec 19 06:13:46 2001 From: duncan at NOSPAMrcp.co.uk (Duncan Booth) Date: Wed, 19 Dec 2001 11:13:46 +0000 (UTC) Subject: Optimization of an RE substitution References: Message-ID: sh at hob.cx (Sean Holdsworth) wrote in news:slrna20tbt.2o4.sh at elf.hob.cx: > Then I remembered that I'm supposed to be handling 8 bit clean data... > I realise that even if I come up with a more efficient method of > doing this I'll still have to use a modified version of smtplib but > I'd be interested to hear people's suggestions and comments. Doesn't this have the effect you want: msg = string.replace(msg, '\r\n', '\n') msg = string.replace(msg, '\r', '\n') msg = string.replace(msg, '\n', '\r\n') -- Duncan Booth duncan at rcp.co.uk int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3" "\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure? From syver-en+usenet at online.no Sun Dec 9 13:28:16 2001 From: syver-en+usenet at online.no (Syver Enstad) Date: 09 Dec 2001 19:28:16 +0100 Subject: It's hard to find documentation References: <9uuith$qb8$1@peabody.colorado.edu> Message-ID: Brad Bollenbach writes: > (That isn't a Perl plug, but the name "pydoc" implies > that > > it wanted to be Python's equivalent of perldoc.) Personally I thought it wanted to be javadoc, because it extracts class hierarchies from source like javadoc does. -- Vennlig hilsen Syver Enstad From lac at strakt.com Tue Dec 11 03:10:30 2001 From: lac at strakt.com (Laura Creighton) Date: Tue, 11 Dec 2001 09:10:30 +0100 Subject: two questions - sockets / c functions In-Reply-To: Message from Oleg Broytmann of "." <20011211004209.A14348@phd.pp.ru> References: <3c14bc2c$1_2@news7.fast.net> <20011210165417.P18573@phd.pp.ru> <200112101947.fBAJllua032444@ratthing-b246.strakt.com> <20011211004209.A14348@phd.pp.ru> Message-ID: <200112110810.fBB8AUua001245@ratthing-b246.strakt.com> > On Mon, Dec 10, 2001 at 08:47:47PM +0100, Laura Creighton wrote: > > The only thing Oleg forgot to tell you was that sockets don't work on > > Windows > > Sockets don't work on Windows? It is nice to hear, but I do not beleive > it! What do you mean?! > > Oleg. > -- > Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru > Programmers don't die, they just GOSUB without RETURN. > > ----------- God I was tired last night. Why can I write code for 19 hours a day all weekend, and, poof no problem, while one 3 hour meeting with lawyers and accountants turns my brain into glue? I must thank Jacob Hall?n, the founder of the company who usually handles this sort of junk more. No wonder he is bitching about not getting to write enough code. And he is the author of the recipe I am promoting .... ----- Ok, as the effbot would write: reset my brain. Here is what I should have began saying. In Tk version 8.0, support for Win32 was suddenly withdrawn for createfilehandler. so you can't use self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.socket.bind('', wherever) At this point my brain is supposed to issue an interrupt and say 'look, idiot, did he say anything about Tkinter' and I am supposed to thank my brain for fulfilling one of its useful functions and keeping me from making an ass of myself in public. This is the part that didn't happen. Instead I get to thank Oleg Broytmann for keeping the damage I did with my stupidity small. And being so polite about it, too. Apologies everybody! Thank you Oleg. Laura From peter at engcorp.com Mon Dec 24 14:33:33 2001 From: peter at engcorp.com (Peter Hansen) Date: Mon, 24 Dec 2001 14:33:33 -0500 Subject: Looping constructs References: <3c25d37e_9@news.newsgroups.com> <3C2602B3.47EA5685@engcorp.com> Message-ID: <3C27830D.DE8E06FB@engcorp.com> beej at piratehaven.org wrote: > > In article <3C2602B3.47EA5685 at engcorp.com>, > Peter Hansen wrote: > >I, for one, find it much easier to start my loop > >with "while 1:" and then stick the logic where it needs > >to be with "if xxxx: break" > > Do you ever have a "while 0:" loop? Of course not. You'd be surprised. :-) I periodically have "if 0" and "while 0". But only when I'm disabling code during debugging... (yes, not to the point :) > So why is there even a conditional in there at all? I'm sorry I was too succinct. Of course I use the conditional case from time to time. Just not often. Rarely enough that I don't feel I need anything more complicated. Rarely enough that when a situation arises which could use some other kind of looping, with the test at the bottom of the loop and inverted, for example, I tend simply to revert to the "while 1" case and make things clean and clear. > Shouldn't Python just have a: > > foreverloop: # do-while, repeat-until > do_stuff() > if condition: break > > foreverloop: # while > if condition: break > do_stuff() > > No, because that's ugly. (Or maybe yes because it's minimalistic?) It already has that, and it's spelled "while 1". Yes, it's a little ugly. Yes, it's minimalist. Yes, there are glossier alternatives, and no, in my opinion we don't really need them. And since we already have "while 1" and we don't have "foreverloop" and there is no practical gain in adding it, we'll likely stick with what we have. > I'm one of those Python newcomers who thinks the set of looping > statements is a little too rarified. :) But whatever, I'll keep using > it. My own thoughts at first... Once you start to trust Guido's judgment in matters of language design, you may find (a) you rationalize some of the ugliness, and (b) you suddenly have more time for writing working, maintainable code and less time spent on discussions of language design. -- ---------------------- Peter Hansen, P.Eng. peter at engcorp.com From anthony.harel at c-s.fr Thu Dec 20 05:02:43 2001 From: anthony.harel at c-s.fr (anthony harel) Date: Thu, 20 Dec 2001 11:02:43 +0100 Subject: launching netscape from python Message-ID: <3C21B743.AB4DBAB6@c-s.fr> Hello, I wanted to know the best way to launch netscape (or internet explorer) from a python application. For the moment I'm using os.system with the command line in argument, but I'm sure it's not the best way to do it. This have to work under windows and UNIX. Thanks -- Anthony HAREL From jason at jorendorff.com Tue Dec 18 12:27:50 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Tue, 18 Dec 2001 11:27:50 -0600 Subject: os.stat() crashes on Win32 Message-ID: I just grabbed the latest out of CVS, built it using VC6, and tried to run python_d.exe. It bails out (a memory-management assertion fails) while running site.py. site.py calls os.path.isdir(), which calls os.stat(), which calls the C function posix_do_stat() in Modules/posixmodule.c (lines 677-725). In my case, it is being called with the argument "C:\\Program Files\\ActivePython22\\Pythonwin\\" (this, including the trailing backslash, is due to a registry setting). The result: char *path = NULL; char pathcopy[MAX_PATH]; ... /* populate 'path' using PyArg_ParseTuple(), line 690 */ ... path = pathcopy; // line 712 ... PyMem_Free(path); // line 723 It appears to be a bug in posixmodule.c. The bug is only enabled on MS_WIN32, thanks to some #ifdef's in the code. What's going on here? Why doesn't this cause crashes in the binary distribution of Python 2.2c1? Am I building it wrong? -- Jason Orendorff http://www.jorendorff.com/ From claird at starbase.neosoft.com Sun Dec 2 22:27:20 2001 From: claird at starbase.neosoft.com (Cameron Laird) Date: 2 Dec 2001 21:27:20 -0600 Subject: a long shot -> sending output to a browser question References: <28d73ad6.0112011316.25e17eb2@posting.google.com> <834rnasdnm.fsf@panacea.canonical.org> Message-ID: <39510D193FE46F2C.E86A8069386D11D6.8E418F956E3B5E03@lp.airnews.net> In article <834rnasdnm.fsf at panacea.canonical.org>, Kragen Sitaker wrote: >bigredlinux at yahoo.com (Dan Allen) writes: >> This may be far out, but something I have always wondered because I >> thought I once saw a page do this and couldn't figure out how. Is it >> possible to trick the browser into thinking the whole page has been >> sent and begin to display data on the page, and then send more. If >> you are wondering where I got this crazy idea, it was with the >> NuSphere installation, which seemed to load the page over a period of >> time. The reason I ask here, is because they wrote it in perl (and I >> didn't see any javascript on the page), and I figured it must have >> been something they were doing with output buffering or something and >> perhaps python had the same thing. > >Well, if you just want to display stuff at the bottom of the page, >just continuing to send it will work fine. (I wish Python had >autoflush, but it's not hard to emulate with a proxy, and you can >always just flush manually. You'll need to flush, though, and make >sure your web server and proxies aren't buffering either. (At least >Apache 1.3 won't; some servers will buffer CGI output unless it's from >an nph-script.) Then there's the browser; some browsers wait until >they've received a few kilobytes before they start rendering, and >others wait for a timeout or until they've received a few kilobytes. >Most browsers wait until they've received a whole block-level element, >such as a paragraph, before rendering anything, with the exception of >tables, which IE 4+ and Netscape 6+ handle more or less cell by cell.) > >If you want to display it in the middle of the page, places you've >already written stuff, you might need JavaScript. (Hmm, maybe you >could use CSS absolute positioning?) One trick for this is to send a >frameset rows="100%,*" that contains the page in a visible frame and a >never-ending stream of JavaScript in another frame. > >"pushlets" was one approach to this, and there are some proprietary >software products that do similar stuff. > >Hope this helps. Let me know what you end up implementing. > "Multipart" is another answer. Netscape browsers (but no others, ever?) arguably conformed to standards by interpreting "multipart" to mean (roughly) that the HTTP connection should be kept open, with more data to come. I've written a couple of articles on the subject. While I'm in a dispute with their publisher about their disposition, I'm happy to send correspondents drafts. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From dellaq2 at pdq.net Fri Dec 14 09:58:55 2001 From: dellaq2 at pdq.net (John Dell'Aquila) Date: 14 Dec 2001 06:58:55 -0800 Subject: re.compile bug? Message-ID: <16d79c8d.0112140658.6bd40400@posting.google.com> Compilation fails with VERBOSE flag but works otherwise. bash-2.05$ python ActivePython 2.1.1, build 212 (ActiveState) Python 2.1.1 (#20, Jul 26 2001, 11:38:51) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. >>> import re >>> comment = "([^#]*)(#.*)?$" >>> re.compile(comment) >>> re.compile(comment, re.VERBOSE) Traceback (most recent call last): File "", line 1, in ? File "d:\PYTHON21\lib\sre.py", line 90, in compile return _compile(pattern, flags) File "d:\PYTHON21\lib\sre.py", line 136, in _compile raise error, v # invalid expression sre_constants.error: unbalanced parenthesis >>> -- John Dell'Aquila From tim.one at home.com Fri Dec 14 17:35:40 2001 From: tim.one at home.com (Tim Peters) Date: Fri, 14 Dec 2001 17:35:40 -0500 Subject: CPython internal design question In-Reply-To: Message-ID: [Courageous] > The various different internal structures of python use > a definition strategy like this: > > typedef struct { > PyObject_HEAD > PyObject *im_func; /* The callable object implementing > the method */ > PyObject *im_self; /* The instance it is bound to, or NULL */ > PyObject *im_class; /* The class that asked for the method */ > PyObject *im_weakreflist; /* List of weak references */ > } PyMethodObject; > > What was the rationale behind the "im_" prefixes on all of > the structure's member variables? In this case "im" is (presumably) short for Instance Method, in all cases it makes it easy to find field references in the code base via simple search mechanisms, and in some cases it's a helpful reminder of what kind of object referencing code is mucking with. Note that there are more than 5,000 instances of the identifier "self" in the C portion of the Python code base. If you're specifically looking for uses of "self" in instance method structs, that there are only 18 hits on im_self greatly eases the task. the-simpler-the-conventions-the-simpler-the-needed-tools-ly y'rs - tim From MarkH at ActiveState.com Tue Dec 4 23:35:15 2001 From: MarkH at ActiveState.com (Mark Hammond) Date: Wed, 05 Dec 2001 04:35:15 GMT Subject: Embedding Python in C++ application: Question #1 References: <8a12e538.0112031616.674f37e8@posting.google.com> <3C0C3B3E.9030302@ActiveState.com> <8a12e538.0112040934.17df3790@posting.google.com> Message-ID: <3C0DA48E.8040408@ActiveState.com> Russell Turpin wrote: > Mark Hammond wrote in message news:<3C0C3B3E.9030302 at ActiveState.com>... > >>Py_BuildValue is a convenience function. >> > > OK. I'm finding the relevant interfaces in Python/C API. > Do I read this right, that all new objects are created > with a refcount of 1 , so that a called function > can pass them to the caller without ref-count manipulation? > Thus, I can call PyList_New() to create the list that will > be returned to the calling Python procedure, iteratively > pass the results of PyTuple_New() directly to > PyList_SetItem(), which "steals" the reference to the > tuple, and then return the list, all without a single > INCREF or DECREF? Which, of course, is the way it *ought* > to work, and that seems to be what it says .. In general you are correct. However you can't rely on the "Set" functions stealing a reference count - eg, PyTuple_SET_ITEM does, but I can never remember if PyTuple_SetItem() does :) Mark. From BPettersen at NAREX.com Thu Dec 6 12:46:40 2001 From: BPettersen at NAREX.com (Bjorn Pettersen) Date: Thu, 6 Dec 2001 10:46:40 -0700 Subject: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces) Message-ID: <60FB8BB7F0EFC7409B75EEEC13E20192158C85@admin56.narex.com> > From: Courageous [mailto:jkraska at san.rr.com] > > >> if isinstance(f, future.Step) or \ > >> isinstance(f, future.Status) or ... > > >klasses = [future.Step, future.Status, ...] > >if filter(lambda x: isinstance(f,x), klasses): > > You're really very annoying. Coming from someone that has kept this annoying thread alive for way too long I'll take that as a compliment. Thank you! -- bjorn Ps: Isn't it time for someone to call someone a space-nazi/tab-nazi so this thread can die? From Heather19i at aol.com Wed Dec 26 00:14:30 2001 From: Heather19i at aol.com (Heather19i at aol.com) Date: Wed, 26 Dec 2001 00:14:30 -0500 (EST) Subject: Hi there Message-ID: <200112260514.AAA21796@www.win.net> Below is the result of your feedback form. It was submitted by (Heather19i at aol.com) on Wednesday, December 26, 2001 at 00:14:30 --------------------------------------------------------------------------- message: Hi, my name is Heather and I am a 19 year old female from San Diego, California. Ever since my 14th birthday, I have been really sexually active, but I am still a virgin. Now I am 19 and away from home, attending school at San Diego State University and sharing a dorm with four of my girlfriends and are all VERY turned on to meet a guy and satisfy ALL of his pleasures. To see our sexy pictures we took just last week and to meet some other couples, go to our site
< a href="http://www.lllil.com/heather/livewebcam">http://www.lllil.com/heather/livewebcam


-1111 --------------------------------------------------------------------------- From kragen at pobox.com Sun Dec 2 04:42:48 2001 From: kragen at pobox.com (Kragen Sitaker) Date: 02 Dec 2001 04:42:48 -0500 Subject: which is best for a singleton, module or class? References: <9sbd8i$680$1@wanadoo.fr> <3C005692.173907B3@engcorp.com> <3C03275E.2C4D8149@engcorp.com> <3C045C07.BA7B3FE6@engcorp.com> <3C05AE56.E2261313@engcorp.com> <3c05b472$1@207.229.64.20> <3C05C9C3.ADC96FB5@engcorp.com> <8ef9bea6.0111290932.4afa618a@posting.google.com> <83elmftfbt.fsf@panacea.canonical.org> <8ef9bea6.0112011607.464fcd9f@posting.google.com> Message-ID: <83d71yq7on.fsf@panacea.canonical.org> hungjunglu at yahoo.com (Hung Jung Lu) writes: > > hungjunglu at yahoo.com (Hung Jung Lu) writes: > > > You can simply put your object into the __builtins__ namespace: > > Joke? :) It's not a joke. Zope Corporation (the same *obnoxious* > people that hired Guido, ha!) uses it. Experienced Python programmers > do use this device, sparingly, but they do use it, in real life. Well, the folks who wrote ZODB.Transaction (the one place in Zope that uses it) have probably written more Python code than I have, and it's certainly more widely used than my code. But I still think this trick is a bad idea, except when you're deliberately trying to write code that's hard to understand. What's wrong with from ZODB import Transaction Transaction.get() Still, using this trick once in 150,000 lines of Python is not so bad; there's only this one thing stuck into __builtins__, and it's used about 150 times. From edwardt at trillium.com Sun Dec 9 20:26:14 2001 From: edwardt at trillium.com (ed) Date: 9 Dec 2001 17:26:14 -0800 Subject: questions about of writing python scripts Message-ID: Hi I have a question regarding writing python scripts.. for large program written i python,, One thing i notice is it needs to run to the specifc piece of code i order to detect error. let's say the valaue is assigned to a wrong variables, I cannot know in advance, say I have b = 1 (defined way earlier) if x == 1: a = b else: a = c which a to be used as interger later on. x being passed in eariler. since b is deinfed I can assign to it, but c is floating and has not value and a got assgined to it. ... in other compiation lang, this type of error will be caught in compilaiton time, but I can't using python.. is ther any utility or way to catch this type of error way ahead? thankx From jdhunter at nitace.bsd.uchicago.edu Sat Dec 8 17:38:49 2001 From: jdhunter at nitace.bsd.uchicago.edu (John Hunter) Date: Sat, 08 Dec 2001 16:38:49 -0600 Subject: It's hard to find documentation References: Message-ID: >>>>> "Bruce" == Bruce Eckel writes: Bruce> So let's try to find "Extending and Embedding the Python Bruce> Interpreter". Using 'search,' using 'advanced search,' Bruce> nothing comes up with that title. Maybe it doesn't Bruce> exist. Who knows. I have this struggle a lot when hunting Bruce> for python information. I use the python info from within emacs, but any other info capable reader would so fine. Search (type 'syour search term') works great, and Extending and Embedding the Python Interpreter is a top level menu item. You even have regex search capabilities by default, but honest I almost never use them since simple keyword searches are usually what you are looking for in documentation. Word of warning, the info build is broken in the src build as of 2.1 (last time I tried). But you can grab info the tarball at ftp://ftp.python.org/pub/python/doc/2.1.1/ If you use emacs as your IDE, info is the way to go in my opinion. Otherwise, there may be a better solution under MS, which I gather you use from your previous posts. John Hunter From wealthychef at yahoo.com Tue Dec 25 18:25:02 2001 From: wealthychef at yahoo.com (wealthychef) Date: Tue, 25 Dec 2001 23:25:02 -0000 Subject: Can't exit python with ^D under certain circumstances Message-ID: Hi, this is weird to me, don't know how to fix. On my local python installation on machine A in a normal shell, ^ D works to exit Python as expected. On machine B on the console, ^D also works fine, but if I ssh to machine B from machine A and try to exit Python with ^D, Python does not exit, instead I get the following strange error message: >>> ^D File "", line 1 c ^ SyntaxError: invalid syntax What is printing here as a little 'c' is showing up in the terminal as maybe E F crammed into one character, or F F I can't quite read it. Can anyone help me? I'm no xmodmap dude, but i suspect some sort of keyboard confusion. The two systems are different. Machine A is running one flavor of Unix, and machine B is running another, each with radically different hardware. Is there another way to exit Python? Workaround? Fix? Thanks. From philh at comuno.freeserve.co.uk Wed Dec 12 14:26:29 2001 From: philh at comuno.freeserve.co.uk (phil hunt) Date: Wed, 12 Dec 2001 19:26:29 +0000 Subject: more fun with PEP 276 References: Message-ID: On Wed, 12 Dec 2001 09:12:48 -0800, David Eppstein wrote: >In article , > philh at comuno.freeserve.co.uk (phil hunt) wrote: > >> how about: >> >> for i in -5 to 5: >> >> or >> >> for i in -5 to 5 step 2: >> >> >> Here, "to" and "to...step" are keywords that create an xrange with the >> required values > >Not bad, but seems to force closed intervals only, which is somewhat at >odds with other features of Python. Another possibility would be to make .. part of the syntax for lists, i.e.: a = [ -5 .. 5, 10, 20 ] a is [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 10, 20] Of course, these features can be implemented in existing python, for example using functions fromTo() and fromToStep() for the 1st usage, and something like this for the second: a = buildList(range(-5, 5), 10, 20) etc. IOW any new feature would be mere syntactic sugar that would have the deficiency of making the compiler more complex. Maybe instead we should be looking at implementing a clever macro system as a preprocessor to Python. Something that could cope with ...to...step... would have to be quite complex, but a macro system that used function-call like syntax would be simpler. -- *** Philip Hunt *** philh at comuno.freeserve.co.uk *** From arno at research.att.com Mon Dec 10 18:56:21 2001 From: arno at research.att.com (Arno Puder) Date: Mon, 10 Dec 2001 23:56:21 GMT Subject: Q: PyObject* to toplevel module Message-ID: <3C154BA5.1050506@research.att.com> Hi, how do I get a pointer to the PyObject instance representing the toplevel module? Thx, Arno From rnd at onego.ru Sun Dec 2 10:20:22 2001 From: rnd at onego.ru (Roman Suzi) Date: Sun, 2 Dec 2001 18:20:22 +0300 (MSK) Subject: Draft PEP: string interpolation with backquotes In-Reply-To: <20011202080626.A76724@hishome.net> Message-ID: On Sun, 2 Dec 2001, Oren Tirosh wrote: >PEP: XXXX >Title: String interpolation with backquotes >Author: oren at hishome.net (Oren Tirosh) >Created: 2-Dec-2001 I am against this. It doesn't belong to Python. Also, such kind of interpolation is easily implemented without any syntactical additions, by function. i" is different from u" and r", because it is doable with a function. If we are concerned about readability, we do not need interpolation. Those who want it could easily use special library. Also i" has an impact on program efficiency, because ` ` will not be precompileble (or will it?) as the rest of Python code. Perl rules for interpolation are the messiest part of the language. Do we really need the mess in Python? Do we need to intermingle code and string data? What for? Yeas, sometimes such ability is needed. But I think it is solvable by special functions like documentTemplates (sp?) Sincerely yours, Roman Suzi -- _/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/ _/ Sunday, December 02, 2001 _/ Powered by Linux RedHat 6.2 _/ _/ "Old MacDonald had a computer with an EIE I/O" _/ From kevin at cazabon.com Mon Dec 3 12:27:31 2001 From: kevin at cazabon.com (Kevin Cazabon) Date: 3 Dec 2001 09:27:31 -0800 Subject: executing .pyc file References: <5.1.0.14.2.20011203134639.03256bd8@202.95.131.154> <5.1.0.14.2.20011203134639.03256bd8@202.95.131.154> Message-ID: <5a4226f0.0112030927.1744f637@posting.google.com> The trick I've always used on Windows is to distribute a separate .py file that simply imported and executed the proper function in the .pyc file. You should be able to directly execute a .py file this way. ex: #!/user/bin/python # .py file that can be freely distributed if __name__ == "__main__": import myPycFile main = myPycFile.main() I have no problem with that being in "readable" text, and it starts the .pyc properly when called directly. Kevin. ################ Tripp Scott wrote in message news:... > On 03/12/2001 16:34, Oleg Broytmann wrote: > >On Mon, Dec 03, 2001 at 01:53:41PM +0700, Tripp Scott wrote: > > > has someone written a trick so i can directly execute .pyc in > > > unix? > > > > http://www.lyra.org/greg/python/#dev > > cool. but the .pyc is now not valid for python (can't be > imported as usual). i think i'll settle with a script wrapping > the original .py, that way i can also get a shorter name. > > thanks, > t From tatebll at aol.com Sun Dec 30 17:40:06 2001 From: tatebll at aol.com (Bill Tate) Date: 30 Dec 2001 14:40:06 -0800 Subject: Python Popularity, python at sourceforge References: Message-ID: Roeland Rengelink wrote in message news:... > Hi, > > As was remarked earlier in this thread, a measure of Python's > popularity, if not quality, can be obtained by looking at the number > of sourceforge projects using Python. Below you'll find a number of > tables comparing sourceforge projects using Python to those using > Perl, PHP, Java, C and C++. These numbers were obtained by > screen-scraping the sourceforge trove pages. > > I started this analysis expecting to find clear evidence for Python's > - exploding popularity > - cross-platform usability > - ease of development > > Alas, the numbers are far more ambigious than I'd hoped. To summarize: > > 1. Python is the smallest of the 6 languages discussed here. > 2. Python is currently growing slower than PHP and Java, but faster > than C and Perl. > - Python has only been gaining on Perl for the last 6 months > - the difference in growth w.r.t PHP and Java may be getting smaller > 3. Java is more cross-platform than Python. Perl, C, C++ are less. > 4. There is no clear evidence for Python's ease of development. > You raise some interesting numbers, but I'm not sure I share some of your conclusions. The basis for your conclusions appear to be derived in large part from projects on sourceforge. While I don't disagree that the numbers could suggest something consistent with your conclusions, there's a couple of things worth noting. First, maturity of the language. Are the number of projects on sourceforge more indicative of the maturity (or lack thereof) of a language as opposed to inferring popularity or growth of the language. C is still hugely popular on Unix and Linux, but I wouldn't necessarily infer that the number of projects on sourceforge for C as being indicative of either its usage or popularity. For python, there is a huge, pre-existing standard library, much of which perhaps doesn't require a dedicated sourceforge project. Second, python developers routinely make use of extensions to existing C and C++ libraries. Many of these extensions do not require a specific project on sourceforge. They are distributed through various means and not necessarily through sourceforge. Third, project numbers do not necessarily equate to developer usage or preference of a particular language. Perhaps in concert with other measures (newsgroup/discussion group activity), something can be inferred about these numbers. Fourth - does the number of actual projects convey the degree of cross-platform support that already exists? Lastly, your numbers I believe omitted RUBY. Ruby appears to be gaining in popularity and the number of projects is increasing. Would your conclusions be the same (in terms of rate of growth rather than totals) had they incorporated into your numbers? WRT Exploding popularity - Regardless of what may or may not be happening, I'll take moderate and un-hyped growth anyday. Ease of Usage - Personally, I don't think we need numbers from Sourceforge to reach a conclusion here. I don't think there is an question on Python's ease of use. Its almost pro forma language that appears at the beginning of any sentence that starts with "What's Python?" From m.bless at gmx.de Sun Dec 30 18:52:36 2001 From: m.bless at gmx.de (Martin Bless) Date: Sun, 30 Dec 2001 23:52:36 GMT Subject: Manipulating Win32 attributes; newbie question. References: Message-ID: <3c2fa7ac.4031975@news.muenster.de> [Peter ]: >My problem is that I need to manipulate some Win32 specific file >attributes. Here's the route I'm exploring to address the same issue: if 1: import win32file print win32file.FILE_ALL_ACCESS print win32file.FILE_ATTRIBUTE_ARCHIVE print win32file.FILE_ATTRIBUTE_COMPRESSED print win32file.FILE_ATTRIBUTE_HIDDEN print win32file.FILE_ATTRIBUTE_NORMAL print win32file.FILE_ATTRIBUTE_OFFLINE print win32file.FILE_ATTRIBUTE_READONLY print win32file.FILE_ATTRIBUTE_SYSTEM print win32file.FILE_ATTRIBUTE_TEMPORARY fattr = win32file.GetFileAttributes( fname) print win32file.SetFileAttributes( fname, fattr ^ win32file.FILE_ATTRIBUTE_READONLY) # & and # | or # ^ xor # - # + # ~ invert = -(x+1) # reset readonly bit fattr = fattr & (win32file.FILE_ATTRIBUTE_READONLY ^ -1) Martin From mwh at python.net Sun Dec 30 16:41:14 2001 From: mwh at python.net (Michael Hudson) Date: Sun, 30 Dec 2001 21:41:14 GMT Subject: CEPort: I Need help with compile.c bug References: <3c2f4102_5@news.newsgroups.com> Message-ID: "Brad Clements" writes: > Sorry to post here, but I'm trying to figure out where in the 2.2 code to > look to solve this problem. > > I'm porting the release22-maint CVS checkout to CE 3.0 > > Seems to work okay, except that many of the regression tests fail because > the CE port is casting numbers to long somewhere... so numeric output has L > at end. > > I'm looking for a suggestion where to look in the code. It's on input, not > output, that the problem is occuring. I'm looking at the diffs and nothing > seems to stick out. Thanks for any suggestions.. Well, I'm baffled too. My only suggestions are for more things to try. > Here's an example on CE 3.0 > > >>> import dis > >>> def a(): x = 1 > >>> dis.dis(a) > 0L SET_LINENO 1L > > 3L SET_LINENO 1L > 6L LOAD_CONST 1L (1L) > 9L STORE_FAST 0L (x) > 12L LOAD_CONST 0L (None) > 15L RETURN_VALUE > > >>> x = 1 > >>> type(x) > > >>> Try these? ord('a') type(ord('a')) int("1") type(int("1")) eval("1") type(eval("1")) Cheers, M. From warren-postma at NOSPAM.rogers.com Wed Dec 12 16:52:13 2001 From: warren-postma at NOSPAM.rogers.com (Warren Postma) Date: Wed, 12 Dec 2001 21:52:13 GMT Subject: zope: compilation problem, can't make ISO_8859_1_Splitter Message-ID: Sorry for the slightly off-topic post. I am trying to get Zope 2.4.1 to compile on OpenBSD 2.8. I have searched Google and found that people do in fact have Zope up and running on OpenBSD. First off, compiling and installing Python 2.1.1 went off without a hitch, indicating to me a reasonable nice make/autoconf type environment, which seems to be what is required for building Python extensions. I ran "python wo_pcgi.py", and it got a fair ways into the building process, and then died inside of a Makefile, with the following being the most interesting error output: /usr/local/lib/python2.1/config/makesetup -m Makefile.pre -c /usr/local/lib/python2.1/config/config.c.in Setup -n /usr/local/lib/python2.1/config/Setup.config /usr/local/lib/python2.1/config/Setup.local /usr/local/lib/python2.1/config/Setup make make: don't know how to make ././src/ISO_8859_1_Splitter.c. Stop Now, there's a folder called ISO_8859_1_Splitter but there's no C file. The path of that folder it seems to want to think of as a C file is ~postma/Zope-2.4.1-src/lib/python/Products/PluginIndexes/TextIndex/Splitter/ ISO_8859_1_Splitter In case it was wo_pcgi.py that exhibits this problem, I also ran "python w_pcgi.py", which failed in the same way. Is this a case of me needing to Read a Million Pages of Documentation On How To Compile Zope, that I haven't read yet? Is there something I need to change in the configuration of Zope, or in Python, in order to get it to build on this platform? Can anyone who has done this on OpenBSD email me and tell me of any funny steps or configuration choices you made. Warren From jdhunter at nitace.bsd.uchicago.edu Sun Dec 30 21:35:44 2001 From: jdhunter at nitace.bsd.uchicago.edu (John Hunter) Date: Sun, 30 Dec 2001 20:35:44 -0600 Subject: introduction to xml in python References: Message-ID: >>>>> "Rajarshi" == Rajarshi Guha writes: Rajarshi> Hi, could somebody point me to some code/tutorial Rajarshi> describing how to use Python to parse XML - I tried Rajarshi> delving into the Python docs, but it seems Rajarshi> confusing. Whats the difference between expat and sax? Rajarshi> How can I generate a parsers etc. expat is a XML parser by James Clark written in C. SAX (Simple API XML) is an event driven API for XML parsing. You may need to do a little background research on XML parsing and event driven parsers before the python docs will start tom make sense to you. You may be interested in http://www.4suite.org, which provides a set of XML tools for use in python. There is also at least one book devoted to XML in python: http://vig.pearsoned.com/store/product/0,,store-562_banner-0_isbn-0130211192,00.html Have fun, John Hunter From djrassoc01 at mindspring.com Sat Dec 29 11:57:39 2001 From: djrassoc01 at mindspring.com (Dr. David J. Ritchie, Sr.) Date: Sat, 29 Dec 2001 10:57:39 -0600 Subject: Python Popularity: Questions and Comments References: <3C2CBACB.FBF3C3C9@mindspring.com> <3C2D47F0.6DF7C8BE@mindspring.com> Message-ID: <3C2DF5FF.E332F4EE@mindspring.com> "Dr. David J. Ritchie, Sr." wrote: > ...I am probably on shaky > ground here due to ignorance... At least on topic in regard to the above anyway ;-} and somewhat on the topic of what doex language X have that makes it more attractive (or less attractive) than Python, I'd like to say that it almost seems like Python is not that far away from allowing as a language feature: from module.python.org import * or from module.python.org import graphics where "module.python.org" is some internet node. It would seem that such a feature would embrace and include as part of Python the Java capability of incorporating classes over the net and up the ante on the .net initiative (remember what I said about ignorance here). Wouldn't this go some way towards solving the problem of encouraging more module sharing a la Perl's CPAN but in a Python-esque way...? -- Dr. David J. Ritchie, Sr. djrassoc01 at mindspring.com http://home.mindspring.com/~djrassoc01/ From bbollenbach at home.com Sun Dec 9 17:43:08 2001 From: bbollenbach at home.com (Brad Bollenbach) Date: Sun, 09 Dec 2001 22:43:08 GMT Subject: join vs instances References: Message-ID: <0ORQ7.45322$pP5.5644649@news1.rdc1.mb.home.com> In article , Robin Becker wrote: > I had expected that the join operation would also apply to UserStrings > somehow or that there would be some magic method that would allow join > to be applied to user strings, but I can't find out how. What is the > primitive implementation of join? This raises an interesting point. In looking at UserString.py, it's clear that the author of that module /intended/ UserString instances to look like regular strings (__str__, __rep__, etc. all return self.data). Perhaps this string-look-alike behaviour breaks with builtin functions, because they subvert the special class methods. From marklists at mceahern.com Thu Dec 20 14:42:27 2001 From: marklists at mceahern.com (Mark McEahern) Date: Thu, 20 Dec 2001 11:42:27 -0800 Subject: elegent sql building In-Reply-To: <9vtcim$dnp$1@scotsman.ed.ac.uk> Message-ID: Rethink: criteria1 = Criteria(name1, operators.lessThan, value1) criteria2 = Criteria(name2, operators.in, value2) criteriaGroup = CriteriaGroup() criteriaGroup.and(criteria1) criteriaGroup.and(criteria2) criteriaGroup.or(criteria3) sql = object.buildSqlSelect(criteriaGroup) // mark From strombrg at seki.acs.uci.edu Mon Dec 3 15:30:57 2001 From: strombrg at seki.acs.uci.edu (Dan Stromberg) Date: 3 Dec 2001 20:30:57 GMT Subject: D-H, buffered socket and ssh wrapper modules in pure python Message-ID: <9ugne1$7ot$1@news.service.uci.edu> I've placed a Diffie-Helman module in pure python at ftp://autoinst.acs.uci.edu/pub/python/dh . Comments on how to improve it are desired. I am NOT a cryptographer, so it may be worse than useless. Also included is a buffered socket implementation to prevent uncommon-but-possible short reads from being a problem in your code. Comments on this too are desired. A coworker has written an ssh wrapper module. Is anyone interested in seeing it? I could dig up permission from him to release it I think, and I'd personally kind of like seeing it get some peer review. -- Dan Stromberg UCI/NACS/DCS From ens_z at yahoo.com Mon Dec 10 03:05:48 2001 From: ens_z at yahoo.com (Ens) Date: 10 Dec 2001 00:05:48 -0800 Subject: Unicode Fonts in wxPython Message-ID: <39ce62b8.0112100005.47d84b2a@posting.google.com> How can i use unicode fonts in wxPython? i want to use an other language. thank From store_li at sina.com Sat Dec 15 21:21:34 2001 From: store_li at sina.com (Kick) Date: Sun, 16 Dec 2001 10:21:34 +0800 Subject: Which widget can read BMP file References: <9v979p$dtuud$1@ID-12869.news.dfncis.de> Message-ID: <9vh0ie$fcnvl$1@ID-12869.news.dfncis.de> Thank you. I have got it. "Syver Enstad" wrote in message news:uheqvae32.fsf at online.no... > "Kick" writes: > > > It seems that BitmapImage class can only read ppm file, and Photoimage > > class > > > > recognize gif file not bmp file. > > > > Is it true? If so, what class or widget allow me working with bmp > > file? > > Get PIL from pythonworks, it supplies more able versions of the > BitmapImage and PhotoImage, while having the same interface as the > original tkinter classes. Indispensible stuff in my opinion. > > > -- > > Vennlig hilsen > > Syver Enstad From j.barelds at good-it.com Wed Dec 12 16:07:20 2001 From: j.barelds at good-it.com (Johan Barelds) Date: Wed, 12 Dec 2001 22:07:20 +0100 Subject: time() returns strange message... Message-ID: <9v8gu9$44e$1@news.hccnet.nl> Hi all, I am trying to use the time() function which strange results. My code is the following: ========================================== import time print time() ========================================== the result is: ========================================== Traceback (most recent call last): File "./fundsalert.py", line 74, in ? print time() TypeError: object of type 'module' is not callable ========================================== anyone any clues?? Thanks! -- Kind Regards / Met vriendelijke groet, Johan Barelds, Good-IT! BV Strijplaan 320 2285 HZ ?Rijswijk(ZH) Email ?j.barelds at good-it.com Tel. ? +31(0)70-3965230 Fax. ?+31(0)70-3965271 Mob. +31(0)6-54253750 From sdm7g at Virginia.EDU Fri Dec 21 16:43:35 2001 From: sdm7g at Virginia.EDU (Steven Majewski) Date: Fri, 21 Dec 2001 16:43:35 -0500 (EST) Subject: age of new pythonistas In-Reply-To: Message-ID: On Fri, 21 Dec 2001, Fredrik Lundh wrote: > Tim Peters wrote: > > I suspect Fredrik Lundh also knows Mark's age, but you've seen > > how hard it is to get a straight answer from a bot. > > iirc, Barry's a few years older than Mark (or was it the other > way around?), and I'm a few years older than my sister. The elevator boy -- is HE part of your family ? -- Steve From jkraska at san.rr.com Mon Dec 10 20:19:15 2001 From: jkraska at san.rr.com (Courageous) Date: Tue, 11 Dec 2001 01:19:15 GMT Subject: Wanted: pointer to detailed PyTypeObject documentation Message-ID: Does anyone have a pointer to something which documents what each attribute of the PyTypeObject is for? My Essential Reference is a bit out of date, and I can't find online what the exact meaning of some of the additional attributes are. C// From skip at pobox.com Mon Dec 17 17:54:11 2001 From: skip at pobox.com (Skip Montanaro) Date: Mon, 17 Dec 2001 16:54:11 -0600 Subject: Why no match? In-Reply-To: References: Message-ID: <15390.30611.318350.475010@12-248-41-177.client.attbi.com> Robin> my own stupidity the patter should be Robin> re.compile(r'^self\s*\.\s*test\s*=\s*\d+\s*$').match('self.test=11') Also, if you're using the match method there's no need to include "^" at the start. (Are there siutations where it makes a difference?) -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/) From grey at despair.dmiyu.org Wed Dec 12 20:12:13 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Thu, 13 Dec 2001 01:12:13 -0000 Subject: capturing output of os.system() into a list? References: Message-ID: On Thu, 13 Dec 2001 01:06:49 GMT, Ron wrote: > Is there a built-in method of doing this? I can write a function > to do it, but would rather use the standard method. os.popen() -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From glchapman at earthlink.net Sun Dec 2 10:36:53 2001 From: glchapman at earthlink.net (Greg Chapman) Date: Sun, 02 Dec 2001 15:36:53 GMT Subject: Python 2.2b1 dicts, iteration, and subclassing References: <3C07D496.5040308@post.harvard.edu> Message-ID: <7iik0usnlloru8jecml6rurm4te44r2daa@4ax.com> On Fri, 30 Nov 2001 18:46:12 GMT, Alexis Layton wrote: >The question for all you Pythonistas out there is, should it? To what >extent should >the built-in behavior of objects like dictionaries be affected by >subclassing? You might want to check out this message from GvR, which gives his thoughts on this topic: http://groups.google.com/groups?q=g:thl890282785d&hl=en&selm=mailman.1004342434.4625.python-list%40python.org --- Greg Chapman From Bruce at EckelObjects.com Fri Dec 7 10:04:54 2001 From: Bruce at EckelObjects.com (Bruce Eckel) Date: Fri, 07 Dec 2001 07:04:54 -0800 Subject: staticmethod and __call__ In-Reply-To: References: Message-ID: <200112070704540760.0012181D@mail.rdc1.sdca.home.com> I suppose a generator could be thought of as a special case of a factory, but it's generally considered a different kind of entity. *********** REPLY SEPARATOR *********** On 12/7/01 at 2:16 PM Luigi e Viviana Ballabio wrote: >Bruce, > >> class ItemGenerator: >> import random >> rgen = random.Random() >> items = [j for j in vars(Item).values() if isinstance(j, Item)] >> def __call__(): >> return ItemGenerator.rgen.choice(ItemGenerator.items) >> __call__ = staticmethod(__call__) > >> items = [ItemGenerator() for i in range(5)] > >apart from the __call__-not-being-overridden issue: > >since you are trying to Think in Patterns, and since what you are >after is some kind of random Item factory, it might make more sense >to name the above correspondingly, as in: > >class Item: > whatever > >class ItemFactory: > import random > etc > def create(): > return ItemFactory.rgen.choice(ItemFactory.items) > create = staticmethod(create) > >items = [ItemFactory.create() for i in range(5)] > >principle-of-least-surprisely yours, > Luigi > >-- Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming at earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar =================== From jkraska at san.rr.com Mon Dec 17 20:42:58 2001 From: jkraska at san.rr.com (Courageous) Date: Tue, 18 Dec 2001 01:42:58 GMT Subject: do not know what is wrong python under win2k References: <3C1E752E.8864E2E9@htp-tel.de> <5KuT7.15581$PA.12409@atlpnn01.usenetserver.com> <3C1E7E22.D6169237@htp-tel.de> <3C1E9C2B.38E9D6EF@engcorp.com> Message-ID: >> >>>> import spam.py > >Correction, "import spam" (no extension inside Python). Yuppers. Woops! :-) C// From ssthapa at classes.cs.uchicago.edu Sat Dec 8 15:06:37 2001 From: ssthapa at classes.cs.uchicago.edu (Suchandra Thapa) Date: Sat, 08 Dec 2001 20:06:37 GMT Subject: lost interest? References: Message-ID: Walter Moreira wrote: >The arguments about not having a working prototype, I think, are not >good. Suchandra Tappa has set up a server with siphon, but nobody has made >comments. > >Why do you think people is not interested? Didn't the community should try to >encourage something like siphon? > I've been curious about that also. However, I've been currently adding stuff so that it would be easier to use as well as creating auxiliary utilities for basic stuff. When I get the new version done (hopefully by monday), it would be nice to get some sort of response. -- ---------------------------------------------------------------------------- | Suchandra Thapa | "There are only two kinds of math . s-thapa-11 at NOSPAMalumni.uchicago.edu | books. Those you cannot read beyond | the first sentence, and those you | can not read beyond the first page." | -C.N. Yang ---------------------------------------------------------------------------- From zhangsc at neusoft.com Fri Dec 14 00:29:19 2001 From: zhangsc at neusoft.com (=?gb2312?B?1cXJ2bPb?=) Date: Fri, 14 Dec 2001 13:29:19 +0800 Subject: Connection reset by peer Message-ID: <010c01c18460$47ebff20$4301010a@sky> I encountered a question,when I deal with UDP socket connection,my programs existed.I have two programs,one is server.py,another is client.py ,I run them in two computers,server.py is at 10.1.1.27,client is at 10.1.1.67 ,my programs are follows: server.py #It works at IP address of 10.1.1.27 import socket,struct import os import string os.system("ifconfig eth0 promisc") Ethhdr='!BBBBBBBBBBBBH' Eth_len=struct.calcsize(Ethhdr) IPhdr='!bbhhhbbhll' IPhdr_len=struct.calcsize(IPhdr) UDPhdr='!HHHH' UDPhdr_len=struct.calcsize(UDPhdr) ipsock=socket.socket(socket.AF_INET,10,8) while 1: recvpack=ipsock.recv(1024) if len(recvpack) <= (Eth_len+IPhdr_len+UDPhdr_len): continue data=struct.unpack(Ethhdr,recvpack[:Eth_len]) if data[12]==2048: ipdata=struct.unpack(IPhdr,recvpack[Eth_len:Eth_len+IPhdr_len]) if ipdata[6]==socket.IPPROTO_UDP: udpdata=struct.unpack(UDPhdr,recvpack[Eth_len+IPhdr_len:Eth_len+IPhdr_len+UDPhdr_len]) if udpdata[1]==21567 or udpdata[0]==21567: #I get udpaddr from IP header of 32bit source ip address, #and I get udpdata[0] from UDP header of 16bit source port number. udpaddr="%i.%i.%i.%i" % (ipdata[8]>>24 & 255,ipdata[8]>>16 & 255,\ ipdata[8]>>8 & 255,ipdata[8] & 255) addr=udpaddr,udpdata[0] print type(addr) print addr #for some program design reason,I can't use data,addr=udpSerSock.recvfrom(BUFSIZ) to get addr, #because data,addr=udpSerSock.recvfrom(BUFSIZ) is conflict with recvpack=ipsock.recv(1024) udpSerSock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) data='hello! I have received message' udpSerSock.sendto(data,addr) udpSerSock.close() client.py #It works at IP address of 10.1.1.67 from socket import * import string HOST='10.1.1.27' PORT=21567 BUFSIZ=1024 ADDR=(HOST,PORT) udpCliSock=socket(AF_INET,SOCK_DGRAM) data=raw_input('>') udpCliSock.sendto(data,ADDR) print udpCliSock.getsockname() data, addr = udpCliSock.recvfrom(BUFSIZ) if data: print data udpCliSock.close() First,I run server.py at 10.1.1.27 $python server.py Then I run client.py at 10.1.1.67 $python client.py >hello The running result of server.py: ('10.1.1.67', 1165) $ The running result of client.py,it raise a error: ('0.0.0.0', 1165) Traceback (most recent call last): File "client.py", line 11, in ? data, addr = udpCliSock.recvfrom(BUFSIZ) socket.error: (104, 'Connection reset by peer') I know that my server.py don't use normal way to return data to client.py ,but I need this way! How to correct my programs? Any ideas will be appreciated! Thanks. Edward -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeff at ccvcorp.com Thu Dec 27 15:28:14 2001 From: jeff at ccvcorp.com (Jeff Shannon) Date: Thu, 27 Dec 2001 12:28:14 -0800 Subject: REPOST: Re: Replacing ActivePython? References: Message-ID: <7$--$$_----_-$-%_$@news.noc.cabal.int> David Brady wrote: > I know I'll need to grab win32all and install it... > what else should I do? For example, how do I make WSH > execute .pys files? They don't appear to be > recognized under the python.org sources. I'm assuming > that it's some sort of registry tweak that's handled > in the ActiveState installer. The win32all package includes scripts that will register Python for use by ActiveScripting (and thus, WSH). I don't recall exactly where, but I think underneath win32comext somewhere--it's discussed in the docs at some point. There may be other registration scripts that need to be run, as well, but I believe that installing win32all on top of PythonLabs Python yields almost exactly the same thing as ActivePython. Mind you, you'll still have to wait for Mark Hammond to build win32all for 2.2 .... though it sounds like he'll have lots of time to work on that now. :( (Wishing good karma to Mark...) Jeff Shannon Technician/Programmer Credit International ========= WAS CANCELLED BY =======: Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp.gblx.net!news-peer.gip.net!news-fw.gip.net!news.gsl.net!gip.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r From: Jeff Shannon Newsgroups: comp.lang.python Subject: cmsg cancel <3C2B845D.3A421FB6 at ccvcorp.com> Control: cancel <3C2B845D.3A421FB6 at ccvcorp.com> Date: Mon, 31 Dec 2001 04:36:25 GMT Organization: A poorly-installed InterNetNews site Lines: 2 Message-ID: NNTP-Posting-Host: 211.57.49.2 X-Trace: news2.kornet.net 1009775597 27193 211.57.49.2 (31 Dec 2001 05:13:17 GMT) X-Complaints-To: usenet at news2.kornet.net NNTP-Posting-Date: Mon, 31 Dec 2001 05:13:17 +0000 (UTC) X-No-Archive: yes X-Unac4ncel: yes X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999) This message was cancelled from within Mozilla. From loewis at informatik.hu-berlin.de Sun Dec 23 18:51:05 2001 From: loewis at informatik.hu-berlin.de (Martin von Loewis) Date: 24 Dec 2001 00:51:05 +0100 Subject: Can I trust mktime ? References: <67090aed4a.tim@worthy.demon.co.uk> Message-ID: Tim Howarth writes: > To find the date in 4 months time I've added to the months element of a > list copy of a localtime tuple. > > (Which obvioulsy means months can be >12.) > > Is converting this to a time() value with mktime then reading back with > localtime() considered correct/safe ? On a POSIX system, that might be safe. The mktime(3) documentation of glibc says # If structure members are outside their legal interval, they will be # normalized (so that, e.g., 40 October is changed into 9 November). I haven't actually verified that this is the POSIX semantics of the function, though. In any case, Python delegates this call to the C library, so you are left to the mercy of the C library's implementors. HTH, Martin From grey at despair.dmiyu.org Fri Dec 21 21:36:36 2001 From: grey at despair.dmiyu.org (Steve Lamb) Date: Sat, 22 Dec 2001 02:36:36 -0000 Subject: vi or emacs for editing Python on Linux? References: Message-ID: On Fri, 21 Dec 2001 18:50:17 +2328, Fernando P?rez wrote: > maxm wrote: >> One of my biggest problems in switching is my editor. On windows I use >> Ultraedit as a general editor, and i type really fast in it. Knowing the >> shortcuts and all. Every time I boot up one of my Linux machines I have a >> hard time editing files under the arcane unix editors. I have tried both >> emacs and vim and I disklike both! > I'm more of an Xemacs person than vi, but I'm not going to bash either here. > What I'm going to say is: when I started using linux, I already had some > fairly ingrained keyboard habits from windows, which I didn't want to lose. > So I spent some time customizing the keybindings for Xemacs (gvim didn't > exist at the time) to mimic a lot of what I knew from windows. The only > problem I now have is that even though I fly in Xemacs, I can't do anything > in a 'raw' emacs, I need *my* customizations :) > So my point is: both are excellent tools, but go with a graphical one (either > Xemacs or gvim). And before you go too far, spend some time fixing the > keyboard shortcuts to everything you already know, it will save you *a lot* > of grief. If shift-arrow selection is second nature to you, look at the > latest Xemacs version which finally implements it. I know this is a large quote but the context is needed. The problem with this suggestion is, as you said, you need your bindings. Now I'm not going to pull the typical "learn vi since it is everywhere" schtick. I found it bogus when it was spit in my face and I most certainly will not fire it off against anyone else. No, what I want to do is tell my path on getting to vim. What is important is the path, not the final destination. First real text editor that I could remember was WordStar. The real WordStar, not a clone. From there were 1-2 other oddball editors on a PC clone. Who knows what they were. Then there was a string of editors that used the WS keyset. VDE(?) and QEdit being the last two. There were also also all the built in editors that come with different things. Windows, OS/2 and console apps. So the first 4-5 years or so I'd gone through about 8-9 different editors with the WS keyset being the preferred. Somewhere in there I also started using unix (Good ol' Netcom). Started off with pico (shush) and settled on joe since it has a WS-esque keyboard. Stuck with joe for about a good 4-5 years. I was frustrated with it at times because it didn't do context highlighting. This is something I found that I liked from my Fido-Net days (GoldEd and GoldEd/2, mmmmm) and also found useful now that I was doing more coding. That began the search for a decent editor that would do context hightlighting that uses the WS keyset. None existed to my liking (I think to this day none do). BTW, through all this I was also using different applications on Windows and OS/2 with proprietary editors. I tried JED for a while and attempted to wrap it in joe keybindings. However the behavior of JED was different enough that I constantly got confused. I tried emacs for all of 10 minutes. This was because I figured that any editor whose two default ways of accessing help were also the two sequences commonly bound to BS/DEL clearly doesn't understand the concept. Yeah, ^? and ^H seem intuative to the neophyte but dang is it annoying to have help come up when I hit backspace. I got the typical "Well, you can always rebind that." True, but I expect an editor to have a bare minimum functionality from the start and that just blew it. I shouldn't have to learn how to configure the editor just to use backspace. Sorry, next. 'sides, I don't like the concept of emacs as it is. That left... dundundunnnnnn. vi. Now, I spent a paragraph slamming emacs so let me say that vi was worse than emacs in my mind. Anyone doubts me just go hit deja for my name in comp.editors and read my debates with people from my joe-centric perspecitve. Point is that vi was my last choice and if anything else would have worked I would have used that instead. In fact, vi is still my last choice. I use vim as my primary variant with nvi as my stand-by and vi is dead freakin' last. Now, vi is completely different than the WS keyset is. Even so once I sat down with vim and ran through its tutorial I was able to do basic edits without referring back to the tutorial or help all that often. In about two weeks I was as fast in vim as I was in joe. More so since I was editing code with context highlighting and that was helping me identify contextual mistakes readily. I don't think I was ever really unproductive, just had to get back up to speed. So it wasn't two weeks lost but rather some leasure time lost since I couldn't do things as fast as I could. So here I am at the end of that journey and I'm currently using vim. I'm not recommending vim. What I recommend is that the person pick an editor and learn it. It doesn't matter if it is emacs, vi, vim, elvis, nvi, jed, joe, fte or any other that I'm sure I've looked at over the years. pico, however, is right out. ;) In my experience once an editor is picked it is fairly trivial to relearn the keystrokes to go with the concepts. More time is spent learning how the editor behaviors differ than anything else. For example in joe marking is done by dropping a start and stop block marker. One can adjust either side by re-dropping the mark on either side. vim, AFAIK, doesn't have such a concept. It has a different "Shift-select" style behavior but it is not what joe does. Learning how to intergrate how that function worked in my editing style too longer than memorizing v|V|^V for the different methods of visual selects. I can comfortably switch between WS, joe, CUA (Windows|OS/2), CUA variants (like PMMail, TheBat!, basic editors built into other things, etc), vim, nvi and with some difficulty, vi. In fact on my desktop I switch between CUA and vim on a regular basis since I dislike how kmail & knode call an external editor. So I am typing this message in vim and replying to email in CUA. Anyway, point is not to try to wrap one editor in another editor's keystrokes. You're spending more time rebinding everything and working around how you think things should work than you would just learning the editor for what it is. -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. To email: Don't despair! | -- Lenny Nero, Strange Days -------------------------------+--------------------------------------------- From davebutlerREMOVE at hotmail.com Thu Dec 20 10:17:07 2001 From: davebutlerREMOVE at hotmail.com (Dave Butler) Date: Thu, 20 Dec 2001 15:17:07 GMT Subject: Python Hosting Questions References: Message-ID: Thanks, it looks interesting. But you need the $24.95 plan (or better) if you want MySQL. Others have included this in the basic plans. "Andrew Henshaw" wrote in message news:u22jvkf7chv447 at corp.supernews.com... > Geometric Engineer wrote: > > > BUMBLEBEE BUZZ: > > > > Might be worth your while to check out [http://www.your-site.com/]. > > They've > > got a good repuation, a good price ($60 a year), and full language support > > (I like PHP myself, but wanted to be able to use Python when time > > permits). > > > > - Grouchy Engineer > > > > "Dave Butler" wrote in message > > news:... > >> I have found a potential hosting company, http://www.hostignition.com , > >> that offers Python, Perl, PHP4, and JSP/Servlets for $5/month. This seems > >> almost too good to be true. Any thoughts? > > Also, check out http://www.featureprice.com at $4.95 per month. They > include this nice quote on their site: > > "Your account will be enabled to run Python 2.0 programs and scripts. Being > as powerful - some say even more powerful than PHP4 - Python is an > extremely versatile programming environment. This increasinly popular > language should be considered as a basis for any serious projects." > > From tim.one at home.com Sat Dec 15 14:47:13 2001 From: tim.one at home.com (Tim Peters) Date: Sat, 15 Dec 2001 14:47:13 -0500 Subject: "Pythonj Fatal error: UNREF invalid object In-Reply-To: Message-ID: [Courageous] > Regarding the subject line, what semantics causes the above fatal > error to occur, generally? Sorry, I've never seen it fail, so the only known cause is "Joe wrote an extension" . [Michael Hudson] > Looks like[1] it happens when internal gc structures get messed up. No, it's not a gc thing. In a debug build (Py_DEBUG), or when Py_TRACE_REFS is defined (Py_DEBUG implies Py_TRACE_REFS), the layout of Python objects changes, and *all* dynamically allocated Python objects (even those that don't participate in gc) are inserted in a doubly-linked list headed at refchain (a static vrbl in object.c). In practice this means all objects except for a handful of static type objects; it does include int objects and string objects and everything else, and is orthogonal to cyclic gc. The message in question occurs when it's time to deallocate an object O, but O doesn't appear to be in the doubly-linked list. It's hard to speculate about likely causes, since I really haven't seen it trigger. Plausible causes include: + Trying to delete an object twice (although I'd expect a memory fault then, since deleting it the first time would have set op->_ob_next = op->_ob_prev = NULL). + Not initializing an extension object correctly -- _Py_NewReference(ob) has to get called when an object pops into existence, in order to insert ob into refchain. But PyObject_Init ususally does that for you. If it's random memory corruption, perhaps defining SLOW_UNREF_CHECK will catch it earlier. From rnd at onego.ru Mon Dec 3 03:18:46 2001 From: rnd at onego.ru (Roman Suzi) Date: Mon, 3 Dec 2001 11:18:46 +0300 (MSK) Subject: Draft PEP: string interpolation with backquotes In-Reply-To: Message-ID: On Mon, 3 Dec 2001, Christian Tanzer wrote: > Oren Tirosh wrote: > > > > > The expression may be any valid Python expression not containing > > > > the backquote character. > > > > > > This is an unnecessary difference with current backtick expressions. It's > > > not particularly pretty to look at, but nested backtick expressions are > > > unambiguous and work fine. Artificially restricting them in this context > > > would be a wart (not to mention that you couldn't reuse the compiler code > > > that compiles them now). > > > > I am aware of this. The reason for this restriction is simplicity. > > String interpolation is meant for short expressions, often just a > > single name. In my proposed implementation most of the processing > > occurs at the tokenizer while parsing nested backtick expressions > > unambigously is a job for the parser so this keeps the implementation > > simple. A possible approach I have considered is to allow nested > > backticks inside interpolations as long as they are surrounded by at > > least one level of parens/braces etc. The tokenizer already counts > > paren levels for expressions extending across newlines. > > Did you consider using the $() notation instead of backticks? bash 2.x > supports this and it is much easier to read (in particular when > nested). It also would avoid the overloading of the backticks with two > completely different meanings. As I mentioned before, %(...)s or %{...}s notation would be even better and more Pythonish and more powerful than inline ` ` or innovation with $-signs. Sincerely yours, Roman A.Suzi -- - Petrozavodsk - Karelia - Russia - mailto:rnd at onego.ru - From debl2nonspammywhammy at bellatlantic.net Mon Dec 31 20:48:41 2001 From: debl2nonspammywhammy at bellatlantic.net (David Lees) Date: Tue, 01 Jan 2002 01:48:41 GMT Subject: Cancel messages References: <6e43133.0112310938.6f93f585@posting.google.com> Message-ID: <3C311584.3E97D48D@bellatlantic.net> For those of us who never hear of HipCrime before, is there anything I should be setting in my browswer when posting to prevent this sort of cancelation attack? David Lees Rob Mitchell wrote: > > Gerhard H?ring wrote in message news:... > > Le 28/12/01 ? 07:18, Syver Enstad ?crivit: > > > [...] > > > ========= WAS CANCELLED BY =======: > > > Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail > > > Message-ID: > > > Control: cancel > > > Subject: cmsg cancel > > > From: Syver Enstad > > > Newsgroups: comp.lang.python > > > X-No-Archive: yes > > > Lines: 2 > > > NNTP-Posting-Host: wonenara.ozemail.com.au > > > X-Trace: ozemail.com.au 1009643103 203.108.164.177 (Sun, 30 Dec 2001 03:25:03 EST) > > > NNTP-Posting-Date: Sun, 30 Dec 2001 03:25:03 EST > > > Organization: OzEmail Ltd, Australia > > > Distribution: world > > > Date: Sat, 29 Dec 2001 13:32:11 GMT > > > > > > This message was cancelled from within Mozilla. > > > > Just curious. > > > > What's going on here? A mailman bug from the mail <-> news gateway, or > > somebody coverage-testing their Mozilla?! > > It's HipCrime, who does this sort of thing all the time. Google has > archived thousands of these rogue cancels all originating from > 203.108.164.177 on December 13, 14, 15, 16, 17, 18, 20, 21, 29, 30, & > 31: > > http://groups.google.com/groups?q=203.108.164.177&num=100&hl=en&scoring=d > > I would first try complaining to abuse at ozemail.com.au , & then if the > rogue cancels continue after that date, to the newsfeeds propagating > the rogue cancel forgery floods to the rest of Usenet, as shown on the > Path line. For example, for the header above, one would complain to > concentric.net, home.com, look.ca, etc. If the abuse still continues > after that, these newsfeeds should be asked to block Ozemail entirely > until it demonstrates itself to be a responsible ISP. > > Rob From max at alcyone.com Mon Dec 31 20:56:03 2001 From: max at alcyone.com (Erik Max Francis) Date: Mon, 31 Dec 2001 17:56:03 -0800 Subject: Cancel messages References: <6e43133.0112310938.6f93f585@posting.google.com> <3C311584.3E97D48D@bellatlantic.net> Message-ID: <3C311733.EFE74714@alcyone.com> David Lees wrote: > For those of us who never hear of HipCrime before, is there anything I > should be setting in my browswer when posting to prevent this sort of > cancelation attack? No. -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ Laws are silent in time of war. \__/ Cicero Esperanto reference / http://www.alcyone.com/max/lang/esperanto/ An Esperanto reference for English speakers. From jason at jorendorff.com Mon Dec 31 23:03:16 2001 From: jason at jorendorff.com (Jason Orendorff) Date: Mon, 31 Dec 2001 22:03:16 -0600 Subject: does python support overloaded methods?(py newbie) In-Reply-To: Message-ID: > You /might/ say that it's a bigger deal in statically-typed > languages, but I think that's not even the case. Consider the > trouble that Python has handling coercions and binary > operators cleanly. Difficulty with type conversion rules and binary operators is not unique to Python. Languages with operator overloading have these problems, Python no more so than C++ or Ruby. ## Jason Orendorff http://www.jorendorff.com/ From peevee78 at yahoo.com Mon Dec 31 18:01:50 2001 From: peevee78 at yahoo.com (peevee78) Date: Mon, 31 Dec 2001 23:01:50 -0000 Subject: rtf reader\writer Message-ID: Hi I was wondering if there is a python module for reading and writing rtf files. I am currently planning a project that would generate an rtf file from text entered in a GUI. Thanks. peevee78. From lull at acm.org Mon Dec 31 18:29:15 2001 From: lull at acm.org (John Lull) Date: 31 Dec 2001 17:29:15 -0600 Subject: Basic threading questions References: Message-ID: aahz at panix.com (Aahz Maruch) wrote (with possible deletions): > Doesn't really answer your questions directly, but take a look at > http://starship.python.net/crew/aahz/ Care to expound about your comment on p. 74? >> Some common extensions: >> NumPy - no Thanks. Regards, John From logiplexsoftware at earthlink.net Mon Dec 31 18:35:14 2001 From: logiplexsoftware at earthlink.net (Cliff Wells) Date: Mon, 31 Dec 2001 15:35:14 -0800 Subject: wxBitmapFromImage function in wxPython? In-Reply-To: <3C30290F.C20213B0@cti.ecp.fr> References: <3C2F7BB3.577D3712@cti.ecp.fr> <3$--$$_----__-$-$$@news.noc.cabal.int> <3C30290F.C20213B0@cti.ecp.fr> Message-ID: <20011231153514.123b7e03.logiplexsoftware@earthlink.net> On Mon, 31 Dec 2001 09:59:59 +0100 Stephane SOPPERA wrote: > Yes that's it. > I'v only the version 2.2.7, not the last one. IIRC, older versions had this as a method of wxBitmap and wxImage (ConvertToImage and ConvertToBitmap, respectively - you'll need to check the source to be sure). -- Cliff Wells Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308 From gkang at earthlink.net Mon Dec 31 20:36:34 2001 From: gkang at earthlink.net (GK) Date: 31 Dec 2001 17:36:34 -0800 Subject: 'pstruct' structure parser and python Message-ID: <8a5557a9.0112311736.77f2b048@posting.google.com> Has anyone developed a tool in PYTHON that is similar to PERL's 'pstruct' ? 'pstruct' is a basically a C structure parser that outputs offset information about structure members in an ascii file. Thanks! From mkelly2002NOSPAM at earthlink.net Mon Dec 31 20:27:33 2001 From: mkelly2002NOSPAM at earthlink.net (Michael Kelly) Date: Tue, 01 Jan 2002 01:27:33 GMT Subject: does python support overloaded methods?(py newbie) References: Message-ID: On Mon, 31 Dec 2001 19:43:06 -0500, "David Abrahams" wrote: >It really has nothing to do with compiled vs. non-compiled languages. >Overloading gives us a mechanism to non-intrusively extend the semantics of >a construct, and it's the only clean way to deal with the problem of >multi-methods. I have a funny feelin' you get into that stuff about proving algebraically that a function cannot fail. :) 'sides, I'm not sure if you're answering my post or the previous guy. I have no desire to non-intrusively extend a construct, just use the language features I find most appealing. :) Mike -- "I don't want to belong to any club that would have me as a member." -- Groucho Marx From howardk at cts.com Mon Dec 31 22:01:25 2001 From: howardk at cts.com (Howard Knight) Date: 01 Jan 2002 03:01:25 GMT Subject: Cancel messages References: <3c3097c7$0$79590$e2e8da3@nntp.cts.com> Message-ID: <3c312684$0$79590$e2e8da3@nntp.cts.com> Aahz Maruch (aahz at panix.com) wrote: > In article <3c3097c7$0$79590$e2e8da3 at nntp.cts.com>, > Howard Knight wrote: > >Aahz Maruch (aahz at panix.com) wrote: > >> > >> I don't think that cancels affect python-list, but the admins should > >> probably set up a filter to ignore the REPOST: articles based on the > >> X-Reposted-By: header. > > > >Actually, a better filter would be the "resurrector" pseudo site in the > >Path line. That way, if anyone else besides Guido resurrects posts, it > >will filter those out too. Here's a sample of one of Guido's Path > >lines: > > > > Path: ...!news.noc.cabal.int!resurrector!guidorepost!not-for-mail > > Possibly; what I meant, though, was filtering on the *existence* of > X-Reposted-By:, not the value of the header. That ought be more > efficent and just as accurate. For the mailing list, either one should work fine. For filtering on a news server itself, using the Path site filter is generally easier. So, if any of you are using a news server that does not honor cancels and you are still seeing the reposts, you should ask your news admin to drop all the reposts by filtering on the "resurrector" pseudo site. Howard From david.abrahams at rcn.com Mon Dec 31 19:43:06 2001 From: david.abrahams at rcn.com (David Abrahams) Date: Mon, 31 Dec 2001 19:43:06 -0500 Subject: does python support overloaded methods?(py newbie) References: Message-ID: "Michael Kelly" wrote in message news:o2p13us48lu0r1o1m5e069maqfra1oluv3 at 4ax.com... > >wanted to confirm this. Overloading method names(with parameters > >belonging to different types) is possible in python??. Not exactly. The Boost.Python library for creating extension modules in C++ supports overloading by linking all the overloads into a chain under the control of a single callable object. Each overload in the chain is tried until one succeeds. You could do something similar in pure Python, but for it to work smoothly you'd need to have some way to distinguish argument errors at the "outer level". In other words, if * f1() has overloads a, b, and c * overload b calls some function f2() * f2's argument list doesn't match you don't want to go on to try overload c, thinking that overload b's argument list failed to match. > Hmmmm, seems like this is a bigger deal in compiled > languages since it's usually more hassle to deal with > an indefinite number of arguments. Scripting languages > often have some catch-all syntax to get all the rest of > the args. It really has nothing to do with compiled vs. non-compiled languages. Overloading gives us a mechanism to non-intrusively extend the semantics of a construct, and it's the only clean way to deal with the problem of multi-methods. You /might/ say that it's a bigger deal in statically-typed languages, but I think that's not even the case. Consider the trouble that Python has handling coercions and binary operators cleanly. -Dave From eldiener at earthlink.net Mon Dec 31 22:30:38 2001 From: eldiener at earthlink.net (Edward Diener) Date: Tue, 01 Jan 2002 03:30:38 GMT Subject: Server side scripting with PSP Message-ID: <3C312D01.3020102@earthlink.net> I want to do my server side scripting with Python. Probably Python Server Pages. Is there an implementation of this around without using an application server or is Zope or Webware the way to go ? What think ye all. From mcfletch at rogers.com Mon Dec 31 20:11:44 2001 From: mcfletch at rogers.com (Mike C. Fletcher) Date: Mon, 31 Dec 2001 20:11:44 -0500 Subject: Properties fun with 2.2 References: Message-ID: <3C310CD0.3080805@rogers.com> The problem with that is, what if I want properties 'a' and '_a'? That is, if superclass X stores the value of "a" as "_a" in the object's slots, (if I understand correctly), then any assignment to _a (in a sub-class or not) will overwrite the value of a. When you store the data in the dict under the same name (a), then you only have the 1 name taken up in the namespace, there's no surprises, just a documented property accessed as if it were a regular attribute. That becomes a significant question when you're using "automagic" properties like those with which I started the thread (ones that don't know what their property names are until instantiated (and don't know the final conditions of the class), and which manage all of the data storage automagically). Simple and clean is the reason properties exist in my little version of the universe :) . Enjoy, Mike Martin von Loewis wrote: ... > Delegating to a different attribute might be appropriate: > > class X(object): > __slots__ = ['_a'] > def set_a(self, val): > self._a = val > def get_a(self): > return self._a > a = property(get_a, set_a) > > Regards, > Martin _______________________________________ Mike C. Fletcher http://members.rogers.com/mcfletch/